2626#include  "randLIB.h" 
2727#include  "common_functions.h" 
2828#include  "mac_common_defines.h" 
29+ #include  "sw_mac.h" 
2930#include  "NWK_INTERFACE/Include/protocol.h" 
3031#include  "6LoWPAN/Bootstraps/protocol_6lowpan.h" 
3132#include  "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h" 
@@ -137,8 +138,23 @@ static int8_t ws_bootsrap_event_trig(ws_bootsrap_event_type_e event_type, int8_t
137138    return  eventOS_event_send (& event );
138139}
139140
141+ static  int8_t  ws_enable_fhss (protocol_interface_info_entry_t  * cur )
142+ {
143+     fhss_ws_configuration_t  fhss_configuration ;
144+     fhss_configuration .bsi  =  cur -> ws_info -> hopping_schdule .fhss_bsi ;
145+     memcpy (fhss_configuration .channel_mask , cur -> ws_info -> hopping_schdule .channel_mask , sizeof (uint32_t ) *  8 );
146+     fhss_configuration .fhss_bc_dwell_interval  =  cur -> ws_info -> hopping_schdule .fhss_bc_dwell_interval ;
147+     fhss_configuration .fhss_broadcast_interval  =  cur -> ws_info -> hopping_schdule .fhss_broadcast_interval ;
148+     fhss_configuration .fhss_uc_dwell_interval  =  cur -> ws_info -> hopping_schdule .fhss_uc_dwell_interval ;
149+     fhss_configuration .ws_channel_function  =  cur -> ws_info -> hopping_schdule .channel_function ;
150+     fhss_api_t  * fhss_api  =  ns_fhss_ws_create (& fhss_configuration , cur -> ws_info -> fhss_timer_ptr );
151+     if  (fhss_api ) {
152+         ns_sw_mac_fhss_register (cur -> mac_api , fhss_api );
153+     }
154+     return  0 ;
155+ }
140156
141-   static  int8_t  ws_bootstrap_up (protocol_interface_info_entry_t  * cur )
157+ static  int8_t  ws_bootstrap_up (protocol_interface_info_entry_t  * cur )
142158{
143159    int8_t  ret_val  =  -1 ;
144160
@@ -150,7 +166,7 @@ static int8_t ws_bootsrap_event_trig(ws_bootsrap_event_type_e event_type, int8_t
150166        tr_debug ("Interface not yet fully configured" );
151167        return  -5 ;
152168    }
153- 
169+      ws_enable_fhss ( cur ); 
154170
155171    addr_interface_set_ll64 (cur , NULL );
156172    cur -> nwk_nd_re_scan_count  =  0 ;
@@ -921,7 +937,7 @@ static void ws_bootstrap_pan_advert_solicit(protocol_interface_info_entry_t *cur
921937    for  (int  i = 0 ; i < 8 ; i ++ ) {
922938        async_req .channel_list .channel_mask [i ] =  cur -> ws_info -> hopping_schdule .channel_mask [i ];
923939    }
924-     async_req .channel_list .channel_page  =  CHANNEL_PAGE_0 ;
940+     async_req .channel_list .channel_page  =  CHANNEL_PAGE_10 ;
925941    async_req .security .SecurityLevel  =  0 ;
926942
927943    ws_llc_asynch_request (cur , & async_req );
@@ -939,7 +955,7 @@ static void ws_bootstrap_pan_config_solicit(protocol_interface_info_entry_t *cur
939955    for  (int  i = 0 ; i < 8 ; i ++ ) {
940956        async_req .channel_list .channel_mask [i ] =  cur -> ws_info -> hopping_schdule .channel_mask [i ];
941957    }
942-     async_req .channel_list .channel_page  =  CHANNEL_PAGE_0 ;
958+     async_req .channel_list .channel_page  =  CHANNEL_PAGE_10 ;
943959    async_req .security .SecurityLevel  =  0 ;
944960
945961    ws_llc_asynch_request (cur , & async_req );
@@ -958,7 +974,7 @@ static void ws_bootstrap_pan_advert(protocol_interface_info_entry_t *cur)
958974    for  (int  i = 0 ; i < 8 ; i ++ ) {
959975        async_req .channel_list .channel_mask [i ] =  cur -> ws_info -> hopping_schdule .channel_mask [i ];
960976    }
961-     async_req .channel_list .channel_page  =  CHANNEL_PAGE_0 ;
977+     async_req .channel_list .channel_page  =  CHANNEL_PAGE_10 ;
962978    async_req .security .SecurityLevel  =  0 ;
963979
964980    ws_llc_asynch_request (cur , & async_req );
@@ -980,7 +996,7 @@ static void ws_bootstrap_pan_config(protocol_interface_info_entry_t *cur)
980996    for  (int  i = 0 ; i < 8 ; i ++ ) {
981997        async_req .channel_list .channel_mask [i ] =  cur -> ws_info -> hopping_schdule .channel_mask [i ];
982998    }
983-     async_req .channel_list .channel_page  =  CHANNEL_PAGE_0 ;
999+     async_req .channel_list .channel_page  =  CHANNEL_PAGE_10 ;
9841000    async_req .security .SecurityLevel  =  mac_helper_default_security_level_get (cur );
9851001    async_req .security .KeyIdMode  =  mac_helper_default_security_key_id_mode_get (cur );
9861002    async_req .security .KeyIndex  =  mac_helper_default_key_index_get (cur );
0 commit comments