{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Buttplug Device Config Schema", "version": 4, "description": "JSON format for Buttplug Device Config Files.", "components": { "uuid": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" }, "endpoint": { "type": "object", "patternProperties": { "^(command|firmware|rx|rxaccel|rxblebattery|rxblemodel|rxpressure|rxtouch|tx|txmode|txshock|txvibrate|txvendorcontrol|whitelist|generic[1-2]?[0-9]|generic3[0-1])$": { "$ref": "#/components/uuid" } }, "additionalProperties": false, "minProperties": 1 }, "btle-definition": { "type": "object", "properties": { "names": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "manufacturer_data": { "type": "array", "items": { "type": "object", "properties": { "company": { "type": "integer" }, "expected_length": { "type": "integer" }, "data": { "type": "array", "items": { "type": "integer" } } }, "required": [ "company" ] } }, "advertised_services": { "type": "array", "items": { "$ref": "#/components/uuid" } }, "services": { "type": "object", "patternProperties": { "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$": { "$ref": "#/components/endpoint" } }, "minProperties": 1, "additionalProperties": false } }, "additionalProperties": false, "required": [ "names", "services" ] }, "websocket-definition": { "type": "object", "properties": { "name": { "type": "string" } }, "additionalProperties": false, "required": [ "name" ] }, "serial-definition": { "type": "object", "properties": { "port": { "type": "string" }, "baud_rate": { "type": "integer" }, "data_bits": { "type": "integer" }, "parity": { "type": "string" }, "stop_bits": { "type": "integer" } }, "required": [ "port", "baud_rate", "data_bits", "parity", "stop_bits" ], "additionalProperties": false }, "xinput-definition": { "type": "object", "properties": { "exists": { "type": "boolean" } } }, "lovense-connect-service-definition": { "type": "object", "properties": { "exists": { "type": "boolean" } } }, "usb-definition": { "type": "object", "properties": { "pairs": { "type": "array", "items": { "type": "object", "properties": { "vendor_id": { "type": "integer", "minimum": 0, "maximum": 65535 }, "product_id": { "type": "integer", "minimum": 0, "maximum": 65535 } }, "required": [ "vendor_id", "product_id" ], "additionalProperties": false }, "minItems": 1 } }, "required": [ "pairs" ] }, "value-range": { "description": "Specifies the range of steps to use for a device. Devices will use the low end value as a stop.", "type": "array", "items": { "type": "integer" }, "minItems": 2, "maxItems": 2 }, "features": { "type": "array", "description": "Attributes for device messages.", "items": { "type": "object", "properties": { "description": { "type": "string" }, "id": { "$ref": "#/components/uuid" }, "output": { "type": "object", "patternProperties": { "^(vibrate|rotate|oscillate|constrict|spray|position|temperature|led)$": { "type": "object", "properties": { "value": { "$ref": "#/components/value-range" } }, "required": [ "value" ] }, "^position_with_duration$": { "type": "object", "properties": { "position": { "$ref": "#/components/value-range" }, "duration": { "$ref": "#/components/value-range" } }, "required": [ "position", "duration" ] } } }, "input": { "type": "object", "patternProperties": { "^(battery|rssi|pressure)$": { "type": "object", "properties": { "value_range": { "type": "array", "items": { "$ref": "#/components/value-range" }, "minItems": 1 }, "input_commands": { "type": "array", "items": { "type": "string", "pattern": "^(Read|Subscribe)$" } } }, "required": [ "value_range", "input_commands" ], "additionalProperties": false } } }, "feature_settings": { "type": "object", "properties": { "alt_protocol_index": { "type": "number" } } } }, "required": [ "id" ], "additionalProperties": false } }, "user-config-features": { "type": "array", "description": "Attributes for device messages, with additional customization for user configs.", "items": { "type": "object", "properties": { "description": { "type": "string" }, "id": { "$ref": "#/components/uuid" }, "base_id": { "$ref": "#/components/uuid" }, "output": { "type": "object", "patternProperties": { "^(vibrate|rotate|oscillate|constrict|spray|temperature|led)$": { "type": "object", "properties": { "value": { "$ref": "#/components/value-range" }, "disabled": { "type": "boolean" } } }, "^position$": { "type": "object", "properties": { "value": { "$ref": "#/components/value-range" }, "reverse": { "type": "boolean" }, "disabled": { "type": "boolean" } } }, "^position_with_duration$": { "type": "object", "properties": { "position": { "$ref": "#/components/value-range" }, "duration": { "$ref": "#/components/value-range" }, "reverse": { "type": "boolean" }, "disabled": { "type": "boolean" } } } } } }, "required": [ "base_id", "id" ], "additionalProperties": false } }, "user-config-customization": { "type": "object", "properties": { "allow": { "type": "boolean" }, "deny": { "type": "boolean" }, "display_name": { "type": "string" }, "index": { "type": "integer" } }, "additionalProperties": false, "required": [ "allow", "deny", "index" ] }, "defaults-definition": { "type": "object", "properties": { "name": { "type": "string" }, "id": { "$ref": "#/components/uuid" }, "protocol_variant": { "type": "string" }, "features": { "$ref": "#/components/features" } }, "required": [ "name", "features", "id" ] }, "configurations-definition": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "name": { "type": "string" }, "id": { "$ref": "#/components/uuid" }, "protocol_variant": { "type": "string" }, "features": { "$ref": "#/components/features" } }, "required": [ "name", "identifier", "id" ], "additionalProperties": false }, "minItems": 1 } }, "type": "object", "properties": { "version": { "description": "Version of the device configuration file.", "type": "object", "properties": { "major": { "type": "integer", "minimum": 1 }, "minor": { "type": "integer", "minimum": 0 } } }, "protocols": { "type": "object", "patternProperties": { "^.*$": { "type": "object", "properties": { "communication": { "type": "array", "items": { "type": "object", "properties": { "btle": { "$ref": "#/components/btle-definition" }, "serial": { "$ref": "#/components/serial-definition" }, "websocket": { "$ref": "#/components/websocket-definition" }, "usb": { "$ref": "#/components/usb-definition" }, "hid": { "$ref": "#/components/usb-definition" }, "xinput": { "$ref": "#/components/xinput-definition" }, "lovense_connect_service": { "$ref": "#/components/lovense-connect-service-definition" } } }, "maxProperties": 1 }, "defaults": { "$ref": "#/components/defaults-definition" }, "configurations": { "$ref": "#/components/configurations-definition" } } } }, "additionalProperties": false }, "user_configs": { "type": "object", "properties": { "protocols": { "type": "object", "patternProperties": { "^.*$": { "type": "object", "properties": { "communication": { "type": "array", "items": { "type": "object", "properties": { "btle": { "$ref": "#/components/btle-definition" }, "serial": { "$ref": "#/components/serial-definition" }, "websocket": { "$ref": "#/components/websocket-definition" }, "usb": { "$ref": "#/components/usb-definition" }, "hid": { "$ref": "#/components/usb-definition" } } }, "maxProperties": 1 }, "devices": { "type": "object", "properties": { "configurations": { "$ref": "#/components/configurations-definition" } } } } } }, "additionalProperties": false }, "devices": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "object", "properties": { "address": { "type": "string" }, "protocol": { "type": "string" }, "identifier": { "type": "string" } }, "additionalProperties": false, "required": [ "address", "protocol" ] }, "config": { "type": "object", "properties": { "name": { "type": "string" }, "id": { "$ref": "#/components/uuid" }, "base_id": { "$ref": "#/components/uuid" }, "features": { "$ref": "#/components/user-config-features" }, "user_config": { "$ref": "#/components/user-config-customization" }, "message_gap_ms": { "type": "integer", "min": 0 } }, "required": [ "id", "base_id", "features", "user_config" ], "additionalProperties": false } }, "additionalProperties": false, "required": [ "identifier", "config" ] } } }, "additionalProperties": false }, "additionalProperties": false }, "required": [ "version" ], "maxProperties": 2, "additionalProperties": false }