@@ -215,48 +215,88 @@ bool ClassFlowLoRaWAN::ReadParameter(FILE* pfile, string& aktparamgraph)
215
215
// OTAA parameters
216
216
if ((toUpper (_param) == " JOINEUI" ) && (splitted.size () > 1 ))
217
217
{
218
- this ->joinEUI = std::strtoull (splitted[1 ].c_str (),NULL ,16 );
218
+ if (splitted[1 ] != " undefined" ) {
219
+ this ->joinEUI = std::strtoull (splitted[1 ].c_str (),NULL ,16 );
220
+ } else {
221
+ this ->joinEUI = NULL ;
222
+ }
219
223
}
220
224
if ((toUpper (_param) == " DEVEUI" ) && (splitted.size () > 1 ))
221
225
{
222
- this ->devEUI = std::strtoull (splitted[1 ].c_str (),NULL ,16 );
226
+ if (splitted[1 ] != " undefined" ) {
227
+ this ->devEUI = std::strtoull (splitted[1 ].c_str (),NULL ,16 );
228
+ } else {
229
+ this ->devEUI = NULL ;
230
+ }
223
231
}
224
232
if ((toUpper (_param) == " NWKKEY" ) && (splitted.size () > 1 ))
225
- {
226
- std::vector<uint8_t > nwkKeyVector = hexStringToByteArray (splitted[1 ]);
227
- this ->nwkKey = new uint8_t [16 ];
228
- copy (nwkKeyVector.begin (), nwkKeyVector.end (), this ->nwkKey );
233
+ {
234
+ if (splitted[1 ] != " undefined" ) {
235
+ this ->nwkKey = new uint8_t [16 ];
236
+ std::vector<uint8_t > nwkKeyVector = hexStringToByteArray (splitted[1 ]);
237
+ copy (nwkKeyVector.begin (), nwkKeyVector.end (), this ->nwkKey );
238
+ } else {
239
+ this ->nwkKey = NULL ;
240
+ }
229
241
}
230
242
if ((toUpper (_param) == " APPKEY" ) && (splitted.size () > 1 ))
231
- {
232
- std::vector<uint8_t > appKeyVector = hexStringToByteArray (splitted[1 ]);
233
- this ->appKey = new uint8_t [16 ];
234
- copy (appKeyVector.begin (), appKeyVector.end (), this ->appKey );
243
+ {
244
+ if (splitted[1 ] != " undefined" ) {
245
+ this ->appKey = new uint8_t [16 ];
246
+ std::vector<uint8_t > appKeyVector = hexStringToByteArray (splitted[1 ]);
247
+ copy (appKeyVector.begin (), appKeyVector.end (), this ->appKey );
248
+ } else {
249
+ this ->appKey = NULL ;
250
+ }
235
251
}
236
252
// ABP parameters
237
253
if ((toUpper (_param) == " DEVADDR" ) && (splitted.size () > 1 ))
238
254
{
239
- this ->devAddr = std::strtoull (splitted[1 ].c_str (),NULL ,16 );
255
+ if (splitted[1 ] != " undefined" ) {
256
+ this ->devAddr = std::strtoull (splitted[1 ].c_str (),NULL ,16 );
257
+ } else {
258
+ this ->devAddr = NULL ;
259
+ }
240
260
}
241
261
if ((toUpper (_param) == " FNWKSINTKEY" ) && (splitted.size () > 1 ))
242
262
{
243
- std::vector<uint8_t > fNwkSIntKeyVector = hexStringToByteArray (splitted[1 ]);
244
- copy (fNwkSIntKeyVector .begin (), fNwkSIntKeyVector .end (), this ->fNwkSIntKey );
263
+ if (splitted[1 ] != " undefined" ) {
264
+ this ->fNwkSIntKey = new uint8_t [16 ];
265
+ std::vector<uint8_t > fNwkSIntKeyVector = hexStringToByteArray (splitted[1 ]);
266
+ copy (fNwkSIntKeyVector .begin (), fNwkSIntKeyVector .end (), this ->fNwkSIntKey );
267
+ } else {
268
+ this ->fNwkSIntKey = NULL ;
269
+ }
245
270
}
246
271
if ((toUpper (_param) == " SNWKSINTKEY" ) && (splitted.size () > 1 ))
247
- {
248
- std::vector<uint8_t > sNwkSIntKeyVector = hexStringToByteArray (splitted[1 ]);
249
- copy (sNwkSIntKeyVector .begin (), sNwkSIntKeyVector .end (), this ->sNwkSIntKey );
272
+ {
273
+ if (splitted[1 ] != " undefined" ) {
274
+ this ->sNwkSIntKey = new uint8_t [16 ];
275
+ std::vector<uint8_t > sNwkSIntKeyVector = hexStringToByteArray (splitted[1 ]);
276
+ copy (sNwkSIntKeyVector .begin (), sNwkSIntKeyVector .end (), this ->sNwkSIntKey );
277
+ } else {
278
+ this ->sNwkSIntKey = NULL ;
279
+ }
250
280
}
251
281
if ((toUpper (_param) == " NWKSENCKEY" ) && (splitted.size () > 1 ))
252
- {
253
- std::vector<uint8_t > nwkSEncKeyVector = hexStringToByteArray (splitted[1 ]);
254
- copy (nwkSEncKeyVector.begin (), nwkSEncKeyVector.end (), this ->nwkSEncKey );
282
+ {
283
+ if (splitted[1 ] != " undefined" ) {
284
+ this ->nwkSEncKey = new uint8_t [16 ];
285
+ std::vector<uint8_t > nwkSEncKeyVector = hexStringToByteArray (splitted[1 ]);
286
+ copy (nwkSEncKeyVector.begin (), nwkSEncKeyVector.end (), this ->nwkSEncKey );
287
+ } else {
288
+ this ->nwkSEncKey = NULL ;
289
+ }
255
290
}
256
291
if ((toUpper (_param) == " APPSKEY" ) && (splitted.size () > 1 ))
257
- {
258
- std::vector<uint8_t > appSKeyVector = hexStringToByteArray (splitted[1 ]);
259
- copy (appSKeyVector.begin (), appSKeyVector.end (), this ->appSKey );
292
+ {
293
+ if (splitted[1 ] != " undefined" ) {
294
+ this ->appSKey = new uint8_t [16 ];
295
+ std::vector<uint8_t > appSKeyVector = hexStringToByteArray (splitted[1 ]);
296
+ copy (appSKeyVector.begin (), appSKeyVector.end (), this ->appSKey );
297
+ } else {
298
+ this ->appSKey = NULL ;
299
+ }
260
300
}
261
301
}
262
302
0 commit comments