Skip to content

WifiApModule

WiFi access point (AP) mode. Provides a recovery access point when no other connectivity is available. Introduced in Sprint 8; automatic management by NetworkModule added Sprint 10.


What it does

WifiApModule manages a Wi-Fi soft access point. 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.

On first boot the AP starts automatically and is the only way to reach the device. Once WifiStaModule connects to a home network, NetworkModule's management tick disables the AP within 10 seconds. If STA later drops for more than 30 seconds, the AP is re-enabled as a recovery path.

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

For the full enable/disable policy (grace period, Ethernet interaction, saved-state behaviour), see Developer Guide: Network — Management policy.


Controls

Key Type Default Description
enabled (inherited) true on first boot Whether the AP should be running. Managed at runtime by NetworkModule.
status display "starting" AP state: starting, active, failed, disabled, or no WiFi
ap_password password (sensitive) "" Only present when WIFIAP_PASSWORD is defined

Fixed network parameters

Parameter Value
IP address 4.3.2.1
Gateway 4.3.2.1
Subnet 255.255.255.0
SSID device_name from NetworkModule
Security Open (no password) unless 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_ap_stop() to cleanly disconnect any connected stations.


Platform notes

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


Test coverage

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


Source