Cirrent provides an API to easily integrate the WCM with your device code. On Linux, we provide a C library that you can link into your application that interfaces to the WCM process. For embedded platforms, we provide the source code to the WCM so that you can build it directly into your application.
There is no requirement for you to use this API. The WCM has been designed to execute independently. This API is provided in case you wish to have some visibility or control over the Wi-Fi connection process (e.g. get called whenever the WCM connects to a ZipKey or private network).
Example API integrations
Showing the connection status on the device lights
If you want to show the user the connection status, you can register a connection-status handler that will be called when the connection status changes (Disconnected, Connected to ZipKey network, Connected to Private network). When your callback is called, you can update the light settings on the device.
There are two levels of factory reset supported by the WCM. If you call wcmc_revert, it reverts the WCM to its last known good configuration, preserving the private network (if any), and preserving the cloud history. If you call wcmc_reset_device, it deletes any private networks, and deletes any Cirrent cloud history about this device, as if the device had just been purchased.
Reporting if a user took an action on the device
For some products, as an added security check, the mobile app may want the user to confirm they have physical control over the device before they can move it to their private network. The user starts trying to onboard their device, and the app displays a message to the user requiring them to take an action (e.g. press a button on the device). The app then waits for confirmation that the button was pressed on the correct device before allowing the user to proceed with on boarding the device. To implement this, you call the wcmc_set_user_action method when the user takes the action (e.g. presses a button). The WCM will report this to the Cirrent cloud. The mobile app can poll the Cirrent cloud to get status updates for that device. When it sees that the action was taken, the app proceeds.