Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
230:11765008ff3a
Parent:
229:0d6755d765fd
Child:
231:f22901955e0c
diff -r 0d6755d765fd -r 11765008ff3a src/ConfigurationHandler/Controls/CompositeControl.cpp
--- a/src/ConfigurationHandler/Controls/CompositeControl.cpp	Tue Oct 18 14:18:30 2016 +0000
+++ b/src/ConfigurationHandler/Controls/CompositeControl.cpp	Tue Oct 18 20:23:31 2016 +0000
@@ -26,6 +26,7 @@
     MbedJSONValue json_value;           // JSON parsing element
     controlFile = _controlFile;
 
+
     // open and read from the control file
     mDot::mdot_file file = GLOBAL_mdot->openUserFile(controlFile.c_str(), mDot::FM_RDONLY);
     if ( file.fd < 0 ) {
@@ -62,12 +63,15 @@
     priority            = atoi(json_value["priority"].get<string>().c_str());
     ca                  = json_value     ["ca"].get<string>();
 
+
     int entries = atoi(json_value["entries"].get<string>().c_str());
 
-    // populate the outputs 
+    // 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);
@@ -97,7 +101,7 @@
 //
 // @param       none
 // @return      none
-// 
+//
 void CompositeControl::update(void)
 {
     std::string function;
@@ -138,7 +142,7 @@
     }
 }
 
-// 
+//
 // method:      executeCommand
 // description: execute the command specified in the control algorithm
 //
@@ -181,28 +185,35 @@
         return "nothing";
     }
 
-    // equal to operator 
+    // equal to operator
     if ( ca->getOp() == "==" ) {
-        // perform the 
+        // perform the equality operation
         if ( value.value == atof(ca->getOpr().c_str()) ) {
             return ca->getResultTrue();
         } else {
             return ca->getResultFalse();
         }
     }
-    // addition operator 
+    if ( ca->getOp() == ">=" ) {
+        if ( value.value >= atof(ca->getOpr().c_str()) ) {
+        return ca->getResultTrue();
+        } else {
+            return ca->getResultFalse();
+        }
+    }
+    // addition operator
     if ( ca->getOp() == "+" ) {
         // TODO
     }
-    // multiply operator 
+    // multiply operator
     if ( ca->getOp() == "*" ) {
-        // TODO: 
+        // TODO:
     }
-    // subtraction operator 
+    // subtraction operator
     if ( ca->getOp() == "-" ) {
         // TODO:
     }
-    
+
     return "nothing";
 }
 
@@ -258,14 +269,14 @@
     strncpy(output_mail->input_tag,  this->tag.c_str(),  sizeof(output_mail->input_tag)-1);
     strncpy(output_mail->output_tag, io_tag.c_str(), sizeof(output_mail->output_tag)-1);
     strncpy(output_mail->id, this->id.c_str(), sizeof(output_mail->id)-1);
-    
+
     OutputMasterMailBox.put(output_mail);
 }
 
 //
 // method:      unregisterControls
 // description: unregister the control with the output task
-// 
+//
 // @param       none
 // @return      none
 //
@@ -298,7 +309,7 @@
                              "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());