Refactor uplink / downlink GW <> NS messages.

This includes:

* Changing the modulation parameters to its own type.
* Changing the timing parameters to its own type.
* Change the gateway_id to string. As the json encoding for bytes fields
  is base64, this was confusing some users.
* Change the uplink / downlink id to uint32 from uuid. A string
  representation of the UUID field (for the same reason as the gateway
  id) would consome quite some additional bytes. An uint32 provides
  sufficient uniqueness for the purpose of uplink / downlink.
This commit is contained in:
Orne Brocaar 2022-04-21 11:42:28 +01:00
parent f033793f74
commit e649e75c8d
56 changed files with 6112 additions and 3661 deletions

2
Cargo.lock generated
View File

@ -873,11 +873,13 @@ dependencies = [
name = "chirpstack_api"
version = "4.0.0"
dependencies = [
"hex",
"pbjson",
"pbjson-build",
"pbjson-types",
"prost",
"prost-types",
"rand",
"serde",
"tokio",
"tonic",

2
api/Dockerfile-rust vendored
View File

@ -2,7 +2,7 @@ FROM rust:1.56
ENV PROJECT_PATH=/chirpstack/api
RUN apt-get update && \
apt-get install -y make git bash && \
apt-get install -y make cmake git bash && \
apt-get clean
RUN git clone https://github.com/googleapis/googleapis.git /googleapis

View File

@ -31,9 +31,9 @@ type UplinkFrameLog struct {
// PHYPayload.
PhyPayload []byte `protobuf:"bytes,1,opt,name=phy_payload,json=phyPayload,proto3" json:"phy_payload,omitempty"`
// TX meta-data.
TxInfo *gw.UplinkTXInfo `protobuf:"bytes,2,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
TxInfo *gw.UplinkTxInfo `protobuf:"bytes,2,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
// RX meta-data.
RxInfo []*gw.UplinkRXInfo `protobuf:"bytes,3,rep,name=rx_info,json=rxInfo,proto3" json:"rx_info,omitempty"`
RxInfo []*gw.UplinkRxInfo `protobuf:"bytes,3,rep,name=rx_info,json=rxInfo,proto3" json:"rx_info,omitempty"`
// Message type.
MType common.MType `protobuf:"varint,4,opt,name=m_type,json=mType,proto3,enum=common.MType" json:"m_type,omitempty"`
// Device address (optional).
@ -83,14 +83,14 @@ func (x *UplinkFrameLog) GetPhyPayload() []byte {
return nil
}
func (x *UplinkFrameLog) GetTxInfo() *gw.UplinkTXInfo {
func (x *UplinkFrameLog) GetTxInfo() *gw.UplinkTxInfo {
if x != nil {
return x.TxInfo
}
return nil
}
func (x *UplinkFrameLog) GetRxInfo() []*gw.UplinkRXInfo {
func (x *UplinkFrameLog) GetRxInfo() []*gw.UplinkRxInfo {
if x != nil {
return x.RxInfo
}
@ -135,9 +135,9 @@ type DownlinkFrameLog struct {
// PHYPayload.
PhyPayload []byte `protobuf:"bytes,2,opt,name=phy_payload,json=phyPayload,proto3" json:"phy_payload,omitempty"`
// TX meta-data.
TxInfo *gw.DownlinkTXInfo `protobuf:"bytes,3,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
// Downlink ID (UUID).
DownlinkId string `protobuf:"bytes,4,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"`
TxInfo *gw.DownlinkTxInfo `protobuf:"bytes,3,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
// Downlink ID.
DownlinkId uint32 `protobuf:"varint,4,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"`
// Gateway ID (EUI64).
GatewayId string `protobuf:"bytes,5,opt,name=gateway_id,json=gatewayId,proto3" json:"gateway_id,omitempty"`
// Message type.
@ -194,18 +194,18 @@ func (x *DownlinkFrameLog) GetPhyPayload() []byte {
return nil
}
func (x *DownlinkFrameLog) GetTxInfo() *gw.DownlinkTXInfo {
func (x *DownlinkFrameLog) GetTxInfo() *gw.DownlinkTxInfo {
if x != nil {
return x.TxInfo
}
return nil
}
func (x *DownlinkFrameLog) GetDownlinkId() string {
func (x *DownlinkFrameLog) GetDownlinkId() uint32 {
if x != nil {
return x.DownlinkId
}
return ""
return 0
}
func (x *DownlinkFrameLog) GetGatewayId() string {
@ -249,10 +249,10 @@ var file_api_frame_log_proto_rawDesc = []byte{
0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x68, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x68, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
0x64, 0x12, 0x29, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x58,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x78,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x29, 0x0a, 0x07,
0x72, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x58, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x06, 0x72, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x0a, 0x06, 0x6d, 0x5f, 0x74, 0x79, 0x70,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2e, 0x4d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a,
@ -270,9 +270,9 @@ var file_api_frame_log_proto_rawDesc = []byte{
0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x68, 0x79,
0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x2b, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x69, 0x6e,
0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x77, 0x2e, 0x44, 0x6f,
0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x58, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78,
0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78,
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b,
0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x77, 0x6e, 0x6c,
0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x6f, 0x77, 0x6e, 0x6c,
0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79,
0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x61, 0x74, 0x65, 0x77,
0x61, 0x79, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x06, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06,
@ -305,19 +305,19 @@ var file_api_frame_log_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_api_frame_log_proto_goTypes = []interface{}{
(*UplinkFrameLog)(nil), // 0: api.UplinkFrameLog
(*DownlinkFrameLog)(nil), // 1: api.DownlinkFrameLog
(*gw.UplinkTXInfo)(nil), // 2: gw.UplinkTXInfo
(*gw.UplinkRXInfo)(nil), // 3: gw.UplinkRXInfo
(*gw.UplinkTxInfo)(nil), // 2: gw.UplinkTxInfo
(*gw.UplinkRxInfo)(nil), // 3: gw.UplinkRxInfo
(common.MType)(0), // 4: common.MType
(*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp
(*gw.DownlinkTXInfo)(nil), // 6: gw.DownlinkTXInfo
(*gw.DownlinkTxInfo)(nil), // 6: gw.DownlinkTxInfo
}
var file_api_frame_log_proto_depIdxs = []int32{
2, // 0: api.UplinkFrameLog.tx_info:type_name -> gw.UplinkTXInfo
3, // 1: api.UplinkFrameLog.rx_info:type_name -> gw.UplinkRXInfo
2, // 0: api.UplinkFrameLog.tx_info:type_name -> gw.UplinkTxInfo
3, // 1: api.UplinkFrameLog.rx_info:type_name -> gw.UplinkRxInfo
4, // 2: api.UplinkFrameLog.m_type:type_name -> common.MType
5, // 3: api.UplinkFrameLog.time:type_name -> google.protobuf.Timestamp
5, // 4: api.DownlinkFrameLog.time:type_name -> google.protobuf.Timestamp
6, // 5: api.DownlinkFrameLog.tx_info:type_name -> gw.DownlinkTXInfo
6, // 5: api.DownlinkFrameLog.tx_info:type_name -> gw.DownlinkTxInfo
4, // 6: api.DownlinkFrameLog.m_type:type_name -> common.MType
7, // [7:7] is the sub-list for method output_type
7, // [7:7] is the sub-list for method input_type

2857
api/go/gw/gw.pb.go vendored

File diff suppressed because it is too large Load Diff

View File

@ -303,9 +303,9 @@ type UplinkEvent struct {
// Note that this is only set when a codec is configured in the Device Profile.
Object *structpb.Struct `protobuf:"bytes,11,opt,name=object,proto3" json:"object,omitempty"`
// Receiving gateway RX info.
RxInfo []*gw.UplinkRXInfo `protobuf:"bytes,12,rep,name=rx_info,json=rxInfo,proto3" json:"rx_info,omitempty"`
RxInfo []*gw.UplinkRxInfo `protobuf:"bytes,12,rep,name=rx_info,json=rxInfo,proto3" json:"rx_info,omitempty"`
// TX info.
TxInfo *gw.UplinkTXInfo `protobuf:"bytes,13,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
TxInfo *gw.UplinkTxInfo `protobuf:"bytes,13,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
}
func (x *UplinkEvent) Reset() {
@ -417,14 +417,14 @@ func (x *UplinkEvent) GetObject() *structpb.Struct {
return nil
}
func (x *UplinkEvent) GetRxInfo() []*gw.UplinkRXInfo {
func (x *UplinkEvent) GetRxInfo() []*gw.UplinkRxInfo {
if x != nil {
return x.RxInfo
}
return nil
}
func (x *UplinkEvent) GetTxInfo() *gw.UplinkTXInfo {
func (x *UplinkEvent) GetTxInfo() *gw.UplinkTxInfo {
if x != nil {
return x.TxInfo
}
@ -611,8 +611,8 @@ type TxAckEvent struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Downlink ID (UUID).
DownlinkId string `protobuf:"bytes,1,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"`
// Downlink ID.
DownlinkId uint32 `protobuf:"varint,1,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"`
// Timestamp.
Time *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"`
// Device info.
@ -624,7 +624,7 @@ type TxAckEvent struct {
// Gateway ID.
GatewayId string `protobuf:"bytes,6,opt,name=gateway_id,json=gatewayId,proto3" json:"gateway_id,omitempty"`
// TX info.
TxInfo *gw.DownlinkTXInfo `protobuf:"bytes,7,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
TxInfo *gw.DownlinkTxInfo `protobuf:"bytes,7,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
}
func (x *TxAckEvent) Reset() {
@ -659,11 +659,11 @@ func (*TxAckEvent) Descriptor() ([]byte, []int) {
return file_integration_integration_proto_rawDescGZIP(), []int{4}
}
func (x *TxAckEvent) GetDownlinkId() string {
func (x *TxAckEvent) GetDownlinkId() uint32 {
if x != nil {
return x.DownlinkId
}
return ""
return 0
}
func (x *TxAckEvent) GetTime() *timestamppb.Timestamp {
@ -701,7 +701,7 @@ func (x *TxAckEvent) GetGatewayId() string {
return ""
}
func (x *TxAckEvent) GetTxInfo() *gw.DownlinkTXInfo {
func (x *TxAckEvent) GetTxInfo() *gw.DownlinkTxInfo {
if x != nil {
return x.TxInfo
}
@ -1151,10 +1151,10 @@ var file_integration_integration_proto_rawDesc = []byte{
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74,
0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x72, 0x78, 0x5f, 0x69,
0x6e, 0x66, 0x6f, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x77, 0x2e, 0x55,
0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x58, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x72, 0x78, 0x49,
0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x72, 0x78, 0x49,
0x6e, 0x66, 0x6f, 0x12, 0x29, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0d,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b,
0x54, 0x58, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xbb,
0x54, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xbb,
0x01, 0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10,
0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63,
@ -1185,7 +1185,7 @@ var file_integration_integration_proto_rawDesc = []byte{
0x64, 0x6f, 0x77, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x66, 0x43, 0x6e, 0x74,
0x44, 0x6f, 0x77, 0x6e, 0x22, 0xa5, 0x02, 0x0a, 0x0a, 0x54, 0x78, 0x41, 0x63, 0x6b, 0x45, 0x76,
0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69,
0x6e, 0x6b, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04,
@ -1200,7 +1200,7 @@ var file_integration_integration_proto_rawDesc = []byte{
0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x49, 0x64, 0x12,
0x2b, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x12, 0x2e, 0x67, 0x77, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x58,
0x32, 0x12, 0x2e, 0x67, 0x77, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x78,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x92, 0x03, 0x0a,
0x08, 0x4c, 0x6f, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x64,
0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
@ -1335,9 +1335,9 @@ var file_integration_integration_proto_goTypes = []interface{}{
nil, // 12: integration.LogEvent.ContextEntry
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
(*structpb.Struct)(nil), // 14: google.protobuf.Struct
(*gw.UplinkRXInfo)(nil), // 15: gw.UplinkRXInfo
(*gw.UplinkTXInfo)(nil), // 16: gw.UplinkTXInfo
(*gw.DownlinkTXInfo)(nil), // 17: gw.DownlinkTXInfo
(*gw.UplinkRxInfo)(nil), // 15: gw.UplinkRxInfo
(*gw.UplinkTxInfo)(nil), // 16: gw.UplinkTxInfo
(*gw.DownlinkTxInfo)(nil), // 17: gw.DownlinkTxInfo
(*common.Location)(nil), // 18: common.Location
}
var file_integration_integration_proto_depIdxs = []int32{
@ -1345,15 +1345,15 @@ var file_integration_integration_proto_depIdxs = []int32{
13, // 1: integration.UplinkEvent.time:type_name -> google.protobuf.Timestamp
2, // 2: integration.UplinkEvent.device_info:type_name -> integration.DeviceInfo
14, // 3: integration.UplinkEvent.object:type_name -> google.protobuf.Struct
15, // 4: integration.UplinkEvent.rx_info:type_name -> gw.UplinkRXInfo
16, // 5: integration.UplinkEvent.tx_info:type_name -> gw.UplinkTXInfo
15, // 4: integration.UplinkEvent.rx_info:type_name -> gw.UplinkRxInfo
16, // 5: integration.UplinkEvent.tx_info:type_name -> gw.UplinkTxInfo
13, // 6: integration.JoinEvent.time:type_name -> google.protobuf.Timestamp
2, // 7: integration.JoinEvent.device_info:type_name -> integration.DeviceInfo
13, // 8: integration.AckEvent.time:type_name -> google.protobuf.Timestamp
2, // 9: integration.AckEvent.device_info:type_name -> integration.DeviceInfo
13, // 10: integration.TxAckEvent.time:type_name -> google.protobuf.Timestamp
2, // 11: integration.TxAckEvent.device_info:type_name -> integration.DeviceInfo
17, // 12: integration.TxAckEvent.tx_info:type_name -> gw.DownlinkTXInfo
17, // 12: integration.TxAckEvent.tx_info:type_name -> gw.DownlinkTxInfo
13, // 13: integration.LogEvent.time:type_name -> google.protobuf.Timestamp
2, // 14: integration.LogEvent.device_info:type_name -> integration.DeviceInfo
0, // 15: integration.LogEvent.level:type_name -> integration.LogLevel

View File

@ -30,9 +30,9 @@ type UplinkMeta struct {
// Device EUI (EUI64).
DevEui string `protobuf:"bytes,1,opt,name=dev_eui,json=devEui,proto3" json:"dev_eui,omitempty"`
// TX meta-data.
TxInfo *gw.UplinkTXInfo `protobuf:"bytes,2,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
TxInfo *gw.UplinkTxInfo `protobuf:"bytes,2,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
// RX meta-data.
RxInfo []*gw.UplinkRXInfo `protobuf:"bytes,3,rep,name=rx_info,json=rxInfo,proto3" json:"rx_info,omitempty"`
RxInfo []*gw.UplinkRxInfo `protobuf:"bytes,3,rep,name=rx_info,json=rxInfo,proto3" json:"rx_info,omitempty"`
// PHYPayload byte count.
PhyPayloadByteCount uint32 `protobuf:"varint,4,opt,name=phy_payload_byte_count,json=phyPayloadByteCount,proto3" json:"phy_payload_byte_count,omitempty"`
// MAC-Command byte count.
@ -82,14 +82,14 @@ func (x *UplinkMeta) GetDevEui() string {
return ""
}
func (x *UplinkMeta) GetTxInfo() *gw.UplinkTXInfo {
func (x *UplinkMeta) GetTxInfo() *gw.UplinkTxInfo {
if x != nil {
return x.TxInfo
}
return nil
}
func (x *UplinkMeta) GetRxInfo() []*gw.UplinkRXInfo {
func (x *UplinkMeta) GetRxInfo() []*gw.UplinkRxInfo {
if x != nil {
return x.RxInfo
}
@ -134,7 +134,7 @@ type DownlinkMeta struct {
// Multicast Group ID (UUID).
MulticastGroupId string `protobuf:"bytes,2,opt,name=multicast_group_id,json=multicastGroupId,proto3" json:"multicast_group_id,omitempty"`
// TX meta-data.
TxInfo *gw.DownlinkTXInfo `protobuf:"bytes,3,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
TxInfo *gw.DownlinkTxInfo `protobuf:"bytes,3,opt,name=tx_info,json=txInfo,proto3" json:"tx_info,omitempty"`
// PHYPayload byte count.
PhyPayloadByteCount uint32 `protobuf:"varint,4,opt,name=phy_payload_byte_count,json=phyPayloadByteCount,proto3" json:"phy_payload_byte_count,omitempty"`
// MAC-Command byte count.
@ -193,7 +193,7 @@ func (x *DownlinkMeta) GetMulticastGroupId() string {
return ""
}
func (x *DownlinkMeta) GetTxInfo() *gw.DownlinkTXInfo {
func (x *DownlinkMeta) GetTxInfo() *gw.DownlinkTxInfo {
if x != nil {
return x.TxInfo
}
@ -245,10 +245,10 @@ var file_meta_meta_proto_rawDesc = []byte{
0x6c, 0x69, 0x6e, 0x6b, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x5f,
0x65, 0x75, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x45, 0x75,
0x69, 0x12, 0x29, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x58,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x78,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x29, 0x0a, 0x07,
0x72, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x58, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x67, 0x77, 0x2e, 0x55, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x52, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x06, 0x72, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x16, 0x70, 0x68, 0x79, 0x5f, 0x70,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x70, 0x68, 0x79, 0x50, 0x61, 0x79, 0x6c,
@ -271,7 +271,7 @@ var file_meta_meta_proto_rawDesc = []byte{
0x6d, 0x75, 0x6c, 0x74, 0x69, 0x63, 0x61, 0x73, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64,
0x12, 0x2b, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x12, 0x2e, 0x67, 0x77, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x54,
0x58, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a,
0x78, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x74, 0x78, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a,
0x16, 0x70, 0x68, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74,
0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x70,
0x68, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x43, 0x6f, 0x75,
@ -312,16 +312,16 @@ var file_meta_meta_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_meta_meta_proto_goTypes = []interface{}{
(*UplinkMeta)(nil), // 0: meta.UplinkMeta
(*DownlinkMeta)(nil), // 1: meta.DownlinkMeta
(*gw.UplinkTXInfo)(nil), // 2: gw.UplinkTXInfo
(*gw.UplinkRXInfo)(nil), // 3: gw.UplinkRXInfo
(*gw.UplinkTxInfo)(nil), // 2: gw.UplinkTxInfo
(*gw.UplinkRxInfo)(nil), // 3: gw.UplinkRxInfo
(common.MType)(0), // 4: common.MType
(*gw.DownlinkTXInfo)(nil), // 5: gw.DownlinkTXInfo
(*gw.DownlinkTxInfo)(nil), // 5: gw.DownlinkTxInfo
}
var file_meta_meta_proto_depIdxs = []int32{
2, // 0: meta.UplinkMeta.tx_info:type_name -> gw.UplinkTXInfo
3, // 1: meta.UplinkMeta.rx_info:type_name -> gw.UplinkRXInfo
2, // 0: meta.UplinkMeta.tx_info:type_name -> gw.UplinkTxInfo
3, // 1: meta.UplinkMeta.rx_info:type_name -> gw.UplinkRxInfo
4, // 2: meta.UplinkMeta.message_type:type_name -> common.MType
5, // 3: meta.DownlinkMeta.tx_info:type_name -> gw.DownlinkTXInfo
5, // 3: meta.DownlinkMeta.tx_info:type_name -> gw.DownlinkTxInfo
4, // 4: meta.DownlinkMeta.message_type:type_name -> common.MType
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type

View File

@ -11,15 +11,15 @@ export class UplinkFrameLog extends jspb.Message {
getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): UplinkFrameLog;
getTxInfo(): gw_gw_pb.UplinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTXInfo): UplinkFrameLog;
getTxInfo(): gw_gw_pb.UplinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTxInfo): UplinkFrameLog;
hasTxInfo(): boolean;
clearTxInfo(): UplinkFrameLog;
getRxInfoList(): Array<gw_gw_pb.UplinkRXInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRXInfo>): UplinkFrameLog;
getRxInfoList(): Array<gw_gw_pb.UplinkRxInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRxInfo>): UplinkFrameLog;
clearRxInfoList(): UplinkFrameLog;
addRxInfo(value?: gw_gw_pb.UplinkRXInfo, index?: number): gw_gw_pb.UplinkRXInfo;
addRxInfo(value?: gw_gw_pb.UplinkRxInfo, index?: number): gw_gw_pb.UplinkRxInfo;
getMType(): common_common_pb.MType;
setMType(value: common_common_pb.MType): UplinkFrameLog;
@ -46,8 +46,8 @@ export class UplinkFrameLog extends jspb.Message {
export namespace UplinkFrameLog {
export type AsObject = {
phyPayload: Uint8Array | string,
txInfo?: gw_gw_pb.UplinkTXInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRXInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
mType: common_common_pb.MType,
devAddr: string,
devEui: string,
@ -66,13 +66,13 @@ export class DownlinkFrameLog extends jspb.Message {
getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): DownlinkFrameLog;
getTxInfo(): gw_gw_pb.DownlinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTXInfo): DownlinkFrameLog;
getTxInfo(): gw_gw_pb.DownlinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTxInfo): DownlinkFrameLog;
hasTxInfo(): boolean;
clearTxInfo(): DownlinkFrameLog;
getDownlinkId(): string;
setDownlinkId(value: string): DownlinkFrameLog;
getDownlinkId(): number;
setDownlinkId(value: number): DownlinkFrameLog;
getGatewayId(): string;
setGatewayId(value: string): DownlinkFrameLog;
@ -98,8 +98,8 @@ export namespace DownlinkFrameLog {
export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
phyPayload: Uint8Array | string,
txInfo?: gw_gw_pb.DownlinkTXInfo.AsObject,
downlinkId: string,
txInfo?: gw_gw_pb.DownlinkTxInfo.AsObject,
downlinkId: number,
gatewayId: string,
mType: common_common_pb.MType,
devAddr: string,

View File

@ -105,9 +105,9 @@ proto.api.UplinkFrameLog.prototype.toObject = function(opt_includeInstance) {
proto.api.UplinkFrameLog.toObject = function(includeInstance, msg) {
var f, obj = {
phyPayload: msg.getPhyPayload_asB64(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTXInfo.toObject(includeInstance, f),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTxInfo.toObject(includeInstance, f),
rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance),
gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
mType: jspb.Message.getFieldWithDefault(msg, 4, 0),
devAddr: jspb.Message.getFieldWithDefault(msg, 5, ""),
devEui: jspb.Message.getFieldWithDefault(msg, 6, ""),
@ -153,13 +153,13 @@ proto.api.UplinkFrameLog.deserializeBinaryFromReader = function(msg, reader) {
msg.setPhyPayload(value);
break;
case 2:
var value = new gw_gw_pb.UplinkTXInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
case 3:
var value = new gw_gw_pb.UplinkRXInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.addRxInfo(value);
break;
case 4:
@ -220,7 +220,7 @@ proto.api.UplinkFrameLog.serializeBinaryToWriter = function(message, writer) {
writer.writeMessage(
2,
f,
gw_gw_pb.UplinkTXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkTxInfo.serializeBinaryToWriter
);
}
f = message.getRxInfoList();
@ -228,7 +228,7 @@ proto.api.UplinkFrameLog.serializeBinaryToWriter = function(message, writer) {
writer.writeRepeatedMessage(
3,
f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
);
}
f = message.getMType();
@ -306,17 +306,17 @@ proto.api.UplinkFrameLog.prototype.setPhyPayload = function(value) {
/**
* optional gw.UplinkTXInfo tx_info = 2;
* @return {?proto.gw.UplinkTXInfo}
* optional gw.UplinkTxInfo tx_info = 2;
* @return {?proto.gw.UplinkTxInfo}
*/
proto.api.UplinkFrameLog.prototype.getTxInfo = function() {
return /** @type{?proto.gw.UplinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 2));
return /** @type{?proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTxInfo, 2));
};
/**
* @param {?proto.gw.UplinkTXInfo|undefined} value
* @param {?proto.gw.UplinkTxInfo|undefined} value
* @return {!proto.api.UplinkFrameLog} returns this
*/
proto.api.UplinkFrameLog.prototype.setTxInfo = function(value) {
@ -343,17 +343,17 @@ proto.api.UplinkFrameLog.prototype.hasTxInfo = function() {
/**
* repeated gw.UplinkRXInfo rx_info = 3;
* @return {!Array<!proto.gw.UplinkRXInfo>}
* repeated gw.UplinkRxInfo rx_info = 3;
* @return {!Array<!proto.gw.UplinkRxInfo>}
*/
proto.api.UplinkFrameLog.prototype.getRxInfoList = function() {
return /** @type{!Array<!proto.gw.UplinkRXInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 3));
return /** @type{!Array<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRxInfo, 3));
};
/**
* @param {!Array<!proto.gw.UplinkRXInfo>} value
* @param {!Array<!proto.gw.UplinkRxInfo>} value
* @return {!proto.api.UplinkFrameLog} returns this
*/
proto.api.UplinkFrameLog.prototype.setRxInfoList = function(value) {
@ -362,12 +362,12 @@ proto.api.UplinkFrameLog.prototype.setRxInfoList = function(value) {
/**
* @param {!proto.gw.UplinkRXInfo=} opt_value
* @param {!proto.gw.UplinkRxInfo=} opt_value
* @param {number=} opt_index
* @return {!proto.gw.UplinkRXInfo}
* @return {!proto.gw.UplinkRxInfo}
*/
proto.api.UplinkFrameLog.prototype.addRxInfo = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.gw.UplinkRXInfo, opt_index);
return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.gw.UplinkRxInfo, opt_index);
};
@ -505,8 +505,8 @@ proto.api.DownlinkFrameLog.toObject = function(includeInstance, msg) {
var f, obj = {
time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
phyPayload: msg.getPhyPayload_asB64(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTXInfo.toObject(includeInstance, f),
downlinkId: jspb.Message.getFieldWithDefault(msg, 4, ""),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTxInfo.toObject(includeInstance, f),
downlinkId: jspb.Message.getFieldWithDefault(msg, 4, 0),
gatewayId: jspb.Message.getFieldWithDefault(msg, 5, ""),
mType: jspb.Message.getFieldWithDefault(msg, 6, 0),
devAddr: jspb.Message.getFieldWithDefault(msg, 7, ""),
@ -557,12 +557,12 @@ proto.api.DownlinkFrameLog.deserializeBinaryFromReader = function(msg, reader) {
msg.setPhyPayload(value);
break;
case 3:
var value = new gw_gw_pb.DownlinkTXInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
var value = /** @type {number} */ (reader.readUint32());
msg.setDownlinkId(value);
break;
case 5:
@ -630,12 +630,12 @@ proto.api.DownlinkFrameLog.serializeBinaryToWriter = function(message, writer) {
writer.writeMessage(
3,
f,
gw_gw_pb.DownlinkTXInfo.serializeBinaryToWriter
gw_gw_pb.DownlinkTxInfo.serializeBinaryToWriter
);
}
f = message.getDownlinkId();
if (f.length > 0) {
writer.writeString(
if (f !== 0) {
writer.writeUint32(
4,
f
);
@ -751,17 +751,17 @@ proto.api.DownlinkFrameLog.prototype.setPhyPayload = function(value) {
/**
* optional gw.DownlinkTXInfo tx_info = 3;
* @return {?proto.gw.DownlinkTXInfo}
* optional gw.DownlinkTxInfo tx_info = 3;
* @return {?proto.gw.DownlinkTxInfo}
*/
proto.api.DownlinkFrameLog.prototype.getTxInfo = function() {
return /** @type{?proto.gw.DownlinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 3));
return /** @type{?proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTxInfo, 3));
};
/**
* @param {?proto.gw.DownlinkTXInfo|undefined} value
* @param {?proto.gw.DownlinkTxInfo|undefined} value
* @return {!proto.api.DownlinkFrameLog} returns this
*/
proto.api.DownlinkFrameLog.prototype.setTxInfo = function(value) {
@ -788,20 +788,20 @@ proto.api.DownlinkFrameLog.prototype.hasTxInfo = function() {
/**
* optional string downlink_id = 4;
* @return {string}
* optional uint32 downlink_id = 4;
* @return {number}
*/
proto.api.DownlinkFrameLog.prototype.getDownlinkId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {string} value
* @param {number} value
* @return {!proto.api.DownlinkFrameLog} returns this
*/
proto.api.DownlinkFrameLog.prototype.setDownlinkId = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
return jspb.Message.setProto3IntField(this, 4, value);
};

View File

@ -14,13 +14,13 @@ export class UplinkFrameLog extends jspb.Message {
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): gw_gw_pb.UplinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTXInfo): void;
getTxInfo(): gw_gw_pb.UplinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTxInfo): void;
clearRxInfoList(): void;
getRxInfoList(): Array<gw_gw_pb.UplinkRXInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRXInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRXInfo, index?: number): gw_gw_pb.UplinkRXInfo;
getRxInfoList(): Array<gw_gw_pb.UplinkRxInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRxInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRxInfo, index?: number): gw_gw_pb.UplinkRxInfo;
getMType(): common_common_pb.MTypeMap[keyof common_common_pb.MTypeMap];
setMType(value: common_common_pb.MTypeMap[keyof common_common_pb.MTypeMap]): void;
@ -49,8 +49,8 @@ export class UplinkFrameLog extends jspb.Message {
export namespace UplinkFrameLog {
export type AsObject = {
phyPayload: Uint8Array | string,
txInfo?: gw_gw_pb.UplinkTXInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRXInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
mType: common_common_pb.MTypeMap[keyof common_common_pb.MTypeMap],
devAddr: string,
devEui: string,
@ -71,11 +71,11 @@ export class DownlinkFrameLog extends jspb.Message {
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): gw_gw_pb.DownlinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTXInfo): void;
getTxInfo(): gw_gw_pb.DownlinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTxInfo): void;
getDownlinkId(): string;
setDownlinkId(value: string): void;
getDownlinkId(): number;
setDownlinkId(value: number): void;
getGatewayId(): string;
setGatewayId(value: string): void;
@ -103,8 +103,8 @@ export namespace DownlinkFrameLog {
export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
phyPayload: Uint8Array | string,
txInfo?: gw_gw_pb.DownlinkTXInfo.AsObject,
downlinkId: string,
txInfo?: gw_gw_pb.DownlinkTxInfo.AsObject,
downlinkId: number,
gatewayId: string,
mType: common_common_pb.MTypeMap[keyof common_common_pb.MTypeMap],
devAddr: string,

View File

@ -68,9 +68,9 @@ proto.api.UplinkFrameLog.prototype.toObject = function(opt_includeInstance) {
proto.api.UplinkFrameLog.toObject = function(includeInstance, msg) {
var f, obj = {
phyPayload: msg.getPhyPayload_asB64(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTXInfo.toObject(includeInstance, f),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTxInfo.toObject(includeInstance, f),
rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance),
gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
mType: msg.getMType(),
devAddr: msg.getDevAddr(),
devEui: msg.getDevEui(),
@ -116,13 +116,13 @@ proto.api.UplinkFrameLog.deserializeBinaryFromReader = function(msg, reader) {
msg.setPhyPayload(value);
break;
case 2:
var value = new gw_gw_pb.UplinkTXInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
case 3:
var value = new gw_gw_pb.UplinkRXInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.getRxInfoList().push(value);
msg.setRxInfoList(msg.getRxInfoList());
break;
@ -193,7 +193,7 @@ proto.api.UplinkFrameLog.prototype.serializeBinaryToWriter = function (writer) {
writer.writeMessage(
2,
f,
gw_gw_pb.UplinkTXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkTxInfo.serializeBinaryToWriter
);
}
f = this.getRxInfoList();
@ -201,7 +201,7 @@ proto.api.UplinkFrameLog.prototype.serializeBinaryToWriter = function (writer) {
writer.writeRepeatedMessage(
3,
f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
);
}
f = this.getMType();
@ -285,16 +285,16 @@ proto.api.UplinkFrameLog.prototype.setPhyPayload = function(value) {
/**
* optional gw.UplinkTXInfo tx_info = 2;
* @return {proto.gw.UplinkTXInfo}
* optional gw.UplinkTxInfo tx_info = 2;
* @return {proto.gw.UplinkTxInfo}
*/
proto.api.UplinkFrameLog.prototype.getTxInfo = function() {
return /** @type{proto.gw.UplinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 2));
return /** @type{proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTxInfo, 2));
};
/** @param {proto.gw.UplinkTXInfo|undefined} value */
/** @param {proto.gw.UplinkTxInfo|undefined} value */
proto.api.UplinkFrameLog.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
@ -315,18 +315,18 @@ proto.api.UplinkFrameLog.prototype.hasTxInfo = function() {
/**
* repeated gw.UplinkRXInfo rx_info = 3;
* repeated gw.UplinkRxInfo rx_info = 3;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<!proto.gw.UplinkRXInfo>}
* @return {!Array.<!proto.gw.UplinkRxInfo>}
*/
proto.api.UplinkFrameLog.prototype.getRxInfoList = function() {
return /** @type{!Array.<!proto.gw.UplinkRXInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 3));
return /** @type{!Array.<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRxInfo, 3));
};
/** @param {Array.<!proto.gw.UplinkRXInfo>} value */
/** @param {Array.<!proto.gw.UplinkRxInfo>} value */
proto.api.UplinkFrameLog.prototype.setRxInfoList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 3, value);
};
@ -460,7 +460,7 @@ proto.api.DownlinkFrameLog.toObject = function(includeInstance, msg) {
var f, obj = {
time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
phyPayload: msg.getPhyPayload_asB64(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTXInfo.toObject(includeInstance, f),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTxInfo.toObject(includeInstance, f),
downlinkId: msg.getDownlinkId(),
gatewayId: msg.getGatewayId(),
mType: msg.getMType(),
@ -512,12 +512,12 @@ proto.api.DownlinkFrameLog.deserializeBinaryFromReader = function(msg, reader) {
msg.setPhyPayload(value);
break;
case 3:
var value = new gw_gw_pb.DownlinkTXInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
var value = /** @type {number} */ (reader.readUint32());
msg.setDownlinkId(value);
break;
case 5:
@ -594,12 +594,12 @@ proto.api.DownlinkFrameLog.prototype.serializeBinaryToWriter = function (writer)
writer.writeMessage(
3,
f,
gw_gw_pb.DownlinkTXInfo.serializeBinaryToWriter
gw_gw_pb.DownlinkTxInfo.serializeBinaryToWriter
);
}
f = this.getDownlinkId();
if (f.length > 0) {
writer.writeString(
if (f !== 0) {
writer.writeUint32(
4,
f
);
@ -714,16 +714,16 @@ proto.api.DownlinkFrameLog.prototype.setPhyPayload = function(value) {
/**
* optional gw.DownlinkTXInfo tx_info = 3;
* @return {proto.gw.DownlinkTXInfo}
* optional gw.DownlinkTxInfo tx_info = 3;
* @return {proto.gw.DownlinkTxInfo}
*/
proto.api.DownlinkFrameLog.prototype.getTxInfo = function() {
return /** @type{proto.gw.DownlinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 3));
return /** @type{proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTxInfo, 3));
};
/** @param {proto.gw.DownlinkTXInfo|undefined} value */
/** @param {proto.gw.DownlinkTxInfo|undefined} value */
proto.api.DownlinkFrameLog.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 3, value);
};
@ -744,15 +744,15 @@ proto.api.DownlinkFrameLog.prototype.hasTxInfo = function() {
/**
* optional string downlink_id = 4;
* @return {string}
* optional uint32 downlink_id = 4;
* @return {number}
*/
proto.api.DownlinkFrameLog.prototype.getDownlinkId = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 4, ""));
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 4, 0));
};
/** @param {string} value */
/** @param {number} value */
proto.api.DownlinkFrameLog.prototype.setDownlinkId = function(value) {
jspb.Message.setField(this, 4, value);
};

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

@ -5,22 +5,23 @@ import * as jspb from "google-protobuf";
import * as common_common_pb from "../common/common_pb";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
export class Modulation extends jspb.Message {
hasLora(): boolean;
clearLora(): void;
getLora(): LoRaModulationInfo | undefined;
setLora(value?: LoRaModulationInfo): void;
getLora(): LoraModulationInfo | undefined;
setLora(value?: LoraModulationInfo): void;
hasFsk(): boolean;
clearFsk(): void;
getFsk(): FSKModulationInfo | undefined;
setFsk(value?: FSKModulationInfo): void;
getFsk(): FskModulationInfo | undefined;
setFsk(value?: FskModulationInfo): void;
hasLrFhss(): boolean;
clearLrFhss(): void;
getLrFhss(): LRFHSSModulationInfo | undefined;
setLrFhss(value?: LRFHSSModulationInfo): void;
getLrFhss(): LrFhssModulationInfo | undefined;
setLrFhss(value?: LrFhssModulationInfo): void;
getParametersCase(): Modulation.ParametersCase;
serializeBinary(): Uint8Array;
@ -35,9 +36,9 @@ export class Modulation extends jspb.Message {
export namespace Modulation {
export type AsObject = {
lora?: LoRaModulationInfo.AsObject,
fsk?: FSKModulationInfo.AsObject,
lrFhss?: LRFHSSModulationInfo.AsObject,
lora?: LoraModulationInfo.AsObject,
fsk?: FskModulationInfo.AsObject,
lrFhss?: LrFhssModulationInfo.AsObject,
}
export enum ParametersCase {
@ -48,7 +49,7 @@ export namespace Modulation {
}
}
export class UplinkTXInfo extends jspb.Message {
export class UplinkTxInfoLegacy extends jspb.Message {
getFrequency(): number;
setFrequency(value: number): void;
@ -57,37 +58,37 @@ export class UplinkTXInfo extends jspb.Message {
hasLoraModulationInfo(): boolean;
clearLoraModulationInfo(): void;
getLoraModulationInfo(): LoRaModulationInfo | undefined;
setLoraModulationInfo(value?: LoRaModulationInfo): void;
getLoraModulationInfo(): LoraModulationInfo | undefined;
setLoraModulationInfo(value?: LoraModulationInfo): void;
hasFskModulationInfo(): boolean;
clearFskModulationInfo(): void;
getFskModulationInfo(): FSKModulationInfo | undefined;
setFskModulationInfo(value?: FSKModulationInfo): void;
getFskModulationInfo(): FskModulationInfo | undefined;
setFskModulationInfo(value?: FskModulationInfo): void;
hasLrFhssModulationInfo(): boolean;
clearLrFhssModulationInfo(): void;
getLrFhssModulationInfo(): LRFHSSModulationInfo | undefined;
setLrFhssModulationInfo(value?: LRFHSSModulationInfo): void;
getLrFhssModulationInfo(): LrFhssModulationInfo | undefined;
setLrFhssModulationInfo(value?: LrFhssModulationInfo): void;
getModulationInfoCase(): UplinkTXInfo.ModulationInfoCase;
getModulationInfoCase(): UplinkTxInfoLegacy.ModulationInfoCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkTXInfo.AsObject;
static toObject(includeInstance: boolean, msg: UplinkTXInfo): UplinkTXInfo.AsObject;
toObject(includeInstance?: boolean): UplinkTxInfoLegacy.AsObject;
static toObject(includeInstance: boolean, msg: UplinkTxInfoLegacy): UplinkTxInfoLegacy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UplinkTXInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkTXInfo;
static deserializeBinaryFromReader(message: UplinkTXInfo, reader: jspb.BinaryReader): UplinkTXInfo;
static serializeBinaryToWriter(message: UplinkTxInfoLegacy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkTxInfoLegacy;
static deserializeBinaryFromReader(message: UplinkTxInfoLegacy, reader: jspb.BinaryReader): UplinkTxInfoLegacy;
}
export namespace UplinkTXInfo {
export namespace UplinkTxInfoLegacy {
export type AsObject = {
frequency: number,
modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationInfo?: LoRaModulationInfo.AsObject,
fskModulationInfo?: FSKModulationInfo.AsObject,
lrFhssModulationInfo?: LRFHSSModulationInfo.AsObject,
loraModulationInfo?: LoraModulationInfo.AsObject,
fskModulationInfo?: FskModulationInfo.AsObject,
lrFhssModulationInfo?: LrFhssModulationInfo.AsObject,
}
export enum ModulationInfoCase {
@ -98,39 +99,69 @@ export namespace UplinkTXInfo {
}
}
export class LoRaModulationInfo extends jspb.Message {
export class UplinkTxInfo extends jspb.Message {
getFrequency(): number;
setFrequency(value: number): void;
hasModulation(): boolean;
clearModulation(): void;
getModulation(): Modulation | undefined;
setModulation(value?: Modulation): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkTxInfo.AsObject;
static toObject(includeInstance: boolean, msg: UplinkTxInfo): UplinkTxInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UplinkTxInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkTxInfo;
static deserializeBinaryFromReader(message: UplinkTxInfo, reader: jspb.BinaryReader): UplinkTxInfo;
}
export namespace UplinkTxInfo {
export type AsObject = {
frequency: number,
modulation?: Modulation.AsObject,
}
}
export class LoraModulationInfo extends jspb.Message {
getBandwidth(): number;
setBandwidth(value: number): void;
getSpreadingFactor(): number;
setSpreadingFactor(value: number): void;
getCodeRate(): string;
setCodeRate(value: string): void;
getCodeRateLegacy(): string;
setCodeRateLegacy(value: string): void;
getCodeRate(): CodeRateMap[keyof CodeRateMap];
setCodeRate(value: CodeRateMap[keyof CodeRateMap]): void;
getPolarizationInversion(): boolean;
setPolarizationInversion(value: boolean): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoRaModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: LoRaModulationInfo): LoRaModulationInfo.AsObject;
toObject(includeInstance?: boolean): LoraModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: LoraModulationInfo): LoraModulationInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LoRaModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoRaModulationInfo;
static deserializeBinaryFromReader(message: LoRaModulationInfo, reader: jspb.BinaryReader): LoRaModulationInfo;
static serializeBinaryToWriter(message: LoraModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoraModulationInfo;
static deserializeBinaryFromReader(message: LoraModulationInfo, reader: jspb.BinaryReader): LoraModulationInfo;
}
export namespace LoRaModulationInfo {
export namespace LoraModulationInfo {
export type AsObject = {
bandwidth: number,
spreadingFactor: number,
codeRate: string,
codeRateLegacy: string,
codeRate: CodeRateMap[keyof CodeRateMap],
polarizationInversion: boolean,
}
}
export class FSKModulationInfo extends jspb.Message {
export class FskModulationInfo extends jspb.Message {
getFrequencyDeviation(): number;
setFrequencyDeviation(value: number): void;
@ -138,23 +169,23 @@ export class FSKModulationInfo extends jspb.Message {
setDatarate(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FSKModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: FSKModulationInfo): FSKModulationInfo.AsObject;
toObject(includeInstance?: boolean): FskModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: FskModulationInfo): FskModulationInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: FSKModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FSKModulationInfo;
static deserializeBinaryFromReader(message: FSKModulationInfo, reader: jspb.BinaryReader): FSKModulationInfo;
static serializeBinaryToWriter(message: FskModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FskModulationInfo;
static deserializeBinaryFromReader(message: FskModulationInfo, reader: jspb.BinaryReader): FskModulationInfo;
}
export namespace FSKModulationInfo {
export namespace FskModulationInfo {
export type AsObject = {
frequencyDeviation: number,
datarate: number,
}
}
export class LRFHSSModulationInfo extends jspb.Message {
export class LrFhssModulationInfo extends jspb.Message {
getOperatingChannelWidth(): number;
setOperatingChannelWidth(value: number): void;
@ -165,16 +196,16 @@ export class LRFHSSModulationInfo extends jspb.Message {
setGridSteps(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LRFHSSModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: LRFHSSModulationInfo): LRFHSSModulationInfo.AsObject;
toObject(includeInstance?: boolean): LrFhssModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: LrFhssModulationInfo): LrFhssModulationInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LRFHSSModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LRFHSSModulationInfo;
static deserializeBinaryFromReader(message: LRFHSSModulationInfo, reader: jspb.BinaryReader): LRFHSSModulationInfo;
static serializeBinaryToWriter(message: LrFhssModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LrFhssModulationInfo;
static deserializeBinaryFromReader(message: LrFhssModulationInfo, reader: jspb.BinaryReader): LrFhssModulationInfo;
}
export namespace LRFHSSModulationInfo {
export namespace LrFhssModulationInfo {
export type AsObject = {
operatingChannelWidth: number,
codeRate: string,
@ -350,7 +381,7 @@ export namespace PerModulationCount {
}
}
export class UplinkRXInfo extends jspb.Message {
export class UplinkRxInfoLegacy extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
@ -417,18 +448,18 @@ export class UplinkRXInfo extends jspb.Message {
getMetadataMap(): jspb.Map<string, string>;
clearMetadataMap(): void;
getFineTimestampCase(): UplinkRXInfo.FineTimestampCase;
getFineTimestampCase(): UplinkRxInfoLegacy.FineTimestampCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkRXInfo.AsObject;
static toObject(includeInstance: boolean, msg: UplinkRXInfo): UplinkRXInfo.AsObject;
toObject(includeInstance?: boolean): UplinkRxInfoLegacy.AsObject;
static toObject(includeInstance: boolean, msg: UplinkRxInfoLegacy): UplinkRxInfoLegacy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UplinkRXInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkRXInfo;
static deserializeBinaryFromReader(message: UplinkRXInfo, reader: jspb.BinaryReader): UplinkRXInfo;
static serializeBinaryToWriter(message: UplinkRxInfoLegacy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkRxInfoLegacy;
static deserializeBinaryFromReader(message: UplinkRxInfoLegacy, reader: jspb.BinaryReader): UplinkRxInfoLegacy;
}
export namespace UplinkRXInfo {
export namespace UplinkRxInfoLegacy {
export type AsObject = {
gatewayId: Uint8Array | string,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
@ -456,7 +487,83 @@ export namespace UplinkRXInfo {
}
}
export class DownlinkTXInfo extends jspb.Message {
export class UplinkRxInfo extends jspb.Message {
getGatewayId(): string;
setGatewayId(value: string): void;
getUplinkId(): number;
setUplinkId(value: number): void;
hasTime(): boolean;
clearTime(): void;
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
setTime(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasTimeSinceGpsEpoch(): boolean;
clearTimeSinceGpsEpoch(): void;
getTimeSinceGpsEpoch(): google_protobuf_duration_pb.Duration | undefined;
setTimeSinceGpsEpoch(value?: google_protobuf_duration_pb.Duration): void;
hasFineTimeSinceGpsEpoch(): boolean;
clearFineTimeSinceGpsEpoch(): void;
getFineTimeSinceGpsEpoch(): google_protobuf_duration_pb.Duration | undefined;
setFineTimeSinceGpsEpoch(value?: google_protobuf_duration_pb.Duration): void;
getRssi(): number;
setRssi(value: number): void;
getSnr(): number;
setSnr(value: number): void;
getBoard(): number;
setBoard(value: number): void;
getAntenna(): number;
setAntenna(value: number): void;
hasLocation(): boolean;
clearLocation(): void;
getLocation(): common_common_pb.Location | undefined;
setLocation(value?: common_common_pb.Location): void;
getContext(): Uint8Array | string;
getContext_asU8(): Uint8Array;
getContext_asB64(): string;
setContext(value: Uint8Array | string): void;
hasMetadata(): boolean;
clearMetadata(): void;
getMetadata(): google_protobuf_struct_pb.Struct | undefined;
setMetadata(value?: google_protobuf_struct_pb.Struct): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkRxInfo.AsObject;
static toObject(includeInstance: boolean, msg: UplinkRxInfo): UplinkRxInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UplinkRxInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkRxInfo;
static deserializeBinaryFromReader(message: UplinkRxInfo, reader: jspb.BinaryReader): UplinkRxInfo;
}
export namespace UplinkRxInfo {
export type AsObject = {
gatewayId: string,
uplinkId: number,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
timeSinceGpsEpoch?: google_protobuf_duration_pb.Duration.AsObject,
fineTimeSinceGpsEpoch?: google_protobuf_duration_pb.Duration.AsObject,
rssi: number,
snr: number,
board: number,
antenna: number,
location?: common_common_pb.Location.AsObject,
context: Uint8Array | string,
metadata?: google_protobuf_struct_pb.Struct.AsObject,
}
}
export class DownlinkTxInfoLegacy extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
@ -473,13 +580,13 @@ export class DownlinkTXInfo extends jspb.Message {
hasLoraModulationInfo(): boolean;
clearLoraModulationInfo(): void;
getLoraModulationInfo(): LoRaModulationInfo | undefined;
setLoraModulationInfo(value?: LoRaModulationInfo): void;
getLoraModulationInfo(): LoraModulationInfo | undefined;
setLoraModulationInfo(value?: LoraModulationInfo): void;
hasFskModulationInfo(): boolean;
clearFskModulationInfo(): void;
getFskModulationInfo(): FSKModulationInfo | undefined;
setFskModulationInfo(value?: FSKModulationInfo): void;
getFskModulationInfo(): FskModulationInfo | undefined;
setFskModulationInfo(value?: FskModulationInfo): void;
getBoard(): number;
setBoard(value: number): void;
@ -510,26 +617,26 @@ export class DownlinkTXInfo extends jspb.Message {
getContext_asB64(): string;
setContext(value: Uint8Array | string): void;
getModulationInfoCase(): DownlinkTXInfo.ModulationInfoCase;
getTimingInfoCase(): DownlinkTXInfo.TimingInfoCase;
getModulationInfoCase(): DownlinkTxInfoLegacy.ModulationInfoCase;
getTimingInfoCase(): DownlinkTxInfoLegacy.TimingInfoCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTXInfo.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTXInfo): DownlinkTXInfo.AsObject;
toObject(includeInstance?: boolean): DownlinkTxInfoLegacy.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTxInfoLegacy): DownlinkTxInfoLegacy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTXInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTXInfo;
static deserializeBinaryFromReader(message: DownlinkTXInfo, reader: jspb.BinaryReader): DownlinkTXInfo;
static serializeBinaryToWriter(message: DownlinkTxInfoLegacy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTxInfoLegacy;
static deserializeBinaryFromReader(message: DownlinkTxInfoLegacy, reader: jspb.BinaryReader): DownlinkTxInfoLegacy;
}
export namespace DownlinkTXInfo {
export namespace DownlinkTxInfoLegacy {
export type AsObject = {
gatewayId: Uint8Array | string,
frequency: number,
power: number,
modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationInfo?: LoRaModulationInfo.AsObject,
fskModulationInfo?: FSKModulationInfo.AsObject,
loraModulationInfo?: LoraModulationInfo.AsObject,
fskModulationInfo?: FskModulationInfo.AsObject,
board: number,
antenna: number,
timing: DownlinkTimingMap[keyof DownlinkTimingMap],
@ -553,6 +660,98 @@ export namespace DownlinkTXInfo {
}
}
export class DownlinkTxInfo extends jspb.Message {
getFrequency(): number;
setFrequency(value: number): void;
getPower(): number;
setPower(value: number): void;
hasModulation(): boolean;
clearModulation(): void;
getModulation(): Modulation | undefined;
setModulation(value?: Modulation): void;
getBoard(): number;
setBoard(value: number): void;
getAntenna(): number;
setAntenna(value: number): void;
hasTiming(): boolean;
clearTiming(): void;
getTiming(): Timing | undefined;
setTiming(value?: Timing): void;
getContext(): Uint8Array | string;
getContext_asU8(): Uint8Array;
getContext_asB64(): string;
setContext(value: Uint8Array | string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTxInfo.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTxInfo): DownlinkTxInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTxInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTxInfo;
static deserializeBinaryFromReader(message: DownlinkTxInfo, reader: jspb.BinaryReader): DownlinkTxInfo;
}
export namespace DownlinkTxInfo {
export type AsObject = {
frequency: number,
power: number,
modulation?: Modulation.AsObject,
board: number,
antenna: number,
timing?: Timing.AsObject,
context: Uint8Array | string,
}
}
export class Timing extends jspb.Message {
hasImmediately(): boolean;
clearImmediately(): void;
getImmediately(): ImmediatelyTimingInfo | undefined;
setImmediately(value?: ImmediatelyTimingInfo): void;
hasDelay(): boolean;
clearDelay(): void;
getDelay(): DelayTimingInfo | undefined;
setDelay(value?: DelayTimingInfo): void;
hasGpsEpoch(): boolean;
clearGpsEpoch(): void;
getGpsEpoch(): GPSEpochTimingInfo | undefined;
setGpsEpoch(value?: GPSEpochTimingInfo): void;
getParametersCase(): Timing.ParametersCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Timing.AsObject;
static toObject(includeInstance: boolean, msg: Timing): Timing.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Timing, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Timing;
static deserializeBinaryFromReader(message: Timing, reader: jspb.BinaryReader): Timing;
}
export namespace Timing {
export type AsObject = {
immediately?: ImmediatelyTimingInfo.AsObject,
delay?: DelayTimingInfo.AsObject,
gpsEpoch?: GPSEpochTimingInfo.AsObject,
}
export enum ParametersCase {
PARAMETERS_NOT_SET = 0,
IMMEDIATELY = 1,
DELAY = 2,
GPS_EPOCH = 3,
}
}
export class ImmediatelyTimingInfo extends jspb.Message {
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ImmediatelyTimingInfo.AsObject;
@ -619,15 +818,25 @@ export class UplinkFrame extends jspb.Message {
getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): void;
hasTxInfoLegacy(): boolean;
clearTxInfoLegacy(): void;
getTxInfoLegacy(): UplinkTxInfoLegacy | undefined;
setTxInfoLegacy(value?: UplinkTxInfoLegacy): void;
hasRxInfoLegacy(): boolean;
clearRxInfoLegacy(): void;
getRxInfoLegacy(): UplinkRxInfoLegacy | undefined;
setRxInfoLegacy(value?: UplinkRxInfoLegacy): void;
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): UplinkTXInfo | undefined;
setTxInfo(value?: UplinkTXInfo): void;
getTxInfo(): UplinkTxInfo | undefined;
setTxInfo(value?: UplinkTxInfo): void;
hasRxInfo(): boolean;
clearRxInfo(): void;
getRxInfo(): UplinkRXInfo | undefined;
setRxInfo(value?: UplinkRXInfo): void;
getRxInfo(): UplinkRxInfo | undefined;
setRxInfo(value?: UplinkRxInfo): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkFrame.AsObject;
@ -642,8 +851,10 @@ export class UplinkFrame extends jspb.Message {
export namespace UplinkFrame {
export type AsObject = {
phyPayload: Uint8Array | string,
txInfo?: UplinkTXInfo.AsObject,
rxInfo?: UplinkRXInfo.AsObject,
txInfoLegacy?: UplinkTxInfoLegacy.AsObject,
rxInfoLegacy?: UplinkRxInfoLegacy.AsObject,
txInfo?: UplinkTxInfo.AsObject,
rxInfo?: UplinkRxInfo.AsObject,
}
}
@ -655,13 +866,13 @@ export class UplinkFrameSet extends jspb.Message {
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): UplinkTXInfo | undefined;
setTxInfo(value?: UplinkTXInfo): void;
getTxInfo(): UplinkTxInfo | undefined;
setTxInfo(value?: UplinkTxInfo): void;
clearRxInfoList(): void;
getRxInfoList(): Array<UplinkRXInfo>;
setRxInfoList(value: Array<UplinkRXInfo>): void;
addRxInfo(value?: UplinkRXInfo, index?: number): UplinkRXInfo;
getRxInfoList(): Array<UplinkRxInfo>;
setRxInfoList(value: Array<UplinkRxInfo>): void;
addRxInfo(value?: UplinkRxInfo, index?: number): UplinkRxInfo;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkFrameSet.AsObject;
@ -676,39 +887,32 @@ export class UplinkFrameSet extends jspb.Message {
export namespace UplinkFrameSet {
export type AsObject = {
phyPayload: Uint8Array | string,
txInfo?: UplinkTXInfo.AsObject,
rxInfoList: Array<UplinkRXInfo.AsObject>,
txInfo?: UplinkTxInfo.AsObject,
rxInfoList: Array<UplinkRxInfo.AsObject>,
}
}
export class DownlinkFrame extends jspb.Message {
getPhyPayload(): Uint8Array | string;
getPhyPayload_asU8(): Uint8Array;
getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): void;
getDownlinkId(): number;
setDownlinkId(value: number): void;
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): DownlinkTXInfo | undefined;
setTxInfo(value?: DownlinkTXInfo): void;
getToken(): number;
setToken(value: number): void;
getDownlinkId(): Uint8Array | string;
getDownlinkId_asU8(): Uint8Array;
getDownlinkId_asB64(): string;
setDownlinkId(value: Uint8Array | string): void;
getDownlinkIdLegacy(): Uint8Array | string;
getDownlinkIdLegacy_asU8(): Uint8Array;
getDownlinkIdLegacy_asB64(): string;
setDownlinkIdLegacy(value: Uint8Array | string): void;
clearItemsList(): void;
getItemsList(): Array<DownlinkFrameItem>;
setItemsList(value: Array<DownlinkFrameItem>): void;
addItems(value?: DownlinkFrameItem, index?: number): DownlinkFrameItem;
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;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkFrame.AsObject;
@ -722,12 +926,11 @@ export class DownlinkFrame extends jspb.Message {
export namespace DownlinkFrame {
export type AsObject = {
phyPayload: Uint8Array | string,
txInfo?: DownlinkTXInfo.AsObject,
token: number,
downlinkId: Uint8Array | string,
downlinkId: number,
downlinkIdLegacy: Uint8Array | string,
itemsList: Array<DownlinkFrameItem.AsObject>,
gatewayId: Uint8Array | string,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
}
}
@ -737,10 +940,15 @@ export class DownlinkFrameItem extends jspb.Message {
getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): void;
hasTxInfoLegacy(): boolean;
clearTxInfoLegacy(): void;
getTxInfoLegacy(): DownlinkTxInfoLegacy | undefined;
setTxInfoLegacy(value?: DownlinkTxInfoLegacy): void;
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): DownlinkTXInfo | undefined;
setTxInfo(value?: DownlinkTXInfo): void;
getTxInfo(): DownlinkTxInfo | undefined;
setTxInfo(value?: DownlinkTxInfo): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkFrameItem.AsObject;
@ -755,67 +963,68 @@ export class DownlinkFrameItem extends jspb.Message {
export namespace DownlinkFrameItem {
export type AsObject = {
phyPayload: Uint8Array | string,
txInfo?: DownlinkTXInfo.AsObject,
txInfoLegacy?: DownlinkTxInfoLegacy.AsObject,
txInfo?: DownlinkTxInfo.AsObject,
}
}
export class DownlinkTXAck extends jspb.Message {
getGatewayId(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string;
setGatewayId(value: Uint8Array | string): void;
export class DownlinkTxAck extends jspb.Message {
getGatewayIdLegacy(): Uint8Array | string;
getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayIdLegacy_asB64(): string;
setGatewayIdLegacy(value: Uint8Array | string): void;
getToken(): number;
setToken(value: number): void;
getGatewayId(): string;
setGatewayId(value: string): void;
getError(): string;
setError(value: string): void;
getDownlinkId(): number;
setDownlinkId(value: number): void;
getDownlinkId(): Uint8Array | string;
getDownlinkId_asU8(): Uint8Array;
getDownlinkId_asB64(): string;
setDownlinkId(value: Uint8Array | string): void;
getDownlinkIdLegacy(): Uint8Array | string;
getDownlinkIdLegacy_asU8(): Uint8Array;
getDownlinkIdLegacy_asB64(): string;
setDownlinkIdLegacy(value: Uint8Array | string): void;
clearItemsList(): void;
getItemsList(): Array<DownlinkTXAckItem>;
setItemsList(value: Array<DownlinkTXAckItem>): void;
addItems(value?: DownlinkTXAckItem, index?: number): DownlinkTXAckItem;
getItemsList(): Array<DownlinkTxAckItem>;
setItemsList(value: Array<DownlinkTxAckItem>): void;
addItems(value?: DownlinkTxAckItem, index?: number): DownlinkTxAckItem;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTXAck.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTXAck): DownlinkTXAck.AsObject;
toObject(includeInstance?: boolean): DownlinkTxAck.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTxAck): DownlinkTxAck.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTXAck, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTXAck;
static deserializeBinaryFromReader(message: DownlinkTXAck, reader: jspb.BinaryReader): DownlinkTXAck;
static serializeBinaryToWriter(message: DownlinkTxAck, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTxAck;
static deserializeBinaryFromReader(message: DownlinkTxAck, reader: jspb.BinaryReader): DownlinkTxAck;
}
export namespace DownlinkTXAck {
export namespace DownlinkTxAck {
export type AsObject = {
gatewayId: Uint8Array | string,
token: number,
error: string,
downlinkId: Uint8Array | string,
itemsList: Array<DownlinkTXAckItem.AsObject>,
gatewayIdLegacy: Uint8Array | string,
gatewayId: string,
downlinkId: number,
downlinkIdLegacy: Uint8Array | string,
itemsList: Array<DownlinkTxAckItem.AsObject>,
}
}
export class DownlinkTXAckItem extends jspb.Message {
export class DownlinkTxAckItem extends jspb.Message {
getStatus(): TxAckStatusMap[keyof TxAckStatusMap];
setStatus(value: TxAckStatusMap[keyof TxAckStatusMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTXAckItem.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTXAckItem): DownlinkTXAckItem.AsObject;
toObject(includeInstance?: boolean): DownlinkTxAckItem.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTxAckItem): DownlinkTxAckItem.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTXAckItem, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTXAckItem;
static deserializeBinaryFromReader(message: DownlinkTXAckItem, reader: jspb.BinaryReader): DownlinkTXAckItem;
static serializeBinaryToWriter(message: DownlinkTxAckItem, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTxAckItem;
static deserializeBinaryFromReader(message: DownlinkTxAckItem, reader: jspb.BinaryReader): DownlinkTxAckItem;
}
export namespace DownlinkTXAckItem {
export namespace DownlinkTxAckItem {
export type AsObject = {
status: TxAckStatusMap[keyof TxAckStatusMap],
}
@ -1146,6 +1355,16 @@ export namespace ConnState {
export const State: StateMap;
}
export interface CodeRateMap {
CR_UNDEFINED: 0;
CR_4_5: 1;
CR_4_6: 2;
CR_4_7: 3;
CR_4_8: 4;
}
export const CodeRate: CodeRateMap;
export interface DownlinkTimingMap {
IMMEDIATELY: 0;
DELAY: 1;

2878
api/js/gw/gw_pb.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -101,14 +101,14 @@ export class UplinkEvent extends jspb.Message {
setObject(value?: google_protobuf_struct_pb.Struct): void;
clearRxInfoList(): void;
getRxInfoList(): Array<gw_gw_pb.UplinkRXInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRXInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRXInfo, index?: number): gw_gw_pb.UplinkRXInfo;
getRxInfoList(): Array<gw_gw_pb.UplinkRxInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRxInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRxInfo, index?: number): gw_gw_pb.UplinkRxInfo;
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): gw_gw_pb.UplinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTXInfo): void;
getTxInfo(): gw_gw_pb.UplinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTxInfo): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkEvent.AsObject;
@ -133,8 +133,8 @@ export namespace UplinkEvent {
confirmed: boolean,
data: Uint8Array | string,
object?: google_protobuf_struct_pb.Struct.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRXInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTXInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
}
}
@ -219,8 +219,8 @@ export namespace AckEvent {
}
export class TxAckEvent extends jspb.Message {
getDownlinkId(): string;
setDownlinkId(value: string): void;
getDownlinkId(): number;
setDownlinkId(value: number): void;
hasTime(): boolean;
clearTime(): void;
@ -243,8 +243,8 @@ export class TxAckEvent extends jspb.Message {
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): gw_gw_pb.DownlinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTXInfo): void;
getTxInfo(): gw_gw_pb.DownlinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTxInfo): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): TxAckEvent.AsObject;
@ -258,13 +258,13 @@ export class TxAckEvent extends jspb.Message {
export namespace TxAckEvent {
export type AsObject = {
downlinkId: string,
downlinkId: number,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
deviceInfo?: DeviceInfo.AsObject,
queueItemId: string,
fCntDown: number,
gatewayId: string,
txInfo?: gw_gw_pb.DownlinkTXInfo.AsObject,
txInfo?: gw_gw_pb.DownlinkTxInfo.AsObject,
}
}

View File

@ -461,8 +461,8 @@ proto.integration.UplinkEvent.toObject = function(includeInstance, msg) {
data: msg.getData_asB64(),
object: (f = msg.getObject()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f),
rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTXInfo.toObject(includeInstance, f)
gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTxInfo.toObject(includeInstance, f)
};
if (includeInstance) {
@ -547,14 +547,14 @@ proto.integration.UplinkEvent.deserializeBinaryFromReader = function(msg, reader
msg.setObject(value);
break;
case 12:
var value = new gw_gw_pb.UplinkRXInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.getRxInfoList().push(value);
msg.setRxInfoList(msg.getRxInfoList());
break;
case 13:
var value = new gw_gw_pb.UplinkTXInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
default:
@ -680,7 +680,7 @@ proto.integration.UplinkEvent.prototype.serializeBinaryToWriter = function (writ
writer.writeRepeatedMessage(
12,
f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
);
}
f = this.getTxInfo();
@ -688,7 +688,7 @@ proto.integration.UplinkEvent.prototype.serializeBinaryToWriter = function (writ
writer.writeMessage(
13,
f,
gw_gw_pb.UplinkTXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkTxInfo.serializeBinaryToWriter
);
}
};
@ -942,18 +942,18 @@ proto.integration.UplinkEvent.prototype.hasObject = function() {
/**
* repeated gw.UplinkRXInfo rx_info = 12;
* repeated gw.UplinkRxInfo rx_info = 12;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<!proto.gw.UplinkRXInfo>}
* @return {!Array.<!proto.gw.UplinkRxInfo>}
*/
proto.integration.UplinkEvent.prototype.getRxInfoList = function() {
return /** @type{!Array.<!proto.gw.UplinkRXInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 12));
return /** @type{!Array.<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRxInfo, 12));
};
/** @param {Array.<!proto.gw.UplinkRXInfo>} value */
/** @param {Array.<!proto.gw.UplinkRxInfo>} value */
proto.integration.UplinkEvent.prototype.setRxInfoList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 12, value);
};
@ -965,16 +965,16 @@ proto.integration.UplinkEvent.prototype.clearRxInfoList = function() {
/**
* optional gw.UplinkTXInfo tx_info = 13;
* @return {proto.gw.UplinkTXInfo}
* optional gw.UplinkTxInfo tx_info = 13;
* @return {proto.gw.UplinkTxInfo}
*/
proto.integration.UplinkEvent.prototype.getTxInfo = function() {
return /** @type{proto.gw.UplinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 13));
return /** @type{proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTxInfo, 13));
};
/** @param {proto.gw.UplinkTXInfo|undefined} value */
/** @param {proto.gw.UplinkTxInfo|undefined} value */
proto.integration.UplinkEvent.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 13, value);
};
@ -1650,7 +1650,7 @@ proto.integration.TxAckEvent.toObject = function(includeInstance, msg) {
queueItemId: msg.getQueueItemId(),
fCntDown: msg.getFCntDown(),
gatewayId: msg.getGatewayId(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTXInfo.toObject(includeInstance, f)
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTxInfo.toObject(includeInstance, f)
};
if (includeInstance) {
@ -1688,7 +1688,7 @@ proto.integration.TxAckEvent.deserializeBinaryFromReader = function(msg, reader)
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
var value = /** @type {number} */ (reader.readUint32());
msg.setDownlinkId(value);
break;
case 2:
@ -1714,8 +1714,8 @@ proto.integration.TxAckEvent.deserializeBinaryFromReader = function(msg, reader)
msg.setGatewayId(value);
break;
case 7:
var value = new gw_gw_pb.DownlinkTXInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
default:
@ -1757,8 +1757,8 @@ proto.integration.TxAckEvent.prototype.serializeBinary = function() {
proto.integration.TxAckEvent.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getDownlinkId();
if (f.length > 0) {
writer.writeString(
if (f !== 0) {
writer.writeUint32(
1,
f
);
@ -1805,7 +1805,7 @@ proto.integration.TxAckEvent.prototype.serializeBinaryToWriter = function (write
writer.writeMessage(
7,
f,
gw_gw_pb.DownlinkTXInfo.serializeBinaryToWriter
gw_gw_pb.DownlinkTxInfo.serializeBinaryToWriter
);
}
};
@ -1821,15 +1821,15 @@ proto.integration.TxAckEvent.prototype.cloneMessage = function() {
/**
* optional string downlink_id = 1;
* @return {string}
* optional uint32 downlink_id = 1;
* @return {number}
*/
proto.integration.TxAckEvent.prototype.getDownlinkId = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
};
/** @param {string} value */
/** @param {number} value */
proto.integration.TxAckEvent.prototype.setDownlinkId = function(value) {
jspb.Message.setField(this, 1, value);
};
@ -1941,16 +1941,16 @@ proto.integration.TxAckEvent.prototype.setGatewayId = function(value) {
/**
* optional gw.DownlinkTXInfo tx_info = 7;
* @return {proto.gw.DownlinkTXInfo}
* optional gw.DownlinkTxInfo tx_info = 7;
* @return {proto.gw.DownlinkTxInfo}
*/
proto.integration.TxAckEvent.prototype.getTxInfo = function() {
return /** @type{proto.gw.DownlinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 7));
return /** @type{proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTxInfo, 7));
};
/** @param {proto.gw.DownlinkTXInfo|undefined} value */
/** @param {proto.gw.DownlinkTxInfo|undefined} value */
proto.integration.TxAckEvent.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 7, value);
};

View File

@ -11,13 +11,13 @@ export class UplinkMeta extends jspb.Message {
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): gw_gw_pb.UplinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTXInfo): void;
getTxInfo(): gw_gw_pb.UplinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTxInfo): void;
clearRxInfoList(): void;
getRxInfoList(): Array<gw_gw_pb.UplinkRXInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRXInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRXInfo, index?: number): gw_gw_pb.UplinkRXInfo;
getRxInfoList(): Array<gw_gw_pb.UplinkRxInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRxInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRxInfo, index?: number): gw_gw_pb.UplinkRxInfo;
getPhyPayloadByteCount(): number;
setPhyPayloadByteCount(value: number): void;
@ -44,8 +44,8 @@ export class UplinkMeta extends jspb.Message {
export namespace UplinkMeta {
export type AsObject = {
devEui: string,
txInfo?: gw_gw_pb.UplinkTXInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRXInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
phyPayloadByteCount: number,
macCommandByteCount: number,
applicationPayloadByteCount: number,
@ -62,8 +62,8 @@ export class DownlinkMeta extends jspb.Message {
hasTxInfo(): boolean;
clearTxInfo(): void;
getTxInfo(): gw_gw_pb.DownlinkTXInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTXInfo): void;
getTxInfo(): gw_gw_pb.DownlinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTxInfo): void;
getPhyPayloadByteCount(): number;
setPhyPayloadByteCount(value: number): void;
@ -94,7 +94,7 @@ export namespace DownlinkMeta {
export type AsObject = {
devEui: string,
multicastGroupId: string,
txInfo?: gw_gw_pb.DownlinkTXInfo.AsObject,
txInfo?: gw_gw_pb.DownlinkTxInfo.AsObject,
phyPayloadByteCount: number,
macCommandByteCount: number,
applicationPayloadByteCount: number,

View File

@ -67,9 +67,9 @@ proto.meta.UplinkMeta.prototype.toObject = function(opt_includeInstance) {
proto.meta.UplinkMeta.toObject = function(includeInstance, msg) {
var f, obj = {
devEui: msg.getDevEui(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTXInfo.toObject(includeInstance, f),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTxInfo.toObject(includeInstance, f),
rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance),
gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
phyPayloadByteCount: msg.getPhyPayloadByteCount(),
macCommandByteCount: msg.getMacCommandByteCount(),
applicationPayloadByteCount: msg.getApplicationPayloadByteCount(),
@ -115,13 +115,13 @@ proto.meta.UplinkMeta.deserializeBinaryFromReader = function(msg, reader) {
msg.setDevEui(value);
break;
case 2:
var value = new gw_gw_pb.UplinkTXInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
case 3:
var value = new gw_gw_pb.UplinkRXInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.getRxInfoList().push(value);
msg.setRxInfoList(msg.getRxInfoList());
break;
@ -191,7 +191,7 @@ proto.meta.UplinkMeta.prototype.serializeBinaryToWriter = function (writer) {
writer.writeMessage(
2,
f,
gw_gw_pb.UplinkTXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkTxInfo.serializeBinaryToWriter
);
}
f = this.getRxInfoList();
@ -199,7 +199,7 @@ proto.meta.UplinkMeta.prototype.serializeBinaryToWriter = function (writer) {
writer.writeRepeatedMessage(
3,
f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter
gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
);
}
f = this.getPhyPayloadByteCount();
@ -258,16 +258,16 @@ proto.meta.UplinkMeta.prototype.setDevEui = function(value) {
/**
* optional gw.UplinkTXInfo tx_info = 2;
* @return {proto.gw.UplinkTXInfo}
* optional gw.UplinkTxInfo tx_info = 2;
* @return {proto.gw.UplinkTxInfo}
*/
proto.meta.UplinkMeta.prototype.getTxInfo = function() {
return /** @type{proto.gw.UplinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 2));
return /** @type{proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTxInfo, 2));
};
/** @param {proto.gw.UplinkTXInfo|undefined} value */
/** @param {proto.gw.UplinkTxInfo|undefined} value */
proto.meta.UplinkMeta.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
@ -288,18 +288,18 @@ proto.meta.UplinkMeta.prototype.hasTxInfo = function() {
/**
* repeated gw.UplinkRXInfo rx_info = 3;
* repeated gw.UplinkRxInfo rx_info = 3;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<!proto.gw.UplinkRXInfo>}
* @return {!Array.<!proto.gw.UplinkRxInfo>}
*/
proto.meta.UplinkMeta.prototype.getRxInfoList = function() {
return /** @type{!Array.<!proto.gw.UplinkRXInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 3));
return /** @type{!Array.<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRxInfo, 3));
};
/** @param {Array.<!proto.gw.UplinkRXInfo>} value */
/** @param {Array.<!proto.gw.UplinkRxInfo>} value */
proto.meta.UplinkMeta.prototype.setRxInfoList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 3, value);
};
@ -418,7 +418,7 @@ proto.meta.DownlinkMeta.toObject = function(includeInstance, msg) {
var f, obj = {
devEui: msg.getDevEui(),
multicastGroupId: msg.getMulticastGroupId(),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTXInfo.toObject(includeInstance, f),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.DownlinkTxInfo.toObject(includeInstance, f),
phyPayloadByteCount: msg.getPhyPayloadByteCount(),
macCommandByteCount: msg.getMacCommandByteCount(),
applicationPayloadByteCount: msg.getApplicationPayloadByteCount(),
@ -469,8 +469,8 @@ proto.meta.DownlinkMeta.deserializeBinaryFromReader = function(msg, reader) {
msg.setMulticastGroupId(value);
break;
case 3:
var value = new gw_gw_pb.DownlinkTXInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader);
var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value);
break;
case 4:
@ -550,7 +550,7 @@ proto.meta.DownlinkMeta.prototype.serializeBinaryToWriter = function (writer) {
writer.writeMessage(
3,
f,
gw_gw_pb.DownlinkTXInfo.serializeBinaryToWriter
gw_gw_pb.DownlinkTxInfo.serializeBinaryToWriter
);
}
f = this.getPhyPayloadByteCount();
@ -631,16 +631,16 @@ proto.meta.DownlinkMeta.prototype.setMulticastGroupId = function(value) {
/**
* optional gw.DownlinkTXInfo tx_info = 3;
* @return {proto.gw.DownlinkTXInfo}
* optional gw.DownlinkTxInfo tx_info = 3;
* @return {proto.gw.DownlinkTxInfo}
*/
proto.meta.DownlinkMeta.prototype.getTxInfo = function() {
return /** @type{proto.gw.DownlinkTXInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 3));
return /** @type{proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTxInfo, 3));
};
/** @param {proto.gw.DownlinkTXInfo|undefined} value */
/** @param {proto.gw.DownlinkTxInfo|undefined} value */
proto.meta.DownlinkMeta.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 3, value);
};

View File

@ -16,10 +16,10 @@ message UplinkFrameLog {
bytes phy_payload = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
repeated gw.UplinkRxInfo rx_info = 3;
// Message type.
common.MType m_type = 4;
@ -42,10 +42,10 @@ message DownlinkFrameLog {
bytes phy_payload = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
gw.DownlinkTxInfo tx_info = 3;
// Downlink ID (UUID).
string downlink_id = 4;
// Downlink ID.
uint32 downlink_id = 4;
// Gateway ID (EUI64).
string gateway_id = 5;

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

@ -10,8 +10,17 @@ option java_outer_classname = "GatewayProto";
import "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;
}
enum DownlinkTiming {
// Send the downlink immediately.
IMMEDIATELY = 0;
@ -23,7 +32,6 @@ enum DownlinkTiming {
GPS_EPOCH = 2;
}
enum FineTimestampType {
// No fine-timestamp available.
NONE = 0;
@ -84,17 +92,17 @@ enum TxAckStatus {
message Modulation {
oneof parameters {
// LoRa modulation information.
LoRaModulationInfo lora = 3 [json_name = "loRa"];
LoraModulationInfo lora = 3;
// FSK modulation information.
FSKModulationInfo fsk = 4;
FskModulationInfo fsk = 4;
// LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss = 5 [json_name = "lrFHSS"];
LrFhssModulationInfo lr_fhss = 5;
}
}
message UplinkTXInfo {
message UplinkTxInfoLegacy {
// Frequency (Hz).
uint32 frequency = 1;
@ -103,17 +111,25 @@ message UplinkTXInfo {
oneof modulation_info {
// LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 3 [json_name = "loRaModulationInfo"];
LoraModulationInfo lora_modulation_info = 3;
// FSK modulation information.
FSKModulationInfo fsk_modulation_info = 4;
FskModulationInfo fsk_modulation_info = 4;
// LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss_modulation_info = 5 [json_name = "lrFHSSModulationInfo"];
LrFhssModulationInfo lr_fhss_modulation_info = 5;
}
}
message LoRaModulationInfo {
message UplinkTxInfo {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation.
Modulation modulation = 2;
}
message LoraModulationInfo {
// Bandwidth.
uint32 bandwidth = 1;
@ -121,13 +137,16 @@ message LoRaModulationInfo {
uint32 spreading_factor = 2;
// Code-rate.
string code_rate = 3;
string code_rate_legacy = 3;
// Code-rate.
CodeRate code_rate = 5;
// Polarization inversion.
bool polarization_inversion = 4;
}
message FSKModulationInfo {
message FskModulationInfo {
// Frequency deviation.
uint32 frequency_deviation = 1;
@ -135,7 +154,7 @@ message FSKModulationInfo {
uint32 datarate = 2;
}
message LRFHSSModulationInfo {
message LrFhssModulationInfo {
// Operating channel width (OCW) in Hz.
uint32 operating_channel_width = 1;
@ -151,10 +170,10 @@ message EncryptedFineTimestamp {
uint32 aes_key_index = 1;
// Encrypted 'main' fine-timestamp (ns precision part of the timestamp).
bytes encrypted_ns = 2 [json_name = "encryptedNS"];
bytes encrypted_ns = 2;
// FPGA ID.
bytes fpga_id = 3 [json_name = "fpgaID"];
bytes fpga_id = 3;
}
message PlainFineTimestamp {
@ -164,7 +183,7 @@ message PlainFineTimestamp {
message GatewayStats {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Gateway IP.
string ip = 9;
@ -183,7 +202,7 @@ message GatewayStats {
uint32 rx_packets_received = 5;
// Number of radio packets received with valid PHY CRC.
uint32 rx_packets_received_ok = 6 [json_name = "rxPacketsReceivedOK"];
uint32 rx_packets_received_ok = 6;
// Number of downlink packets received for transmission.
uint32 tx_packets_received = 7;
@ -196,7 +215,7 @@ message GatewayStats {
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11 [json_name = "statsID"];
bytes stats_id = 11;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12;
@ -222,21 +241,21 @@ message PerModulationCount {
uint32 count = 2;
}
message UplinkRXInfo {
message UplinkRxInfoLegacy {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// 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"];
google.protobuf.Duration time_since_gps_epoch = 3;
// RSSI.
int32 rssi = 5;
// LoRa SNR.
double lora_snr = 6 [json_name = "loRaSNR"];
double lora_snr = 6;
// Channel.
uint32 channel = 7;
@ -270,19 +289,60 @@ message UplinkRXInfo {
// 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"];
bytes uplink_id = 16;
// CRC status.
CRCStatus crc_status = 17 [json_name = "crcStatus"];
CRCStatus crc_status = 17;
// Optional meta-data map.
map<string, string> metadata = 18;
}
message DownlinkTXInfo {
message UplinkRxInfo {
// Gateway ID.
string gateway_id = 1;
// Uplink ID.
uint32 uplink_id = 2;
// RX time (only set when the gateway has a GPS module).
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 metadata = 12;
}
message DownlinkTxInfoLegacy {
// Gateway ID.
// Deprecated: replaced by gateway_id in DownlinkFrame.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// TX frequency (in Hz).
uint32 frequency = 5;
@ -295,10 +355,10 @@ message DownlinkTXInfo {
oneof modulation_info {
// LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 8 [json_name = "loRaModulationInfo"];
LoraModulationInfo lora_modulation_info = 8;
// FSK modulation information.
FSKModulationInfo fsk_modulation_info = 9;
FskModulationInfo fsk_modulation_info = 9;
}
// The board identifier for emitting the frame.
@ -326,6 +386,43 @@ message DownlinkTXInfo {
bytes context = 16;
}
message DownlinkTxInfo {
// TX frequency (in Hz).
uint32 frequency = 1;
// TX power (in 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;
// Timing.
Timing timing = 6;
// Gateway specific context.
// In case of a Class-A downlink, this contains a copy of the uplink context.
bytes context = 7;
}
message Timing {
oneof parameters {
// Immediately timing information.
ImmediatelyTimingInfo immediately = 1;
// Context based delay timing information.
DelayTimingInfo delay = 2;
// GPS Epoch timing information.
GPSEpochTimingInfo gps_epoch = 3;
}
}
message ImmediatelyTimingInfo {
// Not implemented yet.
}
@ -339,18 +436,24 @@ message DelayTimingInfo {
message GPSEpochTimingInfo {
// Duration since GPS Epoch.
google.protobuf.Duration time_since_gps_epoch = 1 [json_name = "timeSinceGPSEpoch"];
google.protobuf.Duration time_since_gps_epoch = 1;
}
message UplinkFrame {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
UplinkTXInfo tx_info = 2;
// TX meta-data (deprecated).
UplinkTxInfoLegacy tx_info_legacy = 2;
// RX meta-data.
UplinkRXInfo rx_info = 3;
// RX meta-data (deprecated).
UplinkRxInfoLegacy rx_info_legacy = 3;
// Tx meta-data.
UplinkTxInfo tx_info = 4;
// Rx meta-data.
UplinkRxInfo rx_info = 5;
}
message UplinkFrameSet {
@ -358,27 +461,19 @@ message UplinkFrameSet {
bytes phy_payload = 1;
// TX meta-data.
UplinkTXInfo tx_info = 2;
UplinkTxInfo tx_info = 2;
// RX meta-data set.
repeated UplinkRXInfo rx_info = 3;
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.
uint32 downlink_id = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Deprecated: use downlink_id.
bytes downlink_id_legacy = 4;
// Downlink frame items.
// This makes it possible to send multiple downlink opportunities to the
@ -388,47 +483,52 @@ message DownlinkFrame {
repeated DownlinkFrameItem items = 5;
// Gateway ID.
bytes gateway_id = 6 [json_name = "gatewayID"];
// Deprecated: use gateway_id
bytes gateway_id_legacy = 6;
// Gateway ID.
string gateway_id = 7;
}
message DownlinkFrameItem {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
DownlinkTXInfo tx_info = 2;
// TX meta-data (deprecated).
DownlinkTxInfoLegacy tx_info_legacy = 2;
// Tx meta-data.
DownlinkTxInfo tx_info = 3;
}
message DownlinkTXAck {
message DownlinkTxAck {
// Gateway ID (deprecated).
bytes gateway_id_legacy = 1;
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
string gateway_id = 6;
// Token (uint16 value).
// Deprecated: replaced by downlink_id.
uint32 token = 2;
// Downlink ID.
uint32 downlink_id = 2;
// Error.
// Deprecated: replaced by items.
string error = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Downlink ID (deprecated).
bytes downlink_id_legacy = 4;
// 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;
repeated DownlinkTxAckItem items = 5;
}
message DownlinkTXAckItem {
message DownlinkTxAckItem {
// The Ack status of this item.
TxAckStatus status = 1;
}
message GatewayConfiguration {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Configuration version.
string version = 2;
@ -449,7 +549,7 @@ message ChannelConfiguration {
oneof modulation_config {
// LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3 [json_name = "loRaModulationConfig"];
LoRaModulationConfig lora_modulation_config = 3;
// FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4;
@ -480,7 +580,7 @@ message FSKModulationConfig {
message GatewayCommandExecRequest {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -489,7 +589,7 @@ message GatewayCommandExecRequest {
// Execution request ID (UUID).
// The same token will be returned when the execution of the command has
// completed.
bytes ExecId = 3 [json_name = "execID"];
bytes ExecId = 3;
// Standard input.
bytes stdin = 4;
@ -500,10 +600,10 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Execution request ID (UUID).
bytes exec_id = 2 [json_name = "execID"];
bytes exec_id = 2;
// Standard output.
bytes stdout = 3;
@ -520,10 +620,10 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"];
bytes raw_id = 2;
// Payload contains the raw payload.
bytes payload = 3;
@ -534,10 +634,10 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"];
bytes raw_id = 2;
// Payload contains the raw payload.
bytes payload = 3;
@ -546,7 +646,7 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway.
message ConnState {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
enum State {
OFFLINE = 0;

View File

@ -1,202 +0,0 @@
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 "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

@ -119,10 +119,10 @@ message UplinkEvent {
google.protobuf.Struct object = 11;
// Receiving gateway RX info.
repeated gw.UplinkRXInfo rx_info = 12;
repeated gw.UplinkRxInfo rx_info = 12;
// TX info.
gw.UplinkTXInfo tx_info = 13;
gw.UplinkTxInfo tx_info = 13;
}
// JoinEvent is the message sent when a device joined the network.
@ -167,8 +167,8 @@ message AckEvent {
// 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;
// Downlink ID.
uint32 downlink_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
@ -186,7 +186,7 @@ message TxAckEvent {
string gateway_id = 6;
// TX info.
gw.DownlinkTXInfo tx_info = 7;
gw.DownlinkTxInfo tx_info = 7;
}
// LogEvent is the message sent when a device-related log was sent.

View File

@ -199,8 +199,8 @@ message DeviceGatewayRxInfoItem {
}
message DownlinkFrame {
// Downlink ID (UUID).
bytes downlink_id = 1;
// Downlink ID.
uint32 downlink_id = 1;
// DevEUI.
bytes dev_eui = 2;
@ -231,5 +231,5 @@ message LoraCloudGeolocBuffer {
message LoraCloudGeolocBufferUplink {
// RxInfo set for a single uplink.
repeated gw.UplinkRXInfo rx_info = 1;
repeated gw.UplinkRxInfo rx_info = 1;
}

View File

@ -16,10 +16,10 @@ message UplinkMeta {
string dev_eui = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
@ -42,7 +42,7 @@ message DownlinkMeta {
string multicast_group_id = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;

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

@ -2,15 +2,6 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.45"
@ -55,6 +46,49 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "axum"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47594e438a243791dba58124b6669561f5baa14cb12046641d8008bf035e5a25"
dependencies = [
"async-trait",
"axum-core",
"bitflags",
"bytes",
"futures-util",
"http",
"http-body",
"hyper",
"itoa 1.0.1",
"matchit",
"memchr",
"mime",
"percent-encoding",
"pin-project-lite",
"serde",
"sync_wrapper",
"tokio",
"tower",
"tower-http",
"tower-layer",
"tower-service",
]
[[package]]
name = "axum-core"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a671c9ae99531afdd5d3ee8340b8da547779430689947144c140fc74a740244"
dependencies = [
"async-trait",
"bytes",
"futures-util",
"http",
"http-body",
"mime",
]
[[package]]
name = "base64"
version = "0.13.0"
@ -73,6 +107,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -83,11 +123,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
name = "chirpstack_api"
version = "4.0.0"
dependencies = [
"hex",
"pbjson",
"pbjson-build",
"pbjson-types",
"prost",
"prost-types",
"rand",
"serde",
"tokio",
"tonic",
@ -100,11 +142,17 @@ version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
"libc",
"num-integer",
"num-traits",
"time",
"winapi",
]
[[package]]
name = "cmake"
version = "0.1.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
dependencies = [
"cc",
]
[[package]]
@ -173,7 +221,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
"cfg-if",
"libc",
"wasi",
"wasi 0.10.2+wasi-snapshot-preview1",
]
[[package]]
@ -191,7 +239,7 @@ dependencies = [
"indexmap",
"slab",
"tokio",
"tokio-util",
"tokio-util 0.6.9",
"tracing",
]
@ -203,12 +251,15 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
version = "0.3.3"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
@ -218,7 +269,7 @@ checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b"
dependencies = [
"bytes",
"fnv",
"itoa",
"itoa 0.4.8",
]
[[package]]
@ -232,6 +283,12 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "http-range-header"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29"
[[package]]
name = "httparse"
version = "1.5.1"
@ -259,7 +316,7 @@ dependencies = [
"http-body",
"httparse",
"httpdate",
"itoa",
"itoa 0.4.8",
"pin-project-lite",
"socket2",
"tokio",
@ -305,6 +362,12 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "itoa"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -313,9 +376,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.107"
version = "0.2.124"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
[[package]]
name = "log"
@ -326,6 +389,12 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "matchit"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
[[package]]
name = "memchr"
version = "2.4.1"
@ -333,15 +402,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "mio"
version = "0.7.14"
name = "mime"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "mio"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9"
dependencies = [
"libc",
"log",
"miow",
"ntapi",
"wasi 0.11.0+wasi-snapshot-preview1",
"winapi",
]
@ -390,9 +466,9 @@ dependencies = [
[[package]]
name = "pbjson"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12f64965beef9b7276dd811b81cce49569430a73ce1586aa121cb4ef9e0f498f"
checksum = "d86c0a61b93c50f35af5d8a4f134790f47cbebf8803a7219dd1e7238cd1af022"
dependencies = [
"base64",
"serde",
@ -400,9 +476,9 @@ dependencies = [
[[package]]
name = "pbjson-build"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d726efd7bfb8725c7100c29cb723eaa865b5e56cd41b723f193436e404c07f5"
checksum = "956a449e8a85fc040e9f8cd8fd4dd2e68059d179092401f0d8570ba059f76dae"
dependencies = [
"heck",
"itertools",
@ -412,9 +488,9 @@ dependencies = [
[[package]]
name = "pbjson-types"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d501adb5dc9774145e21cf497e62641d6b4c7f9db490c52388e26a0f966c7ea8"
checksum = "2c20bd6ec3b4ba0073e7e5a1a770abd95723b431bf0e1941d2dd8aace9ffb97f"
dependencies = [
"bytes",
"chrono",
@ -479,6 +555,16 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
[[package]]
name = "prettyplease"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b83ec2d0af5c5c556257ff52c9f98934e243b9fd39604bfb2a9b75ec2e97f18"
dependencies = [
"proc-macro2",
"syn",
]
[[package]]
name = "proc-macro2"
version = "1.0.32"
@ -490,9 +576,9 @@ dependencies = [
[[package]]
name = "prost"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
checksum = "a07b0857a71a8cb765763950499cae2413c3f9cede1133478c43600d9e146890"
dependencies = [
"bytes",
"prost-derive",
@ -500,11 +586,13 @@ dependencies = [
[[package]]
name = "prost-build"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
checksum = "120fbe7988713f39d780a58cf1a7ef0d7ef66c6d87e5aa3438940c05357929f4"
dependencies = [
"bytes",
"cfg-if",
"cmake",
"heck",
"itertools",
"lazy_static",
@ -520,9 +608,9 @@ dependencies = [
[[package]]
name = "prost-derive"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc"
dependencies = [
"anyhow",
"itertools",
@ -533,9 +621,9 @@ dependencies = [
[[package]]
name = "prost-types"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68"
dependencies = [
"bytes",
"prost",
@ -601,12 +689,10 @@ dependencies = [
[[package]]
name = "regex"
version = "1.5.4"
version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
@ -653,9 +739,9 @@ checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
[[package]]
name = "socket2"
version = "0.4.2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516"
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
dependencies = [
"libc",
"winapi",
@ -663,15 +749,21 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.81"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "sync_wrapper"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8"
[[package]]
name = "tempfile"
version = "3.2.0"
@ -686,28 +778,18 @@ dependencies = [
"winapi",
]
[[package]]
name = "time"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "tokio"
version = "1.14.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
dependencies = [
"autocfg",
"bytes",
"libc",
"memchr",
"mio",
"pin-project-lite",
"socket2",
"tokio-macros",
"winapi",
]
@ -724,9 +806,9 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "1.6.0"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"
checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
dependencies = [
"proc-macro2",
"quote",
@ -759,13 +841,28 @@ dependencies = [
]
[[package]]
name = "tonic"
version = "0.6.1"
name = "tokio-util"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24203b79cf2d68909da91178db3026e77054effba0c5d93deb870d3ca7b35afa"
checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
name = "tonic"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30fb54bf1e446f44d870d260d99957e7d11fb9d0a0f5bd1a662ad1411cc103f9"
dependencies = [
"async-stream",
"async-trait",
"axum",
"base64",
"bytes",
"futures-core",
@ -781,7 +878,7 @@ dependencies = [
"prost-derive",
"tokio",
"tokio-stream",
"tokio-util",
"tokio-util 0.7.1",
"tower",
"tower-layer",
"tower-service",
@ -791,10 +888,11 @@ dependencies = [
[[package]]
name = "tonic-build"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88358bb1dcfeb62dcce85c63006cafb964b7be481d522b7e09589d4d1e718d2a"
checksum = "4d17087af5c80e5d5fc8ba9878e60258065a0a757e35efe7a05b7904bece1943"
dependencies = [
"prettyplease",
"proc-macro2",
"prost-build",
"quote",
@ -803,9 +901,9 @@ dependencies = [
[[package]]
name = "tower"
version = "0.4.10"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c00e500fff5fa1131c866b246041a6bf96da9c965f8fe4128cb1421f23e93c00"
checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e"
dependencies = [
"futures-core",
"futures-util",
@ -815,13 +913,31 @@ dependencies = [
"rand",
"slab",
"tokio",
"tokio-stream",
"tokio-util",
"tokio-util 0.7.1",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower-http"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8"
dependencies = [
"bitflags",
"bytes",
"futures-core",
"futures-util",
"http",
"http-body",
"http-range-header",
"pin-project-lite",
"tower",
"tower-layer",
"tower-service",
]
[[package]]
name = "tower-layer"
version = "0.3.1"
@ -883,12 +999,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]]
name = "unicode-xid"
version = "0.2.2"
@ -911,6 +1021,12 @@ version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "which"
version = "4.2.2"

2
api/rust/Cargo.toml vendored
View File

@ -18,6 +18,8 @@ prost = "0.10"
prost-types = "0.10"
pbjson = "0.3"
pbjson-types = "0.3"
hex = "0.4"
rand = "0.8"
tonic = { version = "0.7", features = ["codegen", "prost"], default-features = false }
tokio = { version = "1.17", features = ["macros"], optional = true }

View File

@ -16,10 +16,10 @@ message UplinkFrameLog {
bytes phy_payload = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
repeated gw.UplinkRxInfo rx_info = 3;
// Message type.
common.MType m_type = 4;
@ -42,10 +42,10 @@ message DownlinkFrameLog {
bytes phy_payload = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
gw.DownlinkTxInfo tx_info = 3;
// Downlink ID (UUID).
string downlink_id = 4;
// Downlink ID.
uint32 downlink_id = 4;
// Gateway ID (EUI64).
string gateway_id = 5;

View File

@ -10,8 +10,17 @@ option java_outer_classname = "GatewayProto";
import "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;
}
enum DownlinkTiming {
// Send the downlink immediately.
IMMEDIATELY = 0;
@ -23,7 +32,6 @@ enum DownlinkTiming {
GPS_EPOCH = 2;
}
enum FineTimestampType {
// No fine-timestamp available.
NONE = 0;
@ -84,17 +92,17 @@ enum TxAckStatus {
message Modulation {
oneof parameters {
// LoRa modulation information.
LoRaModulationInfo lora = 3 [json_name = "loRa"];
LoraModulationInfo lora = 3;
// FSK modulation information.
FSKModulationInfo fsk = 4;
FskModulationInfo fsk = 4;
// LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss = 5 [json_name = "lrFHSS"];
LrFhssModulationInfo lr_fhss = 5;
}
}
message UplinkTXInfo {
message UplinkTxInfoLegacy {
// Frequency (Hz).
uint32 frequency = 1;
@ -103,17 +111,25 @@ message UplinkTXInfo {
oneof modulation_info {
// LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 3 [json_name = "loRaModulationInfo"];
LoraModulationInfo lora_modulation_info = 3;
// FSK modulation information.
FSKModulationInfo fsk_modulation_info = 4;
FskModulationInfo fsk_modulation_info = 4;
// LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss_modulation_info = 5 [json_name = "lrFHSSModulationInfo"];
LrFhssModulationInfo lr_fhss_modulation_info = 5;
}
}
message LoRaModulationInfo {
message UplinkTxInfo {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation.
Modulation modulation = 2;
}
message LoraModulationInfo {
// Bandwidth.
uint32 bandwidth = 1;
@ -121,13 +137,16 @@ message LoRaModulationInfo {
uint32 spreading_factor = 2;
// Code-rate.
string code_rate = 3;
string code_rate_legacy = 3;
// Code-rate.
CodeRate code_rate = 5;
// Polarization inversion.
bool polarization_inversion = 4;
}
message FSKModulationInfo {
message FskModulationInfo {
// Frequency deviation.
uint32 frequency_deviation = 1;
@ -135,7 +154,7 @@ message FSKModulationInfo {
uint32 datarate = 2;
}
message LRFHSSModulationInfo {
message LrFhssModulationInfo {
// Operating channel width (OCW) in Hz.
uint32 operating_channel_width = 1;
@ -151,10 +170,10 @@ message EncryptedFineTimestamp {
uint32 aes_key_index = 1;
// Encrypted 'main' fine-timestamp (ns precision part of the timestamp).
bytes encrypted_ns = 2 [json_name = "encryptedNS"];
bytes encrypted_ns = 2;
// FPGA ID.
bytes fpga_id = 3 [json_name = "fpgaID"];
bytes fpga_id = 3;
}
message PlainFineTimestamp {
@ -164,7 +183,7 @@ message PlainFineTimestamp {
message GatewayStats {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Gateway IP.
string ip = 9;
@ -183,7 +202,7 @@ message GatewayStats {
uint32 rx_packets_received = 5;
// Number of radio packets received with valid PHY CRC.
uint32 rx_packets_received_ok = 6 [json_name = "rxPacketsReceivedOK"];
uint32 rx_packets_received_ok = 6;
// Number of downlink packets received for transmission.
uint32 tx_packets_received = 7;
@ -196,7 +215,7 @@ message GatewayStats {
// Stats ID (UUID).
// Unique identifier for the gateway stats.
bytes stats_id = 11 [json_name = "statsID"];
bytes stats_id = 11;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12;
@ -222,21 +241,21 @@ message PerModulationCount {
uint32 count = 2;
}
message UplinkRXInfo {
message UplinkRxInfoLegacy {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// 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"];
google.protobuf.Duration time_since_gps_epoch = 3;
// RSSI.
int32 rssi = 5;
// LoRa SNR.
double lora_snr = 6 [json_name = "loRaSNR"];
double lora_snr = 6;
// Channel.
uint32 channel = 7;
@ -270,19 +289,60 @@ message UplinkRXInfo {
// 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"];
bytes uplink_id = 16;
// CRC status.
CRCStatus crc_status = 17 [json_name = "crcStatus"];
CRCStatus crc_status = 17;
// Optional meta-data map.
map<string, string> metadata = 18;
}
message DownlinkTXInfo {
message UplinkRxInfo {
// Gateway ID.
string gateway_id = 1;
// Uplink ID.
uint32 uplink_id = 2;
// RX time (only set when the gateway has a GPS module).
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 metadata = 12;
}
message DownlinkTxInfoLegacy {
// Gateway ID.
// Deprecated: replaced by gateway_id in DownlinkFrame.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// TX frequency (in Hz).
uint32 frequency = 5;
@ -295,10 +355,10 @@ message DownlinkTXInfo {
oneof modulation_info {
// LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 8 [json_name = "loRaModulationInfo"];
LoraModulationInfo lora_modulation_info = 8;
// FSK modulation information.
FSKModulationInfo fsk_modulation_info = 9;
FskModulationInfo fsk_modulation_info = 9;
}
// The board identifier for emitting the frame.
@ -326,6 +386,43 @@ message DownlinkTXInfo {
bytes context = 16;
}
message DownlinkTxInfo {
// TX frequency (in Hz).
uint32 frequency = 1;
// TX power (in 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;
// Timing.
Timing timing = 6;
// Gateway specific context.
// In case of a Class-A downlink, this contains a copy of the uplink context.
bytes context = 7;
}
message Timing {
oneof parameters {
// Immediately timing information.
ImmediatelyTimingInfo immediately = 1;
// Context based delay timing information.
DelayTimingInfo delay = 2;
// GPS Epoch timing information.
GPSEpochTimingInfo gps_epoch = 3;
}
}
message ImmediatelyTimingInfo {
// Not implemented yet.
}
@ -339,18 +436,24 @@ message DelayTimingInfo {
message GPSEpochTimingInfo {
// Duration since GPS Epoch.
google.protobuf.Duration time_since_gps_epoch = 1 [json_name = "timeSinceGPSEpoch"];
google.protobuf.Duration time_since_gps_epoch = 1;
}
message UplinkFrame {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
UplinkTXInfo tx_info = 2;
// TX meta-data (deprecated).
UplinkTxInfoLegacy tx_info_legacy = 2;
// RX meta-data.
UplinkRXInfo rx_info = 3;
// RX meta-data (deprecated).
UplinkRxInfoLegacy rx_info_legacy = 3;
// Tx meta-data.
UplinkTxInfo tx_info = 4;
// Rx meta-data.
UplinkRxInfo rx_info = 5;
}
message UplinkFrameSet {
@ -358,27 +461,19 @@ message UplinkFrameSet {
bytes phy_payload = 1;
// TX meta-data.
UplinkTXInfo tx_info = 2;
UplinkTxInfo tx_info = 2;
// RX meta-data set.
repeated UplinkRXInfo rx_info = 3;
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.
uint32 downlink_id = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Deprecated: use downlink_id.
bytes downlink_id_legacy = 4;
// Downlink frame items.
// This makes it possible to send multiple downlink opportunities to the
@ -388,47 +483,52 @@ message DownlinkFrame {
repeated DownlinkFrameItem items = 5;
// Gateway ID.
bytes gateway_id = 6 [json_name = "gatewayID"];
// Deprecated: use gateway_id
bytes gateway_id_legacy = 6;
// Gateway ID.
string gateway_id = 7;
}
message DownlinkFrameItem {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
DownlinkTXInfo tx_info = 2;
// TX meta-data (deprecated).
DownlinkTxInfoLegacy tx_info_legacy = 2;
// Tx meta-data.
DownlinkTxInfo tx_info = 3;
}
message DownlinkTXAck {
message DownlinkTxAck {
// Gateway ID (deprecated).
bytes gateway_id_legacy = 1;
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
string gateway_id = 6;
// Token (uint16 value).
// Deprecated: replaced by downlink_id.
uint32 token = 2;
// Downlink ID.
uint32 downlink_id = 2;
// Error.
// Deprecated: replaced by items.
string error = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Downlink ID (deprecated).
bytes downlink_id_legacy = 4;
// 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;
repeated DownlinkTxAckItem items = 5;
}
message DownlinkTXAckItem {
message DownlinkTxAckItem {
// The Ack status of this item.
TxAckStatus status = 1;
}
message GatewayConfiguration {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Configuration version.
string version = 2;
@ -449,7 +549,7 @@ message ChannelConfiguration {
oneof modulation_config {
// LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3 [json_name = "loRaModulationConfig"];
LoRaModulationConfig lora_modulation_config = 3;
// FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4;
@ -480,7 +580,7 @@ message FSKModulationConfig {
message GatewayCommandExecRequest {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -489,7 +589,7 @@ message GatewayCommandExecRequest {
// Execution request ID (UUID).
// The same token will be returned when the execution of the command has
// completed.
bytes ExecId = 3 [json_name = "execID"];
bytes ExecId = 3;
// Standard input.
bytes stdin = 4;
@ -500,10 +600,10 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Execution request ID (UUID).
bytes exec_id = 2 [json_name = "execID"];
bytes exec_id = 2;
// Standard output.
bytes stdout = 3;
@ -520,10 +620,10 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"];
bytes raw_id = 2;
// Payload contains the raw payload.
bytes payload = 3;
@ -534,10 +634,10 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
// Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"];
bytes raw_id = 2;
// Payload contains the raw payload.
bytes payload = 3;
@ -546,7 +646,7 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway.
message ConnState {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
bytes gateway_id = 1;
enum State {
OFFLINE = 0;

View File

@ -1,202 +0,0 @@
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 "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

@ -119,10 +119,10 @@ message UplinkEvent {
google.protobuf.Struct object = 11;
// Receiving gateway RX info.
repeated gw.UplinkRXInfo rx_info = 12;
repeated gw.UplinkRxInfo rx_info = 12;
// TX info.
gw.UplinkTXInfo tx_info = 13;
gw.UplinkTxInfo tx_info = 13;
}
// JoinEvent is the message sent when a device joined the network.
@ -167,8 +167,8 @@ message AckEvent {
// 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;
// Downlink ID.
uint32 downlink_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
@ -186,7 +186,7 @@ message TxAckEvent {
string gateway_id = 6;
// TX info.
gw.DownlinkTXInfo tx_info = 7;
gw.DownlinkTxInfo tx_info = 7;
}
// LogEvent is the message sent when a device-related log was sent.

View File

@ -199,8 +199,8 @@ message DeviceGatewayRxInfoItem {
}
message DownlinkFrame {
// Downlink ID (UUID).
bytes downlink_id = 1;
// Downlink ID.
uint32 downlink_id = 1;
// DevEUI.
bytes dev_eui = 2;
@ -231,5 +231,5 @@ message LoraCloudGeolocBuffer {
message LoraCloudGeolocBufferUplink {
// RxInfo set for a single uplink.
repeated gw.UplinkRXInfo rx_info = 1;
repeated gw.UplinkRxInfo rx_info = 1;
}

View File

@ -16,10 +16,10 @@ message UplinkMeta {
string dev_eui = 1;
// TX meta-data.
gw.UplinkTXInfo tx_info = 2;
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3;
repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
@ -42,7 +42,7 @@ message DownlinkMeta {
string multicast_group_id = 2;
// TX meta-data.
gw.DownlinkTXInfo tx_info = 3;
gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;

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

@ -1,3 +1,5 @@
use rand::Rng;
tonic::include_proto!("gw/gw");
include!(concat!(env!("OUT_DIR"), "/gw/gw.serde.rs"));
@ -20,3 +22,216 @@ impl Into<String> for TxAckStatus {
.to_string()
}
}
impl UplinkFrame {
pub fn v4_migrate(&mut self) {
if let Some(tx_info) = &self.tx_info_legacy {
if self.tx_info.is_none() {
self.tx_info = Some(UplinkTxInfo {
frequency: tx_info.frequency,
modulation: Some(Modulation {
parameters: tx_info.modulation_info.as_ref().map(|v| match v {
uplink_tx_info_legacy::ModulationInfo::LoraModulationInfo(info) => {
modulation::Parameters::Lora(LoraModulationInfo {
bandwidth: info.bandwidth * 1000,
spreading_factor: info.spreading_factor,
code_rate: match info.code_rate_legacy.as_ref() {
"4/5" => CodeRate::Cr45,
"2/3" | "4/6" => CodeRate::Cr46,
"4/7" => CodeRate::Cr47,
"1/2" | "2/4" | "4/8" => CodeRate::Cr48,
_ => CodeRate::CrUndefined,
}
.into(),
code_rate_legacy: "".into(),
polarization_inversion: info.polarization_inversion,
})
}
uplink_tx_info_legacy::ModulationInfo::FskModulationInfo(info) => {
modulation::Parameters::Fsk(info.clone())
}
uplink_tx_info_legacy::ModulationInfo::LrFhssModulationInfo(info) => {
modulation::Parameters::LrFhss(info.clone())
}
}),
}),
});
self.tx_info_legacy = None;
}
}
if let Some(rx_info) = &self.rx_info_legacy {
if self.rx_info.is_none() {
let mut rng = rand::thread_rng();
self.rx_info = Some(UplinkRxInfo {
gateway_id: hex::encode(&rx_info.gateway_id),
uplink_id: rng.gen::<u32>(),
time: rx_info.time.clone(),
time_since_gps_epoch: rx_info.time_since_gps_epoch.clone(),
fine_time_since_gps_epoch: None,
rssi: rx_info.rssi,
snr: rx_info.lora_snr as f32,
board: rx_info.board,
antenna: rx_info.antenna,
location: rx_info.location.clone(),
context: rx_info.context.clone(),
metadata: Some(pbjson_types::Struct {
fields: rx_info
.metadata
.iter()
.map(|(k, v)| {
(
k.to_string(),
pbjson_types::Value {
kind: Some(pbjson_types::value::Kind::StringValue(
v.to_string(),
)),
},
)
})
.collect(),
}),
});
}
}
}
}
impl UplinkRxInfo {
pub fn get_metadata_string(&self, k: &str) -> Option<String> {
if let Some(v) = &self.metadata {
if let Some(v) = v.fields.get(k) {
if let Some(pbjson_types::value::Kind::StringValue(v)) = &v.kind {
return Some(v.clone());
}
}
}
None
}
pub fn set_metadata_string(&mut self, k: &str, v: &str) {
if self.metadata.is_none() {
self.metadata = Some(pbjson_types::Struct {
..Default::default()
});
}
if let Some(md) = &mut self.metadata {
md.fields.insert(
k.to_string(),
pbjson_types::Value {
kind: Some(pbjson_types::value::Kind::StringValue(v.to_string())),
},
);
}
}
}
impl DownlinkFrame {
pub fn v4_migrate(&mut self) {
self.gateway_id_legacy = hex::decode(&self.gateway_id).unwrap();
self.downlink_id_legacy = vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
self.downlink_id_legacy
.extend_from_slice(&self.downlink_id.to_be_bytes());
for i in self.items.iter_mut() {
if i.tx_info_legacy.is_none() {
if let Some(tx_info) = &i.tx_info {
let mut tx_info_legacy = DownlinkTxInfoLegacy {
frequency: tx_info.frequency,
power: tx_info.power,
board: tx_info.board,
antenna: tx_info.antenna,
context: tx_info.context.clone(),
..Default::default()
};
if let Some(modulation) = &tx_info.modulation {
match &modulation.parameters {
Some(modulation::Parameters::Lora(v)) => {
tx_info_legacy.modulation = crate::common::Modulation::Lora.into();
tx_info_legacy.modulation_info = Some(
downlink_tx_info_legacy::ModulationInfo::LoraModulationInfo(
LoraModulationInfo {
bandwidth: v.bandwidth / 1000,
spreading_factor: v.spreading_factor,
code_rate_legacy: match v.code_rate() {
CodeRate::CrUndefined => "",
CodeRate::Cr45 => "4/5",
CodeRate::Cr46 => "4/6",
CodeRate::Cr47 => "4/7",
CodeRate::Cr48 => "4/8",
}
.into(),
polarization_inversion: v.polarization_inversion,
..Default::default()
},
),
);
}
Some(modulation::Parameters::Fsk(v)) => {
tx_info_legacy.modulation = crate::common::Modulation::Fsk.into();
tx_info_legacy.modulation_info = Some(
downlink_tx_info_legacy::ModulationInfo::FskModulationInfo(
FskModulationInfo {
frequency_deviation: v.frequency_deviation,
datarate: v.datarate,
},
),
);
}
_ => {}
}
}
if let Some(timing) = &tx_info.timing {
match &timing.parameters {
Some(timing::Parameters::Immediately(v)) => {
tx_info_legacy.timing = DownlinkTiming::Immediately.into();
tx_info_legacy.timing_info = Some(
downlink_tx_info_legacy::TimingInfo::ImmediatelyTimingInfo(
v.clone(),
),
);
}
Some(timing::Parameters::Delay(v)) => {
tx_info_legacy.timing = DownlinkTiming::Delay.into();
tx_info_legacy.timing_info = Some(
downlink_tx_info_legacy::TimingInfo::DelayTimingInfo(v.clone()),
);
}
Some(timing::Parameters::GpsEpoch(v)) => {
tx_info_legacy.timing = DownlinkTiming::GpsEpoch.into();
tx_info_legacy.timing_info =
Some(downlink_tx_info_legacy::TimingInfo::GpsEpochTimingInfo(
v.clone(),
));
}
_ => {}
}
}
i.tx_info_legacy = Some(tx_info_legacy);
}
}
}
}
}
impl DownlinkTxAck {
pub fn v4_migrate(&mut self) {
if self.gateway_id.is_empty() {
self.gateway_id = hex::encode(&self.gateway_id_legacy);
}
if self.downlink_id == 0 && self.downlink_id_legacy.len() == 16 {
self.downlink_id = u32::from_be_bytes([
self.downlink_id_legacy[12],
self.downlink_id_legacy[13],
self.downlink_id_legacy[14],
self.downlink_id_legacy[15],
])
}
}
}

View File

@ -39,6 +39,9 @@ impl ToStatus for storage::error::Error {
storage::error::Error::Lrwn(_) => Status::new(Code::Internal, format!("{}", self)),
storage::error::Error::TokioJoin(_) => Status::new(Code::Internal, format!("{}", self)),
storage::error::Error::Redis(_) => Status::new(Code::Internal, format!("{}", self)),
storage::error::Error::ProstDecode(_) => {
Status::new(Code::Internal, format!("{}", self))
}
}
}
}

View File

@ -4,8 +4,8 @@ use std::time::Duration;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use rand::Rng;
use tracing::{span, trace, warn, Instrument, Level};
use uuid::Uuid;
use crate::api::helpers::FromProto;
use crate::downlink::{classb, helpers};
@ -121,7 +121,7 @@ impl Data {
device_gateway_rx_info: Some(dev_gw_rx_info),
downlink_gateway: None,
downlink_frame: gw::DownlinkFrame {
downlink_id: Uuid::new_v4().as_bytes().to_vec(),
downlink_id: rand::thread_rng().gen(),
..Default::default()
},
downlink_frame_items: Vec::new(),
@ -174,7 +174,7 @@ impl Data {
device_gateway_rx_info: Some(dev_gw),
downlink_gateway: None,
downlink_frame: gw::DownlinkFrame {
downlink_id: Uuid::new_v4().as_bytes().to_vec(),
downlink_id: rand::thread_rng().gen(),
..Default::default()
},
downlink_frame_items: vec![],
@ -215,7 +215,7 @@ impl Data {
self.device_gateway_rx_info.as_mut().unwrap(),
)?;
self.downlink_frame.gateway_id = gw_down.gateway_id.clone();
self.downlink_frame.gateway_id = hex::encode(&gw_down.gateway_id);
self.downlink_gateway = Some(gw_down);
Ok(())
@ -598,7 +598,7 @@ impl Data {
trace!("Saving downlink frame");
downlink_frame::save(&internal::DownlinkFrame {
downlink_id: self.downlink_frame.downlink_id.clone(),
downlink_id: self.downlink_frame.downlink_id,
dev_eui: self.device.dev_eui.to_be_bytes().to_vec(),
device_queue_item_id: match &self.device_queue_item {
Some(qi) => qi.id.as_bytes().to_vec(),
@ -1050,12 +1050,11 @@ impl Data {
} else {
self.region_conf.get_defaults().rx1_delay
};
tx_info.set_timing(gw::DownlinkTiming::Delay);
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(delay)),
},
));
})),
});
// get remaining payload size
let max_pl_size = self.region_conf.get_max_payload_size(
@ -1107,19 +1106,20 @@ impl Data {
} else {
self.region_conf.get_defaults().rx2_delay
};
tx_info.set_timing(gw::DownlinkTiming::Delay);
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(delay)),
},
));
})),
});
}
if self.immediately {
tx_info.set_timing(gw::DownlinkTiming::Immediately);
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo(
gw::ImmediatelyTimingInfo {},
));
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {},
)),
});
}
// get remaining payload size
@ -1173,12 +1173,11 @@ impl Data {
self.device_session.class_b_ping_slot_nb as usize,
)?;
trace!(gps_time_now_ts = %now_gps_ts, ping_slot_ts = %ping_slot_ts, "Calculated ping-slot timestamp");
tx_info.set_timing(gw::DownlinkTiming::GpsEpoch);
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::GpsEpochTimingInfo(
gw::GpsEpochTimingInfo {
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::GpsEpoch(gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(ping_slot_ts.to_std()?)),
},
));
})),
});
let scheduler_run_after_ts = ping_slot_ts.to_date_time();
// Try to aquire the device lock.

View File

@ -1,6 +1,7 @@
use anyhow::Result;
use rand::seq::SliceRandom;
use chirpstack_api::gw;
use lrwn::region::DataRateModulation;
use crate::config;
@ -60,28 +61,23 @@ pub fn set_tx_info_data_rate(
) -> Result<()> {
match dr {
DataRateModulation::Lora(v) => {
tx_info.set_modulation(chirpstack_api::common::Modulation::Lora);
tx_info.modulation_info = Some(
chirpstack_api::gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
chirpstack_api::gw::LoRaModulationInfo {
bandwidth: v.bandwidth / 1000,
spreading_factor: v.spreading_factor as u32,
code_rate: "4/5".to_string(),
polarization_inversion: true,
},
),
);
tx_info.modulation = Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(gw::LoraModulationInfo {
bandwidth: v.bandwidth,
spreading_factor: v.spreading_factor as u32,
code_rate: chirpstack_api::gw::CodeRate::Cr45.into(),
polarization_inversion: true,
code_rate_legacy: "".into(),
})),
});
}
DataRateModulation::Fsk(v) => {
tx_info.set_modulation(chirpstack_api::common::Modulation::Fsk);
tx_info.modulation_info = Some(
chirpstack_api::gw::downlink_tx_info::ModulationInfo::FskModulationInfo(
chirpstack_api::gw::FskModulationInfo {
datarate: v.bitrate,
frequency_deviation: v.bitrate / 2, // see: https://github.com/brocaar/chirpstack-gateway-bridge/issues/16
},
),
);
tx_info.modulation = Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Fsk(gw::FskModulationInfo {
datarate: v.bitrate,
frequency_deviation: v.bitrate / 2, // see: https://github.com/brocaar/chirpstack-gateway-bridge/issues/16
})),
});
}
DataRateModulation::LrFhss(_) => {
return Err(anyhow!("LR-FHSS is not supported for downlink"));

View File

@ -1,8 +1,8 @@
use std::sync::Arc;
use anyhow::{Context, Result};
use rand::Rng;
use tracing::{span, trace, Instrument, Level};
use uuid::Uuid;
use lrwn::PhyPayload;
@ -11,7 +11,7 @@ use crate::gateway::backend::send_downlink;
use crate::storage::{device, downlink_frame};
use crate::uplink::UplinkFrameSet;
use crate::{config, region};
use chirpstack_api::internal;
use chirpstack_api::{gw, internal};
pub struct JoinAccept<'a> {
uplink_frame_set: &'a UplinkFrameSet,
@ -54,7 +54,7 @@ impl JoinAccept<'_> {
region_conf: region::get(&ufs.region_name)?,
downlink_frame: chirpstack_api::gw::DownlinkFrame {
downlink_id: Uuid::new_v4().as_bytes().to_vec(),
downlink_id: rand::thread_rng().gen(),
..Default::default()
},
device_gateway_rx_info: None,
@ -84,9 +84,9 @@ impl JoinAccept<'_> {
d_gw_rx_info
.items
.push(chirpstack_api::internal::DeviceGatewayRxInfoItem {
gateway_id: rx_info.gateway_id.clone(),
gateway_id: hex::decode(&rx_info.gateway_id)?,
rssi: rx_info.rssi,
lora_snr: rx_info.lora_snr as f32,
lora_snr: rx_info.snr,
antenna: rx_info.antenna,
board: rx_info.board,
context: rx_info.context.clone(),
@ -107,7 +107,7 @@ impl JoinAccept<'_> {
self.device_gateway_rx_info.as_mut().unwrap(),
)?;
self.downlink_frame.gateway_id = gw_down.gateway_id.clone();
self.downlink_frame.gateway_id = hex::encode(&gw_down.gateway_id);
self.downlink_gateway = Some(gw_down);
Ok(())
@ -160,16 +160,13 @@ impl JoinAccept<'_> {
}
// set timestamp
tx_info.set_timing(chirpstack_api::gw::DownlinkTiming::Delay);
tx_info.timing_info = Some(
chirpstack_api::gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
chirpstack_api::gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(
self.region_conf.get_defaults().join_accept_delay1,
)),
},
),
);
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(
self.region_conf.get_defaults().join_accept_delay1,
)),
})),
});
// set downlink item
self.downlink_frame
@ -209,16 +206,13 @@ impl JoinAccept<'_> {
}
// set timestamp
tx_info.set_timing(chirpstack_api::gw::DownlinkTiming::Delay);
tx_info.timing_info = Some(
chirpstack_api::gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
chirpstack_api::gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(
self.region_conf.get_defaults().join_accept_delay2,
)),
},
),
);
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(
self.region_conf.get_defaults().join_accept_delay2,
)),
})),
});
// set downlink item
self.downlink_frame
@ -250,7 +244,7 @@ impl JoinAccept<'_> {
async fn save_downlink_frame(&self) -> Result<()> {
let df = chirpstack_api::internal::DownlinkFrame {
dev_eui: self.device.dev_eui.to_be_bytes().to_vec(),
downlink_id: self.downlink_frame.downlink_id.clone(),
downlink_id: self.downlink_frame.downlink_id,
downlink_frame: Some(self.downlink_frame.clone()),
nwk_s_enc_key: self.device_session.nwk_s_enc_key.clone(),
..Default::default()

View File

@ -4,6 +4,7 @@ use anyhow::{Context, Result};
use petgraph::algo::min_spanning_tree;
use petgraph::data::FromElements;
use petgraph::graph::{DefaultIx, Graph, NodeIndex, UnGraph};
use rand::Rng;
use tracing::{span, trace, warn, Instrument, Level};
use crate::downlink::helpers;
@ -41,8 +42,8 @@ impl Multicast {
let mut ctx = Multicast {
downlink_frame: gw::DownlinkFrame {
downlink_id: qi.id.as_bytes().to_vec(),
gateway_id: qi.gateway_id.to_vec(),
downlink_id: rand::thread_rng().gen(),
gateway_id: qi.gateway_id.to_string(),
..Default::default()
},
multicast_group_queue_item: qi,
@ -140,27 +141,27 @@ impl Multicast {
match self.multicast_group_queue_item.emit_at_time_since_gps_epoch {
Some(v) => {
tx_info.set_timing(gw::DownlinkTiming::GpsEpoch);
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::GpsEpochTimingInfo(
gw::GpsEpochTimingInfo {
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::GpsEpoch(gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(
std::time::Duration::from_millis(v as u64),
)),
},
));
})),
});
}
None => {
tx_info.set_timing(gw::DownlinkTiming::Immediately);
tx_info.timing_info =
Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo(
tx_info.timing = Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {},
));
)),
});
}
}
self.downlink_frame.items.push(gw::DownlinkFrameItem {
phy_payload: vec![],
tx_info: Some(tx_info),
tx_info_legacy: None,
});
Ok(())
@ -204,7 +205,7 @@ impl Multicast {
trace!("Saving downlink frame");
downlink_frame::save(&internal::DownlinkFrame {
downlink_id: self.downlink_frame.downlink_id.clone(),
downlink_id: self.downlink_frame.downlink_id,
multicast_group_id: self
.multicast_group_queue_item
.multicast_group_id

View File

@ -1,4 +1,4 @@
use anyhow::{Context, Result};
use anyhow::Result;
use chrono::{Duration, Utc};
use std::time::SystemTime;
use tracing::{error, info, span, trace, Instrument, Level};
@ -16,7 +16,7 @@ use chirpstack_api::{api, common, gw, integration as integration_pb, internal};
pub struct TxAck {
downlink_tx_ack: gw::DownlinkTxAck,
downlink_tx_ack_status: gw::TxAckStatus,
downlink_id: Uuid,
downlink_id: u32,
downlink_frame: Option<internal::DownlinkFrame>,
downlink_frame_item: Option<gw::DownlinkFrameItem>,
@ -31,23 +31,13 @@ pub struct TxAck {
impl TxAck {
pub async fn handle(tx_ack: gw::DownlinkTxAck) {
let downlink_id = match Uuid::from_slice(&tx_ack.downlink_id) {
Ok(v) => v,
Err(e) => {
error!(error = %e, "Get downlink_id error");
return;
}
};
let span = span!(Level::TRACE, "tx_ack", downlink_id = %downlink_id);
let span = span!(Level::TRACE, "tx_ack", downlink_id = tx_ack.downlink_id);
if let Err(e) = TxAck::_handle(tx_ack).instrument(span).await {
error!(error = %e, "Handling tx ack error");
}
}
async fn _handle(tx_ack: gw::DownlinkTxAck) -> Result<()> {
let downlink_id = Uuid::from_slice(&tx_ack.downlink_id).context("Uuid from downlink_id")?;
if tx_ack.items.is_empty() {
return Err(anyhow!("Zero items in tx ack"));
}
@ -63,8 +53,8 @@ impl TxAck {
}
status
},
downlink_id: tx_ack.downlink_id,
downlink_tx_ack: tx_ack,
downlink_id,
downlink_frame: None,
downlink_frame_item: None,
phy_payload: None,
@ -132,7 +122,7 @@ impl TxAck {
async fn get_downlink_frame(&mut self) -> Result<()> {
trace!("Get downlink-frame from Redis");
let df = downlink_frame::get(&self.downlink_id).await?;
let df = downlink_frame::get(self.downlink_id).await?;
let gw_df = &df
.downlink_frame
.as_ref()
@ -343,20 +333,19 @@ impl TxAck {
let mut tags = (&*dp.tags).clone();
tags.clone_from(&*dev.tags);
let downlink_id = Uuid::from_slice(&self.downlink_frame.as_ref().unwrap().downlink_id)?;
let gateway_id = EUI64::from_slice(
&self
.downlink_frame
.as_ref()
.unwrap()
.downlink_frame
.as_ref()
.unwrap()
.gateway_id,
)?;
let downlink_id = self.downlink_frame.as_ref().unwrap().downlink_id;
let gateway_id = self
.downlink_frame
.as_ref()
.unwrap()
.downlink_frame
.as_ref()
.unwrap()
.gateway_id
.clone();
let pl = integration_pb::TxAckEvent {
downlink_id: downlink_id.to_string(),
downlink_id,
time: Some(Utc::now().into()),
device_info: Some(integration_pb::DeviceInfo {
tenant_id: tenant.id.to_string(),
@ -371,7 +360,7 @@ impl TxAck {
}),
queue_item_id: qi.id.to_string(),
f_cnt_down: qi.f_cnt_down.unwrap_or(0) as u32,
gateway_id: gateway_id.to_string(),
gateway_id,
tx_info: self.downlink_frame_item.as_ref().unwrap().tx_info.clone(),
};
@ -403,8 +392,8 @@ impl TxAck {
time: Some(SystemTime::now().into()),
phy_payload: dfi.phy_payload.clone(),
tx_info: dfi.tx_info.clone(),
downlink_id: Uuid::from_slice(&gw_df.downlink_id)?.to_string(),
gateway_id: EUI64::from_slice(&gw_df.gateway_id)?.to_string(),
downlink_id: gw_df.downlink_id,
gateway_id: gw_df.gateway_id.clone(),
m_type: match &phy.mhdr.m_type {
MType::JoinAccept => common::MType::JoinAccept,
MType::UnconfirmedDataDown => common::MType::UnconfirmedDataDown,
@ -457,7 +446,7 @@ impl TxAck {
time: dfl.time.clone(),
phy_payload: phy.to_vec()?,
tx_info: dfl.tx_info.clone(),
downlink_id: dfl.downlink_id.clone(),
downlink_id: dfl.downlink_id,
gateway_id: dfl.gateway_id.clone(),
m_type: dfl.m_type,
dev_addr: dfl.dev_addr.clone(),

View File

@ -1,4 +1,5 @@
use std::io::Cursor;
use std::str::FromStr;
use std::thread::sleep;
use std::time::Duration;
@ -29,7 +30,7 @@ pub async fn log_uplink_for_gateways(ufl: &api::UplinkFrameLog) -> Result<()> {
let mut c = get_redis_conn()?;
for rx_info in &ufl.rx_info {
let gateway_id = EUI64::from_slice(&rx_info.gateway_id)?;
let gateway_id = EUI64::from_str(&rx_info.gateway_id)?;
let ufl_copy = api::UplinkFrameLog {
phy_payload: ufl.phy_payload.clone(),

View File

@ -152,11 +152,12 @@ impl<'a> MqttBackend<'a> {
#[async_trait]
impl GatewayBackend for MqttBackend<'_> {
async fn send_downlink(&self, df: &chirpstack_api::gw::DownlinkFrame) -> Result<()> {
let gateway_id = EUI64::from_slice(&df.gateway_id)?;
let topic = self.get_command_topic(&gateway_id.to_string(), "down")?;
let topic = self.get_command_topic(&df.gateway_id, "down")?;
let mut df = df.clone();
df.v4_migrate();
let b = df.encode_to_vec();
info!(gateway_id = %gateway_id, topic = %topic, "Sending downlink frame");
info!(gateway_id = %df.gateway_id, topic = %topic, "Sending downlink frame");
let msg = mqtt::Message::new(topic, b, self.qos as i32);
self.client.publish(msg).await?;
trace!("Message sent");
@ -196,14 +197,11 @@ async fn message_callback(region_name: &str, region_common_name: CommonName, msg
let err = || -> Result<()> {
if topic.ends_with("/up") {
let mut event = chirpstack_api::gw::UplinkFrame::decode(&mut Cursor::new(b))?;
event.v4_migrate();
if let Some(rx_info) = &mut event.rx_info {
rx_info
.metadata
.insert("region_name".to_string(), region_name.to_string());
rx_info.metadata.insert(
"region_common_name".to_string(),
region_common_name.to_string(),
);
rx_info.set_metadata_string("region_name", region_name);
rx_info.set_metadata_string("region_common_name", &region_common_name.to_string());
}
tokio::spawn(uplink::deduplicate_uplink(event));
@ -218,7 +216,8 @@ async fn message_callback(region_name: &str, region_common_name: CommonName, msg
);
tokio::spawn(uplink::stats::Stats::handle(event));
} else if topic.ends_with("/ack") {
let event = chirpstack_api::gw::DownlinkTxAck::decode(&mut Cursor::new(b))?;
let mut event = chirpstack_api::gw::DownlinkTxAck::decode(&mut Cursor::new(b))?;
event.v4_migrate();
tokio::spawn(downlink::tx_ack::TxAck::handle(event));
} else {
return Err(anyhow!("Unknown event type"));

View File

@ -146,12 +146,13 @@ impl IntegrationTrait for Integration {
pl.rx_info
.iter()
.max_by(|x, y| {
x.lora_snr
.partial_cmp(&y.lora_snr)
x.snr
.partial_cmp(&y.snr)
.unwrap_or(std::cmp::Ordering::Less)
})
.unwrap()
.lora_snr,
.snr
.into(),
),
);
v
@ -559,17 +560,17 @@ device_uplink,application_name=test-app,dev_eui=0102030405060708,device_name=tes
rx_info: vec![
gw::UplinkRxInfo {
rssi: -60,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -55,
lora_snr: 2.5,
snr: 2.5,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -70,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
],
@ -651,17 +652,17 @@ device_uplink,application_name=test-app,dev_eui=0102030405060708,device_name=tes
rx_info: vec![
gw::UplinkRxInfo {
rssi: -60,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -55,
lora_snr: 2.5,
snr: 2.5,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -70,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
],
@ -769,17 +770,17 @@ device_uplink,application_name=test-app,dev_eui=0102030405060708,device_name=tes
rx_info: vec![
gw::UplinkRxInfo {
rssi: -60,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -55,
lora_snr: 2.5,
snr: 2.5,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -70,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
],

View File

@ -401,7 +401,7 @@ pub struct UplinkTdoa {
#[serde(rename = "gatewayId")]
pub gateway_id: String,
pub rssi: f64,
pub snr: f64,
pub snr: f32,
pub toa: u32,
#[serde(rename = "antennaId")]
pub antenna_id: u32,
@ -414,7 +414,7 @@ impl UplinkTdoa {
UplinkTdoa {
gateway_id: hex::encode(&rx_info.gateway_id),
rssi: rx_info.rssi.into(),
snr: rx_info.lora_snr,
snr: rx_info.snr,
antenna_id: rx_info.antenna,
antenna_location: match &rx_info.location {
Some(loc) => AntennaLocation {
@ -428,12 +428,9 @@ impl UplinkTdoa {
altitude: 0.0,
},
},
toa: match &rx_info.fine_timestamp {
Some(gw::uplink_rx_info::FineTimestamp::PlainFineTimestamp(ft)) => match &ft.time {
Some(v) => v.nanos as u32,
None => 0,
},
_ => 0,
toa: match &rx_info.fine_time_since_gps_epoch {
Some(v) => v.nanos as u32,
None => 0,
},
}
}
@ -444,7 +441,7 @@ pub struct UplinkRssi {
#[serde(rename = "gatewayId")]
pub gateway_id: String,
pub rssi: f64,
pub snr: f64,
pub snr: f32,
#[serde(rename = "antennaId")]
pub antenna_id: u32,
#[serde(rename = "antennaLocation")]
@ -456,7 +453,7 @@ impl UplinkRssi {
UplinkRssi {
gateway_id: hex::encode(&rx_info.gateway_id),
rssi: rx_info.rssi.into(),
snr: rx_info.lora_snr,
snr: rx_info.snr,
antenna_id: rx_info.antenna,
antenna_location: match &rx_info.location {
Some(loc) => AntennaLocation {

View File

@ -43,9 +43,9 @@ impl UplinkPayload {
.rx_info
.iter()
.map(|i| RxInfo {
gateway_id: hex::encode(&i.gateway_id),
gateway_id: i.gateway_id.clone(),
rssi: i.rssi,
lora_snr: i.lora_snr,
lora_snr: i.snr,
location: match &i.location {
Some(v) => Location {
latitude: v.latitude,
@ -71,7 +71,7 @@ struct RxInfo {
pub gateway_id: String,
pub rssi: i32,
#[serde(rename = "loRaSNR")]
pub lora_snr: f64,
pub lora_snr: f32,
pub location: Location,
}
@ -233,9 +233,9 @@ pub mod test {
..Default::default()
}),
rx_info: vec![gw::UplinkRxInfo {
gateway_id: vec![8, 7, 6, 5, 4, 3, 2, 1],
gateway_id: "0807060504030201".to_string(),
rssi: 20,
lora_snr: 5.0,
snr: 5.0,
location: Some(common::Location {
latitude: 1.123,
longitude: 2.123,

View File

@ -138,7 +138,7 @@ struct UplinkPayload {
struct UplinkMetadata {
pub rssi: i32,
#[serde(rename = "lorasnr")]
pub lora_snr: f64,
pub lora_snr: f32,
#[serde(rename = "rfchain")]
pub rf_chain: u32,
pub antenna: u32,
@ -161,8 +161,8 @@ impl UplinkPayload {
.iter()
.map(|i| UplinkMetadata {
rssi: i.rssi,
lora_snr: i.lora_snr,
rf_chain: i.rf_chain,
lora_snr: i.snr,
rf_chain: 0,
antenna: i.antenna,
board: i.board,
})
@ -212,7 +212,7 @@ pub mod test {
dev_addr: "04030201".into(),
rx_info: vec![gw::UplinkRxInfo {
rssi: -10,
lora_snr: 3.5,
snr: 3.5,
antenna: 1,
board: 2,
..Default::default()

View File

@ -132,12 +132,13 @@ impl IntegrationTrait for Integration {
pl.rx_info
.iter()
.max_by(|x, y| {
x.lora_snr
.partial_cmp(&y.lora_snr)
x.snr
.partial_cmp(&y.snr)
.unwrap_or(std::cmp::Ordering::Less)
})
.unwrap()
.lora_snr,
.snr
.into(),
),
);
let telemetry = Payload(telemetry);
@ -335,17 +336,17 @@ pub mod test {
rx_info: vec![
gw::UplinkRxInfo {
rssi: -60,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -55,
lora_snr: 2.5,
snr: 2.5,
..Default::default()
},
gw::UplinkRxInfo {
rssi: -70,
lora_snr: 1.0,
snr: 1.0,
..Default::default()
},
],

View File

@ -15,19 +15,27 @@ pub fn handle(
info!(dev_eui = %dev.dev_eui, "Received LinkCheckReq");
if let Some(gw::uplink_tx_info::ModulationInfo::LoraModulationInfo(pl)) =
&ufs.tx_info.modulation_info
{
let mod_info = ufs
.tx_info
.modulation
.as_ref()
.ok_or(anyhow!("modulation can not be None"))?;
let mod_params = mod_info
.parameters
.as_ref()
.ok_or(anyhow!("parameters can not be None"))?;
if let gw::modulation::Parameters::Lora(pl) = mod_params {
let required_snr = config::get_required_snr_for_sf(pl.spreading_factor as u8)?;
let mut max_snr: f64 = 0.0;
let mut max_snr: f32 = 0.0;
for (i, rx_info) in ufs.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.lora_snr > max_snr {
max_snr = rx_info.lora_snr;
if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.snr;
}
}
let mut margin = max_snr - required_snr as f64;
let mut margin = max_snr - required_snr;
if margin < 0.0 {
margin = 0.0;
}
@ -69,21 +77,21 @@ pub mod test {
mic: None,
},
tx_info: gw::UplinkTxInfo {
modulation_info: Some(gw::uplink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(gw::LoraModulationInfo {
spreading_factor: 10,
..Default::default()
},
)),
})),
}),
..Default::default()
},
rx_info_set: vec![
gw::UplinkRxInfo {
lora_snr: -2.0,
snr: -2.0,
..Default::default()
},
gw::UplinkRxInfo {
lora_snr: 2.0,
snr: 2.0,
..Default::default()
},
],

View File

@ -4,35 +4,35 @@ use anyhow::Result;
use prost::Message;
use tokio::task;
use tracing::info;
use uuid::Uuid;
use super::{get_redis_conn, redis_key};
use super::{error::Error, get_redis_conn, redis_key};
use chirpstack_api::internal;
pub async fn save(df: &internal::DownlinkFrame) -> Result<()> {
let id = Uuid::from_slice(&df.downlink_frame.as_ref().unwrap().downlink_id)?;
task::spawn_blocking({
let df = df.clone();
move || -> Result<()> {
let b = df.encode_to_vec();
let key = redis_key(format!("frame:{}", id));
let key = redis_key(format!("frame:{}", df.downlink_id));
let mut c = get_redis_conn()?;
redis::cmd("SETEX").arg(key).arg(30).arg(b).query(&mut *c)?;
Ok(())
}
})
.await??;
info!(downlink_id = %id, "Downlink-frame saved");
info!(downlink_id = df.downlink_id, "Downlink-frame saved");
Ok(())
}
pub async fn get(id: &Uuid) -> Result<internal::DownlinkFrame> {
pub async fn get(id: u32) -> Result<internal::DownlinkFrame, Error> {
task::spawn_blocking({
let id = *id;
move || -> Result<internal::DownlinkFrame> {
move || -> Result<internal::DownlinkFrame, Error> {
let mut c = get_redis_conn()?;
let key = redis_key(format!("frame:{}", id));
let v: Vec<u8> = redis::cmd("GET").arg(key).query(&mut *c)?;
if v.is_empty() {
return Err(Error::NotFound(format!("{}", id)));
}
let df = internal::DownlinkFrame::decode(&mut Cursor::new(v))?;
Ok(df)
}
@ -49,17 +49,16 @@ pub mod test {
#[tokio::test]
async fn test_downlink_frame() {
let _guard = test::prepare().await;
let id = Uuid::new_v4();
let df = internal::DownlinkFrame {
downlink_id: 12345,
downlink_frame: Some(gw::DownlinkFrame {
downlink_id: id.as_bytes().to_vec(),
..Default::default()
}),
..Default::default()
};
save(&df).await.unwrap();
let df_get = get(&id).await.unwrap();
let df_get = get(12345).await.unwrap();
assert_eq!(df, df_get);
}
}

View File

@ -44,6 +44,9 @@ pub enum Error {
#[error(transparent)]
Redis(#[from] redis::RedisError),
#[error(transparent)]
ProstDecode(#[from] prost::DecodeError),
}
impl Error {

View File

@ -5,7 +5,6 @@ use std::pin::Pin;
use prost::Message;
use redis::streams::StreamReadReply;
use tokio::sync::RwLock;
use uuid::Uuid;
use crate::gateway::backend::mock as gateway_mock;
use crate::integration::mock;
@ -16,7 +15,7 @@ use chirpstack_api::{gw, integration as integration_pb, internal, meta};
use lrwn::EUI64;
lazy_static! {
static ref LAST_DOWNLINK_ID: RwLock<Uuid> = RwLock::new(Uuid::nil());
static ref LAST_DOWNLINK_ID: RwLock<u32> = RwLock::new(0);
}
pub type Validator = Box<dyn Fn() -> Pin<Box<dyn Future<Output = ()>>>>;
@ -229,12 +228,12 @@ pub fn downlink_frame(df: gw::DownlinkFrame) -> Validator {
let mut items = gateway_mock::get_downlink_frames().await;
assert_eq!(1, items.len());
assert_eq!(16, items[0].downlink_id.len());
assert!(items[0].downlink_id != 0);
let mut last_downlink_id = LAST_DOWNLINK_ID.write().await;
*last_downlink_id = Uuid::from_slice(&items[0].downlink_id).unwrap();
*last_downlink_id = items[0].downlink_id;
items[0].downlink_id = Vec::new();
items[0].downlink_id = 0;
assert_eq!(df, items[0]);
})
})
@ -247,10 +246,10 @@ pub fn downlink_phy_payloads(phys: Vec<lrwn::PhyPayload>) -> Validator {
let items = gateway_mock::get_downlink_frames().await;
assert_eq!(1, items.len());
assert_eq!(16, items[0].downlink_id.len());
assert!(items[0].downlink_id != 0);
let mut last_downlink_id = LAST_DOWNLINK_ID.write().await;
*last_downlink_id = Uuid::from_slice(&items[0].downlink_id).unwrap();
*last_downlink_id = items[0].downlink_id;
assert_eq!(phys.len(), items[0].items.len());
@ -270,10 +269,10 @@ pub fn downlink_phy_payloads_decoded_f_opts(phys: Vec<lrwn::PhyPayload>) -> Vali
let items = gateway_mock::get_downlink_frames().await;
assert_eq!(1, items.len());
assert_eq!(16, items[0].downlink_id.len());
assert!(items[0].downlink_id != 0);
let mut last_downlink_id = LAST_DOWNLINK_ID.write().await;
*last_downlink_id = Uuid::from_slice(&items[0].downlink_id).unwrap();
*last_downlink_id = items[0].downlink_id;
assert_eq!(phys.len(), items[0].items.len());
@ -292,13 +291,13 @@ pub fn downlink_frame_saved(df: internal::DownlinkFrame) -> Validator {
Box::new(move || {
let df = df.clone();
Box::pin(async move {
let mut df_get = downlink_frame::get(&LAST_DOWNLINK_ID.read().await.clone())
let mut df_get = downlink_frame::get(*LAST_DOWNLINK_ID.read().await)
.await
.unwrap();
df_get.downlink_id = Vec::new();
df_get.downlink_id = 0;
if let Some(df) = &mut df_get.downlink_frame {
df.downlink_id = Vec::new();
df.downlink_id = 0;
}
assert_eq!(df, df_get);

View File

@ -96,28 +96,19 @@ async fn test_gateway_filtering() {
.await
.unwrap();
let rx_info_a = gw::UplinkRxInfo {
gateway_id: gw_a.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info_a = gw::UplinkRxInfo {
gateway_id: gw_a.gateway_id.to_string(),
..Default::default()
};
let rx_info_b = gw::UplinkRxInfo {
gateway_id: gw_b.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
rx_info_a.set_metadata_string("region_name", "eu868");
rx_info_a.set_metadata_string("region_common_name", "EU868");
let mut rx_info_b = gw::UplinkRxInfo {
gateway_id: gw_b.gateway_id.to_string(),
..Default::default()
};
rx_info_b.set_metadata_string("region_name", "eu868");
rx_info_b.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -253,17 +244,12 @@ async fn test_lorawan_10_errors() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -436,17 +422,12 @@ async fn test_lorawan_11_errors() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info_freq = gw::UplinkTxInfo {
frequency: 868300000,
@ -589,17 +570,12 @@ async fn test_lorawan_10_skip_f_cnt() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -781,17 +757,12 @@ async fn test_lorawan_10_device_disabled() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -903,17 +874,12 @@ async fn test_lorawan_10_uplink() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -1247,59 +1213,59 @@ async fn test_lorawan_10_uplink() {
..Default::default()
}),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 160, 5, 0, 161, 179, 218, 104],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 160, 5, 0, 161, 179, 218, 104],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
),
),
)),
}),
..Default::default()
}),
},
@ -1357,59 +1323,59 @@ async fn test_lorawan_10_uplink() {
..Default::default()
}),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 160, 5, 0, 161, 179, 218, 104],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 160, 5, 0, 161, 179, 218, 104],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
),
),
)),
}),
..Default::default()
}),
},
@ -1521,17 +1487,12 @@ async fn test_lorawan_11_uplink() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -1754,17 +1715,12 @@ async fn test_lorawan_10_rx_delay() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -1848,55 +1804,59 @@ async fn test_lorawan_10_rx_delay() {
..Default::default()
}),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 160, 5, 0, 161, 179, 218, 104],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(3).into()),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(3).into()),
},
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 160, 5, 0, 161, 179, 218, 104],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(4).into()),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(4).into()),
},
)),
}),
..Default::default()
}),
},
@ -1963,17 +1923,12 @@ async fn test_lorawan_10_mac_commands() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -2332,17 +2287,12 @@ async fn test_lorawan_11_mac_commands() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -2526,17 +2476,12 @@ async fn test_lorawan_10_device_queue() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -2998,17 +2943,12 @@ async fn test_lorawan_11_device_queue() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -3474,17 +3414,12 @@ async fn test_lorawan_10_adr() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -4315,17 +4250,12 @@ async fn test_lorawan_10_device_status_request() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -4577,17 +4507,12 @@ async fn test_lorawan_11_receive_window_selection() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -4659,29 +4584,29 @@ async fn test_lorawan_11_receive_window_selection() {
assert: vec![
assert::f_cnt_up(dev.dev_eui.clone(), 11),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 128, 0, 0, 1, 240, 144, 155, 230, 40],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
)),
})),
}),
..Default::default()
}),
}],
@ -4728,29 +4653,29 @@ async fn test_lorawan_11_receive_window_selection() {
assert: vec![
assert::f_cnt_up(dev.dev_eui.clone(), 11),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 128, 0, 0, 1, 240, 144, 155, 230, 40],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
)),
})),
}),
..Default::default()
}),
}],
@ -4797,55 +4722,59 @@ async fn test_lorawan_11_receive_window_selection() {
assert: vec![
assert::f_cnt_up(dev.dev_eui.clone(), 11),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 128, 0, 0, 1, 240, 144, 155, 230, 40],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 128, 0, 0, 1, 240, 144, 155, 230, 40],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
)),
}),
..Default::default()
}),
},
@ -4891,7 +4820,7 @@ async fn test_lorawan_11_receive_window_selection() {
assert: vec![
assert::f_cnt_up(dev.dev_eui.clone(), 11),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![
gw::DownlinkFrameItem {
phy_payload: vec![
@ -4904,51 +4833,55 @@ async fn test_lorawan_11_receive_window_selection() {
152, 187, 95, 49, 125, 43, 91, 149, 177, 152, 82, 34, 124, 17, 64, 200,
9, 227,
],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 7,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(1).into()),
},
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 144, 5, 0, 88, 62, 73, 197], // f_pending = true
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(2).into()),
},
)),
}),
..Default::default()
}),
},

View File

@ -84,17 +84,12 @@ async fn test_uplink() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -304,31 +299,33 @@ async fn test_downlink_scheduler() {
assert::f_cnt_up(dev.dev_eui.clone(), 8),
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 128, 5, 0, 10, 115, 46, 73, 41, 113, 46, 49],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868300000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 10,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::GpsEpoch.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::GpsEpochTimingInfo(
gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(
ping_slot_ts.to_std().unwrap(),
)),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::GpsEpoch(
gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(
ping_slot_ts.to_std().unwrap(),
)),
},
)),
}),
..Default::default()
}),
}],
@ -382,33 +379,35 @@ async fn test_downlink_scheduler() {
assert::f_cnt_up(dev.dev_eui.clone(), 8),
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![
96, 4, 3, 2, 1, 144, 5, 0, 10, 115, 46, 73, 218, 230, 215, 91,
],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868300000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 10,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::GpsEpoch.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::GpsEpochTimingInfo(
gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(
ping_slot_ts.to_std().unwrap(),
)),
},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::GpsEpoch(
gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(
ping_slot_ts.to_std().unwrap(),
)),
},
)),
}),
..Default::default()
}),
}],

View File

@ -118,27 +118,29 @@ async fn test_downlink_scheduler() {
assert: vec![
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![96, 4, 3, 2, 1, 128, 5, 0, 10, 115, 46, 73, 41, 113, 46, 49],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Immediately.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo(
gw::ImmediatelyTimingInfo {},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {},
)),
}),
..Default::default()
}),
}],
@ -183,29 +185,31 @@ async fn test_downlink_scheduler() {
assert: vec![
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
assert::downlink_frame(gw::DownlinkFrame {
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![
160, 4, 3, 2, 1, 128, 5, 0, 10, 115, 46, 73, 138, 39, 53, 228,
],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Immediately.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo(
gw::ImmediatelyTimingInfo {},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {},
)),
}),
..Default::default()
}),
}],

View File

@ -3,7 +3,7 @@ use crate::storage::{
application, device, device_gateway, device_profile, fields, gateway, multicast, tenant,
};
use crate::{downlink, gateway::backend as gateway_backend, integration, test};
use chirpstack_api::{common, gw, internal};
use chirpstack_api::{gw, internal};
use lrwn::{AES128Key, DevAddr, EUI64};
struct MulticastTest {
@ -118,29 +118,31 @@ async fn test_multicast() {
..Default::default()
}],
assert: vec![assert::downlink_frame(gw::DownlinkFrame {
gateway_id: gw.gateway_id.to_vec(),
gateway_id: gw.gateway_id.to_string(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![
96, 4, 3, 2, 1, 0, 10, 0, 5, 161, 250, 255, 42, 110, 141, 200,
],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868300000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 9,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Immediately.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo(
gw::ImmediatelyTimingInfo {},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {},
)),
}),
..Default::default()
}),
}],
@ -165,29 +167,31 @@ async fn test_multicast() {
},
],
assert: vec![assert::downlink_frame(gw::DownlinkFrame {
gateway_id: gw.gateway_id.to_vec(),
gateway_id: gw.gateway_id.to_string(),
items: vec![gw::DownlinkFrameItem {
phy_payload: vec![
96, 4, 3, 2, 1, 0, 10, 0, 5, 161, 250, 255, 42, 110, 141, 200,
],
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868300000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 9,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Immediately.into(),
timing_info: Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo(
gw::ImmediatelyTimingInfo {},
)),
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {},
)),
}),
..Default::default()
}),
}],

View File

@ -104,28 +104,19 @@ async fn test_gateway_filtering() {
.await
.unwrap();
let rx_info_a = gw::UplinkRxInfo {
gateway_id: gw_a.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info_a = gw::UplinkRxInfo {
gateway_id: gw_a.gateway_id.to_string(),
..Default::default()
};
let rx_info_b = gw::UplinkRxInfo {
gateway_id: gw_b.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
rx_info_a.set_metadata_string("region_name", "eu868");
rx_info_a.set_metadata_string("region_common_name", "EU868");
let mut rx_info_b = gw::UplinkRxInfo {
gateway_id: gw_b.gateway_id.to_string(),
..Default::default()
};
rx_info_b.set_metadata_string("region_name", "eu868");
rx_info_b.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -274,17 +265,12 @@ async fn test_lorawan_10() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -430,60 +416,60 @@ async fn test_lorawan_10() {
items: vec![
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(5).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(6).into()),
},
),
),
)),
}),
..Default::default()
}),
},
],
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".to_string(),
..Default::default()
}),
assert::downlink_frame_saved(internal::DownlinkFrame {
@ -495,60 +481,60 @@ async fn test_lorawan_10() {
items: vec![
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(5).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(6).into()),
},
),
),
)),
}),
..Default::default()
}),
},
],
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
..Default::default()
}),
..Default::default()
@ -715,60 +701,60 @@ async fn test_lorawan_10() {
items: vec![
gw::DownlinkFrameItem {
phy_payload: ja_cflist_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(5).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: ja_cflist_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(6).into()),
},
),
),
)),
}),
..Default::default()
}),
},
],
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
..Default::default()
}),
],
@ -922,17 +908,12 @@ async fn test_lorawan_11() {
.await
.unwrap();
let rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_be_bytes().to_vec(),
metadata: [
("region_name".to_string(), "eu868".to_string()),
("region_common_name".to_string(), "EU868".to_string()),
]
.iter()
.cloned()
.collect(),
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
rx_info.set_metadata_string("region_common_name", "EU868");
let mut tx_info = gw::UplinkTxInfo {
frequency: 868100000,
@ -1047,60 +1028,60 @@ async fn test_lorawan_11() {
items: vec![
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(5).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(6).into()),
},
),
),
)),
}),
..Default::default()
}),
},
],
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".to_string(),
..Default::default()
}),
assert::downlink_frame_saved(internal::DownlinkFrame {
@ -1113,60 +1094,60 @@ async fn test_lorawan_11() {
items: vec![
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 868100000,
power: 14,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(5).into()),
},
),
),
)),
}),
..Default::default()
}),
},
gw::DownlinkFrameItem {
phy_payload: ja_pl.to_vec().unwrap(),
tx_info_legacy: None,
tx_info: Some(gw::DownlinkTxInfo {
frequency: 869525000,
power: 27,
modulation: common::Modulation::Lora.into(),
modulation_info: Some(
gw::downlink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: 125,
modulation: Some(gw::Modulation {
parameters: Some(gw::modulation::Parameters::Lora(
gw::LoraModulationInfo {
bandwidth: 125000,
spreading_factor: 12,
code_rate: "4/5".into(),
code_rate: gw::CodeRate::Cr45.into(),
polarization_inversion: true,
..Default::default()
},
),
),
timing: gw::DownlinkTiming::Delay.into(),
timing_info: Some(
gw::downlink_tx_info::TimingInfo::DelayTimingInfo(
)),
}),
timing: Some(gw::Timing {
parameters: Some(gw::timing::Parameters::Delay(
gw::DelayTimingInfo {
delay: Some(Duration::from_secs(6).into()),
},
),
),
)),
}),
..Default::default()
}),
},
],
gateway_id: vec![1, 2, 3, 4, 5, 6, 7, 8],
gateway_id: "0102030405060708".into(),
..Default::default()
}),
..Default::default()

View File

@ -478,9 +478,9 @@ impl Data {
.rx_info_set
.iter()
.map(|rx_info| internal::DeviceGatewayRxInfoItem {
gateway_id: rx_info.gateway_id.clone(),
gateway_id: hex::decode(&rx_info.gateway_id).unwrap(),
rssi: rx_info.rssi,
lora_snr: rx_info.lora_snr as f32,
lora_snr: rx_info.snr,
antenna: rx_info.antenna,
board: rx_info.board,
context: rx_info.context.clone(),
@ -510,8 +510,8 @@ impl Data {
let mut max_snr = 0.0;
for (i, rx_info) in self.uplink_frame_set.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.lora_snr > max_snr {
max_snr = rx_info.lora_snr;
if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.snr;
}
}
@ -524,7 +524,7 @@ impl Data {
ds.uplink_adr_history.push(internal::UplinkAdrHistory {
f_cnt: self.f_cnt_up_full,
max_snr: max_snr as f32,
max_snr,
max_rssi,
tx_power_index: ds.tx_power_index,
gateway_count: self.uplink_frame_set.rx_info_set.len() as u32,
@ -687,20 +687,20 @@ impl Data {
async fn save_metrics(&self) -> Result<()> {
trace!("Saving device metrics");
let mut max_rssi: i32 = 0;
let mut max_snr: f64 = 0.0;
let mut max_snr: f32 = 0.0;
for (i, rx_info) in self.uplink_frame_set.rx_info_set.iter().enumerate() {
if i == 0 {
max_rssi = rx_info.rssi;
max_snr = rx_info.lora_snr;
max_snr = rx_info.snr;
}
if rx_info.rssi > max_rssi {
max_rssi = rx_info.rssi;
}
if rx_info.lora_snr > max_snr {
max_snr = rx_info.lora_snr;
if rx_info.snr > max_snr {
max_snr = rx_info.snr;
}
}
@ -711,7 +711,7 @@ impl Data {
record.metrics.insert("rx_count".into(), 1.0);
record.metrics.insert("gw_rssi_sum".into(), max_rssi as f64);
record.metrics.insert("gw_snr_sum".into(), max_snr);
record.metrics.insert("gw_snr_sum".into(), max_snr as f64);
record.metrics.insert(
format!("rx_freq_{}", self.uplink_frame_set.tx_info.frequency),
1.0,

View File

@ -10,23 +10,28 @@ use chirpstack_api::{common, gw};
pub fn get_uplink_dr(region_name: &str, tx_info: &chirpstack_api::gw::UplinkTxInfo) -> Result<u8> {
let region_conf = region::get(region_name)?;
let mod_info = tx_info
.modulation_info
.modulation
.as_ref()
.ok_or(anyhow!("modulation_info must not be None"))?;
.ok_or(anyhow!("modulation must not be None"))?;
let dr_modulation = match &mod_info {
chirpstack_api::gw::uplink_tx_info::ModulationInfo::LoraModulationInfo(v) => {
let mod_params = mod_info
.parameters
.as_ref()
.ok_or(anyhow!("parameters must not be None"))?;
let dr_modulation = match &mod_params {
chirpstack_api::gw::modulation::Parameters::Lora(v) => {
lrwn::region::DataRateModulation::Lora(lrwn::region::LoraDataRate {
spreading_factor: v.spreading_factor as u8,
bandwidth: v.bandwidth * 1000, // kHz to Hz
bandwidth: v.bandwidth,
})
}
chirpstack_api::gw::uplink_tx_info::ModulationInfo::FskModulationInfo(v) => {
chirpstack_api::gw::modulation::Parameters::Fsk(v) => {
lrwn::region::DataRateModulation::Fsk(lrwn::region::FskDataRate {
bitrate: v.datarate,
})
}
chirpstack_api::gw::uplink_tx_info::ModulationInfo::LrFhssModulationInfo(v) => {
chirpstack_api::gw::modulation::Parameters::LrFhss(v) => {
lrwn::region::DataRateModulation::LrFhss(lrwn::region::LrFhssDataRate {
coding_rate: v.code_rate.clone(),
occupied_channel_width: v.operating_channel_width,
@ -45,40 +50,33 @@ pub fn set_uplink_modulation(
let region_conf = region::get(region_name)?;
let params = region_conf.get_data_rate(dr)?;
match params {
lrwn::region::DataRateModulation::Lora(v) => {
tx_info.set_modulation(common::Modulation::Lora);
tx_info.modulation_info = Some(gw::uplink_tx_info::ModulationInfo::LoraModulationInfo(
gw::LoRaModulationInfo {
bandwidth: v.bandwidth / 1000,
tx_info.modulation = Some(gw::Modulation {
parameters: Some(match params {
lrwn::region::DataRateModulation::Lora(v) => {
gw::modulation::Parameters::Lora(gw::LoraModulationInfo {
bandwidth: v.bandwidth,
spreading_factor: v.spreading_factor as u32,
code_rate: "4/5".to_string(),
code_rate: gw::CodeRate::Cr45.into(),
code_rate_legacy: "".into(),
polarization_inversion: true,
},
));
}
lrwn::region::DataRateModulation::Fsk(v) => {
tx_info.set_modulation(common::Modulation::Fsk);
tx_info.modulation_info = Some(gw::uplink_tx_info::ModulationInfo::FskModulationInfo(
gw::FskModulationInfo {
})
}
lrwn::region::DataRateModulation::Fsk(v) => {
gw::modulation::Parameters::Fsk(gw::FskModulationInfo {
datarate: v.bitrate,
..Default::default()
},
));
}
lrwn::region::DataRateModulation::LrFhss(v) => {
tx_info.set_modulation(common::Modulation::LrFhss);
tx_info.modulation_info =
Some(gw::uplink_tx_info::ModulationInfo::LrFhssModulationInfo(
gw::LrfhssModulationInfo {
operating_channel_width: v.occupied_channel_width,
code_rate: v.coding_rate,
// GridSteps: this value can't be derived from a DR?
..Default::default()
},
));
}
}
})
}
lrwn::region::DataRateModulation::LrFhss(v) => {
gw::modulation::Parameters::LrFhss(gw::LrFhssModulationInfo {
operating_channel_width: v.occupied_channel_width,
code_rate: v.coding_rate,
// GridSteps: this value can't be derived from a DR?
..Default::default()
})
}
}),
});
Ok(())
}
@ -176,7 +174,7 @@ pub fn get_start_location(rx_info: &[gw::UplinkRxInfo]) -> Option<common::Locati
.cloned()
.filter(|i| i.location.is_some())
.collect();
with_loc.sort_by(|a, b| a.lora_snr.partial_cmp(&b.lora_snr).unwrap());
with_loc.sort_by(|a, b| a.snr.partial_cmp(&b.snr).unwrap());
with_loc
.first()
.map(|i| i.location.as_ref().unwrap().clone())

View File

@ -246,22 +246,20 @@ async fn deduplicate_collect(key: &str) -> Result<gw::UplinkFrameSet> {
}
pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -> Result<()> {
let metadata = &uplink
let rx_info = &uplink
.rx_info
.get(0)
.context("Unable to get first item from rx_info")?
.metadata;
.context("Unable to get first item from rx_info")?;
let region_name = metadata
.get("region_name")
.context("No region_name in metadata")?
.clone();
let region_name = rx_info
.get_metadata_string("region_name")
.ok_or(anyhow!("No region_name in metadata"))?;
let common_name = &metadata
.get("region_common_name")
.context("No region_common_name in metadata")?;
let common_name = rx_info
.get_metadata_string("region_common_name")
.ok_or(anyhow!("No region_common_name in metadata"))?;
let common_name = CommonName::from_str(common_name)?;
let common_name = CommonName::from_str(&common_name)?;
let mut uplink = UplinkFrameSet {
uplink_set_id: deduplication_id,
@ -309,7 +307,7 @@ pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -
async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
for rx_info in &mut ufs.rx_info_set {
let gw_id = EUI64::from_slice(&rx_info.gateway_id)?;
let gw_id = EUI64::from_str(&rx_info.gateway_id)?;
let gw_meta = match gateway::get_meta(&gw_id).await {
Ok(v) => v,
Err(e) => {
@ -341,12 +339,11 @@ fn filter_rx_info_by_tenant_id(tenant_id: &Uuid, uplink: &mut UplinkFrameSet) ->
let mut rx_info_set: Vec<gw::UplinkRxInfo> = Vec::new();
for rx_info in &uplink.rx_info_set {
let gateway_id = EUI64::from_slice(&rx_info.gateway_id)?;
let gateway_id = EUI64::from_str(&rx_info.gateway_id)?;
let region_name = rx_info
.metadata
.get(&"region_name".to_string())
.get_metadata_string("region_name")
.ok_or(anyhow!("No region_name in rx_info metadata"))?;
let force_gws_private = config::get_force_gws_private(region_name)?;
let force_gws_private = config::get_force_gws_private(&region_name)?;
if !(*uplink
.gateway_private_map