chirpstack_api 3.7.6

ChirpStack Protobuf / gRPC API definitions.
Documentation
syntax = "proto3";

package as;

option go_package = "github.com/brocaar/chirpstack-api/go/v3/as";

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "common/common.proto";
import "gw/gw.proto";


// ApplicationServerService is the service providing the application-server interface.
service ApplicationServerService {
    // HandleUplinkData handles uplink data received from an end-device.
    rpc HandleUplinkData(HandleUplinkDataRequest) returns (google.protobuf.Empty) {}

    // HandleProprietaryUplink handles proprietary uplink payloads.
    rpc HandleProprietaryUplink(HandleProprietaryUplinkRequest) returns (google.protobuf.Empty) {}

    // HandleError handles an error message.
    rpc HandleError(HandleErrorRequest) returns (google.protobuf.Empty) {}

    // HandleDownlinkACK handles a downlink ACK or nACK response.
    rpc HandleDownlinkACK(HandleDownlinkACKRequest) returns (google.protobuf.Empty) {}

    // HandleGatewayStats handles the given gateway stats.
    rpc HandleGatewayStats(HandleGatewayStatsRequest) returns (google.protobuf.Empty) {}

    // HandleTXACK handles the TX acknowledgement.
    rpc HandleTxAck(HandleTxAckRequest) returns (google.protobuf.Empty) {}

    // SetDeviceStatus updates the device-status for a device.
    rpc SetDeviceStatus(SetDeviceStatusRequest) returns (google.protobuf.Empty) {}

    // SetDeviceLocation updates the device-location for a device.
    rpc SetDeviceLocation(SetDeviceLocationRequest) returns (google.protobuf.Empty) {}
}

enum RXWindow {
    RX1 = 0;
    RX2 = 1;
}

enum ErrorType {
    // Generic error type.
    GENERIC = 0;

    // OTAA error.
    OTAA = 1;

    // Uplink frame-counter was reset.
    DATA_UP_FCNT_RESET = 2;

    // Uplink MIC error.
    DATA_UP_MIC = 3;

    // Downlink payload size error.
    DEVICE_QUEUE_ITEM_SIZE = 4;

    // Downlink frame-counter error.
    DEVICE_QUEUE_ITEM_FCNT = 5;

    // Uplink frame-counter retransmission.
    DATA_UP_FCNT_RETRANSMISSION = 6;

    // Downlink gateway error.
    DATA_DOWN_GATEWAY = 7;
}


message DeviceActivationContext {
    // Assigned Device Address.
    bytes dev_addr = 1;

    // Application session key (envelope).
    common.KeyEnvelope app_s_key = 2;
}


message HandleUplinkDataRequest {
    // DevEUI EUI (8 bytes).
    bytes dev_eui = 1;

    // Join EUI used for OTAA activation (8 bytes).
    bytes join_eui = 2;

    // Frame-counter.
    uint32 f_cnt = 3;

    // Frame port.
    uint32 f_port = 4;

    // ADR enabled.
    bool adr = 5;

    // Data-rate.
    uint32 dr = 6;

    // TX meta-data.
    gw.UplinkTXInfo tx_info = 7;

    // RX meta-data.
    repeated gw.UplinkRXInfo rx_info = 8;

    // Received data (encrypted).
    bytes data = 9;

    // Device activation context.
    // 
    // This field is only set on the first uplink frame when the security
    // context has changed (e.g. a new OTAA (re)activation).
    DeviceActivationContext device_activation_context = 10;

    // Uplink was of type confirmed.
    bool confirmed_uplink = 11;
}

message HandleProprietaryUplinkRequest {
    // MACPayload of the proprietary LoRaWAN frame.
    bytes mac_payload = 1;

    // MIC of the proprietary LoRaWAN frame.
    bytes mic = 2;

    // TXInfo contains the TX related meta-data.
    gw.UplinkTXInfo tx_info = 3;

    // RXInfo contains the RX related meta-data.
    repeated gw.UplinkRXInfo rx_info = 4;
}

message HandleErrorRequest {
    // Device EUI (8 bytes).
    bytes dev_eui = 1;

    // Type of the error.
    ErrorType type = 3;

    // Error string describing the error.
    string error = 4;

    // Frame-counter (if applicable) related to the error.
    uint32 f_cnt = 5;
}

message HandleDownlinkACKRequest {
    // Device EUI (8 bytes).
    bytes dev_eui = 1;

    // Downlink frame-counter.
    uint32 f_cnt = 2;

    // Frame was acknowledged?
    bool acknowledged = 3;
}

message SetDeviceStatusRequest {
    // Device EUI (8 bytes).
    bytes dev_eui = 1;

    // Battery level (deprecated, use battery_level).
    // 0:      The end-device is connected to an external power source
    // 1..254: The battery level, 1 being at minimum and 254 being at maximum
    // 255:    The end-device was not able to measure the battery level
    uint32 battery = 2;

    // The device margin status
    // -32..32: The demodulation SNR ration in dB
    int32  margin = 3;

    // Device is connected to an external power source.
    bool external_power_source = 4;

    // Device battery status is not available.
    bool battery_level_unavailable = 5;

    // Battery level as a percentage.
    float battery_level = 6;
}

message SetDeviceLocationRequest {
    // Device EUI (8 bytes).
    bytes dev_eui = 1;

    // The location of the device.
    common.Location location = 2;

    // Uplink IDs used for geolocation.
    repeated bytes uplink_ids = 3;
}

message HandleGatewayStatsRequest {
    // Gateway ID (8 bytes).
    bytes gateway_id = 1;

    // Stats ID (UUID).
    bytes stats_id = 2;

    // Timestamp.
    google.protobuf.Timestamp time = 3;

    // Gateway location.
    common.Location location = 4;

    // Uplink frames received.
    uint32 rx_packets_received = 5;

    // Uplink frames received OK.
    uint32 rx_packets_received_ok = 6;

    // Downlink transmissions requested.
    uint32 tx_packets_received = 7;

    // Downlink emitted.
    uint32 tx_packets_emitted = 8;

    // Gateway metadata.
    map<string, string> metadata = 9;
}

message HandleTxAckRequest {
    // Device EUI (8 bytes).
    bytes dev_eui = 1;

    // Downlink frame-counter.
    uint32 f_cnt = 2;
}