Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update parsing of device config file, add user config loading
Update the device configuration format to match the new array based config file, and add the ability to merge user configurations for adding local serial ports. Fixes #64
- Loading branch information
Showing
2 changed files
with
196 additions
and
30 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
buttplug/dependencies/buttplug-device-config/buttplug-user-device-config-schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"title": "Buttplug User Device Config Schema", | ||
"version": 2, | ||
"description": "JSON format for Buttplug User Created 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}$" | ||
}, | ||
"serial-definition": { | ||
"type": "array", | ||
"items": { | ||
"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 | ||
}, | ||
"minItems": 1 | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"protocols": { | ||
"type": "object", | ||
"patternProperties": { | ||
"^.*$": { | ||
"type": "object", | ||
"properties": { | ||
"serial": { | ||
"$ref": "#/components/serial-definition" | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"required": [ | ||
"protocols" | ||
], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters