feat(k1): add USB networking, device management and acquisition recovery
This commit is contained in:
@@ -13,7 +13,7 @@ from datetime import UTC, datetime
|
||||
|
||||
from .trust import PairingError
|
||||
|
||||
ACTIONS = {"scan", "networks", "connect", "verify"}
|
||||
ACTIONS = {"scan", "networks", "connect", "verify", "reset"}
|
||||
|
||||
|
||||
def validate(value):
|
||||
@@ -45,10 +45,16 @@ def validate(value):
|
||||
expected = {"device_id", "discovery_generation", "mode_revision"}
|
||||
if value["action"] == "connect":
|
||||
expected |= {"ssid", "password"}
|
||||
elif value["action"] == "reset":
|
||||
expected = {"mode_revision"}
|
||||
elif value["action"] in {"scan", "networks"}:
|
||||
expected = set()
|
||||
if not isinstance(parameters, dict) or set(parameters) != expected:
|
||||
raise PairingError("Неверные параметры подключения.")
|
||||
if value["action"] == "reset" and (
|
||||
type(parameters["mode_revision"]) is not int or parameters["mode_revision"] < 0
|
||||
):
|
||||
raise PairingError("Обновите состояние подключения.")
|
||||
if "device_id" in expected and (
|
||||
not isinstance(parameters["device_id"], str)
|
||||
or not 1 <= len(parameters["device_id"]) <= 128
|
||||
|
||||
@@ -15,6 +15,7 @@ ACTIONS = {
|
||||
"details",
|
||||
"rename",
|
||||
"verify",
|
||||
"management",
|
||||
"start",
|
||||
"replay",
|
||||
"stop",
|
||||
|
||||
Reference in New Issue
Block a user