|
| namespace | uniot |
| | Contains all classes and functions related to the Uniot Core.
|
| |
This file provides a comprehensive network management controller that combines network connectivity with user interface elements. The NetworkController acts as a bridge between the NetworkScheduler and physical hardware components like buttons and LEDs, providing intuitive device control and status indication.
Key features:
- Button-based network configuration control
- LED status indication for connection states
- Automatic network recovery and reconnection
- Persistent storage of device state
- Reboot detection and handling for configuration reset
- Event-driven architecture with automatic state management
The controller implements intelligent behavior patterns:
- Single click: Manual reconnection attempt
- Long press: Configuration reset (if multiple clicks precede)
- Multiple reboots: Automatic configuration reset
- LED patterns: Visual feedback for different network states
Example usage:
Credentials credentials;
NetworkScheduler networkScheduler(credentials);
NetworkController controller(networkScheduler,
BUTTON_PIN, LOW,
LED_PIN, HIGH);
TaskScheduler scheduler;
controller.pushTo(scheduler);
networkScheduler.pushTo(scheduler);
controller.attach();
networkScheduler.attach();