![]() |
|
Uniot Core
|
| 0.8.1 |
Complete WiFi network management and configuration scheduler. More...
#include <NetworkScheduler.h>
Public Member Functions | |
| NetworkScheduler (Credentials &credentials) | |
| Construct a new NetworkScheduler. | |
| virtual void | pushTo (TaskScheduler &scheduler) override |
| Push all network tasks to the scheduler. | |
| virtual void | attach () override |
| Attach the network scheduler and start initial connection. | |
| void | config () |
| Start or recover configuration mode. | |
| void | forget () |
| Forget stored WiFi credentials and enter configuration mode. | |
| bool | reconnect () |
| Attempt to reconnect using stored credentials. | |
| bool | setCredentials (const String &ssid, const String &password) |
| Set and store new WiFi credentials. | |
Public Member Functions inherited from uniot::ISchedulerConnectionKit | |
| virtual | ~ISchedulerConnectionKit () |
| Virtual destructor for proper cleanup. | |
Public Member Functions inherited from uniot::EventEmitter< unsigned int, int, Bytes > | |
| virtual | ~EventEmitter ()=default |
| Virtual destructor to ensure proper cleanup of derived classes. | |
| virtual type_id | getTypeId () const override |
| Returns the type identifier for this EventEmitter. | |
| void | emitEvent (unsigned int topic, int msg) |
| Emits an event to all registered event buses. | |
| virtual | ~EventEmitter ()=default |
| Virtual destructor to ensure proper cleanup of derived classes. | |
| virtual type_id | getTypeId () const override |
| Returns the type identifier for this EventEmitter. | |
| void | emitEvent (unsigned int topic, int msg) |
| Emits an event to all registered event buses. | |
Public Member Functions inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| virtual | ~EventEntity () |
| Destructor - disconnects from all connected EventBus instances. | |
| bool | sendDataToChannel (T_topic channel, T_data data) |
| Sends data to a specific channel on all connected EventBus instances. | |
| void | receiveDataFromChannel (T_topic channel, DataChannelCallback callback) |
| Receives data from a specific channel on all connected EventBus instances. | |
Additional Inherited Members | |
Public Types inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| using | DataChannelCallback = std::function<void(unsigned int, bool, T_data)> |
| Callback type for handling data received from channels. | |
Protected Member Functions inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| bool | connectUnique (EventBus< T_topic, T_msg, T_data > *eventBus) |
| Connects to an EventBus instance if not already connected. | |
Protected Attributes inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| IterableQueue< EventBus< T_topic, T_msg, T_data > * > | mEventBusQueue |
| Queue of EventBus instances this entity is connected to. | |
Complete WiFi network management and configuration scheduler.
This class orchestrates all aspects of WiFi connectivity including station connection, access point configuration mode, web-based setup interface, and ongoing network monitoring. It implements the ISchedulerConnectionKit interface and emits network events through the CoreEventEmitter system.
The scheduler operates in multiple modes:
All operations are task-based and non-blocking, making it suitable for real-time embedded applications.
|
inline |
Construct a new NetworkScheduler.
| credentials | Reference to device credentials manager |
Initializes the network scheduler with default configuration including:
|
inlineoverridevirtual |
Attach the network scheduler and start initial connection.
Restores stored WiFi credentials and initiates either STA connection (if valid credentials exist) or AP configuration mode (if no valid credentials are stored).
Implements uniot::ISchedulerConnectionKit.
|
inline |
Start or recover configuration mode.
Initiates AP configuration mode or recovers an existing AP if already running. This method is called when manual configuration is requested or when automatic connection fails.
|
inline |
Forget stored WiFi credentials and enter configuration mode.
Clears stored network credentials and switches to AP configuration mode. Emits disconnecting event to notify other system components.
|
inlineoverridevirtual |
Push all network tasks to the scheduler.
| scheduler | TaskScheduler instance to receive the tasks |
Registers all network management tasks including:
Implements uniot::ISchedulerConnectionKit.
|
inline |
Attempt to reconnect using stored credentials.
| bool | true if reconnection attempt was started, false if no valid credentials |
Initiates reconnection to the stored WiFi network if valid credentials exist. Recovers AP mode if it was previously active.
|
inline |
Set and store new WiFi credentials.
| ssid | Network SSID |
| password | Network password |
| bool | true if credentials were set successfully, false if SSID is empty |
Validates and stores new WiFi credentials for future connection attempts. The credentials are immediately persisted to storage.