106 bool begin(
const char GUID[SUPLA_GUID_SIZE],
109 const char authkey[SUPLA_AUTHKEY_SIZE],
110 unsigned char protoVersion = 23);
112 bool begin(
unsigned char protoVersion = 23);
115 void setName(
const char *Name);
117 void setGUID(
const char GUID[SUPLA_GUID_SIZE]);
118 void setAuthKey(
const char authkey[SUPLA_AUTHKEY_SIZE]);
119 void setEmail(
const char *email);
120 void setServer(
const char *server);
121 void setSwVersion(
const char *);
125 void setManufacturerId(int16_t);
129 void setProductId(int16_t);
131 void addFlags(int32_t);
132 void removeFlags(int32_t);
133 bool isSleepingDeviceEnabled();
135 int generateHostname(
char*,
int macSize = 6);
140 void onFastTimer(
void);
143 void status(
int status,
144 const __FlashStringHelper *msg,
145 bool alwaysLog =
false);
146 void setStatusFuncImpl(_impl_arduino_status impl_arduino_status);
147 void setServerPort(
int value);
152 void enterConfigMode();
153 void leaveConfigModeWithoutRestart();
154 void enterNormalMode();
157 void scheduleSoftRestart(
int timeout = 0);
158 void scheduleProtocolsRestart(
int timeout = 0);
160 void saveStateToStorage();
161 void restartCfgModeTimeout(
bool requireRestart);
162 void resetToFactorySettings();
163 void disableLocalActionsIfNeeded();
164 void requestCfgMode();
166 int getCurrentStatus();
167 bool loadDeviceConfig();
168 bool prepareLastStateLog();
169 char *getLastStateLog();
170 void addLastStateLog(
const char*);
171 void enableLastStateLog();
172 void disableLastStateLog();
173 void setRsaPublicKeyPtr(
const uint8_t *ptr);
174 const uint8_t *getRsaPublicKey();
175 enum Supla::DeviceMode getDeviceMode()
const;
177 void setActivityTimeout(_supla_int_t newActivityTimeout);
178 uint32_t getActivityTimeout();
180 void handleAction(
int event,
int action)
override;
186 void setAutomaticResetOnConnectionProblem(
unsigned int timeSec);
190 void setSuplaCACert(
const char *);
191 void setSupla3rdPartyCACert(
const char *);
192 const char* getSuplaCACert()
const;
198 void setCustomHostnamePrefix(
const char *prefix);
200 void enableNetwork();
201 void disableNetwork();
202 bool getStorageInitResult();
203 bool isSleepingAllowed();
212 void allowWorkInOfflineMode(
int mode = 1);
214 bool isRemoteDeviceConfigEnabled()
const;
215 void setShowUptimeInChannelState(
bool value);
217 void setProtoVerboseLog(
bool value);
218 bool isOfflineModeDuringConfig()
const;
222 void setChannelConflictResolver(
224 void setSubdevicePairingHandler(
227 void setMacLengthInHostname(
int value);
284 void addSecurityLog(Supla::SecurityLogSource source,
const char *log)
const;
318 int networkIsNotReadyCounter = 0;
320 uint32_t deviceRestartTimeoutTimestamp = 0;
321 uint32_t protocolRestartTimeoutTimestamp = 0;
322 uint32_t waitForIterate = 0;
323 uint32_t lastIterateTime = 0;
324 uint32_t enterConfigModeTimestamp = 0;
325 uint32_t forceRestartTimeMs = 0;
326 uint32_t protocolRestartTimeMs = 0;
327 uint32_t resetOnConnectionFailTimeoutSec = 0;
328 uint32_t lastSwUpdateCheckTimestamp = 0;
329 int allowOfflineMode = 1;
330 int currentStatus = STATUS_UNKNOWN;
332 enum Supla::DeviceMode deviceMode = Supla::DEVICE_MODE_NOT_SET;
333 bool triggerResetToFactorySettings =
false;
334 bool triggerStartLocalWebServer =
false;
335 bool triggerStopLocalWebServer =
false;
336 bool triggerCheckSwUpdate =
false;
337 bool requestNetworkLayerRestart =
false;
338 bool isNetworkSetupOk =
false;
339 bool skipNetwork =
false;
340 bool storageInitResult =
false;
341 bool configEmpty =
true;
342 bool atLeastOneProtoIsEnabled =
false;
343 bool showUptimeInChannelState =
true;
344 bool lastStateLogEnabled =
true;
347 bool initializationDone =
false;
348 bool goToConfigModeAsap =
false;
349 bool triggerSwUpdateIfAvailable =
false;
350 bool cfgModeStartedRemotelyAndNotRefreshed =
false;
352 uint8_t goToOfflineModeTimeout = 0;
353 uint8_t leaveCfgModeAfterInactivityMin = 5;
354 uint8_t macLengthInHostname = 6;
358 const uint8_t *rsaPublicKey =
nullptr;
360 _impl_arduino_status impl_arduino_status =
nullptr;
362 char *customHostnamePrefix =
nullptr;
368 void iterateAlwaysElements(uint32_t _millis);
369 bool iterateNetworkSetup();
370 bool iterateSuplaProtocol(uint32_t _millis);
371 void handleLocalActionTriggers();
372 void checkIfRestartIsNeeded();
373 void createSrpcLayerIfNeeded();
374 void setupDeviceMode();