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: EthernetInterface mbed-rpc mbed-rtos mbed
Diff: RPCType.cpp
- Revision:
- 5:8ab27ca793cd
- Parent:
- 0:9e4bcb10b3e3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/RPCType.cpp Wed Jul 17 15:01:05 2013 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+#include "mbed_rpc.h"
+#include "RPCType.h"
+
+
+RPCType::RPCType():
+supported_types()
+{
+}
+
+RPCType& RPCType::instance()
+{
+ static RPCType t;
+ return t;
+}
+
+void RPCType::register_types()
+{
+ RPCType &t = instance();
+
+ RPC::add_rpc_class<RpcDigitalOut>();
+ t.supported_types.push_back("DigitalOut");
+ RPC::add_rpc_class<RpcDigitalIn>();
+ t.supported_types.push_back("DigitalIn");
+ RPC::add_rpc_class<RpcDigitalInOut>();
+ t.supported_types.push_back("DigitalInOut");
+
+ #if DEVICE_PWMOUT
+ RPC::add_rpc_class<RpcPwmOut>();
+ t.supported_types.push_back("PwmOut");
+ #endif
+ #if DEVICE_SPI
+ t.supported_types.push_back("SPI");
+ RPC::add_rpc_class<RpcSPI>();
+ #endif
+ #if DEVICE_SERIAL
+ t.supported_types.push_back("Serial");
+ RPC::add_rpc_class<RpcSerial>();
+ #endif
+ RPC::add_rpc_class<RpcTimer>();
+ t.supported_types.push_back("Timer");
+}
+
+bool RPCType::is_supported_type(char *type)
+{
+ for(std::list<char*>::iterator itor = instance().supported_types.begin();
+ itor != instance().supported_types.end();
+ ++itor)
+ if(!strcmp(*itor,type))
+ return true;
+
+ return false;
+}
+
+