Minimize contract, add ADC read and send its data to coonsole

This commit is contained in:
2026-04-13 00:04:48 +03:00
parent 732a2dfa32
commit 977227296e
12 changed files with 269 additions and 67 deletions

View File

@@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "contract/ingest/common.schema.json",
"type": "object",
"required": ["v", "id", "type", "ts", "deviceId", "payload"],
"required": ["v", "t", "id", "ts", "d", "p"],
"additionalProperties": false,
"properties": {
"v": {
@@ -10,28 +10,68 @@
"const": 1
},
"id": {
"type": "string",
"minLength": 1
"type": "integer",
"minimum": 1,
"maximum": 4294967295,
"description": "Autoincrement message id. Unique per session"
},
"type": {
"t": {
"type": "string",
"enum": ["telemetry", "event"]
"enum": ["t", "e", "c"],
"description": "Message type (<t>elemetry, <e>vent, <c>ommand)"
},
"ts": {
"type": "integer",
"minimum": 1600000000000,
"description": "Unix time in milliseconds (UTC)"
"minimum": 1600000000,
"description": "Unix time in seconds (UTC)"
},
"deviceId": {
"type": "string",
"minLength": 1
"d": {
"type": "integer",
"minimum": 1,
"description": "Device ID. Unique per scope"
},
"payload": {
"type": "object"
},
"meta": {
"p": {
"type": "object",
"additionalProperties": true
"description": "User data. Type-specific."
}
}
},
"allOf": [
{
"if": {
"required": ["t"],
"properties": { "t": { "const": "t" } }
},
"then": {
"required": ["p"],
"properties": {
"p": { "$ref": "telemetry.schema.json" }
}
}
},
{
"if": {
"required": ["t"],
"properties": { "t": { "const": "e" } }
},
"then": {
"required": ["p"],
"properties": {
"p": { "$ref": "event.schema.json" }
}
}
},
{
"if": {
"required": ["t"],
"properties": { "t": { "const": "c" } }
},
"then": {
"required": ["p"],
"properties": {
"p": { "$ref": "command.schema.json" }
}
}
}
]
}