* An entry point of the process loop as AutoConnect::handleClient. * The handleClient function of the AutoConnect that later accompanied * the AutoConnectUpdate class will invoke this entry. * This entry point will be called from the process loop of handleClient * function only if the class is associated with the AutoConnect class. */
| 212 | * function only if the class is associated with the AutoConnect class. |
| 213 | */ |
| 214 | void AutoConnectUpdateAct::handleUpdate(void) { |
| 215 | // Activate the update menu conditional with WiFi connected. |
| 216 | if (!isEnabled() && _enable) { |
| 217 | if (WiFi.status() == WL_CONNECTED) |
| 218 | enable(); |
| 219 | } |
| 220 | |
| 221 | if (isEnabled()) { |
| 222 | if (WiFi.status() == WL_CONNECTED) { |
| 223 | // Evaluate the processing status of AutoConnectUpdateAct and |
| 224 | // execute it accordingly. It is only this process point that |
| 225 | // requests update processing. |
| 226 | if (_status == UPDATE_START) { |
| 227 | _status = UPDATE_PROGRESS; |
| 228 | update(); |
| 229 | } |
| 230 | else if (_status == UPDATE_RESET) { |
| 231 | AC_DBG("Restart on %s updated...\n", _binName.c_str()); |
| 232 | ESP.restart(); |
| 233 | } |
| 234 | } |
| 235 | // If WiFi is not connected, disables the update menu. |
| 236 | // However, the AutoConnectUpdateAct class stills active. |
| 237 | else |
| 238 | disable(_enable); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Run the update function of HTTPUpdate that is the base class and |