@@ -220,20 +220,32 @@ int ws_management_fhss_timing_configure(
220220 if (!cur || !ws_info (cur )) {
221221 return -1 ;
222222 }
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 ) {
224235 cur -> ws_info -> fhss_uc_dwell_interval = fhss_uc_dwell_interval ;
236+ updated_configure = true;
225237 }
226- if (fhss_broadcast_interval > 0 ) {
238+ if (fhss_broadcast_interval > 0 && cur -> ws_info -> fhss_bc_interval != fhss_broadcast_interval ) {
227239 cur -> ws_info -> fhss_bc_interval = fhss_broadcast_interval ;
228-
240+ updated_configure = true;
229241 }
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 ) {
231243 cur -> ws_info -> fhss_bc_dwell_interval = fhss_bc_dwell_interval ;
232-
244+ updated_configure = true;
233245 }
234246
235247 // 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 ) ) {
237249 // bootstrap active need to restart
238250 ws_bootstrap_restart (interface_id );
239251 }
@@ -259,23 +271,38 @@ int ws_management_fhss_unicast_channel_function_configure(
259271 return -2 ;
260272 }
261273
274+ if (dwell_interval && dwell_interval < 15 ) {
275+ return -2 ;
276+ }
277+
262278 if (channel_function == WS_FIXED_CHANNEL && fixed_channel == 0xffff ) {
263279 fixed_channel = 0 ;
264280 tr_warn ("Fixed channel not configured. Set to 0" );
265281 }
266282
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+ }
267289
268- cur -> ws_info -> fhss_uc_channel_function = channel_function ;
269290 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+ }
271295 } else {
272296 cur -> ws_info -> fhss_uc_fixed_channel = 0xffff ;
273297 }
274298
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+ }
276303
277304 // 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 ) ) {
279306 // bootstrap active need to restart
280307 ws_bootstrap_restart (interface_id );
281308 }
@@ -303,23 +330,43 @@ int ws_management_fhss_broadcast_channel_function_configure(
303330 return -2 ;
304331 }
305332
333+ if (dwell_interval && dwell_interval < 15 ) {
334+ return -2 ;
335+ }
336+
306337 if (channel_function == WS_FIXED_CHANNEL && fixed_channel == 0xffff ) {
307338 fixed_channel = 0 ;
308339 tr_warn ("Fixed channel not configured. Set to 0" );
309340 }
310341
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+
312349 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+ }
314354 } else {
315355 cur -> ws_info -> fhss_bc_fixed_channel = 0xffff ;
316356 }
317357
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+ }
320367
321368 // 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 ) ) {
323370 // bootstrap active need to restart
324371 ws_bootstrap_restart (interface_id );
325372 }
0 commit comments