This is a simple mbed client example demonstrating, registration of a device with mbed Device Connector and reading and writing values as well as deregistering on different Network Interfaces including Ethernet, WiFi, 6LoWPAN ND and Thread respectively.

Dependencies:   lwip

Fork of mbed-os-example-client by mbed-os-examples

Files at this revision

API Documentation at this revision

Comitter:
markblackburnetcorp
Date:
Thu Mar 09 18:46:25 2017 +0000
Parent:
67:312b4fec81a2
Child:
72:8fcde208b155
Commit message:
Initial commit;

Changed in this revision

lwip.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-client.lib Show annotated file Show diff for this revision Revisions of this file
security.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lwip.lib	Thu Mar 09 18:46:25 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/lwip/#08f08bfc3f3d
--- a/main.cpp	Tue Feb 28 12:45:10 2017 +0000
+++ b/main.cpp	Thu Mar 09 18:46:25 2017 +0000
@@ -345,6 +345,8 @@
     // Keep track of the main thread
     mainThread = osThreadGetId();
 
+    printf("\nVersion 5\n");
+    
     printf("\nStarting mbed Client example in ");
 #if defined (MESH) || (MBED_CONF_LWIP_IPV6_ENABLED==true)
     printf("IPv6 mode\n");
@@ -401,10 +403,15 @@
     mbed_client.test_register(register_object, object_list);
     registered = true;
 
+    printf("Start loop\n");
+
     while (true) {
-        updates.wait(25000);
+        updates.wait(5000);
+        printf("loop\n");
+        printf("registered: %i\n", registered);
         if(registered) {
             if(!clicked) {
+                printf("Calling test_update_register()\n");
                 mbed_client.test_update_register();
             }
         }else {
@@ -412,10 +419,12 @@
         }
         if(clicked) {
             clicked = false;
+            printf("Calling handle_button_click()\n");
             button_resource.handle_button_click();
         }
     }
 
+    printf("Calling test_unregister()\n");
     mbed_client.test_unregister();
     status_ticker.detach();
 }
--- a/mbed-client.lib	Tue Feb 28 12:45:10 2017 +0000
+++ b/mbed-client.lib	Thu Mar 09 18:46:25 2017 +0000
@@ -1,2 +1,1 @@
 https://github.com/ARMmbed/mbed-client/#d41459d8b514d72d525e761fb4e34031e09f76e7
-
--- a/security.h	Tue Feb 28 12:45:10 2017 +0000
+++ b/security.h	Thu Mar 09 18:46:25 2017 +0000
@@ -18,18 +18,38 @@
  
 #include <inttypes.h>
  
-#define MBED_DOMAIN "DOMAIN"
-#define MBED_ENDPOINT_NAME "ENDPOINT_NAME"
+#define MBED_DOMAIN "d6a0042c-14f3-40e6-a955-886946aff565"
+#define MBED_ENDPOINT_NAME "18bd38a2-77ff-4399-ac64-3938da7433df"
  
 const uint8_t SERVER_CERT[] = "-----BEGIN CERTIFICATE-----\r\n"
+"MIIBmDCCAT6gAwIBAgIEVUCA0jAKBggqhkjOPQQDAjBLMQswCQYDVQQGEwJGSTEN\r\n"
+"MAsGA1UEBwwET3VsdTEMMAoGA1UECgwDQVJNMQwwCgYDVQQLDANJb1QxETAPBgNV\r\n"
+"BAMMCEFSTSBtYmVkMB4XDTE1MDQyOTA2NTc0OFoXDTE4MDQyOTA2NTc0OFowSzEL\r\n"
+"MAkGA1UEBhMCRkkxDTALBgNVBAcMBE91bHUxDDAKBgNVBAoMA0FSTTEMMAoGA1UE\r\n"
+"CwwDSW9UMREwDwYDVQQDDAhBUk0gbWJlZDBZMBMGByqGSM49AgEGCCqGSM49AwEH\r\n"
+"A0IABLuAyLSk0mA3awgFR5mw2RHth47tRUO44q/RdzFZnLsAsd18Esxd5LCpcT9w\r\n"
+"0tvNfBv4xJxGw0wcYrPDDb8/rjujEDAOMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0E\r\n"
+"AwIDSAAwRQIhAPAonEAkwixlJiyYRQQWpXtkMZax+VlEiS201BG0PpAzAiBh2RsD\r\n"
+"NxLKWwf4O7D6JasGBYf9+ZLwl0iaRjTjytO+Kw==\r\n"
 "-----END CERTIFICATE-----\r\n";
  
 const uint8_t CERT[] = "-----BEGIN CERTIFICATE-----\r\n"
+"MIIB0DCCAXOgAwIBAgIEN5VJBDAMBggqhkjOPQQDAgUAMDkxCzAJBgNVBAYTAkZ\r\n"
+"JMQwwCgYDVQQKDANBUk0xHDAaBgNVBAMME21iZWQtY29ubmVjdG9yLTIwMTgwHh\r\n"
+"cNMTcwMzA4MjM1ODA5WhcNMTgxMjMxMDYwMDAwWjCBoTFSMFAGA1UEAxNJZDZhM\r\n"
+"DA0MmMtMTRmMy00MGU2LWE5NTUtODg2OTQ2YWZmNTY1LzE4YmQzOGEyLTc3ZmYt\r\n"
+"NDM5OS1hYzY0LTM5MzhkYTc0MzNkZjEMMAoGA1UECxMDQVJNMRIwEAYDVQQKEwl\r\n"
+"tYmVkIHVzZXIxDTALBgNVBAcTBE91bHUxDTALBgNVBAgTBE91bHUxCzAJBgNVBA\r\n"
+"YTAkZJMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE46r9U0Vg22XC0snfkkzSP\r\n"
+"Id6EpO1jMFsvoH3P1FlrEqud17L2HrkMIN/hagHl4hvcdsvtjH067kIkYZXLy3c\r\n"
+"ojAMBggqhkjOPQQDAgUAA0kAMEYCIQDP8E0WcQi/H7iqaqiQnmwDqo28mqx7FB2\r\n"
+"LVEb2GcSVMAIhAKkgu0PkA/wJ6T/jhaBfGOqnN3MG+riUk+ZM7FIT85vX\r\n"
 "-----END CERTIFICATE-----\r\n";
  
 const uint8_t KEY[] = "-----BEGIN PRIVATE KEY-----\r\n"
+"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg6jJ8iMI5w7t+yi2c\r\n"
+"vHPerhEP9sQl78AwmjPlC40C2CmhRANCAATjqv1TRWDbZcLSyd+STNI8h3oSk7WM\r\n"
+"wWy+gfc/UWWsSq53XsvYeuQwg3+FqAeXiG9x2y+2MfTruQiRhlcvLdyi\r\n"
 "-----END PRIVATE KEY-----\r\n";
  
-#endif //__SECURITY_H__
- 
-#error "You need to get security.h credentials from connector.mbed.com and replace the content of this security.h file"
+#endif //__SECURITY_H__
\ No newline at end of file