Pelion test

Revision:
7:826cdcc3c8ec
Parent:
4:7c58c47eca55
Child:
8:5f1c0849001c
--- a/main.cpp	Tue Feb 19 11:28:06 2019 +0900
+++ b/main.cpp	Tue Feb 19 11:59:49 2019 +0900
@@ -47,7 +47,9 @@
 
     button_res->set_value(v);
 
-    printf("User button clicked %d times\n", v);    
+    printf("User button clicked %d times\n", v);
+
+    // Send photo data on button click
     M2MResource* m2m_res = res_camera_capture->get_m2m_resource();
     if(v % 2 == 0) {
         m2m_res->set_value((const uint8_t *)data_icon, data_icon_len);
@@ -116,6 +118,9 @@
  */
 void registered(const ConnectorClientEndpointInfo *endpoint) {
     printf("Connected to Pelion Device Management. Endpoint Name: %s\n", endpoint->internal_endpoint_name.c_str());
+    // Once registered, send default photo.
+    M2MResource* m2m_res = res_camera_capture->get_m2m_resource();
+    m2m_res->set_value((const uint8_t *)data_icon, data_icon_len);
 }
 
 int main(void) {