One very useful aspect of Device Management on the Digi Device Cloud is the ability to view the Connection History of a device. This of course refers to the connection history of that device as viewed from Device Cloud, and is a record of a device’s connections and disconnections with the server, for whatever reason.
Device Cloud Connection History (from the device UI):
Getting the Connection History from the Data Streams API:
As seen above, the Connection History of a device is something which Device Cloud keeps track of. A screen like the one above may be useful when wanting to know the current state of a device or what’s been going on with it, but short of taking a screenshot or copying/pasting that information into a text file, the information isn’t very portable. The good news is, the Connection History is something which is also tracked as a Data Stream, and each of the Connect/Disconnect events is a separate Data Point within that Stream.
To query the Data Stream Connection History if the same device, we must query for the Data Points which make up that Stream as follows:
Example Request: /ws/DataPoint/00000000-00000000-00409DFF-FF5DF1CB/management/connections/
Response (for a single Data Point of the Stream):
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
As can be seen in the <resultSize> field, there were 206 Data Points in the response to the query, so I’ve only listed one Data Point as an example of the type of data retrieved from the Connection History Data Stream.