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-27
Revision:
133:c871de2d2b90
Parent:
132:45821e189dd0
Child:
136:6ad7ba157b70

File content as of revision 133:c871de2d2b90:

/******************************************************************************
 *
 * 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;
    
    enum State {
        STATE_OFF,
        STATE_RUNNING,
        STATE_DISABLED
    };
    State           currentState;
    
    typedef struct {
        unsigned int    priority;       // uniqueness to each timer element 
        unsigned long   startTime;      // epoch time
        unsigned int    duration;       // in seconds
        unsigned long   actualStarTime; 
    } Schedule_t;
    
    std::vector<Schedule_t> schedule;
    unsigned long actualStartTime;

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) {
        return controlFile;
    }

    bool timerStart(void);
    bool timerStop(void);
    
    void startFeed(void);
    void stopFeed(void);
    
    void start(void);
    void update(void);

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

#endif