tcMenu
Toggle main menu visibility
Loading...
Searching...
No Matches
src
RemoteMenuItem.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3
* This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4
*/
5
6
#ifndef REMOTE_MENU_ITEMS_H
7
#define REMOTE_MENU_ITEMS_H
8
14
15
#include <PlatformDetermination.h>
16
#include "
MenuItems.h
"
17
#include <
RemoteConnector.h
>
18
#include <
RemoteAuthentication.h
>
19
#include <
remote/BaseRemoteComponents.h
>
20
21
int
remoteInfoRenderFn(
RuntimeMenuItem
*item, uint8_t row,
RenderFnMode
mode,
char
*buffer,
int
bufferSize);
22
30
class
RemoteMenuItem
:
public
ListRuntimeMenuItem {
31
private
:
32
tcremote::TcMenuRemoteServer
*pRemoteServer;
33
CommsCallbackFn
passThru;
34
const
char
* pgmName;
35
static
RemoteMenuItem
* instance;
36
public
:
40
RemoteMenuItem
(
const
char
* name, menuid_t
id
,
MenuItem
*next =
nullptr
);
41
46
void
setRemoteServer
(
tcremote::TcMenuRemoteServer
&server);
47
52
void
registerCommsNotification
(
CommsCallbackFn
passThruHandler) {
53
this->passThru = passThruHandler;
54
}
55
60
void
doPassThru
(
CommunicationInfo
info
) {
61
if
(passThru) passThru(
info
);
62
}
63
67
static
RemoteMenuItem
*
getInstance
() {
return
instance; }
68
69
friend
int
remoteInfoRenderFn(
RuntimeMenuItem
*item, uint8_t row,
RenderFnMode
mode,
char
*buffer,
int
bufferSize);
70
};
71
72
int
authenticationMenuItemRenderFn(
RuntimeMenuItem
*item, uint8_t row,
RenderFnMode
mode,
char
*buffer,
int
bufferSize);
73
74
class
EepromAuthenticationInfoMenuItem :
public
ListRuntimeMenuItem {
75
private
:
76
const
char
*pgmName;
77
MenuCallbackFn
onAuthChanged;
78
public
:
79
EepromAuthenticationInfoMenuItem(
const
char
*name,
MenuCallbackFn
onAuthChanged, menuid_t
id
,
80
MenuItem
*next =
nullptr
);
81
void
init();
82
83
EepromAuthenticatorManager
*getAuthManager();
84
85
friend
int
86
authenticationMenuItemRenderFn(RuntimeMenuItem *item, uint8_t row,
RenderFnMode
mode,
char
*buffer,
int
bufferSize);
87
88
void
invokePossibleListener() {
89
if
(onAuthChanged) onAuthChanged(
id
);
90
}
91
};
92
93
#endif
BaseRemoteComponents.h
contains remote components that are shared across all remote devices.
MenuItems.h
In TcMenu, MenuItem storage is shared between program memory and RAM. Usually each MenuItem has assoc...
RenderFnMode
RenderFnMode
Definition
MenuItems.h:292
MenuCallbackFn
void(* MenuCallbackFn)(int id)
Definition
MenuItems.h:45
RemoteAuthentication.h
Contains the base functionality for communication between the menu library and remote APIs.
RemoteConnector.h
Contains the base functionality for communication between the menu library and remote APIs.
CommsCallbackFn
void(* CommsCallbackFn)(CommunicationInfo)
Definition
RemoteConnector.h:118
CommunicationInfo
Definition
RemoteConnector.h:108
EepromAuthenticatorManager
Definition
RemoteAuthentication.h:83
MenuItem::MenuItem
MenuItem(MenuType menuType, const AnyMenuInfo *menuInfo, MenuItem *next, bool infoProgMem)
Definition
MenuItems.cpp:12
MenuItem::info
const AnyMenuInfo * info
Definition
MenuItems.h:343
RemoteMenuItem::getInstance
static RemoteMenuItem * getInstance()
Definition
RemoteMenuItem.h:67
RemoteMenuItem::doPassThru
void doPassThru(CommunicationInfo info)
Definition
RemoteMenuItem.h:60
RemoteMenuItem::registerCommsNotification
void registerCommsNotification(CommsCallbackFn passThruHandler)
Definition
RemoteMenuItem.h:52
RemoteMenuItem::RemoteMenuItem
RemoteMenuItem(const char *name, menuid_t id, MenuItem *next=nullptr)
Definition
RemoteMenuItem.cpp:85
RemoteMenuItem::setRemoteServer
void setRemoteServer(tcremote::TcMenuRemoteServer &server)
Definition
RemoteMenuItem.cpp:92
RuntimeMenuItem
Definition
RuntimeMenuItem.h:75
tcremote::TcMenuRemoteServer
Definition
BaseRemoteComponents.h:117