void application_main( Os::AppMainParameter& value ) { Radio *wiselib_radio_ = &wiselib::FacetProvider<Os, Radio>::get_facet( value ); Timer *wiselib_timer_ = &wiselib::FacetProvider<Os, Os::Timer>::get_facet( value ); Debug *wiselib_debug_ = &wiselib::FacetProvider<Os, Os::Debug>::get_facet( value ); Rand *wiselib_rand_ = &wiselib::FacetProvider<Os, Os::Rand>::get_facet( value ); Clock *wiselib_clock_ = &wiselib::FacetProvider<Os, Os::Clock>::get_facet( value ); wiselib_radio_->set_channel( PLTT_CHANNEL ); wiselib_rand_->srand( wiselib_radio_->id() ); #ifdef CONFIG_PLTT_TRACKER reliable_radio.init( *wiselib_radio_, *wiselib_timer_, *wiselib_debug_, *wiselib_clock_, *wiselib_rand_ ); tracker.init( *wiselib_radio_, reliable_radio, *wiselib_timer_, *wiselib_rand_, *wiselib_clock_, *wiselib_debug_ ); tracker.set_self( Node( wiselib_radio_->id(), Position( 0, 0, 0 ) ) ); tracker.enable(); #endif #ifdef CONFIG_PLTT_TARGET target.init( *wiselib_radio_, *wiselib_timer_, *wiselib_clock_, *wiselib_debug_ ); target.set_self( Node( wiselib_radio_->id(), Position( 0, 0, 0 ) ) ); #ifdef CONFIG_PLTT_PRIVACY target.set_request_id( PLTT_TARGET_PRIVACY_REQUEST_ID_1 ); Os::Uart *wiselib_uart_ = &wiselib::FacetProvider<Os, Os::Uart>::get_facet( value ); privacy.set_randomization(); privacy.init( *wiselib_radio_, *wiselib_debug_, *wiselib_uart_, *wiselib_timer_ ); target.reg_privacy_radio_callback<Privacy, &Privacy::radio_receive>( &privacy ); privacy.reg_privacy_callback<PLTT_Target, &PLTT_Target::randomize_callback>( 999, &target ); privacy.enable(); #endif target.enable(); #endif }
void application_main( Os::AppMainParameter& value ) { Radio *wiselib_radio_ = &wiselib::FacetProvider<Os, Radio>::get_facet( value ); Timer *wiselib_timer_ = &wiselib::FacetProvider<Os, Os::Timer>::get_facet( value ); Debug *wiselib_debug_ = &wiselib::FacetProvider<Os, Os::Debug>::get_facet( value ); Rand *wiselib_rand_ = &wiselib::FacetProvider<Os, Os::Rand>::get_facet( value ); Clock *wiselib_clock_ = &wiselib::FacetProvider<Os, Os::Clock>::get_facet( value ); wiselib_radio_->set_channel(20); wiselib_rand_->srand( wiselib_radio_->id() ); #ifdef PLTT_TRACKER tracker.init(*wiselib_radio_, *wiselib_timer_, *wiselib_rand_, *wiselib_clock_, *wiselib_debug_); tracker.set_self( Node( wiselib_radio_->id(), Position( 0, 0, 0 ) ) ); #ifdef PLTT_TRACKING_METRICS tracker.set_metrics_timer( TRACKER_TRACKING_METRICS_TIMER ); #endif tracker.enable(); #endif #ifdef PLTT_TARGET target.init( *wiselib_radio_, *wiselib_timer_, *wiselib_clock_, *wiselib_debug_ ); target.set_self( Node( wiselib_radio_->id(), Position( 0, 0, 0 ) ) ); #ifdef PLTT_TARGET_SPREAD_METRICS target.set_metrics_timer( TARGET_SPREAD_METRICS_TIMER ); #endif #ifdef PLTT_TARGET_MINI_RUN target.set_mini_run_times( TARGET_MINI_RUN_TIMES ); #endif #ifdef PLTT_SECURE target.set_request_id( TARGET_SECURE_REQUEST_ID_1 ); Os::Uart *wiselib_uart_ = &wiselib::FacetProvider<Os, Os::Uart>::get_facet( value ); privacy.set_randomization(); privacy.init( *wiselib_radio_, *wiselib_debug_, *wiselib_uart_, *wiselib_timer_ ); target.reg_privacy_radio_callback<Privacy, &Privacy::radio_receive>( &privacy ); privacy.reg_privacy_callback<PLTT_Target, &PLTT_Target::randomize_callback>( 999, &target ); privacy.enable(); #endif target.enable(); #endif }