void
LightLampApplication::
boot(void) {
    os().debug("ON");

    TOGGLE_LED(LED_BLUE);
    os().allow_doze(false);
    os().allow_sleep(false);


    os().radio().hardware_radio().set_channel(17);

    telos = new TelosbModule(os_);

    telos->init();
    telos->add_button_handler(this);


    os().dispatcher().add_receiver(this);



    //Create the command payload - off
    messclose[0] = 0x7f; //mksense
    messclose[1] = 0x69; //mksense
    messclose[2] = 105; //mksense

    //Create the command payload - on
    messopen[0] = 0x7f; //mksense
    messopen[1] = 0x69; //mksense
    messopen[2] = 105; //mksense

    //Create the command payload - switch
    messwitch[0] = 0x7f; //mksense
    messwitch[1] = 0x69; //mksense
    messwitch[2] = 105; //mksense

    for (int i = 3; i < 13; i++) {
        messopen[i] = 1; //on
        messclose[i] = 0; //off
        messwitch[i] = 99; //swithc
    }

    //create the echo payload
    echomsg[0] = 0x7f; //mksense
    echomsg[1] = 0x69; //mksense
    echomsg[2] = 100; //mksense
    echomsg[3] = 42; //echo payload

    //get the initial light value
    light = telos->light();

    //start periodic tasks
    os().add_task_in(Time(1, 0), this, NULL);
}
void WISEBEDApplication::init_sensors()
{
	#if defined (ISENSE_PACEMATE)

	#endif
	#if defined (ISENSE_MSP430)
		telos_->init();
	#endif
	#if defined (ISENSE_JENNIC_JN513xR1)

			if (em_->temp_sensor() != NULL)
			{
				em_->temp_sensor()->enable();
			} else
				os().fatal("Could not allocate temp sensor");

			em_->enable(true);

			temp_ = em_->temp_sensor()->temperature();

			if (temp_ == -127 )	// node with PIR and ACC
			{
				em_active_ = false;
			}

			if(em_active_ == true)
			{
				if (em_->light_sensor() != NULL)
				{
					em_->light_sensor()->enable();
				} else
					os().fatal("Could not allocate light sensor");
			}
			else
			{
				acc_ = new LisAccelerometer(os());

				if ((acc_ != NULL) && (pir_!= NULL))
				{
					acc_->set_mode(MODE_THRESHOLD);
					acc_->set_threshold(100);
					acc_->set_handler(this);
					acc_->enable();

					pir_->set_sensor_handler(this);
					pir_->set_pir_sensor_int_interval( 2000 );
					pir_->enable();
				}
			}
	#endif
}