Jun Furutani / libMiMic

Fork of libMiMic by Ryo Iizuka

Revision:
85:416f8bbbdf54
Parent:
78:8cdb8fc7eda8
--- a/mbed/jsonrpc/RpcHandlerBase.h	Fri Jul 04 02:10:40 2014 +0000
+++ b/mbed/jsonrpc/RpcHandlerBase.h	Fri Jul 04 14:28:46 2014 +0000
@@ -64,6 +64,30 @@
             }
     		return true;
     	}
+    	static bool getParamByte(ModJsonRpc* i_mod,const union NyLPC_TJsonRpcParserResult* i_rpc,unsigned char &o_val,int i_idx)
+    	{
+			if(!NyLPC_TJsonRpcParserResult_getByte(i_rpc,i_idx,(NyLPC_TUInt8*)&o_val)){
+				i_mod->putError(i_rpc->method.id,ModJsonRpc::INVALID_PARAMS);
+				return false;
+			}
+    		return true;
+    	}
+    	static bool getParamByteArray(ModJsonRpc* i_mod,const union NyLPC_TJsonRpcParserResult* i_rpc,const unsigned char* &o_val,unsigned char &o_len,int i_idx)
+    	{
+			if(!NyLPC_TJsonRpcParserResult_getByteArray(i_rpc,i_idx,(const NyLPC_TUInt8**)&o_val,&o_len)){
+				i_mod->putError(i_rpc->method.id,ModJsonRpc::INVALID_PARAMS);
+				return false;
+			}
+    		return true;
+    	}
+    	static bool getParamString(ModJsonRpc* i_mod,const union NyLPC_TJsonRpcParserResult* i_rpc,const char* &o_val,int i_idx)
+    	{
+			if(!NyLPC_TJsonRpcParserResult_getStr(i_rpc,i_idx,(const NyLPC_TChar**)&o_val,NULL)){
+				i_mod->putError(i_rpc->method.id,ModJsonRpc::INVALID_PARAMS);
+				return false;
+			}
+    		return true;
+    	}
     	static bool getParamInt(ModJsonRpc* i_mod,const union NyLPC_TJsonRpcParserResult* i_rpc,int& o_val,int i_idx)
     	{
 			if(!NyLPC_TJsonRpcParserResult_getInt32(i_rpc,i_idx,((NyLPC_TInt32*)&o_val))){