api: Add duty-cycle stats messages + types.

This commit is contained in:
Orne Brocaar 2024-04-03 09:52:00 +01:00
parent 2bb05fba58
commit ac9923e120
8 changed files with 991 additions and 647 deletions

View File

@ -530,6 +530,54 @@ func (MetricKind) EnumDescriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{7} return file_common_common_proto_rawDescGZIP(), []int{7}
} }
type Regulation int32
const (
// Unknown.
Regulation_REGULATION_UNKNOWN Regulation = 0
// ETSI EN 300 220.
Regulation_ETSI_EN_300_220 Regulation = 1
)
// Enum value maps for Regulation.
var (
Regulation_name = map[int32]string{
0: "REGULATION_UNKNOWN",
1: "ETSI_EN_300_220",
}
Regulation_value = map[string]int32{
"REGULATION_UNKNOWN": 0,
"ETSI_EN_300_220": 1,
}
)
func (x Regulation) Enum() *Regulation {
p := new(Regulation)
*p = x
return p
}
func (x Regulation) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Regulation) Descriptor() protoreflect.EnumDescriptor {
return file_common_common_proto_enumTypes[8].Descriptor()
}
func (Regulation) Type() protoreflect.EnumType {
return &file_common_common_proto_enumTypes[8]
}
func (x Regulation) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Regulation.Descriptor instead.
func (Regulation) EnumDescriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{8}
}
type DeviceClass int32 type DeviceClass int32
const ( const (
@ -566,11 +614,11 @@ func (x DeviceClass) String() string {
} }
func (DeviceClass) Descriptor() protoreflect.EnumDescriptor { func (DeviceClass) Descriptor() protoreflect.EnumDescriptor {
return file_common_common_proto_enumTypes[8].Descriptor() return file_common_common_proto_enumTypes[9].Descriptor()
} }
func (DeviceClass) Type() protoreflect.EnumType { func (DeviceClass) Type() protoreflect.EnumType {
return &file_common_common_proto_enumTypes[8] return &file_common_common_proto_enumTypes[9]
} }
func (x DeviceClass) Number() protoreflect.EnumNumber { func (x DeviceClass) Number() protoreflect.EnumNumber {
@ -579,7 +627,7 @@ func (x DeviceClass) Number() protoreflect.EnumNumber {
// Deprecated: Use DeviceClass.Descriptor instead. // Deprecated: Use DeviceClass.Descriptor instead.
func (DeviceClass) EnumDescriptor() ([]byte, []int) { func (DeviceClass) EnumDescriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{8} return file_common_common_proto_rawDescGZIP(), []int{9}
} }
type Location struct { type Location struct {
@ -1012,18 +1060,21 @@ var file_common_common_proto_rawDesc = []byte{
0x4e, 0x54, 0x48, 0x10, 0x02, 0x2a, 0x32, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b, 0x4e, 0x54, 0x48, 0x10, 0x02, 0x2a, 0x32, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4b,
0x69, 0x6e, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x00, 0x69, 0x6e, 0x64, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x00,
0x12, 0x0c, 0x0a, 0x08, 0x41, 0x42, 0x53, 0x4f, 0x4c, 0x55, 0x54, 0x45, 0x10, 0x01, 0x12, 0x09, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x42, 0x53, 0x4f, 0x4c, 0x55, 0x54, 0x45, 0x10, 0x01, 0x12, 0x09,
0x0a, 0x05, 0x47, 0x41, 0x55, 0x47, 0x45, 0x10, 0x02, 0x2a, 0x34, 0x0a, 0x0b, 0x44, 0x65, 0x76, 0x0a, 0x05, 0x47, 0x41, 0x55, 0x47, 0x45, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x0a, 0x52, 0x65, 0x67,
0x69, 0x63, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x53, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x47, 0x55, 0x4c,
0x53, 0x5f, 0x41, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x53, 0x53, 0x5f, 0x42, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x53, 0x53, 0x5f, 0x43, 0x10, 0x02, 0x42, 0x13, 0x0a, 0x0f, 0x45, 0x54, 0x53, 0x49, 0x5f, 0x45, 0x4e, 0x5f, 0x33, 0x30, 0x30, 0x5f, 0x32,
0x69, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x32, 0x30, 0x10, 0x01, 0x2a, 0x34, 0x0a, 0x0b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6c,
0x2e, 0x61, 0x70, 0x69, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x61, 0x73, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x53, 0x53, 0x5f, 0x41, 0x10, 0x00,
0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4c, 0x41, 0x53, 0x53, 0x5f, 0x42, 0x10, 0x01, 0x12, 0x0b, 0x0a,
0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x07, 0x43, 0x4c, 0x41, 0x53, 0x53, 0x5f, 0x43, 0x10, 0x02, 0x42, 0x69, 0x0a, 0x11, 0x69, 0x6f,
0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0xaa, 0x02, 0x11, 0x43, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31,
0x61, 0x63, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70,
0x6f, 0x33, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b,
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0xaa, 0x02, 0x11, 0x43, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x43,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1038,7 +1089,7 @@ func file_common_common_proto_rawDescGZIP() []byte {
return file_common_common_proto_rawDescData return file_common_common_proto_rawDescData
} }
var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 9) var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 10)
var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_common_common_proto_goTypes = []interface{}{ var file_common_common_proto_goTypes = []interface{}{
(Modulation)(0), // 0: common.Modulation (Modulation)(0), // 0: common.Modulation
@ -1049,20 +1100,21 @@ var file_common_common_proto_goTypes = []interface{}{
(LocationSource)(0), // 5: common.LocationSource (LocationSource)(0), // 5: common.LocationSource
(Aggregation)(0), // 6: common.Aggregation (Aggregation)(0), // 6: common.Aggregation
(MetricKind)(0), // 7: common.MetricKind (MetricKind)(0), // 7: common.MetricKind
(DeviceClass)(0), // 8: common.DeviceClass (Regulation)(0), // 8: common.Regulation
(*Location)(nil), // 9: common.Location (DeviceClass)(0), // 9: common.DeviceClass
(*KeyEnvelope)(nil), // 10: common.KeyEnvelope (*Location)(nil), // 10: common.Location
(*Metric)(nil), // 11: common.Metric (*KeyEnvelope)(nil), // 11: common.KeyEnvelope
(*MetricDataset)(nil), // 12: common.MetricDataset (*Metric)(nil), // 12: common.Metric
(*JoinServerContext)(nil), // 13: common.JoinServerContext (*MetricDataset)(nil), // 13: common.MetricDataset
(*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp (*JoinServerContext)(nil), // 14: common.JoinServerContext
(*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp
} }
var file_common_common_proto_depIdxs = []int32{ var file_common_common_proto_depIdxs = []int32{
5, // 0: common.Location.source:type_name -> common.LocationSource 5, // 0: common.Location.source:type_name -> common.LocationSource
14, // 1: common.Metric.timestamps:type_name -> google.protobuf.Timestamp 15, // 1: common.Metric.timestamps:type_name -> google.protobuf.Timestamp
12, // 2: common.Metric.datasets:type_name -> common.MetricDataset 13, // 2: common.Metric.datasets:type_name -> common.MetricDataset
7, // 3: common.Metric.kind:type_name -> common.MetricKind 7, // 3: common.Metric.kind:type_name -> common.MetricKind
10, // 4: common.JoinServerContext.app_s_key:type_name -> common.KeyEnvelope 11, // 4: common.JoinServerContext.app_s_key:type_name -> common.KeyEnvelope
5, // [5:5] is the sub-list for method output_type 5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type 5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name 5, // [5:5] is the sub-list for extension type_name
@ -1142,7 +1194,7 @@ func file_common_common_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_common_proto_rawDesc, RawDescriptor: file_common_common_proto_rawDesc,
NumEnums: 9, NumEnums: 10,
NumMessages: 5, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,

1448
api/go/gw/gw.pb.go vendored

File diff suppressed because it is too large Load Diff

View File

@ -155,6 +155,14 @@ enum MetricKind {
GAUGE = 2; GAUGE = 2;
} }
enum Regulation {
// Unknown.
REGULATION_UNKNOWN = 0;
// ETSI EN 300 220.
ETSI_EN_300_220 = 1;
}
message Location { message Location {
// Latitude. // Latitude.
double latitude = 1; double latitude = 1;
@ -221,4 +229,4 @@ message JoinServerContext {
// AppSKey envelope. // AppSKey envelope.
KeyEnvelope app_s_key = 2; KeyEnvelope app_s_key = 2;
} }

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

@ -97,6 +97,9 @@ enum TxAckStatus {
// Internal error. // Internal error.
INTERNAL_ERROR = 10; INTERNAL_ERROR = 10;
// Duty-cycle overflow.
DUTY_CYCLE_OVERFLOW = 11;
} }
message Modulation { message Modulation {
@ -249,6 +252,9 @@ message GatewayStats {
// Tx packets per status. // Tx packets per status.
map<string, uint32> tx_packets_per_status = 16; map<string, uint32> tx_packets_per_status = 16;
// Duty-cycle statistics (Concentratord only).
DutyCycleStats duty_cycle_stats = 18;
} }
message PerModulationCount { message PerModulationCount {
@ -259,6 +265,31 @@ message PerModulationCount {
uint32 count = 2; uint32 count = 2;
} }
message DutyCycleStats {
// Implemented regulation.
common.Regulation regulation = 1;
// Bands.
repeated DutyCycleBand bands = 2;
}
message DutyCycleBand {
// Band name.
string name = 1;
// Min frequency for this band.
uint32 frequency_min = 2;
// Max frequency for this band.
uint32 frequency_max = 3;
// Max. allowed load.
google.protobuf.Duration load_max = 4;
// Tracked load (within the window of the regionlation).
google.protobuf.Duration load_tracked = 5;
}
message UplinkRxInfoLegacy { message UplinkRxInfoLegacy {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; bytes gateway_id = 1;

View File

@ -155,6 +155,14 @@ enum MetricKind {
GAUGE = 2; GAUGE = 2;
} }
enum Regulation {
// Unknown.
REGULATION_UNKNOWN = 0;
// ETSI EN 300 220.
ETSI_EN_300_220 = 1;
}
message Location { message Location {
// Latitude. // Latitude.
double latitude = 1; double latitude = 1;
@ -221,4 +229,4 @@ message JoinServerContext {
// AppSKey envelope. // AppSKey envelope.
KeyEnvelope app_s_key = 2; KeyEnvelope app_s_key = 2;
} }

View File

@ -97,6 +97,9 @@ enum TxAckStatus {
// Internal error. // Internal error.
INTERNAL_ERROR = 10; INTERNAL_ERROR = 10;
// Duty-cycle overflow.
DUTY_CYCLE_OVERFLOW = 11;
} }
message Modulation { message Modulation {
@ -249,6 +252,9 @@ message GatewayStats {
// Tx packets per status. // Tx packets per status.
map<string, uint32> tx_packets_per_status = 16; map<string, uint32> tx_packets_per_status = 16;
// Duty-cycle statistics (Concentratord only).
DutyCycleStats duty_cycle_stats = 18;
} }
message PerModulationCount { message PerModulationCount {
@ -259,6 +265,31 @@ message PerModulationCount {
uint32 count = 2; uint32 count = 2;
} }
message DutyCycleStats {
// Implemented regulation.
common.Regulation regulation = 1;
// Bands.
repeated DutyCycleBand bands = 2;
}
message DutyCycleBand {
// Band name.
string name = 1;
// Min frequency for this band.
uint32 frequency_min = 2;
// Max frequency for this band.
uint32 frequency_max = 3;
// Max. allowed load.
google.protobuf.Duration load_max = 4;
// Tracked load (within the window of the regionlation).
google.protobuf.Duration load_tracked = 5;
}
message UplinkRxInfoLegacy { message UplinkRxInfoLegacy {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1; bytes gateway_id = 1;

1
api/rust/build.rs vendored
View File

@ -74,6 +74,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// internal // internal
{ {
#[allow(unused_mut)]
let mut builder = tonic_build::configure() let mut builder = tonic_build::configure()
.out_dir(out_dir.join("internal")) .out_dir(out_dir.join("internal"))
.file_descriptor_set_path(out_dir.join("internal").join("proto_descriptor.bin")) .file_descriptor_set_path(out_dir.join("internal").join("proto_descriptor.bin"))

1
api/rust/src/gw.rs vendored
View File

@ -67,6 +67,7 @@ impl Into<String> for TxAckStatus {
TxAckStatus::GpsUnlocked => "GPS_UNLOCKED", TxAckStatus::GpsUnlocked => "GPS_UNLOCKED",
TxAckStatus::QueueFull => "QUEUE_FULL", TxAckStatus::QueueFull => "QUEUE_FULL",
TxAckStatus::InternalError => "INTERNAL_ERROR", TxAckStatus::InternalError => "INTERNAL_ERROR",
TxAckStatus::DutyCycleOverflow => "DUTY_CYCLE_OVERFLOW",
} }
.to_string() .to_string()
} }