Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
102:715f754cf5a8
Parent:
98:8eab18d03ac2
Child:
108:85d3e4a6e4bb
Child:
109:bb4ef6a4bd0a
Child:
113:001ad47df8ec
Child:
116:7337ed514891
--- a/src/CommandParser/cmd.cpp	Wed Sep 21 20:56:26 2016 +0000
+++ b/src/CommandParser/cmd.cpp	Wed Sep 21 22:12:00 2016 +0000
@@ -55,13 +55,14 @@
 // see cmd.h
 const command_table_t cmdlist[] = {
     {"?",                   "help command",                                     cmd_help            },
-    {"create-manual",       "create a manual control",                          cmd_createManual    },
   //{"create-control",      "create a control",                                 cmd_create          },
-    {"create-setpoint",     "create a setpoint control",                        cmd_createSetpoint  },
-    {"destroy-control",     "destroy a control",                                cmd_destroy         },
+    {"cat",                 "cat a file",                                       cmd_cat             },
     {"cif",                 "create a test input file",                         cmd_cif             },
     {"cmf",                 "create a manual control file",                     cmd_cmf             },
     {"cof",                 "create a test output file",                        cmd_cof             },
+    {"create-manual",       "create a manual control",                          cmd_createManual    },
+    {"create-setpoint",     "create a setpoint control",                        cmd_createSetpoint  },
+    {"destroy-control",     "destroy a control",                                cmd_destroy         },
     {"heap",                "show heap statistics",                             cmd_heap            },
     {"help",                "help command",                                     cmd_help            },
     {"log-level",           "get/set mDot log level",                           cmd_logLevel        },
@@ -72,6 +73,7 @@
     {"reset-stats",         "reset current mDot statistics",                    cmd_resetStats      },
     {"rm",                  "remove a user file",                               cmd_rm              },
     {"rssi-stats",          "get current rssi stats",                           cmd_rssiStats       },
+    {"set-time",            "set current time",                                 cmd_settime         },
     {"show-controls",       "display active controls",                          cmd_ShowControls    },
     {"show-outputs",        "dump outputs",                                     cmd_outputs         },
     {"snr-stats",           "get current SNR stats",                            cmd_snrStats        },
@@ -145,6 +147,20 @@
 
 /************************* callback functions *******************************/
 
+void cmd_cat(int argc, char **argv)
+{
+    if ( argc != 2 ) {
+        printf("\rusage: cat <filename>\n");
+        return;
+    }
+    char data_buf[1024];
+    bool rc = GLOBAL_mdot->readUserFile(argv[1], data_buf, sizeof(data_buf));
+    if ( rc != true ) {
+        printf("\rFailed to read %s\n", argv[1]);
+        return;
+    }
+    printf("%s\n", data_buf);
+}
 /*****************************************************************************
  * Function:        cmd_help
  * Description:     displays the list of commands available
@@ -878,6 +894,31 @@
 }
 
 /*****************************************************************************
+ * Function:        cmd_settime
+ * Description:     set real-time clock
+ *
+ * @param           argc-> number of args
+ * @param           argv-> input
+ * @return          none
+ *****************************************************************************/
+void cmd_settime(int argc, char **argv)
+{
+    
+    if ( argc != 7 ) {
+        printf("\rusage:   set-time <yyyy> <mm> <dd> <hh> <mm> <ss>\n");
+        printf("\rexample: set-time 2016 12 25 12 0 0\r\n");
+        return;
+    }
+        
+    rtc_set_time(atoi(argv[1]),     // year
+                 atoi(argv[2]),     // month
+                 atoi(argv[3]),     // day
+                 atoi(argv[4]),     // hr
+                 atoi(argv[5]),     // min
+                 atoi(argv[6]));    // sec
+}
+
+/*****************************************************************************
  * Function:        cmd_simin
  * Description:     simulat input
  *