Simple Mbed Cloud client application for NuMaker-PFM-M487 and NuMaker-PFM-NUC472 over Ethernet.

This application contains the example codes to:

1) Connect PFM-M487/PFM-NUC472 boards to Pelion

2) Enable Firmware update

For storage, PFM-M487/PFM-NUC472 support both SPI interface SD and built-in SD bus SD.

For connectivity, PFM-M487/PFM-NUC472 support Ethernet (on-board) by default.

This example supports Ethernet and built-in SD by default.

https://os.mbed.com/media/cache/platforms/NuMaker-PFM-M487.png.170x170_q85.png https://os.mbed.com/media/cache/platforms/NuMaker-PFM-NUC472Small.png.170x170_q85.png

Revision:
11:beac893830b4
Parent:
8:ed66653e5a22
--- a/main.cpp	Fri Nov 23 11:19:55 2018 +0800
+++ b/main.cpp	Fri Nov 23 13:13:13 2018 +0800
@@ -15,6 +15,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 // ----------------------------------------------------------------------------
+#ifndef MBED_TEST_MODE
 
 #include "mbed.h"
 #include "simple-mbed-cloud-client.h"
@@ -25,13 +26,13 @@
 EventQueue eventQueue;
 
 // Default block device
-BlockDevice* bd = BlockDevice::get_default_instance();
-FATFileSystem fs("sd", bd);
+BlockDevice *bd = BlockDevice::get_default_instance();
+FATFileSystem fs("fs");
 
 // Default network interface object
-NetworkInterface *net;
+NetworkInterface *net = NetworkInterface::get_default_instance();
 
-// Declaring pointers for access to Mbed Cloud Client resources outside of main()
+// Declaring pointers for access to Pelion Device Management Client resources outside of main()
 MbedCloudClientResource *button_res;
 MbedCloudClientResource *pattern_res;
 
@@ -97,16 +98,14 @@
  * @param endpoint Information about the registered endpoint such as the name (so you can find it back in portal)
  */
 void registered(const ConnectorClientEndpointInfo *endpoint) {
-    printf("Connected to Mbed Cloud. Endpoint Name: %s\n", endpoint->internal_endpoint_name.c_str());
+    printf("Connected to Pelion Device Management. Endpoint Name: %s\n", endpoint->internal_endpoint_name.c_str());
 }
 
 int main(void) {
-    printf("Starting Simple Mbed Cloud Client example\n");
-    printf("Connecting to the network using Ethernet...\n");
+    printf("Starting Simple Pelion Device Management Client example\n");
+    printf("Connecting to the network...\n");
 
     // Connect to the internet (DHCP is expected to be on)
-    net = NetworkInterface::get_default_instance();
-
     nsapi_error_t status = net->connect();
 
     if (status != NSAPI_ERROR_OK) {
@@ -116,11 +115,11 @@
 
     printf("Connected to the network successfully. IP address: %s\n", net->get_ip_address());
 
-    // SimpleMbedCloudClient handles registering over LwM2M to Mbed Cloud
+    // SimpleMbedCloudClient handles registering over LwM2M to Pelion Device Management
     SimpleMbedCloudClient client(net, bd, &fs);
     int client_status = client.init();
     if (client_status != 0) {
-        printf("Initializing Mbed Cloud Client failed (%d)\n", client_status);
+        printf("Pelion Client initialization failed (%d)\n", client_status);
         return -1;
     }
 
@@ -140,12 +139,12 @@
     blink_res->methods(M2MMethod::POST);
     blink_res->attach_post_callback(blink_callback);
 
-    printf("Initialized Mbed Cloud Client. Registering...\n");
+    printf("Initialized Pelion Client. Registering...\n");
 
     // Callback that fires when registering is complete
     client.on_registered(&registered);
 
-    // Register with Mbed Cloud
+    // Register with Pelion Device Management
     client.register_and_connect();
 
     // Placeholder for callback to update local resource when GET comes.
@@ -156,3 +155,4 @@
     // You can easily run the eventQueue in a separate thread if required
     eventQueue.dispatch_forever();
 }
+#endif