sandbox / simple-mbed-client

Dependents:   Wifi_Get_Test_V1 simple-mbed-client-example simple-client-app-shield simple-sensor-client

Fork of simple-mbed-client by Jan Jongboom

Files at this revision

API Documentation at this revision

Comitter:
Jan Jongboom
Date:
Fri Jul 01 13:56:44 2016 +0200
Parent:
5:b875aa494b9f
Child:
7:8a05fbad93d1
Commit message:
Add a way of accessing underlying M2MResource

Changed in this revision

simple-mbed-client.h Show annotated file Show diff for this revision Revisions of this file
--- a/simple-mbed-client.h	Fri Jul 01 12:55:18 2016 +0200
+++ b/simple-mbed-client.h	Fri Jul 01 13:56:44 2016 +0200
@@ -262,6 +262,15 @@
         updateValues[route] = simpleResource;
     }
 
+    M2MResource* get_resource(string route) {
+        if (!resources.count(route)) {
+            debug_msg("[SMC] [ERROR] No such route (%s)\r\n", route.c_str());
+            return NULL;
+        }
+
+        return resources[route];
+    }
+
 private:
     vector<string> parse_route(const char* route) {
         string s(route);
@@ -312,6 +321,10 @@
         if (onUpdate) onUpdate(v);
     }
 
+    M2MResource* get_resource() {
+        return simpleClient->get_resource(route);
+    }
+
 private:
     SimpleMbedClientBase* simpleClient;
     string route;
@@ -340,6 +353,10 @@
         onUpdate(atoi((const char*)v.c_str()));
     }
 
+    M2MResource* get_resource() {
+        return simpleClient->get_resource(route);
+    }
+
 private:
     SimpleMbedClientBase* simpleClient;
     string route;