mbed client

Fork of simple-mbed-client by sandbox

Revision:
12:26810c6b58e1
Parent:
11:4da431479ce3
Child:
14:3fd6afc63e6a
--- a/simple-mbed-client.h	Wed Aug 24 19:05:56 2016 +0200
+++ b/simple-mbed-client.h	Wed Sep 28 11:16:43 2016 +0300
@@ -99,7 +99,7 @@
 
         struct MbedClientOptions options = get_default_options();
 
-        FP1<void, string> updateFp(this, &SimpleMbedClientBase::resource_updated);
+        Callback<void(string)> updateFp(this, &SimpleMbedClientBase::resource_updated);
         client = new MbedClient(options, updateFp, debug);
 
         return init(iface);
@@ -111,31 +111,31 @@
             return false;
         }
 
-        FP1<void, string> updateFp(this, &SimpleMbedClientBase::resource_updated);
+        Callback<void(string)> updateFp(this, &SimpleMbedClientBase::resource_updated);
         client = new MbedClient(options, updateFp, debug);
 
         return init(iface);
     }
 
     void on_registered(void(*fn)(void)) {
-        FunctionPointer fp(fn);
+        Callback<void()> fp(fn);
         client->set_registered_function(fp);
     }
 
     template<typename T>
     void on_registered(T *object, void (T::*member)(void)) {
-        FunctionPointer fp(object, member);
+        Callback<void()> fp(object, member);
         client->set_registered_function(fp);
     }
 
     void on_unregistered(void(*fn)(void)) {
-        FunctionPointer fp(fn);
+        Callback<void()> fp(fn);
         client->set_unregistered_function(fp);
     }
 
     template<typename T>
     void on_unregistered(T *object, void (T::*member)(void)) {
-        FunctionPointer fp(object, member);
+        Callback<void()> fp(object, member);
         client->set_unregistered_function(fp);
     }
 
@@ -305,7 +305,7 @@
 
 class SimpleResourceString : public SimpleResourceBase {
 public:
-    SimpleResourceString(SimpleMbedClientBase* aSimpleClient, string aRoute, FunctionPointerArg1<void, string> aOnUpdate) :
+    SimpleResourceString(SimpleMbedClientBase* aSimpleClient, string aRoute, Callback<void(string)> aOnUpdate) :
         simpleClient(aSimpleClient), route(aRoute), onUpdate(aOnUpdate) {}
 
     string operator=(const string& newValue) {
@@ -327,12 +327,12 @@
 private:
     SimpleMbedClientBase* simpleClient;
     string route;
-    FunctionPointerArg1<void, string> onUpdate;
+    Callback<void(string)> onUpdate;
 };
 
 class SimpleResourceInt : public SimpleResourceBase {
 public:
-    SimpleResourceInt(SimpleMbedClientBase* aSimpleClient, string aRoute, FunctionPointerArg1<void, int> aOnUpdate) :
+    SimpleResourceInt(SimpleMbedClientBase* aSimpleClient, string aRoute, Callback<void(int)> aOnUpdate) :
         simpleClient(aSimpleClient), route(aRoute), onUpdate(aOnUpdate) {}
 
     int operator=(int newValue) {
@@ -359,7 +359,7 @@
 private:
     SimpleMbedClientBase* simpleClient;
     string route;
-    FunctionPointerArg1<void, int> onUpdate;
+    Callback<void(int)> onUpdate;
 };
 
 class SimpleMbedClient : public SimpleMbedClientBase {
@@ -372,7 +372,7 @@
         string v,
         M2MBase::Operation opr = M2MBase::GET_PUT_ALLOWED,
         bool observable = true,
-        FunctionPointerArg1<void, string> onUpdate = NULL)
+        Callback<void(string)> onUpdate = NULL)
     {
         SimpleResourceString* simpleResource = new SimpleResourceString(this, route, onUpdate);
         bool res = define_resource_internal(route, v, opr, observable);
@@ -392,7 +392,7 @@
         bool observable,
         void(*onUpdate)(string))
     {
-        FunctionPointerArg1<void, string> fp;
+        Callback<void(string)> fp;
         fp.attach(onUpdate);
         return define_resource(route, v, opr, observable, fp);
     }
@@ -400,7 +400,7 @@
     SimpleResourceString define_resource(
         const char* route,
         string v,
-        FunctionPointerArg1<void, string> onUpdate)
+        Callback<void(string)> onUpdate)
     {
         return define_resource(route, v, M2MBase::GET_PUT_ALLOWED, true, onUpdate);
     }
@@ -410,7 +410,7 @@
         string v,
         void(*onUpdate)(string))
     {
-        FunctionPointerArg1<void, string> fp;
+        Callback<void(string)> fp;
         fp.attach(onUpdate);
         return define_resource(route, v, M2MBase::GET_PUT_ALLOWED, true, fp);
     }
@@ -420,7 +420,7 @@
         int v,
         M2MBase::Operation opr = M2MBase::GET_PUT_ALLOWED,
         bool observable = true,
-        FunctionPointerArg1<void, int> onUpdate = NULL)
+        Callback<void(int)> onUpdate = NULL)
     {
         SimpleResourceInt* simpleResource = new SimpleResourceInt(this, route, onUpdate);
 
@@ -444,7 +444,7 @@
         bool observable,
         void(*onUpdate)(int))
     {
-        FunctionPointerArg1<void, int> fp;
+        Callback<void(int)> fp;
         fp.attach(onUpdate);
         return define_resource(route, v, opr, observable, fp);
     }
@@ -452,7 +452,7 @@
     SimpleResourceInt define_resource(
         const char* route,
         int v,
-        FunctionPointerArg1<void, int> onUpdate)
+        Callback<void(int)> onUpdate)
     {
         return define_resource(route, v, M2MBase::GET_PUT_ALLOWED, true, onUpdate);
     }
@@ -462,7 +462,7 @@
         int v,
         void(*onUpdate)(int))
     {
-        FunctionPointerArg1<void, int> fp;
+        Callback<void(int)> fp;
         fp.attach(onUpdate);
         return define_resource(route, v, M2MBase::GET_PUT_ALLOWED, true, fp);
     }