Skip to content

C.3 JSON representation of SDT instances

C.3.1 Mapping Rules of JSON representation

This clause explains how to represent SDT instances inJSON format

Inclusion relationship of SDT instances are directly expressed as inclusion relationship of JSON hash({}). Key name is same as each class name of SDT. Value types are written in various types depending on SDT definition.

{
    "Device Class Name": {
        "SubDevice Class Name": {
            "Module Class Name": {
                "DataPointClassName": value ( by specified types in SDT)
            }
        }
    }
}

Action Class can not have any value and it only lengthen the message so it is omitted.

When a certain device does not any SubDevice Class, the tags about SubDevices Class do not appear and tags about Module Class are placed under the Device Class directly.

C.3.2 Example of JSON representation

Below is the example for deviceThreeDPrinter:

{
    "deviceThreeDPrinter": {
        "binarySwitch": {
            "powerState": true
        },
        "faultDetection": {
            "status": false,
            "code": "",
            "description": ""
        },
        "3Dprinter": {
            "printType": 2,
            "printSizeX": 70,
            "printSizeY": 80,
            "printSizeZ": 90,
            "network": true,
            "memorySize": 100
        },
        "runState": {
            "currentMachineState": 1,
            "machineStates": [1, 2, 3],
            "currentJobState": 1,
            "jobState": [1, 2, 3],
            "progressPercentage": 60,
        },
        "temperature": {
            "currentTemperature": 20,
            "targetTemperature": 23,
            "unit": "celsius",
            "minValue": 15,
            "maxValue": 28,
            "stepValue": 0.1
        },
        "printQueue":{
            "uri": "file://www.example.com/file.extension",
            "printingState": 1
        }
    }
}