@@ -220,20 +220,32 @@ int ws_management_fhss_timing_configure(
220
220
if (!cur || !ws_info (cur )) {
221
221
return -1 ;
222
222
}
223
- if (fhss_uc_dwell_interval > 0 ) {
223
+
224
+ if (fhss_uc_dwell_interval && fhss_uc_dwell_interval < 15 ) {
225
+ return -2 ;
226
+ }
227
+
228
+ if (fhss_bc_dwell_interval && fhss_bc_dwell_interval < 15 ) {
229
+ return -2 ;
230
+ }
231
+
232
+ bool updated_configure = false;
233
+
234
+ if (fhss_uc_dwell_interval > 0 && cur -> ws_info -> fhss_uc_dwell_interval != fhss_uc_dwell_interval ) {
224
235
cur -> ws_info -> fhss_uc_dwell_interval = fhss_uc_dwell_interval ;
236
+ updated_configure = true;
225
237
}
226
- if (fhss_broadcast_interval > 0 ) {
238
+ if (fhss_broadcast_interval > 0 && cur -> ws_info -> fhss_bc_interval != fhss_broadcast_interval ) {
227
239
cur -> ws_info -> fhss_bc_interval = fhss_broadcast_interval ;
228
-
240
+ updated_configure = true;
229
241
}
230
- if (fhss_bc_dwell_interval > 0 ) {
242
+ if (fhss_bc_dwell_interval > 0 && cur -> ws_info -> fhss_bc_dwell_interval != fhss_bc_dwell_interval ) {
231
243
cur -> ws_info -> fhss_bc_dwell_interval = fhss_bc_dwell_interval ;
232
-
244
+ updated_configure = true;
233
245
}
234
246
235
247
// if settings change reset_restart for the settings needed
236
- if (cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) {
248
+ if (updated_configure && ( cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) ) {
237
249
// bootstrap active need to restart
238
250
ws_bootstrap_restart (interface_id );
239
251
}
@@ -259,23 +271,38 @@ int ws_management_fhss_unicast_channel_function_configure(
259
271
return -2 ;
260
272
}
261
273
274
+ if (dwell_interval && dwell_interval < 15 ) {
275
+ return -2 ;
276
+ }
277
+
262
278
if (channel_function == WS_FIXED_CHANNEL && fixed_channel == 0xffff ) {
263
279
fixed_channel = 0 ;
264
280
tr_warn ("Fixed channel not configured. Set to 0" );
265
281
}
266
282
283
+ bool updated_config = false;
284
+
285
+ if (cur -> ws_info -> fhss_uc_channel_function != channel_function ) {
286
+ cur -> ws_info -> fhss_uc_channel_function = channel_function ;
287
+ updated_config = true;
288
+ }
267
289
268
- cur -> ws_info -> fhss_uc_channel_function = channel_function ;
269
290
if (cur -> ws_info -> fhss_uc_channel_function == WS_FIXED_CHANNEL ) {
270
- cur -> ws_info -> fhss_uc_fixed_channel = fixed_channel ;
291
+ if (cur -> ws_info -> fhss_uc_fixed_channel != fixed_channel ) {
292
+ cur -> ws_info -> fhss_uc_fixed_channel = fixed_channel ;
293
+ updated_config = true;
294
+ }
271
295
} else {
272
296
cur -> ws_info -> fhss_uc_fixed_channel = 0xffff ;
273
297
}
274
298
275
- cur -> ws_info -> fhss_uc_dwell_interval = dwell_interval ;
299
+ if (dwell_interval && cur -> ws_info -> fhss_uc_dwell_interval != dwell_interval ) {
300
+ cur -> ws_info -> fhss_uc_dwell_interval = dwell_interval ;
301
+ updated_config = true;
302
+ }
276
303
277
304
// if settings change reset_restart for the settings needed
278
- if (cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) {
305
+ if (updated_config && ( cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) ) {
279
306
// bootstrap active need to restart
280
307
ws_bootstrap_restart (interface_id );
281
308
}
@@ -303,23 +330,43 @@ int ws_management_fhss_broadcast_channel_function_configure(
303
330
return -2 ;
304
331
}
305
332
333
+ if (dwell_interval && dwell_interval < 15 ) {
334
+ return -2 ;
335
+ }
336
+
306
337
if (channel_function == WS_FIXED_CHANNEL && fixed_channel == 0xffff ) {
307
338
fixed_channel = 0 ;
308
339
tr_warn ("Fixed channel not configured. Set to 0" );
309
340
}
310
341
311
- cur -> ws_info -> fhss_bc_channel_function = channel_function ;
342
+ bool updated_config = false;
343
+
344
+ if (cur -> ws_info -> fhss_bc_channel_function != channel_function ) {
345
+ cur -> ws_info -> fhss_bc_channel_function = channel_function ;
346
+ updated_config = true;
347
+ }
348
+
312
349
if (cur -> ws_info -> fhss_bc_channel_function == WS_FIXED_CHANNEL ) {
313
- cur -> ws_info -> fhss_bc_fixed_channel = fixed_channel ;
350
+ if (cur -> ws_info -> fhss_bc_fixed_channel != fixed_channel ) {
351
+ cur -> ws_info -> fhss_bc_fixed_channel = fixed_channel ;
352
+ updated_config = true;
353
+ }
314
354
} else {
315
355
cur -> ws_info -> fhss_bc_fixed_channel = 0xffff ;
316
356
}
317
357
318
- cur -> ws_info -> fhss_bc_dwell_interval = dwell_interval ;
319
- cur -> ws_info -> fhss_bc_interval = broadcast_interval ;
358
+ if (dwell_interval > 0 && cur -> ws_info -> fhss_bc_dwell_interval != dwell_interval ) {
359
+ cur -> ws_info -> fhss_bc_dwell_interval = dwell_interval ;
360
+ updated_config = true;
361
+ }
362
+
363
+ if (broadcast_interval > 0 && cur -> ws_info -> fhss_bc_interval != broadcast_interval ) {
364
+ cur -> ws_info -> fhss_bc_interval = broadcast_interval ;
365
+ updated_config = true;
366
+ }
320
367
321
368
// if settings change reset_restart for the settings needed
322
- if (cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) {
369
+ if (updated_config && ( cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) ) {
323
370
// bootstrap active need to restart
324
371
ws_bootstrap_restart (interface_id );
325
372
}
0 commit comments