Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NySNICInterface mbed-rtos mbed
Fork of RESTServerSample by
Diff: RPCObject.h
- Revision:
- 5:70c9f6045f2d
- Parent:
- 4:99a67256b765
- Child:
- 6:d148c8a213ef
--- a/RPCObject.h Sun Feb 15 02:55:36 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#ifndef RPCOBJECT
-#define RPCOBJECT
-
-#include <map>
-#include "mbed.h"
-
-enum RPC_PIN_TYPE {
- RPC_PIN_DIGITAL_IN,
- RPC_PIN_DIGITAL_OUT,
- RPC_PIN_DIGITAL_INOUT,
- RPC_PIN_UNKNOWN
-};
-
-struct rpc_arg
-{
- char *name;
- char *val;
-};
-
-class RPCClass
-{
- public :
- virtual int read()= 0;
- virtual void write(int value) = 0;
-};
-
-class RPCDigitalIn : public RPCClass
-{
- public :
- RPCDigitalIn(PinName pin) :i(pin){}
- virtual int read(void){return i.read();}
- virtual void write(int value){}
-
- private :
- DigitalIn i;
-};
-
-class RPCDigitalOut : public RPCClass
-{
- public :
- RPCDigitalOut(PinName pin) :o(pin){}
- virtual int read(void){return o.read();}
- virtual void write(int value){o.write(value);}
-
- private :
- DigitalOut o;
-};
-
-class RPCDigitalInOut : public RPCClass
-{
- public :
- RPCDigitalInOut(PinName pin) :o(pin){}
- virtual int read(void){return o.read();}
- virtual void write(int value){o.write(value);}
-
- private :
- DigitalInOut o;
-};
-
-class RPCObject
-{
- public :
- RPCObject();
- int decode(char *request, char* reply);
-
- RPC_PIN_TYPE get_type() const { return type; }
- PinName get_pin_name() const { return pin_name; }
- int get_value() const { return value; }
- bool create_pin_object(char* reply);
- std::map<PinName, RPCClass*> pinObjects;
-
- private :
- RPC_PIN_TYPE type;
- char obj_name[20];
- PinName pin_name;
- int value;
-};
-#endif
-

