PROCESS_THREAD(er_example_server, ev, data) { PROCESS_BEGIN(); PROCESS_PAUSE(); PRINTF("Starting Erbium Example Server\n"); #ifdef RF_CHANNEL PRINTF("RF channel: %u\n", RF_CHANNEL); #endif #ifdef IEEE802154_PANID PRINTF("PAN ID: 0x%04X\n", IEEE802154_PANID); #endif PRINTF("uIP buffer: %u\n", UIP_BUFSIZE); PRINTF("LL header: %u\n", UIP_LLH_LEN); PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN); PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE); /* Initialize the REST engine. */ rest_init_engine(); /* * Bind the resources to their Uri-Path. * WARNING: Activating twice only means alternate path, not two instances! * All static variables are the same for each URI path. */ rest_activate_resource(&res_hello, "test/hello"); /* rest_activate_resource(&res_mirror, "debug/mirror"); */ /* rest_activate_resource(&res_chunks, "test/chunks"); */ /* rest_activate_resource(&res_separate, "test/separate"); */ rest_activate_resource(&res_push, "test/push"); /* rest_activate_resource(&res_event, "sensors/button"); */ /* rest_activate_resource(&res_sub, "test/sub"); */ /* rest_activate_resource(&res_b1_sep_b2, "test/b1sepb2"); */ #if PLATFORM_HAS_LEDS /* rest_activate_resource(&res_leds, "actuators/leds"); */ rest_activate_resource(&res_toggle, "actuators/toggle"); #endif #if PLATFORM_HAS_LIGHT rest_activate_resource(&res_light, "sensors/light"); SENSORS_ACTIVATE(light_sensor); #endif /* #if PLATFORM_HAS_BATTERY rest_activate_resource(&res_battery, "sensors/battery"); SENSORS_ACTIVATE(battery_sensor); #endif #if PLATFORM_HAS_RADIO rest_activate_resource(&res_radio, "sensors/radio"); SENSORS_ACTIVATE(radio_sensor); #endif #if PLATFORM_HAS_SHT11 rest_activate_resource(&res_sht11, "sensors/sht11"); SENSORS_ACTIVATE(sht11_sensor); #endif */ /* Define application-specific events here. */ while(1) { PROCESS_WAIT_EVENT(); #if PLATFORM_HAS_BUTTON if(ev == sensors_event && data == &button_sensor) { PRINTF("*******BUTTON*******\n"); /* Call the event_handler for this application-specific event. */ res_event.trigger(); /* Also call the separate response example handler. */ res_separate.resume(); } #endif /* PLATFORM_HAS_BUTTON */ } /* while (1) */ PROCESS_END(); }