Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
64:994c14fc972c
Parent:
61:ae6dd6692c7d
Parent:
63:0ded43237b22
Child:
65:be025ac18fb5
--- a/src/CommandParser/cmd.cpp	Thu Sep 15 21:24:23 2016 +0000
+++ b/src/CommandParser/cmd.cpp	Thu Sep 15 21:40:39 2016 +0000
@@ -37,6 +37,7 @@
 #include "ConfigurationHandler.h"
 #include "mDot.h"
 #include "rtos.h"
+#include "rtc.h"
 
 Serial serial(USBTX, USBRX);
 ntshell_t ntshell;
@@ -71,6 +72,7 @@
     {"snr-stats",           "get current SNR stats",                            cmd_snrStats        },
     {"stack",               "get thread stack usage stats",                     cmd_stack           },
     {"stats",               "get current mDot statistics",                      cmd_stats           },
+    {"time",                "get current time",                                 cmd_time            },
     {NULL, NULL, NULL}
 };
 
@@ -471,11 +473,19 @@
         logInfo("(%d)save file failed, status=%d", __LINE__, status);
     }
 
-    logInfo("Sending Mail To ModbusMasterMailBox, filename=%s", argv[1]);
-    Message_t *mail = ModbusMasterMailBox.alloc();
-    mail->action = ACTION_READ_FILE;
-    strncpy( mail->controlFile, argv[1], (sizeof(mail->controlFile)-1));
-    ModbusMasterMailBox.put(mail);
+    // send a message to the modbust master
+    logInfo("Sending mail to ModbusMasterMailBox, filename=%s", argv[1]);
+    Message_t *modbus_mail = ModbusMasterMailBox.alloc();
+    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();
+    output_mail->action = ACTION_NEW;
+    strncpy(output_mail->controlFile, argv[1], sizeof(output_mail->controlFile)-1);
+    OutputMasterMailBox.put(output_mail);
 }
 
 /*****************************************************************************
@@ -652,16 +662,39 @@
 }
 
 /*****************************************************************************
+<<<<<<< local
  * Function:        cmd_modmap
  * Description:     dump modbus register map
+=======
+ * Function:        cmd_time
+ * Description:     display real-time clock 
+>>>>>>> other
  *
+<<<<<<< local
  * @param           argc-> number of args
+=======
+ * @param           argc (not used)
+ * @param           argv (not used)
+>>>>>>> other
  * @return          none
  *****************************************************************************/
+<<<<<<< local
 void cmd_modmap(int argc, char **argv)
+=======
+void cmd_time(int argc, char **argv)
+>>>>>>> other
 {
+<<<<<<< local
     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 );
     }
+=======
+    UNUSED(argc);
+    UNUSED(argv);
+
+    int iyr=0, imo=0, idy=0, ihr=0, imn=0, isc=0;
+    rtc_get_time(&iyr, &imo, &idy, &ihr, &imn, &isc);
+    printf("%04d-%02d-%02d %02d:%02d:%02d\r\n", iyr, imo, idy, ihr, imn, isc);
+>>>>>>> other
 }
\ No newline at end of file