mbed client

Fork of simple-mbed-client by sandbox

Revision:
4:0f9eae5739dd
Parent:
3:ce2322965a27
Child:
6:a1a766d45957
--- a/simple-mbed-client.h	Tue May 24 14:59:28 2016 -0500
+++ b/simple-mbed-client.h	Thu Jun 30 12:31:29 2016 +0200
@@ -55,7 +55,7 @@
         return options;
     }
 
-    bool init(NetworkStack* iface) {
+    bool init(NetworkInterface* iface) {
         debug_msg("[SMC] Device name %s\r\n", MBED_ENDPOINT_NAME);
 
         // Create endpoint interface to manage register and unregister
@@ -90,7 +90,7 @@
         return true;
     }
 
-    bool setup(NetworkStack* iface) {
+    bool setup(NetworkInterface* iface) {
         debug_msg("[SMC] In mbed_client_setup\r\n");
         if (client) {
             debug_msg("[SMC] [ERROR] mbed_client_setup called, but mbed_client is already instantiated\r\n");
@@ -105,7 +105,7 @@
         return init(iface);
     }
 
-    bool setup(MbedClientOptions options, NetworkStack* iface) {
+    bool setup(MbedClientOptions options, NetworkInterface* iface) {
         if (client) {
             debug_msg("[SMC] [ERROR] mbed_client_setup called, but mbed_client is already instantiated\r\n");
             return false;
@@ -191,7 +191,12 @@
             return false;
         }
 
-        resources[route_str]->set_value((uint8_t*)v.c_str(), v.length());
+        if (v.length() == 0) {
+            resources[route_str]->clear_value();
+        }
+        else {
+            resources[route_str]->set_value((uint8_t*)v.c_str(), v.length());
+        }
 
         return true;
     }