tcMenu
Loading...
Searching...
No Matches
src
SecuredMenuPopup.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 _SECURED_MENU_POPUP_H_
7
#define _SECURED_MENU_POPUP_H_
8
14
#include <
RuntimeMenuItem.h
>
15
#include <
RemoteAuthentication.h
>
16
17
int
secPopupActionRenderFn(
RuntimeMenuItem
* item, uint8_t row,
RenderFnMode
mode,
char
* buffer,
int
bufferSize);
18
19
class
ActivateSubMenuItem
:
public
RuntimeMenuItem
{
20
private
:
21
SubMenuItem
* securedItem;
22
public
:
23
ActivateSubMenuItem
(
RuntimeRenderingFn
customRenderFn,
int
activeStatus,
MenuItem
* next = NULL)
24
:
RuntimeMenuItem
(
MENUTYPE_ACTIVATE_SUBMENU
, nextRandomId(), customRenderFn, activeStatus, 1, next) {
25
}
26
27
void
setSecuredItem(
SubMenuItem
*secured) {
28
securedItem = secured;
29
}
30
31
SubMenuItem
* getSecuredItem() {
return
securedItem; }
32
};
33
40
class
SecuredMenuPopup
{
41
private
:
42
BackMenuItem
backMenuItem;
43
TextMenuItem
pinEntryItem;
44
ActivateSubMenuItem
actionProceedItem;
45
ActivateSubMenuItem
actionCancelItem;
46
AuthenticationManager
* authentication;
47
public
:
48
SecuredMenuPopup
(
AuthenticationManager
*authentication);
49
50
MenuItem
* getItemToActivate() {
return
&pinEntryItem; }
51
52
MenuItem
* start(
SubMenuItem
* securedMenu);
53
54
MenuItem
* getRootItem() {
55
return
&backMenuItem;
56
}
57
58
bool
doesPinMatch() {
59
return
authentication->
doesPinMatch
(pinEntryItem.
getTextValue
());
60
}
61
};
62
63
#endif
// _SECURED_MENU_POPUP_H_
RenderFnMode
RenderFnMode
Definition
MenuItems.h:283
RuntimeRenderingFn
int(* RuntimeRenderingFn)(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
Definition
MenuItems.h:318
MENUTYPE_ACTIVATE_SUBMENU
@ MENUTYPE_ACTIVATE_SUBMENU
Definition
MenuItems.h:256
RemoteAuthentication.h
Contains the base functionality for communication between the menu library and remote APIs.
RuntimeMenuItem.h
Contains definitions of menu items that can be fully defined at runtime with no need for prog mem str...
ActivateSubMenuItem
Definition
SecuredMenuPopup.h:19
AuthenticationManager
Definition
RemoteAuthentication.h:38
AuthenticationManager::doesPinMatch
virtual bool doesPinMatch(const char *pinAttempt)=0
BackMenuItem
Definition
RuntimeMenuItem.h:116
MenuItem
Definition
MenuItems.h:329
RuntimeMenuItem
Definition
RuntimeMenuItem.h:75
SecuredMenuPopup
Definition
SecuredMenuPopup.h:40
SubMenuItem
Definition
RuntimeMenuItem.h:149
TextMenuItem
Definition
RuntimeMenuItem.h:268
TextMenuItem::getTextValue
const char * getTextValue() const
Definition
RuntimeMenuItem.h:337