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" name = "chirpstack_api"
version = "4.0.0" version = "4.0.0"
dependencies = [ dependencies = [
"hex",
"pbjson", "pbjson",
"pbjson-build", "pbjson-build",
"pbjson-types", "pbjson-types",
"prost", "prost",
"prost-types", "prost-types",
"rand",
"serde", "serde",
"tokio", "tokio",
"tonic", "tonic",

2
api/Dockerfile-rust vendored
View File

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

View File

@ -31,9 +31,9 @@ type UplinkFrameLog struct {
// PHYPayload. // PHYPayload.
PhyPayload []byte `protobuf:"bytes,1,opt,name=phy_payload,json=phyPayload,proto3" json:"phy_payload,omitempty"` PhyPayload []byte `protobuf:"bytes,1,opt,name=phy_payload,json=phyPayload,proto3" json:"phy_payload,omitempty"`
// TX meta-data. // 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. // 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. // Message type.
MType common.MType `protobuf:"varint,4,opt,name=m_type,json=mType,proto3,enum=common.MType" json:"m_type,omitempty"` MType common.MType `protobuf:"varint,4,opt,name=m_type,json=mType,proto3,enum=common.MType" json:"m_type,omitempty"`
// Device address (optional). // Device address (optional).
@ -83,14 +83,14 @@ func (x *UplinkFrameLog) GetPhyPayload() []byte {
return nil return nil
} }
func (x *UplinkFrameLog) GetTxInfo() *gw.UplinkTXInfo { func (x *UplinkFrameLog) GetTxInfo() *gw.UplinkTxInfo {
if x != nil { if x != nil {
return x.TxInfo return x.TxInfo
} }
return nil return nil
} }
func (x *UplinkFrameLog) GetRxInfo() []*gw.UplinkRXInfo { func (x *UplinkFrameLog) GetRxInfo() []*gw.UplinkRxInfo {
if x != nil { if x != nil {
return x.RxInfo return x.RxInfo
} }
@ -135,9 +135,9 @@ type DownlinkFrameLog struct {
// PHYPayload. // PHYPayload.
PhyPayload []byte `protobuf:"bytes,2,opt,name=phy_payload,json=phyPayload,proto3" json:"phy_payload,omitempty"` PhyPayload []byte `protobuf:"bytes,2,opt,name=phy_payload,json=phyPayload,proto3" json:"phy_payload,omitempty"`
// TX meta-data. // 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"`
// Downlink ID (UUID). // Downlink ID.
DownlinkId string `protobuf:"bytes,4,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"` DownlinkId uint32 `protobuf:"varint,4,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"`
// Gateway ID (EUI64). // Gateway ID (EUI64).
GatewayId string `protobuf:"bytes,5,opt,name=gateway_id,json=gatewayId,proto3" json:"gateway_id,omitempty"` GatewayId string `protobuf:"bytes,5,opt,name=gateway_id,json=gatewayId,proto3" json:"gateway_id,omitempty"`
// Message type. // Message type.
@ -194,18 +194,18 @@ func (x *DownlinkFrameLog) GetPhyPayload() []byte {
return nil return nil
} }
func (x *DownlinkFrameLog) GetTxInfo() *gw.DownlinkTXInfo { func (x *DownlinkFrameLog) GetTxInfo() *gw.DownlinkTxInfo {
if x != nil { if x != nil {
return x.TxInfo return x.TxInfo
} }
return nil return nil
} }
func (x *DownlinkFrameLog) GetDownlinkId() string { func (x *DownlinkFrameLog) GetDownlinkId() uint32 {
if x != nil { if x != nil {
return x.DownlinkId return x.DownlinkId
} }
return "" return 0
} }
func (x *DownlinkFrameLog) GetGatewayId() string { 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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{}{ var file_api_frame_log_proto_goTypes = []interface{}{
(*UplinkFrameLog)(nil), // 0: api.UplinkFrameLog (*UplinkFrameLog)(nil), // 0: api.UplinkFrameLog
(*DownlinkFrameLog)(nil), // 1: api.DownlinkFrameLog (*DownlinkFrameLog)(nil), // 1: api.DownlinkFrameLog
(*gw.UplinkTXInfo)(nil), // 2: gw.UplinkTXInfo (*gw.UplinkTxInfo)(nil), // 2: gw.UplinkTxInfo
(*gw.UplinkRXInfo)(nil), // 3: gw.UplinkRXInfo (*gw.UplinkRxInfo)(nil), // 3: gw.UplinkRxInfo
(common.MType)(0), // 4: common.MType (common.MType)(0), // 4: common.MType
(*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp (*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{ var file_api_frame_log_proto_depIdxs = []int32{
2, // 0: api.UplinkFrameLog.tx_info:type_name -> gw.UplinkTXInfo 2, // 0: api.UplinkFrameLog.tx_info:type_name -> gw.UplinkTxInfo
3, // 1: api.UplinkFrameLog.rx_info:type_name -> gw.UplinkRXInfo 3, // 1: api.UplinkFrameLog.rx_info:type_name -> gw.UplinkRxInfo
4, // 2: api.UplinkFrameLog.m_type:type_name -> common.MType 4, // 2: api.UplinkFrameLog.m_type:type_name -> common.MType
5, // 3: api.UplinkFrameLog.time:type_name -> google.protobuf.Timestamp 5, // 3: api.UplinkFrameLog.time:type_name -> google.protobuf.Timestamp
5, // 4: api.DownlinkFrameLog.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 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 output_type
7, // [7:7] is the sub-list for method input_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. // 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"` Object *structpb.Struct `protobuf:"bytes,11,opt,name=object,proto3" json:"object,omitempty"`
// Receiving gateway RX info. // 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. // 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() { func (x *UplinkEvent) Reset() {
@ -417,14 +417,14 @@ func (x *UplinkEvent) GetObject() *structpb.Struct {
return nil return nil
} }
func (x *UplinkEvent) GetRxInfo() []*gw.UplinkRXInfo { func (x *UplinkEvent) GetRxInfo() []*gw.UplinkRxInfo {
if x != nil { if x != nil {
return x.RxInfo return x.RxInfo
} }
return nil return nil
} }
func (x *UplinkEvent) GetTxInfo() *gw.UplinkTXInfo { func (x *UplinkEvent) GetTxInfo() *gw.UplinkTxInfo {
if x != nil { if x != nil {
return x.TxInfo return x.TxInfo
} }
@ -611,8 +611,8 @@ type TxAckEvent struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// Downlink ID (UUID). // Downlink ID.
DownlinkId string `protobuf:"bytes,1,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"` DownlinkId uint32 `protobuf:"varint,1,opt,name=downlink_id,json=downlinkId,proto3" json:"downlink_id,omitempty"`
// Timestamp. // Timestamp.
Time *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"` Time *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"`
// Device info. // Device info.
@ -624,7 +624,7 @@ type TxAckEvent struct {
// Gateway ID. // Gateway ID.
GatewayId string `protobuf:"bytes,6,opt,name=gateway_id,json=gatewayId,proto3" json:"gateway_id,omitempty"` GatewayId string `protobuf:"bytes,6,opt,name=gateway_id,json=gatewayId,proto3" json:"gateway_id,omitempty"`
// TX info. // 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() { func (x *TxAckEvent) Reset() {
@ -659,11 +659,11 @@ func (*TxAckEvent) Descriptor() ([]byte, []int) {
return file_integration_integration_proto_rawDescGZIP(), []int{4} return file_integration_integration_proto_rawDescGZIP(), []int{4}
} }
func (x *TxAckEvent) GetDownlinkId() string { func (x *TxAckEvent) GetDownlinkId() uint32 {
if x != nil { if x != nil {
return x.DownlinkId return x.DownlinkId
} }
return "" return 0
} }
func (x *TxAckEvent) GetTime() *timestamppb.Timestamp { func (x *TxAckEvent) GetTime() *timestamppb.Timestamp {
@ -701,7 +701,7 @@ func (x *TxAckEvent) GetGatewayId() string {
return "" return ""
} }
func (x *TxAckEvent) GetTxInfo() *gw.DownlinkTXInfo { func (x *TxAckEvent) GetTxInfo() *gw.DownlinkTxInfo {
if x != nil { if x != nil {
return x.TxInfo 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 nil, // 12: integration.LogEvent.ContextEntry
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
(*structpb.Struct)(nil), // 14: google.protobuf.Struct (*structpb.Struct)(nil), // 14: google.protobuf.Struct
(*gw.UplinkRXInfo)(nil), // 15: gw.UplinkRXInfo (*gw.UplinkRxInfo)(nil), // 15: gw.UplinkRxInfo
(*gw.UplinkTXInfo)(nil), // 16: gw.UplinkTXInfo (*gw.UplinkTxInfo)(nil), // 16: gw.UplinkTxInfo
(*gw.DownlinkTXInfo)(nil), // 17: gw.DownlinkTXInfo (*gw.DownlinkTxInfo)(nil), // 17: gw.DownlinkTxInfo
(*common.Location)(nil), // 18: common.Location (*common.Location)(nil), // 18: common.Location
} }
var file_integration_integration_proto_depIdxs = []int32{ 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 13, // 1: integration.UplinkEvent.time:type_name -> google.protobuf.Timestamp
2, // 2: integration.UplinkEvent.device_info:type_name -> integration.DeviceInfo 2, // 2: integration.UplinkEvent.device_info:type_name -> integration.DeviceInfo
14, // 3: integration.UplinkEvent.object:type_name -> google.protobuf.Struct 14, // 3: integration.UplinkEvent.object:type_name -> google.protobuf.Struct
15, // 4: integration.UplinkEvent.rx_info:type_name -> gw.UplinkRXInfo 15, // 4: integration.UplinkEvent.rx_info:type_name -> gw.UplinkRxInfo
16, // 5: integration.UplinkEvent.tx_info:type_name -> gw.UplinkTXInfo 16, // 5: integration.UplinkEvent.tx_info:type_name -> gw.UplinkTxInfo
13, // 6: integration.JoinEvent.time:type_name -> google.protobuf.Timestamp 13, // 6: integration.JoinEvent.time:type_name -> google.protobuf.Timestamp
2, // 7: integration.JoinEvent.device_info:type_name -> integration.DeviceInfo 2, // 7: integration.JoinEvent.device_info:type_name -> integration.DeviceInfo
13, // 8: integration.AckEvent.time:type_name -> google.protobuf.Timestamp 13, // 8: integration.AckEvent.time:type_name -> google.protobuf.Timestamp
2, // 9: integration.AckEvent.device_info:type_name -> integration.DeviceInfo 2, // 9: integration.AckEvent.device_info:type_name -> integration.DeviceInfo
13, // 10: integration.TxAckEvent.time:type_name -> google.protobuf.Timestamp 13, // 10: integration.TxAckEvent.time:type_name -> google.protobuf.Timestamp
2, // 11: integration.TxAckEvent.device_info:type_name -> integration.DeviceInfo 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 13, // 13: integration.LogEvent.time:type_name -> google.protobuf.Timestamp
2, // 14: integration.LogEvent.device_info:type_name -> integration.DeviceInfo 2, // 14: integration.LogEvent.device_info:type_name -> integration.DeviceInfo
0, // 15: integration.LogEvent.level:type_name -> integration.LogLevel 0, // 15: integration.LogEvent.level:type_name -> integration.LogLevel

View File

@ -30,9 +30,9 @@ type UplinkMeta struct {
// Device EUI (EUI64). // Device EUI (EUI64).
DevEui string `protobuf:"bytes,1,opt,name=dev_eui,json=devEui,proto3" json:"dev_eui,omitempty"` DevEui string `protobuf:"bytes,1,opt,name=dev_eui,json=devEui,proto3" json:"dev_eui,omitempty"`
// TX meta-data. // 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. // 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. // PHYPayload byte count.
PhyPayloadByteCount uint32 `protobuf:"varint,4,opt,name=phy_payload_byte_count,json=phyPayloadByteCount,proto3" json:"phy_payload_byte_count,omitempty"` PhyPayloadByteCount uint32 `protobuf:"varint,4,opt,name=phy_payload_byte_count,json=phyPayloadByteCount,proto3" json:"phy_payload_byte_count,omitempty"`
// MAC-Command byte count. // MAC-Command byte count.
@ -82,14 +82,14 @@ func (x *UplinkMeta) GetDevEui() string {
return "" return ""
} }
func (x *UplinkMeta) GetTxInfo() *gw.UplinkTXInfo { func (x *UplinkMeta) GetTxInfo() *gw.UplinkTxInfo {
if x != nil { if x != nil {
return x.TxInfo return x.TxInfo
} }
return nil return nil
} }
func (x *UplinkMeta) GetRxInfo() []*gw.UplinkRXInfo { func (x *UplinkMeta) GetRxInfo() []*gw.UplinkRxInfo {
if x != nil { if x != nil {
return x.RxInfo return x.RxInfo
} }
@ -134,7 +134,7 @@ type DownlinkMeta struct {
// Multicast Group ID (UUID). // Multicast Group ID (UUID).
MulticastGroupId string `protobuf:"bytes,2,opt,name=multicast_group_id,json=multicastGroupId,proto3" json:"multicast_group_id,omitempty"` MulticastGroupId string `protobuf:"bytes,2,opt,name=multicast_group_id,json=multicastGroupId,proto3" json:"multicast_group_id,omitempty"`
// TX meta-data. // 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. // PHYPayload byte count.
PhyPayloadByteCount uint32 `protobuf:"varint,4,opt,name=phy_payload_byte_count,json=phyPayloadByteCount,proto3" json:"phy_payload_byte_count,omitempty"` PhyPayloadByteCount uint32 `protobuf:"varint,4,opt,name=phy_payload_byte_count,json=phyPayloadByteCount,proto3" json:"phy_payload_byte_count,omitempty"`
// MAC-Command byte count. // MAC-Command byte count.
@ -193,7 +193,7 @@ func (x *DownlinkMeta) GetMulticastGroupId() string {
return "" return ""
} }
func (x *DownlinkMeta) GetTxInfo() *gw.DownlinkTXInfo { func (x *DownlinkMeta) GetTxInfo() *gw.DownlinkTxInfo {
if x != nil { if x != nil {
return x.TxInfo 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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{}{ var file_meta_meta_proto_goTypes = []interface{}{
(*UplinkMeta)(nil), // 0: meta.UplinkMeta (*UplinkMeta)(nil), // 0: meta.UplinkMeta
(*DownlinkMeta)(nil), // 1: meta.DownlinkMeta (*DownlinkMeta)(nil), // 1: meta.DownlinkMeta
(*gw.UplinkTXInfo)(nil), // 2: gw.UplinkTXInfo (*gw.UplinkTxInfo)(nil), // 2: gw.UplinkTxInfo
(*gw.UplinkRXInfo)(nil), // 3: gw.UplinkRXInfo (*gw.UplinkRxInfo)(nil), // 3: gw.UplinkRxInfo
(common.MType)(0), // 4: common.MType (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{ var file_meta_meta_proto_depIdxs = []int32{
2, // 0: meta.UplinkMeta.tx_info:type_name -> gw.UplinkTXInfo 2, // 0: meta.UplinkMeta.tx_info:type_name -> gw.UplinkTxInfo
3, // 1: meta.UplinkMeta.rx_info:type_name -> gw.UplinkRXInfo 3, // 1: meta.UplinkMeta.rx_info:type_name -> gw.UplinkRxInfo
4, // 2: meta.UplinkMeta.message_type:type_name -> common.MType 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 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 output_type
5, // [5:5] is the sub-list for method input_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; getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): UplinkFrameLog; setPhyPayload(value: Uint8Array | string): UplinkFrameLog;
getTxInfo(): gw_gw_pb.UplinkTXInfo | undefined; getTxInfo(): gw_gw_pb.UplinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTXInfo): UplinkFrameLog; setTxInfo(value?: gw_gw_pb.UplinkTxInfo): UplinkFrameLog;
hasTxInfo(): boolean; hasTxInfo(): boolean;
clearTxInfo(): UplinkFrameLog; clearTxInfo(): UplinkFrameLog;
getRxInfoList(): Array<gw_gw_pb.UplinkRXInfo>; getRxInfoList(): Array<gw_gw_pb.UplinkRxInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRXInfo>): UplinkFrameLog; setRxInfoList(value: Array<gw_gw_pb.UplinkRxInfo>): UplinkFrameLog;
clearRxInfoList(): 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; getMType(): common_common_pb.MType;
setMType(value: common_common_pb.MType): UplinkFrameLog; setMType(value: common_common_pb.MType): UplinkFrameLog;
@ -46,8 +46,8 @@ export class UplinkFrameLog extends jspb.Message {
export namespace UplinkFrameLog { export namespace UplinkFrameLog {
export type AsObject = { export type AsObject = {
phyPayload: Uint8Array | string, phyPayload: Uint8Array | string,
txInfo?: gw_gw_pb.UplinkTXInfo.AsObject, txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRXInfo.AsObject>, rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
mType: common_common_pb.MType, mType: common_common_pb.MType,
devAddr: string, devAddr: string,
devEui: string, devEui: string,
@ -66,13 +66,13 @@ export class DownlinkFrameLog extends jspb.Message {
getPhyPayload_asB64(): string; getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): DownlinkFrameLog; setPhyPayload(value: Uint8Array | string): DownlinkFrameLog;
getTxInfo(): gw_gw_pb.DownlinkTXInfo | undefined; getTxInfo(): gw_gw_pb.DownlinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTXInfo): DownlinkFrameLog; setTxInfo(value?: gw_gw_pb.DownlinkTxInfo): DownlinkFrameLog;
hasTxInfo(): boolean; hasTxInfo(): boolean;
clearTxInfo(): DownlinkFrameLog; clearTxInfo(): DownlinkFrameLog;
getDownlinkId(): string; getDownlinkId(): number;
setDownlinkId(value: string): DownlinkFrameLog; setDownlinkId(value: number): DownlinkFrameLog;
getGatewayId(): string; getGatewayId(): string;
setGatewayId(value: string): DownlinkFrameLog; setGatewayId(value: string): DownlinkFrameLog;
@ -98,8 +98,8 @@ export namespace DownlinkFrameLog {
export type AsObject = { export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject, time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
phyPayload: Uint8Array | string, phyPayload: Uint8Array | string,
txInfo?: gw_gw_pb.DownlinkTXInfo.AsObject, txInfo?: gw_gw_pb.DownlinkTxInfo.AsObject,
downlinkId: string, downlinkId: number,
gatewayId: string, gatewayId: string,
mType: common_common_pb.MType, mType: common_common_pb.MType,
devAddr: string, devAddr: string,

View File

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

View File

@ -68,9 +68,9 @@ proto.api.UplinkFrameLog.prototype.toObject = function(opt_includeInstance) {
proto.api.UplinkFrameLog.toObject = function(includeInstance, msg) { proto.api.UplinkFrameLog.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
phyPayload: msg.getPhyPayload_asB64(), 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(), rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance), gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
mType: msg.getMType(), mType: msg.getMType(),
devAddr: msg.getDevAddr(), devAddr: msg.getDevAddr(),
devEui: msg.getDevEui(), devEui: msg.getDevEui(),
@ -116,13 +116,13 @@ proto.api.UplinkFrameLog.deserializeBinaryFromReader = function(msg, reader) {
msg.setPhyPayload(value); msg.setPhyPayload(value);
break; break;
case 2: case 2:
var value = new gw_gw_pb.UplinkTXInfo; var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value); msg.setTxInfo(value);
break; break;
case 3: case 3:
var value = new gw_gw_pb.UplinkRXInfo; var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.getRxInfoList().push(value); msg.getRxInfoList().push(value);
msg.setRxInfoList(msg.getRxInfoList()); msg.setRxInfoList(msg.getRxInfoList());
break; break;
@ -193,7 +193,7 @@ proto.api.UplinkFrameLog.prototype.serializeBinaryToWriter = function (writer) {
writer.writeMessage( writer.writeMessage(
2, 2,
f, f,
gw_gw_pb.UplinkTXInfo.serializeBinaryToWriter gw_gw_pb.UplinkTxInfo.serializeBinaryToWriter
); );
} }
f = this.getRxInfoList(); f = this.getRxInfoList();
@ -201,7 +201,7 @@ proto.api.UplinkFrameLog.prototype.serializeBinaryToWriter = function (writer) {
writer.writeRepeatedMessage( writer.writeRepeatedMessage(
3, 3,
f, f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
); );
} }
f = this.getMType(); f = this.getMType();
@ -285,16 +285,16 @@ proto.api.UplinkFrameLog.prototype.setPhyPayload = function(value) {
/** /**
* optional gw.UplinkTXInfo tx_info = 2; * optional gw.UplinkTxInfo tx_info = 2;
* @return {proto.gw.UplinkTXInfo} * @return {proto.gw.UplinkTxInfo}
*/ */
proto.api.UplinkFrameLog.prototype.getTxInfo = function() { proto.api.UplinkFrameLog.prototype.getTxInfo = function() {
return /** @type{proto.gw.UplinkTXInfo} */ ( return /** @type{proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 2)); 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) { proto.api.UplinkFrameLog.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 2, 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 * 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. * 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() { proto.api.UplinkFrameLog.prototype.getRxInfoList = function() {
return /** @type{!Array.<!proto.gw.UplinkRXInfo>} */ ( return /** @type{!Array.<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 3)); 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) { proto.api.UplinkFrameLog.prototype.setRxInfoList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 3, value); jspb.Message.setRepeatedWrapperField(this, 3, value);
}; };
@ -460,7 +460,7 @@ proto.api.DownlinkFrameLog.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
phyPayload: msg.getPhyPayload_asB64(), 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(), downlinkId: msg.getDownlinkId(),
gatewayId: msg.getGatewayId(), gatewayId: msg.getGatewayId(),
mType: msg.getMType(), mType: msg.getMType(),
@ -512,12 +512,12 @@ proto.api.DownlinkFrameLog.deserializeBinaryFromReader = function(msg, reader) {
msg.setPhyPayload(value); msg.setPhyPayload(value);
break; break;
case 3: case 3:
var value = new gw_gw_pb.DownlinkTXInfo; var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value); msg.setTxInfo(value);
break; break;
case 4: case 4:
var value = /** @type {string} */ (reader.readString()); var value = /** @type {number} */ (reader.readUint32());
msg.setDownlinkId(value); msg.setDownlinkId(value);
break; break;
case 5: case 5:
@ -594,12 +594,12 @@ proto.api.DownlinkFrameLog.prototype.serializeBinaryToWriter = function (writer)
writer.writeMessage( writer.writeMessage(
3, 3,
f, f,
gw_gw_pb.DownlinkTXInfo.serializeBinaryToWriter gw_gw_pb.DownlinkTxInfo.serializeBinaryToWriter
); );
} }
f = this.getDownlinkId(); f = this.getDownlinkId();
if (f.length > 0) { if (f !== 0) {
writer.writeString( writer.writeUint32(
4, 4,
f f
); );
@ -714,16 +714,16 @@ proto.api.DownlinkFrameLog.prototype.setPhyPayload = function(value) {
/** /**
* optional gw.DownlinkTXInfo tx_info = 3; * optional gw.DownlinkTxInfo tx_info = 3;
* @return {proto.gw.DownlinkTXInfo} * @return {proto.gw.DownlinkTxInfo}
*/ */
proto.api.DownlinkFrameLog.prototype.getTxInfo = function() { proto.api.DownlinkFrameLog.prototype.getTxInfo = function() {
return /** @type{proto.gw.DownlinkTXInfo} */ ( return /** @type{proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 3)); 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) { proto.api.DownlinkFrameLog.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 3, value); jspb.Message.setWrapperField(this, 3, value);
}; };
@ -744,15 +744,15 @@ proto.api.DownlinkFrameLog.prototype.hasTxInfo = function() {
/** /**
* optional string downlink_id = 4; * optional uint32 downlink_id = 4;
* @return {string} * @return {number}
*/ */
proto.api.DownlinkFrameLog.prototype.getDownlinkId = function() { 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) { proto.api.DownlinkFrameLog.prototype.setDownlinkId = function(value) {
jspb.Message.setField(this, 4, 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 common_common_pb from "../common/common_pb";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_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_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 { export class Modulation extends jspb.Message {
hasLora(): boolean; hasLora(): boolean;
clearLora(): void; clearLora(): void;
getLora(): LoRaModulationInfo | undefined; getLora(): LoraModulationInfo | undefined;
setLora(value?: LoRaModulationInfo): void; setLora(value?: LoraModulationInfo): void;
hasFsk(): boolean; hasFsk(): boolean;
clearFsk(): void; clearFsk(): void;
getFsk(): FSKModulationInfo | undefined; getFsk(): FskModulationInfo | undefined;
setFsk(value?: FSKModulationInfo): void; setFsk(value?: FskModulationInfo): void;
hasLrFhss(): boolean; hasLrFhss(): boolean;
clearLrFhss(): void; clearLrFhss(): void;
getLrFhss(): LRFHSSModulationInfo | undefined; getLrFhss(): LrFhssModulationInfo | undefined;
setLrFhss(value?: LRFHSSModulationInfo): void; setLrFhss(value?: LrFhssModulationInfo): void;
getParametersCase(): Modulation.ParametersCase; getParametersCase(): Modulation.ParametersCase;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
@ -35,9 +36,9 @@ export class Modulation extends jspb.Message {
export namespace Modulation { export namespace Modulation {
export type AsObject = { export type AsObject = {
lora?: LoRaModulationInfo.AsObject, lora?: LoraModulationInfo.AsObject,
fsk?: FSKModulationInfo.AsObject, fsk?: FskModulationInfo.AsObject,
lrFhss?: LRFHSSModulationInfo.AsObject, lrFhss?: LrFhssModulationInfo.AsObject,
} }
export enum ParametersCase { export enum ParametersCase {
@ -48,7 +49,7 @@ export namespace Modulation {
} }
} }
export class UplinkTXInfo extends jspb.Message { export class UplinkTxInfoLegacy extends jspb.Message {
getFrequency(): number; getFrequency(): number;
setFrequency(value: number): void; setFrequency(value: number): void;
@ -57,37 +58,37 @@ export class UplinkTXInfo extends jspb.Message {
hasLoraModulationInfo(): boolean; hasLoraModulationInfo(): boolean;
clearLoraModulationInfo(): void; clearLoraModulationInfo(): void;
getLoraModulationInfo(): LoRaModulationInfo | undefined; getLoraModulationInfo(): LoraModulationInfo | undefined;
setLoraModulationInfo(value?: LoRaModulationInfo): void; setLoraModulationInfo(value?: LoraModulationInfo): void;
hasFskModulationInfo(): boolean; hasFskModulationInfo(): boolean;
clearFskModulationInfo(): void; clearFskModulationInfo(): void;
getFskModulationInfo(): FSKModulationInfo | undefined; getFskModulationInfo(): FskModulationInfo | undefined;
setFskModulationInfo(value?: FSKModulationInfo): void; setFskModulationInfo(value?: FskModulationInfo): void;
hasLrFhssModulationInfo(): boolean; hasLrFhssModulationInfo(): boolean;
clearLrFhssModulationInfo(): void; clearLrFhssModulationInfo(): void;
getLrFhssModulationInfo(): LRFHSSModulationInfo | undefined; getLrFhssModulationInfo(): LrFhssModulationInfo | undefined;
setLrFhssModulationInfo(value?: LRFHSSModulationInfo): void; setLrFhssModulationInfo(value?: LrFhssModulationInfo): void;
getModulationInfoCase(): UplinkTXInfo.ModulationInfoCase; getModulationInfoCase(): UplinkTxInfoLegacy.ModulationInfoCase;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkTXInfo.AsObject; toObject(includeInstance?: boolean): UplinkTxInfoLegacy.AsObject;
static toObject(includeInstance: boolean, msg: UplinkTXInfo): UplinkTXInfo.AsObject; static toObject(includeInstance: boolean, msg: UplinkTxInfoLegacy): UplinkTxInfoLegacy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UplinkTXInfo, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: UplinkTxInfoLegacy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkTXInfo; static deserializeBinary(bytes: Uint8Array): UplinkTxInfoLegacy;
static deserializeBinaryFromReader(message: UplinkTXInfo, reader: jspb.BinaryReader): UplinkTXInfo; static deserializeBinaryFromReader(message: UplinkTxInfoLegacy, reader: jspb.BinaryReader): UplinkTxInfoLegacy;
} }
export namespace UplinkTXInfo { export namespace UplinkTxInfoLegacy {
export type AsObject = { export type AsObject = {
frequency: number, frequency: number,
modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap], modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationInfo?: LoRaModulationInfo.AsObject, loraModulationInfo?: LoraModulationInfo.AsObject,
fskModulationInfo?: FSKModulationInfo.AsObject, fskModulationInfo?: FskModulationInfo.AsObject,
lrFhssModulationInfo?: LRFHSSModulationInfo.AsObject, lrFhssModulationInfo?: LrFhssModulationInfo.AsObject,
} }
export enum ModulationInfoCase { 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; getBandwidth(): number;
setBandwidth(value: number): void; setBandwidth(value: number): void;
getSpreadingFactor(): number; getSpreadingFactor(): number;
setSpreadingFactor(value: number): void; setSpreadingFactor(value: number): void;
getCodeRate(): string; getCodeRateLegacy(): string;
setCodeRate(value: string): void; setCodeRateLegacy(value: string): void;
getCodeRate(): CodeRateMap[keyof CodeRateMap];
setCodeRate(value: CodeRateMap[keyof CodeRateMap]): void;
getPolarizationInversion(): boolean; getPolarizationInversion(): boolean;
setPolarizationInversion(value: boolean): void; setPolarizationInversion(value: boolean): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoRaModulationInfo.AsObject; toObject(includeInstance?: boolean): LoraModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: LoRaModulationInfo): LoRaModulationInfo.AsObject; static toObject(includeInstance: boolean, msg: LoraModulationInfo): LoraModulationInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LoRaModulationInfo, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: LoraModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LoRaModulationInfo; static deserializeBinary(bytes: Uint8Array): LoraModulationInfo;
static deserializeBinaryFromReader(message: LoRaModulationInfo, reader: jspb.BinaryReader): LoRaModulationInfo; static deserializeBinaryFromReader(message: LoraModulationInfo, reader: jspb.BinaryReader): LoraModulationInfo;
} }
export namespace LoRaModulationInfo { export namespace LoraModulationInfo {
export type AsObject = { export type AsObject = {
bandwidth: number, bandwidth: number,
spreadingFactor: number, spreadingFactor: number,
codeRate: string, codeRateLegacy: string,
codeRate: CodeRateMap[keyof CodeRateMap],
polarizationInversion: boolean, polarizationInversion: boolean,
} }
} }
export class FSKModulationInfo extends jspb.Message { export class FskModulationInfo extends jspb.Message {
getFrequencyDeviation(): number; getFrequencyDeviation(): number;
setFrequencyDeviation(value: number): void; setFrequencyDeviation(value: number): void;
@ -138,23 +169,23 @@ export class FSKModulationInfo extends jspb.Message {
setDatarate(value: number): void; setDatarate(value: number): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FSKModulationInfo.AsObject; toObject(includeInstance?: boolean): FskModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: FSKModulationInfo): FSKModulationInfo.AsObject; static toObject(includeInstance: boolean, msg: FskModulationInfo): FskModulationInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: FSKModulationInfo, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: FskModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FSKModulationInfo; static deserializeBinary(bytes: Uint8Array): FskModulationInfo;
static deserializeBinaryFromReader(message: FSKModulationInfo, reader: jspb.BinaryReader): FSKModulationInfo; static deserializeBinaryFromReader(message: FskModulationInfo, reader: jspb.BinaryReader): FskModulationInfo;
} }
export namespace FSKModulationInfo { export namespace FskModulationInfo {
export type AsObject = { export type AsObject = {
frequencyDeviation: number, frequencyDeviation: number,
datarate: number, datarate: number,
} }
} }
export class LRFHSSModulationInfo extends jspb.Message { export class LrFhssModulationInfo extends jspb.Message {
getOperatingChannelWidth(): number; getOperatingChannelWidth(): number;
setOperatingChannelWidth(value: number): void; setOperatingChannelWidth(value: number): void;
@ -165,16 +196,16 @@ export class LRFHSSModulationInfo extends jspb.Message {
setGridSteps(value: number): void; setGridSteps(value: number): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LRFHSSModulationInfo.AsObject; toObject(includeInstance?: boolean): LrFhssModulationInfo.AsObject;
static toObject(includeInstance: boolean, msg: LRFHSSModulationInfo): LRFHSSModulationInfo.AsObject; static toObject(includeInstance: boolean, msg: LrFhssModulationInfo): LrFhssModulationInfo.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: LRFHSSModulationInfo, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: LrFhssModulationInfo, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): LRFHSSModulationInfo; static deserializeBinary(bytes: Uint8Array): LrFhssModulationInfo;
static deserializeBinaryFromReader(message: LRFHSSModulationInfo, reader: jspb.BinaryReader): LRFHSSModulationInfo; static deserializeBinaryFromReader(message: LrFhssModulationInfo, reader: jspb.BinaryReader): LrFhssModulationInfo;
} }
export namespace LRFHSSModulationInfo { export namespace LrFhssModulationInfo {
export type AsObject = { export type AsObject = {
operatingChannelWidth: number, operatingChannelWidth: number,
codeRate: string, 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(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayId_asB64(): string;
@ -417,18 +448,18 @@ export class UplinkRXInfo extends jspb.Message {
getMetadataMap(): jspb.Map<string, string>; getMetadataMap(): jspb.Map<string, string>;
clearMetadataMap(): void; clearMetadataMap(): void;
getFineTimestampCase(): UplinkRXInfo.FineTimestampCase; getFineTimestampCase(): UplinkRxInfoLegacy.FineTimestampCase;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkRXInfo.AsObject; toObject(includeInstance?: boolean): UplinkRxInfoLegacy.AsObject;
static toObject(includeInstance: boolean, msg: UplinkRXInfo): UplinkRXInfo.AsObject; static toObject(includeInstance: boolean, msg: UplinkRxInfoLegacy): UplinkRxInfoLegacy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UplinkRXInfo, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: UplinkRxInfoLegacy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UplinkRXInfo; static deserializeBinary(bytes: Uint8Array): UplinkRxInfoLegacy;
static deserializeBinaryFromReader(message: UplinkRXInfo, reader: jspb.BinaryReader): UplinkRXInfo; static deserializeBinaryFromReader(message: UplinkRxInfoLegacy, reader: jspb.BinaryReader): UplinkRxInfoLegacy;
} }
export namespace UplinkRXInfo { export namespace UplinkRxInfoLegacy {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayId: Uint8Array | string,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject, 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(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayId_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayId_asB64(): string;
@ -473,13 +580,13 @@ export class DownlinkTXInfo extends jspb.Message {
hasLoraModulationInfo(): boolean; hasLoraModulationInfo(): boolean;
clearLoraModulationInfo(): void; clearLoraModulationInfo(): void;
getLoraModulationInfo(): LoRaModulationInfo | undefined; getLoraModulationInfo(): LoraModulationInfo | undefined;
setLoraModulationInfo(value?: LoRaModulationInfo): void; setLoraModulationInfo(value?: LoraModulationInfo): void;
hasFskModulationInfo(): boolean; hasFskModulationInfo(): boolean;
clearFskModulationInfo(): void; clearFskModulationInfo(): void;
getFskModulationInfo(): FSKModulationInfo | undefined; getFskModulationInfo(): FskModulationInfo | undefined;
setFskModulationInfo(value?: FSKModulationInfo): void; setFskModulationInfo(value?: FskModulationInfo): void;
getBoard(): number; getBoard(): number;
setBoard(value: number): void; setBoard(value: number): void;
@ -510,26 +617,26 @@ export class DownlinkTXInfo extends jspb.Message {
getContext_asB64(): string; getContext_asB64(): string;
setContext(value: Uint8Array | string): void; setContext(value: Uint8Array | string): void;
getModulationInfoCase(): DownlinkTXInfo.ModulationInfoCase; getModulationInfoCase(): DownlinkTxInfoLegacy.ModulationInfoCase;
getTimingInfoCase(): DownlinkTXInfo.TimingInfoCase; getTimingInfoCase(): DownlinkTxInfoLegacy.TimingInfoCase;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTXInfo.AsObject; toObject(includeInstance?: boolean): DownlinkTxInfoLegacy.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTXInfo): DownlinkTXInfo.AsObject; static toObject(includeInstance: boolean, msg: DownlinkTxInfoLegacy): DownlinkTxInfoLegacy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTXInfo, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: DownlinkTxInfoLegacy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTXInfo; static deserializeBinary(bytes: Uint8Array): DownlinkTxInfoLegacy;
static deserializeBinaryFromReader(message: DownlinkTXInfo, reader: jspb.BinaryReader): DownlinkTXInfo; static deserializeBinaryFromReader(message: DownlinkTxInfoLegacy, reader: jspb.BinaryReader): DownlinkTxInfoLegacy;
} }
export namespace DownlinkTXInfo { export namespace DownlinkTxInfoLegacy {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayId: Uint8Array | string,
frequency: number, frequency: number,
power: number, power: number,
modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap], modulation: common_common_pb.ModulationMap[keyof common_common_pb.ModulationMap],
loraModulationInfo?: LoRaModulationInfo.AsObject, loraModulationInfo?: LoraModulationInfo.AsObject,
fskModulationInfo?: FSKModulationInfo.AsObject, fskModulationInfo?: FskModulationInfo.AsObject,
board: number, board: number,
antenna: number, antenna: number,
timing: DownlinkTimingMap[keyof DownlinkTimingMap], 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 { export class ImmediatelyTimingInfo extends jspb.Message {
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ImmediatelyTimingInfo.AsObject; toObject(includeInstance?: boolean): ImmediatelyTimingInfo.AsObject;
@ -619,15 +818,25 @@ export class UplinkFrame extends jspb.Message {
getPhyPayload_asB64(): string; getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): void; 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; hasTxInfo(): boolean;
clearTxInfo(): void; clearTxInfo(): void;
getTxInfo(): UplinkTXInfo | undefined; getTxInfo(): UplinkTxInfo | undefined;
setTxInfo(value?: UplinkTXInfo): void; setTxInfo(value?: UplinkTxInfo): void;
hasRxInfo(): boolean; hasRxInfo(): boolean;
clearRxInfo(): void; clearRxInfo(): void;
getRxInfo(): UplinkRXInfo | undefined; getRxInfo(): UplinkRxInfo | undefined;
setRxInfo(value?: UplinkRXInfo): void; setRxInfo(value?: UplinkRxInfo): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkFrame.AsObject; toObject(includeInstance?: boolean): UplinkFrame.AsObject;
@ -642,8 +851,10 @@ export class UplinkFrame extends jspb.Message {
export namespace UplinkFrame { export namespace UplinkFrame {
export type AsObject = { export type AsObject = {
phyPayload: Uint8Array | string, phyPayload: Uint8Array | string,
txInfo?: UplinkTXInfo.AsObject, txInfoLegacy?: UplinkTxInfoLegacy.AsObject,
rxInfo?: UplinkRXInfo.AsObject, rxInfoLegacy?: UplinkRxInfoLegacy.AsObject,
txInfo?: UplinkTxInfo.AsObject,
rxInfo?: UplinkRxInfo.AsObject,
} }
} }
@ -655,13 +866,13 @@ export class UplinkFrameSet extends jspb.Message {
hasTxInfo(): boolean; hasTxInfo(): boolean;
clearTxInfo(): void; clearTxInfo(): void;
getTxInfo(): UplinkTXInfo | undefined; getTxInfo(): UplinkTxInfo | undefined;
setTxInfo(value?: UplinkTXInfo): void; setTxInfo(value?: UplinkTxInfo): void;
clearRxInfoList(): void; clearRxInfoList(): void;
getRxInfoList(): Array<UplinkRXInfo>; getRxInfoList(): Array<UplinkRxInfo>;
setRxInfoList(value: Array<UplinkRXInfo>): void; setRxInfoList(value: Array<UplinkRxInfo>): void;
addRxInfo(value?: UplinkRXInfo, index?: number): UplinkRXInfo; addRxInfo(value?: UplinkRxInfo, index?: number): UplinkRxInfo;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkFrameSet.AsObject; toObject(includeInstance?: boolean): UplinkFrameSet.AsObject;
@ -676,39 +887,32 @@ export class UplinkFrameSet extends jspb.Message {
export namespace UplinkFrameSet { export namespace UplinkFrameSet {
export type AsObject = { export type AsObject = {
phyPayload: Uint8Array | string, phyPayload: Uint8Array | string,
txInfo?: UplinkTXInfo.AsObject, txInfo?: UplinkTxInfo.AsObject,
rxInfoList: Array<UplinkRXInfo.AsObject>, rxInfoList: Array<UplinkRxInfo.AsObject>,
} }
} }
export class DownlinkFrame extends jspb.Message { export class DownlinkFrame extends jspb.Message {
getPhyPayload(): Uint8Array | string; getDownlinkId(): number;
getPhyPayload_asU8(): Uint8Array; setDownlinkId(value: number): void;
getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): void;
hasTxInfo(): boolean; getDownlinkIdLegacy(): Uint8Array | string;
clearTxInfo(): void; getDownlinkIdLegacy_asU8(): Uint8Array;
getTxInfo(): DownlinkTXInfo | undefined; getDownlinkIdLegacy_asB64(): string;
setTxInfo(value?: DownlinkTXInfo): void; setDownlinkIdLegacy(value: Uint8Array | string): void;
getToken(): number;
setToken(value: number): void;
getDownlinkId(): Uint8Array | string;
getDownlinkId_asU8(): Uint8Array;
getDownlinkId_asB64(): string;
setDownlinkId(value: Uint8Array | string): void;
clearItemsList(): void; clearItemsList(): void;
getItemsList(): Array<DownlinkFrameItem>; getItemsList(): Array<DownlinkFrameItem>;
setItemsList(value: Array<DownlinkFrameItem>): void; setItemsList(value: Array<DownlinkFrameItem>): void;
addItems(value?: DownlinkFrameItem, index?: number): DownlinkFrameItem; addItems(value?: DownlinkFrameItem, index?: number): DownlinkFrameItem;
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getGatewayId(): string;
setGatewayId(value: string): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkFrame.AsObject; toObject(includeInstance?: boolean): DownlinkFrame.AsObject;
@ -722,12 +926,11 @@ export class DownlinkFrame extends jspb.Message {
export namespace DownlinkFrame { export namespace DownlinkFrame {
export type AsObject = { export type AsObject = {
phyPayload: Uint8Array | string, downlinkId: number,
txInfo?: DownlinkTXInfo.AsObject, downlinkIdLegacy: Uint8Array | string,
token: number,
downlinkId: Uint8Array | string,
itemsList: Array<DownlinkFrameItem.AsObject>, 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; getPhyPayload_asB64(): string;
setPhyPayload(value: Uint8Array | string): void; setPhyPayload(value: Uint8Array | string): void;
hasTxInfoLegacy(): boolean;
clearTxInfoLegacy(): void;
getTxInfoLegacy(): DownlinkTxInfoLegacy | undefined;
setTxInfoLegacy(value?: DownlinkTxInfoLegacy): void;
hasTxInfo(): boolean; hasTxInfo(): boolean;
clearTxInfo(): void; clearTxInfo(): void;
getTxInfo(): DownlinkTXInfo | undefined; getTxInfo(): DownlinkTxInfo | undefined;
setTxInfo(value?: DownlinkTXInfo): void; setTxInfo(value?: DownlinkTxInfo): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkFrameItem.AsObject; toObject(includeInstance?: boolean): DownlinkFrameItem.AsObject;
@ -755,67 +963,68 @@ export class DownlinkFrameItem extends jspb.Message {
export namespace DownlinkFrameItem { export namespace DownlinkFrameItem {
export type AsObject = { export type AsObject = {
phyPayload: Uint8Array | string, phyPayload: Uint8Array | string,
txInfo?: DownlinkTXInfo.AsObject, txInfoLegacy?: DownlinkTxInfoLegacy.AsObject,
txInfo?: DownlinkTxInfo.AsObject,
} }
} }
export class DownlinkTXAck extends jspb.Message { export class DownlinkTxAck extends jspb.Message {
getGatewayId(): Uint8Array | string; getGatewayIdLegacy(): Uint8Array | string;
getGatewayId_asU8(): Uint8Array; getGatewayIdLegacy_asU8(): Uint8Array;
getGatewayId_asB64(): string; getGatewayIdLegacy_asB64(): string;
setGatewayId(value: Uint8Array | string): void; setGatewayIdLegacy(value: Uint8Array | string): void;
getToken(): number; getGatewayId(): string;
setToken(value: number): void; setGatewayId(value: string): void;
getError(): string; getDownlinkId(): number;
setError(value: string): void; setDownlinkId(value: number): void;
getDownlinkId(): Uint8Array | string; getDownlinkIdLegacy(): Uint8Array | string;
getDownlinkId_asU8(): Uint8Array; getDownlinkIdLegacy_asU8(): Uint8Array;
getDownlinkId_asB64(): string; getDownlinkIdLegacy_asB64(): string;
setDownlinkId(value: Uint8Array | string): void; setDownlinkIdLegacy(value: Uint8Array | string): void;
clearItemsList(): void; clearItemsList(): void;
getItemsList(): Array<DownlinkTXAckItem>; getItemsList(): Array<DownlinkTxAckItem>;
setItemsList(value: Array<DownlinkTXAckItem>): void; setItemsList(value: Array<DownlinkTxAckItem>): void;
addItems(value?: DownlinkTXAckItem, index?: number): DownlinkTXAckItem; addItems(value?: DownlinkTxAckItem, index?: number): DownlinkTxAckItem;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTXAck.AsObject; toObject(includeInstance?: boolean): DownlinkTxAck.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTXAck): DownlinkTXAck.AsObject; static toObject(includeInstance: boolean, msg: DownlinkTxAck): DownlinkTxAck.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTXAck, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: DownlinkTxAck, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTXAck; static deserializeBinary(bytes: Uint8Array): DownlinkTxAck;
static deserializeBinaryFromReader(message: DownlinkTXAck, reader: jspb.BinaryReader): DownlinkTXAck; static deserializeBinaryFromReader(message: DownlinkTxAck, reader: jspb.BinaryReader): DownlinkTxAck;
} }
export namespace DownlinkTXAck { export namespace DownlinkTxAck {
export type AsObject = { export type AsObject = {
gatewayId: Uint8Array | string, gatewayIdLegacy: Uint8Array | string,
token: number, gatewayId: string,
error: string, downlinkId: number,
downlinkId: Uint8Array | string, downlinkIdLegacy: Uint8Array | string,
itemsList: Array<DownlinkTXAckItem.AsObject>, itemsList: Array<DownlinkTxAckItem.AsObject>,
} }
} }
export class DownlinkTXAckItem extends jspb.Message { export class DownlinkTxAckItem extends jspb.Message {
getStatus(): TxAckStatusMap[keyof TxAckStatusMap]; getStatus(): TxAckStatusMap[keyof TxAckStatusMap];
setStatus(value: TxAckStatusMap[keyof TxAckStatusMap]): void; setStatus(value: TxAckStatusMap[keyof TxAckStatusMap]): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DownlinkTXAckItem.AsObject; toObject(includeInstance?: boolean): DownlinkTxAckItem.AsObject;
static toObject(includeInstance: boolean, msg: DownlinkTXAckItem): DownlinkTXAckItem.AsObject; static toObject(includeInstance: boolean, msg: DownlinkTxAckItem): DownlinkTxAckItem.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DownlinkTXAckItem, writer: jspb.BinaryWriter): void; static serializeBinaryToWriter(message: DownlinkTxAckItem, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DownlinkTXAckItem; static deserializeBinary(bytes: Uint8Array): DownlinkTxAckItem;
static deserializeBinaryFromReader(message: DownlinkTXAckItem, reader: jspb.BinaryReader): DownlinkTXAckItem; static deserializeBinaryFromReader(message: DownlinkTxAckItem, reader: jspb.BinaryReader): DownlinkTxAckItem;
} }
export namespace DownlinkTXAckItem { export namespace DownlinkTxAckItem {
export type AsObject = { export type AsObject = {
status: TxAckStatusMap[keyof TxAckStatusMap], status: TxAckStatusMap[keyof TxAckStatusMap],
} }
@ -1146,6 +1355,16 @@ export namespace ConnState {
export const State: StateMap; 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 { export interface DownlinkTimingMap {
IMMEDIATELY: 0; IMMEDIATELY: 0;
DELAY: 1; 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; setObject(value?: google_protobuf_struct_pb.Struct): void;
clearRxInfoList(): void; clearRxInfoList(): void;
getRxInfoList(): Array<gw_gw_pb.UplinkRXInfo>; getRxInfoList(): Array<gw_gw_pb.UplinkRxInfo>;
setRxInfoList(value: Array<gw_gw_pb.UplinkRXInfo>): void; setRxInfoList(value: Array<gw_gw_pb.UplinkRxInfo>): void;
addRxInfo(value?: gw_gw_pb.UplinkRXInfo, index?: number): gw_gw_pb.UplinkRXInfo; addRxInfo(value?: gw_gw_pb.UplinkRxInfo, index?: number): gw_gw_pb.UplinkRxInfo;
hasTxInfo(): boolean; hasTxInfo(): boolean;
clearTxInfo(): void; clearTxInfo(): void;
getTxInfo(): gw_gw_pb.UplinkTXInfo | undefined; getTxInfo(): gw_gw_pb.UplinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.UplinkTXInfo): void; setTxInfo(value?: gw_gw_pb.UplinkTxInfo): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UplinkEvent.AsObject; toObject(includeInstance?: boolean): UplinkEvent.AsObject;
@ -133,8 +133,8 @@ export namespace UplinkEvent {
confirmed: boolean, confirmed: boolean,
data: Uint8Array | string, data: Uint8Array | string,
object?: google_protobuf_struct_pb.Struct.AsObject, object?: google_protobuf_struct_pb.Struct.AsObject,
rxInfoList: Array<gw_gw_pb.UplinkRXInfo.AsObject>, rxInfoList: Array<gw_gw_pb.UplinkRxInfo.AsObject>,
txInfo?: gw_gw_pb.UplinkTXInfo.AsObject, txInfo?: gw_gw_pb.UplinkTxInfo.AsObject,
} }
} }
@ -219,8 +219,8 @@ export namespace AckEvent {
} }
export class TxAckEvent extends jspb.Message { export class TxAckEvent extends jspb.Message {
getDownlinkId(): string; getDownlinkId(): number;
setDownlinkId(value: string): void; setDownlinkId(value: number): void;
hasTime(): boolean; hasTime(): boolean;
clearTime(): void; clearTime(): void;
@ -243,8 +243,8 @@ export class TxAckEvent extends jspb.Message {
hasTxInfo(): boolean; hasTxInfo(): boolean;
clearTxInfo(): void; clearTxInfo(): void;
getTxInfo(): gw_gw_pb.DownlinkTXInfo | undefined; getTxInfo(): gw_gw_pb.DownlinkTxInfo | undefined;
setTxInfo(value?: gw_gw_pb.DownlinkTXInfo): void; setTxInfo(value?: gw_gw_pb.DownlinkTxInfo): void;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): TxAckEvent.AsObject; toObject(includeInstance?: boolean): TxAckEvent.AsObject;
@ -258,13 +258,13 @@ export class TxAckEvent extends jspb.Message {
export namespace TxAckEvent { export namespace TxAckEvent {
export type AsObject = { export type AsObject = {
downlinkId: string, downlinkId: number,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject, time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
deviceInfo?: DeviceInfo.AsObject, deviceInfo?: DeviceInfo.AsObject,
queueItemId: string, queueItemId: string,
fCntDown: number, fCntDown: number,
gatewayId: string, 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(), data: msg.getData_asB64(),
object: (f = msg.getObject()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f), object: (f = msg.getObject()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f),
rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(), rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance), gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTXInfo.toObject(includeInstance, f) txInfo: (f = msg.getTxInfo()) && gw_gw_pb.UplinkTxInfo.toObject(includeInstance, f)
}; };
if (includeInstance) { if (includeInstance) {
@ -547,14 +547,14 @@ proto.integration.UplinkEvent.deserializeBinaryFromReader = function(msg, reader
msg.setObject(value); msg.setObject(value);
break; break;
case 12: case 12:
var value = new gw_gw_pb.UplinkRXInfo; var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.getRxInfoList().push(value); msg.getRxInfoList().push(value);
msg.setRxInfoList(msg.getRxInfoList()); msg.setRxInfoList(msg.getRxInfoList());
break; break;
case 13: case 13:
var value = new gw_gw_pb.UplinkTXInfo; var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value); msg.setTxInfo(value);
break; break;
default: default:
@ -680,7 +680,7 @@ proto.integration.UplinkEvent.prototype.serializeBinaryToWriter = function (writ
writer.writeRepeatedMessage( writer.writeRepeatedMessage(
12, 12,
f, f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
); );
} }
f = this.getTxInfo(); f = this.getTxInfo();
@ -688,7 +688,7 @@ proto.integration.UplinkEvent.prototype.serializeBinaryToWriter = function (writ
writer.writeMessage( writer.writeMessage(
13, 13,
f, 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 * 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. * 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() { proto.integration.UplinkEvent.prototype.getRxInfoList = function() {
return /** @type{!Array.<!proto.gw.UplinkRXInfo>} */ ( return /** @type{!Array.<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 12)); 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) { proto.integration.UplinkEvent.prototype.setRxInfoList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 12, value); jspb.Message.setRepeatedWrapperField(this, 12, value);
}; };
@ -965,16 +965,16 @@ proto.integration.UplinkEvent.prototype.clearRxInfoList = function() {
/** /**
* optional gw.UplinkTXInfo tx_info = 13; * optional gw.UplinkTxInfo tx_info = 13;
* @return {proto.gw.UplinkTXInfo} * @return {proto.gw.UplinkTxInfo}
*/ */
proto.integration.UplinkEvent.prototype.getTxInfo = function() { proto.integration.UplinkEvent.prototype.getTxInfo = function() {
return /** @type{proto.gw.UplinkTXInfo} */ ( return /** @type{proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 13)); 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) { proto.integration.UplinkEvent.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 13, value); jspb.Message.setWrapperField(this, 13, value);
}; };
@ -1650,7 +1650,7 @@ proto.integration.TxAckEvent.toObject = function(includeInstance, msg) {
queueItemId: msg.getQueueItemId(), queueItemId: msg.getQueueItemId(),
fCntDown: msg.getFCntDown(), fCntDown: msg.getFCntDown(),
gatewayId: msg.getGatewayId(), 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) { if (includeInstance) {
@ -1688,7 +1688,7 @@ proto.integration.TxAckEvent.deserializeBinaryFromReader = function(msg, reader)
var field = reader.getFieldNumber(); var field = reader.getFieldNumber();
switch (field) { switch (field) {
case 1: case 1:
var value = /** @type {string} */ (reader.readString()); var value = /** @type {number} */ (reader.readUint32());
msg.setDownlinkId(value); msg.setDownlinkId(value);
break; break;
case 2: case 2:
@ -1714,8 +1714,8 @@ proto.integration.TxAckEvent.deserializeBinaryFromReader = function(msg, reader)
msg.setGatewayId(value); msg.setGatewayId(value);
break; break;
case 7: case 7:
var value = new gw_gw_pb.DownlinkTXInfo; var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value); msg.setTxInfo(value);
break; break;
default: default:
@ -1757,8 +1757,8 @@ proto.integration.TxAckEvent.prototype.serializeBinary = function() {
proto.integration.TxAckEvent.prototype.serializeBinaryToWriter = function (writer) { proto.integration.TxAckEvent.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined; var f = undefined;
f = this.getDownlinkId(); f = this.getDownlinkId();
if (f.length > 0) { if (f !== 0) {
writer.writeString( writer.writeUint32(
1, 1,
f f
); );
@ -1805,7 +1805,7 @@ proto.integration.TxAckEvent.prototype.serializeBinaryToWriter = function (write
writer.writeMessage( writer.writeMessage(
7, 7,
f, 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; * optional uint32 downlink_id = 1;
* @return {string} * @return {number}
*/ */
proto.integration.TxAckEvent.prototype.getDownlinkId = function() { 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) { proto.integration.TxAckEvent.prototype.setDownlinkId = function(value) {
jspb.Message.setField(this, 1, value); jspb.Message.setField(this, 1, value);
}; };
@ -1941,16 +1941,16 @@ proto.integration.TxAckEvent.prototype.setGatewayId = function(value) {
/** /**
* optional gw.DownlinkTXInfo tx_info = 7; * optional gw.DownlinkTxInfo tx_info = 7;
* @return {proto.gw.DownlinkTXInfo} * @return {proto.gw.DownlinkTxInfo}
*/ */
proto.integration.TxAckEvent.prototype.getTxInfo = function() { proto.integration.TxAckEvent.prototype.getTxInfo = function() {
return /** @type{proto.gw.DownlinkTXInfo} */ ( return /** @type{proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 7)); 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) { proto.integration.TxAckEvent.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 7, value); jspb.Message.setWrapperField(this, 7, value);
}; };

View File

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

View File

@ -67,9 +67,9 @@ proto.meta.UplinkMeta.prototype.toObject = function(opt_includeInstance) {
proto.meta.UplinkMeta.toObject = function(includeInstance, msg) { proto.meta.UplinkMeta.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
devEui: msg.getDevEui(), 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(), rxInfoList: jspb.Message.toObjectList(msg.getRxInfoList(),
gw_gw_pb.UplinkRXInfo.toObject, includeInstance), gw_gw_pb.UplinkRxInfo.toObject, includeInstance),
phyPayloadByteCount: msg.getPhyPayloadByteCount(), phyPayloadByteCount: msg.getPhyPayloadByteCount(),
macCommandByteCount: msg.getMacCommandByteCount(), macCommandByteCount: msg.getMacCommandByteCount(),
applicationPayloadByteCount: msg.getApplicationPayloadByteCount(), applicationPayloadByteCount: msg.getApplicationPayloadByteCount(),
@ -115,13 +115,13 @@ proto.meta.UplinkMeta.deserializeBinaryFromReader = function(msg, reader) {
msg.setDevEui(value); msg.setDevEui(value);
break; break;
case 2: case 2:
var value = new gw_gw_pb.UplinkTXInfo; var value = new gw_gw_pb.UplinkTxInfo;
reader.readMessage(value,gw_gw_pb.UplinkTXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.UplinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value); msg.setTxInfo(value);
break; break;
case 3: case 3:
var value = new gw_gw_pb.UplinkRXInfo; var value = new gw_gw_pb.UplinkRxInfo;
reader.readMessage(value,gw_gw_pb.UplinkRXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.UplinkRxInfo.deserializeBinaryFromReader);
msg.getRxInfoList().push(value); msg.getRxInfoList().push(value);
msg.setRxInfoList(msg.getRxInfoList()); msg.setRxInfoList(msg.getRxInfoList());
break; break;
@ -191,7 +191,7 @@ proto.meta.UplinkMeta.prototype.serializeBinaryToWriter = function (writer) {
writer.writeMessage( writer.writeMessage(
2, 2,
f, f,
gw_gw_pb.UplinkTXInfo.serializeBinaryToWriter gw_gw_pb.UplinkTxInfo.serializeBinaryToWriter
); );
} }
f = this.getRxInfoList(); f = this.getRxInfoList();
@ -199,7 +199,7 @@ proto.meta.UplinkMeta.prototype.serializeBinaryToWriter = function (writer) {
writer.writeRepeatedMessage( writer.writeRepeatedMessage(
3, 3,
f, f,
gw_gw_pb.UplinkRXInfo.serializeBinaryToWriter gw_gw_pb.UplinkRxInfo.serializeBinaryToWriter
); );
} }
f = this.getPhyPayloadByteCount(); f = this.getPhyPayloadByteCount();
@ -258,16 +258,16 @@ proto.meta.UplinkMeta.prototype.setDevEui = function(value) {
/** /**
* optional gw.UplinkTXInfo tx_info = 2; * optional gw.UplinkTxInfo tx_info = 2;
* @return {proto.gw.UplinkTXInfo} * @return {proto.gw.UplinkTxInfo}
*/ */
proto.meta.UplinkMeta.prototype.getTxInfo = function() { proto.meta.UplinkMeta.prototype.getTxInfo = function() {
return /** @type{proto.gw.UplinkTXInfo} */ ( return /** @type{proto.gw.UplinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.UplinkTXInfo, 2)); 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) { proto.meta.UplinkMeta.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 2, 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 * 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. * 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() { proto.meta.UplinkMeta.prototype.getRxInfoList = function() {
return /** @type{!Array.<!proto.gw.UplinkRXInfo>} */ ( return /** @type{!Array.<!proto.gw.UplinkRxInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, gw_gw_pb.UplinkRXInfo, 3)); 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) { proto.meta.UplinkMeta.prototype.setRxInfoList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 3, value); jspb.Message.setRepeatedWrapperField(this, 3, value);
}; };
@ -418,7 +418,7 @@ proto.meta.DownlinkMeta.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
devEui: msg.getDevEui(), devEui: msg.getDevEui(),
multicastGroupId: msg.getMulticastGroupId(), 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(), phyPayloadByteCount: msg.getPhyPayloadByteCount(),
macCommandByteCount: msg.getMacCommandByteCount(), macCommandByteCount: msg.getMacCommandByteCount(),
applicationPayloadByteCount: msg.getApplicationPayloadByteCount(), applicationPayloadByteCount: msg.getApplicationPayloadByteCount(),
@ -469,8 +469,8 @@ proto.meta.DownlinkMeta.deserializeBinaryFromReader = function(msg, reader) {
msg.setMulticastGroupId(value); msg.setMulticastGroupId(value);
break; break;
case 3: case 3:
var value = new gw_gw_pb.DownlinkTXInfo; var value = new gw_gw_pb.DownlinkTxInfo;
reader.readMessage(value,gw_gw_pb.DownlinkTXInfo.deserializeBinaryFromReader); reader.readMessage(value,gw_gw_pb.DownlinkTxInfo.deserializeBinaryFromReader);
msg.setTxInfo(value); msg.setTxInfo(value);
break; break;
case 4: case 4:
@ -550,7 +550,7 @@ proto.meta.DownlinkMeta.prototype.serializeBinaryToWriter = function (writer) {
writer.writeMessage( writer.writeMessage(
3, 3,
f, f,
gw_gw_pb.DownlinkTXInfo.serializeBinaryToWriter gw_gw_pb.DownlinkTxInfo.serializeBinaryToWriter
); );
} }
f = this.getPhyPayloadByteCount(); f = this.getPhyPayloadByteCount();
@ -631,16 +631,16 @@ proto.meta.DownlinkMeta.prototype.setMulticastGroupId = function(value) {
/** /**
* optional gw.DownlinkTXInfo tx_info = 3; * optional gw.DownlinkTxInfo tx_info = 3;
* @return {proto.gw.DownlinkTXInfo} * @return {proto.gw.DownlinkTxInfo}
*/ */
proto.meta.DownlinkMeta.prototype.getTxInfo = function() { proto.meta.DownlinkMeta.prototype.getTxInfo = function() {
return /** @type{proto.gw.DownlinkTXInfo} */ ( return /** @type{proto.gw.DownlinkTxInfo} */ (
jspb.Message.getWrapperField(this, gw_gw_pb.DownlinkTXInfo, 3)); 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) { proto.meta.DownlinkMeta.prototype.setTxInfo = function(value) {
jspb.Message.setWrapperField(this, 3, value); jspb.Message.setWrapperField(this, 3, value);
}; };

View File

@ -16,10 +16,10 @@ message UplinkFrameLog {
bytes phy_payload = 1; bytes phy_payload = 1;
// TX meta-data. // TX meta-data.
gw.UplinkTXInfo tx_info = 2; gw.UplinkTxInfo tx_info = 2;
// RX meta-data. // RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3; repeated gw.UplinkRxInfo rx_info = 3;
// Message type. // Message type.
common.MType m_type = 4; common.MType m_type = 4;
@ -42,10 +42,10 @@ message DownlinkFrameLog {
bytes phy_payload = 2; bytes phy_payload = 2;
// TX meta-data. // TX meta-data.
gw.DownlinkTXInfo tx_info = 3; gw.DownlinkTxInfo tx_info = 3;
// Downlink ID (UUID). // Downlink ID.
string downlink_id = 4; uint32 downlink_id = 4;
// Gateway ID (EUI64). // Gateway ID (EUI64).
string gateway_id = 5; 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 "common/common.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.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 { enum DownlinkTiming {
// Send the downlink immediately. // Send the downlink immediately.
IMMEDIATELY = 0; IMMEDIATELY = 0;
@ -23,7 +32,6 @@ enum DownlinkTiming {
GPS_EPOCH = 2; GPS_EPOCH = 2;
} }
enum FineTimestampType { enum FineTimestampType {
// No fine-timestamp available. // No fine-timestamp available.
NONE = 0; NONE = 0;
@ -84,17 +92,17 @@ enum TxAckStatus {
message Modulation { message Modulation {
oneof parameters { oneof parameters {
// LoRa modulation information. // LoRa modulation information.
LoRaModulationInfo lora = 3 [json_name = "loRa"]; LoraModulationInfo lora = 3;
// FSK modulation information. // FSK modulation information.
FSKModulationInfo fsk = 4; FskModulationInfo fsk = 4;
// LR-FHSS modulation information. // LR-FHSS modulation information.
LRFHSSModulationInfo lr_fhss = 5 [json_name = "lrFHSS"]; LrFhssModulationInfo lr_fhss = 5;
} }
} }
message UplinkTXInfo { message UplinkTxInfoLegacy {
// Frequency (Hz). // Frequency (Hz).
uint32 frequency = 1; uint32 frequency = 1;
@ -103,17 +111,25 @@ message UplinkTXInfo {
oneof modulation_info { oneof modulation_info {
// LoRa modulation information. // LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 3 [json_name = "loRaModulationInfo"]; LoraModulationInfo lora_modulation_info = 3;
// FSK modulation information. // FSK modulation information.
FSKModulationInfo fsk_modulation_info = 4; FskModulationInfo fsk_modulation_info = 4;
// LR-FHSS modulation information. // 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. // Bandwidth.
uint32 bandwidth = 1; uint32 bandwidth = 1;
@ -121,13 +137,16 @@ message LoRaModulationInfo {
uint32 spreading_factor = 2; uint32 spreading_factor = 2;
// Code-rate. // Code-rate.
string code_rate = 3; string code_rate_legacy = 3;
// Code-rate.
CodeRate code_rate = 5;
// Polarization inversion. // Polarization inversion.
bool polarization_inversion = 4; bool polarization_inversion = 4;
} }
message FSKModulationInfo { message FskModulationInfo {
// Frequency deviation. // Frequency deviation.
uint32 frequency_deviation = 1; uint32 frequency_deviation = 1;
@ -135,7 +154,7 @@ message FSKModulationInfo {
uint32 datarate = 2; uint32 datarate = 2;
} }
message LRFHSSModulationInfo { message LrFhssModulationInfo {
// Operating channel width (OCW) in Hz. // Operating channel width (OCW) in Hz.
uint32 operating_channel_width = 1; uint32 operating_channel_width = 1;
@ -151,10 +170,10 @@ message EncryptedFineTimestamp {
uint32 aes_key_index = 1; uint32 aes_key_index = 1;
// Encrypted 'main' fine-timestamp (ns precision part of the timestamp). // Encrypted 'main' fine-timestamp (ns precision part of the timestamp).
bytes encrypted_ns = 2 [json_name = "encryptedNS"]; bytes encrypted_ns = 2;
// FPGA ID. // FPGA ID.
bytes fpga_id = 3 [json_name = "fpgaID"]; bytes fpga_id = 3;
} }
message PlainFineTimestamp { message PlainFineTimestamp {
@ -164,7 +183,7 @@ message PlainFineTimestamp {
message GatewayStats { message GatewayStats {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// Gateway IP. // Gateway IP.
string ip = 9; string ip = 9;
@ -183,7 +202,7 @@ message GatewayStats {
uint32 rx_packets_received = 5; uint32 rx_packets_received = 5;
// Number of radio packets received with valid PHY CRC. // 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. // Number of downlink packets received for transmission.
uint32 tx_packets_received = 7; uint32 tx_packets_received = 7;
@ -196,7 +215,7 @@ message GatewayStats {
// Stats ID (UUID). // Stats ID (UUID).
// Unique identifier for the gateway stats. // Unique identifier for the gateway stats.
bytes stats_id = 11 [json_name = "statsID"]; bytes stats_id = 11;
// Tx packets per frequency. // Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12; map<uint32, uint32> tx_packets_per_frequency = 12;
@ -222,21 +241,21 @@ message PerModulationCount {
uint32 count = 2; uint32 count = 2;
} }
message UplinkRXInfo { message UplinkRxInfoLegacy {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// RX time (only set when the gateway has a GPS module). // RX time (only set when the gateway has a GPS module).
google.protobuf.Timestamp time = 2; google.protobuf.Timestamp time = 2;
// RX time since GPS epoch (only set when the gateway has a GPS module). // 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. // RSSI.
int32 rssi = 5; int32 rssi = 5;
// LoRa SNR. // LoRa SNR.
double lora_snr = 6 [json_name = "loRaSNR"]; double lora_snr = 6;
// Channel. // Channel.
uint32 channel = 7; uint32 channel = 7;
@ -270,19 +289,60 @@ message UplinkRXInfo {
// Uplink ID (UUID bytes). // Uplink ID (UUID bytes).
// Unique and random ID which can be used to correlate the uplink across multiple logs. // 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. // CRC status.
CRCStatus crc_status = 17 [json_name = "crcStatus"]; CRCStatus crc_status = 17;
// Optional meta-data map. // Optional meta-data map.
map<string, string> metadata = 18; 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. // Gateway ID.
// Deprecated: replaced by gateway_id in DownlinkFrame. // Deprecated: replaced by gateway_id in DownlinkFrame.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// TX frequency (in Hz). // TX frequency (in Hz).
uint32 frequency = 5; uint32 frequency = 5;
@ -295,10 +355,10 @@ message DownlinkTXInfo {
oneof modulation_info { oneof modulation_info {
// LoRa modulation information. // LoRa modulation information.
LoRaModulationInfo lora_modulation_info = 8 [json_name = "loRaModulationInfo"]; LoraModulationInfo lora_modulation_info = 8;
// FSK modulation information. // FSK modulation information.
FSKModulationInfo fsk_modulation_info = 9; FskModulationInfo fsk_modulation_info = 9;
} }
// The board identifier for emitting the frame. // The board identifier for emitting the frame.
@ -326,6 +386,43 @@ message DownlinkTXInfo {
bytes context = 16; 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 { message ImmediatelyTimingInfo {
// Not implemented yet. // Not implemented yet.
} }
@ -339,18 +436,24 @@ message DelayTimingInfo {
message GPSEpochTimingInfo { message GPSEpochTimingInfo {
// Duration since GPS Epoch. // 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 { message UplinkFrame {
// PHYPayload. // PHYPayload.
bytes phy_payload = 1; bytes phy_payload = 1;
// TX meta-data. // TX meta-data (deprecated).
UplinkTXInfo tx_info = 2; UplinkTxInfoLegacy tx_info_legacy = 2;
// RX meta-data. // RX meta-data (deprecated).
UplinkRXInfo rx_info = 3; UplinkRxInfoLegacy rx_info_legacy = 3;
// Tx meta-data.
UplinkTxInfo tx_info = 4;
// Rx meta-data.
UplinkRxInfo rx_info = 5;
} }
message UplinkFrameSet { message UplinkFrameSet {
@ -358,27 +461,19 @@ message UplinkFrameSet {
bytes phy_payload = 1; bytes phy_payload = 1;
// TX meta-data. // TX meta-data.
UplinkTXInfo tx_info = 2; UplinkTxInfo tx_info = 2;
// RX meta-data set. // RX meta-data set.
repeated UplinkRXInfo rx_info = 3; repeated UplinkRxInfo rx_info = 3;
} }
message DownlinkFrame { message DownlinkFrame {
// PHYPayload. // Downlink ID.
// Deprecated: replaced by items. uint32 downlink_id = 3;
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 (UUID). // Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"]; // Deprecated: use downlink_id.
bytes downlink_id_legacy = 4;
// Downlink frame items. // Downlink frame items.
// This makes it possible to send multiple downlink opportunities to the // This makes it possible to send multiple downlink opportunities to the
@ -388,47 +483,52 @@ message DownlinkFrame {
repeated DownlinkFrameItem items = 5; repeated DownlinkFrameItem items = 5;
// Gateway ID. // 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 { message DownlinkFrameItem {
// PHYPayload. // PHYPayload.
bytes phy_payload = 1; bytes phy_payload = 1;
// TX meta-data. // TX meta-data (deprecated).
DownlinkTXInfo tx_info = 2; 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. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; string gateway_id = 6;
// Token (uint16 value). // Downlink ID.
// Deprecated: replaced by downlink_id. uint32 downlink_id = 2;
uint32 token = 2;
// Error. // Downlink ID (deprecated).
// Deprecated: replaced by items. bytes downlink_id_legacy = 4;
string error = 3;
// Downlink ID (UUID).
bytes downlink_id = 4 [json_name = "downlinkID"];
// Downlink frame items. // Downlink frame items.
// This list has the same length as the request and indicates which // 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). // downlink frame has been emitted of the requested list (or why it failed).
// Note that at most one item has a positive acknowledgement. // 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. // The Ack status of this item.
TxAckStatus status = 1; TxAckStatus status = 1;
} }
message GatewayConfiguration { message GatewayConfiguration {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// Configuration version. // Configuration version.
string version = 2; string version = 2;
@ -449,7 +549,7 @@ message ChannelConfiguration {
oneof modulation_config { oneof modulation_config {
// LoRa modulation config. // LoRa modulation config.
LoRaModulationConfig lora_modulation_config = 3 [json_name = "loRaModulationConfig"]; LoRaModulationConfig lora_modulation_config = 3;
// FSK modulation config. // FSK modulation config.
FSKModulationConfig fsk_modulation_config = 4; FSKModulationConfig fsk_modulation_config = 4;
@ -480,7 +580,7 @@ message FSKModulationConfig {
message GatewayCommandExecRequest { message GatewayCommandExecRequest {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// Command to execute. // Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge configuration. // This command must be pre-configured in the LoRa Gateway Bridge configuration.
@ -489,7 +589,7 @@ message GatewayCommandExecRequest {
// Execution request ID (UUID). // Execution request ID (UUID).
// The same token will be returned when the execution of the command has // The same token will be returned when the execution of the command has
// completed. // completed.
bytes ExecId = 3 [json_name = "execID"]; bytes ExecId = 3;
// Standard input. // Standard input.
bytes stdin = 4; bytes stdin = 4;
@ -500,10 +600,10 @@ message GatewayCommandExecRequest {
message GatewayCommandExecResponse { message GatewayCommandExecResponse {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// Execution request ID (UUID). // Execution request ID (UUID).
bytes exec_id = 2 [json_name = "execID"]; bytes exec_id = 2;
// Standard output. // Standard output.
bytes stdout = 3; bytes stdout = 3;
@ -520,10 +620,10 @@ message GatewayCommandExecResponse {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent { message RawPacketForwarderEvent {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"]; bytes raw_id = 2;
// Payload contains the raw payload. // Payload contains the raw payload.
bytes payload = 3; bytes payload = 3;
@ -534,10 +634,10 @@ message RawPacketForwarderEvent {
// integrated with the ChirpStack Gateway Bridge. // integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand { message RawPacketForwarderCommand {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
// Raw ID (UUID). // Raw ID (UUID).
bytes raw_id = 2 [json_name = "rawID"]; bytes raw_id = 2;
// Payload contains the raw payload. // Payload contains the raw payload.
bytes payload = 3; bytes payload = 3;
@ -546,7 +646,7 @@ message RawPacketForwarderCommand {
// ConnState contains the connection state of a gateway. // ConnState contains the connection state of a gateway.
message ConnState { message ConnState {
// Gateway ID. // Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"]; bytes gateway_id = 1;
enum State { enum State {
OFFLINE = 0; 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; google.protobuf.Struct object = 11;
// Receiving gateway RX info. // Receiving gateway RX info.
repeated gw.UplinkRXInfo rx_info = 12; repeated gw.UplinkRxInfo rx_info = 12;
// TX info. // TX info.
gw.UplinkTXInfo tx_info = 13; gw.UplinkTxInfo tx_info = 13;
} }
// JoinEvent is the message sent when a device joined the network. // 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 // for transmission. As a downlink can be scheduled in the future, this event
// does not confirm that the message has already been transmitted. // does not confirm that the message has already been transmitted.
message TxAckEvent { message TxAckEvent {
// Downlink ID (UUID). // Downlink ID.
string downlink_id = 1; uint32 downlink_id = 1;
// Timestamp. // Timestamp.
google.protobuf.Timestamp time = 2; google.protobuf.Timestamp time = 2;
@ -186,7 +186,7 @@ message TxAckEvent {
string gateway_id = 6; string gateway_id = 6;
// TX info. // TX info.
gw.DownlinkTXInfo tx_info = 7; gw.DownlinkTxInfo tx_info = 7;
} }
// LogEvent is the message sent when a device-related log was sent. // LogEvent is the message sent when a device-related log was sent.

View File

@ -199,8 +199,8 @@ message DeviceGatewayRxInfoItem {
} }
message DownlinkFrame { message DownlinkFrame {
// Downlink ID (UUID). // Downlink ID.
bytes downlink_id = 1; uint32 downlink_id = 1;
// DevEUI. // DevEUI.
bytes dev_eui = 2; bytes dev_eui = 2;
@ -231,5 +231,5 @@ message LoraCloudGeolocBuffer {
message LoraCloudGeolocBufferUplink { message LoraCloudGeolocBufferUplink {
// RxInfo set for a single uplink. // 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; string dev_eui = 1;
// TX meta-data. // TX meta-data.
gw.UplinkTXInfo tx_info = 2; gw.UplinkTxInfo tx_info = 2;
// RX meta-data. // RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3; repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count. // PHYPayload byte count.
uint32 phy_payload_byte_count = 4; uint32 phy_payload_byte_count = 4;
@ -42,7 +42,7 @@ message DownlinkMeta {
string multicast_group_id = 2; string multicast_group_id = 2;
// TX meta-data. // TX meta-data.
gw.DownlinkTXInfo tx_info = 3; gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count. // PHYPayload byte count.
uint32 phy_payload_byte_count = 4; 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. # It is not intended for manual editing.
version = 3 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]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.45" version = "1.0.45"
@ -55,6 +46,49 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 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]] [[package]]
name = "base64" name = "base64"
version = "0.13.0" version = "0.13.0"
@ -73,6 +107,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -83,11 +123,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
name = "chirpstack_api" name = "chirpstack_api"
version = "4.0.0" version = "4.0.0"
dependencies = [ dependencies = [
"hex",
"pbjson", "pbjson",
"pbjson-build", "pbjson-build",
"pbjson-types", "pbjson-types",
"prost", "prost",
"prost-types", "prost-types",
"rand",
"serde", "serde",
"tokio", "tokio",
"tonic", "tonic",
@ -100,11 +142,17 @@ version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [ dependencies = [
"libc",
"num-integer", "num-integer",
"num-traits", "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]] [[package]]
@ -173,7 +221,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"wasi", "wasi 0.10.2+wasi-snapshot-preview1",
] ]
[[package]] [[package]]
@ -191,7 +239,7 @@ dependencies = [
"indexmap", "indexmap",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util 0.6.9",
"tracing", "tracing",
] ]
@ -203,12 +251,15 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
dependencies = [
"unicode-segmentation", [[package]]
] name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "http" name = "http"
@ -218,7 +269,7 @@ checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
"itoa", "itoa 0.4.8",
] ]
[[package]] [[package]]
@ -232,6 +283,12 @@ dependencies = [
"pin-project-lite", "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]] [[package]]
name = "httparse" name = "httparse"
version = "1.5.1" version = "1.5.1"
@ -259,7 +316,7 @@ dependencies = [
"http-body", "http-body",
"httparse", "httparse",
"httpdate", "httpdate",
"itoa", "itoa 0.4.8",
"pin-project-lite", "pin-project-lite",
"socket2", "socket2",
"tokio", "tokio",
@ -305,6 +362,12 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "itoa"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -313,9 +376,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.107" version = "0.2.124"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
[[package]] [[package]]
name = "log" name = "log"
@ -326,6 +389,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "matchit"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.4.1" version = "2.4.1"
@ -333,15 +402,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "mio" name = "mime"
version = "0.7.14" version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index" 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 = [ dependencies = [
"libc", "libc",
"log", "log",
"miow", "miow",
"ntapi", "ntapi",
"wasi 0.11.0+wasi-snapshot-preview1",
"winapi", "winapi",
] ]
@ -390,9 +466,9 @@ dependencies = [
[[package]] [[package]]
name = "pbjson" name = "pbjson"
version = "0.2.1" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12f64965beef9b7276dd811b81cce49569430a73ce1586aa121cb4ef9e0f498f" checksum = "d86c0a61b93c50f35af5d8a4f134790f47cbebf8803a7219dd1e7238cd1af022"
dependencies = [ dependencies = [
"base64", "base64",
"serde", "serde",
@ -400,9 +476,9 @@ dependencies = [
[[package]] [[package]]
name = "pbjson-build" name = "pbjson-build"
version = "0.2.1" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d726efd7bfb8725c7100c29cb723eaa865b5e56cd41b723f193436e404c07f5" checksum = "956a449e8a85fc040e9f8cd8fd4dd2e68059d179092401f0d8570ba059f76dae"
dependencies = [ dependencies = [
"heck", "heck",
"itertools", "itertools",
@ -412,9 +488,9 @@ dependencies = [
[[package]] [[package]]
name = "pbjson-types" name = "pbjson-types"
version = "0.2.1" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d501adb5dc9774145e21cf497e62641d6b4c7f9db490c52388e26a0f966c7ea8" checksum = "2c20bd6ec3b4ba0073e7e5a1a770abd95723b431bf0e1941d2dd8aace9ffb97f"
dependencies = [ dependencies = [
"bytes", "bytes",
"chrono", "chrono",
@ -479,6 +555,16 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" 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]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.32" version = "1.0.32"
@ -490,9 +576,9 @@ dependencies = [
[[package]] [[package]]
name = "prost" name = "prost"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" checksum = "a07b0857a71a8cb765763950499cae2413c3f9cede1133478c43600d9e146890"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost-derive", "prost-derive",
@ -500,11 +586,13 @@ dependencies = [
[[package]] [[package]]
name = "prost-build" name = "prost-build"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" checksum = "120fbe7988713f39d780a58cf1a7ef0d7ef66c6d87e5aa3438940c05357929f4"
dependencies = [ dependencies = [
"bytes", "bytes",
"cfg-if",
"cmake",
"heck", "heck",
"itertools", "itertools",
"lazy_static", "lazy_static",
@ -520,9 +608,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-derive" name = "prost-derive"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools", "itertools",
@ -533,9 +621,9 @@ dependencies = [
[[package]] [[package]]
name = "prost-types" name = "prost-types"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68"
dependencies = [ dependencies = [
"bytes", "bytes",
"prost", "prost",
@ -601,12 +689,10 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.4" version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [ dependencies = [
"aho-corasick",
"memchr",
"regex-syntax", "regex-syntax",
] ]
@ -653,9 +739,9 @@ checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.2" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
dependencies = [ dependencies = [
"libc", "libc",
"winapi", "winapi",
@ -663,15 +749,21 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.81" version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "sync_wrapper"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.2.0" version = "3.2.0"
@ -686,28 +778,18 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "time"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.14.0" version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
dependencies = [ dependencies = [
"autocfg",
"bytes", "bytes",
"libc", "libc",
"memchr", "memchr",
"mio", "mio",
"pin-project-lite", "pin-project-lite",
"socket2",
"tokio-macros", "tokio-macros",
"winapi", "winapi",
] ]
@ -724,9 +806,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.6.0" version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e" checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -759,13 +841,28 @@ dependencies = [
] ]
[[package]] [[package]]
name = "tonic" name = "tokio-util"
version = "0.6.1" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" 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 = [ dependencies = [
"async-stream", "async-stream",
"async-trait", "async-trait",
"axum",
"base64", "base64",
"bytes", "bytes",
"futures-core", "futures-core",
@ -781,7 +878,7 @@ dependencies = [
"prost-derive", "prost-derive",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util 0.7.1",
"tower", "tower",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
@ -791,10 +888,11 @@ dependencies = [
[[package]] [[package]]
name = "tonic-build" name = "tonic-build"
version = "0.6.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88358bb1dcfeb62dcce85c63006cafb964b7be481d522b7e09589d4d1e718d2a" checksum = "4d17087af5c80e5d5fc8ba9878e60258065a0a757e35efe7a05b7904bece1943"
dependencies = [ dependencies = [
"prettyplease",
"proc-macro2", "proc-macro2",
"prost-build", "prost-build",
"quote", "quote",
@ -803,9 +901,9 @@ dependencies = [
[[package]] [[package]]
name = "tower" name = "tower"
version = "0.4.10" version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c00e500fff5fa1131c866b246041a6bf96da9c965f8fe4128cb1421f23e93c00" checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-util", "futures-util",
@ -815,13 +913,31 @@ dependencies = [
"rand", "rand",
"slab", "slab",
"tokio", "tokio",
"tokio-stream", "tokio-util 0.7.1",
"tokio-util",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
"tracing", "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]] [[package]]
name = "tower-layer" name = "tower-layer"
version = "0.3.1" version = "0.3.1"
@ -883,12 +999,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.2" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 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]] [[package]]
name = "which" name = "which"
version = "4.2.2" version = "4.2.2"

2
api/rust/Cargo.toml vendored
View File

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

View File

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

View File

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

View File

@ -199,8 +199,8 @@ message DeviceGatewayRxInfoItem {
} }
message DownlinkFrame { message DownlinkFrame {
// Downlink ID (UUID). // Downlink ID.
bytes downlink_id = 1; uint32 downlink_id = 1;
// DevEUI. // DevEUI.
bytes dev_eui = 2; bytes dev_eui = 2;
@ -231,5 +231,5 @@ message LoraCloudGeolocBuffer {
message LoraCloudGeolocBufferUplink { message LoraCloudGeolocBufferUplink {
// RxInfo set for a single uplink. // 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; string dev_eui = 1;
// TX meta-data. // TX meta-data.
gw.UplinkTXInfo tx_info = 2; gw.UplinkTxInfo tx_info = 2;
// RX meta-data. // RX meta-data.
repeated gw.UplinkRXInfo rx_info = 3; repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count. // PHYPayload byte count.
uint32 phy_payload_byte_count = 4; uint32 phy_payload_byte_count = 4;
@ -42,7 +42,7 @@ message DownlinkMeta {
string multicast_group_id = 2; string multicast_group_id = 2;
// TX meta-data. // TX meta-data.
gw.DownlinkTXInfo tx_info = 3; gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count. // PHYPayload byte count.
uint32 phy_payload_byte_count = 4; 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"); tonic::include_proto!("gw/gw");
include!(concat!(env!("OUT_DIR"), "/gw/gw.serde.rs")); include!(concat!(env!("OUT_DIR"), "/gw/gw.serde.rs"));
@ -20,3 +22,216 @@ impl Into<String> for TxAckStatus {
.to_string() .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::Lrwn(_) => Status::new(Code::Internal, format!("{}", self)),
storage::error::Error::TokioJoin(_) => 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::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 anyhow::{Context, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use rand::Rng;
use tracing::{span, trace, warn, Instrument, Level}; use tracing::{span, trace, warn, Instrument, Level};
use uuid::Uuid;
use crate::api::helpers::FromProto; use crate::api::helpers::FromProto;
use crate::downlink::{classb, helpers}; use crate::downlink::{classb, helpers};
@ -121,7 +121,7 @@ impl Data {
device_gateway_rx_info: Some(dev_gw_rx_info), device_gateway_rx_info: Some(dev_gw_rx_info),
downlink_gateway: None, downlink_gateway: None,
downlink_frame: gw::DownlinkFrame { downlink_frame: gw::DownlinkFrame {
downlink_id: Uuid::new_v4().as_bytes().to_vec(), downlink_id: rand::thread_rng().gen(),
..Default::default() ..Default::default()
}, },
downlink_frame_items: Vec::new(), downlink_frame_items: Vec::new(),
@ -174,7 +174,7 @@ impl Data {
device_gateway_rx_info: Some(dev_gw), device_gateway_rx_info: Some(dev_gw),
downlink_gateway: None, downlink_gateway: None,
downlink_frame: gw::DownlinkFrame { downlink_frame: gw::DownlinkFrame {
downlink_id: Uuid::new_v4().as_bytes().to_vec(), downlink_id: rand::thread_rng().gen(),
..Default::default() ..Default::default()
}, },
downlink_frame_items: vec![], downlink_frame_items: vec![],
@ -215,7 +215,7 @@ impl Data {
self.device_gateway_rx_info.as_mut().unwrap(), 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); self.downlink_gateway = Some(gw_down);
Ok(()) Ok(())
@ -598,7 +598,7 @@ impl Data {
trace!("Saving downlink frame"); trace!("Saving downlink frame");
downlink_frame::save(&internal::DownlinkFrame { 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(), dev_eui: self.device.dev_eui.to_be_bytes().to_vec(),
device_queue_item_id: match &self.device_queue_item { device_queue_item_id: match &self.device_queue_item {
Some(qi) => qi.id.as_bytes().to_vec(), Some(qi) => qi.id.as_bytes().to_vec(),
@ -1050,12 +1050,11 @@ impl Data {
} else { } else {
self.region_conf.get_defaults().rx1_delay self.region_conf.get_defaults().rx1_delay
}; };
tx_info.set_timing(gw::DownlinkTiming::Delay); tx_info.timing = Some(gw::Timing {
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::DelayTimingInfo( parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(delay)), delay: Some(pbjson_types::Duration::from(delay)),
}, })),
)); });
// get remaining payload size // get remaining payload size
let max_pl_size = self.region_conf.get_max_payload_size( let max_pl_size = self.region_conf.get_max_payload_size(
@ -1107,19 +1106,20 @@ impl Data {
} else { } else {
self.region_conf.get_defaults().rx2_delay 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( tx_info.timing = Some(gw::Timing {
gw::DelayTimingInfo { parameters: Some(gw::timing::Parameters::Delay(gw::DelayTimingInfo {
delay: Some(pbjson_types::Duration::from(delay)), delay: Some(pbjson_types::Duration::from(delay)),
}, })),
)); });
} }
if self.immediately { if self.immediately {
tx_info.set_timing(gw::DownlinkTiming::Immediately); tx_info.timing = Some(gw::Timing {
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::ImmediatelyTimingInfo( parameters: Some(gw::timing::Parameters::Immediately(
gw::ImmediatelyTimingInfo {}, gw::ImmediatelyTimingInfo {},
)); )),
});
} }
// get remaining payload size // get remaining payload size
@ -1173,12 +1173,11 @@ impl Data {
self.device_session.class_b_ping_slot_nb as usize, 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"); 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 = Some(gw::Timing {
tx_info.timing_info = Some(gw::downlink_tx_info::TimingInfo::GpsEpochTimingInfo( parameters: Some(gw::timing::Parameters::GpsEpoch(gw::GpsEpochTimingInfo {
gw::GpsEpochTimingInfo {
time_since_gps_epoch: Some(pbjson_types::Duration::from(ping_slot_ts.to_std()?)), 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(); let scheduler_run_after_ts = ping_slot_ts.to_date_time();
// Try to aquire the device lock. // Try to aquire the device lock.

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
use std::io::Cursor; use std::io::Cursor;
use std::str::FromStr;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; 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()?; let mut c = get_redis_conn()?;
for rx_info in &ufl.rx_info { 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 { let ufl_copy = api::UplinkFrameLog {
phy_payload: ufl.phy_payload.clone(), phy_payload: ufl.phy_payload.clone(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,19 +15,27 @@ pub fn handle(
info!(dev_eui = %dev.dev_eui, "Received LinkCheckReq"); info!(dev_eui = %dev.dev_eui, "Received LinkCheckReq");
if let Some(gw::uplink_tx_info::ModulationInfo::LoraModulationInfo(pl)) = let mod_info = ufs
&ufs.tx_info.modulation_info .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 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() { for (i, rx_info) in ufs.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.lora_snr > max_snr { if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.lora_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 { if margin < 0.0 {
margin = 0.0; margin = 0.0;
} }
@ -69,21 +77,21 @@ pub mod test {
mic: None, mic: None,
}, },
tx_info: gw::UplinkTxInfo { tx_info: gw::UplinkTxInfo {
modulation_info: Some(gw::uplink_tx_info::ModulationInfo::LoraModulationInfo( modulation: Some(gw::Modulation {
gw::LoRaModulationInfo { parameters: Some(gw::modulation::Parameters::Lora(gw::LoraModulationInfo {
spreading_factor: 10, spreading_factor: 10,
..Default::default() ..Default::default()
}, })),
)), }),
..Default::default() ..Default::default()
}, },
rx_info_set: vec![ rx_info_set: vec![
gw::UplinkRxInfo { gw::UplinkRxInfo {
lora_snr: -2.0, snr: -2.0,
..Default::default() ..Default::default()
}, },
gw::UplinkRxInfo { gw::UplinkRxInfo {
lora_snr: 2.0, snr: 2.0,
..Default::default() ..Default::default()
}, },
], ],

View File

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

View File

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

View File

@ -5,7 +5,6 @@ use std::pin::Pin;
use prost::Message; use prost::Message;
use redis::streams::StreamReadReply; use redis::streams::StreamReadReply;
use tokio::sync::RwLock; use tokio::sync::RwLock;
use uuid::Uuid;
use crate::gateway::backend::mock as gateway_mock; use crate::gateway::backend::mock as gateway_mock;
use crate::integration::mock; use crate::integration::mock;
@ -16,7 +15,7 @@ use chirpstack_api::{gw, integration as integration_pb, internal, meta};
use lrwn::EUI64; use lrwn::EUI64;
lazy_static! { 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 = ()>>>>; 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; let mut items = gateway_mock::get_downlink_frames().await;
assert_eq!(1, items.len()); 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; 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]); 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; let items = gateway_mock::get_downlink_frames().await;
assert_eq!(1, items.len()); 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; 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()); 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; let items = gateway_mock::get_downlink_frames().await;
assert_eq!(1, items.len()); 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; 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()); assert_eq!(phys.len(), items[0].items.len());
@ -292,13 +291,13 @@ pub fn downlink_frame_saved(df: internal::DownlinkFrame) -> Validator {
Box::new(move || { Box::new(move || {
let df = df.clone(); let df = df.clone();
Box::pin(async move { 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 .await
.unwrap(); .unwrap();
df_get.downlink_id = Vec::new(); df_get.downlink_id = 0;
if let Some(df) = &mut df_get.downlink_frame { if let Some(df) = &mut df_get.downlink_frame {
df.downlink_id = Vec::new(); df.downlink_id = 0;
} }
assert_eq!(df, df_get); assert_eq!(df, df_get);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -478,9 +478,9 @@ impl Data {
.rx_info_set .rx_info_set
.iter() .iter()
.map(|rx_info| internal::DeviceGatewayRxInfoItem { .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, rssi: rx_info.rssi,
lora_snr: rx_info.lora_snr as f32, lora_snr: rx_info.snr,
antenna: rx_info.antenna, antenna: rx_info.antenna,
board: rx_info.board, board: rx_info.board,
context: rx_info.context.clone(), context: rx_info.context.clone(),
@ -510,8 +510,8 @@ impl Data {
let mut max_snr = 0.0; let mut max_snr = 0.0;
for (i, rx_info) in self.uplink_frame_set.rx_info_set.iter().enumerate() { for (i, rx_info) in self.uplink_frame_set.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.lora_snr > max_snr { if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.lora_snr; max_snr = rx_info.snr;
} }
} }
@ -524,7 +524,7 @@ impl Data {
ds.uplink_adr_history.push(internal::UplinkAdrHistory { ds.uplink_adr_history.push(internal::UplinkAdrHistory {
f_cnt: self.f_cnt_up_full, f_cnt: self.f_cnt_up_full,
max_snr: max_snr as f32, max_snr,
max_rssi, max_rssi,
tx_power_index: ds.tx_power_index, tx_power_index: ds.tx_power_index,
gateway_count: self.uplink_frame_set.rx_info_set.len() as u32, gateway_count: self.uplink_frame_set.rx_info_set.len() as u32,
@ -687,20 +687,20 @@ impl Data {
async fn save_metrics(&self) -> Result<()> { async fn save_metrics(&self) -> Result<()> {
trace!("Saving device metrics"); trace!("Saving device metrics");
let mut max_rssi: i32 = 0; 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() { for (i, rx_info) in self.uplink_frame_set.rx_info_set.iter().enumerate() {
if i == 0 { if i == 0 {
max_rssi = rx_info.rssi; max_rssi = rx_info.rssi;
max_snr = rx_info.lora_snr; max_snr = rx_info.snr;
} }
if rx_info.rssi > max_rssi { if rx_info.rssi > max_rssi {
max_rssi = rx_info.rssi; max_rssi = rx_info.rssi;
} }
if rx_info.lora_snr > max_snr { if rx_info.snr > max_snr {
max_snr = rx_info.lora_snr; max_snr = rx_info.snr;
} }
} }
@ -711,7 +711,7 @@ impl Data {
record.metrics.insert("rx_count".into(), 1.0); record.metrics.insert("rx_count".into(), 1.0);
record.metrics.insert("gw_rssi_sum".into(), max_rssi as f64); 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( record.metrics.insert(
format!("rx_freq_{}", self.uplink_frame_set.tx_info.frequency), format!("rx_freq_{}", self.uplink_frame_set.tx_info.frequency),
1.0, 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> { pub fn get_uplink_dr(region_name: &str, tx_info: &chirpstack_api::gw::UplinkTxInfo) -> Result<u8> {
let region_conf = region::get(region_name)?; let region_conf = region::get(region_name)?;
let mod_info = tx_info let mod_info = tx_info
.modulation_info .modulation
.as_ref() .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 { let mod_params = mod_info
chirpstack_api::gw::uplink_tx_info::ModulationInfo::LoraModulationInfo(v) => { .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 { lrwn::region::DataRateModulation::Lora(lrwn::region::LoraDataRate {
spreading_factor: v.spreading_factor as u8, 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 { lrwn::region::DataRateModulation::Fsk(lrwn::region::FskDataRate {
bitrate: v.datarate, 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 { lrwn::region::DataRateModulation::LrFhss(lrwn::region::LrFhssDataRate {
coding_rate: v.code_rate.clone(), coding_rate: v.code_rate.clone(),
occupied_channel_width: v.operating_channel_width, occupied_channel_width: v.operating_channel_width,
@ -45,40 +50,33 @@ pub fn set_uplink_modulation(
let region_conf = region::get(region_name)?; let region_conf = region::get(region_name)?;
let params = region_conf.get_data_rate(dr)?; let params = region_conf.get_data_rate(dr)?;
match params { tx_info.modulation = Some(gw::Modulation {
lrwn::region::DataRateModulation::Lora(v) => { parameters: Some(match params {
tx_info.set_modulation(common::Modulation::Lora); lrwn::region::DataRateModulation::Lora(v) => {
tx_info.modulation_info = Some(gw::uplink_tx_info::ModulationInfo::LoraModulationInfo( gw::modulation::Parameters::Lora(gw::LoraModulationInfo {
gw::LoRaModulationInfo { bandwidth: v.bandwidth,
bandwidth: v.bandwidth / 1000,
spreading_factor: v.spreading_factor as u32, 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, polarization_inversion: true,
}, })
)); }
} lrwn::region::DataRateModulation::Fsk(v) => {
lrwn::region::DataRateModulation::Fsk(v) => { gw::modulation::Parameters::Fsk(gw::FskModulationInfo {
tx_info.set_modulation(common::Modulation::Fsk);
tx_info.modulation_info = Some(gw::uplink_tx_info::ModulationInfo::FskModulationInfo(
gw::FskModulationInfo {
datarate: v.bitrate, datarate: v.bitrate,
..Default::default() ..Default::default()
}, })
)); }
} lrwn::region::DataRateModulation::LrFhss(v) => {
lrwn::region::DataRateModulation::LrFhss(v) => { gw::modulation::Parameters::LrFhss(gw::LrFhssModulationInfo {
tx_info.set_modulation(common::Modulation::LrFhss); operating_channel_width: v.occupied_channel_width,
tx_info.modulation_info = code_rate: v.coding_rate,
Some(gw::uplink_tx_info::ModulationInfo::LrFhssModulationInfo( // GridSteps: this value can't be derived from a DR?
gw::LrfhssModulationInfo { ..Default::default()
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(()) Ok(())
} }
@ -176,7 +174,7 @@ pub fn get_start_location(rx_info: &[gw::UplinkRxInfo]) -> Option<common::Locati
.cloned() .cloned()
.filter(|i| i.location.is_some()) .filter(|i| i.location.is_some())
.collect(); .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 with_loc
.first() .first()
.map(|i| i.location.as_ref().unwrap().clone()) .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<()> { pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -> Result<()> {
let metadata = &uplink let rx_info = &uplink
.rx_info .rx_info
.get(0) .get(0)
.context("Unable to get first item from rx_info")? .context("Unable to get first item from rx_info")?;
.metadata;
let region_name = metadata let region_name = rx_info
.get("region_name") .get_metadata_string("region_name")
.context("No region_name in metadata")? .ok_or(anyhow!("No region_name in metadata"))?;
.clone();
let common_name = &metadata let common_name = rx_info
.get("region_common_name") .get_metadata_string("region_common_name")
.context("No region_common_name in metadata")?; .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 { let mut uplink = UplinkFrameSet {
uplink_set_id: deduplication_id, 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<()> { async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
for rx_info in &mut ufs.rx_info_set { 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 { let gw_meta = match gateway::get_meta(&gw_id).await {
Ok(v) => v, Ok(v) => v,
Err(e) => { 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(); let mut rx_info_set: Vec<gw::UplinkRxInfo> = Vec::new();
for rx_info in &uplink.rx_info_set { 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 let region_name = rx_info
.metadata .get_metadata_string("region_name")
.get(&"region_name".to_string())
.ok_or(anyhow!("No region_name in rx_info metadata"))?; .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 if !(*uplink
.gateway_private_map .gateway_private_map