Ryo Iizuka / libMiMic

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Files at this revision

API Documentation at this revision

Comitter:
nyatla
Date:
Sat Jun 14 15:55:57 2014 +0000
Parent:
74:fc7f46e67229
Child:
76:b375b3d750d8
Commit message:
MiMicCore r360???; mbed???????

Changed in this revision

core/NyLPC_cMiMicEnv.c Show annotated file Show diff for this revision Revisions of this file
core/http/json/NyLPC_cJsonRpcParser.c Show annotated file Show diff for this revision Revisions of this file
mbed/jsonrpc/MbedApi.h Show diff for this revision Revisions of this file
mbed/jsonrpc/MbedJsApi.h Show annotated file Show diff for this revision Revisions of this file
mbed/jsonrpc/RpcDigitalOut.cpp Show annotated file Show diff for this revision Revisions of this file
mbed/mimic.h Show annotated file Show diff for this revision Revisions of this file
mbed/mod/ModJsonRpc.cpp Show annotated file Show diff for this revision Revisions of this file
mbed/mod/ModJsonRpc.h Show annotated file Show diff for this revision Revisions of this file
--- a/core/NyLPC_cMiMicEnv.c	Sat Jun 14 02:25:19 2014 +0000
+++ b/core/NyLPC_cMiMicEnv.c	Sat Jun 14 15:55:57 2014 +0000
@@ -1,7 +1,7 @@
 #include "NyLPC_cMiMicEnv.h"
 #include "../uip/NyLPC_cUipService_protected.h"
 
-const static char* VERSION="MiMic/1.5.3";
+const static char* VERSION="MiMic/1.5.4";
 
 #if NyLPC_MCU==NyLPC_MCU_LPC4088
 const static char* MCU="LPC4088";
--- a/core/http/json/NyLPC_cJsonRpcParser.c	Sat Jun 14 02:25:19 2014 +0000
+++ b/core/http/json/NyLPC_cJsonRpcParser.c	Sat Jun 14 15:55:57 2014 +0000
@@ -7,6 +7,9 @@
 
 NyLPC_TBool NyLPC_TJsonRpcParserResult_getUInt32(const union NyLPC_TJsonRpcParserResult* i_struct,NyLPC_TInt16 i_idx,NyLPC_TUInt32* o_val)
 {
+	if(i_struct->method.param_index[i_idx]==0xff){
+		return NyLPC_TBool_FALSE;
+	}
 	if(i_struct->method.class_def->functions[i_struct->method.func_number].param_patt[i_idx]!=NyLPC_cJsonRpcParser_TYPE_UINT32){
 		return NyLPC_TBool_FALSE;
 	}
@@ -15,6 +18,9 @@
 }
 NyLPC_TBool NyLPC_TJsonRpcParserResult_getInt32(const union NyLPC_TJsonRpcParserResult* i_struct, NyLPC_TInt16 i_idx, NyLPC_TInt32* o_val)
 {
+	if(i_struct->method.param_index[i_idx]==0xff){
+		return NyLPC_TBool_FALSE;
+	}
 	if (i_struct->method.class_def->functions[i_struct->method.func_number].param_patt[i_idx] != NyLPC_cJsonRpcParser_TYPE_INT32){
 		return NyLPC_TBool_FALSE;
 	}
@@ -23,6 +29,9 @@
 }
 NyLPC_TBool NyLPC_TJsonRpcParserResult_getStr(const union NyLPC_TJsonRpcParserResult* i_struct, NyLPC_TInt16 i_idx, const NyLPC_TChar** o_val)
 {
+	if(i_struct->method.param_index[i_idx]==0xff){
+		return NyLPC_TBool_FALSE;
+	}
 	if (i_struct->method.class_def->functions[i_struct->method.func_number].param_patt[i_idx] != NyLPC_cJsonRpcParser_TYPE_STRING){
 		return NyLPC_TBool_FALSE;
 	}
@@ -31,6 +40,9 @@
 }
 NyLPC_TBool NyLPC_TJsonRpcParserResult_getByte(const union NyLPC_TJsonRpcParserResult* i_struct, NyLPC_TInt16 i_idx, NyLPC_TUInt8* o_val)
 {
+	if(i_struct->method.param_index[i_idx]==0xff){
+		return NyLPC_TBool_FALSE;
+	}
 	if (i_struct->method.class_def->functions[i_struct->method.func_number].param_patt[i_idx] != NyLPC_cJsonRpcParser_TYPE_BYTE){
 		return NyLPC_TBool_FALSE;
 	}
--- a/mbed/jsonrpc/MbedApi.h	Sat Jun 14 02:25:19 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-namespace MiMic
-{
-    extern const struct NyLPC_TJsonRpcMethodDef RpcDigitalOut[];
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed/jsonrpc/MbedJsApi.h	Sat Jun 14 15:55:57 2014 +0000
@@ -0,0 +1,9 @@
+#pragma once
+#include "NyLPC_http.h"
+namespace MiMic
+{
+    class MbedJsApi{
+    public:
+        const static struct NyLPC_TJsonRpcClassDef RPC_MBED_DIGITAL_OUT;
+    };
+}
\ No newline at end of file
--- a/mbed/jsonrpc/RpcDigitalOut.cpp	Sat Jun 14 02:25:19 2014 +0000
+++ b/mbed/jsonrpc/RpcDigitalOut.cpp	Sat Jun 14 15:55:57 2014 +0000
@@ -1,5 +1,5 @@
-#include "NyLPC_http.h"
 #include "mod/ModJsonRpc.h"
+#include "MbedJsApi.h"
 #include "mbed.h"
 namespace MiMic
 {
@@ -93,15 +93,18 @@
     
     
     
-    const struct NyLPC_TJsonRpcMethodDef RpcDigitalOut[]=
-    {
-        { "_new1"   ,"u"    ,DigitalOutHandler::new1},
-        { "_new2"   ,"ud"   ,DigitalOutHandler::new2},
-        { "write"   ,"dd"   ,DigitalOutHandler::write},
-        { "read"    ,"d"    ,DigitalOutHandler::read},
-        { NULL      ,NULL   ,NULL}
-    };
-    
+const static struct NyLPC_TJsonRpcMethodDef func_table[]=
+{
+    { "_new1"   ,"u"    ,DigitalOutHandler::new1},
+    { "_new2"   ,"ud"   ,DigitalOutHandler::new2},
+    { "write"   ,"dd"   ,DigitalOutHandler::write},
+    { "read"    ,"d"    ,DigitalOutHandler::read},
+    { NULL      ,NULL   ,NULL}
+};
+
+const struct NyLPC_TJsonRpcClassDef MbedJsApi::RPC_MBED_DIGITAL_OUT={
+    "mbedJS","DigitalOut",func_table
+};
 
 
 
--- a/mbed/mimic.h	Sat Jun 14 02:25:19 2014 +0000
+++ b/mbed/mimic.h	Sat Jun 14 15:55:57 2014 +0000
@@ -12,6 +12,7 @@
 #include "TcpSocket.h"
 #include "UdpSocket.h"
 #include "HttpClient.h"
+#include "jsonrpc/MbedJsApi.h"
 
 #include "mod/ModUrl.h"
 #include "mod/ModRomFiles.h"
--- a/mbed/mod/ModJsonRpc.cpp	Sat Jun 14 02:25:19 2014 +0000
+++ b/mbed/mod/ModJsonRpc.cpp	Sat Jun 14 15:55:57 2014 +0000
@@ -70,7 +70,7 @@
         return false;
     }
 
-    void ModJsonRpc::dispatchRpcCall()
+    void ModJsonRpc::dispatchRpc()
     {
         const union NyLPC_TJsonRpcParserResult* rpc_result;
         if(this->_mod==NULL){
--- a/mbed/mod/ModJsonRpc.h	Sat Jun 14 02:25:19 2014 +0000
+++ b/mbed/mod/ModJsonRpc.h	Sat Jun 14 15:55:57 2014 +0000
@@ -48,7 +48,7 @@
          * true if successful;otherwishe false.
          */
         bool execute(HttpdConnection& i_connection);
-        void dispatchRpcCall();
+        void dispatchRpc();
         
     public:
         //for development