tcMenu
RemoteMenuItem.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 https://www.thecoderscorner.com (Nutricherry LTD).
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 
16 #include <PlatformDetermination.h>
17 #include "MenuItems.h"
18 #include <RemoteConnector.h>
19 #include <RemoteAuthentication.h>
21 
22 int remoteInfoRenderFn(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize);
23 
32 private:
33  tcremote::TcMenuRemoteServer *pRemoteServer;
34  CommsCallbackFn passThru;
35  const char* pgmName;
36  static RemoteMenuItem* instance;
37 public:
41  RemoteMenuItem(const char* name, menuid_t id, MenuItem *next = nullptr);
42 
48 
54  this->passThru = passThruHandler;
55  }
56 
62  if (passThru) passThru(info);
63  }
64 
68  static RemoteMenuItem *getInstance() { return instance; }
69 
70  friend int remoteInfoRenderFn(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize);
71 };
72 
73 int authenticationMenuItemRenderFn(RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize);
74 
76 private:
77  const char *pgmName;
78  MenuCallbackFn onAuthChanged;
79 public:
80  EepromAuthenticationInfoMenuItem(const char *name, MenuCallbackFn onAuthChanged, menuid_t id,
81  MenuItem *next = nullptr);
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
RenderFnMode
Definition: MenuItems.h:287
void(* CommsCallbackFn)(CommunicationInfo)
Definition: RemoteConnector.h:108
Definition: BaseRemoteComponents.h:105
Definition: MenuItems.h:329
RemoteMenuItem(const char *name, menuid_t id, MenuItem *next=nullptr)
Definition: RemoteMenuItem.cpp:81
static RemoteMenuItem * getInstance()
Definition: RemoteMenuItem.h:68
Definition: RuntimeMenuItem.h:179
Definition: RemoteMenuItem.h:75
void(* MenuCallbackFn)(int id)
Definition: MenuItems.h:40
void setRemoteServer(tcremote::TcMenuRemoteServer &server)
Definition: RemoteMenuItem.cpp:86
Definition: RuntimeMenuItem.h:73
void registerCommsNotification(CommsCallbackFn passThruHandler)
Definition: RemoteMenuItem.h:53
Definition: RemoteConnector.h:98
Definition: RemoteMenuItem.h:31
void doPassThru(CommunicationInfo info)
Definition: RemoteMenuItem.h:61
Definition: RemoteAuthentication.h:78