Initial Ktor backend skeleton with ProtocolMessage DTO, REST and WebSocket

This commit is contained in:
2026-04-01 18:29:10 +03:00
parent b0a48e94bd
commit 6f3584fe6d
16 changed files with 80 additions and 19 deletions

34
.gitignore vendored
View File

@@ -1,23 +1,25 @@
# Kotlin/Java
*.class
*.jar
*.iml
/out/
# Gradle/Java/Kotlin
.gradle/
build/
out/
*.iml
# ESP32 / PlatformIO / Arduino
*.bin
*.elf
*.pio
*.pioenvs/
*.idf/
# Android
/.gradle/
/build/
/local.properties
# IDEA
.idea/
*.iws
*.ipr
# Logs
*.log
# OS
.DS_Store
Thumbs.db
# Node/npm (если есть frontend/mobile)
node_modules/
dist/
# Python (если будет)
__pycache__/
*.pyc

View File

@@ -1,2 +0,0 @@
#Mon Mar 30 18:39:06 EEST 2026
gradle.version=9.3.0

Binary file not shown.

Binary file not shown.

View File

View File

@@ -0,0 +1,13 @@
{
"v": 1,
"id": "cmd-123",
"type": "command",
"ts": 1710000000,
"deviceId": "esp32-001",
"payload": {
"command": "setRelay",
"params": {
"state": true
}
}
}

View File

@@ -0,0 +1,12 @@
{
"v": 1,
"id": "evt-123",
"type": "event",
"ts": 1710000003,
"deviceId": "esp32-001",
"payload": {
"event": "overheat",
"level": "warning",
"message": "Temperature too high"
}
}

View File

@@ -0,0 +1,12 @@
{
"v": 1,
"id": "resp-123",
"type": "response",
"ts": 1710000001,
"deviceId": "esp32-001",
"payload": {
"requestId": "cmd-123",
"status": "ok",
"data": {}
}
}

View File

@@ -0,0 +1,12 @@
{
"v": 1,
"id": "tel-123",
"type": "telemetry",
"ts": 1710000002,
"deviceId": "esp32-001",
"payload": {
"voltage": 220.5,
"current": 1.2,
"temperature": 36.6
}
}

12
protocol/schema.json Normal file
View File

@@ -0,0 +1,12 @@
{
"type": "object",
"required": ["v", "id", "type", "ts", "deviceId", "payload"],
"properties": {
"v": { "type": "integer" },
"id": { "type": "string" },
"type": { "type": "string" },
"ts": { "type": "integer" },
"deviceId": { "type": "string" },
"payload": { "type": "object" }
}
}