@@ -451,28 +451,30 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
451
451
*/
452
452
static void ws_bootstrap_primary_parent_set (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info )
453
453
{
454
- if (neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_dwell_interval == 0 ||
455
- neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_interval == 0 ) {
456
- tr_debug ("Parent synch fail by missing BT information" );
454
+
455
+ fhss_ws_configuration_t fhss_configuration ;
456
+ if (!neighbor_info -> ws_neighbor -> broadcast_timing_info_stored ) {
457
+ tr_error ("No BC timing info for set new parent" );
457
458
return ;
458
459
}
459
460
460
-
461
- fhss_ws_configuration_t fhss_configuration ;
462
461
memcpy (& fhss_configuration , ns_fhss_ws_configuration_get (cur -> ws_info -> fhss_api ), sizeof (fhss_ws_configuration_t ));
463
462
464
463
ws_fhss_set_defaults (cur , & fhss_configuration );
465
464
466
465
// Learning broadcast network configuration
467
- fhss_configuration .ws_bc_channel_function = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_channel_function ;
468
- if (fhss_configuration .ws_bc_channel_function == WS_FIXED_CHANNEL ) {
469
- cur -> ws_info -> hopping_schdule .bc_fixed_channel = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .fixed_channel ;
466
+ if (neighbor_info -> ws_neighbor -> broadcast_shedule_info_stored ) {
467
+ fhss_configuration .ws_bc_channel_function = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_channel_function ;
468
+ if (fhss_configuration .ws_bc_channel_function == WS_FIXED_CHANNEL ) {
469
+ cur -> ws_info -> hopping_schdule .bc_fixed_channel = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .fixed_channel ;
470
+ }
471
+ fhss_configuration .bsi = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_schedule_id ;
472
+ fhss_configuration .fhss_bc_dwell_interval = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_dwell_interval ;
473
+ fhss_configuration .fhss_broadcast_interval = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_interval ;
474
+ fhss_configuration .broadcast_fixed_channel = cur -> ws_info -> fhss_bc_fixed_channel ;
475
+
470
476
}
471
- fhss_configuration .bsi = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_schedule_id ;
472
- fhss_configuration .fhss_bc_dwell_interval = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_dwell_interval ;
473
- fhss_configuration .fhss_broadcast_interval = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_interval ;
474
477
fhss_configuration .unicast_fixed_channel = cur -> ws_info -> fhss_uc_fixed_channel ;
475
- fhss_configuration .broadcast_fixed_channel = cur -> ws_info -> fhss_bc_fixed_channel ;
476
478
ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
477
479
478
480
// We have broadcast schedule set up set the broadcast parent schedule
@@ -506,11 +508,32 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr
506
508
ws_neighbor_class_entry_t * ws_neighbour = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , attribute_index );
507
509
etx_storage_t * etx_entry = etx_storage_entry_get (interface -> id , attribute_index );
508
510
509
- if (!ws_neighbour || !etx_entry || etx_entry -> etx_samples < 1 ||
510
- !ws_neighbour -> candidate_parent ) {
511
- // if RSL value is not good enough candidate parent flag is removed and device not accepted as parent
512
- //tr_debug("ws_etx_read not valid parent");
513
- return 0xffff ;
511
+ if (interface -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
512
+ if (!ws_neighbour || !etx_entry ) {
513
+ return 0xffff ;
514
+ }
515
+ } else {
516
+
517
+ if (!ws_neighbour || !etx_entry || etx_entry -> etx_samples < 1 ||
518
+ !ws_neighbour -> candidate_parent ) {
519
+ // if RSL value is not good enough candidate parent flag is removed and device not accepted as parent
520
+ //tr_debug("ws_etx_read not valid parent");
521
+ return 0xffff ;
522
+ }
523
+
524
+ //If we are not following gbobal Broadcast synch
525
+ if (!interface -> ws_info -> pan_information .use_parent_bs ) {
526
+ //We must know both information's here
527
+ if (!ws_neighbour -> broadcast_shedule_info_stored ||
528
+ !ws_neighbour -> broadcast_timing_info_stored ) {
529
+ return 0xffff ;
530
+ }
531
+ } else {
532
+ if (!ws_neighbour -> broadcast_timing_info_stored ) {
533
+ //Global shedule is stored already
534
+ return 0xffff ;
535
+ }
536
+ }
514
537
}
515
538
516
539
etx = etx_local_etx_read (interface -> id ,attribute_index );
@@ -875,12 +898,21 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
875
898
return ;
876
899
}
877
900
}
901
+
902
+
878
903
}
879
904
880
905
if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
881
906
//Border router does not learn network information
882
907
return ;
883
908
}
909
+
910
+ //Update synch to primary parent allways to update broadcast shedule and timing
911
+ if (neighbor_info .neighbor -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
912
+ // RPL priority parent configuration we must update FHSS data
913
+ ws_bootstrap_primary_parent_set (cur , & neighbor_info );
914
+ }
915
+
884
916
if (cur -> ws_info -> configuration_learned &&
885
917
cur -> ws_info -> pan_information .pan_version == pan_version ) {
886
918
// No new information
@@ -907,8 +939,8 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
907
939
// set neighbor as priority parent clear if there is others
908
940
protocol_6lowpan_neighbor_priority_clear_all (cur -> id , PRIORITY_1ST );
909
941
neighbor_info .neighbor -> link_role = PRIORITY_PARENT_NEIGHBOUR ;
910
- } else if (neighbor_info .neighbor -> link_role = = PRIORITY_PARENT_NEIGHBOUR ) {
911
- // RPL priority parent configuration we must update FHSS data
942
+ } else if (neighbor_info .neighbor -> link_role ! = PRIORITY_PARENT_NEIGHBOUR ) {
943
+ //This cuold affect serious problem if BC parameters are changed
912
944
ws_bootstrap_primary_parent_set (cur , & neighbor_info );
913
945
}
914
946
}
0 commit comments