1515This tutorial a wires up the dummy IoT devices which are responding using a custom [ XML] ( https://www.w3.org/TR/xml11/ )
1616message format. A ** custom IoT Agent** is created based on the IoT Agent Node.js
1717[ library] ( https://iotagent-node-lib.readthedocs.io/en/latest/ ) and the framework found in the
18- [ IoT Agent for Ultralight ] ( https://fiware-iotagent-ul .readthedocs.io/en/latest/usermanual/index.html#user-programmers-manual )
18+ [ IoT Agent for JSON ] ( https://fiware-iotagent-json .readthedocs.io/en/latest/usermanual/index.html#user-programmers-manual )
1919devices so that measurements can be read and commands can be sent using
2020[ NGSI-v2] ( https://fiware.github.io/specifications/OpenAPI/ngsiv2 ) requests sent to the
2121[ Orion Context Broker] ( https://fiware-orion.readthedocs.io/en/latest/ ) .
@@ -69,10 +69,10 @@ The process for creating your own IoT Agent is relatively simple. It is best ach
6969which uses the required data transport and rewriting/amending the payload processing code to handle the payloads in
7070question.
7171
72- For the purpose of this tutorial we will amend code from the existing Ultralight IoT Agent to process a similar custom
72+ For the purpose of this tutorial we will amend code from the existing JSON IoT Agent to process a similar custom
7373XML format. A direct comparison of the two IoT Agents can be seen below:
7474
75- | IoT Agent for Ultralight | New IoT Agent for XML | Protocol's Area of Concern |
75+ | IoT Agent for JSON | New IoT Agent for XML | Protocol's Area of Concern |
7676| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -------------------------- |
7777| Sample Measure ` c\|1 ` | Sample Measure ` <measure device="lamp002" key="xxx"> ` <br />  ; ` <c value="1"/> ` <br />` </measure> ` | Message Payload |
7878| Sample Command ` Robot1@turn\|left=30 ` | Sample Command ` <turn device="Robot1"> ` <br />  ; ` <left>30</left> ` <br />` </turn> ` | Message Payload |
@@ -98,7 +98,7 @@ lower-level CoAP transport used by the devices.
9898## The teaching goal of this tutorial
9999
100100The aim of this tutorial is to improve developer understanding of how to create their own custom IoT Agents, a series of
101- simple modifications has been made to the code of the Ultralight IoT Agent demonstrating how to make changes. The
101+ simple modifications has been made to the code of the JSON IoT Agent demonstrating how to make changes. The
102102tutorial consists of a walkthrough of the relevant code and a series of HTTP requests to connect the new IoT Agent. The
103103code can be found within the current
104104[ GitHub Repository] ( https://github.com/FIWARE/tutorials.Custom-IoT-Agent/tree/master/iot-agent )
@@ -208,7 +208,7 @@ The other `tutorial` container configuration values described in the YAML file a
208208
209209The code for the custom XML IoT Agent can be found within the
210210[GitHub Repository](https://github.com/FIWARE/tutorials.Custom-IoT-Agent/tree/master/iot-agent) associated to this
211- tutorial. It is a copy of the 1.12.0 version of the IoT Agent for Ultralight , lightly modified as described below. The
211+ tutorial. It is a copy of the 1.12.0 version of the IoT Agent for JSON , lightly modified as described below. The
212212associated [Dockerfile](https://github.com/FIWARE/tutorials.Custom-IoT-Agent/blob/master/iot-agent/Dockerfile) merely
213213copies the code into an appropriate location within a Docker container running Node.js. This allows the component to be
214214instantiated using a `docker-compose.yaml` file. The necessary configuration can be seen below :
@@ -418,7 +418,7 @@ Where the `<measure>` holds the relevant device ID and API key.
418418</measure >
419419```
420420
421- This syntax differs from the Ultralight IoT Agent where the device ID and API key are sent as URL parameters.
421+ This syntax differs from the JSON IoT Agent where the device ID and API key are sent as URL parameters.
422422
423423The relevant changes can be found in the `HTTPBindings.js` file where an XML parser is instantiated.
424424
@@ -521,7 +521,7 @@ curl -iX POST \
521521```
522522
523523As expected the HTTP command to ** provision a device** does not change based on the underlying payload or transport
524- protocol since we are using the same HTTP transport as the original Ultralight IoT Agent. ` internal_atttributes ` can be
524+ protocol since we are using the same HTTP transport as the original JSON IoT Agent. ` internal_atttributes ` can be
525525used to supply additional information for the custom IoT Agent if necessary. In the request we are associating the
526526device ` motion001 ` with the URN ` urn:ngsi-ld:Motion:001 ` and mapping the device reading ` c ` with the context attribute
527527` count ` (which is defined as an ` Integer ` ) A ` refStore ` is defined as a ` static_attribute ` , placing the device within
@@ -540,7 +540,7 @@ curl -L -X POST 'http://localhost:7896/iot/xml' \
540540</measure>'
541541```
542542
543- Both the payload and the ` Content-Type ` have been updated. The dummy devices made a similar Ultralight request in the
543+ Both the payload and the ` Content-Type ` have been updated. The dummy devices made a similar JSON request in the
544544previous tutorials when the door was unlocked, you will have seen the state of each motion sensor changing and a
545545Northbound request will be logged in the device monitor.
546546
@@ -661,7 +661,7 @@ Agent the provisioning of commands fulfills the following implied contract:
661661
6626621 . The custom IoT Agent is making a registration for an attribute
6636632 . The custom IoT Agent each request for updating context (on the ` /v2/op/update ` endpoint)
664- 3 . A decision is made how to handle the request - for both the Custom IoT Agent and the Ultralight Agent this follows
664+ 3 . A decision is made how to handle the request - for both the Custom IoT Agent and the JSON Agent this follows
665665 the paradigm of setting a ` <command>State ` attribute, amending and forwarding the request on a ` /cmd ` endpoint to
666666 the device (or alternatively to a middleware responsible for the device).
667667
@@ -751,7 +751,7 @@ function createCommandPayload(device, command, attributes) {
751751}
752752` ` `
753753
754- This is an amendment from the Ultralight protocol where the ` @` and ` | ` symbol is generated for Ultralight devices.
754+ This is an amendment from the JSON protocol where the ` @` and ` | ` symbol is generated for JSON devices.
755755
756756However, creating a payload is only half the job, it must be sent to the device and understood, so communications must
757757be completed using a well-defined communications handshake. So after generating the payload the ` sendXMLCommandHTTP ()`
0 commit comments