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
src/ConfigurationHandler/Controls/CompositeControl.h@221:2a5e9902003c, 2016-10-14 (annotated)
- Committer:
- jmarkel44
- Date:
- Fri Oct 14 21:30:21 2016 +0000
- Revision:
- 221:2a5e9902003c
- Parent:
- 220:dbe21411f962
composite control and composite algorithm implementation
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jmarkel44 | 164:7cecd731882e | 1 | /****************************************************************************** |
| jmarkel44 | 164:7cecd731882e | 2 | * |
| jmarkel44 | 164:7cecd731882e | 3 | * File: CompositeControl.h |
| jmarkel44 | 164:7cecd731882e | 4 | * Desciption: ICE Composite Control Class |
| jmarkel44 | 164:7cecd731882e | 5 | * |
| jmarkel44 | 164:7cecd731882e | 6 | *****************************************************************************/ |
| jmarkel44 | 164:7cecd731882e | 7 | #ifndef COMPOSITECONTROL_H |
| jmarkel44 | 164:7cecd731882e | 8 | #define COMPOSITECONTROL_H |
| jmarkel44 | 164:7cecd731882e | 9 | |
| jmarkel44 | 164:7cecd731882e | 10 | #include <string> |
| jmarkel44 | 164:7cecd731882e | 11 | #include <vector> |
| jmarkel44 | 164:7cecd731882e | 12 | #include <stdio.h> |
| jmarkel44 | 221:2a5e9902003c | 13 | #include "global.h" |
| jmarkel44 | 221:2a5e9902003c | 14 | #include "CompositeAlgorithm.h" |
| jmarkel44 | 220:dbe21411f962 | 15 | |
| jmarkel44 | 164:7cecd731882e | 16 | class CompositeControl |
| jmarkel44 | 164:7cecd731882e | 17 | { |
| jmarkel44 | 164:7cecd731882e | 18 | private: |
| jmarkel44 | 220:dbe21411f962 | 19 | typedef struct oe_tag { |
| jmarkel44 | 220:dbe21411f962 | 20 | std::string tag; |
| jmarkel44 | 220:dbe21411f962 | 21 | std::string response; |
| jmarkel44 | 220:dbe21411f962 | 22 | } OutputElement; |
| jmarkel44 | 221:2a5e9902003c | 23 | |
| jmarkel44 | 195:21df85341cb3 | 24 | std::string controlFile; // the control file |
| jmarkel44 | 195:21df85341cb3 | 25 | std::string id; // composite identifier |
| jmarkel44 | 221:2a5e9902003c | 26 | std::string tag; // i/o tag to evaluate |
| jmarkel44 | 220:dbe21411f962 | 27 | unsigned int priority; // control priority |
| jmarkel44 | 220:dbe21411f962 | 28 | std::string ca; // control algorithm |
| jmarkel44 | 220:dbe21411f962 | 29 | std::vector<OutputElement> outputs; // (virtual) output(s) |
| jmarkel44 | 221:2a5e9902003c | 30 | |
| jmarkel44 | 221:2a5e9902003c | 31 | enum State { |
| jmarkel44 | 221:2a5e9902003c | 32 | STATE_INIT, |
| jmarkel44 | 221:2a5e9902003c | 33 | STATE_START, |
| jmarkel44 | 221:2a5e9902003c | 34 | STATE_CONTROL_OFF, |
| jmarkel44 | 221:2a5e9902003c | 35 | STATE_CONTROL_ON, |
| jmarkel44 | 221:2a5e9902003c | 36 | STATE_MAX |
| jmarkel44 | 221:2a5e9902003c | 37 | }; |
| jmarkel44 | 221:2a5e9902003c | 38 | State currentState; // current state |
| jmarkel44 | 221:2a5e9902003c | 39 | |
| jmarkel44 | 221:2a5e9902003c | 40 | std::string executeCommand(void); |
| jmarkel44 | 221:2a5e9902003c | 41 | std::string executeOperation(const CompositeAlgorithm*); |
| jmarkel44 | 221:2a5e9902003c | 42 | void triggerOutputs(std::string result); |
| jmarkel44 | 221:2a5e9902003c | 43 | void sendMail(std::string io_tag, OutputAction action); |
| jmarkel44 | 221:2a5e9902003c | 44 | |
| jmarkel44 | 164:7cecd731882e | 45 | public: |
| jmarkel44 | 164:7cecd731882e | 46 | CompositeControl() { } |
| jmarkel44 | 220:dbe21411f962 | 47 | ~CompositeControl() { |
| jmarkel44 | 220:dbe21411f962 | 48 | printf("\r%s invoked\n", __func__); |
| jmarkel44 | 220:dbe21411f962 | 49 | } |
| jmarkel44 | 220:dbe21411f962 | 50 | |
| jmarkel44 | 164:7cecd731882e | 51 | bool load(std::string controlFile); |
| jmarkel44 | 220:dbe21411f962 | 52 | |
| jmarkel44 | 221:2a5e9902003c | 53 | void start(void); |
| jmarkel44 | 221:2a5e9902003c | 54 | |
| jmarkel44 | 221:2a5e9902003c | 55 | void update(void); |
| jmarkel44 | 221:2a5e9902003c | 56 | |
| jmarkel44 | 221:2a5e9902003c | 57 | void unregisterControls(); |
| jmarkel44 | 221:2a5e9902003c | 58 | |
| jmarkel44 | 164:7cecd731882e | 59 | std::string getControlFile(void) const { |
| jmarkel44 | 164:7cecd731882e | 60 | return controlFile; |
| jmarkel44 | 164:7cecd731882e | 61 | } |
| jmarkel44 | 164:7cecd731882e | 62 | std::string getId(void) const { |
| jmarkel44 | 164:7cecd731882e | 63 | return id; |
| jmarkel44 | 164:7cecd731882e | 64 | } |
| jmarkel44 | 220:dbe21411f962 | 65 | |
| jmarkel44 | 221:2a5e9902003c | 66 | State getState(void) const { |
| jmarkel44 | 221:2a5e9902003c | 67 | return currentState; |
| jmarkel44 | 221:2a5e9902003c | 68 | } |
| jmarkel44 | 221:2a5e9902003c | 69 | |
| jmarkel44 | 221:2a5e9902003c | 70 | std::string getTag(void) const { |
| jmarkel44 | 221:2a5e9902003c | 71 | return tag; |
| jmarkel44 | 221:2a5e9902003c | 72 | } |
| jmarkel44 | 164:7cecd731882e | 73 | std::vector<std::string> getOutputs(void) const; |
| jmarkel44 | 220:dbe21411f962 | 74 | |
| jmarkel44 | 220:dbe21411f962 | 75 | void display(void); |
| jmarkel44 | 164:7cecd731882e | 76 | }; |
| jmarkel44 | 164:7cecd731882e | 77 | |
| jmarkel44 | 164:7cecd731882e | 78 | #endif |
