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.
Diff: ICE-Application/src/ConfigurationHandler/Controls/CompositeControl.h
- Revision:
- 2:02cb20446785
- Parent:
- 1:b2e90cda7a5a
--- a/ICE-Application/src/ConfigurationHandler/Controls/CompositeControl.h Tue Jan 24 19:06:45 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/****************************************************************************** - * - * File: CompositeControl.h - * Desciption: ICE Composite Control Class - * - *****************************************************************************/ -#ifndef COMPOSITECONTROL_H -#define COMPOSITECONTROL_H - -#include <string> -#include <vector> -#include <stdio.h> -#include <stdlib.h> -#include "global.h" -#include "./Algorithms/CompositeAlgorithm.h" - -typedef enum { - COMPOSITE_CONTROL_OK, - COMPOSITE_CONTROL_UNK_STATE, - COMPOSITE_CONTROL_ERROR, - COMPOSITE_CONTROL_DESTROY -} CompositeControlError_t; - -//! Composite Control - used to implement a composite control -class CompositeControl -{ -private: - typedef struct oe_tag { - 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<OutputElement> outputs; // (virtual) output(s) - - enum State { - STATE_INIT, - STATE_START, - STATE_CONTROL_OFF, - STATE_CONTROL_ON, - STATE_MAX - }; - State currentState; // current state - - bool validateControlData(const char *buf); - void copyControlData(const char *buf); - - std::string executeCommand(void); - std::string executeOperation(const CompositeAlgorithm*); - void triggerOutputs(std::string result); - void sendMail(std::string io_tag, OutputAction action); - -public: - /// constructor - CompositeControl() { } - - /// destructor - ~CompositeControl() { - printf("\r%s invoked\n", __func__); - } - - /// load a composite control from a JSON configuration file - bool load(std::string controlFile); - - /// start a composite control instance - void start(void); - - /// update a composite control instance - CompositeControlError_t update(void); - - /// unregister a composite control(s) instance - void unregisterControls(); - - /// get the composite control's control filename - std::string getControlFile(void) const { - return controlFile; - } - - /// get the composite control's identifier - std::string getId(void) const { - return id; - } - - /// get the composite control's current state - State getState(void) const { - return currentState; - } - - /// get the composite control's tag - std::string getTag(void) const { - return tag; - } - - /// get a list of a composite control's outputs - std::vector<std::string> getOutputs(void) const; - - void display(void); -}; - -#endif