MCPcopy Create free account
hub / github.com/BruceDevices/firmware / cleanlyStopWebUiForWiFiFeature

Function cleanlyStopWebUiForWiFiFeature

src/core/wifi/webInterface.cpp:61–85  ·  view source on GitHub ↗

** Function: cleanlyStopWebUiForWiFiFeature ** Cleanly stop WebUI and AP mode before starting a WiFi feature ** This prevents WiFi mode conflicts when features need exclusive control **********************************************************************/

Source from the content-addressed store, hash-verified

59** This prevents WiFi mode conflicts when features need exclusive control
60**********************************************************************/
61void cleanlyStopWebUiForWiFiFeature() {
62 // Only proceed if WebUI is active
63 if (!isWebUIActive && !server) { return; }
64
65 // Brief notification (non-blocking)
66 Serial.println("Stopping WebUI for WiFi feature...");
67
68 // Stop the WebUI
69 if (server) {
70 stopWebUi();
71 // Give the web server time to fully shut down
72 vTaskDelay(pdMS_TO_TICKS(100));
73 }
74
75 // Disconnect WiFi AP mode if it's the WebUI's AP
76 // Check if we're in AP or APSTA mode (used by WebUI)
77 wifi_mode_t currentMode = WiFi.getMode();
78 if (currentMode == WIFI_MODE_AP || currentMode == WIFI_MODE_APSTA) {
79 wifiDisconnect();
80 // Give WiFi time to fully disconnect
81 vTaskDelay(pdMS_TO_TICKS(250));
82 }
83
84 Serial.println("WebUI stopped, starting WiFi feature...");
85}
86/**********************************************************************
87** Function: loopOptionsWebUi
88** Display options to launch the WebUI

Callers 7

EvilPortalMethod · 0.85
karma_setupFunction · 0.85
deauthFloodAttackFunction · 0.85
capture_handshakeFunction · 0.85
target_atkFunction · 0.85
sniffer_setupFunction · 0.85
stationDeauthFunction · 0.85

Calls 3

stopWebUiFunction · 0.85
wifiDisconnectFunction · 0.85
printlnMethod · 0.45

Tested by

no test coverage detected