|
Ersa Wearable Platform
Embedded smartwatch firmware and application framework
|
#include <network_manager.h>

Public Member Functions | |
| NetworkManager (events::EventBus &bus=events::EventBus::instance(), hal::IWifiRadio *wifi=nullptr) | |
| Result< void > | init () |
| void | tick (uint32_t currentUptimeMs) |
| NetworkHandle | requestInternet () |
| void | acquire () |
| void | release () |
| bool | isConnected () const |
| Return whether station networking is connected. | |
| bool | isConnecting () const |
| Return whether a station connection is being established. | |
| size_t | getActiveHandleCount () const |
| Return the number of active network leases. | |
Static Public Member Functions | |
| static NetworkManager & | instance () |
| Return the installed process-wide network manager. | |
| static void | setInstance (NetworkManager *instance) |
| Install the process-wide network manager. | |
Private Attributes | |
| events::EventBus & | bus_ |
| hal::IWifiRadio * | wifi_ |
| size_t | activeHandles_ {0} |
| bool | connected_ {false} |
| bool | connecting_ {false} |
| uint32_t | lastActivityMs_ {0} |
Coordinates Wi-Fi availability with independent service clients.
Each NetworkHandle is a scoped radio-use lease. The manager keeps the radio active while at least one lease exists and powers it down after the final lease and idle policy permit. This makes resource lifetime explicit and avoids one app disconnecting Wi-Fi while another service still needs it.
|
explicit |
Bind a radio and event bus; null radio provides a no-hardware host mode.
| void ersa::services::NetworkManager::acquire | ( | ) |
Increment an unscoped reference count for legacy/manual lifetime code.
| size_t ersa::services::NetworkManager::getActiveHandleCount | ( | ) | const |
Return the number of active network leases.
| Result< void > ersa::services::NetworkManager::init | ( | ) |
Subscribe to link transitions and initialize radio state if available.
|
static |
Return the installed process-wide network manager.
| bool ersa::services::NetworkManager::isConnected | ( | ) | const |
Return whether station networking is connected.
| bool ersa::services::NetworkManager::isConnecting | ( | ) | const |
Return whether a station connection is being established.
| void ersa::services::NetworkManager::release | ( | ) |
Decrement a prior raw acquisition; unmatched releases are ignored.
| NetworkHandle ersa::services::NetworkManager::requestInternet | ( | ) |
Acquire an RAII lease; connectivity remains active until release.
|
static |
Install the process-wide network manager.
| void ersa::services::NetworkManager::tick | ( | uint32_t | currentUptimeMs | ) |
Apply deferred link events and idle power-off using monotonic uptime.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |