LWM2M Weather Station
Dependencies: EthernetInterfaceUpdate mbed-rtos mbed nanoservice_client_1_12_X
Revision 2:d758d2248748, committed 2015-01-18
- Comitter:
- michaeljkoster
- Date:
- Sun Jan 18 18:38:37 2015 +0000
- Parent:
- 1:edf59b423849
- Child:
- 3:12c28025d4a4
- Commit message:
- Update resource registration and slight cleanup
Changed in this revision
--- a/main.cpp Tue Nov 25 01:44:53 2014 +0000 +++ b/main.cpp Sun Jan 18 18:38:37 2015 +0000 @@ -114,19 +114,19 @@ memset(resource_ptr->resource_parameters_ptr, 0, sizeof(sn_nsdl_resource_parameters_s)); // Static resources - nsdl_create_static_resource(resource_ptr, sizeof("3/0/0")-1, (uint8_t*) "3/0/0", sizeof("Manufacturer")-1, (uint8_t*) "Manufacturer", (uint8_t*) "mbedDEMO", sizeof("mbedDEMO")-1); - nsdl_create_static_resource(resource_ptr, sizeof("3/0/1")-1, (uint8_t*) "3/0/1", sizeof("Model_Number")-1, (uint8_t*) "Model_Number", (uint8_t*) "DEMO", sizeof("DEMO")-1); + nsdl_create_static_resource(resource_ptr, sizeof("3/0/0")-1, (uint8_t*) "3/0/0", sizeof("Manufacturer")-1, (uint8_t*) "Manufacturer", (uint8_t*) "mbed_DEMO", sizeof("mbed_DEMO")-1); + nsdl_create_static_resource(resource_ptr, sizeof("3/0/1")-1, (uint8_t*) "3/0/1", sizeof("Model_Number")-1, (uint8_t*) "Model_Number", (uint8_t*) "WS_1", sizeof("WS_1")-1); // Dynamic resources - //create_barometer_resource(resource_ptr); + create_barometer_resource(resource_ptr); create_gas_sensor_resource(resource_ptr); - //create_humidity_resource(resource_ptr); - //create_illuminance_resource(resource_ptr); - //create_rain_resource(resource_ptr); - //create_temperature_resource(resource_ptr); - //create_wind_resource(resource_ptr); - //create_wind_gust_resource(resource_ptr); - //create_wind_direction_resource(resource_ptr); + create_humidity_resource(resource_ptr); + create_illuminance_resource(resource_ptr); + create_rain_resource(resource_ptr); + create_temperature_resource(resource_ptr); + create_wind_resource(resource_ptr); + create_wind_gust_resource(resource_ptr); + create_wind_direction_resource(resource_ptr); /* Register with NSP */ endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)endpoint_name, ep_type, lifetime_ptr);
--- a/mbed-rtos.lib Tue Nov 25 01:44:53 2014 +0000 +++ b/mbed-rtos.lib Sun Jan 18 18:38:37 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#02f5cf381388 +http://mbed.org/users/mbed_official/code/mbed-rtos/#9387d4c49609
--- a/mbed.bld Tue Nov 25 01:44:53 2014 +0000 +++ b/mbed.bld Sun Jan 18 18:38:37 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
--- a/nsdl_support.cpp Tue Nov 25 01:44:53 2014 +0000 +++ b/nsdl_support.cpp Sun Jan 18 18:38:37 2015 +0000 @@ -36,16 +36,16 @@ void *nsdl_alloc(uint16_t size) { void *buf = malloc(size); - printf("alloc\r\n"); - MEM_VALID(0); + //printf("alloc\r\n"); + //MEM_VALID(0); return buf; } void nsdl_free(void* ptr_to_free) { - printf("de-alloc\r\n"); - MEM_VALID(0); free(ptr_to_free); + //printf("de-alloc\r\n"); + //MEM_VALID(0); } /* @@ -131,30 +131,13 @@ if (coap_packet_ptr->options_list_ptr && coap_packet_ptr->options_list_ptr->location_path_ptr) { pc.printf("Location: /"); - int i; - for (i=0; i < coap_packet_ptr->options_list_ptr->location_path_len; i++) pc.printf("%c", (char)(coap_packet_ptr->options_list_ptr->location_path_ptr[i])); + for (int i=0; i < coap_packet_ptr->options_list_ptr->location_path_len; i++) pc.printf("%c", (char)(coap_packet_ptr->options_list_ptr->location_path_ptr[i])); pc.printf(" \r\n"); } - //sn_coap_packet_debug(coap_packet_ptr); + //sn_coap_packet_debug(coap_packet_ptr); // need to enable in nsdl source code return 0; } -static void registration_update_thread(void const *args) -{ - sn_nsdl_ep_parameters_s *endpoint_ptr = NULL; - - while(true) - { - wait(RD_UPDATE_PERIOD); - endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)null_ep_name, null_ep_type, null_lifetime_ptr); - if(sn_nsdl_update_registration(endpoint_ptr) != 0) - pc.printf("NSP re-registering failed\r\n"); - else - pc.printf("NSP re-registering OK\r\n"); - nsdl_clean_register_endpoint(&endpoint_ptr); - } -} - void nsdl_init() { uint8_t nsp_addr[4];