(t *testing.T)
| 31 | ) |
| 32 | |
| 33 | func TestLoRaWANEncodingMAC(t *testing.T) { |
| 34 | phy := test.Must(band.Get(band.EU_863_870, ttnpb.PHYVersion_RP001_V1_1_REV_B)) |
| 35 | |
| 36 | for _, tc := range []struct { |
| 37 | Name string |
| 38 | Payload interface { |
| 39 | MACCommand() *ttnpb.MACCommand |
| 40 | } |
| 41 | Bytes []byte |
| 42 | IsUplink bool |
| 43 | }{ |
| 44 | { |
| 45 | "ResetConf", |
| 46 | &ttnpb.MACCommand_ResetConf{MinorVersion: 1}, |
| 47 | []byte{0x01, 1}, |
| 48 | false, |
| 49 | }, |
| 50 | { |
| 51 | "ResetInd", |
| 52 | &ttnpb.MACCommand_ResetInd{MinorVersion: 1}, |
| 53 | []byte{0x01, 1}, |
| 54 | true, |
| 55 | }, |
| 56 | { |
| 57 | "ResetConf", |
| 58 | &ttnpb.MACCommand_ResetConf{MinorVersion: 1}, |
| 59 | []byte{0x01, 1}, |
| 60 | false, |
| 61 | }, |
| 62 | { |
| 63 | "LinkCheckReq", |
| 64 | ttnpb.MACCommandIdentifier_CID_LINK_CHECK, |
| 65 | []byte{0x02}, |
| 66 | true, |
| 67 | }, |
| 68 | { |
| 69 | "LinkCheckAns", |
| 70 | &ttnpb.MACCommand_LinkCheckAns{Margin: 20, GatewayCount: 3}, |
| 71 | []byte{0x02, 20, 3}, |
| 72 | false, |
| 73 | }, |
| 74 | { |
| 75 | "LinkADRReq", |
| 76 | &ttnpb.MACCommand_LinkADRReq{ |
| 77 | DataRateIndex: 0b0101, |
| 78 | TxPowerIndex: 0b0010, |
| 79 | ChannelMask: []bool{ |
| 80 | false, false, true, false, false, false, false, false, |
| 81 | false, true, false, false, false, false, false, false, |
| 82 | }, |
| 83 | ChannelMaskControl: 1, |
| 84 | NbTrans: 1, |
| 85 | }, |
| 86 | []byte{0x03, 0b0101_0010, 0b00000100, 0b00000010, 0b0_001_0001}, |
| 87 | false, |
| 88 | }, |
| 89 | { |
| 90 | "LinkADRAns", |
nothing calls this directly
no test coverage detected