Retain K1 connection between scans and admit the next named acquisition

This commit is contained in:
DCCONSTRUCTIONS
2026-09-07 21:13:17 +03:00
parent ed9a77ba73
commit c6693d6f44
17 changed files with 586 additions and 274 deletions
@@ -2,19 +2,13 @@ import type {Sensor} from './runtime';
export function k1Status(device:Sensor,fresh:boolean):{label:string;tone:'neutral'|'success'|'warning'|'danger'} {
if(!fresh)return {label:'Нет свежих сведений с БК',tone:'neutral'};
if(device.control?.phase==='completed'&&device.snapshot.acquisition==='idle')return {label:'Устройство остановлено',tone:'neutral'};
if(!device.online||!device.verified)return device.control?.network_applied
?{label:'Wi-Fi настроен · нет управления',tone:'warning'}:{label:'Связь не подтверждена',tone:'neutral'};
if(device.snapshot.acquisition==='failed')return {label:'Ошибка захвата',tone:'danger'};
if(device.snapshot.acquisition==='streaming')return {label:'Идёт захват',tone:'success'};
if(['preparing','starting'].includes(device.snapshot.acquisition))return {label:'Запускается',tone:'neutral'};
if(device.snapshot.acquisition==='stopping')return {label:'Останавливается',tone:'neutral'};
return {label:device.control?.can_start?'Готов к запуску':'Подключён',tone:'success'};
?{label:'Нет связи с K1',tone:'warning'}:{label:'Связь не подтверждена',tone:'neutral'};
return {label:'Подключён',tone:'success'};
}
export function k1ConnectionNotice(device:Sensor,fresh:boolean):string {
if(!fresh)return 'Нет свежих сведений с БК. Ожидаем восстановления связи.';
if(device.control?.phase==='completed')return 'Устройство остановлено. Проверьте связь с K1 перед следующим запуском; повторно вводить настройки Wi-Fi не нужно.';
if(device.control?.reason_code==='application_authority_unavailable')
return 'Wi-Fi настроен. Служба K1 на БК не смогла авторизовать подключение. Обновите интеграцию K1 на БК и проверьте состояние устройства.';
return device.control?.network_applied
@@ -1516,13 +1516,14 @@ export function useXgridsK1Runtime(enabled: boolean) {
);
}
if (["idle", "closed", "completed"].includes(phase)) {
if (["idle", "closed"].includes(phase)) {
throw new ApiError(
"K1 ещё не подключён. Сначала завершите подключение устройства в «Парке».",
);
}
if (phase === "connection-ready") {
if (phase === "connection-ready" || (phase === "completed"
&& nextState.application_control_session?.control_socket_open === true)) {
const physical = nextState.application_control_session?.physical_command
?? nextState.physical_command;
if (physical?.requires_reconciliation === true) {
+2 -2
View File
@@ -22,7 +22,7 @@ from credential_install import PROFILE_ID, validate # noqa: E402
from debian import package # noqa: E402
from runtime_payload import files as runtime_files # noqa: E402
VERSION = "0.1.12"
VERSION = "0.1.13"
RESOURCES = (
"plugins/xgrids-k1/profile_loader.py",
"plugins/xgrids-k1/plugin.manifest.json",
@@ -135,7 +135,7 @@ Architecture: amd64
Maintainer: NODE.DC local build <noreply@example.invalid>
Section: admin
Priority: optional
Depends: mission-core-node (>= 0.8.12), mission-core-node (<< 0.9.0),
Depends: mission-core-node (>= 0.8.13), mission-core-node (<< 0.9.0),
systemd, python3, adduser, bluez, network-manager, iproute2, ffmpeg
Breaks: mission-core-node (<< 0.8.0)
Replaces: mission-core-node (<< 0.8.0)