@@ -38,10 +38,10 @@ The process for creating your own IoT Agent is relatively simple. It is best ach
3838which uses the required data transport and rewriting/amending the payload processing code to handle the payloads in
3939question.
4040
41- For the purpose of this tutorial we will amend code from the existing JSON IoT Agent to process a similar custom
42- XML format. A direct comparison of the two IoT Agents can be seen below:
41+ For the purpose of this tutorial we will amend code from the existing JSON IoT Agent to process a similar custom XML
42+ format. A direct comparison of the two IoT Agents can be seen below:
4343
44- | IoT Agent for JSON | IoT Agent for XML | Protocol's Area of Concern |
44+ | IoT Agent for JSON | IoT Agent for XML | Protocol's Area of Concern |
4545| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------- |
4646| Sample Measure ` c\1 ` | Sample Measure <br />` <measure device="lamp002" key="xxx"> ` <br />  ;  ; ` <c value="1"/> ` <br />` </measure> ` | Message Payload |
4747| Sample Command ` Robot1@turn\left=30 ` | Sample Command <br />` <turn device="Robot1"> ` <br />  ;  ; ` <left>30</left> ` <br />` </turn> ` | Message Payload |
@@ -67,9 +67,9 @@ lower-level CoAP transport used by the devices.
6767## The teaching goal of this tutorial
6868
6969The aim of this tutorial is to improve developer understanding of how to create their own custom IoT Agents, a series of
70- simple modifications has been made to the code of the JSON IoT Agent demonstrating how to make changes. The
71- tutorial consists of a walkthrough of the relevant code and a series of HTTP requests to connect the new IoT Agent. The
72- code can be found within the current
70+ simple modifications has been made to the code of the JSON IoT Agent demonstrating how to make changes. The tutorial
71+ consists of a walkthrough of the relevant code and a series of HTTP requests to connect the new IoT Agent. The code can
72+ be found within the current
7373[ GitHub Repository] ( https://github.com/FIWARE/tutorials.Custom-IoT-Agent/tree/master/iot-agent )
7474
7575## Reusing Common Functionality
@@ -468,11 +468,11 @@ curl -iX POST \
468468```
469469
470470As expected the HTTP command to ** provision a device** does not change based on the underlying payload or transport
471- protocol since we are using the same HTTP transport as the original JSON IoT Agent. ` internal_atttributes ` can be
472- used to supply additional information for the custom IoT Agent if necessary. In the request we are associating the
473- device ` motion001 ` with the URN ` urn:ngsi-ld:Motion:001 ` and mapping the device reading ` c ` with the context attribute
474- ` count ` (which is defined as an ` Integer ` ) A ` refStore ` is defined as a ` static_attribute ` , placing the device within
475- ** Store ** ` urn:ngsi-ld:Store:001 `
471+ protocol since we are using the same HTTP transport as the original JSON IoT Agent. ` internal_atttributes ` can be used
472+ to supply additional information for the custom IoT Agent if necessary. In the request we are associating the device
473+ ` motion001 ` with the URN ` urn:ngsi-ld:Motion:001 ` and mapping the device reading ` c ` with the context attribute ` count `
474+ (which is defined as an ` Integer ` ) A ` refStore ` is defined as a ` static_attribute ` , placing the device within ** Store **
475+ ` urn:ngsi-ld:Store:001 `
476476
477477You can simulate a dummy IoT device measurement coming from the ** Motion Sensor** device ` motion001 ` , by making the
478478following XML request
@@ -489,9 +489,9 @@ curl -L -X POST 'http://localhost:7896/iot/xml' \
489489
490490<h3 >Reading Measures - Analysing the Code</h3 >
491491
492- Both the payload and the ` Content-Type ` have been updated. The dummy devices made a similar JSON request in the
493- previous tutorials when the door was unlocked, you will have seen the state of each motion sensor changing and a
494- Northbound request will be logged in the device monitor.
492+ Both the payload and the ` Content-Type ` have been updated. The dummy devices made a similar JSON request in the previous
493+ tutorials when the door was unlocked, you will have seen the state of each motion sensor changing and a Northbound
494+ request will be logged in the device monitor.
495495
496496Now the IoT Agent is connected, the service group has defined the resource upon which the IoT Agent is listening
497497(` iot/xml ` ) and the API key used to authenticate the request (` 4jggokgpepnvsb2uv4s40d59ov ` ) is found in the body. Since
@@ -617,9 +617,9 @@ Agent the provisioning of commands fulfills the following implied contract:
617617
6186181 . The custom IoT Agent is making a registration for an attribute
6196192 . The custom IoT Agent each request for updating context (on the ` /v2/op/update ` endpoint)
620- 3 . A decision is made how to handle the request - for both the Custom IoT Agent and the JSON Agent this follows
621- the paradigm of setting a ` <command>State ` attribute, amending and forwarding the request on a ` /cmd ` endpoint to
622- the device (or alternatively to a middleware responsible for the device).
620+ 3 . A decision is made how to handle the request - for both the Custom IoT Agent and the JSON Agent this follows the
621+ paradigm of setting a ` <command>State ` attribute, amending and forwarding the request on a ` /cmd ` endpoint to the
622+ device (or alternatively to a middleware responsible for the device).
623623
624624The first two items - listening to context changes from the context broker follow the well-defined NGSI syntax and
625625therefore are common to all IoT Agents. However, the third item - what to do to prepare the message for ongoing
0 commit comments