@@ -451,28 +451,30 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
451451 */
452452static void ws_bootstrap_primary_parent_set (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info )
453453{
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" );
457458 return ;
458459 }
459460
460-
461- fhss_ws_configuration_t fhss_configuration ;
462461 memcpy (& fhss_configuration , ns_fhss_ws_configuration_get (cur -> ws_info -> fhss_api ), sizeof (fhss_ws_configuration_t ));
463462
464463 ws_fhss_set_defaults (cur , & fhss_configuration );
465464
466465 // 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+
470476 }
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 ;
474477 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 ;
476478 ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
477479
478480 // 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
506508 ws_neighbor_class_entry_t * ws_neighbour = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , attribute_index );
507509 etx_storage_t * etx_entry = etx_storage_entry_get (interface -> id , attribute_index );
508510
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+ }
514537 }
515538
516539 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
875898 return ;
876899 }
877900 }
901+
902+
878903 }
879904
880905 if (cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
881906 //Border router does not learn network information
882907 return ;
883908 }
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+
884916 if (cur -> ws_info -> configuration_learned &&
885917 cur -> ws_info -> pan_information .pan_version == pan_version ) {
886918 // No new information
@@ -907,8 +939,8 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
907939 // set neighbor as priority parent clear if there is others
908940 protocol_6lowpan_neighbor_priority_clear_all (cur -> id , PRIORITY_1ST );
909941 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
912944 ws_bootstrap_primary_parent_set (cur , & neighbor_info );
913945 }
914946}
0 commit comments