1 #include "NyLPC_net.h"
\r
6 //static NyLPC_TBool write(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
9 // NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
10 // NyLPC_TUInt8* addr;
\r
11 // NyLPC_TUInt8 v,mask;
\r
12 // if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,0,((NyLPC_TUInt32*)&addr))){
\r
13 // if(NyLPC_TJsonRpcParserResult_getByte(i_rpc,1,((NyLPC_TUInt8*)&v))){
\r
14 // if(NyLPC_TJsonRpcParserResult_getByte(i_rpc,2,((NyLPC_TUInt8*)&mask))){
\r
15 // *addr=((*addr)&(~mask))|((*addr)|mask);
\r
16 // return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"");
\r
20 // NyLPC_cModJsonRpc_putError(mod,i_rpc->method.id,NyLPC_TJsonRpcErrorCode_INVALID_PARAMS);
\r
21 // return NyLPC_TBool_FALSE;
\r
26 //static NyLPC_TBool read(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
29 // NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
30 // NyLPC_TUInt8* addr;
\r
31 // if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,0,((NyLPC_TUInt32*)&addr))){
\r
32 // return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"%u",(int)(*addr));
\r
34 // NyLPC_cModJsonRpc_putError(mod,i_rpc->method.id,NyLPC_TJsonRpcErrorCode_INVALID_PARAMS);
\r
35 // return NyLPC_TBool_FALSE;
\r
41 //static NyLPC_TBool write32(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
44 // NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
45 // NyLPC_TUInt32* addr;
\r
46 // NyLPC_TUInt32 v,mask;
\r
47 // if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,0,((NyLPC_TUInt32*)&addr))){
\r
48 // if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,1,((NyLPC_TUInt32*)&v))){
\r
49 // if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,2,((NyLPC_TUInt32*)&mask))){
\r
50 // *addr=((*addr)&(~mask))|((*addr)|mask);
\r
51 // return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"");
\r
55 // NyLPC_cModJsonRpc_putError(mod,i_rpc->method.id,NyLPC_TJsonRpcErrorCode_INVALID_PARAMS);
\r
56 // return NyLPC_TBool_FALSE;
\r
61 //static NyLPC_TBool read32(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
64 // NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
65 // NyLPC_TUInt32* addr;
\r
67 // if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,0,((NyLPC_TUInt32*)&addr))){
\r
69 // return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"%u",v);
\r
71 // NyLPC_cModJsonRpc_putError(mod,i_rpc->method.id,NyLPC_TJsonRpcErrorCode_INVALID_PARAMS);
\r
72 // return NyLPC_TBool_FALSE;
\r
77 static NyLPC_TBool init(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
80 NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
81 return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"");
\r
87 static NyLPC_TBool write(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
90 NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
92 const NyLPC_TUInt8* v;
\r
94 if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,0,((NyLPC_TUInt32*)&addr))){
\r
95 if(NyLPC_TJsonRpcParserResult_getByteArray(i_rpc,1,&v,&l)){
\r
97 return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"");
\r
100 NyLPC_cModJsonRpc_putError(mod,i_rpc->method.id,NyLPC_TJsonRpcErrorCode_INVALID_PARAMS);
\r
101 return NyLPC_TBool_FALSE;
\r
106 static NyLPC_TBool read(const union NyLPC_TJsonRpcParserResult* i_rpc,void* i_param)
\r
109 NyLPC_TcModJsonRpc_t* mod=(NyLPC_TcModJsonRpc_t*)i_param;
\r
110 NyLPC_TUInt8* addr;
\r
112 if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,0,((NyLPC_TUInt32*)&addr))){
\r
113 if(NyLPC_TJsonRpcParserResult_getUInt32(i_rpc,1,((NyLPC_TUInt32*)&l))){
\r
114 return NyLPC_cModJsonRpc_putResult(mod,i_rpc->method.id,"\"%.*B\"",(int)l,addr);
\r
117 NyLPC_cModJsonRpc_putError(mod,i_rpc->method.id,NyLPC_TJsonRpcErrorCode_INVALID_PARAMS);
\r
118 return NyLPC_TBool_FALSE;
\r
123 const static struct NyLPC_TJsonRpcMethodDef func_table[]=
\r
125 { "init" ,"" ,init},
\r
126 { "write" ,"uB" ,write},
\r
127 { "read" ,"uu" ,read},
\r
128 { NULL ,NULL ,NULL}
\r
131 const struct NyLPC_TJsonRpcClassDef NyLPC_cJsonRpcFunction_Memory={
\r
132 "MiMic","Memory",func_table
\r