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