Carriots Provisioning Protocol: Auto-Provisioning
Auto-provisioning means a device can provision itself into the Carriots Platform. The auto provisioning mechanism consists in two factors:
- Status/data stream: This consists in sending a data or status stream from your device to Carriots. This stream must contain all data necessary to provision the device in Carriots. This requires programming your device firmware, but once you get the code done, you can reuse it in every device. See the doc "Carriots Provisioning Protocol: Previous Considerations" section "Provisioning Best Practices".
- A listener: Is a script, a piece of code that runs when a certain condition is met. This script must contain the code to extract the information from the stream and create the device using the Carriots entities. The listener is associated to an entity type: Project, Service, Group Asset or Device. The higher in the hierarchy, the more streams will be listened to. In this case the event to trigger the listener must be Event Data Received or Event Status Received depending on your approach (using data or status streams for auto-provisioning).
- Provisioning Schema
To create a new listener, follow these steps:
- Access the Carriots Control Panel by logging with your credentials at www.carriots.com.
- Click on "Listeners" under the label "RULES" on the left menu in the screen.
- Click on "New Listener" below the listeners table to open the form in order to create a new listener.
- Fill the form and click on "Create Listener". Your new listener will be created and provisioned with the data you supplied.
A typical provisioning listener would contain:
- Event: "Event Status Data Received" (to listen to every status stream received, as we decided to send provisioning info in a status stream)
- If expression: "context.data.containsKey('operation')&&context.data.containsKey('resgisterEquipment')" (As our devices send provisioning streams cointaining those two keys)
- Then expression: The Groovy or Java code to be run could be like this: