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
RpcBusIn.cpp
00001 #include "RpcHandlerBase.h" 00002 namespace MiMic 00003 { 00004 class BusInHandler :RpcHandlerBase 00005 { 00006 public: 00007 static NyLPC_TBool new1(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param) 00008 { 00009 //uuuuuuuuuuuuuuuu 00010 ModJsonRpc* mod=((ModJsonRpc::TcJsonRpcEx_t*)i_param)->cppmod_ptr; 00011 PinName pin[16]; 00012 if(getParamsAsPin(mod,i_rpc,pin,16)){ 00013 addNewObjectBatch(mod,i_rpc->method.id,new ModJsonRpc::RpcObject<BusIn>(new BusIn(pin))); 00014 } 00015 return NyLPC_TBool_TRUE; 00016 } 00017 static NyLPC_TBool read(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param) 00018 { 00019 //d return d 00020 ModJsonRpc* mod=((ModJsonRpc::TcJsonRpcEx_t*)i_param)->cppmod_ptr; 00021 BusIn* inst=(BusIn*)getObjectBatch(mod,i_rpc); 00022 if(inst!=NULL){ 00023 mod->putResult(i_rpc->method.id,"%d",(int)(inst->read())); 00024 } 00025 return NyLPC_TBool_TRUE; 00026 } 00027 static NyLPC_TBool mode(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param) 00028 { 00029 //dd return void 00030 ModJsonRpc* mod=((ModJsonRpc::TcJsonRpcEx_t*)i_param)->cppmod_ptr; 00031 BusIn* inst=(BusIn*)getObjectBatch(mod,i_rpc); 00032 if(inst!=NULL){ 00033 int v; 00034 if(getParamInt(mod,i_rpc,v,1)){ 00035 inst->mode(pinmodeId2PinMode(v)); 00036 mod->putResult(i_rpc->method.id); 00037 } 00038 } 00039 return NyLPC_TBool_TRUE; 00040 } 00041 }; 00042 00043 00044 00045 const static struct NyLPC_TJsonRpcMethodDef func_table[]= 00046 { 00047 { "_new1" ,"uuuuuuuuuuuuuuuuu",BusInHandler::new1}, 00048 { "read" ,"d" ,BusInHandler::read}, 00049 { "mode" ,"dd" ,BusInHandler::mode}, 00050 { NULL ,NULL ,NULL} 00051 }; 00052 00053 const struct NyLPC_TJsonRpcClassDef MbedJsApi::RPC_MBED_BUS_IN={ 00054 "mbedJS","BusIn",func_table 00055 }; 00056 00057 00058 00059 }
Generated on Tue Jul 12 2022 16:22:59 by
