Skip to content

WifiApModule

WiFi access point (AP) mode. Always starts an open AP on boot — the unconditional recovery path for connecting to the device. Introduced in Sprint 8.


What it does

WifiApModule starts a Wi-Fi soft access point in setup(). The AP:

  • Uses the parent NetworkModule's deviceName() as its SSID (e.g. MM-A3F2).
  • Is bound to the fixed IP 4.3.2.1 via softAPConfig().
  • Is open by default (no password). Define WIFIAP_PASSWORD at compile time to add a ap_password sensitive control.
  • Stays up even when WifiStaModule connects to a home network — both run simultaneously via WIFI_AP_STA mode set by NetworkModule.

The AP is the recovery path: even if STA credentials are wrong, the device is always reachable at http://4.3.2.1.

On PC, startAp() is a no-op; status is set to "PC (no WiFi)".


Controls

Key Type Default Description
status display "starting""active" or "failed" AP state, updated after softAP() call
ap_password password (sensitive) "" Only present when WIFIAP_PASSWORD is defined

Data-flow input

WifiApModule reads the device name from NetworkModule via:

void setInput(const char* key, Module* source) override {
    if (strcmp(key, "network") == 0)
        network_ = static_cast<NetworkModule*>(source);
}

Wire it in state/modulemanager.json via "inputs": {"network": "network1"}.


Parent

WifiApModule is a child of NetworkModule. Its lifecycle is managed by the ModuleManager parent-child mechanism. teardown() calls WiFi.softAPdisconnect() cleanly.


Platform notes

PC: no-op; status is always "PC (no WiFi)".


Test coverage

Network and WiFi — lifecycle on PC does not crash; setInput("network") accepted without crash.


Source