This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RpcPortIn.cpp Source File

RpcPortIn.cpp

00001 #include "RpcHandlerBase.h"
00002 namespace MiMic
00003 {
00004     class PortInHandler :RpcHandlerBase
00005     {
00006     public:
00007         static NyLPC_TBool new1(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
00008         {
00009             //uu
00010             ModJsonRpc* mod=((ModJsonRpc::TcJsonRpcEx_t*)i_param)->cppmod_ptr;
00011             unsigned int port;
00012             unsigned int mask;
00013             if(getParamUInt(mod,i_rpc,port,0)){
00014                 if(getParamUInt(mod,i_rpc,mask,1)){
00015                     addNewObjectBatch(mod,i_rpc->method.id,new ModJsonRpc::RpcObject<PortIn>(new PortIn(portId2PortName(port),(int)mask)));
00016                 }
00017             }
00018             return NyLPC_TBool_TRUE;
00019         }
00020         static NyLPC_TBool read(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
00021         {
00022             //d return d
00023             ModJsonRpc* mod=((ModJsonRpc::TcJsonRpcEx_t*)i_param)->cppmod_ptr;
00024             PortIn* inst=(PortIn*)getObjectBatch(mod,i_rpc);
00025             if(inst!=NULL){
00026                 mod->putResult(i_rpc->method.id,"%d",(int)(inst->read()));
00027             }
00028             return NyLPC_TBool_TRUE;
00029         }
00030     };
00031 
00032 
00033 
00034 const static struct NyLPC_TJsonRpcMethodDef func_table[]=
00035 {
00036     { "_new1"   ,"uu"   ,PortInHandler::new1},
00037     { "read"    ,"d"    ,PortInHandler::read},
00038     { NULL      ,NULL   ,NULL}
00039 };
00040 
00041 const struct NyLPC_TJsonRpcClassDef MbedJsApi::RPC_MBED_PORT_IN={
00042     "mbedJS","PortIn",func_table
00043 };
00044 
00045 
00046 
00047 }