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.
Fork of libMiMic by
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 }
Generated on Tue Jul 12 2022 16:22:59 by
1.7.2
