The sensor data model in XMPP is similar to how we treated sensor data in previous chapters. Each device maintains a collection of timestamps; each one is comprised of a set of fields, as shown in Figure 1. The model also allows for measurement or communication errors to be reported. Apart from a value, each field also has a name, optional localization information, field type information, quality of service information, and custom annotations. In a later chapter, we will build on this model by introducing the concept of nodes, where a device can be said to host a set of nodes, or virtual devices:
There are different kinds of fields that can be represented in this model. They all share the aforementioned common properties, but represent the corresponding value differently:
Representation |
Description |
Physical Quantity |
Represents a floating-point numerical value (xsd:double) together with a string (xsd:string) unit value. The number of decimals used in the representation corresponds to the precision of the value. |
String |
Value encoded as xsd:string. |
Boolean |
Value encoded as xsd:boolean. |
Date |
Value encoded as xsd:date. |
DateTime |
Value encoded as xsd:dateTime. |
Duration |
Value encoded as xsd:duration. |
Enumeration |
Represents a string value (xsd:string) from a discrete enumeration. The enumeration is defined using a type attribute (xsd:string). |
Int32 |
Value encoded as xsd:int. |
Int64 |
Value encoded as xsd:long. |
Time |
Value encoded as xsd:time. |