Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
67:49f266601d83
Parent:
66:db1425574b58
Child:
71:34856d21f2bf
--- a/src/CommandParser/cmd.cpp	Thu Sep 15 22:26:28 2016 +0000
+++ b/src/CommandParser/cmd.cpp	Fri Sep 16 15:30:47 2016 +0000
@@ -54,7 +54,7 @@
 // see cmd.h
 const command_table_t cmdlist[] = {
     {"?",                   "help command",                                     cmd_help            },
-    {"create",              "create a control",                                 cmd_create          },
+    {"create-control",      "create a control",                                 cmd_create          },
     {"destroy",             "destroy a control",                                cmd_destroy         },
     {"ccf",                 "create a test control file",                       cmd_ccf             },
     {"cif",                 "create a test input file",                         cmd_cif             },
@@ -448,12 +448,14 @@
  *****************************************************************************/
 void cmd_cof(int argc, char **argv)
 {
-    if ( argc != 2 ) {
-        printf("\rusage: cof <filename>\r\n");
+    if ( argc != 3 ) {
+        printf("\rusage: cof <filename> <output>\r\n");
+        printf("\rexample: cof output_rly1.json o_rly1\n");
         return;
     }
 
     char data_buf[1024];
+#if 0
     snprintf(data_buf, sizeof(data_buf),
              "{ "
              "\"id\":       \"o_r05\", "
@@ -469,7 +471,23 @@
              "\"scalelo\":  \"0\", "
              "\"scalehi\":  \"100\" }"
             );
+#endif
 
+    snprintf(data_buf, sizeof(data_buf),
+             "{ "
+             "\"id\":       \"%s\", "
+             "\"name\":     \"Relay 5\", "
+             "\"min\":      \"0\", "
+             "\"max\":      \"300\", "
+             "\"node\":     \"20\", "
+             "\"reg\":      \"21\", "
+             "\"rtype\":    \"1\", "
+             "\"type\":     \"16\", "
+             "\"fmt\":      \"%%.2f\", "
+             "\"toperiod\": \"0\", "
+             "\"scalelo\":  \"0\", "
+             "\"scalehi\":  \"100\" }", argv[2]);
+        
     bool status = GLOBAL_mdot->saveUserFile(argv[1], (void *)data_buf, 1024);
     if( status != true ) {
         logInfo("(%d)save file failed, status=%d", __LINE__, status);
@@ -481,7 +499,7 @@
     modbus_mail->action = ACTION_READ_FILE;
     strncpy( modbus_mail->controlFile, argv[1], (sizeof(modbus_mail->controlFile)-1));
     ModbusMasterMailBox.put(modbus_mail);
-    
+
     // send a message to the output master
     logInfo("Sending mail to OutputMaster, filename = %s", argv[1]);
     OutputControlMsg_t *output_mail = OutputMasterMailBox.alloc();
@@ -671,7 +689,7 @@
 {
     UNUSED(argc);
     UNUSED(argv);
-    
+
     std::map<std::string, ModbusRegister>::iterator iter;
     for (iter = ModbusRegisterMap.begin(); iter != ModbusRegisterMap.end(); ++iter) {
         printf("tag=%s, name=%s, units=%s, node=%d, reg=%d, size=%d, order=%d, value=%2.2f\r\n", iter->first.c_str(), iter->second.name.c_str(), iter->second.units.c_str(), iter->second.node, iter->second.reg, iter->second.size, iter->second.order, iter->second.float_value );
@@ -700,6 +718,6 @@
 {
     UNUSED(argc);
     UNUSED(argv);
-    
+
     DisplayOutputs();
 }
\ No newline at end of file