On this page is found detailed information about filtering and configuring the Device. The device filtering is possible to contain the device UID, name, tags and attributes. Also it is possible to change device name, add new device tags to the existing and modify device attributes.
Filtering Devices
<device-filter>
The <device-filter> is optional element and it is used to filter the devices to which the configuration to be applied. The possible ways to filter the devices are - by LDAP filter or by device properties. For this reason the <device-filter> element has two child elements – <ldap> and <device-properties>. Only one of these child elements should be available.
<ldap>
The <ldap> is an optional element, but if this element is not provided, then the <device-filter> element must be provided. The <ldap> tag has required attribute "value", that contains the LDAP filter. This value must be encoded according LDAP specification. The following examples shows LDAP filter that filters all devices that have name "Device Test Name".
<device-filter>
<ldap value="(name=Device Test Name)" />
</device-filter>
<device-properties>
The <device-properties> is an optional element, but if this element is not provided, then the <ldap> element must be provided. This element is used to represent the restrictions for the device. From the content of the <device-properties>, LDAP filter is constructed by using AND operator. The <device-properties> element has the following child elements <uid>, <name>, <tags> and <attributes>.
<uid> – an optional child element with a required attribute "value" that holds the UID of the device:<device-filter>
<device-properties>
<uid value="Device UID" />
</device-properties>
</device-filter>
<name> – an optional child element with an optional attribute "value" that holds the name of the device if the device has one. If the name of the device is null, then an attribute xsi:nil with value true is used.
Only one of the above attributes should be provided.
In the following example, the name of the device is Device Test Name:
<device-filter>
<device-properties>
<name value="Device Test Name" />
</device-properties>
</device-filter>
If the name of the device is null, then the xsi:nil attribute is used:
<device-filter>
<device-properties>
<name xsi:nil="true" />
</device-properties>
</device-filter>
<tags> – this child element is optional and it has one or many child elements <tag>. Every child element represent a tag of the device. The <tag> tag has required attribute "value" that holds representation of one device tag.<device-filter>
<device-properties>
<tags>
<tag value="Device Test Tag 1" />
<tag value="Device Test Tag 2" />
</tags>
</device-properties>
</device-filter>
<attributes> – this child element is optional and it has one or many child elements <attribute>. On Represent an object values page there is detailed information about the representation of the Device attributes.The following example will filter the devices that have these attributes: "hardware.vendor" with value "Bosch.IO" AND "hardware.version" with value "1.0.0" AND "adapter" with value "Custom Adapter":
<device-filter>
<device-properties>
<attributes>
<attribute name="hardware.vendor" value="Bosch.IO" />
<attribute name="hardware.version" value="1.0.0" />
<attribute name="adapter.name" value="Custom Adapter" />
</attributes>
<device-properties>
</device-filter>
The following example filters those devices that have name "Device Test Name" AND tag equal to "Device Test Tag" AND attribute with key "Custom Attribute" and value Map with key "Custom Attribute Value Key" and value List that have two elements "Custom Attribute Value 1" and "Custom Attribute Value 2":
<device-filter>
<device-properties>
<name value="Device Test Name" />
<tags>
<tag value="Device Test Tag" />
</tags>
<attributes>
<attribute name="Custom Attribute">
<map-value>
<element key="Custom Attribute Value Key">
<array-value>
<element value="Custom Attribute Value 1" />
<element value="Custom Attribute Value 2" />
</array-value>
</element>
</map-value>
<class value="java.util.Map">
<class value="java.util.List">
<class value="java.lang.String" />
</class>
</class>
</attribute>
<attributes>
</device-properties>
</device-filter>
Configuring Devices
<device-config>
The <device-config> is an optional element and it is used to configure those devices that match the <device-filer>. If there is no <device-filter>, the configuration should configure all devices. The <device-config> element configures the name, tags and attributes of the filtered devices. The <device-config> element has child elements – <name>, <tags> and <attributes>:
<name>The <name> element is optional and it has optional attribute "value" that holds the new name with which the device should be configured. If the device has not name, then the optional attribute xsi:nil is used with value true. Only one of these attribute should be provided.
For example the configuration of device with value null:
<device-config>
<name xsi:nil="true" />
<device-config>
<tags>The <tags> element is optional and it has one or many child elements <tag>. The <tag> has required attribute "value" that holds the value of the device tag that should be added to the existing ones.
The following example configured the device name to "Device Name Configured" and adds two new tags to the existing tags on the device or set of devices that should be configured.
<device-config>
<name value="Device Name Configured" />
<tags>
<tag value="Device Tag Configured 1" />
<tag value="Device Tag Configured 2" />
</tags>
<device-config>
<attributes>The <attributes> element is optional and it has one or many <attribute> child elements. On XML Object Representation page there is detailed information about the representation of the Device attributes.
It is possible to add new device attribute to already existing device attributes, to change existing device attribute or to remove exiting one. When the device attribute is set to null in configuration XML file, then this attribute should be deleted from the device attributes. If an attribute with the same key is already specified in the device attributes, then its value will be overridden.
For example if the device attribute "hardware.vendor" is not set correctly – "hardwarevendor", then this attribute should be deleted and replaced with the correct attribute "hardware.vendor".
<device-config>
<attributes>
<attribute name="hardwarevendor" xsi:nil="true" />
<attribute name="hardware.vendor" value="Bosch.IO" />
</attributes>
</device-config>