HTTP (RPC) Server mit UI
Dependencies: EthernetInterface mbed-rpc mbed-rtos mbed
Fork of IoTKit_RPC-Server by
HTTP (RPC) Server mit eigener UI Oberfläche.
Board mit dem Ethernet verbinden. Console starten und angezeigte IP-Adresse notieren und in Browser öffnen.
Create Object
Type: DigitalOut Name: led1 arg(optional): PTB22
und Create Button drücken.
Call a function
Command: /led1/write 1
eingeben und Send drücken. Das rote LED auf dem Board geht aus. Mittels /led1/write 0 wird es wieder eingeschaltet.
Für die komplette Dokumentation siehe /users/feb11/code/HTTP-Server/
Diff: RPCObjectManager.cpp
- Revision:
- 0:9e4bcb10b3e3
diff -r 000000000000 -r 9e4bcb10b3e3 RPCObjectManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RPCObjectManager.cpp Wed Jul 17 10:15:05 2013 +0000 @@ -0,0 +1,68 @@ +#include "RPCObjectManager.h" +#include "mbed.h" + +RPCObjectManager& RPCObjectManager::instance() +{ + static RPCObjectManager om; + return om; +} + +RPCObjectManager::RPCObjectManager(): +objects() +{ +} + +RPCObjectManager::~RPCObjectManager() +{ + for(std::list<char*>::iterator itor = objects.begin(); + itor != objects.end(); + ++itor) + delete *itor; +} + +void RPCObjectManager::store_object(char *obj_name) +{ + char *obj = new char[strlen(obj_name)+1]; + strcpy(obj, obj_name); + obj[strlen(obj_name)] = '\0'; + objects.push_back(obj); +} + +void RPCObjectManager::remove_object(char *obj_name) +{ + for(std::list<char*>::iterator itor = objects.begin(); + itor != objects.end(); + ++itor) + if(!strcmp(obj_name, *itor)) + { + delete *itor; + objects.erase(itor); + break; + } +} + +bool RPCObjectManager::lookup_object(char *obj_name) +{ + for(std::list<char*>::iterator itor = objects.begin(); + itor != objects.end(); + ++itor) + if(!strcmp(obj_name, *itor)) + return true; + return false; +} + +bool RPCObjectManager::is_empty() +{ + return objects.empty(); +} + +std::list<char*>::iterator RPCObjectManager::begin() +{ + return objects.begin(); +} + +std::list<char*>::iterator RPCObjectManager::end() +{ + return objects.end(); +} +