Add adaptive per-vehicle layouts, full-panel dragging, source controls and automatic preview recovery for RealSense, Insta360 X4 and XGRIDS K1 observation views. Integrate cached Cesium map layers through the private NAS gateway link, retain bounded sensor command receipts, and document validation and operational handoff.
19 lines
1.3 KiB
TypeScript
19 lines
1.3 KiB
TypeScript
import {perform,type Sensor,type SensorTransport} from '../../../../packages/sensor-ui/src/contracts';
|
|
import {currentObservationDevice,observationOperation} from '../../../../packages/sensor-ui/src/observationStart';
|
|
import {cameraStatus} from './model';
|
|
|
|
export function startX4Observation(device:Sensor,transport:SensorTransport,restart=false){
|
|
return observationOperation(device,async()=>{
|
|
let current=await currentObservationDevice(device,transport);let status=cameraStatus(current);
|
|
if(!status.connected)throw new Error('Камера не подключена.');
|
|
if(status.preview===1&&!restart)return;
|
|
if(restart){
|
|
if(status.recording!==0)throw new Error('Не удалось восстановить просмотр во время записи.');
|
|
if(status.preview===1)await perform(transport,current,'preview.stop');
|
|
current=await currentObservationDevice(device,transport);status=cameraStatus(current);
|
|
if(status.recording!==0)throw new Error('Состояние записи изменилось. Повторите просмотр после её завершения.');
|
|
}else if(status.preview!==0)throw new Error('Состояние просмотра пока не подтверждено.');
|
|
await perform(transport,current,'preview.start');
|
|
});
|
|
}
|