Network Flow
Overview
This document outlines the operational firmware logic for network connectivity and management. It details the state machine implemented to handle initial network establishment, maintain connectivity, and manage recovery from transient and persistent network failures. The primary goal is to ensure reliable communication with the backend server infrastructure.
The network connectivity process is divided into two primary phases:
- Startup Phase: Establishes the initial communication link upon device power-on or reset.
- Operational & Retry Phase: Monitors the established connection and executes a defined retry mechanism upon link failure.
State Descriptions
Startup Phase
The Startup Phase is initiated upon device boot or a system reset. Its objective is to establish a stable network connection.
| State | Operation | Success Criteria | Failure Transition |
|---|---|---|---|
| Cellular Connect | The device firmware initializes the cellular modem and attempts to establish a connection with the registered cellular network. | A data session is successfully established, and the device can ping the designated endpoint. | If a connection is not established within the predefined timeout, the state transitions to Wi-Fi Connect. |
| Wi-Fi Connect | The firmware attempts to connect to a pre-configured Wi-Fi network. | The device successfully associates with the Wi-Fi network, obtains an IP address, and can communicate with the network gateway. | If the connection fails, the device will enter Soft AP Mode. |
| Soft AP Mode | The device broadcasts its own Wi-Fi network (SSID) to allow for user intervention and configuration. | A user successfully connects to the device’s Soft AP network within a 5-minute window to provision network credentials. | If no user connection is detected within 5 minutes, the device will perform a system Reboot to re-initiate the Startup Phase. |
| Reboot | The device performs a software-initiated reboot. | N/A | This state always transitions to the initial Power On/Reset state. |
Operational & Retry Phase
Once a connection is established, the device enters the Operational Phase. The Retry Phase is a sub-state of this, triggered by a loss of connectivity.
| State | Operation | Success Criteria | Failure Transition |
|---|---|---|---|
| Connected | The device is successfully connected to either the Cellular or Wi-Fi network and is operating normally. The firmware periodically checks the connection status. | Continuous successful communication with the backend server. | If the connection check fails, the device enters the Retry Connection state. |
| Retry Connection | The firmware attempts to re-establish the connection using the last known successful method (Cellular or Wi-Fi). | The connection is successfully re-established. The device returns to the Connected state. | If the initial retries fail, the device will enter the Connection Loss Protocol. |
| Connection Loss Protocol | To conserve power and avoid network flooding, the device implements an exponential backoff algorithm for connection retries. It will attempt to reconnect at increasing intervals. | The connection is re-established. | If the connection cannot be re-established after a prolonged period, the device may enter a low-power “awaiting manual reset” state or trigger a system reboot based on configuration. |
Last updated on