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
api
go/gw
js/gw
proto/gw
python
proto/chirpstack-api/gw
src/chirpstack_api/gw
rust
Cargo.lock
proto/chirpstack/gw
chirpstack/src
gateway/backend
uplink

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 {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getIp(): string;
setIp(value: string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
hasTime(): boolean;
clearTime(): void;
@ -303,11 +303,6 @@ export class GatewayStats extends jspb.Message {
getMetaDataMap(): jspb.Map<string, string>;
clearMetaDataMap(): void;
getStatsId(): Uint8Array | string;
getStatsId_asU8(): Uint8Array;
getStatsId_asB64(): string;
setStatsId(value: Uint8Array | string): void;
getTxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearTxPacketsPerFrequencyMap(): void;
getRxPacketsPerFrequencyMap(): jspb.Map<number, number>;
@ -336,8 +331,8 @@ export class GatewayStats extends jspb.Message {
export namespace GatewayStats {
export type AsObject = {
gatewayId: Uint8Array | string,
ip: string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
location?: common_common_pb.Location.AsObject,
configVersion: string,
@ -346,7 +341,6 @@ export namespace GatewayStats {
txPacketsReceived: number,
txPacketsEmitted: number,
metaDataMap: Array<[string, string]>,
statsId: Uint8Array | string,
txPacketsPerFrequencyMap: Array<[number, number]>,
rxPacketsPerFrequencyMap: Array<[number, number]>,
txPacketsPerModulationList: Array<PerModulationCount.AsObject>,
@ -1031,10 +1025,13 @@ export namespace DownlinkTxAckItem {
}
export class GatewayConfiguration extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getVersion(): string;
setVersion(value: string): void;
@ -1061,7 +1058,8 @@ export class GatewayConfiguration extends jspb.Message {
export namespace GatewayConfiguration {
export type AsObject = {
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
version: string,
channelsList: Array<ChannelConfiguration.AsObject>,
statsInterval?: google_protobuf_duration_pb.Duration.AsObject,
@ -1072,18 +1070,18 @@ export class ChannelConfiguration extends jspb.Message {
getFrequency(): number;
setFrequency(value: number): void;
getModulation(): common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap];
setModulation(value: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap]): void;
getModulationLegacy(): common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap];
setModulationLegacy(value: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap]): void;
hasLoraModulationConfig(): boolean;
clearLoraModulationConfig(): void;
getLoraModulationConfig(): LoRaModulationConfig | undefined;
setLoraModulationConfig(value?: LoRaModulationConfig): void;
getLoraModulationConfig(): LoraModulationConfig | undefined;
setLoraModulationConfig(value?: LoraModulationConfig): void;
hasFskModulationConfig(): boolean;
clearFskModulationConfig(): void;
getFskModulationConfig(): FSKModulationConfig | undefined;
setFskModulationConfig(value?: FSKModulationConfig): void;
getFskModulationConfig(): FskModulationConfig | undefined;
setFskModulationConfig(value?: FskModulationConfig): void;
getBoard(): number;
setBoard(value: number): void;
@ -1105,9 +1103,9 @@ export class ChannelConfiguration extends jspb.Message {
export namespace ChannelConfiguration {
export type AsObject = {
frequency: number,
modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationConfig?: LoRaModulationConfig.AsObject,
fskModulationConfig?: FSKModulationConfig.AsObject,
modulationLegacy: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationConfig?: LoraModulationConfig.AsObject,
fskModulationConfig?: FskModulationConfig.AsObject,
board: 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;
setBandwidth(value: number): void;
@ -1129,23 +1130,27 @@ export class LoRaModulationConfig extends jspb.Message {
addSpreadingFactors(value: number, index?: number): number;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoRaModulationConfig.AsObject;
static toObject(includeInstance: boolean, msg: LoRaModulationConfig): LoRaModulationConfig.AsObject;
toObject(includeInstance?: boolean): LoraModulationConfig.AsObject;
static toObject(includeInstance: boolean, msg: LoraModulationConfig): LoraModulationConfig.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LoRaModulationConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoRaModulationConfig;
static deserializeBinaryFromReader(message: LoRaModulationConfig, reader: jspb.BinaryReader): LoRaModulationConfig;
static serializeBinaryToWriter(message: LoraModulationConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoraModulationConfig;
static deserializeBinaryFromReader(message: LoraModulationConfig, reader: jspb.BinaryReader): LoraModulationConfig;
}
export namespace LoRaModulationConfig {
export namespace LoraModulationConfig {
export type AsObject = {
bandwidthLegacy: number,
bandwidth: number,
spreadingFactorsList: Array<number>,
}
}
export class FSKModulationConfig extends jspb.Message {
export class FskModulationConfig extends jspb.Message {
getBandwidthLegacy(): number;
setBandwidthLegacy(value: number): void;
getBandwidth(): number;
setBandwidth(value: number): void;
@ -1153,27 +1158,31 @@ export class FSKModulationConfig extends jspb.Message {
setBitrate(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FSKModulationConfig.AsObject;
static toObject(includeInstance: boolean, msg: FSKModulationConfig): FSKModulationConfig.AsObject;
toObject(includeInstance?: boolean): FskModulationConfig.AsObject;
static toObject(includeInstance: boolean, msg: FskModulationConfig): FskModulationConfig.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: FSKModulationConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FSKModulationConfig;
static deserializeBinaryFromReader(message: FSKModulationConfig, reader: jspb.BinaryReader): FSKModulationConfig;
static serializeBinaryToWriter(message: FskModulationConfig, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FskModulationConfig;
static deserializeBinaryFromReader(message: FskModulationConfig, reader: jspb.BinaryReader): FskModulationConfig;
}
export namespace FSKModulationConfig {
export namespace FskModulationConfig {
export type AsObject = {
bandwidthLegacy: number,
bandwidth: number,
bitrate: number,
}
}
export class GatewayCommandExecRequest extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getCommand(): string;
setCommand(value: string): void;
@ -1202,7 +1211,8 @@ export class GatewayCommandExecRequest extends jspb.Message {
export namespace GatewayCommandExecRequest {
export type AsObject = {
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
command: string,
execid: Uint8Array | string,
stdin: Uint8Array | string,
@ -1211,10 +1221,13 @@ export namespace GatewayCommandExecRequest {
}
export class GatewayCommandExecResponse extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getExecId(): Uint8Array | string;
getExecId_asU8(): Uint8Array;
@ -1246,7 +1259,8 @@ export class GatewayCommandExecResponse extends jspb.Message {
export namespace GatewayCommandExecResponse {
export type AsObject = {
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
execId: Uint8Array | string,
stdout: Uint8Array | string,
stderr: Uint8Array | string,
@ -1255,10 +1269,13 @@ export namespace GatewayCommandExecResponse {
}
export class RawPacketForwarderEvent extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getRawId(): Uint8Array | string;
getRawId_asU8(): Uint8Array;
@ -1282,17 +1299,21 @@ export class RawPacketForwarderEvent extends jspb.Message {
export namespace RawPacketForwarderEvent {
export type AsObject = {
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
rawId: Uint8Array | string,
payload: Uint8Array | string,
}
}
export class RawPacketForwarderCommand extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getRawId(): Uint8Array | string;
getRawId_asU8(): Uint8Array;
@ -1316,17 +1337,21 @@ export class RawPacketForwarderCommand extends jspb.Message {
export namespace RawPacketForwarderCommand {
export type AsObject = {
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
rawId: Uint8Array | string,
payload: Uint8Array | string,
}
}
export class ConnState extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getState(): ConnState.StateMap[keyof ConnState.StateMap];
setState(value: ConnState.StateMap[keyof ConnState.StateMap]): void;
@ -1343,7 +1368,8 @@ export class ConnState extends jspb.Message {
export namespace ConnState {
export type AsObject = {
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
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 {
// Gateway ID.
bytes gateway_id = 1;
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway IP.
string ip = 9;
// Gateway ID.
string gateway_id = 17;
// Gateway time.
google.protobuf.Timestamp time = 2;
@ -195,7 +196,7 @@ message GatewayStats {
common.Location location = 3;
// 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;
// Number of radio packets received.
@ -213,10 +214,6 @@ message GatewayStats {
// Additional gateway meta-data.
map<string, string> meta_data = 10;
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12;
@ -528,7 +525,11 @@ message DownlinkTxAckItem {
message GatewayConfiguration {
// Gateway ID.
bytes gateway_id = 1;
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 5;
// Configuration version.
string version = 2;
@ -544,15 +545,15 @@ message ChannelConfiguration {
// Frequency (Hz).
uint32 frequency = 1;
// Channel modulation.
common.Modulation modulation = 2;
// Modulation (deprecated).
common.Modulation modulation_legacy = 2;
oneof modulation_config {
// LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3;
LoraModulationConfig lora_modulation_config = 3;
// FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4;
FskModulationConfig fsk_modulation_config = 4;
}
// Board index.
@ -562,17 +563,25 @@ message ChannelConfiguration {
uint32 demodulator = 6;
}
message LoRaModulationConfig {
// Bandwidth.
uint32 bandwidth = 1;
message LoraModulationConfig {
// Bandwidth (kHz).
// Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Spreading-factors.
repeated uint32 spreading_factors = 2;
}
message FSKModulationConfig {
// Bandwidth.
uint32 bandwidth = 1;
message FskModulationConfig {
// Bandwidth (kHz).
// Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Bitrate.
uint32 bitrate = 2;
@ -580,7 +589,11 @@ message FSKModulationConfig {
message GatewayCommandExecRequest {
// Gateway ID.
bytes gateway_id = 1;
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -600,7 +613,11 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse {
// 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).
bytes exec_id = 2;
@ -620,7 +637,11 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent {
// Gateway ID.
bytes gateway_id = 1;
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID).
bytes raw_id = 2;
@ -634,7 +655,11 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand {
// Gateway ID.
bytes gateway_id = 1;
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Raw ID (UUID).
bytes raw_id = 2;
@ -646,7 +671,11 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway.
message ConnState {
// Gateway ID.
bytes gateway_id = 1;
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 3;
enum State {
OFFLINE = 0;

View File

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

View File

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

View File

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

View File

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