Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
132:45821e189dd0
Parent:
128:534bf29132f8
Child:
133:c871de2d2b90
--- a/src/ConfigurationHandler/Controls/TimerControl.h	Mon Sep 26 17:36:30 2016 +0000
+++ b/src/ConfigurationHandler/Controls/TimerControl.h	Tue Sep 27 12:18:47 2016 +0000
@@ -9,25 +9,31 @@
 
 #include <string>
 #include <stdio.h>
+#include <vector>
 
 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;
+    
+    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() {};
@@ -43,7 +49,8 @@
         return controlFile;
     }
 
-    bool feedCheck(void);
+    bool timerStart(void);
+    bool timerStop(void);
     
     void start(void);
     void update(void);
@@ -53,24 +60,4 @@
     }
 };
 
-#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