Identifiers are used to identify and implicity describe device properties, events and measurements.
The ID can be decoded by reading bytes one by one, up to 4 bytes maximum:
- If byte value is in the range 0x00 - 0x7F, append this byte and stop
- If byte value is in the range 0x80 - 0xFF, append this byte and go to the next byte
- 0x05 - One byte ID
- 0x7E - One byte ID
- 0x8000 - Two byte ID
- 0xEF10 - Two byte ID
- 0xEE8001 - Three byte ID
The ID implies the value type. This type can be a simple value type or a composite/structure type. In short, the identifier describes:
- What it is
- Format of the data (if there is any data associated)
Common types and their representation:
|JSON Data Type
|1 byte of value 0 or 1
|1 byte (signed)
|1 byte (unsigned)
|2 bytes (signed)
|2 bytes (unsigned)
|4 bytes (signed)
|4 bytes (unsigned)
|6 bytes (unsigned)
|UTF-8 encoded string
|4 bytes (float)
|6 bytes (unsigned)
Multi-byte types are always encoded as big-endian.
Dictionary Value Type
Sometimes an identifier value only makes sense as a collection of values, some of which may be optional. In these cases the value can be represented using a dictionary type. The format of the dictionary type is as follows:
- KEY is a byte used to identify the dictionary entry
- LENGTH is a byte indicating the length of VALUE that follows (in bytes)
Key-value pairs shall be ordered by KEY.
The value for an identifier can be extended in the future. To ensure backwards compatibility it is important to allow for extra bytes at the end of the value byte-array when parsing/validating. Value extensions are typically used to extend common types.
Identifier Translation and JSON encoding
A gateway can support translation of raw hex identifiers and byte-array value to a human readable name and a corresponding JSON encoded value.
The dictionary used for translation has a version number, starting at 1. In the identifier description, the translation dictionary version number where it was added is in parenthesis behind the human-readable name.
A specific firmware version of a gateway implements a version of the dictionary.
Value extensions will always be encoded as a JSON object.
When the translation to JSON is obvious from the value type, there will be no JSON description.
Most device properties are reported automatically at a predefined interval. For most devices this interval be 20 minutes. Some properties are not reported and they must be read explicitly.
If 0x9810 - Whitelist Key property's reported value is No it means that the device will not report 0x9810 - Whitelist Key property every 20 minutes. For example, MT Wristband 211 property 0x9810 - Whitelist Key's reported value is Yes, so MT Wristband 211 will send the property's details every 20 minutes.