ESP_IOT v2.5
IOT ESP Coding
ModelController.h
Go to the documentation of this file.
1
2
3#ifndef ModelController_h
4#define ModelController_h
5
6//*** For the MenuSelection MODEL
7//! a pseudo Class
8
9//!the ModelKindEnum is what state we are holding. There will be state models behind each of these.
10typedef enum
11{
17#define ModelKindEnumMax 4
18
19//!MENUS
20//! Pairing
21//! APMode
22//! Timer
23//! Advanced
24//! Status
25//! WIFI sharing
26//! Guest Feed
27//! Settings
28//! DocFollow
29//! help
30//! HomePage
31//! /WIFI Feed
32//! WIFI Share
33
34
35//!state variables
36typedef enum
37{
38 //paired to a device, but BLE NOT connected right now
40 //paired to a device, and BLE connected right now
42 //factory default: not paired (but could be paired as it's a named device])
44 //!factory default but not connecte to anything..
47
48//!the struct for the models. Since this isn't straight OO, we are overlaying information..
49typedef struct
50{
51 //!What kind of model
53
54 //! which SM mode 0.. SM_LAST
56
57 //!a preference to the View that big text is desired
59
60 //!the number of items in the model
62 //!the current item
64
65 //! if pairedDeviceModel then..
66 //! what is the state of the pairing..
68
69 //!Timer info (placeholder)
70 unsigned long delayStartMillis;
71 //! true if still waiting for delay to finish
72 boolean delayRunning = false;
73 //! length of delay (changable..)
75 //! finished flag (let user know .. then restart)
77 //! current seconds (<= delaySeconds)
79
80 //! for the next page state 0..n
82 // the max before goes back to 0
84 //! the stream number
86 // max streams (usually 3 1..3)
88 //!which wave
89 char *waveName;
90
91 //! feed local instead of MQTT or BLE..
93
95
96//!updates the model for the menu state (this will initialize if not done yet..)
97void updateMenuState(ModelKindEnum modelKind);
98//!returns the menu string for the deviceState's item number (use woudl go 0..maxItems -1
99char *menuForState(ModelKindEnum modelKind, int item);
100//!increments the device states deviceState (wrapping around)
101void incrementMenuState(ModelKindEnum modelKind);
102//!restarts all the menu states to the first one .. useful for getting a clean start. This doesn't care if the menu is being shown
104//!invokes the menu state, return true if the model state has change enough to refreesh your View (such as new menu items)
105boolean invokeMenuState(ModelKindEnum modelKind);
106//!retrieves the state model for the modelKind
108//!retrieves the state model for the SM_Mode (SM_0 .. SM_LAST)l. NULL if none
110
111//!retrieves a semantic marker for the current selected item. Return null if none specified YET
112//!TODO.. right now the logis is in MQTTNetworking .. so need to figure something nice out..
114
115//!initialize the objects
117
118//!! TIMER Remote control set delay seconds
119//!MQTT: set: timerdelay, val:seconds
120void setTimerDelaySeconds_mainModule(int delaySeconds);
121
122//!! TIMER Remote control start
123//! MQTT: set: starttimer, val: true/false (true == start timer, false = stop timer)
124void startStopTimer_mainModule(boolean startTimer);
125
126//!performs the pairing.. to whatever is currently connected, this means a message could make that happen
127//!for a device (ESP-32) with no user interface.
129
130//! just unpair .. don't skip
131//!performs the unpairing
133
134#endif
void updateMenuState(ModelKindEnum modelKind)
updates the model for the menu state (this will initialize if not done yet..)
void incrementMenuState(ModelKindEnum modelKind)
increments the device states deviceState (wrapping around)
boolean invokeMenuState(ModelKindEnum modelKind)
invokes the menu state, return true if the model state has change enough to refreesh your View (such ...
ModelKindEnum
a pseudo Class
@ menusModel
@ pairedDeviceModel
@ timerModel
@ rebootModel
void invokePair_ModelController()
void setTimerDelaySeconds_mainModule(int delaySeconds)
void startStopTimer_mainModule(boolean startTimer)
char * menuForState(ModelKindEnum modelKind, int item)
returns the menu string for the deviceState's item number (use woudl go 0..maxItems -1
PairedDeviceStateEnum
state variables
@ pairedButNotConnectedEnum
@ notConnectedEnum
factory default but not connecte to anything..
@ pairableAndConnectedEnum
@ pairedAndConnectedEnum
void invokeUnpairNoName_ModelController()
ModelStateStruct * hasModelForSM_Mode(int SM_Mode)
retrieves the state model for the SM_Mode (SM_0 .. SM_LAST)l. NULL if none
char * getModelSemanticMarker(ModelKindEnum modelKind)
retrieves a semantic marker for the current selected item
ModelStateStruct * getModel(ModelKindEnum modelKind)
retrieves the state model for the modelKind
void initModelStructs_ModelController()
initialize the objects
void restartAllMenuStates_ModelController()
restarts all the menu states to the first one .. useful for getting a clean start....
the struct for the models. Since this isn't straight OO, we are overlaying information....
ModelKindEnum modelKindEnum
What kind of model.
int currentCounterSeconds
current seconds (<= delaySeconds)
int currentPageState
for the next page state 0..n
boolean feedLocalOnly
feed local instead of MQTT or BLE..
int currentItem
the current item
int currentStreamNum
the stream number
char * waveName
which wave
int SM_Mode
which SM mode 0.. SM_LAST
boolean perfersBigText
a preference to the View that big text is desired
unsigned long delayStartMillis
Timer info (placeholder)
PairedDeviceStateEnum pairedDeviceStateEnum
int delaySeconds
length of delay (changable..)
boolean finishedTimer
finished flag (let user know .. then restart)
int maxItems
the number of items in the model