Initial commit.

This commit is contained in:
Orne Brocaar
2022-04-06 21:18:32 +01:00
commit 96fe672fc7
709 changed files with 335482 additions and 0 deletions

View File

@ -0,0 +1,738 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "ApplicationProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// ApplicationService is the service providing API methods for managing applications.
service ApplicationService {
// Create creates the given application.
rpc Create(CreateApplicationRequest) returns (CreateApplicationResponse) {}
// Get the application for the given ID.
rpc Get(GetApplicationRequest) returns (GetApplicationResponse) {}
// Update updates the given application.
rpc Update(UpdateApplicationRequest) returns (google.protobuf.Empty) {}
// Delete the application for the given ID.
rpc Delete(DeleteApplicationRequest) returns (google.protobuf.Empty) {}
// Get the list of applications.
rpc List(ListApplicationsRequest) returns (ListApplicationsResponse) {}
// List all configured integrations.
rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse) {}
// Create HTTP integration.
rpc CreateHttpIntegration(CreateHttpIntegrationRequest) returns (google.protobuf.Empty) {}
// Get the configured HTTP integration.
rpc GetHttpIntegration(GetHttpIntegrationRequest) returns (GetHttpIntegrationResponse) {}
// Update the HTTP integration.
rpc UpdateHttpIntegration(UpdateHttpIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete the HTTP integration.
rpc DeleteHttpIntegration(DeleteHttpIntegrationRequest) returns (google.protobuf.Empty) {}
// Create InfluxDb integration.
rpc CreateInfluxDbIntegration(CreateInfluxDbIntegrationRequest) returns (google.protobuf.Empty) {}
// Get InfluxDb integration.
rpc GetInfluxDbIntegration(GetInfluxDbIntegrationRequest) returns (GetInfluxDbIntegrationResponse) {}
// Update InfluxDb integration.
rpc UpdateInfluxDbIntegration(UpdateInfluxDbIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete InfluxDb integration.
rpc DeleteInfluxDbIntegration(DeleteInfluxDbIntegrationRequest) returns (google.protobuf.Empty) {}
// Create ThingsBoard integration.
rpc CreateThingsBoardIntegration(CreateThingsBoardIntegrationRequest) returns (google.protobuf.Empty) {}
// Get ThingsBoard integration.
rpc GetThingsBoardIntegration(GetThingsBoardIntegrationRequest) returns (GetThingsBoardIntegrationResponse) {}
// Update ThingsBoard integration.
rpc UpdateThingsBoardIntegration(UpdateThingsBoardIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete ThingsBoard integration.
rpc DeleteThingsBoardIntegration(DeleteThingsBoardIntegrationRequest) returns (google.protobuf.Empty) {}
// Create myDevices integration.
rpc CreateMyDevicesIntegration(CreateMyDevicesIntegrationRequest) returns (google.protobuf.Empty) {}
// Get myDevices integration.
rpc GetMyDevicesIntegration(GetMyDevicesIntegrationRequest) returns (GetMyDevicesIntegrationResponse) {}
// Update myDevices integration.
rpc UpdateMyDevicesIntegration(UpdateMyDevicesIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete myDevices integration.
rpc DeleteMyDevicesIntegration(DeleteMyDevicesIntegrationRequest) returns (google.protobuf.Empty) {}
// Create LoRaCloud integration.
rpc CreateLoraCloudIntegration(CreateLoraCloudIntegrationRequest) returns (google.protobuf.Empty) {}
// Get LoRaCloud integration.
rpc GetLoraCloudIntegration(GetLoraCloudIntegrationRequest) returns (GetLoraCloudIntegrationResponse) {}
// Update LoRaCloud integration.
rpc UpdateLoraCloudIntegration(UpdateLoraCloudIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete LoRaCloud integration.
rpc DeleteLoraCloudIntegration(DeleteLoraCloudIntegrationRequest) returns (google.protobuf.Empty) {}
// Create GCP Pub/Sub integration.
rpc CreateGcpPubSubIntegration(CreateGcpPubSubIntegrationRequest) returns (google.protobuf.Empty) {}
// Get GCP Pub/Sub integration.
rpc GetGcpPubSubIntegration(GetGcpPubSubIntegrationRequest) returns (GetGcpPubSubIntegrationResponse) {}
// Update GCP Pub/Sub integration.
rpc UpdateGcpPubSubIntegration(UpdateGcpPubSubIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete GCP Pub/Sub integration.
rpc DeleteGcpPubSubIntegration(DeleteGcpPubSubIntegrationRequest) returns (google.protobuf.Empty) {}
// Create AWS SNS integration.
rpc CreateAwsSnsIntegration(CreateAwsSnsIntegrationRequest) returns (google.protobuf.Empty) {}
// Get AWS SNS integration.
rpc GetAwsSnsIntegration(GetAwsSnsIntegrationRequest) returns (GetAwsSnsIntegrationResponse) {}
// Update AWS SNS integration.
rpc UpdateAwsSnsIntegration(UpdateAwsSnsIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete AWS SNS integration.
rpc DeleteAwsSnsIntegration(DeleteAwsSnsIntegrationRequest) returns (google.protobuf.Empty) {}
// Create Azure Service-Bus integration.
rpc CreateAzureServiceBusIntegration(CreateAzureServiceBusIntegrationRequest) returns (google.protobuf.Empty) {}
// Get Azure Service-Bus integration.
rpc GetAzureServiceBusIntegration(GetAzureServiceBusIntegrationRequest) returns (GetAzureServiceBusIntegrationResponse) {}
// Update Azure Service-Bus integration.
rpc UpdateAzureServiceBusIntegration(UpdateAzureServiceBusIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete Azure Service-Bus integration.
rpc DeleteAzureServiceBusIntegration(DeleteAzureServiceBusIntegrationRequest) returns (google.protobuf.Empty) {}
// Create Pilot Things integration.
rpc CreatePilotThingsIntegration(CreatePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Get Pilot Things integration.
rpc GetPilotThingsIntegration(GetPilotThingsIntegrationRequest) returns (GetPilotThingsIntegrationResponse) {}
// Update Pilot Things integration.
rpc UpdatePilotThingsIntegration(UpdatePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Delete Pilot Things integration.
rpc DeletePilotThingsIntegration(DeletePilotThingsIntegrationRequest) returns (google.protobuf.Empty) {}
// Generates application ID specific client-certificate.
rpc GenerateMqttIntegrationClientCertificate(GenerateMqttIntegrationClientCertificateRequest) returns (GenerateMqttIntegrationClientCertificateResponse) {}
}
enum Encoding {
JSON = 0;
PROTOBUF = 1;
}
enum IntegrationKind {
HTTP = 0;
INFLUX_DB = 1;
THINGS_BOARD = 2;
MY_DEVICES = 3;
LORA_CLOUD = 4;
GCP_PUB_SUB = 5;
AWS_SNS = 6;
AZURE_SERVICE_BUS = 7;
PILOT_THINGS = 8;
MQTT_GLOBAL = 9;
}
message Application {
// Application ID (UUID).
// Note: on create this will be automatically generated.
string id = 1;
// Application name.
string name = 2;
// Application description.
string description = 3;
// Tenant ID (UUID).
string tenant_id = 4;
}
message ApplicationListItem {
// Application ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Application name.
string name = 4;
// Application description.
string description = 5;
}
message CreateApplicationRequest {
// Application object to create.
Application application = 1;
}
message CreateApplicationResponse {
// Application ID (UUID).
string id = 1;
}
message GetApplicationRequest {
// Application ID (UUID).
string id = 1;
}
message GetApplicationResponse {
// Application object.
Application application = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateApplicationRequest {
// Application object.
Application application = 1;
}
message DeleteApplicationRequest {
// Application ID (UUID).
string id = 1;
}
message ListApplicationsRequest {
// Max number of applications to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Tenant ID to list the applications for.
string tenant_id = 4;
}
message ListApplicationsResponse {
// Total number of applications.
uint32 total_count = 1;
// Result-set.
repeated ApplicationListItem result = 2;
}
message ListIntegrationsRequest {
// Application ID (UUID).
string application_id = 1;
}
message IntegrationListItem {
// Integration kind.
IntegrationKind kind = 1;
}
message ListIntegrationsResponse {
// Total number of integrations available within the result-set.
uint32 total_count = 1;
// Integrations within result-set.
repeated IntegrationListItem result = 2;
}
message HttpIntegration {
// Application ID (UUIO).
string application_id = 1;
// HTTP headers to set when making requests.
map<string, string> headers = 2;
// Payload encoding.
Encoding encoding = 3;
// Event endpoint URL.
// The HTTP integration will POST all events to this enpoint. The request
// will contain a query parameters "event" containing the type of the
// event.
string event_endpoint_url = 4;
}
message CreateHttpIntegrationRequest {
// Integration object to create.
HttpIntegration integration = 1;
}
message GetHttpIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetHttpIntegrationResponse {
// Integration object.
HttpIntegration integration = 1;
}
message UpdateHttpIntegrationRequest {
// Integration object to update.
HttpIntegration integration = 1;
}
message DeleteHttpIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
enum InfluxDbPrecision {
NS = 0;
U = 1;
MS = 2;
S = 3;
M = 4;
H = 5;
}
enum InfluxDbVersion {
INFLUXDB_1 = 0;
INFLUXDB_2 = 1;
}
message InfluxDbIntegration {
// Application ID (UUIO).
string application_id = 1;
// InfluxDb API write endpoint (e.g. http://localhost:8086/write).
string endpoint = 2;
// InfluxDb database name. (InfluxDb v1)
string db = 3;
// InfluxDb username. (InfluxDb v1)
string username = 4;
// InfluxDb password. (InfluxDb v1)
string password = 5;
// InfluxDb retention policy name. (InfluxDb v1)
string retention_policy_name = 6;
// InfluxDb timestamp precision (InfluxDb v1).
InfluxDbPrecision precision = 7;
// InfluxDb version.
InfluxDbVersion version = 8;
// Token. (InfluxDb v2)
string token = 9;
// Organization. (InfluxDb v2)
string organization = 10;
// Bucket. (InfluxDb v2)
string bucket = 11;
}
message CreateInfluxDbIntegrationRequest {
// Integration object to create.
InfluxDbIntegration integration = 1;
}
message GetInfluxDbIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetInfluxDbIntegrationResponse {
// Integration object.
InfluxDbIntegration integration = 1;
}
message UpdateInfluxDbIntegrationRequest {
// Integration object to update.
InfluxDbIntegration integration = 1;
}
message DeleteInfluxDbIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message ThingsBoardIntegration {
// Application ID (UUIO).
string application_id = 1;
// ThingsBoard server endpoint, e.g. https://example.com
string server = 2;
}
message CreateThingsBoardIntegrationRequest {
// Integration object to create.
ThingsBoardIntegration integration = 1;
}
message GetThingsBoardIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetThingsBoardIntegrationResponse {
// Integration object.
ThingsBoardIntegration integration = 1;
}
message UpdateThingsBoardIntegrationRequest {
// Integration object to update.
ThingsBoardIntegration integration = 1;
}
message DeleteThingsBoardIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message MyDevicesIntegration {
// Application ID (UUIO).
string application_id = 1;
// myDevices API endpoint.
string endpoint = 2;
}
message CreateMyDevicesIntegrationRequest {
// Integration object to create.
MyDevicesIntegration integration = 1;
}
message GetMyDevicesIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message GetMyDevicesIntegrationResponse {
// Integration object.
MyDevicesIntegration integration = 1;
}
message UpdateMyDevicesIntegrationRequest {
// Integration object to update.
MyDevicesIntegration integration = 1;
}
message DeleteMyDevicesIntegrationRequest {
// Application ID (UUIO).
string application_id = 1;
}
message LoraCloudIntegration {
// Application ID (UUID).
string application_id = 1;
// Modem & Geolocation Services configuration.
LoraCloudModemGeolocationServices modem_geolocation_services = 2;
}
message LoraCloudModemGeolocationServices {
// API token.
string token = 1;
// Device implements Modem / Modem-E stack.
bool modem_enabled = 2;
// Modem port (fPort).
// ChirpStack will only forward the FrmPayload to the MGS if the port
// is equal to the configured value.
uint32 modem_port = 3;
// GNSS port (fPort).
// ChirpStack will forward the FrmPayload to MGS as GNSS payload if the
// port is equal to the configured value.
uint32 gnss_port = 4;
// Use rx time for GNSS resolving.
// In case this is set to true, the MGS resolver will use the RX time of the
// network instead of the timestamp included in the LR1110 payload.
bool gnss_use_rx_time = 5;
// Parse TLV records.
// If enabled, stream records (expected in TLV format) are scanned for GNSS
// data (0x06 or 0x07). If found, ChirpStack will make an additional
// geolocation call to the MGS API for resolving the location of the detected
// payload.
bool parse_tlv = 6;
// Geolocation buffer TTL (in seconds).
// If > 0, uplink RX meta-data will be stored in a buffer so that
// the meta-data of multiple uplinks can be used for geolocation.
uint32 geolocation_buffer_ttl = 7;
// Geolocation minimum buffer size.
// If > 0, geolocation will only be performed when the buffer has
// at least the given size.
uint32 geolocation_min_buffer_size = 8;
// TDOA based geolocation is enabled.
bool geolocation_tdoa = 9;
// RSSI based geolocation is enabled.
bool geolocation_rssi = 10;
// GNSS based geolocation is enabled (LR1110).
bool geolocation_gnss = 11;
// GNSS payload field.
// This holds the name of the field in the decoded payload object which
// contains the GNSS payload bytes (as HEX string).
string geolocation_gnss_payload_field = 12;
// GNSS use RX time.
// In case this is set to true, the resolver will use the RX time of the
// network instead of the timestamp included in the LR1110 payload.
bool geolocation_gnss_use_rx_time = 13;
// Wifi based geolocation is enabled.
bool geolocation_wifi = 14;
// Wifi payload field.
// This holds the name of the field in the decoded payload object which
// contains an array of objects with the following fields:
// * macAddress - e.g. 01:23:45:67:89:ab
// * signalStrength - e.g. -51 (optional)
string geolocation_wifi_payload_field = 15;
}
message CreateLoraCloudIntegrationRequest {
// Integration object to create.
LoraCloudIntegration integration = 1;
}
message GetLoraCloudIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetLoraCloudIntegrationResponse {
// Integration object.
LoraCloudIntegration integration = 1;
}
message UpdateLoraCloudIntegrationRequest {
// Integration object to update.
LoraCloudIntegration integration = 1;
}
message DeleteLoraCloudIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GcpPubSubIntegration {
// Application ID (UUID).
string application_id = 1;
// Encoding.
Encoding encoding = 2;
// Credentials file.
// This IAM service-account credentials file (JSON) must have the following Pub/Sub roles:
// * Pub/Sub Publisher
string credentials_file = 3;
// Project ID.
string project_id = 4;
// Topic name.
// This is the name of the Pub/Sub topic.
string topic_name = 5;
}
message CreateGcpPubSubIntegrationRequest {
// Integration object to create.
GcpPubSubIntegration integration = 1;
}
message GetGcpPubSubIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetGcpPubSubIntegrationResponse {
// Integration object.
GcpPubSubIntegration integration = 1;
}
message UpdateGcpPubSubIntegrationRequest {
// Integration object to update.
GcpPubSubIntegration integration = 1;
}
message DeleteGcpPubSubIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message AwsSnsIntegration {
// Application ID (UUID).
string application_id = 1;
// Encoding.
Encoding encoding = 2;
// AWS region.
string region = 3;
// AWS Access Key ID.
string access_key_id = 4;
// AWS Secret Access Key.
string secret_access_key = 5;
// Topic ARN.
string topic_arn = 6;
}
message CreateAwsSnsIntegrationRequest {
// Integration object to create.
AwsSnsIntegration integration = 1;
}
message GetAwsSnsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetAwsSnsIntegrationResponse {
// Integration object.
AwsSnsIntegration integration = 1;
}
message UpdateAwsSnsIntegrationRequest {
// Integration object to update.
AwsSnsIntegration integration = 1;
}
message DeleteAwsSnsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message AzureServiceBusIntegration {
// Application ID (UUID).
string application_id = 1;
// Encoding.
Encoding encoding = 2;
// Connection string.
string connection_string = 3;
// Publish name.
// This is the name of the topic or queue.
string publish_name = 4;
}
message CreateAzureServiceBusIntegrationRequest {
// Integration object to create.
AzureServiceBusIntegration integration = 1;
}
message GetAzureServiceBusIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetAzureServiceBusIntegrationResponse {
// Integration object.
AzureServiceBusIntegration integration = 1;
}
message UpdateAzureServiceBusIntegrationRequest {
// Integration object to create.
AzureServiceBusIntegration integration = 1;
}
message DeleteAzureServiceBusIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message PilotThingsIntegration {
// Application ID (UUID).
string application_id = 1;
// Server URL.
string server = 2;
// Authentication token.
string token = 3;
}
message CreatePilotThingsIntegrationRequest {
// Integration object to create.
PilotThingsIntegration integration = 1;
}
message GetPilotThingsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GetPilotThingsIntegrationResponse {
// Integration object.
PilotThingsIntegration integration = 1;
}
message UpdatePilotThingsIntegrationRequest {
// Integration object to update.
PilotThingsIntegration integration = 1;
}
message DeletePilotThingsIntegrationRequest {
// Application ID (UUID).
string application_id = 1;
}
message GenerateMqttIntegrationClientCertificateRequest {
// Application ID (UUID).
string application_id = 1;
}
message GenerateMqttIntegrationClientCertificateResponse {
// TLS certificate.
string tls_cert = 1;
// TLS key.
string tls_key = 2;
// CA certificate.
string ca_cert = 3;
// Expires at defines the expiration date of the certificate.
google.protobuf.Timestamp expires_at = 4;
}

View File

@ -0,0 +1,414 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
// DeviceService is the service providing API methods for managing devices.
service DeviceService {
// Create the given device.
rpc Create(CreateDeviceRequest) returns (google.protobuf.Empty) {}
// Get returns the device for the given DevEUI.
rpc Get(GetDeviceRequest) returns (GetDeviceResponse) {}
// Update the given device.
rpc Update(UpdateDeviceRequest) returns (google.protobuf.Empty) {}
// Delete the device with the given DevEUI.
rpc Delete(DeleteDeviceRequest) returns (google.protobuf.Empty) {}
// Get the list of devices.
rpc List(ListDevicesRequest) returns (ListDevicesResponse) {}
// Create the given device-keys.
rpc CreateKeys(CreateDeviceKeysRequest) returns (google.protobuf.Empty) {}
// Get the device-keys for the given DevEUI.
rpc GetKeys(GetDeviceKeysRequest) returns (GetDeviceKeysResponse) {}
// Update the given device-keys.
rpc UpdateKeys(UpdateDeviceKeysRequest) returns (google.protobuf.Empty) {}
// Delete the device-keys for the given DevEUI.
rpc DeleteKeys(DeleteDeviceKeysRequest) returns (google.protobuf.Empty) {}
// FlushDevNonces flushes the OTAA device nonces.
rpc FlushDevNonces(FlushDevNoncesRequest) returns (google.protobuf.Empty) {}
// Activate (re)activates the device with the given parameters (for ABP or for importing OTAA activations).
rpc Activate(ActivateDeviceRequest) returns (google.protobuf.Empty) {}
// Deactivate de-activates the device.
rpc Deactivate(DeactivateDeviceRequest) returns (google.protobuf.Empty) {}
// GetActivation returns the current activation details of the device (OTAA or ABP).
rpc GetActivation(GetDeviceActivationRequest) returns (GetDeviceActivationResponse) {}
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
rpc GetRandomDevAddr(GetRandomDevAddrRequest) returns (GetRandomDevAddrResponse) {}
// GetStats returns the device stats.
rpc GetStats(GetDeviceStatsRequest) returns (GetDeviceStatsResponse) {}
// Enqueue adds the given item to the downlink queue.
rpc Enqueue(EnqueueDeviceQueueItemRequest) returns (EnqueueDeviceQueueItemResponse) {}
// FlushQueue flushes the downlink device-queue.
rpc FlushQueue(FlushDeviceQueueRequest) returns (google.protobuf.Empty) {}
// GetQueue returns the downlink device-queue.
rpc GetQueue(GetDeviceQueueItemsRequest) returns (GetDeviceQueueItemsResponse) {}
}
message Device {
// DevEUI (EUI64).
string dev_eui = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Application ID (UUID).
string application_id = 4;
// Device-profile ID (UUID).
string device_profile_id = 5;
// Skip frame-counter checks (this is insecure, but could be helpful for debugging).
bool skip_fcnt_check = 6;
// Device is disabled.
bool is_disabled = 7;
// Variables (user defined).
// These variables can be used together with integrations to store tokens /
// secrets that must be configured per device. These variables are not
// exposed in the event payloads.
map<string, string> variables = 8;
// Tags (user defined).
// These tags are exposed in the event payloads or to integration. Tags are
// intended for aggregation and filtering.
map<string, string> tags = 9;
}
message DeviceStatus {
// The device margin status
// -32..32: The demodulation SNR ration in dB
int32 margin = 1;
// Device is connected to an external power source.
bool external_power_source = 2;
// Device battery level as a percentage.
// -1 when the battery level is not available.
float battery_level = 3;
}
message DeviceListItem {
// DevEUI (EUI64).
string dev_eui = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
// Name.
string name = 5;
// Description.
string description = 6;
// Device-profile ID (UUID).
string device_profile_id = 7;
// Device-profile name.
string device_profile_name = 8;
// Device status.
DeviceStatus device_status = 9;
}
message DeviceKeys {
// DevEUI (EUI64).
string dev_eui = 1;
// Network root key (128 bit).
// Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`!
string nwk_key = 2;
// Application root key (128 bit).
// Note: This field only needs to be set for LoRaWAN 1.1.x devices!
string app_key = 3;
}
message CreateDeviceRequest {
// Device object.
Device device = 1;
}
message GetDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceResponse {
// Device object.
Device device = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
// Device status.
DeviceStatus device_status = 5;
}
message UpdateDeviceRequest {
// Device object.
Device device = 1;
}
message DeleteDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message ListDevicesRequest {
// Max number of devices to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Application ID (UUID) to filter devices on.
string application_id = 4;
// Multicst-group ID (UUID) to filter devices on.
string multicast_group_id = 5;
}
message ListDevicesResponse {
// Total number of devices.
uint32 total_count = 1;
// Result-set.
repeated DeviceListItem result = 2;
}
message CreateDeviceKeysRequest {
// Device-keys object.
DeviceKeys device_keys = 1;
}
message GetDeviceKeysRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceKeysResponse {
// Device-keys object.
DeviceKeys device_keys = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceKeysRequest {
// Device-keys object.
DeviceKeys device_keys = 1;
}
message DeleteDeviceKeysRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message DeviceActivation {
// Device EUI (EUI64).
string dev_eui = 1;
// Device address (HEX encoded).
string dev_addr = 2;
// Application session key (HEX encoded).
string app_s_key = 3;
// Network session encryption key (HEX encoded).
string nwk_s_enc_key = 4;
// Serving network session integrity key (HEX encoded).
string s_nwk_s_int_key = 8;
// Forwarding network session integrity key (HEX encoded).
string f_nwk_s_int_key = 9;
// Uplink frame-counter.
uint32 f_cnt_up = 5;
// Downlink network frame-counter.
uint32 n_f_cnt_down = 6;
// Downlink application frame-counter.
uint32 a_f_cnt_down = 10;
}
message ActivateDeviceRequest {
// Device activation object.
DeviceActivation device_activation = 1;
}
message DeactivateDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceActivationRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceActivationResponse {
// Device activation object.
DeviceActivation device_activation = 1;
}
message GetRandomDevAddrRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetRandomDevAddrResponse {
// DevAddr.
string dev_addr = 1;
}
message GetDeviceStatsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
}
message GetDeviceStatsResponse {
repeated DeviceStats result = 1;
}
message DeviceStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
// Packets received from the device.
uint32 rx_packets = 2;
// Average RSSI (as reported by the gateway(s)).
float gw_rssi = 3;
// Average SNR (as reported by the gateway(s)).
float gw_snr = 4;
// Packets received by frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
// Packets received by DR.
map<uint32, uint32> rx_packets_per_dr = 6;
// Error count.
map<string, uint32> errors = 7;
}
message DeviceQueueItem {
// ID (UUID).
// This is automatically generated on enqueue.
string id = 1;
// Device EUI (EUI64).
string dev_eui = 2;
// Confirmed.
bool confirmed = 3;
// FPort (must be > 0).
uint32 f_port = 4;
// Data.
// Or use the json_object field when a codec has been configured.
bytes data = 5;
// Only use this when a codec has been configured that can encode this
// object to bytes.
google.protobuf.Struct object = 6;
// Is pending.
// This is set to true when the downlink is pending.
bool is_pending = 7;
// Downlink frame-counter.
// This is set when the payload has been sent as downlink.
uint32 f_cnt_down = 8;
}
message EnqueueDeviceQueueItemRequest {
DeviceQueueItem item = 1;
}
message EnqueueDeviceQueueItemResponse {
// ID (UUID).
string id = 1;
}
message FlushDeviceQueueRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}
message GetDeviceQueueItemsRequest {
// Device EUI (EUI64).
string dev_eui = 1;
// Return only the count, not the result-set.
bool count_only = 2;
}
message GetDeviceQueueItemsResponse {
// Total number of queue items.
uint32 total_count = 1;
// Result-set.
repeated DeviceQueueItem result = 2;
}
message FlushDevNoncesRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}

View File

@ -0,0 +1,235 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "chirpstack-api/common/common.proto";
enum CodecRuntime {
// None.
NONE = 0;
// Cayenne LPP.
CAYENNE_LPP = 1;
// JavaScript.
JS = 2;
}
// DeviceProfileService is the service providing API methods for managing device-profiles.
service DeviceProfileService {
// Create the given device-profile.
rpc Create(CreateDeviceProfileRequest) returns (CreateDeviceProfileResponse) {}
// Get the device-profile for the given ID.
rpc Get(GetDeviceProfileRequest) returns (GetDeviceProfileResponse) {}
// Update the given device-profile.
rpc Update(UpdateDeviceProfileRequest) returns (google.protobuf.Empty) {}
// Delete the device-profile with the given ID.
rpc Delete(DeleteDeviceProfileRequest) returns (google.protobuf.Empty) {}
// List the available device-profiles.
rpc List(ListDeviceProfilesRequest) returns (ListDeviceProfilesResponse) {}
// List available ADR algorithms.
rpc ListAdrAlgorithms(google.protobuf.Empty) returns (ListDeviceProfileAdrAlgorithmsResponse) {}
}
message DeviceProfile {
// Device-profile ID (UUID).
// Note: on create this will be automatically generated.
string id = 1;
// Tenant ID (UUID).
string tenant_id = 2;
// Name.
string name = 3;
// Region.
common.Region region = 4;
// LoRaWAN mac-version.
common.MacVersion mac_version = 5;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 6;
// ADR algorithm ID.
string adr_algorithm_id = 7;
// Payload codec runtime.
CodecRuntime payload_codec_runtime = 8;
// Payload codec encoder config.
string payload_encoder_config = 9;
// Payload codec decoder config.
string payload_decoder_config = 10;
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. When the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 11;
// Device-status request interval (times / day).
// This defines the times per day that ChirpStack will request the device-status
// from the device.
uint32 device_status_req_interval = 12;
// Supports OTAA.
bool supports_otaa = 13;
// Supports Class B.
bool supports_class_b = 14;
// Supports Class-C.
bool supports_class_c = 15;
// Class-B timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_b_timeout = 16;
// Class-B ping-slot periodicity.
uint32 class_b_ping_slot_period = 17;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 18;
// Class-B ping-slot freq (Hz).
uint32 class_b_ping_slot_freq = 19;
// Class-C timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_c_timeout = 20;
// RX1 delay (for ABP).
uint32 abp_rx1_delay = 21;
// RX1 DR offset (for ABP).
uint32 abp_rx1_dr_offset = 22;
// RX2 DR (for ABP).
uint32 abp_rx2_dr = 23;
// RX2 frequency (for ABP, Hz).
uint32 abp_rx2_freq = 24;
// User defined tags.
map<string, string> tags = 25;
}
message DeviceProfileListItem {
// Device-profile ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Region.
common.Region region = 5;
// LoRaWAN mac-version.
common.MacVersion mac_version = 6;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 7;
// Supports OTAA.
bool supports_otaa = 8;
// Supports Class-B.
bool supports_class_b = 9;
// Supports Class-C.
bool supports_class_c = 10;
}
message CreateDeviceProfileRequest {
// Object to create.
DeviceProfile device_profile = 1;
}
message CreateDeviceProfileResponse {
// ID (UUID).
string id = 1;
}
message GetDeviceProfileRequest {
// ID (UUID).
string id = 1;
}
message GetDeviceProfileResponse {
// Device-profile object.
DeviceProfile device_profile = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceProfileRequest {
// Device-profile object.
DeviceProfile device_profile = 1;
}
message DeleteDeviceProfileRequest {
// ID (UUID).
string id = 1;
}
message ListDeviceProfilesRequest {
// Max number of device-profiles to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// Tenant ID to list the device-profiles for.
string tenant_id = 4;
}
message ListDeviceProfilesResponse {
// Total number of device-profiles.
uint32 total_count = 1;
// Result-set.
repeated DeviceProfileListItem result = 2;
}
message ListDeviceProfileAdrAlgorithmsResponse {
// Total number of algorithms.
uint32 total_count = 1;
// Result-set.
repeated AdrAlgorithmListItem result = 2;
}
message AdrAlgorithmListItem {
// Algorithm ID.
string id = 1;
// Algorithm name.
string name = 2;
}

View File

@ -0,0 +1,61 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "FrameLogProto";
import "google/protobuf/timestamp.proto";
import "chirpstack-api/common/common.proto";
import "chirpstack-api/gw/gw.proto";
message UplinkFrameLog {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
// Message type.
common.MType m_type = 4;
// Device address (optional).
string dev_addr = 5;
// Device EUI (optional).
string dev_eui = 6;
// Time.
google.protobuf.Timestamp time = 7;
}
message DownlinkFrameLog {
// Time.
google.protobuf.Timestamp time = 1;
// PHYPayload.
bytes phy_payload = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
// Downlink ID (UUID).
string downlink_id = 4;
// Gateway ID (EUI64).
string gateway_id = 5;
// Message type.
common.MType m_type = 6;
// Device address (optional).
string dev_addr = 7;
// Device EUI (optional).
string dev_eui = 8;
}

View File

@ -0,0 +1,205 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "chirpstack-api/common/common.proto";
// GatewayService is the service providing API methods for managing gateways.
service GatewayService {
// Create creates the given gateway.
rpc Create(CreateGatewayRequest) returns (google.protobuf.Empty) {}
// Get returns the gateway for the given Gateway ID.
rpc Get(GetGatewayRequest) returns (GetGatewayResponse) {}
// Update updates the given gateway.
rpc Update(UpdateGatewayRequest) returns (google.protobuf.Empty) {}
// Delete deletes the gateway matching the given Gateway ID.
rpc Delete(DeleteGatewayRequest) returns (google.protobuf.Empty) {}
// Get the list of gateways.
rpc List(ListGatewaysRequest) returns (ListGatewaysResponse) {}
// Generate client-certificate for the gateway.
rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {}
// GetStats returns the gateway stats.
rpc GetStats(GetGatewayStatsRequest) returns (GetGatewayStatsResponse) {}
}
message Gateway {
// Gateway ID (EUI64).
string gateway_id = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Gateway location.
common.Location location = 4;
// Tenant ID (UUID).
string tenant_id = 5;
// Tags.
map<string, string> tags = 6;
// Properties (provided by the gateway).
map<string, string> properties = 7;
}
message GatewayListItem {
// Tenant ID.
string tenant_id = 1;
// Gateway ID (EUI64).
string gateway_id = 2;
// Name.
string name = 3;
// Description.
string description = 4;
// Location.
common.Location location = 5;
// Gateway properties.
map<string, string> properties = 6;
// Created at timestamp.
google.protobuf.Timestamp created_at = 7;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 8;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 9;
}
message CreateGatewayRequest {
// Gateway object.
Gateway gateway = 1;
}
message GetGatewayRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message GetGatewayResponse {
// Gateway object.
Gateway gateway = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
}
message UpdateGatewayRequest {
// Gateway object.
Gateway gateway = 1;
}
message DeleteGatewayRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message ListGatewaysRequest {
// Max number of gateways to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Tenant ID (UUID) to filter gateways on.
// To list all gateways as a global admin user, this field can be left blank.
string tenant_id = 4;
}
message ListGatewaysResponse {
// Total number of gateways.
uint32 total_count = 1;
// Result-set.
repeated GatewayListItem result = 2;
}
message GenerateGatewayClientCertificateRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message GenerateGatewayClientCertificateResponse {
// TLS certificate.
string tls_cert = 1;
// TLS key.
string tls_key = 2;
// CA certificate.
string ca_cert = 3;
// Expires at defines the expiration date of the certificate.
google.protobuf.Timestamp expires_at = 4;
}
message GetGatewayStatsRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
}
message GetGatewayStatsResponse {
repeated GatewayStats result = 1;
}
message GatewayStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
// Packets received.
uint32 rx_packets = 2;
// Packets emitted.
uint32 tx_packets = 3;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 4;
// Rx packets per frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
// Tx packets per DR.
map<uint32, uint32> tx_packets_per_dr = 6;
// Rx packets per DR.
map<uint32, uint32> rx_packets_per_dr = 7;
// Tx packets per status.
map<string, uint32> tx_packets_per_status = 8;
}

View File

@ -0,0 +1,300 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "InternalProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "chirpstack-api/api/user.proto";
// InternalService is the service providing API endpoints for internal usage.
service InternalService {
// Log in a user
rpc Login(LoginRequest) returns (LoginResponse) {}
// Get the current user's profile
rpc Profile(google.protobuf.Empty) returns (ProfileResponse) {}
// Perform a global search.
rpc GlobalSearch(GlobalSearchRequest) returns (GlobalSearchResponse) {}
// CreateApiKey creates the given API key.
rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) {}
// DeleteApiKey deletes the API key.
rpc DeleteApiKey(DeleteApiKeyRequest) returns (google.protobuf.Empty) {}
// ListApiKeys lists the available API keys.
rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) {}
// Get the global settings.
rpc Settings(google.protobuf.Empty) returns (SettingsResponse) {}
// OpenId Connect login.
rpc OpenIdConnectLogin(OpenIdConnectLoginRequest) returns (OpenIdConnectLoginResponse) {}
// GetDevicesSummary returns an aggregated summary of the devices.
rpc GetDevicesSummary(GetDevicesSummaryRequest) returns (GetDevicesSummaryResponse) {}
// GetGatewaysSummary returns an aggregated summary of the gateways.
rpc GetGatewaysSummary(GetGatewaysSummaryRequest) returns (GetGatewaysSummaryResponse) {}
// Stream frame for the given Gateway ID.
rpc StreamGatewayFrames(StreamGatewayFramesRequest) returns (stream LogItem) {}
// Stream frames for the given Device EUI.
rpc StreamDeviceFrames(StreamDeviceFramesRequest) returns (stream LogItem) {}
// Stream events for the given Device EUI.
rpc StreamDeviceEvents(StreamDeviceEventsRequest) returns (stream LogItem) {}
}
message ApiKey {
// API key ID.
// This value will be automatically generated on create.
string id = 1;
// Name.
string name = 2;
// Is global admin key.
bool is_admin = 3;
// Tenant ID.
// In case the API key is intended to manage resources under a single tenant.
string tenant_id = 4;
}
message CreateApiKeyRequest {
// The API key to create.
ApiKey api_key = 1;
}
message CreateApiKeyResponse {
// API key ID.
string id = 1;
// API token for authentication API requests.
string token = 2;
}
message DeleteApiKeyRequest {
// API key ID.
string id = 1;
}
message ListApiKeysRequest {
// Max number of items to return.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// Return only admin keys.
bool is_admin = 3;
// Filter on tenant ID.
string tenant_id = 4;
}
message ListApiKeysResponse {
// Total number of API keys.
uint32 total_count = 1;
repeated ApiKey result = 2;
}
// Defines a tenant to which the user is associated.
message UserTenantLink {
// Created at timestamp.
google.protobuf.Timestamp created_at = 1;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 2;
// Tenant ID.
string tenant_id = 3;
// User is admin within the context of this tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 4;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 5;
// User is able to modify gateways.
bool is_gateway_admin = 6;
}
message LoginRequest {
// Email of the user.
string email = 1;
// Password of the user.
string password = 2;
}
message LoginResponse {
// The JWT tag to be used to access chirpstack-application-server interfaces.
string jwt = 1;
}
message ProfileResponse {
// User object.
User user = 1;
// Tenants to which the user is associated.
repeated UserTenantLink tenants = 3;
}
message GlobalSearchRequest {
// Search query.
string search = 1;
// Max number of results to return.
int64 limit = 2;
// Offset offset of the result-set (for pagination).
int64 offset = 3;
}
message GlobalSearchResponse {
repeated GlobalSearchResult result = 1;
}
message GlobalSearchResult {
// Record kind.
string kind = 1;
// Search score.
float score = 2;
// Organization id.
string tenant_id = 3;
// Organization name.
string tenant_name = 4;
// Application id.
string application_id = 5;
// Application name.
string application_name = 6;
// Device DevEUI (hex encoded).
string device_dev_eui = 7;
// Device name.
string device_name = 8;
// Gateway MAC (hex encoded).
string gateway_id = 9;
// Gateway name.
string gateway_name = 10;
}
message SettingsResponse {
// OpenId Connect settings.
OpenIdConnect openid_connect = 1;
}
message OpenIdConnect {
// Enable OpenId Connect authentication.
bool enabled = 1;
// Login url.
string login_url = 2 [json_name = "loginURL"];
// Login label.
string login_label = 3;
// Logout url.
string logout_url = 4 [json_name = "logoutURL"];
}
message OpenIdConnectLoginRequest {
// OpenId Connect callback code.
string code = 1;
// OpenId Connect callback state.
string state = 2;
}
message OpenIdConnectLoginResponse {
// Token to use for authentication.
string token = 1;
}
message GetDevicesSummaryRequest {
// Tenant ID (UUID).
string tenant_id = 1;
}
message GetDevicesSummaryResponse {
// Active count.
uint32 active_count = 1;
// Inactive count.
uint32 inactive_count = 2;
// per data-rate count.
// Devices that have never been seen are excluded.
map<uint32, uint32> dr_count = 3;
// Never seen count.
uint32 never_seen_count = 4;
}
message GetGatewaysSummaryRequest {
// Tenant ID (UUID).
string tenant_id = 1;
}
message GetGatewaysSummaryResponse {
// Active count.
uint32 active_count = 1;
// Inactive count.
uint32 inactive_count = 2;
// Never seen count.
uint32 never_seen_count = 3;
}
message LogItem {
// ID.
string id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Message.
string description = 3;
// Body.
string body = 4;
// Properties.
map<string, string> properties = 5;
}
message StreamGatewayFramesRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message StreamDeviceFramesRequest {
// Device EUI.
string dev_eui = 1;
}
message StreamDeviceEventsRequest {
// Device EUI.
string dev_eui = 1;
}

View File

@ -0,0 +1,228 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "MulticastGroupProto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "chirpstack-api/common/common.proto";
// MulticastGroupService is the service managing multicast-groups.
service MulticastGroupService {
// Create the given multicast group.
rpc Create(CreateMulticastGroupRequest) returns (CreateMulticastGroupResponse) {}
// Get returns the multicast group for the given ID.
rpc Get(GetMulticastGroupRequest) returns (GetMulticastGroupResponse) {}
// Update the given multicast group.
rpc Update(UpdateMulticastGroupRequest) returns (google.protobuf.Empty) {}
// Delete the multicast-group with the given ID.
rpc Delete(DeleteMulticastGroupRequest) returns (google.protobuf.Empty) {}
// List the available multicast groups.
rpc List(ListMulticastGroupsRequest) returns (ListMulticastGroupsResponse) {}
// Add a device to the multicast group.
rpc AddDevice(AddDeviceToMulticastGroupRequest) returns (google.protobuf.Empty) {}
// Remove a device from the multicast group.
rpc RemoveDevice(RemoveDeviceFromMulticastGroupRequest) returns (google.protobuf.Empty) {}
// Add the given item to the multcast group queue.
rpc Enqueue(EnqueueMulticastGroupQueueItemRequest) returns (EnqueueMulticastGroupQueueItemResponse) {}
// Flush the queue for the given multicast group.
rpc FlushQueue(FlushMulticastGroupQueueRequest) returns (google.protobuf.Empty) {}
// List the items in the multicast group queue.
rpc ListQueue(ListMulticastGroupQueueRequest) returns (ListMulticastGroupQueueResponse) {}
}
enum MulticastGroupType {
// Class C.
CLASS_C = 0;
// Class-B.
CLASS_B = 1;
}
message MulticastGroup {
// ID (UUID).
// This will be generated automatically on create.
string id = 1;
// Name.
string name = 2;
// Application ID.
// After creation, this can not be updated.
string application_id = 3;
// Region.
common.Region region = 4;
// Multicast address (HEX encoded DevAddr).
string mc_addr = 5;
// Multicast network session key (HEX encoded AES128 key).
string mc_nwk_s_key = 6;
// Multicast application session key (HEX encoded AES128 key).
string mc_app_s_key = 7;
// Frame-counter.
uint32 f_cnt = 8;
// Multicast group type.
MulticastGroupType group_type = 9;
// Data-rate.
uint32 dr = 10;
// Frequency (Hz).
uint32 frequency = 11;
// Ping-slot period (only for Class-B).
uint32 class_b_ping_slot_period = 12;
}
message MulticastGroupListItem {
// ID.
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Region.
common.Region region = 5;
// Multicast group type.
MulticastGroupType group_type = 6;
}
message CreateMulticastGroupRequest {
// Multicast group to create.
MulticastGroup multicast_group = 1;
}
message CreateMulticastGroupResponse {
// ID of created multicast group (UUID).
string id = 1;
}
message GetMulticastGroupRequest {
// Multicast group ID.
string id = 1;
}
message GetMulticastGroupResponse {
// Multicast group object.
MulticastGroup multicast_group = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateMulticastGroupRequest {
// Multicast group object to update.
MulticastGroup multicast_group = 1;
}
message DeleteMulticastGroupRequest {
// Multicast group iD.
string id = 1;
}
message ListMulticastGroupsRequest {
// Max number of multicast groups to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// Application ID to list the multicast groups for.
string application_id = 4;
}
message ListMulticastGroupsResponse {
// Total number of multicast groups.
uint32 total_count = 1;
// Result-test.
repeated MulticastGroupListItem result = 2;
}
message AddDeviceToMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Device EUI (HEX encoded).
string dev_eui = 2;
}
message RemoveDeviceFromMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Device EUI (HEX encoded).
string dev_eui = 2;
}
message MulticastGroupQueueItem {
// Multicast group ID.
string multicast_group_id = 1;
// Downlink frame-counter.
// This will be automatically set on enqueue.
uint32 f_cnt = 2;
// FPort (must be > 0).
uint32 f_port = 3;
// Payload.
bytes data = 4;
}
message EnqueueMulticastGroupQueueItemRequest {
// Multicast queue-item to enqueue.
MulticastGroupQueueItem multicast_group_queue_item = 1;
}
message EnqueueMulticastGroupQueueItemResponse {
// Frame-counter of the enqueued payload.
uint32 f_cnt = 1;
}
message FlushMulticastGroupQueueRequest {
// Multicast group ID.
string multicast_group_id = 1;
}
message ListMulticastGroupQueueRequest {
// Multicast group ID.
string multicast_group_id = 1;
}
message ListMulticastGroupQueueResponse {
repeated MulticastGroupQueueItem items = 1;
}

View File

@ -0,0 +1,261 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "InternalProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// TenantService is the service providing API methods for managing tenants.
service TenantService {
// Create a new tenant.
rpc Create(CreateTenantRequest) returns (CreateTenantResponse) {}
// Get the tenant for the given ID.
rpc Get(GetTenantRequest) returns (GetTenantResponse) {}
// Update the given tenant.
rpc Update(UpdateTenantRequest) returns (google.protobuf.Empty) {}
// Delete the tenant with the given ID.
rpc Delete(DeleteTenantRequest) returns (google.protobuf.Empty) {}
// Get the list of tenants.
rpc List(ListTenantsRequest) returns (ListTenantsResponse) {}
// Add an user to the tenant.
// Note: the user must already exist.
rpc AddUser(AddTenantUserRequest) returns (google.protobuf.Empty) {}
// Get the the tenant user for the given tenant and user IDs.
rpc GetUser(GetTenantUserRequest) returns (GetTenantUserResponse) {}
// Update the given tenant user.
rpc UpdateUser(UpdateTenantUserRequest) returns (google.protobuf.Empty) {}
// Delete the given tenant user.
rpc DeleteUser(DeleteTenantUserRequest) returns (google.protobuf.Empty) {}
// Get the list of tenant users.
rpc ListUsers(ListTenantUsersRequest) returns (ListTenantUsersResponse) {}
}
message Tenant {
// Tenant ID (UUID).
// Note: this value will be automatically generated on create.
string id = 1;
// Tenant name,
string name = 2;
// Tenant description.
string description = 3;
// Can the tenant create and "own" Gateways?
bool can_have_gateways = 4;
// Max. gateway count for tenant.
// When set to 0, the tenant can have unlimited gateways.
uint32 max_gateway_count = 5;
// Max. device count for tenant.
// When set to 0, the tenant can have unlimited devices.
uint32 max_device_count = 6;
// Private gateways.
// Gateways under this tenant are private.
bool private_gateways = 7;
}
message TenantListItem {
// Tenant ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Tenant name.
string name = 4;
// Can the tenant create and "own" Gateways?
bool can_have_gateways = 5;
// Gateways are private to tenant.
bool private_gateways = 6;
// Max gateway count.
// 0 = unlimited.
uint32 max_gateway_count = 7;
// Max device count.
// 0 = unlimited.
uint32 max_device_count = 8;
}
message CreateTenantRequest {
// Tenant object to create.
Tenant tenant = 1;
}
message CreateTenantResponse {
// Tenant ID.
string id = 1;
}
message GetTenantRequest {
// Tenant ID.
string id = 1;
}
message GetTenantResponse {
// Tenant object.
Tenant tenant = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateTenantRequest {
// Tenant object.
Tenant tenant = 1;
}
message DeleteTenantRequest {
// Tenant ID.
string id = 1;
}
message ListTenantsRequest {
// Max number of tenants to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
}
message ListTenantsResponse {
// Total number of tenants.
uint32 total_count = 1;
// Result-set.
repeated TenantListItem result = 2;
}
message TenantUser {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 3;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 4;
// User is able to modify gateways.
bool is_gateway_admin = 5;
// Email (only used on get and when adding a user to a tenant).
string email = 6;
}
message TenantUserListItem {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
// Created at timestamp.
google.protobuf.Timestamp created_at = 3;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 4;
// Email.
string email = 5;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 6;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 7;
// User is able to modify gateways.
bool is_gateway_admin = 8;
}
message AddTenantUserRequest {
// Tenant user object.
TenantUser tenant_user = 1;
}
message GetTenantUserRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
}
message GetTenantUserResponse {
// Tenant user object.
TenantUser tenant_user = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateTenantUserRequest {
// Tenant user object.
TenantUser tenant_user = 1;
}
message DeleteTenantUserRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
}
message ListTenantUsersRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// Max number of tenants to return in the result-set.
uint32 limit = 2;
// Offset in the result-set (for pagination).
uint32 offset = 3;
}
message ListTenantUsersResponse {
// Total number of tenants.
uint32 total_count = 1;
// Result-set.
repeated TenantUserListItem result = 2;
}

View File

@ -0,0 +1,153 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "UserProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// UserService is the service providing API methods for managing users.
service UserService {
// Create a new user.
rpc Create(CreateUserRequest) returns (CreateUserResponse) {}
// Get the user for the given ID.
rpc Get(GetUserRequest) returns (GetUserResponse) {}
// Update the given user.
rpc Update(UpdateUserRequest) returns (google.protobuf.Empty) {}
// Delete the user with the given ID.
rpc Delete(DeleteUserRequest) returns (google.protobuf.Empty) {}
// Get the list of users.
rpc List(ListUsersRequest) returns (ListUsersResponse) {}
// Update the password for the given user.
rpc UpdatePassword(UpdateUserPasswordRequest) returns (google.protobuf.Empty) {}
}
message User {
// User ID (UUID).
// Will be set automatically on create.
string id = 1;
// Set to true to make the user a global administrator.
bool is_admin = 4;
// Set to false to disable the user.
bool is_active = 5;
// E-mail of the user.
string email = 6;
// Optional note to store with the user.
string note = 7;
}
message UserListItem {
// User ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Email of the user.
string email = 4;
// Set to true to make the user a global administrator.
bool is_admin = 5;
// Set to false to disable the user.
bool is_active = 6;
}
message UserTenant {
// Tenant ID.
string tenant_id = 1;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 2;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 3;
// User is able to modify gateways.
bool is_gateway_admin = 4;
}
message CreateUserRequest {
// User object to create.
User user = 1;
// Password to set for the user.
string password = 2;
// Add the user to the following tenants.
repeated UserTenant tenants = 3;
}
message CreateUserResponse {
// User ID.
string id = 1;
}
message GetUserRequest {
// User ID.
string id = 1;
}
message GetUserResponse {
// User object.
User user = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateUserRequest {
// User object.
User user = 1;
}
message DeleteUserRequest {
// User ID.
string id = 1;
}
message ListUsersRequest {
// Max number of tenants to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
}
message ListUsersResponse {
// Total number of users.
uint32 total_count = 1;
// Result-set.
repeated UserListItem result = 2;
}
message UpdateUserPasswordRequest {
// User ID.
string user_id = 1;
// Password to set.
string password = 2;
}

View File

@ -0,0 +1,155 @@
syntax = "proto3";
package common;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/common";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
enum Modulation {
// LoRa
LORA = 0;
// FSK
FSK = 1;
// LR-FHSS
LR_FHSS = 2;
}
enum Region {
// EU868
EU868 = 0;
// US915
US915 = 2;
// CN779
CN779 = 3;
// EU433
EU433 = 4;
// AU915
AU915 = 5;
// CN470
CN470 = 6;
// AS923
AS923 = 7;
// AS923 with -1.80 MHz frequency offset
AS923_2 = 12;
// AS923 with -6.60 MHz frequency offset
AS923_3 = 13;
// (AS923 with -5.90 MHz frequency offset).
AS923_4 = 14;
// KR920
KR920 = 8;
// IN865
IN865 = 9;
// RU864
RU864 = 10;
// ISM2400 (LoRaWAN 2.4 GHz)
ISM2400 = 11;
}
enum MType {
// JoinRequest.
JOIN_REQUEST = 0;
// JoinAccept.
JOIN_ACCEPT = 1;
// UnconfirmedDataUp.
UNCONFIRMED_DATA_UP = 2;
// UnconfirmedDataDown.
UNCONFIRMED_DATA_DOWN = 3;
// ConfirmedDataUp.
CONFIRMED_DATA_UP = 4;
// ConfirmedDataDown.
CONFIRMED_DATA_DOWN = 5;
// RejoinRequest.
REJOIN_REQUEST = 6;
// Proprietary.
PROPRIETARY = 7;
}
enum MacVersion {
LORAWAN_1_0_0 = 0;
LORAWAN_1_0_1 = 1;
LORAWAN_1_0_2 = 2;
LORAWAN_1_0_3 = 3;
LORAWAN_1_0_4 = 4;
LORAWAN_1_1_0 = 5;
}
enum RegParamsRevision {
A = 0;
B = 1;
RP002_1_0_0 = 2;
RP002_1_0_1 = 3;
RP002_1_0_2 = 4;
RP002_1_0_3 = 5;
}
enum LocationSource {
// Unknown.
UNKNOWN = 0;
// GPS.
GPS = 1;
// Manually configured.
CONFIG = 2;
// Geo resolver (TDOA).
GEO_RESOLVER_TDOA = 3;
// Geo resolver (RSSI).
GEO_RESOLVER_RSSI = 4;
// Geo resolver (GNSS).
GEO_RESOLVER_GNSS = 5;
// Geo resolver (WIFI).
GEO_RESOLVER_WIFI = 6;
}
message Location {
// Latitude.
double latitude = 1;
// Longitude.
double longitude = 2;
// Altitude.
double altitude = 3;
// Location source.
LocationSource source = 4;
// Accuracy.
float accuracy = 5;
}
message KeyEnvelope {
// KEK label.
string kek_label = 1;
// AES key (when the kek_label is set, this value must first be decrypted).
bytes aes_key = 2;
}

View File

@ -0,0 +1,557 @@
syntax = "proto3";
package gw;
option go_package = "github.com/chirpstack/chirpstack-api/go/v4/gw";
option java_package = "io.chirpstack.api.gw";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
import "chirpstack-api/common/common.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
enum DownlinkTiming {
// Send the downlink immediately.
IMMEDIATELY = 0;
// Send downlink at the given delay (based on provided context).
DELAY = 1;
// Send at given GPS epoch value.
GPS_EPOCH = 2;
}
enum FineTimestampType {
// No fine-timestamp available.
NONE = 0;
// Encrypted fine-timestamp.
ENCRYPTED = 1;
// Plain fine-timestamp.
PLAIN = 2;
}
enum CRCStatus {
// No CRC.
NO_CRC = 0;
// Bad CRC.
BAD_CRC = 1;
// CRC OK.
CRC_OK = 2;
}
enum TxAckStatus {
// Ignored (when a previous item was already emitted).
IGNORED = 0;
// Packet has been programmed for downlink.
OK = 1;
// Rejected because it was already too late to program this packet for downlink.
TOO_LATE = 2;
// Rejected because downlink packet timestamp is too much in advance.
TOO_EARLY = 3;
// Rejected because there was already a packet programmed in requested timeframe.
COLLISION_PACKET = 4;
// Rejected because there was already a beacon planned in requested timeframe.
COLLISION_BEACON = 5;
// Rejected because requested frequency is not supported by TX RF chain.
TX_FREQ = 6;
// Rejected because requested power is not supported by gateway.
TX_POWER = 7;
// Rejected because GPS is unlocked, so GPS timestamp cannot be used.
GPS_UNLOCKED = 8;
// Downlink queue is full.
QUEUE_FULL = 9;
// Internal error.
INTERNAL_ERROR = 10;
}
message Modulation {
oneof parameters {
// LoRa modulation information.
LoRaModulationInfo lora = 3 [json_name = "loRa"];
// FSK modulation information.
FSKModulationInfo fsk = 4;
// LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss = 5 [json_name = "lrFHSS"];
}
}
message UplinkTXInfo {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation.
common.Modulation modulation = 2;
oneof modulation_info {
// LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 3 [json_name = "loRaModulationInfo"];
// FSK modulation information.
FSKModulationInfo fsk_modulation_info = 4;
// LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss_modulation_info = 5 [json_name = "lrFHSSModulationInfo"];
}
}
message LoRaModulationInfo {
// Bandwidth.
uint32 bandwidth = 1;
// Speading-factor.
uint32 spreading_factor = 2;
// Code-rate.
string code_rate = 3;
// Polarization inversion.
bool polarization_inversion = 4;
}
message FSKModulationInfo {
// Frequency deviation.
uint32 frequency_deviation = 1;
// FSK datarate (bits / sec).
uint32 datarate = 2;
}
message LRFHSSModulationInfo {
// Operating channel width (OCW) in Hz.
uint32 operating_channel_width = 1;
// Code-rate.
string code_rate = 2;
// Hopping grid number of steps.
uint32 grid_steps = 3;
}
message EncryptedFineTimestamp {
// AES key index used for encrypting the fine timestamp.
uint32 aes_key_index = 1;
// Encrypted 'main' fine-timestamp (ns precision part of the timestamp).
bytes encrypted_ns = 2 [json_name = "encryptedNS"];
// FPGA ID.
bytes fpga_id = 3 [json_name = "fpgaID"];
}
message PlainFineTimestamp {
// Full timestamp.
google.protobuf.Timestamp time = 1;
}
message GatewayStats {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Gateway IP.
string ip = 9;
// Gateway time.
google.protobuf.Timestamp time = 2;
// Gateway location.
common.Location location = 3;
// Gateway configuration version (this maps to the config_version sent
// by LoRa Server to the gateway).
string config_version = 4;
// Number of radio packets received.
uint32 rx_packets_received = 5;
// Number of radio packets received with valid PHY CRC.
uint32 rx_packets_received_ok = 6 [json_name = "rxPacketsReceivedOK"];
// Number of downlink packets received for transmission.
uint32 tx_packets_received = 7;
// Number of downlink packets emitted.
uint32 tx_packets_emitted = 8;
// Additional gateway meta-data.
map<string, string> meta_data = 10;
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11 [json_name = "statsID"];
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12;
// Rx packets per frequency.
map<uint32, uint32> rx_packets_per_frequency = 13;
// Tx packets per modulation parameters.
repeated PerModulationCount tx_packets_per_modulation = 14;
// Rx packets per modulation parameters.
repeated PerModulationCount rx_packets_per_modulation = 15;
// Tx packets per status.
map<string, uint32> tx_packets_per_status = 16;
}
message PerModulationCount {
// Modulation.
Modulation modulation = 1;
// Count.
uint32 count = 2;
}
message UplinkRXInfo {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// RX time (only set when the gateway has a GPS module).
google.protobuf.Timestamp time = 2;
// RX time since GPS epoch (only set when the gateway has a GPS module).
google.protobuf.Duration time_since_gps_epoch = 3 [json_name = "timeSinceGPSEpoch"];
// RSSI.
int32 rssi = 5;
// LoRa SNR.
double lora_snr = 6 [json_name = "loRaSNR"];
// Channel.
uint32 channel = 7;
// RF Chain.
uint32 rf_chain = 8;
// Board.
uint32 board = 9;
// Antenna.
uint32 antenna = 10;
// Location.
common.Location location = 11;
// Fine-timestamp type.
FineTimestampType fine_timestamp_type = 12;
// Fine-timestamp data.
oneof fine_timestamp {
// Encrypted fine-timestamp data.
EncryptedFineTimestamp encrypted_fine_timestamp = 13;
// Plain fine-timestamp data.
PlainFineTimestamp plain_fine_timestamp = 14;
}
// Gateway specific context.
bytes context = 15;
// Uplink ID (UUID bytes).
// Unique and random ID which can be used to correlate the uplink across multiple logs.
bytes uplink_id = 16 [json_name = "uplinkID"];
// CRC status.
CRCStatus crc_status = 17 [json_name = "crcStatus"];
// Optional meta-data map.
map<string, string> metadata = 18;
}
message DownlinkTXInfo {
// Gateway ID.
// Deprecated: replaced by gateway_id in DownlinkFrame.
bytes gateway_id = 1 [json_name = "gatewayID"];
// TX frequency (in Hz).
uint32 frequency = 5;
// TX power (in dBm).
int32 power = 6;
// Modulation.
common.Modulation modulation = 7;
oneof modulation_info {
// LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 8 [json_name = "loRaModulationInfo"];
// FSK modulation information.
FSKModulationInfo fsk_modulation_info = 9;
}
// The board identifier for emitting the frame.
uint32 board = 10;
// The antenna identifier for emitting the frame.
uint32 antenna = 11;
// Timing defines the downlink timing to use.
DownlinkTiming timing = 12;
oneof timing_info {
// Immediately timing information.
ImmediatelyTimingInfo immediately_timing_info = 13;
// Context based delay timing information.
DelayTimingInfo delay_timing_info = 14;
// GPS Epoch timing information.
GPSEpochTimingInfo gps_epoch_timing_info = 15;
}
// Gateway specific context.
// In case of a Class-A downlink, this contains a copy of the uplink context.
bytes context = 16;
}
message ImmediatelyTimingInfo {
// Not implemented yet.
}
message DelayTimingInfo {
// Delay (duration).
// The delay will be added to the gateway internal timing, provided by the context object.
google.protobuf.Duration delay = 1;
}
message GPSEpochTimingInfo {
// Duration since GPS Epoch.
google.protobuf.Duration time_since_gps_epoch = 1 [json_name = "timeSinceGPSEpoch"];
}
message UplinkFrame {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
UplinkTXInfo tx_info = 2;
// RX meta-data.
UplinkRXInfo rx_info = 3;
}
message UplinkFrameSet {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
UplinkTXInfo tx_info = 2;
// RX meta-data set.
repeated UplinkRXInfo rx_info = 3;
}
message DownlinkFrame {
// PHYPayload.
// Deprecated: replaced by items.
bytes phy_payload = 1;
// TX meta-data.
// Deprecated: replaced by items.
DownlinkTXInfo tx_info = 2;
// Token (uint16 value).
// Deprecated: replaced by downlink_id.
uint32 token = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Downlink frame items.
// This makes it possible to send multiple downlink opportunities to the
// gateway at once (e.g. RX1 and RX2 in LoRaWAN). The first item has the
// highest priority, the last the lowest. The gateway will emit at most
// one item.
repeated DownlinkFrameItem items = 5;
// Gateway ID.
bytes gateway_id = 6 [json_name = "gatewayID"];
}
message DownlinkFrameItem {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
DownlinkTXInfo tx_info = 2;
}
message DownlinkTXAck {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Token (uint16 value).
// Deprecated: replaced by downlink_id.
uint32 token = 2;
// Error.
// Deprecated: replaced by items.
string error = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Downlink frame items.
// This list has the same length as the request and indicates which
// downlink frame has been emitted of the requested list (or why it failed).
// Note that at most one item has a positive acknowledgement.
repeated DownlinkTXAckItem items = 5;
}
message DownlinkTXAckItem {
// The Ack status of this item.
TxAckStatus status = 1;
}
message GatewayConfiguration {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Configuration version.
string version = 2;
// Channels.
repeated ChannelConfiguration channels = 3;
// Stats interval.
google.protobuf.Duration stats_interval = 4;
}
message ChannelConfiguration {
// Frequency (Hz).
uint32 frequency = 1;
// Channel modulation.
common.Modulation modulation = 2;
oneof modulation_config {
// LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3 [json_name = "loRaModulationConfig"];
// FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4;
}
// Board index.
uint32 board = 5;
// Demodulator index (of the given board).
uint32 demodulator = 6;
}
message LoRaModulationConfig {
// Bandwidth.
uint32 bandwidth = 1;
// Spreading-factors.
repeated uint32 spreading_factors = 2;
}
message FSKModulationConfig {
// Bandwidth.
uint32 bandwidth = 1;
// Bitrate.
uint32 bitrate = 2;
}
message GatewayCommandExecRequest {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration.
string command = 2;
// Execution request ID (UUID).
// The same token will be returned when the execution of the command has
// completed.
bytes ExecId = 3 [json_name = "execID"];
// Standard input.
bytes stdin = 4;
// Environment variables.
map<string, string> environment = 5;
}
message GatewayCommandExecResponse {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Execution request ID (UUID).
bytes exec_id = 2 [json_name = "execID"];
// Standard output.
bytes stdout = 3;
// Standard error.
bytes stderr = 4;
// Error message.
string error = 5;
}
// RawPacketForwarderEvent contains a raw packet-forwarder event.
// It can be used to access packet-forwarder features that are not (fully)
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"];
// Payload contains the raw payload.
bytes payload = 3;
}
// RawPacketForwarderEvent contains a raw packet-forwarder command.
// It can be used to access packet-forwarder features that are not (fully)
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"];
// Payload contains the raw payload.
bytes payload = 3;
}
// ConnState contains the connection state of a gateway.
message ConnState {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
enum State {
OFFLINE = 0;
ONLINE = 1;
}
State state = 2;
}

View File

@ -0,0 +1,202 @@
syntax = "proto3";
package gw;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/gw";
option java_package = "io.chirpstack.api.gw";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
import "chirpstack-api/common/common.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
enum CodeRate {
CR_UNDEFINED = 0;
CR_4_5 = 1;
CR_4_6 = 2;
CR_4_7 = 3;
CR_4_8 = 4;
}
message UplinkFrame {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
UplinkTxParams tx_params = 2;
// RX meta-data.
UplinkRxParams rx_params = 3;
}
message DownlinkFrame {
// Gateway ID.
string gateway_id = 1;
// Downlink ID.
uint32 downlink_id = 2;
// Downlink frame items.
// This makes it possible to send multiple downlink opportunities to the
// gateway at once (e.g. RX1 and RX2 in LoRaWAN). The first item has the
// highest priority, the last the lowest. The gateway will emit at most
// one item.
repeated DownlinkFrameItem items = 3;
}
message UplinkTxParams {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation.
Modulation modulation = 2;
}
message Modulation {
oneof parameters {
// LoRa.
LoraModulationParams lora = 1;
// FSK.
FskModulationParams fsk = 2;
// LR-FHSS.
LrFhssModulationParams lr_fhss = 3;
}
}
message LoraModulationParams {
// Bandwidth (Hz).
uint32 bandwidth = 1;
// Spreading-factor.
uint32 spreading_factor = 2;
// Polarization inversion.
bool polarization_inversion = 3;
// Code-rate.
CodeRate code_rate = 4;
}
message FskModulationParams {
// Frequency deviation.
uint32 frequency_deviation = 1;
// FSK datarate (bits / sec).
uint32 datarate = 2;
}
message LrFhssModulationParams {
// Operating channel width (OCW) in Hz.
uint32 operating_channel_width = 1;
// Code-rate.
CodeRate code_rate = 2;
// Hopping grid number of steps.
uint32 grid_steps = 3;
}
message UplinkRxParams {
// Gateway ID (EUI).
string gateway_id = 1;
// Uplink ID (UUID).
uint32 uplink_id = 2;
// Rx time.
google.protobuf.Timestamp time = 3;
// RX time since GPS epoch (only set when the gateway has a GPS module).
google.protobuf.Duration time_since_gps_epoch = 4;
// Fine-timestamp.
// This timestamp can be used for TDOA based geolocation.
google.protobuf.Duration fine_time_since_gps_epoch = 5;
// RSSI.
int32 rssi = 6;
// SNR.
// Note: only available for LoRa modulation.
float snr = 7;
// Board.
uint32 board = 8;
// Antenna.
uint32 antenna = 9;
// Location.
common.Location location = 10;
// Gateway specific context.
// This value must be returned to the gateway on (Class-A) downlink.
bytes context = 11;
// Properties.
google.protobuf.Struct properties = 12;
}
message DownlinkFrameItem {
// PHYPayload.
bytes phy_payload = 1;
// Tx parameters.
DownlinkTxParams tx_params = 2;
}
message DownlinkTxParams {
// Tx frequency (Hz).
uint32 frequency = 1;
// Tx power (dBm).
int32 power = 2;
// Modulation.
Modulation modulation = 3;
// The board identifier for emitting the frame.
uint32 board = 4;
// The antenna identifier for emitting the frame.
uint32 antenna = 5;
// Downlink timing.
DownlinkTiming timing = 6;
// Gateway specific context.
// In case of a Class-A downlink, this must contain a copy of the uplink context.
bytes context = 7;
}
message DownlinkTiming {
oneof parameters {
// Immediately timing information.
DownlinkTimingImmediately immediately = 1;
// Delay timing information.
DownlinkTimingDelay delay = 2;
// GPS epoch timing information.
DownlinkTimingGpsEpoch gps_epoch = 3;
}
}
message DownlinkTimingImmediately {
// No fields implemented yet.
}
message DownlinkTimingDelay {
// Delay relative to provided context.
google.protobuf.Duration delay = 1;
}
message DownlinkTimingGpsEpoch {
// Duration since GPS epoch.
google.protobuf.Duration time_since_gps_epoch = 1;
}

View File

@ -0,0 +1,278 @@
syntax = "proto3";
package integration;
option go_package = "github.com/brocaar/chirpstack/api/go/v4/integration";
option java_package = "io.chirpstack.api.as.integration";
option java_multiple_files = true;
option java_outer_classname = "IntegrationProto";
import "chirpstack-api/common/common.proto";
import "chirpstack-api/gw/gw.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
enum LogLevel {
// Info.
INFO = 0;
// Warning.
WARNING = 1;
// Error.
ERROR = 2;
}
enum LogCode {
// Unknown type.
UNKNOWN = 0;
// Error related to the downlink payload size.
// Usually seen when the payload exceeded the maximum allowed payload size.
DOWNLINK_PAYLOAD_SIZE = 1;
// Uplink codec error.
UPLINK_CODEC = 2;
// Downlink codec error.
DOWNLINK_CODEC = 3;
// OTAA error.
OTAA = 4;
// Uplink frame-counter was reset.
UPLINK_F_CNT_RESET = 5;
// Uplink MIC error.
UPLINK_MIC = 6;
// Uplink frame-counter retransmission.
UPLINK_F_CNT_RETRANSMISSION = 7;
// Downlink gateway error.
DOWNLINK_GATEWAY = 8;
}
// Device information.
message DeviceInfo {
// Tenant ID (UUID).
string tenant_id = 1;
// Tenant name.
string tenant_name = 2;
// Application ID (UUID).
string application_id = 3;
// Application name.
string application_name = 4;
// Device-profile ID (UUID).
string device_profile_id = 5;
// Device-profile name.
string device_profile_name = 6;
// Device name.
string device_name = 7;
// Device EUI.
string dev_eui = 8;
// Device-profile and device tags.
map<string, string> tags = 9;
}
// UplinkEvent is the message sent when an uplink payload has been received.
message UplinkEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device information.
DeviceInfo device_info = 3;
// Device address.
string dev_addr = 4;
// Device has ADR bit set.
bool adr = 5;
// Data-rate.
uint32 dr = 6;
// Frame counter.
uint32 f_cnt_up = 7;
// Frame port.
uint32 f_port = 8;
// Uplink was of type confirmed.
bool confirmed = 9;
// FRMPayload data.
bytes data = 10;
// Note that this is only set when a codec is configured in the Device Profile.
google.protobuf.Struct object = 11;
// Receiving gateway RX info.
repeated gw.UplinkRXInfo rx_info = 12;
// TX info.
gw.UplinkTXInfo tx_info = 13;
}
// JoinEvent is the message sent when a device joined the network.
// Note: this event is sent at the first uplink after OTAA.
message JoinEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Device address.
string dev_addr = 4;
}
// AckEvent is the message sent when a confirmation on a confirmed downlink
// has been received -or- when the downlink timed out.
message AckEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Downlink queue item ID (UUID).
string queue_item_id = 4;
// Frame was acknowledged.
bool acknowledged = 5;
// Downlink frame counter to which the acknowledgement relates.
uint32 f_cnt_down = 6;
}
// TxAckEvent is the message sent when a downlink was acknowledged by the gateway
// for transmission. As a downlink can be scheduled in the future, this event
// does not confirm that the message has already been transmitted.
message TxAckEvent {
// Downlink ID (UUID).
string downlink_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Downlink queue item ID (UUID).
string queue_item_id = 4;
// Downlink frame-counter.
uint32 f_cnt_down = 5;
// Gateway ID.
string gateway_id = 6;
// TX info.
gw.DownlinkTXInfo tx_info = 7;
}
// LogEvent is the message sent when a device-related log was sent.
message LogEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Log level.
LogLevel level = 4;
// Log code.
LogCode code = 5;
// Description message.
string description = 6;
// Context map.
map<string, string> context = 7;
}
// StatusEvent is the message sent when a device-status mac-command was sent
// by the device.
message StatusEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// The demodulation signal-to-noise ratio in dB for the last successfully
// received device-status request by the Network Server.
int32 margin = 5;
// Device is connected to an external power source.
bool external_power_source = 6;
// Battery level is not available.
bool battery_level_unavailable = 7;
// Battery level.
float battery_level = 8;
}
// LocationEvent is the message sent when a geolocation resolve was returned.
message LocationEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Location.
common.Location location = 4;
}
// IntegrationEvent is the message that can be sent by an integration.
// It allows for sending events which are provided by an external integration
// which are "not native" to ChirpStack.
message IntegrationEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Integration name.
string integration_name = 4;
// Event type.
string event_type = 5;
// Struct containing the event object.
google.protobuf.Struct object = 6;
}

View File

@ -0,0 +1,235 @@
syntax = "proto3";
package internal;
import "chirpstack-api/common/common.proto";
import "chirpstack-api/gw/gw.proto";
import "google/protobuf/timestamp.proto";
message DeviceSession {
// Device EUI.
bytes dev_eui = 1;
// Device address.
bytes dev_addr = 2;
// Join EUI.
bytes join_eui = 3;
// LoRaWAN mac-version.
common.MacVersion mac_version = 4;
// FNwkSIntKey.
bytes f_nwk_s_int_key = 5;
// SNwkSIntKey.
bytes s_nwk_s_int_key = 6;
// NwkSEncKey.
bytes nwk_s_enc_key = 7;
// AppSKey envelope.
common.KeyEnvelope app_s_key = 8;
// Uplink frame-counter.
uint32 f_cnt_up = 9;
// Downlink frame-counter (ns).
uint32 n_f_cnt_down = 10;
// Downlink frame-counter (as).
uint32 a_f_cnt_down = 11;
// Frame-counter holding the last confirmed downlink frame (n_f_cnt_down or a_f_cnt_down).
uint32 conf_f_cnt = 12;
// Skip uplink frame-counter validation.
bool skip_f_cnt_check = 13;
// RX1 delay.
uint32 rx1_delay = 14;
// RX1 data-rate offset.
uint32 rx1_dr_offset = 15;
// RX2 data-rate.
uint32 rx2_dr = 16;
// RX2 frequency.
uint32 rx2_frequency = 17;
// Enabled uplink channels.
repeated uint32 enabled_uplink_channel_indices = 18;
// Extra user-defined uplink channels.
map<uint32, DeviceSessionChannel> extra_uplink_channels = 19;
// Class-B ping-slot data-rate.
uint32 class_b_ping_slot_dr = 20;
// Class-B ping-slot frequency.
uint32 class_b_ping_slot_freq = 21;
// Class-B ping-slot nb.
uint32 class_b_ping_slot_nb = 22;
// Nb. transmissions.
uint32 nb_trans = 23;
// TXPowerIndex which the node is using. The possible values are defined
// by the lorawan/band package and are region specific. By default it is
// assumed that the node is using TXPower 0. This value is controlled by
// the ADR engine.
uint32 tx_power_index = 24;
// DR defines the (last known) data-rate at which the node is operating.
// This value is controlled by the ADR engine.
uint32 dr = 25;
// ADR defines if the device has ADR enabled.
bool adr = 26;
// MaxSupportedTXPowerIndex defines the maximum supported tx-power index
// by the node, or 0 when not set.
uint32 max_supported_tx_power_index = 27;
// MinSupportedTXPowerIndex defines the minimum supported tx-power index
// by the node (default 0).
uint32 min_supported_tx_power_index = 28;
// Pending rejoin device-session contains a device-session which has not
// yet been activated by the device (by sending a first uplink).
DeviceSession pending_rejoin_device_session = 29;
// Uplink history for ADR (last 20 uplink transmissions).
repeated UplinkAdrHistory uplink_adr_history = 30;
// Mac-command error count.
map<uint32, uint32> mac_command_error_count = 31;
// Last device-status request.
google.protobuf.Timestamp last_device_status_request = 32;
// RejoinRequestEnabled defines if the rejoin-request is enabled on the
// device.
bool rejoin_request_enabled = 33;
// RejoinRequestMaxCountN defines the 2^(C+4) uplink message interval for
// the rejoin-request.
uint32 rejoin_request_max_count_n = 34;
// RejoinRequestMaxTimeN defines the 2^(T+10) time interval (seconds)
// for the rejoin-request.
uint32 rejoin_request_max_time_n = 35;
// Rejoin counter (RJCount0).
// This counter is reset to 0 after each successful join-accept.
uint32 rejoin_count_0 = 36;
// Uplink dwell time.
bool uplink_dwell_time_400ms = 37;
// Downlink dwell time.
bool downlink_dwell_time_400ms = 38;
// Uplink max. EIRP index.
uint32 uplink_max_eirp_index = 39;
// Region name.
string region_name = 40;
}
message UplinkAdrHistory {
// Uplink frame-counter.
uint32 f_cnt = 1;
// Max SNR (of deduplicated frames received by one or multiple gateways).
float max_snr = 2;
// Max RSSI.
int32 max_rssi = 5;
// TX Power (as known by the network-server).
uint32 tx_power_index = 3;
// Number of receiving gateways.
uint32 gateway_count = 4;
}
message DeviceSessionChannel {
// Frequency Hz.
uint32 frequency = 1;
// Min. data-rate.
uint32 min_dr = 2;
// Max. data-rate.
uint32 max_dr = 3;
}
message DeviceGatewayRxInfo {
// DevEUI (EUI64).
bytes dev_eui = 1;
// Data-rate.
uint32 dr = 2;
// Gateway RxInfo elements.
repeated DeviceGatewayRxInfoItem items = 3;
}
message DeviceGatewayRxInfoItem {
// Gateway ID (EUI64).
bytes gateway_id = 1;
// RSSI.
int32 rssi = 2;
// LoRa SNR.
float lora_snr = 3;
// Antenna.
uint32 antenna = 4;
// Board.
uint32 board = 5;
// Context blob.
bytes context = 6;
}
message DownlinkFrame {
// Downlink ID (UUID).
bytes downlink_id = 1;
// DevEUI.
bytes dev_eui = 2;
// Device queue item ID.
bytes device_queue_item_id = 3;
// Multicast Group ID.
bytes multicast_group_id = 4;
// Multicast queue item ID.
bytes multicast_group_queue_item_id = 5;
// Downlink frames.
gw.DownlinkFrame downlink_frame = 6;
// Encrypted FOpts (LoRaWAN 1.1).
bool encrypted_fopts = 8;
// Network session encryption key (for FOpts).
bytes nwk_s_enc_key = 9;
}
message LoraCloudGeolocBuffer {
// Uplinks in buffer.
repeated LoraCloudGeolocBufferUplink uplinks = 1;
}
message LoraCloudGeolocBufferUplink {
// RxInfo set for a single uplink.
repeated gw.UplinkRXInfo rx_info = 1;
}

View File

@ -0,0 +1,61 @@
syntax = "proto3";
package meta;
option go_package = "github.com/chirpstack/chirpstack-api/go/v4/meta";
option java_package = "io.chirpstack.api.meta";
option java_multiple_files = true;
option java_outer_classname = "MetaProto";
import "chirpstack-api/common/common.proto";
import "chirpstack-api/gw/gw.proto";
message UplinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
}
message DownlinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// Multicast Group ID (UUID).
string multicast_group_id = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
// Gateway ID (EUI64).
string gateway_id = 8;
}