Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/ConfigurationHandler/Controls/SetpointControl.h

Committer:
jmarkel44
Date:
2016-09-20
Revision:
90:7d9731dec0da
Parent:
89:55ac65d7f206
Child:
91:0e8d76030598

File content as of revision 90:7d9731dec0da:

/******************************************************************************
 *
 * File:                SetpointControl.h
 * Desciption:          ICE Timer Control Class
 *
 *****************************************************************************/
#ifndef SETPOINTCONTROL_H
#define SETPOINTCONTROL_H

#include "MbedJSONValue.h"
#include <string>

using namespace std;

class SetpointControl
{
private:
    string          controlFile;        // name of the control file
    string          id;                 // control identifier
    int             priority;           // control priority
    string          input;              // control input
    string          output;             // control output
    double          setpoint;           // setpoint value
    double          productFactor;
    int             actingDir;          // acting direction 
    double          highAlert;
    double          lowAlert;
    double          highFailsafe;
    double          lowFailsafe;
    enum State {
        STATE_STARTUP,
        STATE_CONTROL_OFF,
        STATE_CONTROL_ON,
        STATE_DISABLE,
        STATE_PAUSE,
        STATE_MAX
    };
    State           currentState;

public:
    // ctor
    SetpointControl() {};
    // dtor
    ~SetpointControl() {
        printf("\r%s destructor invoked\n", __func__);
        // TODO: unregister the control with the output task
    }

    // load the control data
    bool load(string filename);

    // register the control with the output task
    void registerControl(void);

    // unregister the control with the output task
    void unregisterControl(void);

    // start the control
    void start(void);

    // update the control
    void update(void);

    bool underLimit();
    bool overLimit();

    // state transition functions
    void startFeed();
    void stopFeed();

    string getControlFile(void) const {
        return controlFile;
    }
    string getId(void) const {
        return id;
    }
    unsigned int getPriority(void) const {
        return priority;
    }
    string getInput(void) const {
        return input;
    }
    string getOutput(void) const {
        return output;
    }
    float getProductFactor(void) const {
        return productFactor;
    }
    int getActingDir(void) const {
        return actingDir;
    }
    float getSetpoint(void) const {
        return setpoint;
    }
    float getHighAlert(void) const {
        return highAlert;
    }
    float getLowAlert(void) const {
        return lowAlert;
    }
    float getHighFailsafe(void) const {
        return highFailsafe;
    }
    float getLowFailsafe(void) const {
        return lowFailsafe;
    }
    
    State getCurrentState(void) const {
        return currentState;
    }
};

#endif