Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Committer:
jmarkel44
Date:
Tue Sep 27 18:46:10 2016 +0000
Revision:
136:6ad7ba157b70
Parent:
133:c871de2d2b90
Child:
156:44f87c5a83ae
unregister timer control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmarkel44 12:ea87887ca7ad 1 /******************************************************************************
jmarkel44 12:ea87887ca7ad 2 *
jmarkel44 12:ea87887ca7ad 3 * File: TimerControl.h
jmarkel44 12:ea87887ca7ad 4 * Desciption: ICE Timer Control Class
jmarkel44 12:ea87887ca7ad 5 *
jmarkel44 12:ea87887ca7ad 6 *****************************************************************************/
jmarkel44 12:ea87887ca7ad 7 #ifndef TIMERCONTROL_H
jmarkel44 12:ea87887ca7ad 8 #define TIMERCONTROL_H
jmarkel44 12:ea87887ca7ad 9
jmarkel44 12:ea87887ca7ad 10 #include <string>
jmarkel44 122:4db48b933115 11 #include <stdio.h>
jmarkel44 132:45821e189dd0 12 #include <vector>
jmarkel44 19:9bc8fabeddfa 13
jmarkel44 12:ea87887ca7ad 14 class TimerControl
jmarkel44 12:ea87887ca7ad 15 {
jmarkel44 12:ea87887ca7ad 16 private:
jmarkel44 122:4db48b933115 17 std::string controlFile;
jmarkel44 122:4db48b933115 18 std::string id;
jmarkel44 122:4db48b933115 19 std::string output;
jmarkel44 132:45821e189dd0 20
jmarkel44 128:534bf29132f8 21 enum State {
jmarkel44 128:534bf29132f8 22 STATE_OFF,
jmarkel44 128:534bf29132f8 23 STATE_RUNNING,
jmarkel44 128:534bf29132f8 24 STATE_DISABLED
jmarkel44 128:534bf29132f8 25 };
jmarkel44 128:534bf29132f8 26 State currentState;
jmarkel44 132:45821e189dd0 27
jmarkel44 132:45821e189dd0 28 typedef struct {
jmarkel44 132:45821e189dd0 29 unsigned int priority; // uniqueness to each timer element
jmarkel44 132:45821e189dd0 30 unsigned long startTime; // epoch time
jmarkel44 132:45821e189dd0 31 unsigned int duration; // in seconds
jmarkel44 132:45821e189dd0 32 unsigned long actualStarTime;
jmarkel44 132:45821e189dd0 33 } Schedule_t;
jmarkel44 132:45821e189dd0 34
jmarkel44 132:45821e189dd0 35 std::vector<Schedule_t> schedule;
jmarkel44 132:45821e189dd0 36 unsigned long actualStartTime;
jmarkel44 128:534bf29132f8 37
jmarkel44 12:ea87887ca7ad 38 public:
jmarkel44 19:9bc8fabeddfa 39 TimerControl() {};
jmarkel44 12:ea87887ca7ad 40 ~TimerControl() {
jmarkel44 12:ea87887ca7ad 41 printf("\r%s destructor invoked\n", __func__);
jmarkel44 12:ea87887ca7ad 42 }
jmarkel44 20:653923c2f37a 43 // load a control from the control file
jmarkel44 122:4db48b933115 44 bool load(std::string filename);
jmarkel44 128:534bf29132f8 45
jmarkel44 122:4db48b933115 46 void display(void);
jmarkel44 128:534bf29132f8 47
jmarkel44 122:4db48b933115 48 std::string getControlFile(void) {
jmarkel44 12:ea87887ca7ad 49 return controlFile;
jmarkel44 12:ea87887ca7ad 50 }
jmarkel44 128:534bf29132f8 51
jmarkel44 132:45821e189dd0 52 bool timerStart(void);
jmarkel44 132:45821e189dd0 53 bool timerStop(void);
jmarkel44 126:c85ac6a8e9af 54
jmarkel44 133:c871de2d2b90 55 void startFeed(void);
jmarkel44 133:c871de2d2b90 56 void stopFeed(void);
jmarkel44 133:c871de2d2b90 57
jmarkel44 126:c85ac6a8e9af 58 void start(void);
jmarkel44 126:c85ac6a8e9af 59 void update(void);
jmarkel44 136:6ad7ba157b70 60
jmarkel44 136:6ad7ba157b70 61 // unregister the control with the output task
jmarkel44 136:6ad7ba157b70 62 void unregisterControl(void);
jmarkel44 128:534bf29132f8 63
jmarkel44 128:534bf29132f8 64 State getCurrentState(void) const {
jmarkel44 128:534bf29132f8 65 return currentState;
jmarkel44 128:534bf29132f8 66 }
jmarkel44 12:ea87887ca7ad 67 };
jmarkel44 12:ea87887ca7ad 68
jmarkel44 12:ea87887ca7ad 69 #endif