114 NS_LOG_FUNCTION_NOARGS();
121 uint8_t fCtl = start.ReadU8();
122 m_adr = (fCtl >> 6) & 0b1;
124 m_ack = (fCtl >> 4) & 0b1;
129 NS_LOG_DEBUG(
"Deserialized data: ");
130 NS_LOG_DEBUG(
"Address: " <<
m_address.Print());
131 NS_LOG_DEBUG(
"ADR: " <<
unsigned(
m_adr));
132 NS_LOG_DEBUG(
"ADRAckReq: " <<
unsigned(
m_adrAckReq));
133 NS_LOG_DEBUG(
"Ack: " <<
unsigned(
m_ack));
134 NS_LOG_DEBUG(
"fPending: " <<
unsigned(
m_fPending));
135 NS_LOG_DEBUG(
"fOptsLen: " <<
unsigned(
m_fOptsLen));
136 NS_LOG_DEBUG(
"fCnt: " <<
unsigned(
m_fCnt));
139 NS_LOG_DEBUG(
"Starting deserialization of MAC commands");
140 for (uint8_t byteNumber = 0; byteNumber <
m_fOptsLen;)
142 uint8_t cid = start.PeekU8();
143 NS_LOG_DEBUG(
"CID: " <<
unsigned(cid));
156 NS_LOG_DEBUG(
"Creating a LinkCheckReq command");
157 Ptr<LinkCheckReq> command = CreateObject<LinkCheckReq>();
158 byteNumber += command->Deserialize(start);
163 NS_LOG_DEBUG(
"Creating a LinkAdrAns command");
164 Ptr<LinkAdrAns> command = CreateObject<LinkAdrAns>();
165 byteNumber += command->Deserialize(start);
170 NS_LOG_DEBUG(
"Creating a DutyCycleAns command");
171 Ptr<DutyCycleAns> command = CreateObject<DutyCycleAns>();
172 byteNumber += command->Deserialize(start);
177 NS_LOG_DEBUG(
"Creating a RxParamSetupAns command");
178 Ptr<RxParamSetupAns> command = CreateObject<RxParamSetupAns>();
179 byteNumber += command->Deserialize(start);
184 NS_LOG_DEBUG(
"Creating a DevStatusAns command");
185 Ptr<DevStatusAns> command = CreateObject<DevStatusAns>();
186 byteNumber += command->Deserialize(start);
191 NS_LOG_DEBUG(
"Creating a NewChannelAns command");
192 Ptr<NewChannelAns> command = CreateObject<NewChannelAns>();
193 byteNumber += command->Deserialize(start);
198 NS_LOG_DEBUG(
"Creating a RxTimingSetupAns command");
199 Ptr<RxTimingSetupAns> command = CreateObject<RxTimingSetupAns>();
200 byteNumber += command->Deserialize(start);
205 NS_LOG_DEBUG(
"Creating a TxParamSetupAns command");
206 Ptr<TxParamSetupAns> command = CreateObject<TxParamSetupAns>();
207 byteNumber += command->Deserialize(start);
212 NS_LOG_DEBUG(
"Creating a DlChannelAns command");
213 Ptr<DlChannelAns> command = CreateObject<DlChannelAns>();
214 byteNumber += command->Deserialize(start);
219 NS_LOG_ERROR(
"CID not recognized during deserialization");
230 NS_LOG_DEBUG(
"Creating a LinkCheckAns command");
231 Ptr<LinkCheckAns> command = CreateObject<LinkCheckAns>();
232 byteNumber += command->Deserialize(start);
237 NS_LOG_DEBUG(
"Creating a LinkAdrReq command");
238 Ptr<LinkAdrReq> command = CreateObject<LinkAdrReq>();
239 byteNumber += command->Deserialize(start);
244 NS_LOG_DEBUG(
"Creating a DutyCycleReq command");
245 Ptr<DutyCycleReq> command = CreateObject<DutyCycleReq>();
246 byteNumber += command->Deserialize(start);
251 NS_LOG_DEBUG(
"Creating a RxParamSetupReq command");
252 Ptr<RxParamSetupReq> command = CreateObject<RxParamSetupReq>();
253 byteNumber += command->Deserialize(start);
258 NS_LOG_DEBUG(
"Creating a DevStatusReq command");
259 Ptr<DevStatusReq> command = CreateObject<DevStatusReq>();
260 byteNumber += command->Deserialize(start);
265 NS_LOG_DEBUG(
"Creating a NewChannelReq command");
266 Ptr<NewChannelReq> command = CreateObject<NewChannelReq>();
267 byteNumber += command->Deserialize(start);
272 NS_LOG_DEBUG(
"Creating a RxTimingSetupReq command");
273 Ptr<RxTimingSetupReq> command = CreateObject<RxTimingSetupReq>();
274 byteNumber += command->Deserialize(start);
279 NS_LOG_DEBUG(
"Creating a TxParamSetupReq command");
280 Ptr<TxParamSetupReq> command = CreateObject<TxParamSetupReq>();
281 byteNumber += command->Deserialize(start);
286 NS_LOG_ERROR(
"CID not recognized during deserialization");
292 m_fPort = uint8_t(start.ReadU8());
459 std::list<int> enabledChannels,
462 NS_LOG_FUNCTION(
this <<
unsigned(dataRate) << txPower << repetitions);
464 uint16_t channelMask = 0;
465 for (
auto it = enabledChannels.begin(); it != enabledChannels.end(); it++)
467 NS_ASSERT((*it) < 16 && (*it) > -1);
469 channelMask |= 0b1 << (*it);
474 NS_LOG_DEBUG(
"Creating LinkAdrReq with: DR = " <<
unsigned(dataRate)
475 <<
" and txPower = " <<
unsigned(txPower));
477 Ptr<LinkAdrReq> command =
478 CreateObject<LinkAdrReq>(dataRate, txPower, channelMask, 0, repetitions);
522 NS_LOG_FUNCTION(
this <<
unsigned(rx1DrOffset) <<
unsigned(rx2DataRate) << frequency);
525 NS_ASSERT(0 <= rx1DrOffset && rx1DrOffset <= 5);
527 Ptr<RxParamSetupReq> command =
528 CreateObject<RxParamSetupReq>(rx1DrOffset, rx2DataRate, frequency);