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 returns to the Idle / Disconnected state. |
| Idle / Disconnected | The device is in a disconnected state, not actively attempting to connect. | N/A | After a period of time, the device will automatically begin a new connection cycle, restarting from Cellular Connect. |
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). This is attempted up to 3 times. | The connection is successfully re-established. The device returns to the Connected state. | If all 3 retry attempts fail, the device will enter Soft AP Mode to allow manual reconfiguration. |
| 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 the timeout window. | If no user action is taken within the timeout window, the device returns to the Idle / Disconnected state to await the next attempt. |
| Idle / Disconnected | The device is in a disconnected state, not actively attempting to connect. | N/A | After a period of time, the device will automatically begin a new connection cycle, restarting from Cellular Connect. |
Last updated on