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 setTimerDelaySecondsMax_mainModule (int delaySecondsMax)
 
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 273 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 1269 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 283 of file ModelController.cpp.

Here is the call graph for this function:

◆ incrementMenuState()

void incrementMenuState ( ModelKindEnum  modelKind)

increments the device states deviceState (wrapping around)

Definition at line 301 of file ModelController.cpp.

Here is the call graph for this function:

◆ initModelStructs_ModelController()

void initModelStructs_ModelController ( )

initialize the objects

for the next page state 0..n

initialize the random:

See also
https://www.arduino.cc/reference/en/language/functions/random-numbers/random/

true if still waiting for delay to finish

length of delay get from in EPROM

feed local instead of MQTT or BLE..

Definition at line 79 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..

8.16.25 BLE CLIENT

8.16.25 BLE CLIENT

for now, the color is incremented in the displayModule

8.16.25 MQTT

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

8.16.25 MQTT

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..

8.16.25 MQTT

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

This will restart the timer..

same login for each

make sure the max is >= min

11.29.23 add the random feed

now use those values to create a new random time.. not needed until the START above

Delay .. no-opp

Definition at line 940 of file ModelController.cpp.

Here is the call 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 391 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

8.16.25 BLE CLIENT

Definition at line 369 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

Max == 4 if not running (START, TIME, MAXTIME, DELAY)

draw the state we are in..

update menu with seconds countdown

only if stopped... max == 4, other max == 2

show max

Definition at line 665 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 316 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 145 of file ModelController.cpp.

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

◆ setTimerDelaySecondsMax_mainModule()

void setTimerDelaySecondsMax_mainModule ( int  delaySeconds)

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

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

save in EPROM

Definition at line 159 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 191 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 8.16.25 BLE CLIENT

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..

the number of seconds since starting the loop

if count <=0 then finished..

11.29.23 use a random calculate a new random

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

added a max delay

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

Definition at line 443 of file ModelController.cpp.

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