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: EthernetInterface PololuLedStripx mbed-rtos mbed nanoservice_client_1_12_X
Fork of LPC1768_LWM2M_Client by
Diff: resources/light.cpp
- Revision:
- 2:4166c3e5b321
- Parent:
- 1:09a525977925
--- a/resources/light.cpp Sat Sep 27 21:53:28 2014 +0000
+++ b/resources/light.cpp Sat Sep 27 23:58:43 2014 +0000
@@ -9,12 +9,14 @@
extern Serial pc;
char led_color[] = {"00000000"};
+extern void set_led_color(char* led_color);
+
/* Only GET and PUT method allowed */
static uint8_t light_resource_cb(sn_coap_hdr_s *received_coap_ptr, sn_nsdl_addr_s *address, sn_proto_info_s * proto)
{
sn_coap_hdr_s *coap_res_ptr = 0;
- pc.printf("LED Strip callback\r\n");
+ //pc.printf("LED Strip callback\r\n");
if(received_coap_ptr->msg_code == COAP_MSG_CODE_REQUEST_GET)
{
@@ -26,7 +28,7 @@
}
else if(received_coap_ptr->msg_code == COAP_MSG_CODE_REQUEST_PUT)
{
- pc.printf("PUT: %d bytes\r\n", received_coap_ptr->payload_len);
+ //pc.printf("PUT: %d bytes\r\n", received_coap_ptr->payload_len);
if(received_coap_ptr->payload_len == 8)
{
memcpy(led_color, (char *)received_coap_ptr->payload_ptr, received_coap_ptr->payload_len);
@@ -35,6 +37,7 @@
pc.printf("PUT: %s\r\n",led_color);
//call LED strup update function here
+ set_led_color(led_color);
coap_res_ptr = sn_coap_build_response(received_coap_ptr, COAP_MSG_CODE_RESPONSE_CHANGED);
sn_nsdl_send_coap_message(address, coap_res_ptr);
