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:
157:0d79678ed00f
Parent:
156:44f87c5a83ae
Child:
217:d5a2ff093319

File content as of revision 157:0d79678ed00f:

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

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

typedef enum {
    TIMER_CONTROL_OK,
    TIMER_CONTROL_ERROR,
    TIMER_CONTROL_DESTROY
} TimerError_t;

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);
    TimerError_t update(void);

    void cleanup(void);

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

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

#endif