|
libpowermon 1.20
PowerMon Access Library
|
Powermon is a class representing one PowerMon device (BLE or WiFi) and offers a set of functions for accessing all features of PowerMon battery monitors. More...
#include <powermon.h>
Classes | |
| struct | AuthKey |
| AuthKey is a structure representing an authentication key used to unlock a locked PowerMon device. More... | |
| struct | DeviceIdentifier |
| DeviceIdentifier is a structure containing all information used to identify a PowerMon device. More... | |
| struct | DeviceInfo |
| DeviceInfo is the information structure returned by PowerMon as response to the GetInfo request. More... | |
| struct | FuelgaugeStatistics |
| FuelgaugeStatistics is a structure containing battery statistics. More... | |
| struct | LogFileDescriptor |
| LogFileDescriptor represents a PowerMon log file. More... | |
| struct | MonitorData |
| MonitorData is a structure containing the real-time PowerMon data. More... | |
| struct | MonitorStatistics |
| MonitorStatistics is a structure containing power meter statistics. More... | |
| struct | RemoteAccessKey |
| RemoteAccessKey is a structure representing the access keys used to connect to a WiFi/Ethernet PowerMon remotely (via the Internet) More... | |
| struct | WifiNetwork |
| WifiNetwork represents all information required by PowerMon-W to connect to an access point. More... | |
| struct | WifiScanResult |
| WifiScanResult represents a WiFi network detected by PowerMon-W during WiFi scanning. More... | |
Public Types | |
| enum | HardwareRevision : uint8_t { FAMILY_MASK = 0xF0 , POWERMON_E = 0x10 , POWERMON = 0x20 , POWERMON_5S = 0x30 , POWERMON_W = 0x40 } |
| HardwareRevision definitions (2 digit BCD format) More... | |
| enum | State : uint8_t { Disconnected = 0 , Connecting , Connected } |
| State represents the PowerMon connection state. More... | |
| enum | DisconnectReason : uint8_t { CLOSED = 0 , NO_ROUTE , FAILED , UNEXPECTED_ERROR , UNEXPECTED_RESPONSE , WRITE_ERROR , READ_ERROR } |
| DisconnectReason is an enumeration of all reasons a connection can be terminated. | |
| enum | ResponseCode : uint16_t { RSP_SUCCESS = 0x0000 , RSP_SUCCESS_MORE = 0x0100 , RSP_INVALID_REQ = 0x0001 , RSP_INVALID_PARAM = 0x0002 , RSP_ERROR = 0x0003 , RSP_LOCKED_USER = 0x0004 , RSP_LOCKED_MASTER = 0x0005 , RSP_CANNOT_UNLOCK = 0x0006 , RSP_NOT_FOUND = 0x0007 , RSP_TIMEOUT = 0x0008 , RSP_INVALID = 0x0009 , RSP_CANCELLED = 0x000A } |
| ResponseCodes is an enumeration of all possible response codes for requests to a PowerMon device. | |
| enum | PowerStatus : uint8_t { PS_OFF = 0 , PS_ON = 1 , PS_LVD = 2 , PS_OCD = 3 , PS_HVD = 4 , PS_FGD = 5 , PS_NCH = 6 , PS_LTD = 7 , PS_HTD = 8 } |
| PowerStatus is an enumeration of all possible power states. More... | |
Public Member Functions | |
| virtual bool | connectIp (const RemoteAccessKey &key)=0 |
| Connects to a remote network PowerMon (Ethernet / WiFi) | |
| virtual bool | connectIp (uint32_t ipaddr)=0 |
| Connects to a local network PowerMon (Ethernet / WiFi) | |
| virtual bool | connectBle (uint64_t ble_address)=0 |
| Connects to a local BLE PowerMon. | |
| virtual bool | disconnect (void)=0 |
| Disconnects from a connected device. | |
| virtual bool | isLocalConnection (void) const =0 |
| Returns true if the current connection is local. | |
| virtual void | setOnConnectCallback (const std::function< void(void)> &cb)=0 |
| Sets the callback to be called by the driver when a connection to the PowerMon device is fully established. | |
| virtual void | setOnDisconnectCallback (const std::function< void(DisconnectReason)> &cb)=0 |
| Sets the callback to be called by the driver when a connection to the PowerMon device is disconnected. | |
| virtual void | setOnMonitorDataCallback (const std::function< void(const MonitorData &)> &cb)=0 |
| Sets the callback to be called by the driver when new monitor data is received. This applies to the BLE devices only. For the network devices (WiFi / Ethernet), use the request to retrieve the monitor data. | |
| virtual void | setOnWifiScanReportCallback (const std::function< void(const WifiScanResult *)> &cb)=0 |
| Sets the callback to be called by the driver when a new WiFi scan result is received from the PowerMon. This applies to the WiFi devices only. WiFi scanning can be initiated using requestStartWifiScan(). | |
| virtual const DeviceInfo & | getLastDeviceInfo (void) const =0 |
| Returns the last DeviceInfo retrieved from the PowerMon. | |
| virtual void | requestGetInfo (const std::function< void(ResponseCode, const DeviceInfo &)> &cb)=0 |
| Requests the device information. | |
| virtual void | requestGetMonitorData (const std::function< void(ResponseCode, const MonitorData &)> &cb)=0 |
| Requests the device monitor data. It only applies to the network devices (WiFi / Ethernet). | |
| virtual void | requestGetStatistics (const std::function< void(ResponseCode, const MonitorStatistics &)> &cb)=0 |
| Requests the device power monitor statistics data. | |
| virtual void | requestGetFgStatistics (const std::function< void(ResponseCode, const FuelgaugeStatistics &)> &cb)=0 |
| Requests the device battery statistics data. | |
| virtual void | requestUnlock (const AuthKey &key, std::function< void(ResponseCode)> cb)=0 |
| Requests unlocking a password protected device. | |
| virtual void | requestSetUserPasswordLock (const AuthKey &key, std::function< void(ResponseCode)> cb)=0 |
| Requests setting a user password lock. | |
| virtual void | requestSetMasterPasswordLock (const AuthKey &key, std::function< void(ResponseCode)> cb)=0 |
| Requests setting a master password lock on. | |
| virtual void | requestClearUserPasswordLock (std::function< void(ResponseCode)> cb)=0 |
| Requests clearing of the user password lock. | |
| virtual void | requestClearMasterPasswordLock (std::function< void(ResponseCode)> cb)=0 |
| Requests clearing of the master password lock. | |
| virtual void | requestGetAuthKey (std::function< void(ResponseCode, const AuthKey &)> cb)=0 |
| Requests the authentication key from the device. This key can be used to unlock a locked device. It acts the same way as the user password lock. | |
| virtual void | requestResetAuthKey (std::function< void(ResponseCode)> cb)=0 |
| Requests the reset of the device authentication key. | |
| virtual void | requestResetEnergyMeter (const std::function< void(ResponseCode)> &cb)=0 |
| Requests the reset of the energy meter. | |
| virtual void | requestResetCoulombMeter (const std::function< void(ResponseCode)> &cb)=0 |
| Requests the reset of the coulomb meter. | |
| virtual void | requestResetStatistics (const std::function< void(ResponseCode)> &cb)=0 |
| Requests the reset of the power meter statistics. | |
| virtual void | requestSetPowerState (bool state, const std::function< void(ResponseCode)> &cb)=0 |
| Requests changing the power state. | |
| virtual void | requestGetConfig (const std::function< void(ResponseCode, const PowermonConfig &)> &cb)=0 |
| Retrieves the device configuration structure. | |
| virtual void | requestSetConfig (const PowermonConfig &config, const std::function< void(ResponseCode)> &cb)=0 |
| Sends new configuration to the device. | |
| virtual void | requestResetConfig (const std::function< void(ResponseCode)> &cb)=0 |
| Resets the PowerMon configuration to factory settings This will also clear the data log, reset the name, authentication keys and remote access keys (for network devices). | |
| virtual void | requestRename (const char *name, const std::function< void(ResponseCode)> &cb)=0 |
| Requests renaming the PowerMon device. | |
| virtual void | requestSetTime (uint32_t time, const std::function< void(ResponseCode)> &cb)=0 |
| Requests setting the internal clock of the PowerMon device. | |
| virtual void | requestFgSynchronize (const std::function< void(ResponseCode)> &cb)=0 |
| Requests forcing the SoC to 100% (SoC synchronize) | |
| virtual void | requestStartWifiScan (const std::function< void(ResponseCode)> &cb)=0 |
| Requests starting the WiFi scan (only applies to the WiFi PowerMons). WiFi scanning will stop automatically after a max of 5 seconds. | |
| virtual void | requestWifiConfigure (const WifiNetwork &network, const std::function< void(ResponseCode)> &cb)=0 |
| Sends new WiFi network credentials to the PowerMon device. The new credentials will be saved by the device whether PowerMon can or cannot connect to that specified network. | |
| virtual void | requestGetWifiNetworks (const std::function< void(ResponseCode, const std::vector< WifiNetwork > &)> &cb)=0 |
| Returns a list of all WiFi networks known by the device. | |
| virtual void | requestAddWifiNetwork (const WifiNetwork &network, const std::function< void(ResponseCode)> &cb)=0 |
| Add a new WiFi network The new credentials will be saved by the device whether PowerMon can or cannot connect to that specified network. | |
| virtual void | requestRemoveWifiNetwork (uint8_t index, const std::function< void(ResponseCode)> &cb)=0 |
| Removes a stored WiFi network. | |
| virtual void | requestGetAccessKeys (const std::function< void(ResponseCode, const RemoteAccessKey &)> &cb)=0 |
| Requests the network remote access keys (only applies to the network PowerMons). The access keys are used to remotely access the device. | |
| virtual void | requestResetAccessKeys (const std::function< void(ResponseCode)> &cb)=0 |
| Requests resetting of the network remote access keys (only applies to the network PowerMons). This effectively severs the connection to all the paired clients. | |
| virtual void | requestZeroCurrentOffset (const std::function< void(ResponseCode)> &cb)=0 |
| Requests zeroing of the current reading offset. | |
| virtual void | requestCalibrateCurrent (float value, const std::function< void(ResponseCode)> &cb)=0 |
| Requests calibration of the current reading. | |
| virtual void | requestGetSchedules (const std::function< void(ResponseCode, const std::vector< PowermonSchedule > &)> &cb)=0 |
| Requests the list of all schedules stored in the device. | |
| virtual void | requestAddSchedules (const std::vector< PowermonSchedule > &schedules, const std::function< void(ResponseCode)> &cb)=0 |
| Requests adding new schedules. | |
| virtual void | requestUpdateSchedule (uint64_t old_schedule_descriptor, const PowermonSchedule &new_schedule, const std::function< void(ResponseCode)> &cb)=0 |
| Requests updating an existing schedule. | |
| virtual void | requestDeleteSchedule (uint64_t schedule_descriptor, const std::function< void(ResponseCode)> &cb)=0 |
| Requests deleting an existing schedule. | |
| virtual void | requestClearSchedules (const std::function< void(ResponseCode)> &cb)=0 |
| Requests clearing of all schedules. | |
| virtual void | requestCommitSchedules (const std::function< void(ResponseCode)> &cb)=0 |
| Requests committing the schedules to non-volatile memory. | |
| virtual void | requestGetLogFileList (const std::function< void(ResponseCode, const std::vector< LogFileDescriptor > &)> &cb)=0 |
| Requests the list of log files. | |
| virtual void | requestReadLogFile (uint32_t file_id, uint32_t offset, uint32_t read_size, const std::function< void(ResponseCode, const uint8_t *, size_t)> &cb)=0 |
| Requests reading of a log file. | |
| virtual void | requestClearLog (const std::function< void(ResponseCode)> &cb)=0 |
| Requests clearing of all schedules. | |
| virtual void | requestUpdateFirmware (const uint8_t *firmware_image, uint32_t size, const std::function< bool(uint32_t, uint32_t)> &progress_cb, const std::function< void(ResponseCode)> &done_cb)=0 |
| Requests firmware update. | |
| virtual void | requestReadDebug (uint32_t offset, uint32_t read_size, const std::function< void(ResponseCode, const uint8_t *, size_t)> &cb)=0 |
| virtual void | requestEraseDebug (const std::function< void(ResponseCode)> &cb)=0 |
| virtual void | requestReboot (const std::function< void(ResponseCode)> &cb)=0 |
Static Public Member Functions | |
| static Powermon * | createInstance (void) |
| Creates an instance of the Powermon class. | |
| static uint16_t | getVersion (void) |
| Returns the PowerMon access library version. | |
| static std::string | getIpAddressString (uint32_t ip) |
| Returns the IP address as string. | |
| static std::string | getMacAddressString (uint64_t mac) |
| Returns the Bluetooth MAC address as string. | |
| static uint64_t | parseMacAddress (const char *address) |
| Parses a MAC address string. | |
| static std::string | getHardwareString (uint8_t bcd) |
| Returns the hardware name based on the hardware revision in BCD format. | |
| static std::string | getPowerStatusString (PowerStatus ps) |
| Returns the power status string representation. | |
| static bool | hasDataLog (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has data logging capabilities. | |
| static bool | hasVoltage2 (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has V2. | |
| static bool | hasConfigurableShunt (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision supports configurable shunts. | |
| static bool | hasIntegratedShunt (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has an integrated shunt. | |
| static bool | hasWifi (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has WiFi. | |
| static bool | hasEthernet (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has Ethernet. | |
| static bool | hasNetwork (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has any network connection (WiFi or Ethernet) | |
| static bool | hasBluetooth (uint8_t bcd) |
| Returns true if the PowerMon described by the BCD hardware revision has Bluetooth. | |
| static bool | checkBCD (uint16_t bcd) |
| Returns true if the parameter is a valid BCD number. | |
| static AuthKey | getAuthKeyFromPassword (const char *password) |
| Generates the SHA256 hash of a password. | |
| static std::string | getUpdateFirmwareImageUrl (uint8_t hardware_revision_bcd, uint16_t firmware_revision_bcd) |
| Returns the update firmware image URL based on the hardware revision and firmware version. | |
| static uint16_t | checkFirmwareImage (const uint8_t *image, size_t size, uint8_t hardware_revision_bcd) |
| Checks the validity of the firmware update image. | |
Powermon is a class representing one PowerMon device (BLE or WiFi) and offers a set of functions for accessing all features of PowerMon battery monitors.
| enum Powermon::HardwareRevision : uint8_t |
HardwareRevision definitions (2 digit BCD format)
| Enumerator | |
|---|---|
| FAMILY_MASK | Mask for the family part of the revision number. |
| POWERMON_E | PowerMon-E (Ethernet) |
| POWERMON | Original PowerMon (BLE) |
| POWERMON_5S | PowerMon-5S (BLE) |
| POWERMON_W | PowerMon-W (WiFi) |
| enum Powermon::PowerStatus : uint8_t |
PowerStatus is an enumeration of all possible power states.
| enum Powermon::State : uint8_t |
State represents the PowerMon connection state.
| Enumerator | |
|---|---|
| Disconnected | Device is not connected. |
| Connecting | Device is in the process of connecting. |
| Connected | Device is connected. |
|
pure virtual |
Connects to a local BLE PowerMon.
| ble_address | The Bluetooth address of the PowerMon device |
|
pure virtual |
Connects to a remote network PowerMon (Ethernet / WiFi)
| key | The access key used to connect |
|
pure virtual |
Connects to a local network PowerMon (Ethernet / WiFi)
| ipaddr | The IPv4 address of the local WiFi PowerMon device |
|
static |
|
pure virtual |
Disconnects from a connected device.
|
static |
Generates the SHA256 hash of a password.
| password | C string containing the password |
|
pure virtual |
Returns the last DeviceInfo retrieved from the PowerMon.
|
static |
Returns the PowerMon access library version.
|
pure virtual |
Requests adding new schedules.
| schedules | A list of schedules to add |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Add a new WiFi network The new credentials will be saved by the device whether PowerMon can or cannot connect to that specified network.
| network | WiFi network credentials |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests calibration of the current reading.
| value | The actual current flowing through the shunt. An accurate multimeter is required to measure the current. |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests clearing of all schedules.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests clearing of the master password lock.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests clearing of all schedules.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests clearing of the user password lock.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests committing the schedules to non-volatile memory.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests deleting an existing schedule.
| schedule_descriptor | The descriptor of the schedule to delete |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests forcing the SoC to 100% (SoC synchronize)
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests the network remote access keys (only applies to the network PowerMons). The access keys are used to remotely access the device.
| cb | Lambda of type void(ResponseCode, const RemoteAccessKey&) that will be called to signal the result of the request |
|
pure virtual |
Requests the authentication key from the device. This key can be used to unlock a locked device. It acts the same way as the user password lock.
| cb | Lambda of type void(ResponseCode, const AuthKey&) that will be called to signal the result of the request |
|
pure virtual |
Retrieves the device configuration structure.
| cb | Lambda of type void(ResponseCode, const PowermonConfig&) that will be called to signal the result of the request |
|
pure virtual |
Requests the device battery statistics data.
| cb | Lambda of type void(ResponseCode, const FuelgaugeStatistics&) that will be called to signal the result of the request |
|
pure virtual |
Requests the device information.
| cb | Lambda of type void(ResponseCode, const DeviceInfo&) that will be called to signal the result of the request |
|
pure virtual |
Requests the list of log files.
| cb | Lambda of type void(ResponseCode, const std::vector<LogFileDescriptor>&) that will be called to signal the result of the request |
|
pure virtual |
Requests the device monitor data. It only applies to the network devices (WiFi / Ethernet).
| cb | Lambda of type void(ResponseCode, const MonitorData&) that will be called to signal the result of the request |
|
pure virtual |
Requests the list of all schedules stored in the device.
| cb | Lambda of type void(ResponseCode, const std::vector<PowermonSchedule>&) that will be called to signal the result of the request |
|
pure virtual |
Requests the device power monitor statistics data.
| cb | Lambda of type void(ResponseCode, const MonitorStatistics&) that will be called to signal the result of the request |
|
pure virtual |
Returns a list of all WiFi networks known by the device.
| cb | Lambda of type void(ResponseCode, const std::vector<WifiNetwork>&) that will be called to signal the result of the request |
|
pure virtual |
Requests reading of a log file.
| file_id | ID of the file to read (obtained from the LogFileDescriptor) |
| offset | Offset to read from |
| read_size | Read size in bytes |
| cb | Lambda of type void(ResponseCode, const uint8_t*, size_t) that will be called to signal the result of the request |
|
pure virtual |
Removes a stored WiFi network.
| index | WiFi network index in the list returned by requestGetWifiNetworks() |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests renaming the PowerMon device.
| name | New name. For Bluetooth PowerMons the name is limited to 8 characters. For network PowerMons the name can be up to 32 characters in length. |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests resetting of the network remote access keys (only applies to the network PowerMons). This effectively severs the connection to all the paired clients.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests the reset of the device authentication key.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Resets the PowerMon configuration to factory settings This will also clear the data log, reset the name, authentication keys and remote access keys (for network devices).
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request. |
|
pure virtual |
Requests the reset of the coulomb meter.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests the reset of the energy meter.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests the reset of the power meter statistics.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Sends new configuration to the device.
| config | New configuration structure |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests setting a master password lock on.
| key | 32 bytes AuthKey type used to unlock the device. This is typically the SHA256 hash of a password. |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests changing the power state.
| state | New power state (ON / OFF) |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests setting the internal clock of the PowerMon device.
| time | New clock in UNIX format (number of seconds since Jan 1st, 1970) in localtime (not UTC) |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests setting a user password lock.
| key | 32 bytes AuthKey type used to unlock the device. This is typically the SHA256 hash of a password. |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests starting the WiFi scan (only applies to the WiFi PowerMons). WiFi scanning will stop automatically after a max of 5 seconds.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests unlocking a password protected device.
| key | 32 bytes AuthKey type used to unlock the device. This is typically the SHA256 hash of a password. |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests firmware update.
| firmware_image | The firmware update image |
| size | Size of the firmware update image |
| progress_cb | Lambda of type bool(uint32_t progress, uint32_t total) that will be called regularly with updates about the progress. Returning false from the lambda will abort the update operation. |
| done_cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request upon completion of the firmware update |
|
pure virtual |
Requests updating an existing schedule.
| old_schedule_descriptor | The descriptor of the schedule to update |
| new_schedule | The new schedule |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Sends new WiFi network credentials to the PowerMon device. The new credentials will be saved by the device whether PowerMon can or cannot connect to that specified network.
| network | WiFi network credentials |
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Requests zeroing of the current reading offset.
| cb | Lambda of type void(ResponseCode) that will be called to signal the result of the request |
|
pure virtual |
Sets the callback to be called by the driver when a connection to the PowerMon device is fully established.
| cb | Lambda of type void(void) |
|
pure virtual |
Sets the callback to be called by the driver when a connection to the PowerMon device is disconnected.
| cb | Lambda of type void(Powermmon::DisconnectReason) |
|
pure virtual |
Sets the callback to be called by the driver when new monitor data is received. This applies to the BLE devices only. For the network devices (WiFi / Ethernet), use the request to retrieve the monitor data.
| cb | Lambda of type void(Powermon::MonitorData&) |
|
pure virtual |
Sets the callback to be called by the driver when a new WiFi scan result is received from the PowerMon. This applies to the WiFi devices only. WiFi scanning can be initiated using requestStartWifiScan().
| cb | Lambda of type void(Powermon::WifiScanResult*) |
| result | Pointer to a WiFiScanResult structure describing a WiFi network. The pointer is only valid inside the scope of the callback closure. Do not store this pointer. Result can be nullptr to signal the WiFi scan ending. |