Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
220:dbe21411f962
Parent:
216:7783e894f7e0
Child:
221:2a5e9902003c
--- a/src/CommandParser/cmd.cpp	Tue Oct 11 18:39:43 2016 +0000
+++ b/src/CommandParser/cmd.cpp	Fri Oct 14 13:32:47 2016 +0000
@@ -64,6 +64,7 @@
     {"cmf",                 "create a manual control file",                     cmd_cmf             },
     {"cmt",                 "create multiple timers",                           cmd_cmt             },
     {"cof",                 "create a test output file",                        cmd_cof             },
+    {"create-comp",         "craete a composite control file",                  cmd_createComposite },
     {"create-mn",           "create a manual control",                          cmd_createManual    },
     {"create-sp",           "create a setpoint control",                        cmd_createSetpoint  },
     {"create-tm",           "create a timer control",                           cmd_createTimer     },
@@ -583,6 +584,52 @@
     }
 }
 
+void cmd_createComposite(int argc, char **argv)
+{
+    if ( argc != 2 ) {
+        printf("\rusage:    create-comp control_cm_1.json\n");
+        return;
+    }
+
+    char data_buf[MAX_FILE_SIZE];
+    snprintf(data_buf, sizeof(data_buf),
+             "{ "
+             "\"id\":           \"FLOW_OVERRIDE\",  "
+             "\"input\":        \"i_flowswitch\",  "
+             "\"ca\":           \"EQUAL_TO_1\",   "
+             "\"priority\":     \"400\", "
+             "\"entries\":      \"2\", " 
+             "\"outputs\": [ "
+             "{"
+                 "\"tag\": \"o_rly01\", "
+                 "\"response\": \"fixed off\" "
+             "},"
+             "{"
+                "\"tag\": \"o_rly02\", "
+                "\"response\": \"fixed off\" "
+             "}"
+             "]"
+             "}"
+            ); 
+    bool status = GLOBAL_mdot->saveUserFile(argv[1], (void *)data_buf, MAX_FILE_SIZE);
+    if ( status != true ) {
+        printf("\rFailed to save user file %s\n", argv[1]);
+        return;
+    }
+    
+    // send a message to the configuration handler to create the control
+    Message_t *msg  = MailBox.alloc();
+    memset(msg, 0, sizeof(Message_t));
+    msg->action  = ACTION_CREATE;
+    msg->control = CONTROL_COMPOSITE;
+    strncpy(msg->controlFile, argv[1], sizeof(msg->controlFile)-1);
+
+    printf("%s: Sending a create request for control %s type = %u\r\n",
+           __func__, msg->controlFile, msg->control);
+
+    MailBox.put(msg);
+}
+
 /*****************************************************************************
  * Function:        cmd_createManual
  * Description:     create a manual control
@@ -599,7 +646,7 @@
         printf("\rexample: create-manual control_mn_1.json man-1 o_rly1 1\r\n");
         return;
     }
-    
+
     string state(argv[4]);
 
     if ( state == "on" ) {
@@ -610,7 +657,7 @@
         printf("\r<state> must be on or off\r\n");
         return;
     }
-        
+
     char data_buf[MAX_FILE_SIZE];
     snprintf(data_buf, sizeof(data_buf),
              "{ "
@@ -984,44 +1031,43 @@
 void cmd_modifyManual(int argc, char **argv)
 {
     std::string relayState;
-    
+
     if ( argc != 3 ) {
         printf("\rusage:    modify-mn <controlFile> <state>\n");
         printf("\rexample:  modify-mn control_mn_rly1.json on\n");
         return;
     }
-    
+
     string state(argv[2]);
     if ( state == "on" ) {
         relayState = "1";
     } else if ( state == "off" ) {
         relayState = "0";
-    }
-    else {
+    } else {
         printf("\r<state> must be ON or OFF\n");
         return;
     }
-    
+
     char buf[MAX_FILE_SIZE];
     bool rc = GLOBAL_mdot->readUserFile(argv[1], (void*)buf, MAX_FILE_SIZE);
     if ( rc != true ) {
         printf("\rFailed to read %s\n", argv[1]);
         return;
     }
-    
+
     MbedJSONValue json_value;
     parse(json_value, buf);
 
     json_value["state"] = relayState;
-    
+
     std::string s = json_value.serialize();
-    
+
     rc = GLOBAL_mdot->saveUserFile(argv[1], (void*)s.c_str(), MAX_FILE_SIZE);
     if ( rc != true ) {
         printf("\rFailed to write %s\n", argv[1]);
         return;
     }
-    
+
     // send a message to the configuration handler to create the control
     Message_t *msg  = MailBox.alloc();
     memset(msg, 0, sizeof(Message_t));
@@ -1062,15 +1108,15 @@
 
     json_value["setpoint"] = argv[2];
     json_value["tol"] = argv[3];
-    
+
     std::string s = json_value.serialize();
-    
+
     rc = GLOBAL_mdot->saveUserFile(argv[1], (void*)s.c_str(), MAX_FILE_SIZE);
     if ( rc != true ) {
         printf("\rFailed to write %s\n", argv[1]);
         return;
     }
-    
+
     // send a message to the configuration handler to create the control
     Message_t *msg  = MailBox.alloc();
     memset(msg, 0, sizeof(Message_t));
@@ -1643,9 +1689,9 @@
              "\"opr\":\"%s\", "
              "\"op\":\"%s\", "
              "\"c\":\"%s\" } ", "TEMP_CONV_PH01", "i_ph_temp01", "i_ph_temp01", "", "/", "1000.0");
-             
+
     printf("JSON=%s\r\n",buf);
-             
+
     rc = GLOBAL_mdot->saveUserFile("vcmd_TEMP_CONV_PH01.json", (void *)buf, MAX_FILE_SIZE);
     if( rc != true ) {
         printf("(%d)save file failed, status=%d\r\n", __LINE__, rc);
@@ -1656,9 +1702,9 @@
     mail->action = ACTION_READ_FILE;
     strncpy( mail->controlFile, "vcmd_TEMP_CONV_PH01.json", (sizeof(mail->controlFile)-1));
     ModbusMasterMailBox.put(mail);
-    
+
     Thread::wait(5000);
-    
+
     snprintf(buf, sizeof(buf),
              "{ "
              "\"id\":\"%s\", "
@@ -1667,9 +1713,9 @@
              "\"opr\":\"%s\", "
              "\"op\":\"%s\", "
              "\"c\":\"%s\" } ", "TEMP_CONV_BDCOND01", "i_cond_temp01", "i_cond_temp01", "", "/", "1000.0");
-             
+
     printf("JSON=%s\r\n",buf);
-             
+
     rc = GLOBAL_mdot->saveUserFile("vcmd_TEMP_CONV_BDCOND01.json", (void *)buf, MAX_FILE_SIZE);
     if( rc != true ) {
         printf("(%d)save file failed, status=%d\r\n", __LINE__, rc);
@@ -1680,7 +1726,7 @@
     mail->action = ACTION_READ_FILE;
     strncpy( mail->controlFile, "vcmd_TEMP_CONV_BDCOND01.json", (sizeof(mail->controlFile)-1));
     ModbusMasterMailBox.put(mail);
-    
+
     Thread::wait(5000);
 
     // OUTPUT: Relay 01
@@ -1771,96 +1817,96 @@
 
     Thread::wait(2000);
 
-/*
-    // OUTPUT: Relay 03
-    snprintf(buf, sizeof(buf),
-             "{ "
-             "\"id\": \"o_rly03\", "
-             "\"name\": \"Bleach\", "
-             "\"units\": \"\", "
-             "\"min\":  \"0\", "
-             "\"max\": \"300\", "
-             "\"node\": \"50\", "
-             "\"reg\": \"3\", "
-             "\"rtype\": \"1\", "
-             "\"type\": \"0\", "
-             "\"size\": \"2\", "
-             "\"order\": \"2\", "
-             "\"fmt\": \"%%.2f\", "
-             "\"vcmd\": \"\", "
-             "\"rfreq\": \"5\", "
-             "\"toperiod\": \"0\", "
-             "\"scalelo\": \"0\", "
-             "\"scalehi\": \"100\" }");
-    rc = GLOBAL_mdot->saveUserFile("output_o_rly03.json", (void *)buf, MAX_FILE_SIZE);
-    if ( rc != true ) {
-        printf("\rFailed to save output_o_rly03.json\n");
-        return;
-    } else {
-        printf("\r...generated output_o_rly03.json\n");
-    }
+    /*
+        // OUTPUT: Relay 03
+        snprintf(buf, sizeof(buf),
+                 "{ "
+                 "\"id\": \"o_rly03\", "
+                 "\"name\": \"Bleach\", "
+                 "\"units\": \"\", "
+                 "\"min\":  \"0\", "
+                 "\"max\": \"300\", "
+                 "\"node\": \"50\", "
+                 "\"reg\": \"3\", "
+                 "\"rtype\": \"1\", "
+                 "\"type\": \"0\", "
+                 "\"size\": \"2\", "
+                 "\"order\": \"2\", "
+                 "\"fmt\": \"%%.2f\", "
+                 "\"vcmd\": \"\", "
+                 "\"rfreq\": \"5\", "
+                 "\"toperiod\": \"0\", "
+                 "\"scalelo\": \"0\", "
+                 "\"scalehi\": \"100\" }");
+        rc = GLOBAL_mdot->saveUserFile("output_o_rly03.json", (void *)buf, MAX_FILE_SIZE);
+        if ( rc != true ) {
+            printf("\rFailed to save output_o_rly03.json\n");
+            return;
+        } else {
+            printf("\r...generated output_o_rly03.json\n");
+        }
 
-    // send a message to the modbus master
-    modbus_mail = ModbusMasterMailBox.alloc();
-    modbus_mail->action = ACTION_READ_FILE;
-    strncpy( modbus_mail->controlFile, "output_o_rly03.json", (sizeof(modbus_mail->controlFile)-1));
-    ModbusMasterMailBox.put(modbus_mail);
+        // send a message to the modbus master
+        modbus_mail = ModbusMasterMailBox.alloc();
+        modbus_mail->action = ACTION_READ_FILE;
+        strncpy( modbus_mail->controlFile, "output_o_rly03.json", (sizeof(modbus_mail->controlFile)-1));
+        ModbusMasterMailBox.put(modbus_mail);
 
-    Thread::wait(5000);
+        Thread::wait(5000);
 
-    // send a message to the output master
-    output_mail = OutputMasterMailBox.alloc();
-    output_mail->action = ACTION_NEW;
-    strncpy(output_mail->controlFile, "output_o_rly03.json", sizeof(output_mail->controlFile)-1);
-    OutputMasterMailBox.put(output_mail);
+        // send a message to the output master
+        output_mail = OutputMasterMailBox.alloc();
+        output_mail->action = ACTION_NEW;
+        strncpy(output_mail->controlFile, "output_o_rly03.json", sizeof(output_mail->controlFile)-1);
+        OutputMasterMailBox.put(output_mail);
 
-    Thread::wait(2000);
+        Thread::wait(2000);
 
-    // OUTPUT: Relay 04
-    snprintf(buf, sizeof(buf),
-             "{ "
-             "\"id\": \"o_rly04\", "
-             "\"name\": \"H2SO4\", "
-             "\"units\": \"\", "
-             "\"min\":  \"0\", "
-             "\"max\": \"300\", "
-             "\"node\": \"50\", "
-             "\"reg\": \"4\", "
-             "\"rtype\": \"1\", "
-             "\"type\": \"0\", "
-             "\"size\": \"2\", "
-             "\"order\": \"2\", "
-             "\"fmt\": \"%%.2f\", "
-             "\"vcmd\": \"\", "
-             "\"rfreq\": \"5\", "
-             "\"toperiod\": \"0\", "
-             "\"scalelo\": \"0\", "
-             "\"scalehi\": \"100\" }");
-    rc = GLOBAL_mdot->saveUserFile("output_o_rly04.json", (void *)buf, MAX_FILE_SIZE);
-    if ( rc != true ) {
-        printf("\rFailed to save output_o_rly04.json\n");
-        return;
-    } else {
-        printf("\r...generated output_o_rly04.json\n");
-    }
+        // OUTPUT: Relay 04
+        snprintf(buf, sizeof(buf),
+                 "{ "
+                 "\"id\": \"o_rly04\", "
+                 "\"name\": \"H2SO4\", "
+                 "\"units\": \"\", "
+                 "\"min\":  \"0\", "
+                 "\"max\": \"300\", "
+                 "\"node\": \"50\", "
+                 "\"reg\": \"4\", "
+                 "\"rtype\": \"1\", "
+                 "\"type\": \"0\", "
+                 "\"size\": \"2\", "
+                 "\"order\": \"2\", "
+                 "\"fmt\": \"%%.2f\", "
+                 "\"vcmd\": \"\", "
+                 "\"rfreq\": \"5\", "
+                 "\"toperiod\": \"0\", "
+                 "\"scalelo\": \"0\", "
+                 "\"scalehi\": \"100\" }");
+        rc = GLOBAL_mdot->saveUserFile("output_o_rly04.json", (void *)buf, MAX_FILE_SIZE);
+        if ( rc != true ) {
+            printf("\rFailed to save output_o_rly04.json\n");
+            return;
+        } else {
+            printf("\r...generated output_o_rly04.json\n");
+        }
 
-    // send a message to the modbus master
-    modbus_mail = ModbusMasterMailBox.alloc();
-    modbus_mail->action = ACTION_READ_FILE;
-    strncpy( modbus_mail->controlFile, "output_o_rly04.json", (sizeof(modbus_mail->controlFile)-1));
-    ModbusMasterMailBox.put(modbus_mail);
+        // send a message to the modbus master
+        modbus_mail = ModbusMasterMailBox.alloc();
+        modbus_mail->action = ACTION_READ_FILE;
+        strncpy( modbus_mail->controlFile, "output_o_rly04.json", (sizeof(modbus_mail->controlFile)-1));
+        ModbusMasterMailBox.put(modbus_mail);
 
-    Thread::wait(5000);
+        Thread::wait(5000);
 
-    // send a message to the output master
-    output_mail = OutputMasterMailBox.alloc();
-    output_mail->action = ACTION_NEW;
-    strncpy(output_mail->controlFile, "output_o_rly04.json", sizeof(output_mail->controlFile)-1);
-    OutputMasterMailBox.put(output_mail);
+        // send a message to the output master
+        output_mail = OutputMasterMailBox.alloc();
+        output_mail->action = ACTION_NEW;
+        strncpy(output_mail->controlFile, "output_o_rly04.json", sizeof(output_mail->controlFile)-1);
+        OutputMasterMailBox.put(output_mail);
 
-    Thread::wait(2000);
+        Thread::wait(2000);
 
-*/
+    */
     // SETPOINT: Blowdown
     snprintf(buf, sizeof(buf),
              "{ "
@@ -1927,73 +1973,73 @@
     MailBox.put(sp_msg);
     Thread::wait(2000);
 
-/*
-    // SETPOINT: Acid Base
-    snprintf(buf, sizeof(buf),
-             "{ "
-             "\"id\": \"ACID_BASE_01\", "
-             "\"priority\": \"800\", "
-             "\"input\": \"i_ph01\", "
-             "\"output\": \"o_rly04\", "
-             "\"setpoint\": \"8\", "
-             "\"prodfact\": \"\", "
-             "\"actingDir\": \"1\", "
-             "\"halert\": \"9.10\", "
-             "\"lalert\": \"6.80\", "
-             "\"hfs\": \"9.40\", "
-             "\"lfs\": \"6.40\", "
-             "\"tol\": \".5\" }");
-    rc = GLOBAL_mdot->saveUserFile("control_sp_ph01.json", (void *)buf, MAX_FILE_SIZE);
-    if ( rc != true ) {
-        printf("\rFailed to save control_sp_ph01.json\n");
-        return;
-    } else {
-        printf("\r...generated control_sp_ph01.json\n");
-        Thread::wait(500);
-    }
+    /*
+        // SETPOINT: Acid Base
+        snprintf(buf, sizeof(buf),
+                 "{ "
+                 "\"id\": \"ACID_BASE_01\", "
+                 "\"priority\": \"800\", "
+                 "\"input\": \"i_ph01\", "
+                 "\"output\": \"o_rly04\", "
+                 "\"setpoint\": \"8\", "
+                 "\"prodfact\": \"\", "
+                 "\"actingDir\": \"1\", "
+                 "\"halert\": \"9.10\", "
+                 "\"lalert\": \"6.80\", "
+                 "\"hfs\": \"9.40\", "
+                 "\"lfs\": \"6.40\", "
+                 "\"tol\": \".5\" }");
+        rc = GLOBAL_mdot->saveUserFile("control_sp_ph01.json", (void *)buf, MAX_FILE_SIZE);
+        if ( rc != true ) {
+            printf("\rFailed to save control_sp_ph01.json\n");
+            return;
+        } else {
+            printf("\r...generated control_sp_ph01.json\n");
+            Thread::wait(500);
+        }
 
-    sp_msg  = MailBox.alloc();
-    memset(sp_msg, 0, sizeof(Message_t));
-    sp_msg->action  = ACTION_CREATE;
-    sp_msg->control = CONTROL_SETPOINT;
-    strncpy(sp_msg->controlFile, "control_sp_ph01.json", sizeof(sp_msg->controlFile)-1);
+        sp_msg  = MailBox.alloc();
+        memset(sp_msg, 0, sizeof(Message_t));
+        sp_msg->action  = ACTION_CREATE;
+        sp_msg->control = CONTROL_SETPOINT;
+        strncpy(sp_msg->controlFile, "control_sp_ph01.json", sizeof(sp_msg->controlFile)-1);
 
-    MailBox.put(sp_msg);
-    Thread::wait(2000);
+        MailBox.put(sp_msg);
+        Thread::wait(2000);
 
-    // SETPOINT: MicroBio
-    snprintf(buf, sizeof(buf),
-             "{ "
-             "\"id\": \"MICRO_BIO_01\", "
-             "\"priority\": \"800\", "
-             "\"input\": \"i_orp01\", "
-             "\"output\": \"o_rly03\", "
-             "\"setpoint\": \"350\", "
-             "\"prodfact\": \"\", "
-             "\"actingDir\": \"0\", "
-             "\"halert\": \"500\", "
-             "\"lalert\": \"200\", "
-             "\"hfs\": \"525\", "
-             "\"lfs\": \"150\", "
-             "\"tol\": \"25\" }");
-    rc = GLOBAL_mdot->saveUserFile("control_sp_orp01.json", (void *)buf, MAX_FILE_SIZE);
-    if ( rc != true ) {
-        printf("\rFailed to save control_sp_orp01.json\n");
-        return;
-    } else {
-        printf("\r...generated control_sp_orp01.json\n");
-        Thread::wait(500);
-    }
+        // SETPOINT: MicroBio
+        snprintf(buf, sizeof(buf),
+                 "{ "
+                 "\"id\": \"MICRO_BIO_01\", "
+                 "\"priority\": \"800\", "
+                 "\"input\": \"i_orp01\", "
+                 "\"output\": \"o_rly03\", "
+                 "\"setpoint\": \"350\", "
+                 "\"prodfact\": \"\", "
+                 "\"actingDir\": \"0\", "
+                 "\"halert\": \"500\", "
+                 "\"lalert\": \"200\", "
+                 "\"hfs\": \"525\", "
+                 "\"lfs\": \"150\", "
+                 "\"tol\": \"25\" }");
+        rc = GLOBAL_mdot->saveUserFile("control_sp_orp01.json", (void *)buf, MAX_FILE_SIZE);
+        if ( rc != true ) {
+            printf("\rFailed to save control_sp_orp01.json\n");
+            return;
+        } else {
+            printf("\r...generated control_sp_orp01.json\n");
+            Thread::wait(500);
+        }
 
-    sp_msg  = MailBox.alloc();
-    memset(sp_msg, 0, sizeof(Message_t));
-    sp_msg->action  = ACTION_CREATE;
-    sp_msg->control = CONTROL_SETPOINT;
-    strncpy(sp_msg->controlFile, "control_sp_orp01.json", sizeof(sp_msg->controlFile)-1);
+        sp_msg  = MailBox.alloc();
+        memset(sp_msg, 0, sizeof(Message_t));
+        sp_msg->action  = ACTION_CREATE;
+        sp_msg->control = CONTROL_SETPOINT;
+        strncpy(sp_msg->controlFile, "control_sp_orp01.json", sizeof(sp_msg->controlFile)-1);
 
-    MailBox.put(sp_msg);
-    Thread::wait(2000);
-*/
+        MailBox.put(sp_msg);
+        Thread::wait(2000);
+    */
 }
 
 /*****************************************************************************
@@ -2094,24 +2140,23 @@
 void cmd_regcmd(int argc, char **argv)
 {
     char filename[64];
-    
+
     printf("argc=%d\r\n",argc);
-    
+
     if ( argc != 7 ) {
         printf("\rusage:   regcmd <if> <tag> <opl> <opr> <op> <c>\n");
         printf("\rexample: regcmd TEMP_CONV_PH01 i_ph_temp01 i_ph_temp01 - / 1000\n");
         return;
     }
-    
+
     memset( filename, 0, 64 );
     snprintf( filename, 63, "%s%s%s", "vcmd_", argv[1], ".json" );
     printf("filename=%s\r\n",filename);
-    
+
     std::string opl(argv[4]);
-    
+
     printf("argv[4]=%s, opl=%s\r\n",argv[4], opl.c_str());
-    if( opl.c_str()[0] == '-' )
-    {
+    if( opl.c_str()[0] == '-' ) {
         printf("argv[4]=%s, SETTING TO NULL\r\n",argv[4]);
         opl = "";
     }
@@ -2125,9 +2170,9 @@
              "\"opr\":\"%s\", "
              "\"op\":\"%s\", "
              "\"c\":\"%s\" } ", argv[1], argv[2], argv[3], opl.c_str(), argv[5], argv[6]);
-             
+
     printf("JSON=%s\r\n",data_buf);
-             
+
     bool status = GLOBAL_mdot->saveUserFile(filename, (void *)data_buf, MAX_FILE_SIZE);
     if( status != true ) {
         logInfo("(%d)save file failed, status=%d", __LINE__, status);
@@ -2151,65 +2196,65 @@
  *****************************************************************************/
 void cmd_trimTemp(int argc, char **argv)
 {
-/*
+    /*
+
+        char filename[64];
 
-    char filename[64];
-    
-    memset( filename, 0, 64 );
-    snprintf( filename, 63, "%s%s%s", "vcmd_", "2_DIV_TEMP_PH01", ".json" );
-    printf("filename=%s\r\n",filename);
+        memset( filename, 0, 64 );
+        snprintf( filename, 63, "%s%s%s", "vcmd_", "2_DIV_TEMP_PH01", ".json" );
+        printf("filename=%s\r\n",filename);
 
-    char data_buf[MAX_FILE_SIZE];
-    snprintf(data_buf, sizeof(data_buf),
-             "{ "
-             "\"id\":\"%s\", "
-             "\"tag\":\"%s\", "
-             "\"opl\":\"%s\", "
-             "\"opr\":\"%s\", "
-             "\"op\":\"%s\", "
-             "\"c\":\"%s\" } ", "2_DIV_TEMP_PH01", "i_ph_temp01", "i_ph_temp01", "", "/", "1000.0");
-             
-    printf("JSON=%s\r\n",data_buf);
-             
-    bool status = GLOBAL_mdot->saveUserFile(filename, (void *)data_buf, MAX_FILE_SIZE);
-    if( status != true ) {
-        logInfo("(%d)save file failed, status=%d", __LINE__, status);
-    }
+        char data_buf[MAX_FILE_SIZE];
+        snprintf(data_buf, sizeof(data_buf),
+                 "{ "
+                 "\"id\":\"%s\", "
+                 "\"tag\":\"%s\", "
+                 "\"opl\":\"%s\", "
+                 "\"opr\":\"%s\", "
+                 "\"op\":\"%s\", "
+                 "\"c\":\"%s\" } ", "2_DIV_TEMP_PH01", "i_ph_temp01", "i_ph_temp01", "", "/", "1000.0");
+
+        printf("JSON=%s\r\n",data_buf);
+
+        bool status = GLOBAL_mdot->saveUserFile(filename, (void *)data_buf, MAX_FILE_SIZE);
+        if( status != true ) {
+            logInfo("(%d)save file failed, status=%d", __LINE__, status);
+        }
+
+        logInfo("Sending Mail To ModbusMasterMailBox, filename=%s", filename);
+        Message_t *mail = ModbusMasterMailBox.alloc();
+        mail->action = ACTION_READ_FILE;
+        strncpy( mail->controlFile, filename, (sizeof(mail->controlFile)-1));
+        ModbusMasterMailBox.put(mail);
 
-    logInfo("Sending Mail To ModbusMasterMailBox, filename=%s", filename);
-    Message_t *mail = ModbusMasterMailBox.alloc();
-    mail->action = ACTION_READ_FILE;
-    strncpy( mail->controlFile, filename, (sizeof(mail->controlFile)-1));
-    ModbusMasterMailBox.put(mail);
-    
-    Thread::wait(5000);
-    
-    memset( filename, 0, 64 );
-    snprintf( filename, 63, "%s%s%s", "vcmd_", "1_CONST_TEMP_PH01", ".json" );
-    printf("filename=%s\r\n",filename);
+        Thread::wait(5000);
+
+        memset( filename, 0, 64 );
+        snprintf( filename, 63, "%s%s%s", "vcmd_", "1_CONST_TEMP_PH01", ".json" );
+        printf("filename=%s\r\n",filename);
+
+        snprintf(data_buf, sizeof(data_buf),
+                 "{ "
+                 "\"id\":\"%s\", "
+                 "\"tag\":\"%s\", "
+                 "\"opl\":\"%s\", "
+                 "\"opr\":\"%s\", "
+                 "\"op\":\"%s\", "
+                 "\"c\":\"%s\" } ", "1_CONST_TEMP_PH01", "i_ph_temp01", "i_ph_temp01", "", "=", "26000.0");
 
-    snprintf(data_buf, sizeof(data_buf),
-             "{ "
-             "\"id\":\"%s\", "
-             "\"tag\":\"%s\", "
-             "\"opl\":\"%s\", "
-             "\"opr\":\"%s\", "
-             "\"op\":\"%s\", "
-             "\"c\":\"%s\" } ", "1_CONST_TEMP_PH01", "i_ph_temp01", "i_ph_temp01", "", "=", "26000.0");
-             
-    printf("JSON=%s\r\n",data_buf);
-             
-    status = GLOBAL_mdot->saveUserFile(filename, (void *)data_buf, MAX_FILE_SIZE);
-    if( status != true ) {
-        logInfo("(%d)save file failed, status=%d", __LINE__, status);
-    }
+        printf("JSON=%s\r\n",data_buf);
+
+        status = GLOBAL_mdot->saveUserFile(filename, (void *)data_buf, MAX_FILE_SIZE);
+        if( status != true ) {
+            logInfo("(%d)save file failed, status=%d", __LINE__, status);
+        }
 
-    logInfo("Sending Mail To ModbusMasterMailBox, filename=%s", filename);
-    mail = ModbusMasterMailBox.alloc();
-    mail->action = ACTION_READ_FILE;
-    strncpy( mail->controlFile, filename, (sizeof(mail->controlFile)-1));
-    ModbusMasterMailBox.put(mail);
-    
-    Thread::wait(5000);
-*/
+        logInfo("Sending Mail To ModbusMasterMailBox, filename=%s", filename);
+        mail = ModbusMasterMailBox.alloc();
+        mail->action = ACTION_READ_FILE;
+        strncpy( mail->controlFile, filename, (sizeof(mail->controlFile)-1));
+        ModbusMasterMailBox.put(mail);
+
+        Thread::wait(5000);
+    */
 }
\ No newline at end of file