OSDN Git Service

mbed/LPCXpresso version
[mimic/MiMicSDK.git] / projects / app.RemoteMCU / src / sketch.c
index 1c795a6..fb2c039 100644 (file)
@@ -36,9 +36,11 @@ static struct{
        NyLPC_TUInt8 setup_access;\r
 }cgi_setting;\r
 static NyLPC_TUInt16 port;\r
-\r
 static NyLPC_TcMutex_t _vm_mutex;\r
-\r
+/**\r
+ * プラットフォーム名\r
+ */\r
+static const char* _platform_name="Unknown platform";\r
 \r
 #define ACCESS_CTRL_SUBNET 0x00 //default\r
 #define ACCESS_CTRL_ALL 0x01\r
@@ -53,7 +55,7 @@ static NyLPC_TcMutex_t _vm_mutex;
 \r
 //MVMのVERSION情報\r
 #define MVM_VERSION "MiMicVM/1.0;Json/1.0"\r
-#define APPLICATION_VERSION "MiMicRemoteMCU/1.1;LPCXpresso1769"\r
+#define APPLICATION_VERSION "MiMicRemoteMCU/1.2"\r
 //スレッドのスタックサイズ\r
 #define THREAD_STACK_SIZE 256+256\r
 \r
@@ -255,6 +257,17 @@ void loop(void)
 \r
        NyLPC_cTcpListener_initialize(&listener,port);\r
        NyLPC_cUipService_start(&config);\r
+       //プラットフォーム名を推測(デバイス名の初めの1文字だけ見る。)\r
+       switch(*(NyLPC_cUipService_refDeviceName())){\r
+       case 'L':\r
+               _platform_name="LPCXPresso1769";\r
+               break;\r
+       case 'D':\r
+               _platform_name="mbed";\r
+               break;\r
+       default:\r
+               break;\r
+       }\r
        for(;;){\r
                //ターミネイト状態のタスクを検索\r
                for(i=0;i<NUM_OF_TH;i++){\r
@@ -410,8 +423,8 @@ static NyLPC_TBool writeSetupUpdateJson(NyLPC_TcHttpStream_t* i_st,const struct
 \r
        //JSONを書く。\r
        if(!NyLPC_cHttpBodyWriter_format(&(work.bw),\r
-               "{application:\""APPLICATION_VERSION"\",result:0x%x}",\r
-               ret?0x80000000:0x00000000))\r
+               "{application:\""APPLICATION_VERSION";%s\",result:0x%x}",\r
+               _platform_name,ret?0x80000000:0x00000000))\r
        {\r
                return NyLPC_TBool_FALSE;\r
        }\r
@@ -453,7 +466,8 @@ static NyLPC_TBool writeSetupCurrentJson(NyLPC_TcHttpStream_t* i_st,const struct
 \r
        //JSONを書く。\r
        if(!NyLPC_cHttpBodyWriter_format(&(work.bw),\r
-               "{application:\""APPLICATION_VERSION"\",mac00010203:0x%x,mac0405xxxx:0x%x,ip:0x%x,mask:0x%x,droute:0x%x,port:0x%x,access:0x%x}",\r
+               "{application:\""APPLICATION_VERSION";%s\",mac00010203:0x%x,mac0405xxxx:0x%x,ip:0x%x,mask:0x%x,droute:0x%x,port:0x%x,access:0x%x}",\r
+               _platform_name,\r
                config->mac_00_01_02_03,\r
                config->mac_04_05_xx_xx,\r
                config->ipv4_addr_net,\r
@@ -500,7 +514,7 @@ static NyLPC_TBool writeStatus(NyLPC_TcHttpStream_t* i_st,const struct TRemoteMc
        NyLPC_cHttpBodyWriter_setChunked(&(work.bw));\r
 \r
        //JSONを書く。\r
-       if(!NyLPC_cHttpBodyWriter_format(&(work.bw),"{application:\""APPLICATION_VERSION"\"}")){\r
+       if(!NyLPC_cHttpBodyWriter_format(&(work.bw),"{application:\""APPLICATION_VERSION";%s\"}",_platform_name)){\r
                return NyLPC_TBool_FALSE;\r
        }\r
        //エラーチェック\r