Share the K1 live scene template and preserve idle media channels
This commit is contained in:
@@ -151,9 +151,21 @@ class NodeK1Sensor:
|
||||
await self.peers.close(params.get("peer_id"))
|
||||
return {"ok": True}
|
||||
if action == "offer":
|
||||
if item["snapshot"]["acquisition"] != "streaming":
|
||||
raise ValueError("Acquisition is not active")
|
||||
return await self.peers.offer(params)
|
||||
acquisition_id = item["control"]["acquisition_id"]
|
||||
if (item["snapshot"]["acquisition"] != "streaming" or not acquisition_id
|
||||
or params.get("acquisition_id") != acquisition_id):
|
||||
raise ValueError("Acquisition is not active or changed")
|
||||
answer = await self.peers.offer(params)
|
||||
# Signalling may outlive STOP or a replacement acquisition. Retire
|
||||
# that disposable preview instead of attaching it to another run.
|
||||
current = project_sensor(await self.raw_state(), node_id)
|
||||
if (current is None or current["snapshot"]["acquisition"] != "streaming"
|
||||
or current["snapshot"]["context"]["session_id"]
|
||||
!= command["session"]["session_id"]
|
||||
or current["control"]["acquisition_id"] != acquisition_id):
|
||||
await self.peers.close(answer["peer_id"])
|
||||
raise ValueError("Acquisition changed during preview signalling")
|
||||
return answer
|
||||
async with self.bridge.lock:
|
||||
if datetime.fromisoformat(command["deadline_at"]) <= datetime.now(UTC):
|
||||
raise ValueError("Command expired before dispatch")
|
||||
|
||||
Reference in New Issue
Block a user