Measurement Data Types
The data map of a MeasurementComponent is polymorphic: depending on the component type it holds a single value, an embedded file, or a file reference. All variants share a common set of base keys.
Base keys (all data records)
| Property | CBOR key | JSON key | Type | Description |
|---|---|---|---|---|
| — | class |
— | string | Type discriminator, see below. Only present in the binary (CBOR) encoding. |
| ClassType | classType |
class |
string | Logical type of the record: "SingleMeasurement" or "FileReference". |
| Version | version |
ver |
integer | Schema version of the data record. Currently 1. |
| ValueType | valueType |
valueType |
string | .NET type name of the value, e.g. "System.Double", "System.Int32". |
| SerializedValue | serializedValue |
value |
string | The value serialized as a JSON string, e.g. "42.42". |
| Value | value |
— | any | The value encoded natively (number, string, map, …). Only present in the binary (CBOR) encoding. |
The key
classmeans different things in the two encodings, and so doesvalue:
- In the binary (CBOR) encoding,
classis the type discriminator (the internal record name, e.g."SingleMeasurementDataGenericDto","FileReferenceDataGenericDto"or"FileBinaryDataGenericDto") and the logical type lives inclassType. The native value lives invalue, and the JSON-serialized copy inserializedValue.- In the JSON Variant,
classholds the logical type ("SingleMeasurement"/"FileReference") andvalueholds the JSON-serialized value string. There is no separate discriminator or native value.
When reading a binary RAE file, use class to select the concrete record type. To read the value itself you can usually use the native value directly; the reference implementation reconstructs it from serializedValue + valueType.
SingleMeasurementData
Used with single components. It adds no keys beyond the base keys — the measurement value lives in value / serializedValue. The value is typically a number, but any JSON-serializable type is allowed (valueType tells you what it is).
Example (CBOR diagnostic notation):
{
"class": "SingleMeasurementDataGenericDto",
"classType": "SingleMeasurement",
"version": 1,
"valueType": "System.Double",
"serializedValue": "87.3",
"value": 87.3
}
FileReferenceData
Used with fileReference components. It describes a file without embedding its content:
| Property | CBOR key | JSON key | Type | Description |
|---|---|---|---|---|
| FileIdentifier | fileIdentifier |
fileId |
string | Identifier of the file. |
| Filename | filename |
name |
string | Original file name. |
| MimeType | mimeType |
type |
string | MIME type of the file content (e.g. "image/png", "image/x-raw"). |
| HashData | hashData |
hash |
map | Hash of the file content, see below. |
| Metadata | metadata |
meta |
map | File metadata, see below. |
The HashData map:
| Property | CBOR key | JSON key | Type | Description |
|---|---|---|---|---|
| Algorithm | algorithm |
alg |
string (enum) | Hash algorithm. Currently "sha256". |
| Hash | hash |
hash |
string | The hash value. |
The FileMetadata map:
| Property | CBOR key | JSON key | Type | Description |
|---|---|---|---|---|
| Author | author |
author |
string | Author of the file. |
| Created | created |
created |
string (ISO 8601) | Creation time of the file. |
FileBinaryData
Used with file components. It extends FileReferenceData by embedding the file content:
| Property | CBOR key | JSON key | Type | Description |
|---|---|---|---|---|
| BinaryData | binaryData |
bin |
byte string | The raw file content. In the binary encoding this is a CBOR byte string; in the JSON Variant it is Base64-encoded. |
Device images returned by Elements Hub use this record — see Measurement Image Formats for the image encodings and how to decode the image/x-raw payload.
Example (CBOR diagnostic notation, binary data shortened):
{
"class": "FileBinaryDataGenericDto",
"classType": "FileReference",
"version": 1,
"valueType": null,
"serializedValue": null,
"value": null,
"fileIdentifier": "surfaceImage",
"filename": "surfaceImage.png",
"mimeType": "image/png",
"hashData": null,
"metadata": null,
"binaryData": h'89504E470D0A1A0A...'
}