Commit ad1c90a2 authored by Orne Brocaar's avatar Orne Brocaar
Browse files

Remote set mac-command set from scheduleNextQueueItemTasks.

Per LoRaWAN 1.0.4 specs, Class-C downlinks shall not transport any
mac-commands. This does also remove sending mac-commands for Class-B.

Closes #543.
parent c386dfda
......@@ -154,7 +154,6 @@ var scheduleNextQueueItemTasks = []func(*dataContext) error{
),
setToken,
getNextDeviceQueueItem,
setMACCommandsSet,
stopOnNothingToSend,
setPHYPayloads,
sendDownlinkFrame,
......@@ -1393,7 +1392,7 @@ func setPHYPayloads(ctx *dataContext) error {
// Set MIC.
// If this is an ACK, then FCntUp has already been incremented by one. If
// this is not an ACK, then DownlinkDataMIC will zero out ConfFCnt.
if err := phy.SetDownlinkDataMIC(ctx.DeviceSession.GetMACVersion(), ctx.DeviceSession.FCntUp - 1, ctx.DeviceSession.SNwkSIntKey); err != nil {
if err := phy.SetDownlinkDataMIC(ctx.DeviceSession.GetMACVersion(), ctx.DeviceSession.FCntUp-1, ctx.DeviceSession.SNwkSIntKey); err != nil {
return errors.Wrap(err, "set MIC error")
}
......
package testsuite
import (
"context"
"testing"
"github.com/stretchr/testify/require"
......@@ -182,51 +181,6 @@ func (ts *ClassCTestSuite) TestClassC() {
AssertNoDownlinkFrame,
},
},
{
Name: "containing mac-commands",
BeforeFunc: func(*DownlinkTest) error {
ts.ServiceProfile.DevStatusReqFreq = 1
if err := storage.UpdateServiceProfile(context.Background(), storage.DB(), ts.ServiceProfile); err != nil {
return err
}
if err := storage.FlushServiceProfileCache(context.Background(), ts.ServiceProfile.ID); err != nil {
return err
}
return nil
},
DeviceSession: *ts.DeviceSession,
DeviceQueueItems: []storage.DeviceQueueItem{
{DevEUI: ts.DeviceSession.DevEUI, FPort: 10, FCnt: 5, FRMPayload: []byte{5, 4, 3, 2, 1}},
},
Assert: []Assertion{
AssertFCntUp(8),
AssertNFCntDown(5),
AssertDownlinkFrame(ts.Gateway.GatewayID, txInfo, lorawan.PHYPayload{
MHDR: lorawan.MHDR{
MType: lorawan.UnconfirmedDataDown,
Major: lorawan.LoRaWANR1,
},
MIC: lorawan.MIC{115, 18, 33, 93},
MACPayload: &lorawan.MACPayload{
FHDR: lorawan.FHDR{
DevAddr: ts.DeviceSession.DevAddr,
FCnt: 5,
FCtrl: lorawan.FCtrl{
ADR: true,
},
FOpts: []lorawan.Payload{
&lorawan.MACCommand{CID: lorawan.CID(6)},
},
},
FPort: &fPortTen,
FRMPayload: []lorawan.Payload{
&lorawan.DataPayload{Bytes: []byte{5, 4, 3, 2, 1}},
},
},
}),
},
},
}
for _, tst := range tests {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment