Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/ConfigurationHandler/Controls/TimerControl.h

Committer:
jmarkel44
Date:
2016-09-30
Revision:
156:44f87c5a83ae
Parent:
136:6ad7ba157b70
Child:
157:0d79678ed00f

File content as of revision 156:44f87c5a83ae:

/******************************************************************************
 *
 * File:                TimerControl.h
 * Desciption:          ICE Timer Control Class
 *
 *****************************************************************************/
#ifndef TIMERCONTROL_H
#define TIMERCONTROL_H

#include <string>
#include <stdio.h>
#include <vector>

class TimerControl
{
private:
    std::string     controlFile;
    std::string     id;
    std::string     output;
    unsigned int    priority;
    unsigned long   startTime;
    unsigned int    duration;
    unsigned long   actualStartTime;
    
    enum State {
        STATE_OFF,
        STATE_RUNNING,
        STATE_DISABLED
    };
    State           currentState;

public:
    TimerControl() {};
    ~TimerControl() {
        printf("\r%s destructor invoked\n", __func__);
    }
    // load a control from the control file
    bool load(std::string filename);

    void display(void);

    std::string getControlFile(void) const {
        return controlFile;
    }
    
    std::string getOutput(void) const {
        return output;
    }
    
    unsigned long getStartTime() const {
        return startTime;
    }

    bool timerStart(void);
    bool timerStop(void);
    
    void startFeed(void);
    void stopFeed(void);
    
    void start(void);
    void update(void);
    
    void cleanup(void);
    
    // unregister the control with the output task
    void unregisterControl(void);

    State getCurrentState(void) const {
        return currentState;
    }
};

#endif