System Calls Used By Your factory Firmware
The following API methods are reserved for the two key Connected Factory operations: BlinkUp™ and blessing. All of these methods are intended only to be included in your factory firmware — if included in application firmware, they will throw exceptions that cause devices to restart.
The first two methods — server.bless() and server.factoryblinkup() — are mandatory; your factory firmware will not do its job correctly without them.
The third, imp.clearconfiguration(), is not required, but is strongly recommended. It will prevent Production Devices from attempting to connect using their stored factory network and enrollment credentials when end-users power them up for the first time. Clearing the stored credentials with imp.clearconfiguration() ensures that each device’s BlinkUp status LED signals what should be the correct state for a new end-user device: that the unit is unconfigured.
Also useful to writing efficient factory firmware is the data stored in the imp.configparams property. The remaining API methods are optional.
server.bless(testResult, callback)
Initiates the blessing of the Device Under Test (DUT) on which it is called.
server.factoryblinkup(ssid, password, ledPin, flags)
Initiates BlinkUp by the factory BlinkUp fixture on which it is called.
imp.setcountry(countryCode)
Sets the device’s WiFi region.
imp.setenroltokens(planID, token)
Sets the device’s enrollment data — its plan ID and enrollment token — without BlinkUp.
imp.setnvramimage()
Sets the device’s WiFi NVRAM image (imp003, imp004m and imp005 only).
imp.setwificonfiguration(ssid, password)
Sets the device’s WiFi access credentials without BlinkUp.
Electric Imp provides a free-to-use code library, FactoryTools, to help you construct your factory firmware by providing simple functions for determining the type of device on which your factory firmware is running.
Note Please see “When is imp.configparams Populated?” in the imp.configparams documentation before you make use of the FactoryTools library in your factory firmware.