105 bool begin(
const char GUID[SUPLA_GUID_SIZE],
108 const char authkey[SUPLA_AUTHKEY_SIZE],
109 unsigned char protoVersion = 23);
111 bool begin(
unsigned char protoVersion = 23);
114 void setName(
const char *Name);
116 void setGUID(
const char GUID[SUPLA_GUID_SIZE]);
117 void setAuthKey(
const char authkey[SUPLA_AUTHKEY_SIZE]);
118 void setEmail(
const char *email);
119 void setServer(
const char *server);
120 void setSwVersion(
const char *);
124 void setManufacturerId(int16_t);
128 void setProductId(int16_t);
130 void addFlags(int32_t);
131 void removeFlags(int32_t);
132 bool isSleepingDeviceEnabled();
134 int generateHostname(
char*,
int macSize = 6);
139 void onFastTimer(
void);
142 void status(
int status,
143 const __FlashStringHelper *msg,
144 bool alwaysLog =
false);
145 void setStatusFuncImpl(_impl_arduino_status impl_arduino_status);
146 void setServerPort(
int value);
151 void enterConfigMode();
152 void leaveConfigModeWithoutRestart();
153 void enterNormalMode();
156 void scheduleSoftRestart(
int timeout = 0);
157 void scheduleProtocolsRestart(
int timeout = 0);
159 void saveStateToStorage();
160 void restartCfgModeTimeout(
bool requireRestart);
161 void resetToFactorySettings();
162 void disableLocalActionsIfNeeded();
163 void requestCfgMode();
165 int getCurrentStatus();
166 bool loadDeviceConfig();
167 bool prepareLastStateLog();
168 char *getLastStateLog();
169 void addLastStateLog(
const char*);
170 void enableLastStateLog();
171 void disableLastStateLog();
172 void setRsaPublicKeyPtr(
const uint8_t *ptr);
173 const uint8_t *getRsaPublicKey();
174 enum Supla::DeviceMode getDeviceMode()
const;
176 void setActivityTimeout(_supla_int_t newActivityTimeout);
177 uint32_t getActivityTimeout();
179 void handleAction(
int event,
int action)
override;
185 void setAutomaticResetOnConnectionProblem(
unsigned int timeSec);
189 void setSuplaCACert(
const char *);
190 void setSupla3rdPartyCACert(
const char *);
191 const char* getSuplaCACert()
const;
197 void setCustomHostnamePrefix(
const char *prefix);
199 void enableNetwork();
200 void disableNetwork();
201 bool getStorageInitResult();
202 bool isSleepingAllowed();
211 void allowWorkInOfflineMode(
int mode = 1);
213 bool isRemoteDeviceConfigEnabled()
const;
214 void setShowUptimeInChannelState(
bool value);
216 void setProtoVerboseLog(
bool value);
217 bool isOfflineModeDuringConfig()
const;
221 void setChannelConflictResolver(
223 void setSubdevicePairingHandler(
226 void setMacLengthInHostname(
int value);
278 int networkIsNotReadyCounter = 0;
280 uint32_t deviceRestartTimeoutTimestamp = 0;
281 uint32_t protocolRestartTimeoutTimestamp = 0;
282 uint32_t waitForIterate = 0;
283 uint32_t lastIterateTime = 0;
284 uint32_t enterConfigModeTimestamp = 0;
285 uint32_t forceRestartTimeMs = 0;
286 uint32_t protocolRestartTimeMs = 0;
287 uint32_t resetOnConnectionFailTimeoutSec = 0;
288 uint32_t lastSwUpdateCheckTimestamp = 0;
289 int allowOfflineMode = 1;
290 int currentStatus = STATUS_UNKNOWN;
292 enum Supla::DeviceMode deviceMode = Supla::DEVICE_MODE_NOT_SET;
293 bool triggerResetToFactorySettings =
false;
294 bool triggerStartLocalWebServer =
false;
295 bool triggerStopLocalWebServer =
false;
296 bool triggerCheckSwUpdate =
false;
297 bool requestNetworkLayerRestart =
false;
298 bool isNetworkSetupOk =
false;
299 bool skipNetwork =
false;
300 bool storageInitResult =
false;
301 bool configEmpty =
true;
302 bool atLeastOneProtoIsEnabled =
false;
303 bool showUptimeInChannelState =
true;
304 bool lastStateLogEnabled =
true;
307 bool initializationDone =
false;
308 bool goToConfigModeAsap =
false;
309 bool triggerSwUpdateIfAvailable =
false;
311 uint8_t goToOfflineModeTimeout = 0;
312 uint8_t leaveCfgModeAfterInactivityMin = 5;
313 uint8_t macLengthInHostname = 6;
317 const uint8_t *rsaPublicKey =
nullptr;
319 _impl_arduino_status impl_arduino_status =
nullptr;
321 char *customHostnamePrefix =
nullptr;
326 void iterateAlwaysElements(uint32_t _millis);
327 bool iterateNetworkSetup();
328 bool iterateSuplaProtocol(uint32_t _millis);
329 void handleLocalActionTriggers();
330 void checkIfRestartIsNeeded(uint32_t _millis);
331 void createSrpcLayerIfNeeded();
332 void setupDeviceMode();