tcMenu
Loading...
Searching...
No Matches
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
13
14#include <RuntimeMenuItem.h>
16
17int secPopupActionRenderFn(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int bufferSize);
18
19class ActivateSubMenuItem : public RuntimeMenuItem {
20private:
21 SubMenuItem* securedItem;
22public:
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
40class SecuredMenuPopup {
41private:
42 BackMenuItem backMenuItem;
43 TextMenuItem pinEntryItem;
44 ActivateSubMenuItem actionProceedItem;
45 ActivateSubMenuItem actionCancelItem;
46 AuthenticationManager* authentication;
47public:
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
Definition MenuItems.h:292
int(* RuntimeRenderingFn)(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
Definition MenuItems.h:327
@ MENUTYPE_ACTIVATE_SUBMENU
Definition MenuItems.h:265
Contains the base functionality for communication between the menu library and remote APIs.
Contains definitions of menu items that can be fully defined at runtime with no need for prog mem str...
menuid_t nextRandomId()
Definition RuntimeMenuItem.cpp:15
Definition SecuredMenuPopup.h:19
Definition RemoteAuthentication.h:38
Definition RuntimeMenuItem.h:116
Definition MenuItems.h:338
MenuItem(MenuType menuType, const AnyMenuInfo *menuInfo, MenuItem *next, bool infoProgMem)
Definition MenuItems.cpp:12
Definition RuntimeMenuItem.h:75
Definition RuntimeMenuItem.h:149
Definition RuntimeMenuItem.h:268