Skip to main content

Module camera

Module camera 

Source
Expand description

The built-in (printer chamber) camera seam for the server — distinct from the external IP-camera proxy, which is just a URL on super::AppState. Live mode grabs a JPEG over TCP:6000 (see crate::camera); fake / no-target mode has no built-in camera. Abstracted as a trait so the server stays testable without a real printer.

Structs§

ExternalCamera
One configured external IP camera: a human label plus the snapshot URL the server proxies. The URL is an internal LAN address kept server-side — it’s only exposed on the gated config endpoint, never on the open camera listing.
LiveCamera
Live built-in camera: a one-shot TCP:6000 grab against the printer.
NoCamera
No built-in camera — fake mode, or bambu serve without a printer target.
OpenedCameraStream
An opened MJPEG stream: the upstream content-type (which carries the multipart boundary) plus a blocking reader over the long-lived body.

Traits§

CameraSource
Source of built-in-camera frames.

Functions§

open_mjpeg_stream
Open url’s MJPEG stream (blocking): connect and return the content-type plus a reader over the endless multipart body. A connect timeout bounds the handshake and a per-read timeout ends a stalled stream, but there is deliberately no overall timeout — the stream is meant to be endless. Shared by the HTTP reverse-proxy and the plain-timelapse stream recorder.
url_stream_opener
A StreamOpen that re-opens url on each call.

Type Aliases§

StreamOpen
Opens a camera’s MJPEG stream on demand. A closure, not a URL, so a recorder can reconnect (re-open) without knowing the source and tests can inject a fake that yields canned readers.