Digital twin facet operations
The Things Agent supports invoking of operations on the Functional Items by sending of properly formatted messages via the Bosch IoT Things service. Command-and-control functionalities are handled via Ditto messages. After the message is received, the Edge Services runtime sends a response in the form of a JSON binding representation.
Messages to or from a thing and a featureMessages can be sent via the Bosch IoT Things HTTP API by:
POST /things/{thing-id}/features/{feature-id}/inbox/messages/{operation-id}
Content-Type: application/json
<operation-arguments>
The <operation-arguments> are operation arguments encoded as a JSON object containing pairs of argument names to argument values.
Example:
{arg1_name: arg1_value, arg2_name: arg2_value, ...., argN_name: argN_value}, where each arg<N>_value can be a number, string, array or object - depending on the corresponding Java type of the Functional Item operation argument.
If the Functional Item argument is a bean, it is represented as a JSON object. The result of the Functional Item operation is returned as a response of the Thing REST call - formatted as JSON number, string, array or object - depending of the Java type of the operation result.
Setting a property
Any changes of thing properties (e.g. Feature properties) that are initiated through the Bosch IoT Things API itself will not be reflected on the edge device.
All property modifications should be executed via commands as shown below.
Setting a property on a digital twin is done through a command, following the pattern:
POST /things/{thing-id}/features/{feature-id}/inbox/messages/$set.configuration/<property-name>
Example:
POST /things/{thing-id}/features/{feature-id}/inbox/messages/$set.configuration/$set.configuration/name
with payload
{"new_value":<new value>}
Messages from device
The OSGi Things Agent provides functionality to send Ditto-outbox messages mapped to Vorto events. If some feature property is need to be monitored and send Ditto-outbox messages when its value is changed, so this property should be in events section. Go to Categorization Functional Item properties guide to learn more about how to categorize functional item properties according their access.
When the property is annotated with @Section(Section.Name.EVENTS) and its change the value, then the OSGi Things Agent will send Ditto-outbox message for this property.
More information about the Ditto-outbox messages mapped to Vorto events visit Digital twin facet events.