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-23
Revision:
128:534bf29132f8
Parent:
126:c85ac6a8e9af
Child:
132:45821e189dd0

File content as of revision 128:534bf29132f8:

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

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

class TimerControl
{
private:
    std::string     controlFile;
    std::string     id;
    unsigned int    priority;
    unsigned int    dow;
    unsigned int    startw;
    std::string     output;
    unsigned int    startHour;
    unsigned int    startMinute;
    unsigned int    duration;
    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) {
        return controlFile;
    }

    bool feedCheck(void);
    
    void start(void);
    void update(void);

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

#define DAYS_IN_WEEK        (7)

#define DAY_SUNDAY_MASK     (1 << 0)
#define DAY_MONDAY_MASK     (1 << 1)
#define DAY_TUESDAY_MASK    (1 << 2)
#define DAY_WEDNESDAY_MASK  (1 << 3)
#define DAY_THURSDAY_MASK   (1 << 4)
#define DAY_FRIDAY_MASK     (1 << 5)
#define DAY_SATURDAY_MASK   (1 << 6)

// used to decipher starting week
typedef enum {
    EVERY_WEEK  = 0,
    FIRST_WEEK  = 1,
    SECOND_WEEK = 2,
    THIRD_WEEK  = 3,
    FOURTH_WEEK = 4,
    LAST_WEEK   = 5,
    EVERY_OTHER_WEEK = 6
} WEEKLY_CHOICES;
#endif