ESP_IOT v2.5
IOT ESP Coding
ModelController.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ModelStateStruct
 the struct for the models. Since this isn't straight OO, we are overlaying information.. More...
 

Macros

#define ModelKindEnumMax   4
 

Enumerations

enum  ModelKindEnum { pairedDeviceModel = 0 , rebootModel = 1 , menusModel = 2 , timerModel = 3 }
 a pseudo Class More...
 
enum  PairedDeviceStateEnum { pairedButNotConnectedEnum , pairedAndConnectedEnum , pairableAndConnectedEnum , notConnectedEnum }
 state variables More...
 

Functions

void updateMenuState (ModelKindEnum modelKind)
 updates the model for the menu state (this will initialize if not done yet..) More...
 
char * menuForState (ModelKindEnum modelKind, int item)
 returns the menu string for the deviceState's item number (use woudl go 0..maxItems -1 More...
 
void incrementMenuState (ModelKindEnum modelKind)
 increments the device states deviceState (wrapping around) More...
 
void restartAllMenuStates_ModelController ()
 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 More...
 
boolean invokeMenuState (ModelKindEnum modelKind)
 invokes the menu state, return true if the model state has change enough to refreesh your View (such as new menu items) More...
 
ModelStateStructgetModel (ModelKindEnum modelKind)
 retrieves the state model for the modelKind More...
 
ModelStateStructhasModelForSM_Mode (int SM_Mode)
 retrieves the state model for the SM_Mode (SM_0 .. SM_LAST)l. NULL if none More...
 
char * getModelSemanticMarker (ModelKindEnum modelKind)
 retrieves a semantic marker for the current selected item More...
 
void initModelStructs_ModelController ()
 initialize the objects More...
 
void setTimerDelaySeconds_mainModule (int delaySeconds)
 
void startStopTimer_mainModule (boolean startTimer)
 
void invokePair_ModelController ()
 
void invokeUnpairNoName_ModelController ()
 

Macro Definition Documentation

◆ ModelKindEnumMax

#define ModelKindEnumMax   4

Definition at line 17 of file ModelController.h.

Enumeration Type Documentation

◆ ModelKindEnum

a pseudo Class

the ModelKindEnum is what state we are holding. There will be state models behind each of these.

Enumerator
pairedDeviceModel 
rebootModel 
menusModel 
timerModel 

Definition at line 10 of file ModelController.h.

◆ PairedDeviceStateEnum

state variables

MENUS Pairing APMode Timer Advanced Status WIFI sharing Guest Feed Settings DocFollow help HomePage /WIFI Feed WIFI Share

Enumerator
pairedButNotConnectedEnum 
pairedAndConnectedEnum 
pairableAndConnectedEnum 
notConnectedEnum 

factory default but not connecte to anything..

Definition at line 36 of file ModelController.h.

Function Documentation

◆ getModel()

ModelStateStruct * getModel ( ModelKindEnum  modelKind)

retrieves the state model for the modelKind

Definition at line 226 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModelSemanticMarker()

char * getModelSemanticMarker ( ModelKindEnum  modelKind)

retrieves a semantic marker for the current selected item

retrieves a semantic marker for the current selected item. Return null if none specified YET TODO.. right now the logis is in MQTTNetworking .. so need to figure something nice out..

default is the view is the same

what model struct to use

Definition at line 1171 of file ModelController.cpp.

Here is the call graph for this function:

◆ hasModelForSM_Mode()

ModelStateStruct * hasModelForSM_Mode ( int  SM_Mode)

retrieves the state model for the SM_Mode (SM_0 .. SM_LAST)l. NULL if none

retrieves the state model for the SM_Mode (SM_0 .. SM_LAST)l. NULL if none

Definition at line 236 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incrementMenuState()

void incrementMenuState ( ModelKindEnum  modelKind)

increments the device states deviceState (wrapping around)

Definition at line 254 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initModelStructs_ModelController()

void initModelStructs_ModelController ( )

initialize the objects

for the next page state 0..n

true if still waiting for delay to finish

length of delay get from in EPROM

feed local instead of MQTT or BLE.. if camera then feed local == take a picture..

Definition at line 77 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invokeMenuState()

boolean invokeMenuState ( ModelKindEnum  modelKind)

invokes the menu state, return true if the model state has change enough to refreesh your View (such as new menu items)

invokes the menu state, return true if the model state has change enough to refreesh your View (such as new menu items) NOTE: This is the LONG press on the M5 button (the BLUE item)

default is the view is the same

what model struct to use

the pairdDeviceModel kind

factory default but not connecte to anything..

for now, the color is incremented in the displayModule

BUT at the MQTT level not web page level

9.30.22 IF SET .. send a feed but to all devices except ours and our pair (if any) uses new wildcard syntax either ! OUR NAME [ & ! OUR_CONNECTED_NAME

BUT at the MQTT level not web page level

9.30.22 IF SET .. send a feed but to all devices except ours and our pair (if any) uses new wildcard syntax either ! OUR NAME [ & ! OUR_CONNECTED_NAME

this has the # so it is treated slightly different, but tacking on the device for example..

BUT at the MQTT level not web page level

9.30.22 IF SET .. send a feed but to all devices except ours and our pair (if any) uses new wildcard syntax either ! OUR NAME [ & ! OUR_CONNECTED_NAME

This just goes to the 0'th page in the stream..

1 based (not 0 based)

this has the # so it is treated slightly different, but tacking on the device for example..

set transient look for PTClicker

11.4.22 (after Maggie Bluetic was fed with Pumpking Uno and GreyGoose

use lookup

Issue: #222 for #206, this sets the current mode to SM_doc_follow, but when at that page in the the current mode (which is now SM_doc_follow) won't let the page go somewhere else (except in this case we are the same page). Only but a physical button click. I THINK THE ANSWER: if current and next are the same an SM_doc_follow, then do the page change..

if HELP then printout preferences to the debug window

if HELP .. show the status print the preferences to SerialDebug

reset to default

Definition at line 872 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invokePair_ModelController()

void invokePair_ModelController ( )

performs the pairing.. to whatever is currently connected, this means a message could make that happen for a device (ESP-32) with no user interface.

this is where it needs to know if GEN3. If so, then if their is a paired name .. If GEN3, don't overreight the device name in case it was set by the user..

always set the ADDRESS

This means the name

Definition at line 347 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invokeUnpairNoName_ModelController()

void invokeUnpairNoName_ModelController ( )

just unpair .. don't skip performs the unpairing

refactored base

Definition at line 323 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ menuForState()

char * menuForState ( ModelKindEnum  modelKind,
int  item 
)

returns the menu string for the deviceState's item number (use woudl go 0..maxItems -1

MENUS Pairing APMode Timer Advanced Status WIFI sharing Guest Feed Settings DocFollow help HomePage /WIFI Feed WIFI Share

draw the state we are in..

update menu with seconds countdown

only if stopped...

Definition at line 611 of file ModelController.cpp.

Here is the call graph for this function:

◆ restartAllMenuStates_ModelController()

void restartAllMenuStates_ModelController ( )

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

Definition at line 269 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTimerDelaySeconds_mainModule()

void setTimerDelaySeconds_mainModule ( int  delaySeconds)

! TIMER Remote control set delay seconds MQTT: set: timerdelay, val:seconds

save in EPROM

Definition at line 134 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startStopTimer_mainModule()

void startStopTimer_mainModule ( boolean  startTimer)

! TIMER Remote control start MQTT: set: starttimer, val: true/false (true == start timer, false = stop timer)

Definition at line 148 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateMenuState()

void updateMenuState ( ModelKindEnum  modelKind)

updates the model for the menu state (this will initialize if not done yet..)

updates the model for the menu state (this will initialize if not done yet..)

must save since many preferences are called...

the pairedName stored in EPROM can be an Address (eg. 03:34:23:33)

show the BLE connected status at the bottom (G3 if gen3), WIFI, and AP if APmode

whether the gateway is on.. this isn't using the Gx just BLE or GE3

name of paired device (if any) in EPROM

name of connected device, or "" if not specified, which means not pairable

compare to what's connected ..

is paired and connected (to that pair .. if BLECLient working right)

if connectedBLE then either paired or not-paired

if the EPROM's pairedDevice/Address == what's connected, then we are paired and connected

is paired

not connected, so paired if a valid paired name/address

if the EPROM's pairedDevice/Address is set then paired and NOT connected

unpaired

MENUS Pairing APMode Timer Advanced Status WIFI sharing Guest Feed Settings DocFollow help HomePage /WIFI Feed WIFI Share

calculate the current second counter..

substract the seconds from the set delay

if count <=0 then finished..

if local .. send a command directly to the device..

send the command to the stepper.. not a BLE command

for now only invoke the feed ... todo mroe things.. STATUS, WIFI FEED, DOCFOLLOW

TODO: look at a scrolling idea if > 6 ...

Definition at line 400 of file ModelController.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: