Fix field types for GatewayStats and GatewayConfiguration.

The gateway_id field now has type string and bandwidth is in Hz, which
is consistent with the other messages.
This commit is contained in:
Orne Brocaar 2022-07-21 15:28:09 +01:00
parent 067869e4f0
commit 69e3b672ac
10 changed files with 1328 additions and 951 deletions

1042
api/go/gw/gw.pb.go vendored

File diff suppressed because it is too large Load Diff

160
api/js/gw/gw_pb.d.ts vendored
View File

@ -268,13 +268,13 @@ export namespace PlainFineTimestamp {
} }
export class GatewayStats extends jspb.Message { export class GatewayStats extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getIp(): string; getGatewayId(): string;
setIp(value: string): void; setGatewayId(value: string): void;
hasTime(): boolean; hasTime(): boolean;
clearTime(): void; clearTime(): void;
@ -303,11 +303,6 @@ export class GatewayStats extends jspb.Message {
getMetaDataMap(): jspb.Map<string, string>; getMetaDataMap(): jspb.Map<string, string>;
clearMetaDataMap(): void; clearMetaDataMap(): void;
getStatsId(): Uint8Array | string;
getStatsId_asU8(): Uint8Array;
getStatsId_asB64(): string;
setStatsId(value: Uint8Array | string): void;
getTxPacketsPerFrequencyMap(): jspb.Map<number, number>; getTxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearTxPacketsPerFrequencyMap(): void; clearTxPacketsPerFrequencyMap(): void;
getRxPacketsPerFrequencyMap(): jspb.Map<number, number>; getRxPacketsPerFrequencyMap(): jspb.Map<number, number>;
@ -336,8 +331,8 @@ export class GatewayStats extends jspb.Message {
export namespace GatewayStats { export namespace GatewayStats {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
ip: string, gatewayId: string,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject, time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
location?: common_common_pb.Location.AsObject, location?: common_common_pb.Location.AsObject,
configVersion: string, configVersion: string,
@ -346,7 +341,6 @@ export namespace GatewayStats {
txPacketsReceived: number, txPacketsReceived: number,
txPacketsEmitted: number, txPacketsEmitted: number,
metaDataMap: Array<[string, string]>, metaDataMap: Array<[string, string]>,
statsId: Uint8Array | string,
txPacketsPerFrequencyMap: Array<[number, number]>, txPacketsPerFrequencyMap: Array<[number, number]>,
rxPacketsPerFrequencyMap: Array<[number, number]>, rxPacketsPerFrequencyMap: Array<[number, number]>,
txPacketsPerModulationList: Array<PerModulationCount.AsObject>, txPacketsPerModulationList: Array<PerModulationCount.AsObject>,
@ -1031,10 +1025,13 @@ export namespace DownlinkTxAckItem {
} }
export class GatewayConfiguration extends jspb.Message { export class GatewayConfiguration extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getVersion(): string; getVersion(): string;
setVersion(value: string): void; setVersion(value: string): void;
@ -1061,7 +1058,8 @@ export class GatewayConfiguration extends jspb.Message {
export namespace GatewayConfiguration { export namespace GatewayConfiguration {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
version: string, version: string,
channelsList: Array<ChannelConfiguration.AsObject>, channelsList: Array<ChannelConfiguration.AsObject>,
statsInterval?: google_protobuf_duration_pb.Duration.AsObject, statsInterval?: google_protobuf_duration_pb.Duration.AsObject,
@ -1072,18 +1070,18 @@ export class ChannelConfiguration extends jspb.Message {
getFrequency(): number; getFrequency(): number;
setFrequency(value: number): void; setFrequency(value: number): void;
getModulation(): common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap]; getModulationLegacy(): common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap];
setModulation(value: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap]): void; setModulationLegacy(value: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap]): void;
hasLoraModulationConfig(): boolean; hasLoraModulationConfig(): boolean;
clearLoraModulationConfig(): void; clearLoraModulationConfig(): void;
getLoraModulationConfig(): LoRaModulationConfig | undefined; getLoraModulationConfig(): LoraModulationConfig | undefined;
setLoraModulationConfig(value?: LoRaModulationConfig): void; setLoraModulationConfig(value?: LoraModulationConfig): void;
hasFskModulationConfig(): boolean; hasFskModulationConfig(): boolean;
clearFskModulationConfig(): void; clearFskModulationConfig(): void;
getFskModulationConfig(): FSKModulationConfig | undefined; getFskModulationConfig(): FskModulationConfig | undefined;
setFskModulationConfig(value?: FSKModulationConfig): void; setFskModulationConfig(value?: FskModulationConfig): void;
getBoard(): number; getBoard(): number;
setBoard(value: number): void; setBoard(value: number): void;
@ -1105,9 +1103,9 @@ export class ChannelConfiguration extends jspb.Message {
export namespace ChannelConfiguration { export namespace ChannelConfiguration {
export type AsObject = { export type AsObject = {
frequency: number, frequency: number,
modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap], modulationLegacy: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationConfig?: LoRaModulationConfig.AsObject, loraModulationConfig?: LoraModulationConfig.AsObject,
fskModulationConfig?: FSKModulationConfig.AsObject, fskModulationConfig?: FskModulationConfig.AsObject,
board: number, board: number,
demodulator: number, demodulator: number,
} }
@ -1119,7 +1117,10 @@ export namespace ChannelConfiguration {
} }
} }
export class LoRaModulationConfig extends jspb.Message { export class LoraModulationConfig extends jspb.Message {
getBandwidthLegacy(): number;
setBandwidthLegacy(value: number): void;
getBandwidth(): number; getBandwidth(): number;
setBandwidth(value: number): void; setBandwidth(value: number): void;
@ -1129,23 +1130,27 @@ export class LoRaModulationConfig extends jspb.Message {
addSpreadingFactors(value: number, index?: number): number; addSpreadingFactors(value: number, index?: number): number;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoRaModulationConfig.AsObject; toObject(includeInstance?: boolean): LoraModulationConfig.AsObject;
static toObject(includeInstance: boolean, msg: LoRaModulationConfig): LoRaModulationConfig.AsObject; static toObject(includeInstance: boolean, msg: LoraModulationConfig): LoraModulationConfig.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LoRaModulationConfig, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: LoraModulationConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoRaModulationConfig; static deserializeBinary(bytes: Uint8Array): LoraModulationConfig;
static deserializeBinaryFromReader(message: LoRaModulationConfig, reader: jspb.BinaryReader): LoRaModulationConfig; static deserializeBinaryFromReader(message: LoraModulationConfig, reader: jspb.BinaryReader): LoraModulationConfig;
} }
export namespace LoRaModulationConfig { export namespace LoraModulationConfig {
export type AsObject = { export type AsObject = {
bandwidthLegacy: number,
bandwidth: number, bandwidth: number,
spreadingFactorsList: Array<number>, spreadingFactorsList: Array<number>,
} }
} }
export class FSKModulationConfig extends jspb.Message { export class FskModulationConfig extends jspb.Message {
getBandwidthLegacy(): number;
setBandwidthLegacy(value: number): void;
getBandwidth(): number; getBandwidth(): number;
setBandwidth(value: number): void; setBandwidth(value: number): void;
@ -1153,27 +1158,31 @@ export class FSKModulationConfig extends jspb.Message {
setBitrate(value: number): void; setBitrate(value: number): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FSKModulationConfig.AsObject; toObject(includeInstance?: boolean): FskModulationConfig.AsObject;
static toObject(includeInstance: boolean, msg: FSKModulationConfig): FSKModulationConfig.AsObject; static toObject(includeInstance: boolean, msg: FskModulationConfig): FskModulationConfig.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: FSKModulationConfig, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: FskModulationConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FSKModulationConfig; static deserializeBinary(bytes: Uint8Array): FskModulationConfig;
static deserializeBinaryFromReader(message: FSKModulationConfig, reader: jspb.BinaryReader): FSKModulationConfig; static deserializeBinaryFromReader(message: FskModulationConfig, reader: jspb.BinaryReader): FskModulationConfig;
} }
export namespace FSKModulationConfig { export namespace FskModulationConfig {
export type AsObject = { export type AsObject = {
bandwidthLegacy: number,
bandwidth: number, bandwidth: number,
bitrate: number, bitrate: number,
} }
} }
export class GatewayCommandExecRequest extends jspb.Message { export class GatewayCommandExecRequest extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getCommand(): string; getCommand(): string;
setCommand(value: string): void; setCommand(value: string): void;
@ -1202,7 +1211,8 @@ export class GatewayCommandExecRequest extends jspb.Message {
export namespace GatewayCommandExecRequest { export namespace GatewayCommandExecRequest {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
command: string, command: string,
execid: Uint8Array | string, execid: Uint8Array | string,
stdin: Uint8Array | string, stdin: Uint8Array | string,
@ -1211,10 +1221,13 @@ export namespace GatewayCommandExecRequest {
} }
export class GatewayCommandExecResponse extends jspb.Message { export class GatewayCommandExecResponse extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getExecId(): Uint8Array | string; getExecId(): Uint8Array | string;
getExecId_asU8(): Uint8Array; getExecId_asU8(): Uint8Array;
@ -1246,7 +1259,8 @@ export class GatewayCommandExecResponse extends jspb.Message {
export namespace GatewayCommandExecResponse { export namespace GatewayCommandExecResponse {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
execId: Uint8Array | string, execId: Uint8Array | string,
stdout: Uint8Array | string, stdout: Uint8Array | string,
stderr: Uint8Array | string, stderr: Uint8Array | string,
@ -1255,10 +1269,13 @@ export namespace GatewayCommandExecResponse {
} }
export class RawPacketForwarderEvent extends jspb.Message { export class RawPacketForwarderEvent extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getRawId(): Uint8Array | string; getRawId(): Uint8Array | string;
getRawId_asU8(): Uint8Array; getRawId_asU8(): Uint8Array;
@ -1282,17 +1299,21 @@ export class RawPacketForwarderEvent extends jspb.Message {
export namespace RawPacketForwarderEvent { export namespace RawPacketForwarderEvent {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
rawId: Uint8Array | string, rawId: Uint8Array | string,
payload: Uint8Array | string, payload: Uint8Array | string,
} }
} }
export class RawPacketForwarderCommand extends jspb.Message { export class RawPacketForwarderCommand extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getRawId(): Uint8Array | string; getRawId(): Uint8Array | string;
getRawId_asU8(): Uint8Array; getRawId_asU8(): Uint8Array;
@ -1316,17 +1337,21 @@ export class RawPacketForwarderCommand extends jspb.Message {
export namespace RawPacketForwarderCommand { export namespace RawPacketForwarderCommand {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
rawId: Uint8Array | string, rawId: Uint8Array | string,
payload: Uint8Array | string, payload: Uint8Array | string,
} }
} }
export class ConnState extends jspb.Message { export class ConnState extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getState(): ConnState.StateMap[keyof ConnState.StateMap]; getState(): ConnState.StateMap[keyof ConnState.StateMap];
setState(value: ConnState.StateMap[keyof ConnState.StateMap]): void; setState(value: ConnState.StateMap[keyof ConnState.StateMap]): void;
@ -1343,7 +1368,8 @@ export class ConnState extends jspb.Message {
export namespace ConnState { export namespace ConnState {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
state: ConnState.StateMap[keyof ConnState.StateMap], state: ConnState.StateMap[keyof ConnState.StateMap],
} }

637
api/js/gw/gw_pb.js vendored

File diff suppressed because it is too large Load Diff

77
api/proto/gw/gw.proto vendored
View File

@ -183,10 +183,11 @@ message PlainFineTimestamp {
message GatewayStats { message GatewayStats {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway IP. // Gateway ID.
string ip = 9; string gateway_id = 17;
// Gateway time. // Gateway time.
google.protobuf.Timestamp time = 2; google.protobuf.Timestamp time = 2;
@ -195,7 +196,7 @@ message GatewayStats {
common.Location location = 3; common.Location location = 3;
// Gateway configuration version (this maps to the config_version sent // Gateway configuration version (this maps to the config_version sent
// by LoRa Server to the gateway). // by ChirpStack to the gateway).
string config_version = 4; string config_version = 4;
// Number of radio packets received. // Number of radio packets received.
@ -213,10 +214,6 @@ message GatewayStats {
// Additional gateway meta-data. // Additional gateway meta-data.
map<string, string> meta_data = 10; map<string, string> meta_data = 10;
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11;
// Tx packets per frequency. // Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12; map<uint32, uint32> tx_packets_per_frequency = 12;
@ -528,7 +525,11 @@ message DownlinkTxAckItem {
message GatewayConfiguration { message GatewayConfiguration {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 5;
// Configuration version. // Configuration version.
string version = 2; string version = 2;
@ -544,15 +545,15 @@ message ChannelConfiguration {
// Frequency (Hz). // Frequency (Hz).
uint32 frequency = 1; uint32 frequency = 1;
// Channel modulation. // Modulation (deprecated).
common.Modulation modulation = 2; common.Modulation modulation_legacy = 2;
oneof modulation_config { oneof modulation_config {
// LoRa modulation config. // LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3; LoraModulationConfig lora_modulation_config = 3;
// FSK modulation config. // FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4; FskModulationConfig fsk_modulation_config = 4;
} }
// Board index. // Board index.
@ -562,17 +563,25 @@ message ChannelConfiguration {
uint32 demodulator = 6; uint32 demodulator = 6;
} }
message LoRaModulationConfig { message LoraModulationConfig {
// Bandwidth. // Bandwidth (kHz).
uint32 bandwidth = 1; // Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Spreading-factors. // Spreading-factors.
repeated uint32 spreading_factors = 2; repeated uint32 spreading_factors = 2;
} }
message FSKModulationConfig { message FskModulationConfig {
// Bandwidth. // Bandwidth (kHz).
uint32 bandwidth = 1; // Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Bitrate. // Bitrate.
uint32 bitrate = 2; uint32 bitrate = 2;
@ -580,7 +589,11 @@ message FSKModulationConfig {
message GatewayCommandExecRequest { message GatewayCommandExecRequest {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Command to execute. // Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration. // This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -600,7 +613,11 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse { message GatewayCommandExecResponse {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Execution request ID (UUID). // Execution request ID (UUID).
bytes exec_id = 2; bytes exec_id = 2;
@ -620,7 +637,11 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent { message RawPacketForwarderEvent {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2; bytes raw_id = 2;
@ -634,7 +655,11 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand { message RawPacketForwarderCommand {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2; bytes raw_id = 2;
@ -646,7 +671,11 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway. // ConnState contains the connection state of a gateway.
message ConnState { message ConnState {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 3;
enum State { enum State {
OFFLINE = 0; OFFLINE = 0;

View File

@ -183,10 +183,11 @@ message PlainFineTimestamp {
message GatewayStats { message GatewayStats {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway IP. // Gateway ID.
string ip = 9; string gateway_id = 17;
// Gateway time. // Gateway time.
google.protobuf.Timestamp time = 2; google.protobuf.Timestamp time = 2;
@ -195,7 +196,7 @@ message GatewayStats {
common.Location location = 3; common.Location location = 3;
// Gateway configuration version (this maps to the config_version sent // Gateway configuration version (this maps to the config_version sent
// by LoRa Server to the gateway). // by ChirpStack to the gateway).
string config_version = 4; string config_version = 4;
// Number of radio packets received. // Number of radio packets received.
@ -213,10 +214,6 @@ message GatewayStats {
// Additional gateway meta-data. // Additional gateway meta-data.
map<string, string> meta_data = 10; map<string, string> meta_data = 10;
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11;
// Tx packets per frequency. // Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12; map<uint32, uint32> tx_packets_per_frequency = 12;
@ -528,7 +525,11 @@ message DownlinkTxAckItem {
message GatewayConfiguration { message GatewayConfiguration {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 5;
// Configuration version. // Configuration version.
string version = 2; string version = 2;
@ -544,15 +545,15 @@ message ChannelConfiguration {
// Frequency (Hz). // Frequency (Hz).
uint32 frequency = 1; uint32 frequency = 1;
// Channel modulation. // Modulation (deprecated).
common.Modulation modulation = 2; common.Modulation modulation_legacy = 2;
oneof modulation_config { oneof modulation_config {
// LoRa modulation config. // LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3; LoraModulationConfig lora_modulation_config = 3;
// FSK modulation config. // FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4; FskModulationConfig fsk_modulation_config = 4;
} }
// Board index. // Board index.
@ -562,17 +563,25 @@ message ChannelConfiguration {
uint32 demodulator = 6; uint32 demodulator = 6;
} }
message LoRaModulationConfig { message LoraModulationConfig {
// Bandwidth. // Bandwidth (kHz).
uint32 bandwidth = 1; // Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Spreading-factors. // Spreading-factors.
repeated uint32 spreading_factors = 2; repeated uint32 spreading_factors = 2;
} }
message FSKModulationConfig { message FskModulationConfig {
// Bandwidth. // Bandwidth (kHz).
uint32 bandwidth = 1; // Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Bitrate. // Bitrate.
uint32 bitrate = 2; uint32 bitrate = 2;
@ -580,7 +589,11 @@ message FSKModulationConfig {
message GatewayCommandExecRequest { message GatewayCommandExecRequest {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Command to execute. // Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration. // This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -600,7 +613,11 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse { message GatewayCommandExecResponse {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Execution request ID (UUID). // Execution request ID (UUID).
bytes exec_id = 2; bytes exec_id = 2;
@ -620,7 +637,11 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent { message RawPacketForwarderEvent {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2; bytes raw_id = 2;
@ -634,7 +655,11 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand { message RawPacketForwarderCommand {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2; bytes raw_id = 2;
@ -646,7 +671,11 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway. // ConnState contains the connection state of a gateway.
message ConnState { message ConnState {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 3;
enum State { enum State {
OFFLINE = 0; OFFLINE = 0;

File diff suppressed because one or more lines are too long

2
api/rust/Cargo.lock generated vendored
View File

@ -121,7 +121,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chirpstack_api" name = "chirpstack_api"
version = "4.0.0-test.7" version = "4.0.0-test.10"
dependencies = [ dependencies = [
"hex", "hex",
"pbjson", "pbjson",

View File

@ -183,10 +183,11 @@ message PlainFineTimestamp {
message GatewayStats { message GatewayStats {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway IP. // Gateway ID.
string ip = 9; string gateway_id = 17;
// Gateway time. // Gateway time.
google.protobuf.Timestamp time = 2; google.protobuf.Timestamp time = 2;
@ -195,7 +196,7 @@ message GatewayStats {
common.Location location = 3; common.Location location = 3;
// Gateway configuration version (this maps to the config_version sent // Gateway configuration version (this maps to the config_version sent
// by LoRa Server to the gateway). // by ChirpStack to the gateway).
string config_version = 4; string config_version = 4;
// Number of radio packets received. // Number of radio packets received.
@ -213,10 +214,6 @@ message GatewayStats {
// Additional gateway meta-data. // Additional gateway meta-data.
map<string, string> meta_data = 10; map<string, string> meta_data = 10;
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11;
// Tx packets per frequency. // Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12; map<uint32, uint32> tx_packets_per_frequency = 12;
@ -528,7 +525,11 @@ message DownlinkTxAckItem {
message GatewayConfiguration { message GatewayConfiguration {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 5;
// Configuration version. // Configuration version.
string version = 2; string version = 2;
@ -544,15 +545,15 @@ message ChannelConfiguration {
// Frequency (Hz). // Frequency (Hz).
uint32 frequency = 1; uint32 frequency = 1;
// Channel modulation. // Modulation (deprecated).
common.Modulation modulation = 2; common.Modulation modulation_legacy = 2;
oneof modulation_config { oneof modulation_config {
// LoRa modulation config. // LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3; LoraModulationConfig lora_modulation_config = 3;
// FSK modulation config. // FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4; FskModulationConfig fsk_modulation_config = 4;
} }
// Board index. // Board index.
@ -562,17 +563,25 @@ message ChannelConfiguration {
uint32 demodulator = 6; uint32 demodulator = 6;
} }
message LoRaModulationConfig { message LoraModulationConfig {
// Bandwidth. // Bandwidth (kHz).
uint32 bandwidth = 1; // Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Spreading-factors. // Spreading-factors.
repeated uint32 spreading_factors = 2; repeated uint32 spreading_factors = 2;
} }
message FSKModulationConfig { message FskModulationConfig {
// Bandwidth. // Bandwidth (kHz).
uint32 bandwidth = 1; // Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Bitrate. // Bitrate.
uint32 bitrate = 2; uint32 bitrate = 2;
@ -580,7 +589,11 @@ message FSKModulationConfig {
message GatewayCommandExecRequest { message GatewayCommandExecRequest {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Command to execute. // Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration. // This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -600,7 +613,11 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse { message GatewayCommandExecResponse {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Execution request ID (UUID). // Execution request ID (UUID).
bytes exec_id = 2; bytes exec_id = 2;
@ -620,7 +637,11 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent { message RawPacketForwarderEvent {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2; bytes raw_id = 2;
@ -634,7 +655,11 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand { message RawPacketForwarderCommand {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2; bytes raw_id = 2;
@ -646,7 +671,11 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway. // ConnState contains the connection state of a gateway.
message ConnState { message ConnState {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; // Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 3;
enum State { enum State {
OFFLINE = 0; OFFLINE = 0;

View File

@ -13,13 +13,11 @@ use prost::Message;
use serde::Serialize; use serde::Serialize;
use tracing::{error, info, trace}; use tracing::{error, info, trace};
use super::GatewayBackend;
use crate::config::GatewayBackendMqtt; use crate::config::GatewayBackendMqtt;
use crate::monitoring::prometheus; use crate::monitoring::prometheus;
use crate::{downlink, uplink}; use crate::{downlink, uplink};
use lrwn::region::CommonName; use lrwn::region::CommonName;
use lrwn::EUI64;
use super::GatewayBackend;
#[derive(Clone, Hash, PartialEq, Eq, Encode)] #[derive(Clone, Hash, PartialEq, Eq, Encode)]
struct EventLabels { struct EventLabels {
@ -216,11 +214,10 @@ impl GatewayBackend for MqttBackend<'_> {
command: "config".to_string(), command: "config".to_string(),
}) })
.inc(); .inc();
let gateway_id = EUI64::from_slice(&gw_conf.gateway_id)?; let topic = self.get_command_topic(&gw_conf.gateway_id, "config")?;
let topic = self.get_command_topic(&gateway_id.to_string(), "config")?;
let b = gw_conf.encode_to_vec(); let b = gw_conf.encode_to_vec();
info!(gateway_id = %gateway_id, topic = %topic, "Sending gateway configuration"); info!(gateway_id = %gw_conf.gateway_id, topic = %topic, "Sending gateway configuration");
let msg = mqtt::Message::new(topic, b, self.qos as i32); let msg = mqtt::Message::new(topic, b, self.qos as i32);
self.client.publish(msg).await?; self.client.publish(msg).await?;
trace!("Message sent"); trace!("Message sent");

View File

@ -1,11 +1,11 @@
use std::collections::hash_map::DefaultHasher; use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::str::FromStr;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use chrono::{DateTime, Local}; use chrono::{DateTime, Local};
use tracing::{error, info, span, trace, Instrument, Level}; use tracing::{error, info, span, trace, Instrument, Level};
use uuid::Uuid;
use crate::gateway::backend as gateway_backend; use crate::gateway::backend as gateway_backend;
use crate::storage::{gateway, metrics}; use crate::storage::{gateway, metrics};
@ -14,7 +14,6 @@ use chirpstack_api::{common, gw};
use lrwn::EUI64; use lrwn::EUI64;
pub struct Stats { pub struct Stats {
id: Uuid,
gateway_id: EUI64, gateway_id: EUI64,
stats: gw::GatewayStats, stats: gw::GatewayStats,
gateway: Option<gateway::Gateway>, gateway: Option<gateway::Gateway>,
@ -22,22 +21,28 @@ pub struct Stats {
impl Stats { impl Stats {
pub async fn handle(s: gw::GatewayStats) { pub async fn handle(s: gw::GatewayStats) {
let id = match Uuid::from_slice(&s.stats_id) { let gateway_id = match if !s.gateway_id.is_empty() {
EUI64::from_str(&s.gateway_id)
} else {
EUI64::from_slice(&s.gateway_id_legacy)
} {
Ok(v) => v, Ok(v) => v,
Err(_) => Uuid::nil(), Err(e) => {
error!(error = %e, "Decode stats gateway_id error");
return;
}
}; };
let span = span!(Level::INFO, "stats", stats_id = %id); let span = span!(Level::INFO, "stats", gateway_id = %gateway_id);
if let Err(e) = Stats::_handle(id, s).instrument(span).await { if let Err(e) = Stats::_handle(gateway_id, s).instrument(span).await {
error!(error = %e, "Handle gateway stats error"); error!(error = %e, "Handle gateway stats error");
} }
} }
async fn _handle(id: Uuid, s: gw::GatewayStats) -> Result<()> { async fn _handle(gateway_id: EUI64, s: gw::GatewayStats) -> Result<()> {
let mut ctx = Stats { let mut ctx = Stats {
id, gateway_id: gateway_id,
gateway_id: EUI64::from_slice(&s.gateway_id)?,
stats: s, stats: s,
gateway: None, gateway: None,
}; };
@ -180,13 +185,14 @@ impl Stats {
let gw_conf = gw::GatewayConfiguration { let gw_conf = gw::GatewayConfiguration {
gateway_id: self.stats.gateway_id.clone(), gateway_id: self.stats.gateway_id.clone(),
gateway_id_legacy: self.stats.gateway_id_legacy.clone(),
version: hash, version: hash,
channels: gateway_conf channels: gateway_conf
.channels .channels
.iter() .iter()
.map(|c| gw::ChannelConfiguration { .map(|c| gw::ChannelConfiguration {
frequency: c.frequency, frequency: c.frequency,
modulation: match c.modulation { modulation_legacy: match c.modulation {
config::GatewayChannelModulation::LORA => common::Modulation::Lora, config::GatewayChannelModulation::LORA => common::Modulation::Lora,
config::GatewayChannelModulation::FSK => common::Modulation::Fsk, config::GatewayChannelModulation::FSK => common::Modulation::Fsk,
} }
@ -194,8 +200,9 @@ impl Stats {
modulation_config: Some(match c.modulation { modulation_config: Some(match c.modulation {
config::GatewayChannelModulation::LORA => { config::GatewayChannelModulation::LORA => {
gw::channel_configuration::ModulationConfig::LoraModulationConfig( gw::channel_configuration::ModulationConfig::LoraModulationConfig(
gw::LoRaModulationConfig { gw::LoraModulationConfig {
bandwidth: c.bandwidth / 1000, bandwidth_legacy: c.bandwidth / 1000,
bandwidth: c.bandwidth,
spreading_factors: c.spreading_factors.clone(), spreading_factors: c.spreading_factors.clone(),
}, },
) )
@ -203,7 +210,8 @@ impl Stats {
config::GatewayChannelModulation::FSK => { config::GatewayChannelModulation::FSK => {
gw::channel_configuration::ModulationConfig::FskModulationConfig( gw::channel_configuration::ModulationConfig::FskModulationConfig(
gw::FskModulationConfig { gw::FskModulationConfig {
bandwidth: c.bandwidth / 1000, bandwidth_legacy: c.bandwidth / 1000,
bandwidth: c.bandwidth,
bitrate: c.datarate, bitrate: c.datarate,
}, },
) )