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.
ICE-Application/src/OutputTask/ControlClass/Control.h
- Committer:
- jmarkel44
- Date:
- 2017-01-24
- Revision:
- 1:b2e90cda7a5a
- Parent:
- 0:61364762ee0e
File content as of revision 1:b2e90cda7a5a:
/******************************************************************************
*
* File: Control.h
* Desciption: interface file for the ICE Output Task Control
*
* Controls are sorted by priority on the output
* vector. The highest priority control manipulates
* the output via Modbus writes.
*
*****************************************************************************/
#ifndef CONTROL_H
#define CONTROL_H
#include <stdio.h>
#include <string>
#include "OutputTask.h"
#include "global.h"
//! Control - implements a control (for use with the Output thread)
class Control
{
private:
std::string id; // control identifier
Control_t controlType; // control type
std::string input; // input
unsigned int priority; // control priority
ControlState state; // state (ON or OFF)
public:
/// creates a control instance
Control(std::string id,
Control_t controlType,
std::string input,
unsigned int priority,
ControlState state) :
id(id), controlType(controlType), input(input), priority(priority), state(state) {}
/// destroys a control instance
~Control() {
//printf("\r%s invoked\n", __func__);
}
/// display the pertinent data of a Control instance
void display() {
printf("[%-24s | %3s | %u] -> ",
id.c_str(), (state == CONTROL_ON) ? "ON" : "OFF", priority);
}
std::string getId() const {
return id;
}
Control_t getControlType(void) const {
return controlType;
}
std::string getInput(void) const {
return input;
}
unsigned int getPriority() const {
return priority;
}
ControlState getState(void) const {
return state;
}
int getMappedState(void) const;
void setState(ControlState _state) {
state = _state;
}
};
#endif