You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

6237 lines
398 KiB

<?xml version='1.0' encoding='UTF-8'?>
<!-- TODO: enhanced concentrator GUI XEP. (Icons, overlays, etc.) -->
<!-- TODO: Interaction with provisioning server -->
<!-- TODO: Execute command failure: Error message. -->
<!-- TODO: Execute command on nodes failures: Error messages. -->
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Internet of Things - Concentrators</title>
<abstract>
Note: This specification has been retracted by the author; new
implementations are not recommended.
This specification describes how to manage and get information from
concentrators of devices over XMPP networks.
</abstract>
&LEGALNOTICE;
<number>0326</number>
<status>Retracted</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0001</spec>
<spec>XEP-0004</spec>
<spec>XEP-0030</spec>
<spec>XEP-0122</spec>
<spec>XEP-0137</spec>
<spec>XEP-0141</spec>
<spec>XEP-0323</spec>
<spec>XEP-0324</spec>
<spec>XEP-0331</spec>
<spec>XEP-0336</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>sensor-network-concentrators</shortname>
&peterwaher;
<revision>
<version>0.4</version>
<date>2017-05-20</date>
<initials>XEP Editor: ssw</initials>
<remark>Mark XEP as retracted by the author.</remark>
</revision>
<revision>
<version>0.3</version>
<date>2015-11-09</date>
<initials>pw</initials>
<remark>
<p>Updated contact information.</p>
<p>Updated example JIDs to example.org</p>
</remark>
</revision>
<revision>
<version>0.2</version>
<date>2014-03-10</date>
<initials>pw</initials>
<remark>
<p>Namespace in dynamic form examples has been changed to urn:xmpp:xdata:dynamic.</p>
<p>Added the following node query events: <strong>title</strong>, <strong>status</strong>, <strong>beginSection</strong> and <strong>endSection</strong>.</p>
<p>Updated the schema to more strictly validate references to x-data forms.</p>
<p>Updated attribute names so queries and responses are consistent.</p>
<p>Updated the language.</p>
<p>Added section about how to determine support.</p>
<p>Corrected language and examples.</p>
<p>Node Query command type added.</p>
<p>Fixed links to documents with new numbers.</p>
<p>Changed namespace urn:xmpp:sn to urn:xmpp:iot</p>
</remark>
</revision>
<revision>
<version>0.1</version>
<date>2013-05-06</date>
<initials>psa</initials>
<remark>
<p>Initial published version approved by the XMPP Council.</p>
</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2013-03-20</date>
<initials>pw</initials>
<remark>
<p>First draft.</p>
</remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>
Concentrators are devices in sensor networks, concentrating the management of a sub set of devices to one point. They can be small (for example: PLC:s managing a small
set of sensors and actuators), medium-sized (for example: mid-level concentrators, controlling branches of the network, islands, perhaps using separate communication protocols),
large (for example: entire sub-systems, perhaps managed by a separate child/partner organization) to massive (for example: The entire top-level system, smart-grid, IoT network).
</p>
<p>
Even though this XEP is generally written and can be used by other implementations not based on sensor networks, much of the requirements used to define this specification
comes from requirements used in sensor networks and Internet of Things applications and infrastructure.
</p>
<p>
This specification will define the following aspects of a general concentrator profile, that can handle all different types of concentrators available in sensor network architectures:
</p>
<ul>
<li>
A concentrator works with multiple <strong>data sources</strong>. Effective management of data sources and their contents is a vital part of this XEP.
</li>
<li>The ability to work with massive quantities of entities.</li>
<li>Effective synchronization of contents between interested parties.</li>
<li>Effective ways to interact with entities controlled by the concentrator.</li>
</ul>
<p>
Sensor networks contains many different architectures and use cases. For this reason, the sensor network standards have been divided into multiple XEPs according to the following table:
</p>
<table caption='Sensor Network XEPs'>
<tr>
<th>XEP</th>
<th>Description</th>
</tr>
<tr>
<td>xep-0000-IoT-BatteryPoweredSensors</td>
<td>Defines how to handle the peculiars related to battery powered devices, and other devices intermittently available on the network.</td>
</tr>
<tr>
<td>xep-0000-IoT-Discovery</td>
<td>Defines the peculiars of sensor discovery in sensor networks. Apart from discovering sensors by JID, it also defines how to discover sensors based on location, etc.</td>
</tr>
<tr>
<td>xep-0000-IoT-Events</td>
<td>Defines how sensors send events, how event subscription, hysteresis levels, etc., are configured.</td>
</tr>
<tr>
<td>xep-0000-IoT-Interoperability</td>
<td>Defines guidelines for how to achieve interoperability in sensor networks, publishing interoperability interfaces for different types of devices.</td>
</tr>
<tr>
<td>xep-0000-IoT-Multicast</td>
<td>Defines how sensor data can be multicast in efficient ways.</td>
</tr>
<tr>
<td>xep-0000-IoT-PubSub</td>
<td>Defines how efficient publication of sensor data can be made in sensor networks.</td>
</tr>
<tr>
<td>xep-0000-IoT-Chat</td>
<td>Defines how human-to-machine interfaces should be constructed using chat messages to be user friendly, automatable and consistent with other IoT extensions and possible underlying architecture.</td>
</tr>
<tr>
<td>XEP-0322</td>
<td>
Defines how to EXI can be used in XMPP to achieve efficient compression of data. Albeit not a sensor network specific XEP, this XEP should be considered
in all sensor network implementations where memory and packet size is an issue.
</td>
</tr>
<tr>
<td>XEP-0323</td>
<td>
Provides the underlying architecture, basic operations and data structures for sensor data communication over XMPP networks.
It includes a hardware abstraction model, removing any technical detail implemented in underlying technologies. This XEP is used by all other sensor network XEPs.
</td>
</tr>
<tr>
<td>XEP-0324</td>
<td>Defines how provisioning, the management of access privileges, etc., can be efficiently and easily implemented.</td>
</tr>
<tr>
<td>XEP-0325</td>
<td>Defines how to control actuators and other devices in Internet of Things.</td>
</tr>
<tr>
<td>XEP-0326</td>
<td>This specification. Defines how to handle architectures containing concentrators or servers handling multiple sensors.</td>
</tr>
<tr>
<td>XEP-0331</td>
<td>Defines extensions for how color parameters can be handled, based on &xep0004;</td>
</tr>
<tr>
<td>XEP-0336</td>
<td>Defines extensions for how dynamic forms can be created, based on &xep0004;, &xep0122;, &xep0137; and &xep0141;.</td>
</tr>
</table>
<section2 topic='Relations to other extensions'>
<p>
Even though there are technologies available in forms of XEPs that solve parts of the above mentioned problem, they do not provide sufficient support. The following paragraphs will
take the time to list why different technologies are not applicable.
</p>
<section3 topic='XEP-0060'>
<p>
This XEP defines tree structures for nodes in different data sources. &xep0060; defines a model where a tree structure of nodes is published and users can browse this
tree structure. Furthermore, it allows the possibility to publish items on these nodes as well as syndication of this information.
</p>
<p>
This XEP also defines data sources (in a tree structure). These data sources contain nodes. &xep0248; defines a structure called a node collection, a structure that
allows the creation of collections containing loosely coupled nodes.
</p>
<p>
Even though this document defines tree structures of data, it is not however based on XEP-0060. There are multiple reasons for this:
</p>
<ul>
<li>
The structures defined in this specification do not include items to publish for each node.
</li>
<li>
We want to be able to use XEP-0060 in parallel to this specification, for the purpose of publishing sensor data.
More information about this is found in <link url='xep-0000-IoT-PubSub.html'>xep-0000-IoT-PubSub.html</link>.
</li>
<li>
For massive systems (hundreds of thousands, or millions, of nodes behind a concentrator, its vitally important to be able to manage sets of nodes directly
(for example: Edit multiple nodes at once). Many of the operations in XEP-0060 only allow for operations of singular nodes. Furthermore, many simple operations
require multiple messages per node. This document defines way to operate of sets of nodes simultaneously, as well as ways to perform operations with a smaller
number of operations.
</li>
<li>
In this document, nodes have specific functions, controlled by a specific Node Type. Different Node Types have different parameter sets, different options, commands,
capabilities, etc. XEP-0060 does not differ between node types. There, nodes are only a structural way to sort data into a tree graph.
</li>
<li>
In this document, nodes have real-time status, like errors, warnings, etc.
</li>
</ul>
</section3>
<section3 topic='XEP-0248'>
<p>
XEP-0248 defines the concept of node collections and syndication of information from nodes in these collections. But XEP-0248 is not used in this specification.
There are multiple reasons:
</p>
<ul>
<li>
We want to be able to use XEP-0248 in parallel to this specification, for the purpose of publishing sensor data.
More information about this is found in <link url='xep-0000-IoT-PubSub.html'>xep-0000-IoT-PubSub.html</link>.
</li>
<li>
Node IDs are not necessarily unique by themselves in the system. This document defines a uniqueness concept based on a triple of data: (Data Source ID, Cache Type, Node ID). This
means that Nodes must have IDs unique within a given Cache Type, within a given data source.
</li>
<li>
We need to expand on types of events generated from a data source, to make them adhere to the particulars of nodes as defined in this specification.
</li>
<li>
Data sources own their nodes. XEP-0248 define a loosely coupled structure with references to nodes. In this document, a data source is the owner of all nodes
contained in it.
</li>
</ul>
</section3>
<section3 topic='XEP-0050'>
<p>
&xep0050; defines how ad-hoc commands can be implemented and how clients can use such commands to interact with underlying logic. But XEP-0050 is not used in this specification.
There are multiple reasons:
</p>
<ul>
<li>
We want to be able to use XEP-0050 for other types of commands, than commands defined in this specification. Generally, XEP-0050 is used to implement
system-wide commands.
</li>
<li>
Commands defined in this specification are context sensitive, i.e. they depend on the type of node and the context of the node on which the act.
</li>
<li>
It is a requirement to be able to execute commands on sets of nodes directly.
</li>
<li>
Since commands have to be context sensitive, a large concentrator system may have hundreds or thousands of different commands, making it impossible to create
context sensitive GUI's using XEP-0050.
</li>
<li>
Dialog types used for Ad-Hoc-commands are not sufficient. First, dynamic dialogs are required in the general case.
(<link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0326</link> define how to create dynamic forms.) Furthermore, the
wizard style type of dialogs used for more complex dialogs in ad-hoc commands, are difficult to automate.
</li>
</ul>
</section3>
</section2>
</section1>
<section1 topic='Glossary' anchor='glossary'>
<p>The following table lists common terms and corresponding descriptions.</p>
<dl>
<di>
<dt>Actuator</dt>
<dd>Device containing at least one configurable property or output that can and should be controlled by some other entity or device.</dd>
</di>
<di>
<dt>Computed Value</dt>
<dd>A value that is computed instead of measured.</dd>
</di>
<di>
<dt>Concentrator</dt>
<dd>Device managing a set of devices which it publishes on the XMPP network.</dd>
</di>
<di>
<dt>Data Source</dt>
<dd>
A Data source contains a collection of nodes. Three types of data sources exist: Singular, Flat and Tree. Singular data sources only include one object.
Flat data sources contain a list of objects and Tree data sources contain nodes formed as a tree graph with one root element.
</dd>
</di>
<di>
<dt>Field</dt>
<dd>
One item of sensor data. Contains information about: Node, Field Name, Value, Precision, Unit, Value Type, Status, Timestamp, Localization information, etc.
Fields should be unique within the triple (Node ID, Field Name, Timestamp).
</dd>
</di>
<di>
<dt>Field Name</dt>
<dd>Name of a field of sensor data. Examples: Energy, Volume, Flow, Power, etc.</dd>
</di>
<di>
<dt>Field Type</dt>
<dd>What type of value the field represents. Examples: Momentary Value, Status Value, Identification Value, Calculated Value, Peak Value, Historical Value, etc.</dd>
</di>
<di>
<dt>Historical Value</dt>
<dd>A value stored in memory from a previous timestamp.</dd>
</di>
<di>
<dt>Identification Value</dt>
<dd>A value that can be used for identification. (Serial numbers, meter IDs, locations, names, etc.)</dd>
</di>
<di>
<dt>Localization information</dt>
<dd>Optional information for a field, allowing the sensor to control how the information should be presented to human viewers.</dd>
</di>
<di>
<dt>Meter</dt>
<dd>A device possible containing multiple sensors, used in metering applications. Examples: Electricity meter, Water Meter, Heat Meter, Cooling Meter, etc.</dd>
</di>
<di>
<dt>Momentary Value</dt>
<dd>A momentary value represents a value measured at the time of the read-out.</dd>
</di>
<di>
<dt>Node</dt>
<dd>
Graphs contain nodes and edges between nodes. In Internet of Things, sensors, actuators, meters, devices, gateways, etc., are often depicted as nodes whereas links between sensors (friendships)
are depicted as edges. In abstract terms, it's easier to talk about a Node, rather than list different possible node types (sensors, actuators, meters, devices, gateways, etc.).
Each Node has a Node ID. Nodes belong to a data source, and all nodes have a Node Type. Some nodes have a parent node, and some nodes have child nodes. Nodes with the same
parent nodes a called sibling nodes.
</dd>
</di>
<di>
<dt>Node ID</dt>
<dd>
An ID uniquely identifying a node within its corresponding context. If a globally unique ID is desired, an architecture should be used using a universally accepted
ID scheme.
</dd>
</di>
<di>
<dt>Node Type</dt>
<dd>Each node has a Node Type. The Node Type defines the functionality of the node in the system.</dd>
</di>
<di>
<dt>Parameter</dt>
<dd>
Readable and/or writable property on a node/device. The XEP-0326 &xep0326; deals with reading and writing parameters
on nodes/devices. Fields are not parameters, and parameters are not fields.
</dd>
</di>
<di>
<dt>Peak Value</dt>
<dd>A maximum or minimum value during a given period.</dd>
</di>
<di>
<dt>Precision</dt>
<dd>
In physics, precision determines the number of digits of precision. In sensor networks however, this definition is not easily applicable. Instead, precision
determines, for example, the number of decimals of precision, or power of precision. Example: 123.200 MWh contains 3 decimals of precision. All entities parsing and
delivering field information in sensor networks should always retain the number of decimals in a message.
</dd>
</di>
<di>
<dt>Sensor</dt>
<dd>
Device measuring at least one digital value (0 or 1) or analog value (value with precision and physical unit). Examples: Temperature sensor, pressure sensor, etc.
Sensor values are reported as fields during read-out. Each sensor has a unique Node ID.
</dd>
</di>
<di>
<dt>SN</dt>
<dd>Sensor Network. A network consisting, but not limited to sensors, where transport and use of sensor data is of primary concern. A sensor network may contain actuators, network applications, monitors, services, etc.</dd>
</di>
<di>
<dt>Status Value</dt>
<dd>A value displaying status information about something.</dd>
</di>
<di>
<dt>Timestamp</dt>
<dd>Timestamp of value, when the value was sampled or recorded.</dd>
</di>
<di>
<dt>Token</dt>
<dd>
A client, device or user can get a token from a provisioning server. These tokens can be included in requests to other entities in the network, so these entities can validate
access rights with the provisioning server.
</dd>
</di>
<di>
<dt>Unit</dt>
<dd>Physical unit of value. Example: MWh, l/s, etc.</dd>
</di>
<di>
<dt>Value</dt>
<dd>A field value.</dd>
</di>
<di>
<dt>Value Status</dt>
<dd>Status of field value. Contains important status information for Quality of Service purposes. Examples: Ok, Error, Warning, Time Shifted, Missing, Signed, etc.</dd>
</di>
<di>
<dt>Value Type</dt>
<dd>Can be numeric, string, boolean, Date &amp; Time, Time Span or Enumeration.</dd>
</di>
<di>
<dt>WSN</dt>
<dd>Wireless Sensor Network, a sensor network including wireless devices.</dd>
</di>
<di>
<dt>XMPP Client</dt>
<dd>Application connected to an XMPP network, having a JID. Note that sensors, as well as applications requesting sensor data can be XMPP clients.</dd>
</di>
</dl>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<p>
To create a complete set of operations supported by all types of concentrators, ranging from PLCs to subsystems to entire systems is very difficult. So, the aim
of this document is instead to create a very small reduced set of operations, a common denominator, that would allow for basic maintenance and interoperability of
concentrators of different makes and models and of these varying ranges.
</p>
<section2 topic='Capabilities'>
<section3 topic='Get Capabilities'>
<p>
This document lists a sequence of commands. Some are very basic, while others are used for managing massive amounts of devices. When developing a small PLC, it might
be difficult to motivate the implementation of the more advanced commands. They are simply not necessary for the management of the device. So, clients connecting to
the concentrator need a way to learn what operations are available in the concentrator, and as a consequence what operations are not. To do this, the
<strong>getCapabilities</strong> command is sent, as is shown in the following example.
</p>
<example caption='Full capabilities'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='subsystem@example.org'
id='1'>
<getCapabilities xmlns='urn:xmpp:iot:concentrators'/>
</iq>
<iq type='result'
from='subsystem@example.org'
to='client@example.org/client'
id='1'>
<getCapabilitiesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>getCapabilities</value>
<value>getAllDataSources</value>
<value>getRootDataSources</value>
<value>getChildDataSources</value>
<value>containsNode</value>
<value>containsNodes</value>
<value>getNode</value>
<value>getNodes</value>
<value>getAllNodes</value>
<value>getNodeInheritance</value>
<value>getRootNodes</value>
<value>getChildNodes</value>
<value>getIndices</value>
<value>getNodesFromIndex</value>
<value>getNodesFromIndices</value>
<value>getAllIndexValues</value>
<value>getNodeParametersForEdit</value>
<value>setNodeParametersAfterEdit</value>
<value>getCommonNodeParametersForEdit</value>
<value>setCommonNodeParametersAfterEdit</value>
<value>getAddableNodeTypes</value>
<value>getParametersForNewNode</value>
<value>createNewNode</value>
<value>destroyNode</value>
<value>getAncestors</value>
<value>getNodeCommands</value>
<value>getCommandParameters</value>
<value>executeNodeCommand</value>
<value>executeNodeQuery</value>
<value>abortNodeQuery</value>
<value>getCommonNodeCommands</value>
<value>getCommonCommandParameters</value>
<value>executeCommonNodeCommand</value>
<value>executeCommonNodeQuery</value>
<value>abortCommonNodeQuery</value>
<value>moveNodeUp</value>
<value>moveNodeDown</value>
<value>moveNodesUp</value>
<value>moveNodesDown</value>
<value>subscribe</value>
<value>unsubscribe</value>
<value>getDatabases</value>
<value>getDatabaseReadoutParameters</value>
<value>startDatabaseReadout</value>
</getCapabilitiesResponse>
</iq>]]>
</example>
<p>
A concentrator without databases, but still contain a rich interface for handling masses of nodes may present itself as follows:
</p>
<example caption='No database capabilities'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='subsystem@example.org'
id='63'>
<getCapabilities xmlns='urn:xmpp:iot:concentrators'/>
</iq>
<iq type='result'
from='subsystem@example.org'
to='client@example.org/client'
id='63'>
<getCapabilitiesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>getCapabilities</value>
<value>getAllDataSources</value>
<value>getRootDataSources</value>
<value>getChildDataSources</value>
<value>containsNode</value>
<value>containsNodes</value>
<value>getNode</value>
<value>getNodes</value>
<value>getAllNodes</value>
<value>getNodeInheritance</value>
<value>getRootNodes</value>
<value>getChildNodes</value>
<value>getIndices</value>
<value>getNodesFromIndex</value>
<value>getNodesFromIndices</value>
<value>getAllIndexValues</value>
<value>getNodeParametersForEdit</value>
<value>setNodeParametersAfterEdit</value>
<value>getCommonNodeParametersForEdit</value>
<value>setCommonNodeParametersAfterEdit</value>
<value>getAddableNodeTypes</value>
<value>getParametersForNewNode</value>
<value>createNewNode</value>
<value>destroyNode</value>
<value>getAncestors</value>
<value>getNodeCommands</value>
<value>getCommandParameters</value>
<value>executeNodeCommand</value>
<value>executeNodeQuery</value>
<value>abortNodeQuery</value>
<value>getCommonNodeCommands</value>
<value>getCommonCommandParameters</value>
<value>executeCommonNodeCommand</value>
<value>executeCommonNodeQuery</value>
<value>abortCommonNodeQuery</value>
<value>moveNodeUp</value>
<value>moveNodeDown</value>
<value>moveNodesUp</value>
<value>moveNodesDown</value>
<value>subscribe</value>
<value>unsubscribe</value>
</getCapabilitiesResponse>
</iq>]]>
</example>
<p>
A smaller gateway on the other hand, may have skipped the implementation of the batch commands that are used for larger systems:
</p>
<example caption='No batch command capabilities'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='gateway@example.org'
id='2'>
<getCapabilities xmlns='urn:xmpp:iot:concentrators'/>
</iq>
<iq type='result'
from='gateway@example.org'
to='client@example.org/client'
id='2'>
<getCapabilitiesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>getCapabilities</value>
<value>getAllDataSources</value>
<value>getRootDataSources</value>
<value>getChildDataSources</value>
<value>containsNode</value>
<value>getNode</value>
<value>getNodeInheritance</value>
<value>getRootNodes</value>
<value>getChildNodes</value>
<value>getNodeParametersForEdit</value>
<value>setNodeParametersAfterEdit</value>
<value>getAddableNodeTypes</value>
<value>getParametersForNewNode</value>
<value>createNewNode</value>
<value>destroyNode</value>
<value>getAncestors</value>
<value>getNodeCommands</value>
<value>getCommandParameters</value>
<value>executeNodeCommand</value>
<value>executeNodeQuery</value>
<value>abortNodeQuery</value>
<value>moveNodeUp</value>
<value>moveNodeDown</value>
<value>moveNodesUp</value>
<value>moveNodesDown</value>
<value>subscribe</value>
<value>unsubscribe</value>
</getCapabilitiesResponse>
</iq>]]>
</example>
<p>
But a small PLC, possibly with a fixed set of nodes, might have support for an even more reduced set of commands:
</p>
<example caption='No edit capabilities'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='plc@example.org'
id='3'>
<getCapabilities xmlns='urn:xmpp:iot:concentrators'/>
</iq>
<iq type='result'
from='plc@example.org'
to='client@example.org/client'
id='3'>
<getCapabilitiesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>getCapabilities</value>
<value>getAllDataSources</value>
<value>containsNode</value>
<value>getNode</value>
<value>getRootNodes</value>
<value>getChildNodes</value>
<value>getNodeCommands</value>
<value>getCommandParameters</value>
<value>executeNodeCommand</value>
<value>executeNodeQuery</value>
<value>abortNodeQuery</value>
</getCapabilitiesResponse>
</iq>]]>
</example>
<p>
So, clients who need to interact with different types of concentrators need to be aware of what commands are supported, and limit operations to those commands.
</p>
</section3>
</section2>
<section2 topic='Data Sources'>
<section3 topic='Get All Data Sources'>
<p>
This command will return a flat list of all available data sources on the concentrator. It is not structured hierarchically.
</p>
<example caption='Get All Data Sources'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='4'>
<getAllDataSources xmlns='urn:xmpp:iot:concentrators' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='4'>
<getAllDataSourcesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<dataSource sourceId='Applications' name='Applications' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='Certificates' name='Certificates' hasChildren='false' lastChanged='2013-02-20T12:31:54'/>
<dataSource sourceId='Clayster.EventSink.Programmable' name='Programmable Event Log' hasChildren='false' lastChanged='2012-10-25T09:31:12'/>
...
</getAllDataSourcesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Root Data Sources'>
<p>
If the client is interested in the hierarchical structure of available data sources, it should request only the root sources, and then ask the client for their
corresponding child data sources. If the client wants to present the data sources to a user, presenting them in their hierarchical order may be more intuitive.
</p>
<example caption='Get Root Data Sources'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='5'>
<getRootDataSources xmlns='urn:xmpp:iot:concentrators' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='5'>
<getRootDataSourcesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<dataSource sourceId='MeteringRoot' name='Metering' hasChildren='true' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='SecurityRoot' name='Security' hasChildren='true' lastChanged='2013-01-12T22:03:50'/>
<dataSource sourceId='SystemRoot' name='System' hasChildren='true' lastChanged='2012-02-20T12:34:56'/>
...
</getRootDataSourcesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Child Data Sources'>
<p>
Having the ID of a data source that contains child data sources, you can fetch the child sources as follows:
</p>
<example caption='Get Child Data Sources'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='6'>
<getChildDataSources xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringRoot' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='6'>
<getChildDataSourcesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<dataSource sourceId='MeteringFieldImports' name='Field Imports' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='MeteringFieldProcessors' name='Field Processors' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='MeteringFieldSinks' name='Field Sinks' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='MeteringGroups' name='Groups' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='MeteringJobs' name='Jobs' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='MeteringTopology' name='Topology' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
<dataSource sourceId='MeteringUnitConversion' name='Unit Conversion' hasChildren='false' lastChanged='2013-03-19T17:58:01'/>
</getChildDataSourcesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Subscribe to data source events' anchor='subscribe'>
<p>
A client can subscribe to changes made in a data source. It does this by sending the <strong>subscribe</strong> command to the concentrator,
as is shown in the following example:
</p>
<example caption='Subscribing to data source events'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='57'>
<subscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='57'>
<subscribeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
Multiple subscriptions to the same source will not result in an error, however the server will still only send one event message for each event in the data source.
</p>
<p>
<strong>Important:</strong> Event subscriptions only last for as long as the client and concentrator both maintain presence. The concentrator must not persist
event notification subscriptions, and if it goes offline and back online, or if the client goes offline or online again for any reason, the event subscription
is removed.
</p>
<p>
<strong>Note:</strong> The <strong>parameters</strong> and <strong>messages</strong> attributes can be used to retrieve parameter and status message information
about the nodes in event messages sent from the concentrator. Note that the <strong>xml:lang</strong> may be used to select the language used in such events,
if the concentrator supports localization of strings.
</p>
<example caption='Subscribing to data source events with localized parameters'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='60'>
<subscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' parameters='true' messages='true' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='60'>
<subscribeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
The <strong>subscribe</strong> command has a set of optional attributes, one for each event type available, and with the same names (<strong>nodeAdded</strong>,
<strong>nodeUpdated</strong>, <strong>nodeStatusChanged</strong>, <strong>nodeRemoved</strong>, <strong>nodeMovedUp</strong> and <strong>nodeMovedDown</strong>), that the
client can use to subscribe to individual events, but not to others. They have the default value of true implying that if not provided, the
default action is to subscribe to those events. The attributes <strong>parameters</strong> and <strong>messages</strong> can also be used to specify
if node parameters and node messages respectively should be available in event messages. The default value for the these later attributes is false, implying
that normal events do not include node parameter and node message information.
</p>
<p>
The following example shows how a client can subscribe to a set of events only:
</p>
<example caption='Subscribing to data source events, avoiding state events'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='61'>
<subscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' parameters='true' messages='false' xml:lang='en'
nodeAdded='true' nodeUpdated='true' nodeStatusChanged='false' nodeRemoved='true' nodeMovedUp='false' nodeMovedDown='false'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='61'>
<subscribeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
For more information on types of events sent, see the <link url='#sourceevents'>Data Source Events</link> section.
</p>
</section3>
<section3 topic='Unsubscribe from data source events'>
<p>
A client can unsubscribe to changes made in a data source it is subscribed to. It does this by sending the <strong>unsubscribe</strong> command to the concentrator,
as is shown in the following example:
</p>
<example caption='Unsubscribing from data source events'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='58'>
<unsubscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='58'>
<unsubscribeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
An unsubscription made to an existing data source, but where an event subscription does not exist, must not result in an error.
</p>
<p>
The <strong>unsubscribe</strong> command has a set of optional attributes, one for each event type available, and with the same names, that the
client can use to unsubscribe from individual events, but not from others. They have the default value of true implying that if not provided, the
default action is to unsubscribe from those events.
</p>
<p>
The following example shows how a client can unsubscribe from a subset of events, keeping subscriptions on the others (if subscribed to):
</p>
<example caption='Unsubscribing from state events'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='62'>
<unsubscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' parameters='true' messages='false' xml:lang='en'
nodeAdded='false' nodeUpdated='false' nodeStatusChanged='true' nodeRemoved='false' nodeMovedUp='false' nodeMovedDown='false'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='62'>
<subscribeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
</section3>
<section3 topic='Get changes since given timestamp before subscribing' anchor='subscribe2'>
<p>
If a client comes back online and wants to know any changes that have taken place on the concentrator since last time it was in contact with it,
it can include a <strong>getEventsSince</strong> attribute in the <strong>subscribe</strong> command sent to the concentrator. This will make the
concentrator send all event messages since the given timestamp to the client before subscribing the client to events in the given data source.
</p>
<example caption='Get changes since given timestamp before subscribing'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='59'>
<subscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' getEventsSince='2013-03-21T19:24:00'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='59'>
<subscribeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>
... Sequence of event messages sent from concentrator to client.]]>
</example>
<p>
<strong>Important:</strong> Event subscriptions only last for as long as the client and concentrator both maintain presence. The concentrator must not persist
event notification subscriptions, and if it goes offline and back online, or if the client goes offline or online again for any reason, the event subscription
is removed.
</p>
<p>
<strong>Note:</strong> The <strong>parameters</strong> and <strong>messages</strong> attributes can be used to retrieve parameter and status message information
about the nodes in event messages sent from the concentrator.
</p>
<p>
For more information on types of events sent, see the <link url='#sourceevents'>Data Source Events</link> section.
</p>
</section3>
<section3 topic='Get changes since given timestamp before subscribing, Failure'>
<p>
If during a subscription request the concentrator is not able to fulfill the request of retrieving previous events using the <strong>getEventsSince</strong> attribute,
perhaps the attribute stretches too far back, or includes too many records, the concentrator can return an error message using a response code of <strong>NotImplemented</strong>.
In this case, the subscription must not be made.
</p>
<p>
When receiving such an error from the concentrator, the client must make a decision if it should download the data source again, or keep the data source as is, and
subscribing again without the <strong>getEventsSince</strong> attribute.
</p>
<example caption='Get changes since given timestamp before subscribing, Failure'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='73'>
<subscribe xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' getEventsSince='2001-01-01T00:00:00'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='73'>
<subscribeResponse xmlns='urn:xmpp:iot:concentrators' result='NotImplemented'/>
</iq>]]>
</example>
</section3>
</section2>
<section2 topic='Nodes'>
<section3 topic='Contains Node'>
<p>
This command permits the client to check the existence of a node in the concentrator.
</p>
<example caption='Checking the existence of a node'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='7'>
<containsNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='7'>
<containsNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>true</containsNodeResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Contains Nodes'>
<p>
If the client wants to check the existence of multiple nodes on the concentrator, it can use this batch command instead:
</p>
<example caption='Checking the existence of a multiple nodes'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='8'>
<containsNodes xmlns='urn:xmpp:iot:concentrators'>
<node sourceId='MeteringTopology' nodeId='Node1'/>
<node sourceId='MeteringTopology' nodeId='Node2'/>
<node sourceId='MeteringTopology' nodeId='Node3'/>
<node sourceId='MeteringGroups' nodeId='Group1'/>
</containsNodes>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='8'>
<containsNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>true</value>
<value>true</value>
<value>false</value>
<value>true</value>
</containsNodesResponse>
</iq>]]>
</example>
<p>
The array returned will have one item for each item in the request, in the same order.
</p>
</section3>
<section3 topic='Get Node'>
<p>
This command returns basic information about a node in the concentrator.
</p>
<example caption='Get Node'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='9'>
<getNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='9'>
<getNodeResponse xmlns='urn:xmpp:iot:concentrators'
result='OK'
nodeId='Node1'
nodeType='Namespace.NodeType1'
cacheType='Node'
state='WarningUnsigned'
hasChildren='false'
isReadable='true'
isControllable='true'
hasCommands='true'
parentId='Root'
lastChanged='2013-03-19T17:58:01'/>
</iq>]]>
</example>
<p>
For more information, see <link url='#nodeinfo'>Node Information</link>.
</p>
</section3>
<section3 topic='Get Nodes'>
<p>
This command lets the client get information from multiple nodes at once.
</p>
<example caption='Get Nodes'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='10'>
<getNodes xmlns='urn:xmpp:iot:concentrators' xml:lang='en'>
<node sourceId='MeteringTopology' nodeId='Node1'/>
<node sourceId='MeteringTopology' nodeId='Node2'/>
<node sourceId='MeteringTopology' nodeId='Node3'/>
</getNodes>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='10'>
<getNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false' isReadable='true'
isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'/>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false' isReadable='true'
isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'/>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false' isReadable='true'
isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'/>
</getNodesResponse>
</iq>]]>
</example>
<p>
For more information, see <link url='#nodeinfo'>Node Information</link>.
</p>
</section3>
<section3 topic='Get Node with parameters'>
<p>
This command returns basic information about a node in the concentrator, as well as node parameters.
</p>
<example caption='Get Node with parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='11'>
<getNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' xml:lang='en' parameters='true'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='11'>
<getNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK' nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node'
state='WarningUnsigned' hasChildren='false' isReadable='true' isControllable='true' hasCommands='true'
parentId='Root' lastChanged='2013-03-19T17:58:01'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</getNodeResponse>
</iq>]]>
</example>
<p>
For more information, see <link url='#nodeinfo'>Node Information</link>.
</p>
</section3>
<section3 topic='Get Nodes with parameters'>
<p>
This command lets the client get information from multiple nodes at once, including node parameters.
</p>
<example caption='Get Nodes with parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='12'>
<getNodes xmlns='urn:xmpp:iot:concentrators' parameters='true' xml:lang='en'>
<node sourceId='MeteringTopology' nodeId='Node1'/>
<node sourceId='MeteringTopology' nodeId='Node2'/>
<node sourceId='MeteringTopology' nodeId='Node3'/>
</getNodes>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='12'>
<getNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false' isReadable='true'
isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false' isReadable='true'
isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'>
<string id='id' name='Node ID' value='Node2'/>
<string id='type' name='Node Type' value='Watchamacallit Pressure Sensor v1.2'/>
<string id='sn' name='Serial Number' value='234567'/>
<string id='class' name='Node Class' value='Pressure'/>
<string id='meterLoc' name='Meter Location' value='P668632-6'/>
<int id='addr' name='Address' value='124'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false' isReadable='true'
isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'>
<string id='id' name='Node ID' value='Node3'/>
<string id='type' name='Node Type' value='Watchamacallit Electricity Meter v1.2'/>
<string id='sn' name='Serial Number' value='345678'/>
<string id='class' name='Node Class' value='Electricity'/>
<string id='meterLoc' name='Meter Location' value='P332367-9'/>
<int id='addr' name='Address' value='125'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
</getNodesResponse>
</iq>]]>
</example>
<p>
For more information, see <link url='#nodeinfo'>Node Information</link>.
</p>
</section3>
<section3 topic='Get All Nodes'>
<p>
If the device does not manage too many nodes, it could choose to implement this function. It would return all available nodes with one call.
</p>
<example caption='Get All Nodes'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='13'>
<getAllNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='13'>
<getAllNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
<node nodeId='Root' nodeType='Namespace.Root' cacheType='Node' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true'/>
</getAllNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get All Nodes with Parameters'>
<p>
If the device does not manage too many nodes, it could choose to implement this function. It would return all available nodes with their parameters with one call.
</p>
<example caption='Get All Nodes with Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='14'>
<getAllNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' parameters='true' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='14'>
<getAllNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node2'/>
<string id='type' name='Node Type' value='Watchamacallit Pressure Sensor v1.2'/>
<string id='sn' name='Serial Number' value='234567'/>
<string id='class' name='Node Class' value='Pressure'/>
<string id='meterLoc' name='Meter Location' value='P668632-6'/>
<int id='addr' name='Address' value='124'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node3'/>
<string id='type' name='Node Type' value='Watchamacallit Electricity Meter v1.2'/>
<string id='sn' name='Serial Number' value='345678'/>
<string id='class' name='Node Class' value='Electricity'/>
<string id='meterLoc' name='Meter Location' value='P332367-9'/>
<int id='addr' name='Address' value='125'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Root' nodeType='Namespace.Root' cacheType='Node' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true'>
<string id='id' name='Node ID' value='Root'/>
<string id='type' name='Node Type' value='Root Node'/>
</node>
</getAllNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get All Nodes derived from'>
<p>
This command assumes node types exist in a class hierarchy, and allows the caller to retrieve nodes with similar inheritance.
</p>
<example caption='Get All Nodes derived from'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='15'>
<getAllNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' xml:lang='en'>
<onlyIfDerivedFrom>Namespace.BaseClass1</onlyIfDerivedFrom>
</getAllNodes>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='15'>
<getAllNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
</getAllNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get All Nodes derived from, with Parameters'>
<p>
This command assumes node types exist in a class hierarchy, and allows the caller to retrieve nodes with similar inheritance. It also returns node parameters
directly in the response.
</p>
<example caption='Get All Nodes derived from, with Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='16'>
<getAllNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' parameters='true' xml:lang='en'>
<onlyIfDerivedFrom>Namespace.BaseClass1</onlyIfDerivedFrom>
</getAllNodes>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='16'>
<getAllNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node3'/>
<string id='type' name='Node Type' value='Watchamacallit Electricity Meter v1.2'/>
<string id='sn' name='Serial Number' value='345678'/>
<string id='class' name='Node Class' value='Electricity'/>
<string id='meterLoc' name='Meter Location' value='P332367-9'/>
<int id='addr' name='Address' value='125'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
</getAllNodesResponse>
</iq>]]>
</example>
<p>
Note that the caller can list multiple classes in the request. This would return only nodes having the correct base class(es) and
implementing all interfaces.
</p>
</section3>
<section3 topic='Get Node Inheritance'>
<p>
This command assumes node types exist in a class hierarchy. It allows the caller to get a list of the node class hierarchy and implemented interfaces the
node has.
</p>
<example caption='Get node inheritance'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='17'>
<getNodeInheritance xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='17'>
<getNodeInheritanceResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<baseClasses>
<value>Namespace.BaseClass1</value>
<value>Namespace.AbstractBase</value>
</baseClasses>
</getNodeInheritanceResponse>
</iq>]]>
</example>
<p>
<strong>Note:</strong> It is assumed the client already knows the node type of the node, so the response must not contain the type of the node, only
its base classes and any implemented interfaces.
</p>
</section3>
<section3 topic='Get Root Nodes'>
<p>
This command returns the root node of a data source (in case the source is a tree-shaped data source) or the nodes of a data source (in case the
source is flat).
</p>
<example caption='Get Root Nodes'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='18'>
<getRootNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='18'>
<getRootNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
</getRootNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Root Nodes with Parameters'>
<p>
This command returns the root node of a data source (in case the source is a tree-shaped data source) or the root nodes of a data source (in case the
source is flat), and also returns the parameters for the corresponding nodes.
</p>
<example caption='Get Root Nodes with Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='19'>
<getRootNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' parameters='true' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='19'>
<getRootNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
</getRootNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Child Nodes'>
<p>
This command returns the child nodes of a node in a data source.
</p>
<example caption='Get Child Nodes'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='20'>
<getChildNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='20'>
<getChildNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'/>
</getChildNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Child Nodes with Parameters'>
<p>
This command returns the child nodes of a node in a data source, and also returns the parameters for the corresponding nodes.
</p>
<example caption='Get Child Nodes with Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='21'>
<getChildNodes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' parameters='true' xml:lang='en' />
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='21'>
<getChildNodesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node2'/>
<string id='type' name='Node Type' value='Watchamacallit Pressure Sensor v1.2'/>
<string id='sn' name='Serial Number' value='234567'/>
<string id='class' name='Node Class' value='Pressure'/>
<string id='meterLoc' name='Meter Location' value='P668632-6'/>
<int id='addr' name='Address' value='124'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node3'/>
<string id='type' name='Node Type' value='Watchamacallit Electricity Meter v1.2'/>
<string id='sn' name='Serial Number' value='345678'/>
<string id='class' name='Node Class' value='Electricity'/>
<string id='meterLoc' name='Meter Location' value='P332367-9'/>
<int id='addr' name='Address' value='125'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
</getChildNodesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Indices of Data Source'>
<p>
This command returns a list of available indices in a data source. Indices can be used for efficient node look-up.
</p>
<example caption='Get Indices of Data Source'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='22'>
<getIndices xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' />
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='22'>
<getIndicesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>country</value>
<value>region</value>
<value>city</value>
<value>area</value>
<value>street</value>
<value>building</value>
<value>apartment</value>
<value>oid</value>
</getIndicesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Nodes from index'>
<p>
This command can be used to get a node or nodes from a data source using an index and an index value.
</p>
<example caption='Get Nodes from index'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='23'>
<getNodesFromIndex xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' index='apartment' indexValue='A1-1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='23'>
<getNodesFromIndexResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-1'/>
</getNodesFromIndexResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Nodes from index with Parameters'>
<p>
This command can be used to get a node or nodes from a data source using an index and an index value, and also returns the parameters for the corresponding nodes.
</p>
<example caption='Get Nodes from index with Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='24'>
<getNodesFromIndex xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' index='apartment' indexValue='A1-1'
parameters='true' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='24'>
<getNodesFromIndexResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-1'>
<string id='id' name='Node ID' value='Node2'/>
<string id='type' name='Node Type' value='Metering Topology Reference'/>
<string id='referenceId' name='Reference ID' value='Node2'/>
</node>
</getNodesFromIndexResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Nodes from indices'>
<p>
This command can be used to get nodes from a set of data source using indices and index values.
</p>
<example caption='Get Nodes from indices'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='25'>
<getNodesFromIndices xmlns='urn:xmpp:iot:concentrators' xml:lang='en'>
<indexRef sourceId='MeteringGroups' index='apartment' indexValue='A1-1'/>
<indexRef sourceId='MeteringGroups' index='apartment' indexValue='A1-2'/>
</getNodesFromIndices>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='25'>
<getNodesFromIndicesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-1'/>
<node nodeId='Node3' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-2'/>
</getNodesFromIndicesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Nodes from indices with Parameters'>
<p>
This command can be used to get nodes from a set of data source using indices and index values, and also returns the parameters for the corresponding nodes.
</p>
<example caption='Get Nodes from indices with Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='26'>
<getNodesFromIndices xmlns='urn:xmpp:iot:concentrators' parameters='true' xml:lang='en'>
<indexRef sourceId='MeteringGroups' index='apartment' indexValue='A1-1'/>
<indexRef sourceId='MeteringGroups' index='apartment' indexValue='A1-2'/>
</getNodesFromIndices>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='26'>
<getNodesFromIndicesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-1'>
<string id='id' name='Node ID' value='Node2'/>
<string id='type' name='Node Type' value='Metering Topology Reference'/>
<string id='referenceId' name='Reference ID' value='Node2'/>
</node>
<node nodeId='Node3' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-2'>
<string id='id' name='Node ID' value='Node3'/>
<string id='type' name='Node Type' value='Metering Topology Reference'/>
<string id='referenceId' name='Reference ID' value='Node3'/>
</node>
</getNodesFromIndicesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get All Index Values'>
<p>
This command can be used to get a list of available index values, given a data source and an index.
</p>
<example caption='Get All Index Values'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='27'>
<getAllIndexValues xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' index='apartment'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='27'>
<getAllIndexValuesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<value>A1-1</value>
<value>A1-2</value>
...
</getAllIndexValuesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Node Ancestors'>
<p>
In a tree formed data source, all nodes except the root node has a parent node. The <strong>getAncestors</strong> command allows the client to get a list
of all ancestors (parent, grand parent, etc.) of a node, as is shown in the following example:
</p>
<example caption='Get Node Ancestors'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='42'>
<getAncestors xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='Node2' parameters='false' messages='false' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='42'>
<getAncestorsResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node2' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Apartment 1-1'/>
<node nodeId='Apartment 1-1' nodeType='Namespace.Apartment' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='Building 1'/>
<node nodeId='Building 1' nodeType='Namespace.Building' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='Street'/>
<node nodeId='Street' nodeType='Namespace.Street' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='Area'/>
<node nodeId='Area' nodeType='Namespace.Area' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='City'/>
<node nodeId='City' nodeType='Namespace.City' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='Region'/>
<node nodeId='Region' nodeType='Namespace.Region' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='Country'/>
<node nodeId='Country' nodeType='Namespace.Country' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true' parentId='Root'/>
<node nodeId='Root' nodeType='Namespace.Root' state='None' hasChildren='true'
isReadable='false' isControllable='false' hasCommands='true'/>
</getAncestorsResponse>
</iq>]]>
</example>
<p>
Note that the concentrator returns information about the node itself in the response. The <strong>parameters</strong> and <strong>messages</strong>
attributes are used in the request to control if the concentrator should return node parameters and node status messages in the response as well.
</p>
</section3>
<section3 topic='Move Node Up'>
<p>
As the order of siblings in a tree can be important, depending on the context and type of nodes involved, the client may be allowed to move nodes up and down among siblings.
To move a node upwards among its siblings is done using the command <strong>moveNodeUp</strong>, as is shown in the following example:
</p>
<example caption='Move Node Up'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='53'>
<moveNodeUp xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringFieldProcessors' nodeId='LogicalOperator'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='53'>
<moveNodeUpResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
Note that a node that is first among its siblings will maintain its position. The response to the command must still be <strong>OK</strong>.
</p>
</section3>
<section3 topic='Move Node Down'>
<p>
As the order of siblings in a tree can be important, depending on the context and type of nodes involved, the client may be allowed to move nodes up and down among siblings.
To move a node downwards among its siblings is done using the command <strong>moveNodeDown</strong>, as is shown in the following example:
</p>
<example caption='Move Node Up'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='54'>
<moveNodeDown xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringFieldProcessors' nodeId='LogicalOperator'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='54'>
<moveNodeDownResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
Note that a node that is last among its siblings will maintain its position. The response to the command must still be <strong>OK</strong>.
</p>
</section3>
<section3 topic='Move Nodes Up'>
<p>
To move a set of nodes upwards among its siblings is done using the command <strong>moveNodesUp</strong>, as is shown in the following example:
</p>
<example caption='Move Nodes Up'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='55'>
<moveNodesUp xmlns='urn:xmpp:iot:concentrators'>
<node sourceId='MeteringFieldProcessors' nodeId='LogicalOperator3'/>
<node sourceId='MeteringFieldProcessors' nodeId='LogicalOperator4'/>
<node sourceId='MeteringFieldProcessors' nodeId='LogicalOperator5'/>
</moveNodesUp>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='55'>
<moveNodesUpResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
Note that a node that is first among its siblings will maintain its position. The response to the command must still be <strong>OK</strong>. If an attempt is performed to move a
sequence of nodes that are together first as siblings, none of the nodes move relative to each other.
</p>
</section3>
<section3 topic='Move Nodes Down'>
<p>
To move a set of nodes downwards among its siblings is done using the command <strong>moveNodesDown</strong>, as is shown in the following example:
</p>
<example caption='Move Node Down'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='56'>
<moveNodesDown xmlns='urn:xmpp:iot:concentrators'>
<node sourceId='MeteringFieldProcessors' nodeId='LogicalOperator3'/>
<node sourceId='MeteringFieldProcessors' nodeId='LogicalOperator4'/>
<node sourceId='MeteringFieldProcessors' nodeId='LogicalOperator5'/>
</moveNodesDown>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='56'>
<moveNodesDownResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
Note that a node that is last among its siblings will maintain its position. The response to the command must still be <strong>OK</strong>. If an attempt is performed to move a
sequence of nodes that are together last as siblings, none of the nodes move relative to each other.
</p>
</section3>
</section2>
<section2 topic='Node Parameters'>
<section3 topic='Get Node Parameters for editing'>
<p>
Previously described commands can return parameters for a node. But these parameters are for presentational or informational use. If the client wants to edit
the parameters of a node, another set of commands must be used. This use case shows how <strong>getNodeParametersForEdit</strong> can be used to edit available
parameters for one node.
</p>
<p>
<strong>Note:</strong> When editing parameters for a node, a different set of parameters might be returned compared to the set of parameters available in commands
mentioned above. There may be various reasons for this, among other things (but not limited to) user rights, node settings, and parameter type. User rights may restrict the number
of parameters the user can access. The node may be configured not to allow editing of certain parameters. Also, some types of parameters may only be available in
an edit mode (like long multi-line parameters) and not in a shorter presentation mode.
</p>
<example caption='Get Node Parameters for editing'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='28'>
<getNodeParametersForEdit xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='28'>
<getNodeParametersForEditResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<x type='form'
xmlns='jabber:x:data'
xmlns:xdv='http://jabber.org/protocol/xdata-validate'
xmlns:xdl='http://jabber.org/protocol/xdata-layout'
xmlns:xdd='urn:xmpp:xdata:dynamic'>
<title>Node1</title>
<xdl:page label='Identity'>
<xdl:fieldref var='id'/>
<xdl:fieldref var='type'/>
<xdl:fieldref var='class'/>
<xdl:fieldref var='sn'/>
</xdl:page>
<xdl:page label='Location'>
<xdl:fieldref var='meterLoc'/>
<xdl:fieldref var='lat'/>
<xdl:fieldref var='long'/>
</xdl:page>
<xdl:page label='Communication'>
<xdl:fieldref var='addr'/>
</xdl:page>
<field var='xdd session' type='hidden'>
<value>009c7956-001c-43fb-8edb-76bcf74272c9</value>
</field>
<field var='id' type='text-single' label='Node ID:'>
<desc>ID of the node.</desc>
<required/>
<value>Node1</value>
</field>
<field var='type' type='text-single' label='Node Type:'>
<desc>Type of node.</desc>
<value>Watchamacallit Temperature Sensor v1.2</value>
<xdd:readOnly/>
</field>
<field var='class' type='list-single' label='Node Class:'>
<desc>Class of node</desc>
<value>Temperature</value>
<option label='Cooling'><value>Cooling</value></option>
<option label='Electricity'><value>Electricity</value></option>
<option label='Heating'><value>Heating</value></option>
<option label='Pressure'><value>Pressure</value></option>
<option label='Temperature'><value>Temperature</value></option>
<option label='Water'><value>Water</value></option>
...
</field>
<field var='sn' type='text-single' label='Serial Number:'>
<desc>Serial number of node/device.</desc>
<value>123456</value>
</field>
<field var='meterLoc' type='text-single' label='Meter Location:'>
<desc>Meter Location.</desc>
<value>P123502-2</value>
</field>
<field var='addr' type='text-single' label='Address:'>
<xdv:validate datatype='xs:int'>
<xdv:range min='1' max='250'/>
</xdv:validate>
<desc>Bus address</desc>
<value>123</value>
</field>
<field var='lat' type='text-single' label='Latitude:'>
<xdv:validate datatype='xs:double'>
<xdv:range min='-90' max='90'/>
</xdv:validate>
<desc>Latitude of node.</desc>
<value>12.345</value>
</field>
<field var='long' type='text-single' label='Longitude:'>
<xdv:validate datatype='xs:double'>
<xdv:range min='-180' max='180'/>
</xdv:validate>
<desc>Longitude of node.</desc>
<value>123.45</value>
</field>
</x>
</getNodeParametersForEditResponse>
</iq>]]>
</example>
<p>
The following table lists the different XEP's the client should implement to be able to support parameter forms according to this proposal:
</p>
<table caption='Form XEPs'>
<tr>
<th>XEP</th>
<th>Description</th>
</tr>
<tr>
<td>XEP-0004</td>
<td>Describes how basic forms are handled.</td>
</tr>
<tr>
<td>XEP-0122</td>
<td>Makes it possible to add certain client validation rules to form parameters.</td>
</tr>
<tr>
<td>XEP-0137</td>
<td>Makes it possible to publish a file upload parameter.</td>
</tr>
<tr>
<td>XEP-0141</td>
<td>Makes it possible to layout parameters into pages and sections.</td>
</tr>
<tr>
<td>XEP-0331</td>
<td>Defines extensions for how color parameters can be handled.</td>
</tr>
<tr>
<td>XEP-0336</td>
<td>Makes it possible to create dynamic forms, with server-side validation and forms that change dynamically depending on input.</td>
</tr>
</table>
<p>
Read-only parameters will be returned with the <strong>readOnly</strong> element, as defined in <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link>.
Clients SHOULD support this extension if using this command. However, the server MUST NOT change parameters in a node that are read-only, even if clients happen
to try to set them.
</p>
</section3>
<section3 topic='Set Node Parameters after editing'>
<p>
After editing the form, the client uses the <strong>setNodeParametersAfterEdit</strong> command to set the parameters in the node. Note that it is possible to
set the same parameters (or a sub-set of the same parameters) to a different node using this command, without the need to get new form parameters. However, after the first
successful set operation, any form session used for dynamic validation during edit will not be available on the server anymore and must be ignored by the server.
</p>
<example caption='Set Node Parameters after editing'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='29'>
<setNodeParametersAfterEdit xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' xml:lang='en'>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>009c7956-001c-43fb-8edb-76bcf74272c9</value>
</field>
<field var='id' type='text-single'>
<value>Node1</value>
</field>
<field var='class' type='list-single'>
<value>Temperature</value>
</field>
<field var='sn' type='text-single'>
<value>123456</value>
</field>
<field var='meterLoc' type='text-single'>
<value>P123502-2</value>
</field>
<field var='addr' type='text-single'>
<value>123</value>
</field>
<field var='lat' type='text-single'>
<value>12.345</value>
</field>
<field var='long' type='text-single'>
<value>123.45</value>
</field>
</x>
</setNodeParametersAfterEdit>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='29'>
<setNodeParametersAfterEditResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
</setNodeParametersAfterEditResponse>
</iq>]]>
</example>
<p>
Note that validation rules, pagination, etc., can be stripped from the form when submitting it to the server. Also the form type attribute must be set
to <strong>'submit'</strong>. Note also that as the <strong>result</strong> attribute is <strong>OK</strong>, it is assumed the server has dropped any parameter form resources
related to the form, which disables any future dynamic validation of the contents of the form. The newly edited node will also be available in the response
in a <strong>node</strong> element.
</p>
</section3>
<section3 topic='Set Node Parameters after editing, Failure'>
<p>
The following example shows how the server responds when the client tries to set invalid parameters. The response contains detailed information about why,
information which the client can use to inform the user (if any) of what went wrong.
</p>
<example caption='Set Node Parameters after editing, Failure'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='30'>
<setNodeParametersAfterEdit xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node2' xml:lang='en'>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>009c7956-001c-43fb-8edb-76bcf74272c9</value>
</field>
<field var='id' type='text-single'>
<value>Node1</value>
</field>
<field var='class' type='list-single'>
<value>Temperature</value>
</field>
<field var='sn' type='text-single'>
<value>123456</value>
</field>
<field var='meterLoc' type='text-single'>
<value>P123502-2</value>
</field>
<field var='addr' type='text-single'>
<value>123</value>
</field>
<field var='lat' type='text-single'>
<value>12.345</value>
</field>
<field var='long' type='text-single'>
<value>123.45</value>
</field>
</x>
</setNodeParametersAfterEdit>
</iq>
<iq type='error'
from='concentrator@example.org'
to='client@example.org/client'
id='30'>
<setNodeParametersAfterEditResponse xmlns='urn:xmpp:iot:concentrators' result='FormError'>
<error var='id'>There already exists a node with this ID.</error>
</setNodeParametersAfterEditResponse>
</iq>]]>
</example>
<p>
As the <strong>result</strong> attribute is <strong>FormError</strong>, the server maintains any parameter form resources related to the form, and features such as
dynamic validation of the contents of the form will still be available until the parameters have been successfully set, the operation has been
explicitly cancelled or a form session time-out has occurred. See <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link>
<note>
XEP-0336: Dynamic Data Forms &lt;<link url='http://xmpp.org/extensions/xep-0336.html'>http://xmpp.org/extensions/xep-0336.html</link>&gt;
</note> for more information.
</p>
</section3>
<section3 topic='Get Common Node Parameters for editing'>
<p>
Advanced concentrators handling large quantities of nodes may let users edit sets of nodes at once to be practical. This is done by publishing the
<strong>getCommonNodeParametersForEdit</strong> command. It will return a form with parameters that are common for all selected nodes. Since nodes
may have different node types it is assumed that different nodes have different sets of parameters. But if this command is used, only parameters matching
in IDs, descriptions, validation rules, etc., (but not values) will be returned in a form.
</p>
<p>
<strong>Important:</strong> A parameter that exists in multiple nodes, but has different parameter values among the nodes, will be marked with the
<strong>notSame</strong> element, according to <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link>. Clients using this command MUST
support the extensions defined in <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link>.
</p>
<example caption='Get Common Node Parameters for editing'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='31'>
<getCommonNodeParametersForEdit xmlns='urn:xmpp:iot:concentrators' xml:lang='en'>
<node sourceId='MeteringTopology' nodeId='Node1'/>
<node sourceId='MeteringTopology' nodeId='Node2'/>
<node sourceId='MeteringTopology' nodeId='Node3'/>
</getCommonNodeParametersForEdit>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='31'>
<getCommonNodeParametersForEditResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<x type='form'
xmlns='jabber:x:data'
xmlns:xdv='http://jabber.org/protocol/xdata-validate'
xmlns:xdl='http://jabber.org/protocol/xdata-layout'
xmlns:xdd='urn:xmpp:xdata:dynamic'>
<title>Node1, Node2, Node3</title>
<xdl:page label='Identity'>
<xdl:fieldref var='type'/>
<xdl:fieldref var='class'/>
<xdl:fieldref var='sn'/>
</xdl:page>
<xdl:page label='Location'>
<xdl:fieldref var='meterLoc'/>
<xdl:fieldref var='lat'/>
<xdl:fieldref var='long'/>
</xdl:page>
<field var='xdd session' type='hidden'>
<value>009c7956-001c-43fb-8edb-76bcf74272c9</value>
</field>
<field var='type' type='text-single' label='Node Type:'>
<desc>Type of node.</desc>
<value>Watchamacallit Temperature Sensor v1.2</value>
<xdd:readOnly/>
<xdd:notSame/>
</field>
<field var='class' type='list-single' label='Node Class:'>
<desc>Class of node</desc>
<value>Temperature</value>
<xdd:notSame/>
<option label='Cooling'><value>Cooling</value></option>
<option label='Electricity'><value>Electricity</value></option>
<option label='Heating'><value>Heating</value></option>
<option label='Pressure'><value>Pressure</value></option>
<option label='Temperature'><value>Temperature</value></option>
<option label='Water'><value>Water</value></option>
...
</field>
<field var='sn' type='text-single' label='Serial Number:'>
<desc>Serial number of node/device.</desc>
<value>123456</value>
<xdd:notSame/>
</field>
<field var='meterLoc' type='text-single' label='Meter Location:'>
<desc>Meter Location.</desc>
<value>P123502-2</value>
<xdd:notSame/>
</field>
<field var='addr' type='text-single' label='Address:'>
<xdv:validate datatype='xs:int'>
<xdv:range min='1' max='250'/>
</xdv:validate>
<desc>Bus address</desc>
<value>123</value>
<xdd:notSame/>
</field>
<field var='lat' type='text-single' label='Latitude:'>
<xdv:validate datatype='xs:double'>
<xdv:range min='-90' max='90'/>
</xdv:validate>
<desc>Latitude of node.</desc>
<value>12.345</value>
<xdd:notSame/>
</field>
<field var='long' type='text-single' label='Longitude:'>
<xdv:validate datatype='xs:double'>
<xdv:range min='-180' max='180'/>
</xdv:validate>
<desc>Longitude of node.</desc>
<value>123.45</value>
<xdd:notSame/>
</field>
</x>
</getCommonNodeParametersForEditResponse>
</iq>]]>
</example>
<p>
Note that parameters that are not available in all selected nodes will have been removed. Also and ID-parameter will have been removed, since they
cannot be set for a collection of nodes.
</p>
<p>
Fields marked with the <strong>notSame</strong> element only present one value, perhaps the value of the first node. However, the field should be clearly
marked in any end-user GUI (for example by graying the field), and MUST ONLY be sent back to the server in a set operation if explicitly edited by the end-user.
The parameter will be set in all selected nodes in that case. Unedited fields should be treated as if the end-user accepts the different values for the current set of nodes.
</p>
</section3>
<section3 topic='Set Common Node Parameters after editing'>
<p>
After editing the form, the client uses the <strong>setCommonNodeParametersAfterEdit</strong> command to set the parameters in the set of nodes. Note that it is possible to
set the same parameters (or a sub-set of the same parameters) to a different set of nodes using this command, without the need to get new form parameters. However, after the first
successful set operation, any form session used for dynamic validation during edit will not be available on the server any more.
</p>
<example caption='Set Common Node Parameters after editing'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='32'>
<setCommonNodeParametersAfterEdit xmlns='urn:xmpp:iot:concentrators' xml:lang='en'>
<node sourceId='MeteringTopology' nodeId='Node1'/>
<node sourceId='MeteringTopology' nodeId='Node2'/>
<node sourceId='MeteringTopology' nodeId='Node3'/>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>009c7956-001c-43fb-8edb-76bcf74272c9</value>
</field>
<field var='class' type='list-single'>
<value>Temperature</value>
</field>
</x>
</setCommonNodeParametersAfterEdit>
</iq>
<iq type='error'
from='concentrator@example.org'
to='client@example.org/client'
id='32'>
<setCommonNodeParametersAfterEditResponse xmlns='urn:xmpp:iot:concentrators' result='FormError'>
<node nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node2' nodeType='Namespace.NodeType2' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node2'/>
<string id='type' name='Node Type' value='Watchamacallit Pressure Sensor v1.2'/>
<string id='sn' name='Serial Number' value='234567'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P668632-6'/>
<int id='addr' name='Address' value='124'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
<node nodeId='Node3' nodeType='Namespace.NodeType3' cacheType='Node' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root'>
<string id='id' name='Node ID' value='Node3'/>
<string id='type' name='Node Type' value='Watchamacallit Electricity Meter v1.2'/>
<string id='sn' name='Serial Number' value='345678'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P332367-9'/>
<int id='addr' name='Address' value='125'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
</node>
</setCommonNodeParametersAfterEditResponse>
</iq>]]>
</example>
<p>
Note that validation rules, pagination, etc., can be stripped from the form when submitting it to the server. Also the form type attribute must be set
to <strong>'submit'</strong>. Note also that as the <strong>result</strong> attribute is <strong>OK</strong>, it is assumed the server has dropped any parameter form resources
related to the form, which disables any future dynamic validation of the contents of the form.
</p>
<p>
<strong>Important:</strong> A parameter that exists in multiple nodes, but has different parameter values among the nodes, will be marked with the
<strong>notSame</strong> element, according to <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link>. Such parameters MUST NOT be sent back to the server
unless they have explicitly been edited or signed by the end-user. The value sent back to the server will be set in all nodes.
</p>
</section3>
<section3 topic='Set Common Node Parameters after editing, Failure'>
<p>
The following example shows how the server responds when the client tries to set invalid parameters to a set of nodes. The response contains detailed information about why,
information which the client can use to inform the user (if any) of what went wrong.
</p>
<example caption='Set Common Node Parameters after editing, Failure'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='33'>
<setCommonNodeParametersAfterEdit xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' xml:lang='en'>
<node sourceId='MeteringTopology' nodeId='Node1'/>
<node sourceId='MeteringTopology' nodeId='Node2'/>
<node sourceId='MeteringTopology' nodeId='Node3'/>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>009c7956-001c-43fb-8edb-76bcf74272c9</value>
</field>
<field var='id' type='text-single'>
<value>Node1</value>
</field>
<field var='class' type='list-single'>
<value>Temperature</value>
</field>
</x>
</setCommonNodeParametersAfterEdit>
</iq>
<iq type='error'
from='concentrator@example.org'
to='client@example.org/client'
id='33'>
<setCommonNodeParametersAfterEditResponse xmlns='urn:xmpp:iot:concentrators' result='FormError'>
<error var='id'>Parameter not available.</error>
</setCommonNodeParametersAfterEditResponse>
</iq>]]>
</example>
<p>
As the <strong>result</strong> attribute is <strong>FormError</strong>, the server maintains any parameter form resources related to the form, and features such as
dynamic validation of the contents of the form will still be available until the parameters have been successfully set, the operation has been
explicitly cancelled or a form session time-out has occurred. See <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link> for more information.
</p>
</section3>
<section3 topic='Get Node Messages'>
<p>
Each node in the concentrator has a <strong>state</strong>. This state is a dynamic run-time state, and therefore not presented as a more static property.
This state can be any of the following values, in order of increasing importance:
</p>
<table caption='Node states'>
<tr>
<th>State</th>
<th>Description</th>
</tr>
<tr>
<td>None</td>
<td>Nothing has been reported on the node.</td>
</tr>
<tr>
<td>Information</td>
<td>There are informative events reported on the node.</td>
</tr>
<tr>
<td>WarningSigned</td>
<td>There are warnings reported on the node. But these warnings have been viewed by an operator.</td>
</tr>
<tr>
<td>WarningUnsigned</td>
<td>There are new or unreviewed warnings reported on the node.</td>
</tr>
<tr>
<td>ErrorSigned</td>
<td>There are errors reported on the node. But these errors have been viewed by an operator.</td>
</tr>
<tr>
<td>ErrorUnsigned</td>
<td>There are new or unreviewed errors reported on the node.</td>
</tr>
</table>
<p>
Other types of "states" are of course possible, such as phase - installation phase, test phase, production phase, etc. - but such "states" are seen as static
and presented as parameters on the node. The purpose of the dynamic state attribute of a node, is to give a dynamic runtime state that has
the possibility to change during runtime, which operators must be aware of.
</p>
<p>
The following commands have an optional attribute <strong>messages</strong>, with which they can ask the server to return any events logged on the node, giving more details of the
current state of the node:
</p>
<ul>
<li>
<strong>getNode</strong>
</li>
<li>
<strong>getNodes</strong>
</li>
<li>
<strong>getChildNodes</strong>
</li>
<li>
<strong>getAllNodes</strong>
</li>
<li>
<strong>getRootNodes</strong>
</li>
<li>
<strong>getNodesFromIndex</strong>
</li>
<li>
<strong>getNodesFromIndices</strong>
</li>
</ul>
<example caption='Get Node Messages'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='34'>
<getNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' messages='true' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='34'>
<getNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'
nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'>
<message timestamp='2013-03-21T11:06:15' type='WarningUnsigned'
eventId='ClockWarning'>Internal clock is offset more than 7 seconds.</message>
</getNodeResponse>
</iq>]]>
</example>
<p>
The <strong>messages</strong> attribute can be combined with the <strong>parameters</strong> attribute to provide both node parameters and
messages in the response.
</p>
<example caption='Get Node with parameters and messages'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='35'>
<getNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringTopology' nodeId='Node1' xml:lang='en' parameters='true' messages='true'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='35'>
<getNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'
nodeId='Node1' nodeType='Namespace.NodeType1' cacheType='Node' state='WarningUnsigned' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='Root' lastChanged='2013-03-19T17:58:01'>
<string id='id' name='Node ID' value='Node1'/>
<string id='type' name='Node Type' value='Watchamacallit Temperature Sensor v1.2'/>
<string id='sn' name='Serial Number' value='123456'/>
<string id='class' name='Node Class' value='Temperature'/>
<string id='meterLoc' name='Meter Location' value='P123502-2'/>
<int id='addr' name='Address' value='123'/>
<double id='lat' name='Latitude' value='12.345'/>
<double id='long' name='Longitude' value='123.45'/>
<message timestamp='2013-03-21T11:06:15' type='WarningUnsigned'
eventId='ClockWarning'>Internal clock is offset more than 7 seconds.</message>
</getNodeResponse>
</iq>]]>
</example>
</section3>
</section2>
<section2 topic='Creating and Destroying Nodes'>
<section3 topic='Get Addable Node Types'>
<p>
Since nodes are context sensitive, depending on node type and tree structure, before being able to create a new node, it is important to know what types of nodes
that can be added to a given node. This is done using the <strong>getAddableNodeTypes</strong> command, as is shown in the following example:
</p>
<example caption='Get Addable Node Types'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='36'>
<getAddableNodeTypes xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='B1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='36'>
<getAddableNodeTypesResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<nodeType type='Namespace.Apartment' name='Apartment'/>
<nodeType type='Namespace.MeteringTopologyReference' name='Metering Topology Reference'/>
<nodeType type='Namespace.Location' name='Service Location'/>
</getAddableNodeTypesResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Get Parameters for New Node'>
<p>
When you know what type of node you want to create, you need to get a set of parameters you need to fill in for the new node, before you can create it.
This is done using the <strong>getParametersForNewNode</strong> command, as is shown in the following example:
</p>
<example caption='Get Parameters for New Node'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='37'>
<getParametersForNewNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='B1'
type='Namespace.MeteringTopologyReference' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='37'>
<getParametersForNewNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<x type='form'
xmlns='jabber:x:data'
xmlns:xdv='http://jabber.org/protocol/xdata-validate'
xmlns:xdl='http://jabber.org/protocol/xdata-layout'
xmlns:xdd='urn:xmpp:xdata:dynamic'>
<title>Metering Topology</title>
<xdl:page label='Identity'>
<xdl:fieldref var='id'/>
<xdl:fieldref var='referenceId'/>
</xdl:page>
<field var='xdd session' type='hidden'>
<value>0B146517-8EA3-4BEC-A2E9-CF3F209D4A5D</value>
</field>
<field var='id' type='text-single' label='Node ID:'>
<desc>ID of the node.</desc>
<required/>
<value/>
</field>
<field var='referenceId' type='text-single' label='Metering Node ID:'>
<desc>ID of the node in the metering topology.</desc>
<required/>
<value/>
</field>
</x>
</getParametersForNewNodeResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Create New Node'>
<p>
After editing the form, the client uses the <strong>createNewNode</strong> command to create the new node using the parameters provided in the form.
</p>
<example caption='Create New Node after editing'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='38'>
<createNewNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='B1'
type='Namespace.MeteringTopologyReference' xml:lang='en'>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>0B146517-8EA3-4BEC-A2E9-CF3F209D4A5D</value>
</field>
<field var='id' type='text-single'>
<value>Reference to Node1</value>
</field>
<field var='referenceId' type='text-single'>
<value>Node1</value>
</field>
</x>
</createNewNode>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='38'>
<createNewNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<node nodeId='Reference to Node1' nodeType='Namespace.MeteringTopologyReference' state='None' hasChildren='false'
isReadable='true' isControllable='true' hasCommands='true' parentId='B1'>
<string id='id' name='Node ID' value='Reference to Node1'/>
<string id='type' name='Node Type' value='Metering Topology Reference'/>
<string id='referenceId' name='Reference ID' value='Node1'/>
</node>
</createNewNodeResponse>
</iq>]]>
</example>
<p>
Note that validation rules, pagination, etc., can be stripped from the form when submitting it to the server. Also the form type attribute must be set
to <strong>'submit'</strong>. Note also that as the <strong>result</strong> attribute is <strong>OK</strong>, it is assumed the server has dropped any parameter form resources
related to the form, which disables any future dynamic validation of the contents of the form. The newly created node with corresponding parameters is also returned
in the response in a <strong>node</strong> element.
</p>
</section3>
<section3 topic='Create New Node, Failure'>
<p>
The following example shows how the server responds when it cannot accept parameters provided when trying to create a node. The response will contain detailed information
about why, information which the client can use to inform the user (if any) of what went wrong.
</p>
<example caption='Create New Node, Failure'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='39'>
<createNewNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='B1'
type='Namespace.MeteringTopologyReference' xml:lang='en'>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>0B146517-8EA3-4BEC-A2E9-CF3F209D4A5D</value>
</field>
<field var='id' type='text-single'>
<value>Node2</value>
</field>
<field var='referenceId' type='text-single'>
<value>NodeX</value>
</field>
</x>
</createNewNode>
</iq>
<iq type='error'
from='concentrator@example.org'
to='client@example.org/client'
id='39'>
<createNewNodeResponse xmlns='urn:xmpp:iot:concentrators' result='FormError'>
<error var='id'>There already exists a node with this ID.</error>
<error var='referenceId'>Referenced node was not found.</error>
</createNewNodeResponse>
</iq>]]>
</example>
<p>
As the <strong>result</strong> attribute is <strong>FormError</strong>, the server maintains any parameter form resources related to the form, and features such as
dynamic validation of the contents of the form will still be available until the parameters have been successfully set, the operation has been
explicitly cancelled or a form session time-out has occurred. See <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link> for more information.
</p>
</section3>
<section3 topic='Destroy Node'>
<p>
To destroy (remove) a node from the concentrator, the <strong>destroyNode</strong> command is sent, as is shown in the following example:
</p>
<example caption='Destroy Node'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='40'>
<destroyNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='B1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='40'>
<destroyNodeResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
<p>
Since the <strong>result</strong> attribute in the response is <strong>OK</strong>, the node has been removed.
</p>
</section3>
<section3 topic='Destroy Node, Failure'>
<p>
If the <strong>result</strong> attribute in the response is other than <strong>OK</strong>, the node was not removed from the concentrator.
The <strong>result</strong> attribute contains the reason why the operation failed, as is shown in the following example:
</p>
<example caption='Destroy Node, Failure'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='41'>
<destroyNode xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='B1' xml:lang='en'/>
</iq>
<iq type='error'
from='concentrator@example.org'
to='client@example.org/client'
id='41'>
<destroyNodeResponse xmlns='urn:xmpp:iot:concentrators' result='InsufficientPrivileges'/>
</iq>]]>
</example>
</section3>
</section2>
<section2 topic='Node Commands'>
<section3 topic='Get Node Commands'>
<p>
Each node can have a context sensitive set of commands available to it. This is shown using the <strong>hasCommands</strong> attribute in the
<link url='#nodeinfo'>Node Information</link> record describing the corresponding node. If the client wants to get a list of available commands,
the <strong>getNodeCommands</strong> command is sent to the concentrator, as is shown in the following example:
</p>
<example caption='Get Node Commands'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='43'>
<getNodeCommands xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='Apartment 1-1' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='43'>
<getNodeCommandsResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<command command='knockDoor' name='Knock on door' type='Simple'
confirmationString='Are you sure you want to knock on the door?'
failureString='Unable to knock on the door.'
successString='Door knocked.'/>
<command command='scheduleWakeupCall' name='Schedule wakeup call' type='Parameterized'
failureString='Unable to schedule the wakeup call.'
successString='Wakeup call scheduled.'/>
<command command='searchEvents' name='Search events...' type='Query'
failureString='Unable to search for events.'
successString='Search for events started...'/>
</getNodeCommandsResponse>
</iq>]]>
</example>
<p>
There are three types of commands available: <strong>Simple</strong>, <strong>Parameterized</strong> and <strong>Query</strong>. <strong>Simple</strong> commands
take no parameters, and are therefore simpler to execute. <strong>Parameterized</strong> commands require the client to get a set of parameters for the corresponding
command before it can be executed. <strong>Query</strong> commands also require a set of parameters to be executed, but return a response after (or during) execution
in an asynchronous fashion. Queries can also be aborted during execution. A Query with an empty parameter set is considered to be a simple query, not requiring a
parameter dialog to be shown.
</p>
<p>
For more information about command attributes, see <link url='#nodecommands'>Node Commands</link>.
</p>
</section3>
<section3 topic='Execute Simple Node Command'>
<p>
Executing a simple command is done by sending the <strong>executeNodeCommand</strong> command to the concentrator, as is shown in the following example:
</p>
<example caption='Execute Simple Node Command'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='44'>
<executeNodeCommand xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='Apartment 1-1' command='knockDoor' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='44'>
<executeNodeCommandResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
</section3>
<section3 topic='Get Node Command Parameters'>
<p>
To execute a parameterized command or a query on the node, the client first needs to get (and edit) a set of parameters for the command. Getting a set of parameters for a
parameterized command is done as follows:
</p>
<example caption='Get Node Command Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='45'>
<getCommandParameters xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='Apartment 1-1'
command='scheduleWakeupCall' xml:lang='en'/>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='45'>
<getCommandParametersResponse xmlns='urn:xmpp:iot:concentrators' result='OK'>
<x type='form'
xmlns='jabber:x:data'
xmlns:xdv='http://jabber.org/protocol/xdata-validate'
xmlns:xdl='http://jabber.org/protocol/xdata-layout'
xmlns:xdd='urn:xmpp:xdata:dynamic'>
<title>Schedule wake-up call</title>
<field var='xdd session' type='hidden'>
<value>E14E330F-8496-46F0-8F40-178808AB13A7</value>
</field>
<field var='time' type='text-single' label='Time:'>
<desc>Time of the wake-up call.</desc>
<required/>
<value></value>
<xdv:validate datatype='xs:time'/>
<xdv:basic/>
</xdv:validate>
</field>
<field var='mode' type='list-single' label='Wake-up mode:'>
<desc>Type of wake-up call</desc>
<value>Soft</value>
<option label='Soft'><value>Soft</value></option>
<option label='Normal'><value>Normal</value></option>
<option label='Harass'><value>Harass</value></option>
</field>
</x>
</getCommandParametersResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Execute Parameterized Node Command'>
<p>
Executing a parameterized command is also done by sending the <strong>executeNodeCommand</strong> command to the concentrator, but including the edited form parameters,
as is shown in the following example:
</p>
<example caption='Execute Parameterized Node Command'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='46'>
<executeNodeCommand xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='Apartment 1-1'
command='scheduleWakeupCall' xml:lang='en'>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>E14E330F-8496-46F0-8F40-178808AB13A7</value>
</field>
<field var='time' type='text-single'>
<value>04:30:00</value>
</field>
<field var='mode' type='list-single'>
<value>Harass</value>
</field>
</x>
</executeNodeCommand>
</iq>
<iq type='result'
from='concentrator@example.org'
to='client@example.org/client'
id='46'>
<executeNodeCommandResponse xmlns='urn:xmpp:iot:concentrators' result='OK'/>
</iq>]]>
</example>
</section3>
<section3 topic='Execute Node Command, Failure'>
<p>
If an error occurs during the execution of a command or if the server rejects the execution of a command, the server returns a response code different from
<strong>OK</strong>. If the response code is <strong>FormError</strong>, the server maintains any parameter form resources related to the form, and features such as
dynamic validation of the contents of the form will still be available until the parameters have been successfully set, the operation has been
explicitly cancelled or a form session time-out has occurred. See <link url='http://xmpp.org/extensions/xep-0336.html'>XEP-0336</link> for more information.
</p>
<example caption='Execute Node Command, Failure'>
<![CDATA[
<iq type='set'
from='client@example.org/client'
to='concentrator@example.org'
id='47'>
<executeNodeCommand xmlns='urn:xmpp:iot:concentrators' sourceId='MeteringGroups' nodeId='Apartment 1-1'
command='scheduleWakeupCall' xml:lang='en'>
<x type='submit' xmlns='jabber:x:data'>
<field var='xdd session' type='hidden'>
<value>E14E330F-8496-46F0-8F40-178808AB13A7</value>
</field>
<field var='time' type='text-single'>
<value>04:30:00</value>
</field>
<field var='mode' type='list-single'>
<value>Harass</value>
</field>
</x>
</executeNodeCommand>
</iq>
<iq type='error'
from='concentrator@example.org'
to='client@example.org/client'
id='47'>
<executeNodeCommandResponse xmlns='urn:xmpp:iot:concentrators' result='FormError'>
<error var='mode'>You are not allowed to harass people at 04:30:00!</error>
</executeNodeCommandResponse>
</iq>]]>
</example>
</section3>
<section3 topic='Execute Node Query'>
<p>
Executing a Node Query also requires the client to get a set of parameters for the query. This is done in the same way as for parametrized commands,
as is shown in the following example:
</p>
<example caption='Get Node Query Parameters'>
<![CDATA[
<iq type='get'
from='client@example.org/client'
to='concentrator@example.org'
id='74'>
<getCommandParameters xmlns='urn: