Add camera snapshot messages and flag for P1/A1 cameras
camera_snapshot_request (cloud to gateway) and camera_snapshot (gateway to cloud) carry one JPEG frame at a time; telemetry gains camera_snapshot and the app view gains cameraSnapshot.
This commit is contained in:
@@ -62,6 +62,11 @@ export const AppPrinterStateSchema = Type.Object({
|
||||
* calling; null means render no player at all.
|
||||
*/
|
||||
cameraStream: Type.Optional(Nullable(Type.String())),
|
||||
/**
|
||||
* True when the camera can only be read as refreshing JPEG frames (Bambu
|
||||
* P1/A1); `GET /printers/:id/stream` then answers `kind: "snapshot"`.
|
||||
*/
|
||||
cameraSnapshot: Type.Optional(Type.Boolean()),
|
||||
/**
|
||||
* When a gateway last reported this printer; null means never. This is how
|
||||
* a client tells "idle" from "nobody has heard from it in an hour", which
|
||||
|
||||
@@ -65,6 +65,11 @@ export const PrinterTelemetrySchema = Type.Object({
|
||||
* implements yet.
|
||||
*/
|
||||
camera_stream: Maybe(Type.String()),
|
||||
/**
|
||||
* The camera can only be read as single JPEG frames (Bambu P1/A1) and the
|
||||
* gateway answers `camera_snapshot_request` for it.
|
||||
*/
|
||||
camera_snapshot: Maybe(Type.Boolean()),
|
||||
layer: Maybe(Type.Integer({ minimum: 0 })),
|
||||
total_layers: Maybe(Type.Integer({ minimum: 0 })),
|
||||
remaining_minutes: Maybe(Type.Integer({ minimum: 0 })),
|
||||
@@ -296,6 +301,13 @@ export const EdgeClientMessageSchema = Type.Union([
|
||||
session_id: Type.String(),
|
||||
message: Type.String(),
|
||||
}),
|
||||
/** One JPEG frame from a `camera_snapshot_request`, or why there is none. */
|
||||
Type.Object({
|
||||
type: Type.Literal("camera_snapshot"),
|
||||
request_id: Type.String(),
|
||||
jpeg_base64: Maybe(Type.String()),
|
||||
error: Maybe(Type.String()),
|
||||
}),
|
||||
Type.Object({
|
||||
type: Type.Literal("frame_batch"),
|
||||
printer_id: Type.String(),
|
||||
@@ -367,6 +379,20 @@ export const EdgeServerMessageSchema = Type.Union([
|
||||
/** The browser's offer SDP, passed through verbatim. */
|
||||
sdp: Type.String(),
|
||||
}, { additionalProperties: false }),
|
||||
/**
|
||||
* Read one JPEG frame from a printer whose camera is not RTSP (Bambu P1/A1).
|
||||
* Unlike `webrtc_offer` the picture itself crosses the cloud: frames are
|
||||
* small and requested one at a time.
|
||||
*/
|
||||
Type.Object(
|
||||
{
|
||||
type: Type.Literal("camera_snapshot_request"),
|
||||
request_id: Type.String(),
|
||||
/** The gateway's own printer id. */
|
||||
printer_id: Type.String(),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
Type.Object({
|
||||
type: Type.Literal("command"),
|
||||
command_id: Type.String(),
|
||||
|
||||
Reference in New Issue
Block a user