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.

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

Files at this revision

API Documentation at this revision

Comitter:
rkuo2000
Date:
Wed Mar 01 02:08:03 2017 +0000
Parent:
67:312b4fec81a2
Commit message:
mbed-OS v5.3.6

Changed in this revision

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
--- a/main.cpp	Tue Feb 28 12:45:10 2017 +0000
+++ b/main.cpp	Wed Mar 01 02:08:03 2017 +0000
@@ -13,6 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+// security.h need to be replaced by your own security credentails 
+// from https://connector.mbed.com/#credentials
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
 #include "simpleclient.h"
--- a/mbed-client.lib	Tue Feb 28 12:45:10 2017 +0000
+++ b/mbed-client.lib	Wed Mar 01 02:08:03 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	Wed Mar 01 02:08:03 2017 +0000
@@ -1,35 +1,109 @@
 /*
+
  * Copyright (c) 2015 ARM Limited. All rights reserved.
+
  * SPDX-License-Identifier: Apache-2.0
+
  * Licensed under the Apache License, Version 2.0 (the License); you may
+
  * not use this file except in compliance with the License.
+
  * You may obtain a copy of the License at
+
  *
+
  * http://www.apache.org/licenses/LICENSE-2.0
+
  *
+
  * Unless required by applicable law or agreed to in writing, software
+
  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
  * See the License for the specific language governing permissions and
+
  * limitations under the License.
+
  */
+
 #ifndef __SECURITY_H__
+
 #define __SECURITY_H__
+
+ 
+
+#include <inttypes.h>
+
+ 
+
+#define MBED_DOMAIN "39614035-5e3c-40bf-a18e-b85d78634558"
+
+#define MBED_ENDPOINT_NAME "f7a71f67-838c-4c95-8376-5c9965b65e58"
+
  
-#include <inttypes.h>
+
+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";
+
  
-#define MBED_DOMAIN "DOMAIN"
-#define MBED_ENDPOINT_NAME "ENDPOINT_NAME"
- 
-const uint8_t SERVER_CERT[] = "-----BEGIN CERTIFICATE-----\r\n"
-"-----END CERTIFICATE-----\r\n";
- 
+
 const uint8_t CERT[] = "-----BEGIN CERTIFICATE-----\r\n"
+
+"MIIB0DCCAXOgAwIBAgIEHd8x/DAMBggqhkjOPQQDAgUAMDkxCzAJBgNVBAYTAkZ\r\n"
+
+"JMQwwCgYDVQQKDANBUk0xHDAaBgNVBAMME21iZWQtY29ubmVjdG9yLTIwMTgwHh\r\n"
+
+"cNMTcwMzAxMDE0ODE4WhcNMTgxMjMxMDYwMDAwWjCBoTFSMFAGA1UEAxNJMzk2M\r\n"
+
+"TQwMzUtNWUzYy00MGJmLWExOGUtYjg1ZDc4NjM0NTU4L2Y3YTcxZjY3LTgzOGMt\r\n"
+
+"NGM5NS04Mzc2LTVjOTk2NWI2NWU1ODEMMAoGA1UECxMDQVJNMRIwEAYDVQQKEwl\r\n"
+
+"tYmVkIHVzZXIxDTALBgNVBAcTBE91bHUxDTALBgNVBAgTBE91bHUxCzAJBgNVBA\r\n"
+
+"YTAkZJMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEESTllnKSh1qZJ8aSODxkh\r\n"
+
+"MzKVXXdoyVr29fwet4HRpSfogpq4BAv9S2HDD0KWWITI8dOYdo+0IVFY9AlGalh\r\n"
+
+"aDAMBggqhkjOPQQDAgUAA0kAMEYCIQDH5MnQmKVIRqJimgK8JSJAcz0rZi91IBT\r\n"
+
+"+myIrx7PLSgIhALWcMt93xHFrXB9HvWGB8AlMoKedXvlDejZH3GrSAOie\r\n"
+
 "-----END CERTIFICATE-----\r\n";
+
  
+
 const uint8_t KEY[] = "-----BEGIN PRIVATE KEY-----\r\n"
+
+"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgFmLLtob3aJmbicJt\r\n"
+
+"ZOW9JS/ua75wktoZW5tlu8yzKDmhRANCAAQRJOWWcpKHWpknxpI4PGSEzMpVdd2j\r\n"
+
+"JWvb1/B63gdGlJ+iCmrgEC/1LYcMPQpZYhMjx05h2j7QhUVj0CUZqWFo\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"