BSB Developer Docs
Loading...
Searching...
No Matches
Appendix 3: Input Event Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"key": {
"type": "string",
"enum": ["encoder", "ok", "start", "back"],
"description": "Name of the control that produced the event"
},
"action": {
"type": "string",
"enum": ["press", "release", "short", "long", "repeat", "clockwise", "counterclockwise"],
"description": "Type of the event that occurred"
},
"delta": {
"type": "integer",
"description": "For the encoder wheel only: number of clicks (negative is counterclockwise)"
}
},
"required": ["key", "action"],
"oneOf": [
{ "$ref": "#/$defs/button" },
{ "$ref": "#/$defs/encoder" }
],
"$defs": {
"button": {
"properties": {
"key": { "enum": ["ok", "start", "back"] },
"action": { "enum": ["press", "release", "short", "long", "repeat"] }
},
"not": { "required": ["delta"] },
"if": {
"properties": { "key": { "const": "back" } }
},
"then": {
"properties": { "action": { "not": { "const": "long" } } }
}
},
"encoder": {
"properties": {
"key": { "const": "encoder" },
"action": { "enum": ["clockwise", "counterclockwise"] }
},
"required": ["delta"],
"if": {
"properties": { "action": { "const": "clockwise" } }
},
"then": {
"properties": { "delta": { "const": 1 } }
},
"else": {
"properties": { "delta": { "const": -1 } }
}
}
}
}