/*---------------------------------------------------------------------------*/ PROCESS_THREAD(receiver_node_process, ev, data) { static struct etimer et; static struct uip_ds6_notification n; uip_ipaddr_t *ipaddr; PROCESS_BEGIN(); ipaddr = set_global_address(); uip_ds6_notification_add(&n, route_callback); simple_udp_register(&unicast_connection, UDP_PORT, NULL, UDP_PORT, receiver); etimer_set(&et, CLOCK_SECOND); while(1) { PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); etimer_reset(&et); if(should_blink) { leds_on(LEDS_ALL); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); etimer_reset(&et); leds_off(LEDS_ALL); } } PROCESS_END(); }
/*---------------------------------------------------------------------------*/ void simple_rpl_init(void) { to_become_root = 0; set_global_address(); uip_ds6_notification_add(&n, route_callback); }
void node_info_init(void) { memset(node_info_table, 0, sizeof(node_info_table)); uip_ds6_notification_add(&node_info_route_notification, node_info_route_notification_cb); }
/*---------------------------------------------------------------------------*/ void rpl_dag_root_init(void) { static uint8_t initialized = 0; if(!initialized) { to_become_root = 0; set_global_address(); uip_ds6_notification_add(&n, route_callback); initialized = 1; } }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(mesh_node_process, ev, data) { static struct uip_ds6_notification n; PROCESS_BEGIN(); leds_on(LEDS_ALL); uip_ds6_notification_add(&n, route_callback); while(1) { PROCESS_WAIT_EVENT(); } PROCESS_END(); }
/*---------------------------------------------------------------------------*/ void rpl_dag_root_init(void) { static uint8_t initialized = 0; if(!initialized) { to_become_root = 0; set_global_address(); #if (UIP_CONF_MAX_ROUTES != 0) uip_ds6_notification_add(&n, route_callback); #endif /* (UIP_CONF_MAX_ROUTES != 0) */ initialized = 1; } }
void cetic_6lbr_start_delayed_dodag_root(int send_dis) { if(rpl_can_become_root && is_own_dodag()) { LOG6LBR_INFO("Own DODAG already existing\n"); cetic_6lbr_start_dodag_root(); } else { dodag_root_check_interval = rpl_wait_delay / 2 + random_rand() % (rpl_wait_delay / 2); LOG6LBR_INFO("Wait for potential DODAGs\n"); ctimer_set(&create_dodag_root_timer, dodag_root_check_interval, check_dodag_creation, NULL); uip_ds6_notification_add(&create_dodag_root_route_callback, route_callback); if(send_dis) { dis_output(NULL); } } }