102 bool begin(
const char GUID[SUPLA_GUID_SIZE],
105 const char authkey[SUPLA_AUTHKEY_SIZE],
106 unsigned char protoVersion = 23);
108 bool begin(
unsigned char protoVersion = 23);
111 void setName(
const char *Name);
113 void setGUID(
const char GUID[SUPLA_GUID_SIZE]);
114 void setAuthKey(
const char authkey[SUPLA_AUTHKEY_SIZE]);
115 void setEmail(
const char *email);
116 void setServer(
const char *server);
117 void setSwVersion(
const char *);
121 void setManufacturerId(int16_t);
125 void setProductId(int16_t);
127 void addFlags(int32_t);
128 void removeFlags(int32_t);
129 bool isSleepingDeviceEnabled();
131 int generateHostname(
char*,
int macSize = 6);
136 void onFastTimer(
void);
139 void status(
int status,
140 const __FlashStringHelper *msg,
141 bool alwaysLog =
false);
142 void setStatusFuncImpl(_impl_arduino_status impl_arduino_status);
143 void setServerPort(
int value);
148 void enterConfigMode();
149 void leaveConfigModeWithoutRestart();
150 void enterNormalMode();
153 void scheduleSoftRestart(
int timeout = 0);
154 void scheduleProtocolsRestart(
int timeout = 0);
156 void saveStateToStorage();
157 void disableCfgModeTimeout();
158 void resetToFactorySettings();
159 void disableLocalActionsIfNeeded();
160 void requestCfgMode(Supla::Device::RequestConfigModeType);
162 int getCurrentStatus();
163 bool loadDeviceConfig();
164 bool prepareLastStateLog();
165 char *getLastStateLog();
166 void addLastStateLog(
const char*);
167 void enableLastStateLog();
168 void disableLastStateLog();
169 void setRsaPublicKeyPtr(
const uint8_t *ptr);
170 const uint8_t *getRsaPublicKey();
171 enum Supla::DeviceMode getDeviceMode()
const;
173 void setActivityTimeout(_supla_int_t newActivityTimeout);
174 uint32_t getActivityTimeout();
176 void handleAction(
int event,
int action)
override;
182 void setAutomaticResetOnConnectionProblem(
unsigned int timeSec);
186 void setSuplaCACert(
const char *);
187 void setSupla3rdPartyCACert(
const char *);
193 void setCustomHostnamePrefix(
const char *prefix);
195 void enableNetwork();
196 void disableNetwork();
197 bool getStorageInitResult();
198 bool isSleepingAllowed();
207 void allowWorkInOfflineMode(
int mode = 1);
209 bool isRemoteDeviceConfigEnabled()
const;
210 void setShowUptimeInChannelState(
bool value);
212 void setProtoVerboseLog(
bool value);
213 bool isOfflineModeDuringConfig()
const;
217 void setChannelConflictResolver(
219 void setSubdevicePairingHandler(
222 void setMacLengthInHostname(
int value);
227 int networkIsNotReadyCounter = 0;
229 uint32_t deviceRestartTimeoutTimestamp = 0;
230 uint32_t protocolRestartTimeoutTimestamp = 0;
231 uint32_t waitForIterate = 0;
232 uint32_t lastIterateTime = 0;
233 uint32_t enterConfigModeTimestamp = 0;
234 uint32_t forceRestartTimeMs = 0;
235 uint32_t protocolRestartTimeMs = 0;
236 uint32_t resetOnConnectionFailTimeoutSec = 0;
237 int allowOfflineMode = 0;
238 int currentStatus = STATUS_UNKNOWN;
240 enum Supla::DeviceMode deviceMode = Supla::DEVICE_MODE_NOT_SET;
241 Supla::Device::RequestConfigModeType goToConfigModeAsap = Supla::Device::None;
242 bool triggerResetToFactorySettings =
false;
243 bool triggerStartLocalWebServer =
false;
244 bool triggerStopLocalWebServer =
false;
245 bool triggerCheckSwUpdate =
false;
246 bool requestNetworkLayerRestart =
false;
247 bool isNetworkSetupOk =
false;
248 bool skipNetwork =
false;
249 bool storageInitResult =
false;
250 bool configEmpty =
true;
251 bool atLeastOneProtoIsEnabled =
false;
252 bool showUptimeInChannelState =
true;
253 bool lastStateLogEnabled =
true;
256 bool initializationDone =
false;
258 uint8_t goToOfflineModeTimeout = 0;
259 uint8_t macLengthInHostname = 6;
263 const uint8_t *rsaPublicKey =
nullptr;
265 _impl_arduino_status impl_arduino_status =
nullptr;
267 char *customHostnamePrefix =
nullptr;
272 void iterateAlwaysElements(uint32_t _millis);
273 bool iterateNetworkSetup();
274 bool iterateSuplaProtocol(uint32_t _millis);
275 void handleLocalActionTriggers();
276 void checkIfRestartIsNeeded(uint32_t _millis);
277 void createSrpcLayerIfNeeded();
278 void setupDeviceMode();