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 - When the timer was started
71 //!the value returned from random .. the diff is taken off this number
72 //! but this number doesn't change except next random call
74 //! true if still waiting for delay to finish
75 boolean delayRunning = false;
76 //! length of delay (changable..)
78 //! 11.29.23 max Delay Seconds .. if different than delay then next delay will be random() * (max-min) + min
80
81 //! finished flag (let user know .. then restart)
83 //! current seconds (<= delaySeconds)
85
86 //! for the next page state 0..n
88 // the max before goes back to 0
90 //! the stream number
92 // max streams (usually 3 1..3)
94 //!which wave
95 char *waveName;
96
97 //! feed local instead of MQTT or BLE..
99
101
102//!updates the model for the menu state (this will initialize if not done yet..)
103void updateMenuState(ModelKindEnum modelKind);
104//!returns the menu string for the deviceState's item number (use woudl go 0..maxItems -1
105char *menuForState(ModelKindEnum modelKind, int item);
106//!increments the device states deviceState (wrapping around)
107void incrementMenuState(ModelKindEnum modelKind);
108//!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
110//!invokes the menu state, return true if the model state has change enough to refreesh your View (such as new menu items)
111boolean invokeMenuState(ModelKindEnum modelKind);
112//!retrieves the state model for the modelKind
114//!retrieves the state model for the SM_Mode (SM_0 .. SM_LAST)l. NULL if none
116
117//!retrieves a semantic marker for the current selected item. Return null if none specified YET
118//!TODO.. right now the logis is in MQTTNetworking .. so need to figure something nice out..
120
121//!initialize the objects
123
124//!! TIMER Remote control set delay seconds
125//!MQTT: set: timerdelay, val:seconds
126void setTimerDelaySeconds_mainModule(int delaySeconds);
127
128//!! TIMER Remote control set delay seconds
129//!MQTT: set: timerdelayMax, val:seconds
130void setTimerDelaySecondsMax_mainModule(int delaySecondsMax);
131
132//!! TIMER Remote control start
133//! MQTT: set: starttimer, val: true/false (true == start timer, false = stop timer)
134void startStopTimer_mainModule(boolean startTimer);
135
136//!performs the pairing.. to whatever is currently connected, this means a message could make that happen
137//!for a device (ESP-32) with no user interface.
139
140//! just unpair .. don't skip
141//!performs the unpairing
143
144#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 setTimerDelaySecondsMax_mainModule(int delaySecondsMax)
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 delaySecondsMax
11.29.23 max Delay Seconds .. if different than delay then next delay will be random() * (max-min) + ...
int delayStartMillis
Timer info - When the timer was started.
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
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