Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Beep C12832_lcd EthernetInterface LM75B MMA7660 mbed-rtos mbed nsdl_lib
Fork of LWM2M_NanoService_Ethernet by
Diff: resources/temperature.cpp
- Revision:
- 3:52c1b649eb04
- Parent:
- 2:7e489126fe7a
- Child:
- 8:f0ecb62bda47
diff -r 7e489126fe7a -r 52c1b649eb04 resources/temperature.cpp
--- a/resources/temperature.cpp Tue Oct 15 12:45:46 2013 +0000
+++ b/resources/temperature.cpp Tue Oct 15 15:48:23 2013 +0000
@@ -11,7 +11,7 @@
static LM75B tmp(p28,p27);
/* stored data for observable resource */
static uint8_t obs_number = 0;
-static uint8_t *obs_token_ptr = 0;
+static uint8_t *obs_token_ptr = NULL;
static uint8_t obs_token_len = 0;
static char temp_val[5];
extern Serial pc;
@@ -26,7 +26,7 @@
wait(1);
time++;
sn_nsdl_exec(time);
- if((!(time % 10)) && obs_number != 0)
+ if((!(time % 10)) && obs_number != 0 && obs_token_ptr != NULL)
{
obs_number++;
sprintf(temp_val,"%2.2f" ,tmp.read());
@@ -45,7 +45,7 @@
sprintf(temp_val,"%2.2f" ,tmp.read());
sn_coap_hdr_s *coap_res_ptr = 0;
- //pc.printf("temp callback\r\n");
+ pc.printf("temp callback\r\n");
coap_res_ptr = sn_coap_build_response(received_coap_ptr, COAP_MSG_CODE_RESPONSE_CONTENT);
coap_res_ptr->payload_len = 5;
@@ -85,7 +85,7 @@
int create_temperature_resource(sn_nsdl_resource_info_s *resource_ptr)
{
- Thread exec_thread(exec_call_thread);
+ static Thread exec_thread(exec_call_thread);
nsdl_create_dynamic_resource(resource_ptr, sizeof(TEMP_RES_ID)-1, (uint8_t*)TEMP_RES_ID, 0, 0, 1, &temp_resource_cb, SN_GRS_GET_ALLOWED);
return 0;
