Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4193,6 +4193,7 @@ Only the components for which the keys were meant, will have the key-encryption-
| `f_port` | [`uint32`](#uint32) | | |
| `frm_payload` | [`bytes`](#bytes) | | |
| `decoded_payload` | [`google.protobuf.Struct`](#google.protobuf.Struct) | | |
| `full_f_cnt` | [`uint32`](#uint32) | | Full 32-bit FCnt value. Used internally by Network Server. |

#### Field Rules

Expand Down
5 changes: 5 additions & 0 deletions api/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11400,6 +11400,11 @@
},
"decoded_payload": {
"type": "object"
},
"full_f_cnt": {
"type": "integer",
"format": "int64",
"description": "Full 32-bit FCnt value. Used internally by Network Server."
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions api/lorawan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ message MACPayload {
uint32 f_port = 2 [(validate.rules).uint32.lte = 255];
bytes frm_payload = 3 [(gogoproto.customname) = "FRMPayload"];
google.protobuf.Struct decoded_payload = 4;
// Full 32-bit FCnt value. Used internally by Network Server.
uint32 full_f_cnt = 5;
}

message FHDR {
Expand Down
6 changes: 3 additions & 3 deletions pkg/networkserver/adr.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ func lossRate(nbTrans uint32, ups ...*ttnpb.UplinkMessage) float32 {
return 0
}

min := ups[0].Payload.GetMACPayload().FHDR.FCnt
max := lastUplink(ups...).Payload.GetMACPayload().FHDR.FCnt
min := ups[0].Payload.GetMACPayload().FullFCnt
max := lastUplink(ups...).Payload.GetMACPayload().FullFCnt

fCnt := min + 1
var fCntTrans uint32
Expand All @@ -105,7 +105,7 @@ func lossRate(nbTrans uint32, ups ...*ttnpb.UplinkMessage) float32 {

loop:
for i := 0; i < len(ups); i++ {
switch v := ups[i].Payload.GetMACPayload().FHDR.FCnt; v {
switch v := ups[i].Payload.GetMACPayload().FullFCnt; v {
case min:
continue

Expand Down
3 changes: 2 additions & 1 deletion pkg/networkserver/adr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ func newADRUplink(fCnt uint32, maxSNR float32, gtwCount uint, confirmed bool, tx
FCtrl: ttnpb.FCtrl{
ADR: true,
},
FCnt: fCnt,
FCnt: fCnt & 0xffff,
},
FullFCnt: fCnt,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/networkserver/grpc_gsns.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ func (ns *NetworkServer) handleDataUplink(ctx context.Context, up *ttnpb.UplinkM
return err
}
ctx = matched.Context
pld.FCnt = matched.FCnt
pld.FullFCnt = matched.FCnt
up.DeviceChannelIndex = uint32(matched.ChannelIndex)
up.Settings.DataRateIndex = matched.DataRateIndex
ctx = log.NewContextWithFields(ctx, log.Fields(
Expand Down Expand Up @@ -950,7 +950,7 @@ func (ns *NetworkServer) handleDataUplink(ctx context.Context, up *ttnpb.UplinkM
matched = rematched

ctx = matched.Context
pld.FCnt = matched.FCnt
pld.FullFCnt = matched.FCnt
up.DeviceChannelIndex = uint32(matched.ChannelIndex)
up.Settings.DataRateIndex = matched.DataRateIndex
logger = log.FromContext(ctx).WithFields(log.Fields(
Expand Down
1 change: 1 addition & 0 deletions pkg/networkserver/networkserver_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ func MakeDataUplink(macVersion ttnpb.MACVersion, decodePayload, confirmed bool,
FHDR: fhdr,
FPort: uint32(fPort),
FRMPayload: frmPayload,
FullFCnt: fCnt,
},
},
}
Expand Down
23 changes: 23 additions & 0 deletions pkg/ttnpb/end_device.pb.paths.fm.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkg/ttnpb/gatewayserver.pb.paths.fm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/ttnpb/join.pb.paths.fm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

746 changes: 394 additions & 352 deletions pkg/ttnpb/lorawan.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/ttnpb/lorawan.pb.paths.fm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/ttnpb/lorawan.pb.setters.fm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/ttnpb/lorawan.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/ttnpb/messages.pb.paths.fm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/ttnpb/qrcodegenerator.pb.paths.fm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions sdk/js/generated/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -18224,6 +18224,16 @@
"fullType": "google.protobuf.Struct",
"ismap": false,
"defaultValue": ""
},
{
"name": "full_f_cnt",
"description": "Full 32-bit FCnt value. Used internally by Network Server.",
"label": "",
"type": "uint32",
"longType": "uint32",
"fullType": "uint32",
"ismap": false,
"defaultValue": ""
}
]
},
Expand Down