HTTP (RPC) Server mit UI

Dependencies:   EthernetInterface mbed-rpc mbed-rtos mbed

Fork of IoTKit_RPC-Server by th.iotkit.ch

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/

RPCType.cpp

Committer:
marcel1691
Date:
2015-03-23
Revision:
12:e04008977007
Parent:
0:9e4bcb10b3e3

File content as of revision 12:e04008977007:

#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;
}