@@ -183,6 +183,21 @@ static int ws_bootstrap_tasklet_init(protocol_interface_info_entry_t *cur)
183
183
184
184
return 0 ;
185
185
}
186
+ static void ws_nwk_event_post (protocol_interface_info_entry_t * cur , arm_nwk_interface_status_type_e posted_event )
187
+ {
188
+ arm_event_s event = {
189
+ .receiver = cur -> net_start_tasklet ,
190
+ .sender = protocol_read_tasklet_id (), /**< Event sender Tasklet ID */
191
+ .event_type = ARM_LIB_NWK_INTERFACE_EVENT ,
192
+ .event_data = posted_event ,
193
+ .event_id = (int8_t ) cur -> id ,
194
+ .data_ptr = NULL ,
195
+ .priority = ARM_LIB_LOW_PRIORITY_EVENT ,
196
+ };
197
+ if (eventOS_event_send (& event ) != 0 ) {
198
+ tr_error ("nwk_net_event_post(): event send failed" );
199
+ }
200
+ }
186
201
187
202
static int8_t ws_bootsrap_event_trig (ws_bootsrap_event_type_e event_type , int8_t interface_id , arm_library_event_priority_e priority , void * event_data )
188
203
{
@@ -1966,6 +1981,13 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur)
1966
1981
trickle_inconsistent_heard (& cur -> ws_info -> trickle_pan_advertisement_solicit , & cur -> ws_info -> trickle_params_pan_discovery );
1967
1982
}
1968
1983
1984
+ if ((cur -> lowpan_info & INTERFACE_NWK_BOOTSRAP_ACTIVE ) != INTERFACE_NWK_BOOTSRAP_ACTIVE ) {
1985
+ // we have sent bootstrap ready event and now
1986
+ // restarted discovery so bootstrap down event is sent
1987
+ cur -> lowpan_info |= INTERFACE_NWK_BOOTSRAP_ACTIVE ;
1988
+ ws_nwk_event_post (cur , ARM_NWK_NWK_CONNECTION_DOWN );
1989
+ }
1990
+
1969
1991
// Discovery statemachine is checkked after two trickle interval
1970
1992
cur -> bootsrap_state_machine_cnt = 2 * cur -> ws_info -> trickle_params_pan_discovery .Imin + randLIB_get_8bit () % 50 ;
1971
1993
}
0 commit comments