Collecting data from devices
Device Management's Connect API and Notification API let you send commands to device resources - the sensors and actuators on a device - and receive data from device resources directly or through a web application.
Device Management provides a queueing and delivery mechanism that guarantees:
- Delivery of commands to devices, including low-bandwidth devices that may be available only occasionally, independent of the connectivity technology used.
- Delivery of notifications even when there are connectivity issues or load spikes.
All communication with the device is asynchronous, and Device Management delivers the result of an operation as an event through an event notification channel.
To set up communication between a user or application and a device:
Request information from the device by:
Note: You create the resource structure in the device application. For information about creating device resources with Device Management Client, please see Creating and configuring objects and resources.
Device Management stores the structure of resources for each device. Device Management caches resource values for the lifetime defined by the device application.
Device resource model
Device Management uses the LwM2M device handling logic, which is based on a hierarchical data structure of device objects and resources:
An object is collection of resources on the device. For example, it might represent an "interface" with a temperature sensor.
An object can have multiple instances.
Any piece of information from a device is a resource. A resource has either a static value (a value that never changes) or a dynamic value (a value that changes during the device's operation). A resource can also be an array with multiple values.
If a resource has array of values, these values are called resource instances.
You can read, write to or execute a resource's information.
Here is an example data structure, following the definition of the Open Mobile Alliance:
In this example:
- The device has two objects: a temperature sensor and a humidity sensor.
- The temperature sensor object has five resources. You can read their values, reset their minimum and maximum values and change the unit value.
- The device has three instances of a temperature sensor.
Objects and resources have IDs, some of which are reserved for a particular use. For example:
3is a device object.
5is a firmware object.
5700is the current measured value from the resource's sensor.
For more information about predefined object and resource names, see the Open Mobile Alliance website.