Direct Device Integration (DDI) API
This Direct Device Integration (DDI) API is based on HTTP standards and based on a polling mechanism.
The Rollouts update server provides REST resources which are consumed by the device to retrieve software update tasks. That includes the artifact download with support for RFC7233 range requests.
Note: In DDI the target is identified using a controllerId. Controller is used as a term for the actual service/client on the device. This enables users to have even multiple clients on the same target for different tasks, e.g. Firmware update and App management.
Please be aware of the existence of a Quota. We also recommend to check out the target and action state machines.
Access the DDI API reference documentation at https://docs.bosch-iot-rollouts.com/rest-api/ddi-doc.html.
Table of contents:
Eclipse hawkBit™ compatibility
Bosch IoT Rollouts DDI API is fully compatible to Eclipse hawkBit’s DDI API in version 1 (v1).
As a result hawkBit compatible clients can be used with Rollouts, e.g. SWupdate which is a Linux Update agent with focus on an efficient and safe way to update embedded systems.
The hawkBit project provides Java representations that allow to decode the message body at runtime into a Java object (that is if you have the luxury of Java on your device). The Java models can also be used to encode Java objects into JSON bodies to send a requests to Rollouts. The project as well provides examples leveraging the Feign client.
The model is available on Maven central, e.g. in Maven
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-ddi-api</artifactId>
<version>
0.2
.
0
</version>
</dependency>
State machine mapping
For historical reasons the DDI has a different state machine and status messages than the Target State Machine of the Rollouts update server.
This is kept to ensure that DDI stays compatible for devices out there in the field. A future version “2” of DDI might change that. DDI also defines more states than the update server, e.g. different DDI states are currently mapped by the implementation to RUNNING state. It is possible that in the future Rollouts will fully leverage these additional states.
The DDI API allows the device to provide the following feedback messages:
DDI status.execution type |
handling by update server |
Mapped ActionStatus type |
CANCELED |
This is sent by the target as confirmation of a cancellation request by the update server. |
CANCELED |
REJECTED |
This is sent by the target in case an update of a cancellation is rejected, i.e. cannot be fulfilled at this point in time. Note: the target should send a CLOSED->ERROR if it believes it will not be able to proceed the action at all. |
WARNING |
CLOSED |
Target completes the action either with status.result.finished SUCCESS or FAILURE as result. Note: DDI also defines a status NONE which will not be interpreted by the update server and handled like SUCCESS. |
ERROR (DDI FAILURE) or FINISHED (DDI SUCCESS or NONE) |
DOWNLOAD |
This can be used by the target to inform that it is downloading artifacts of the action. |
DOWNLOAD |
DOWNLOADED |
This can be used by the target to inform that it has downloaded artifacts of the action. |
DOWNLOADED |
PROCEEDING |
This can be used by the target to inform that it is working on the action. |
RUNNING |
SCHEDULED |
This can be used by the target to inform that it scheduled on the action. |
RUNNING |
RESUMED |
This can be used by the target to inform that it continued to work on the action. |
RUNNING |
User consent flow enabled
When the user consent flow feature is enabled (which is recommended) some modifications on the DDI interface occur. The main one is that it will not directly expose the update via the deploymentBase resource link (the one polled by the devices to check whether there is an update). Instead, it will provide the update information via a confirmationBase link so that devices can recognize that there is an update present, but it first requires an explicit confirmation from the user before it can be installed.
When the user consent flow feature has been enabled prior to the start of an update action, an additional WAIT_FOR_CONFIRMATION action status is introduced (see Action state machine).
While the update action is in this status, the device can use the following two execution statuses as a response:
DDI status.execution type |
handling by update server |
Mapped ActionStatus type |
CONFIRMED |
This is used by the target to inform that the user has confirmed the update. |
RUNNING |
DENIED |
This is used by the target to inform that the user has denied the confirmation request. |
WAIT_FOR_CONFIRMATION |
The execution status types from the main table above are not applicable while the update action is in WAIT_FOR_CONFIRMATION state.
The DDI API also provides a resource to activate auto confirmation. As a result all current active as well as future actions will automatically be confirmed by mentioning the initiator as triggered person. Actions will be automatically confirmed, as long as auto confirmation is active.
Once the confirmation is given by the user via the respective POST method, the action state will change to RUNNING and the update will be exposed via the deploymentBase link.
If the user confirmation has been Denied, the action state will stay infinitely in WAIT_FOR_CONFIRMATION state, until it's confirmed.
Before enabling the user consent flow feature you need to be sure that your devices support the different flow and know how to react to such kind of payload.