When I call CTRL_REQUEST_WIFI_CLEAR_KNOWN_NETWORKS
through a BLE control request it doesn't issue a network_credentials_cleared
event from my network manager event handler. It does when I call WiFi.clearCredentials()
though.
When called with WiFi.clearCredentials()
,
[ncp.mgr] TRACE: Updated file: /sys/wifi_config.bin
[system.nm] TRACE: Updated file: /sys/network.dat
[app] INFO: Network credentials event: network_credentials_cleared
When called with a control request,
[ncp.mgr] TRACE: Updated file: /sys/wifi_config.bin
It looks like this is because the control request calls,
ctrl::wifi::clearKnownNetworks(req)
└>wifiMgr->clearNetworkConfig()
└>saveConfig(networks)
while WiFi.clearCredentials()
calls,
NetworkManager::clearConfiguration()
├>wifiMan->clearNetworkConfig()
| └>saveConfig(networks)
└>NetworkManager::saveStoredConfiguration()
└>system_notify_event(network_credentials, network_credentials_cleared)
Is this intentional? I had been trying to keep track of wifi networks being added and cleared through the event handler because I didn't know if calling WiFi.hasCredentials()
all the time was a good idea.