Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/ConfigurationHandler/Controls/CompositeControl.h
- Revision:
- 221:2a5e9902003c
- Parent:
- 220:dbe21411f962
--- a/src/ConfigurationHandler/Controls/CompositeControl.h Fri Oct 14 13:32:47 2016 +0000
+++ b/src/ConfigurationHandler/Controls/CompositeControl.h Fri Oct 14 21:30:21 2016 +0000
@@ -10,8 +10,8 @@
#include <string>
#include <vector>
#include <stdio.h>
-
-
+#include "global.h"
+#include "CompositeAlgorithm.h"
class CompositeControl
{
@@ -20,13 +20,28 @@
std::string tag;
std::string response;
} OutputElement;
-
+
std::string controlFile; // the control file
std::string id; // composite identifier
+ std::string tag; // i/o tag to evaluate
unsigned int priority; // control priority
std::string ca; // control algorithm
- std::vector<std::string> inputs; // (virtual) input(s)
std::vector<OutputElement> outputs; // (virtual) output(s)
+
+ enum State {
+ STATE_INIT,
+ STATE_START,
+ STATE_CONTROL_OFF,
+ STATE_CONTROL_ON,
+ STATE_MAX
+ };
+ State currentState; // current state
+
+ std::string executeCommand(void);
+ std::string executeOperation(const CompositeAlgorithm*);
+ void triggerOutputs(std::string result);
+ void sendMail(std::string io_tag, OutputAction action);
+
public:
CompositeControl() { }
~CompositeControl() {
@@ -35,6 +50,12 @@
bool load(std::string controlFile);
+ void start(void);
+
+ void update(void);
+
+ void unregisterControls();
+
std::string getControlFile(void) const {
return controlFile;
}
@@ -42,12 +63,15 @@
return id;
}
- std::vector<std::string> getInputs(void) const;
+ State getState(void) const {
+ return currentState;
+ }
+
+ std::string getTag(void) const {
+ return tag;
+ }
std::vector<std::string> getOutputs(void) const;
- // unregister the control with the output task
- void unregisterControl(void);
-
void display(void);
};
