{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://dpworld/schemas/protocol_v3.json", "title": "Protocol configuration (schema v3 — nested 재설계)", "description": "Web Configurator ↔ dpworldapp 옵션 C. v2 의 정규화 + Nested grouping. ★ 큰 BC break. future ideal.", "type": "object", "required": ["schema_version", "device", "protocol"], "additionalProperties": false, "properties": { "schema_version": {"type": "integer", "const": 3}, "device": { "type": "object", "required": ["type"], "additionalProperties": false, "properties": { "type": {"type": "string", "enum": ["RTLS"], "description": "디바이스 종류."}, "version": {"type": "string", "pattern": "^v\\d+\\.\\d+(\\.\\d+)?$", "default": "v1.0"}, "equipment": { "type": "object", "additionalProperties": false, "properties": { "type": {"type": "string", "enum": ["ITV","FL","CR"]}, "id": {"type": "string", "pattern": "^\\d{2}$"}, "meid": {"type": "integer", "minimum": 0} } } } }, "protocol": { "type": "string", "enum": ["OPC-UA", "MODBUS", "CAN-BUS", "NONE"], "description": "활성 protocol." }, "features": { "type": "object", "additionalProperties": false, "description": "On/Off 기능 토글 — v2 의 dr_on/odo_on 등 boolean fields 그룹화.", "properties": { "dr": {"type": "boolean", "default": true, "description": "Dead Reckoning."}, "odo": {"type": "boolean", "default": false, "description": "Odometer."}, "heading": {"type": "boolean", "default": true, "description": "Heading 계산."}, "heading_imu": {"type": "boolean", "default": false, "description": "IMU 기반 heading."}, "fix_mode": {"type": "boolean", "default": true, "description": "Fix mode."}, "can_input": {"type": "boolean", "default": false, "description": "CAN 입력."} } }, "speed_data": { "type": "string", "enum": ["CAN", "HW", "OPC-UA", "MODBUS"], "description": "속도 데이터 source." }, "byte_order": { "type": "object", "additionalProperties": false, "description": "v2 의 two_byte_order / four_byte_order 통합 그룹.", "properties": { "two_byte": {"type": "string", "enum": ["big","little"], "default": "big"}, "four_byte": {"type": "string", "enum": ["big","little","bigSwap","littleSwap"], "default": "big"} } }, "analog_input": { "type": "object", "additionalProperties": false, "description": "Analog input level + ai0~ai3.", "properties": { "level": {"type": "string", "enum": ["2","4","6"]}, "enabled": { "type": "array", "minItems": 4, "maxItems": 4, "description": "ai0~ai3 활성 여부 (boolean 4개).", "items": {"type": "boolean"} } } }, "digital_input": { "type": "object", "additionalProperties": false, "properties": { "enabled": { "type": "array", "minItems": 4, "maxItems": 4, "description": "di0~di3 활성 여부.", "items": {"type": "boolean"} } } }, "odo": { "type": "object", "additionalProperties": false, "description": "Odometer 설정.", "properties": { "speed": {"$ref": "#/$defs/OdoField"}, "direction": {"$ref": "#/$defs/OdoField"} } }, "registers": { "type": "object", "additionalProperties": false, "description": "v2 의 OPC_UA/CAN/MODBUS upper-case array → lowercase nested 그룹.", "properties": { "opc_ua": {"type": "array", "items": {"$ref": "#/$defs/OpcUaRegister"}}, "can": {"type": "array", "items": {"$ref": "#/$defs/CanRegister"}}, "modbus": {"type": "array", "items": {"$ref": "#/$defs/ModbusRegister"}} } } }, "$defs": { "OdoField": { "type": "object", "required": ["source"], "additionalProperties": false, "properties": { "source": {"type": "string", "enum": ["CAN","HW","OPC-UA","MODBUS"]}, "id": {"type": "string", "pattern": "^0x[0-9a-fA-F]+$"}, "shift": {"type": "integer", "minimum": 0, "maximum": 63}, "mask": {"type": "string", "pattern": "^0x[0-9a-fA-F]+$"}, "expr": {"type": "string", "maxLength": 256} } }, "OpcUaRegister": { "type": "object", "required": ["field","ns","addr","odt"], "additionalProperties": false, "properties": { "field": {"type": "string"}, "ns": {"type": "integer", "minimum": 0}, "addr": {"type": "integer", "minimum": 0}, "odt": {"type": "string", "enum": ["integer","float","float64","boolean","string"]}, "dv": {"type": "integer"}, "expr": {"type": "string", "maxLength": 256} } }, "CanRegister": { "type": "object", "required": ["field","id","shift","mask","odt"], "additionalProperties": false, "properties": { "field": {"type": "string"}, "id": {"type": "string", "pattern": "^0x[0-9a-fA-F]+$"}, "shift": {"type": "integer", "minimum": 0, "maximum": 63}, "mask": {"type": "string", "pattern": "^0x[0-9a-fA-F]+$"}, "odt": {"type": "string", "enum": ["integer","float","float64","boolean","string"]}, "dv": {"type": "integer"}, "expr": {"type": "string", "maxLength": 256} } }, "ModbusRegister": { "type": "object", "required": ["field","addr","odt"], "additionalProperties": false, "properties": { "field": {"type": "string"}, "addr": {"type": "integer", "minimum": 0}, "odt": {"type": "string", "enum": ["integer","float","float64","boolean","string"]}, "dv": {"type": "integer"}, "expr": {"type": "string", "maxLength": 256} } } } }