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-13
Revision:
51:66b820f203a5
Parent:
46:4cb96ab2d1c8
Child:
86:189c125d8878

File content as of revision 51:66b820f203a5:

/******************************************************************************
 *
 * 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
    string          name;               // friendly name
    int             priority;           // control priority
    string          input;              // control input
    string          output;             // control output
    double          productFactor;
    double          highAlert;
    double          lowAlert;
    double          highFailsafe;
    double          lowFailsafe;
    double          tol;
    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) {
        return controlFile;
    }
    string getId(void) {
        return id;
    }
    string getName(void) {
        return name;
    }
    unsigned int getPriority(void) {
        return priority;
    }
    string getInput(void) {
        return input;
    }
    string getOutput(void) {
        return output;
    }
    float getProductFactor(void) {
        return productFactor;
    }
    float getHighAlert(void) {
        return highAlert;
    }
    float getLowAlert(void) {
        return lowAlert;
    }
    float getHighFailsafe(void) {
        return highFailsafe;
    }
    float getLowFailsafe(void) {
        return lowFailsafe;
    }
    float getTol(void) {
        return tol;
    }
    State getCurrentState(void) {
        return currentState;
    }
};

#endif