/*---------------------------------------------------------------------------*/ void rime_init(const struct mac_driver *m) { queuebuf_init(); route_init(); packetbuf_clear(); neighbor_init(); announcement_init(); rime_mac = m; rime_mac->set_receive_function(input); chameleon_init(&chameleon_bitopt); #if ! RIME_CONF_NO_POLITE_ANNOUCEMENTS /* XXX This is initializes the transmission of announcements but it * is not currently certain where this initialization is supposed to * be. Also, the times are arbitrarily set for now. They should * either be configurable, or derived from some MAC layer property * (duty cycle, sleep time, or something similar). But this is OK * for now, and should at least get us started with experimenting * with announcements. */ polite_announcement_init(POLITE_ANNOUNCEMENT_CHANNEL, POLITE_ANNOUNCEMENT_START_TIME, POLITE_ANNOUNCEMENT_MAX_TIME); #endif /* ! RIME_CONF_NO_POLITE_ANNOUCEMENTS */ }
/*---------------------------------------------------------------------------*/ void collect_open(struct collect_conn *tc, uint16_t channels, const struct collect_callbacks *cb) { #if !COLLECT_ANNOUNCEMENTS neighbor_discovery_open(&tc->neighbor_discovery_conn, channels, CLOCK_SECOND * 2, CLOCK_SECOND * 10, CLOCK_SECOND * 60, &neighbor_discovery_callbacks); #endif /* !COLLECT_ANNOUNCEMENTS */ runicast_open(&tc->runicast_conn, channels + 1, &runicast_callbacks); channel_set_attributes(channels + 1, attributes); tc->rtmetric = RTMETRIC_MAX; tc->cb = cb; #if COLLECT_ANNOUNCEMENTS announcement_register(&tc->announcement, channels, tc->rtmetric, received_announcement); announcement_listen(2); #else neighbor_discovery_start(&tc->neighbor_discovery_conn, tc->rtmetric); #endif /* COLLECT_ANNOUNCEMENTS */ neighbor_init(); }