Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
212:289f63158d2b
Parent:
195:21df85341cb3
Child:
217:d5a2ff093319
--- a/src/OutputTask/OutputTask.cpp	Mon Oct 10 14:16:23 2016 +0000
+++ b/src/OutputTask/OutputTask.cpp	Mon Oct 10 16:06:10 2016 +0000
@@ -18,8 +18,8 @@
 static int  createOutput(const char *controlFile);
 static void loadPersistentOutputs(void);
 static void writeOutputs(const std::string, const std::string);
-static int  enableOutputReq(OutputControlMsg_t *msg);
-static int  disableOutputReq(OutputControlMsg_t *msg);
+static int  enableOutputReqHandler(OutputControlMsg_t *msg);
+static int  disableOutputReqHandler(OutputControlMsg_t *msg);
 static int  unregisterControl(const char *id, unsigned int pri, const char *output);
 
 // The Output Map
@@ -27,10 +27,13 @@
 // this is the main data structure used to distinguish which control has
 // priority of an output. the layout is as-follows:
 //
-// outputMap["o_rly1"]-> Control<"ManCtrl_rly1",       100, ON > <<- highest pri control manipulates relay
-//                       Control<"SetpointCtrl_rly1",  800, OFF> <<- lowest pri (queued up)
-// outputMap["o_rly2"]-> Control<"SetpointCtrl_rly2",  800, ON >
-// outputMap["o_rly3"]-> Control<"TimerControl_rl3",   500, ON>
+// outputMap["o_rly1"]-> Control<"ManControl_rly1",       100, ON > <<- highest pri control manipulates relay
+//                       Control<"SetpointControl_rly1",  800, OFF> <<- lowest pri (queued up)
+//
+// outputMap["o_rly2"]-> Control<"SetpointControl_rly2",  800, ON >
+//
+// outputMap["o_rly3"]-> Control<"TimerControl_rly3",   500, ON>
+//
 //
 // The Control Vector (per relay) is always sorted by priority, whereas
 // the highest priority control is at the front (v.front()) of the
@@ -80,7 +83,7 @@
                     break;
                 case ACTION_CONTROL_ON:
                     logInfo("%s is requesting ON control of %s", msg->id, msg->output_tag);
-                    rc = enableOutputReq(msg);
+                    rc = enableOutputReqHandler(msg);
                     if ( rc != 0 ) {
                         logError("%s: failed to enabled output for %s",
                                  __func__, msg->id);
@@ -88,7 +91,7 @@
                     break;
                 case ACTION_CONTROL_OFF:
                     logInfo("%s is requesting OFF control of %s", msg->id, msg->output_tag);
-                    rc = disableOutputReq(msg);
+                    rc = disableOutputReqHandler(msg);
                     if ( rc != 0 ) {
                         printf("%s: failed to disabled output for %s",
                                __func__, msg->id);
@@ -216,7 +219,6 @@
             recordEvent(pos->first, NULL);
         } else { 
             ModbusMasterWriteRegister(pos->first, pos->second.begin()->getMappedState());
-            printf("\rDEBUG: wrote %u to the modbus map\n", pos->second.begin()->getMappedState());
             recordEvent(pos->first, (Control*)pos->second.begin());
         }
     } else {
@@ -238,9 +240,9 @@
     
     for ( pos = outputMap.begin(); pos != outputMap.end(); ++pos ) {
         if ( pos->second.empty() ) {
-            printf("\r  [%s]->[no controls]\n", pos->first.c_str());
+            printf("\r  [%s]-> [no controls] \n", pos->first.c_str());
         } else {
-            printf("\r  [%s]->", pos->first.c_str());
+            printf("\r  [%s]-> ", pos->first.c_str());
             vector<Control>::iterator i;
             for ( i = pos->second.begin(); i != pos->second.end(); ++i ) {
                 i->display();
@@ -287,13 +289,13 @@
 }
 
 /*****************************************************************************
- * Function:            enableOutputReq
- * Description:         Display a list of outputs and its controls
+ * Function:            enableOutputReqHandler
+ * Description:         handle a reques
  *
  * @param               args -> not used
  * @return              none
  *****************************************************************************/
-static int enableOutputReq(OutputControlMsg_t *msg)
+static int enableOutputReqHandler(OutputControlMsg_t *msg)
 {
     // attempt to find the output in the map
     StringOutputVector_t::iterator pos;
@@ -334,13 +336,13 @@
 }
 
 /*****************************************************************************
- * Function:            disableOutputReq
+ * Function:            disableOutputReqHandler
  * Description:
  *
  * @param               args -> not used
  * @return              none
  *****************************************************************************/
-static int disableOutputReq(OutputControlMsg_t *msg)
+static int disableOutputReqHandler(OutputControlMsg_t *msg)
 {
     // attempt to find the output in the map
     StringOutputVector_t::iterator pos;
@@ -468,4 +470,3 @@
         }
     }
 }
-