Skip to content

ImprovProvisioningModule

Source: ImprovProvisioningModule.h

ImprovProvisioningModule

class ImprovProvisioningModule
src/core/system/ImprovProvisioningModule.h:45

Inherits: MoonModule

Browser-driven WiFi provisioning over serial, using the open Improv protocol.

It solves the bootstrap problem: a freshly flashed board is not yet on your network. Improv carries that first handoff over the cable the browser already used to flash it. This module is the status surface, the protocol living in the platform layer.

ImprovProvisioningModule card

Public Methods

inline void setSystemModule(SystemModule * s) : Adopt the system module, whose name and version the device info reports.

inline void setNetworkModule(NetworkModule * n) : Adopt the network module, which receives the credentials this one collects.

inline void setHttpServerModule(HttpServerModule * h) : Adopt the web server, whose apply-core a pushed operation is routed to.

virtual inline bool respectsEnabled() const override : Keep listening whatever the toggle says, as the other fixed services do.

virtual inline bool userEditable() const override : Apparatus rather than content, so it cannot be deleted, only disabled.

virtual inline void setup() override : Install the serial listener, handing it the buffers the protocol task writes.

virtual inline void defineControls() override : Declare the one status readout.

virtual inline void tick1s() override : Poll what the protocol task published: the power cap first, then any credentials.

virtual inline void tick() override : Apply any pending operation, polled every tick so a burst of them installs briskly.

More info

Transports

The listener serves an external USB-to-UART bridge and a native USB port alike. Without either, the access-point flow remains, the device serving its own network.

The commands

Four standard commands report state, scan for networks, and set credentials. Two vendor commands extend them. One caps transmit power before any association, for a board whose supply browns out. The other carries one config operation as JSON, routed to the same apply-core. So a call over the network and one over serial execute identically. That is what lets the installer configure a device a browser cannot reach directly.

Applying an operation

Operations are idempotent, and a long value chunks across frames into a buffer. It is applied on the main loop rather than the serial task, one at a time. A failure cannot travel back on the spent acknowledgement, so it surfaces here.