11 #ifndef TCMENU_BASEREMOTECOMPONENTS_H
12 #define TCMENU_BASEREMOTECOMPONENTS_H
14 #include <PlatformDetermination.h>
15 #include "../RemoteConnector.h"
20 #ifndef ALLOWED_CONNECTIONS
21 #define ALLOWED_CONNECTIONS 4
26 class BaseRemoteServerConnection;
35 bool initialised =
false;
37 bool isInitialised()
const {
return initialised; }
38 virtual bool attemptInitialisation()=0;
48 bool attemptConnectionReturn;
50 explicit NoInitialisationNeeded(
bool attemptConnectionReturn =
true) : attemptConnectionReturn(attemptConnectionReturn) {}
52 bool attemptInitialisation()
override {
60 enum RemoteServerType: uint8_t {
61 TAG_VAL_REMOTE_SERVER, SIMHUB_CONNECTOR, TAG_VAL_WEB_SOCKET
67 RemoteServerType remoteServerType;
70 : initialisation(initialisation), remoteServerType(remoteServerType) {}
72 RemoteServerType getRemoteServerType() {
return remoteServerType; }
77 virtual void tick() = 0;
78 virtual bool connected() = 0;
79 virtual void copyConnectionStatus(
char *buffer,
int bufferSize) = 0;
80 virtual void notifyRemoteHasClosed() {}
104 void tick()
override;
105 bool connected()
override {
return remoteTransport.connected(); }
107 void copyConnectionStatus(
char *buffer,
int bufferSize)
override;
109 void notifyRemoteHasClosed()
override;
120 uint8_t remotesAdded;
138 void exec()
override;
159 if(num >= remotesAdded || connections[num]->getRemoteServerType() != TAG_VAL_REMOTE_SERVER)
return nullptr;
169 if(num >= remotesAdded || connections[num]->getRemoteServerType() != TAG_VAL_REMOTE_SERVER)
return nullptr;
180 if(num >= remotesAdded)
return nullptr;
181 return connections[num];
184 void setHeartbeatIntervalAll(uint16_t milli);
194 int fromWiFiRSSITo4StateIndicator(
int strength);
Definition: MessageProcessors.h:146
Definition: RemoteConnector.h:187
Definition: RemoteConnector.h:141
Definition: BaseRemoteComponents.h:64
Definition: BaseRemoteComponents.h:33
Definition: BaseRemoteComponents.h:46
Definition: BaseRemoteComponents.h:88