tcMenu
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 
15 #include <PlatformDetermination.h>
16 #include "MenuItems.h"
17 #include <RemoteConnector.h>
18 #include <RemoteAuthentication.h>
20 
21 int remoteInfoRenderFn(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize);
22 
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 
47 
53  this->passThru = passThruHandler;
54  }
55 
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 
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
contains remote components that are shared across all remote devices.
In TcMenu, MenuItem storage is shared between program memory and RAM. Usually each MenuItem has assoc...
RenderFnMode
Definition: MenuItems.h:283
void(* MenuCallbackFn)(int id)
Definition: MenuItems.h:45
Contains the base functionality for communication between the menu library and remote APIs.
Contains the base functionality for communication between the menu library and remote APIs.
void(* CommsCallbackFn)(CommunicationInfo)
Definition: RemoteConnector.h:114
Definition: RemoteConnector.h:104
Definition: RemoteMenuItem.h:74
Definition: RemoteAuthentication.h:83
Definition: RuntimeMenuItem.h:196
Definition: MenuItems.h:329
const AnyMenuInfo * info
Definition: MenuItems.h:334
Definition: RemoteMenuItem.h:30
void doPassThru(CommunicationInfo info)
Definition: RemoteMenuItem.h:60
static RemoteMenuItem * getInstance()
Definition: RemoteMenuItem.h:67
void registerCommsNotification(CommsCallbackFn passThruHandler)
Definition: RemoteMenuItem.h:52
RemoteMenuItem(const char *name, menuid_t id, MenuItem *next=nullptr)
Definition: RemoteMenuItem.cpp:85
void setRemoteServer(tcremote::TcMenuRemoteServer &server)
Definition: RemoteMenuItem.cpp:90
Definition: RuntimeMenuItem.h:73
Definition: BaseRemoteComponents.h:117