Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
232:8a86b5bf38f7
Parent:
231:f22901955e0c
Child:
242:3b0086a6d625
--- a/src/ConfigurationHandler/Controls/CompositeControl.cpp	Wed Oct 19 15:55:40 2016 +0000
+++ b/src/ConfigurationHandler/Controls/CompositeControl.cpp	Wed Oct 19 16:26:02 2016 +0000
@@ -11,6 +11,8 @@
 #include "ModbusMasterApi.h"
 #include "global.h"
 #include <string>
+#include <iostream>
+#include <iomanip>
 
 extern mDot *GLOBAL_mdot;
 
@@ -69,9 +71,7 @@
     // populate the outputs
     for ( int i = 0; i < entries; ++i ) {
         std::string tag = json_value["outputs"][i]["tag"].get<string>();
-        Thread::wait(1000);
         std::string response = json_value["outputs"][i]["responseA"].get<string>();
-        Thread::wait(1000);
         if ( !tag.empty() && !response.empty()  ) {
             OutputElement x = { tag, response };
             outputs.push_back(x);
@@ -196,7 +196,7 @@
     }
     if ( ca->getOp() == ">=" ) {
         if ( value.value >= atof(ca->getOpr().c_str()) ) {
-        return ca->getResultTrue();
+            return ca->getResultTrue();
         } else {
             return ca->getResultFalse();
         }
@@ -296,7 +296,7 @@
 }
 
 //
-// methid:          display
+// method:          display
 // description:     display the pertinents
 //
 // @param           none
@@ -307,21 +307,22 @@
     const char *mapper[] = { "INIT",
                              "START",
                              "CONTROL_OFF",
-                             "CONTROL_ON"
-                           };
-    \
-    printf("\r       control file : %s\n", controlFile.c_str());
-    printf("\r                 id : %s\n", id.c_str());
-    printf("\r                tag : %s\n", tag.c_str());
-    printf("\r           priority : %u\n", priority);
-    printf("\r                 ca : %s\n", ca.c_str());
+                             "CONTROL_ON" };
+
+    printf("\r\n");                           
+    std::cout << left << setw(10) << setfill(' ') << "composite: ";
+    std::cout << left << setw(32) << setfill(' ') << controlFile;
+    std::cout << left << setw(20) << setfill(' ') << id;
+    std::cout << left << setw(20) << setfill(' ') << tag;
+    std::cout << left << setw(6)  << setfill(' ') << priority;
+    std::cout << left << setw(20) << setfill(' ') << ca;
+    std::cout << left << setw(16) << setfill(' ') << mapper[currentState];
 
     vector<OutputElement>::iterator it;
-    printf("\r            outputs :\n");
     for ( it = outputs.begin(); it != outputs.end(); ++it ) {
-        printf("\r                     tag-> %s\n", (*it).tag.c_str());
-        printf("\r                response-> %s\n", (*it).response.c_str());
+        std::cout << left << (*it).tag << ":" << (*it).response << "  ";
     }
-    printf("\r      current state : %s\n", mapper[currentState]);
-    printf("\r\n");
+
+    std::cout.flush();
+
 }
\ No newline at end of file