Uniot Core
0.8.1
Loading...
Searching...
No Matches
uniot::NetworkScheduler Class Reference

Complete WiFi network management and configuration scheduler. More...

#include <NetworkScheduler.h>

Inheritance diagram for uniot::NetworkScheduler:
[legend]

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.
 

Detailed Description

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:

  • STA mode: Connects to configured WiFi networks
  • AP mode: Creates configuration access point
  • Hybrid mode: Maintains AP while attempting STA connection

All operations are task-based and non-blocking, making it suitable for real-time embedded applications.

Constructor & Destructor Documentation

◆ NetworkScheduler()

uniot::NetworkScheduler::NetworkScheduler ( Credentials & credentials)
inline

Construct a new NetworkScheduler.

Parameters
credentialsReference to device credentials manager

Initializes the network scheduler with default configuration including:

  • AP name generation based on device ID
  • WiFi persistence and auto-connect disabled
  • Task initialization for all network operations
  • WebSocket configuration server setup

Member Function Documentation

◆ attach()

virtual void uniot::NetworkScheduler::attach ( )
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.

◆ config()

void uniot::NetworkScheduler::config ( )
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.

◆ forget()

void uniot::NetworkScheduler::forget ( )
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.

◆ pushTo()

virtual void uniot::NetworkScheduler::pushTo ( TaskScheduler & scheduler)
inlineoverridevirtual

Push all network tasks to the scheduler.

Parameters
schedulerTaskScheduler instance to receive the tasks

Registers all network management tasks including:

  • Server start/serve/stop tasks
  • AP configuration and stop tasks
  • STA connection and monitoring tasks
  • WiFi scanning and availability check tasks

Implements uniot::ISchedulerConnectionKit.

◆ reconnect()

bool uniot::NetworkScheduler::reconnect ( )
inline

Attempt to reconnect using stored credentials.

Return values
booltrue 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.

◆ setCredentials()

bool uniot::NetworkScheduler::setCredentials ( const String & ssid,
const String & password )
inline

Set and store new WiFi credentials.

Parameters
ssidNetwork SSID
passwordNetwork password
Return values
booltrue 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.


The documentation for this class was generated from the following file: