A camera implementation with no camera and no WebRTC, for testing the
dashboard's side of the BB.LiveView.Camera seam.
config :bb_liveview, :camera, BB.LiveView.SyntheticCameraCameras are whatever it was started with. Watching one hands the test the stream, and the test plays the camera's half of the signalling, so it can see exactly what the dashboard asked for and answer it, with nothing to wait for:
{:synthetic_camera, {:watching, camera, stream, opts}}is sent to the reporting process when the dashboard starts watchingcamera;to_browser/2sends a signalling message from the "camera" to the dashboard, as a WebRTC sink would;{:synthetic_camera, {:from_browser, camera, message}}reports each message the dashboard passes back;end_stream/1ends a stream, as a camera stopping would;{:synthetic_camera, {:unwatched, camera, stream}}reports the dashboard letting go.
to_browser/2 and end_stream/1 send straight from the test to the
watching process, so anything the test asks of that process afterwards is
answered with the message already handled.
Summary
Functions
Returns a specification to start this module under a supervisor.
Ends a stream, as a camera stopping would.
Changes a camera's status, standing in for a robot starting or a sensor dying.
Starts the synthetic camera.
Sends a signalling message from the camera's side of stream to the dashboard.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec end_stream(stream()) :: :ok
Ends a stream, as a camera stopping would.
@spec set_status(atom(), :capturing | :running | :declared) :: :ok
Changes a camera's status, standing in for a robot starting or a sensor dying.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the synthetic camera.
Options
:cameras— required, a list of camera specifications. Each is a map of:robot,:name, and optionally:path,:attached_to,:status(:capturing | :running | :declared) and:stream.:available?— whether a camera package is installed,trueby default;falsestands in for an application withoutbb_camera.:webrtc?— whether streaming is available,trueby default;falsestands in for an application withoutbb_camera_webrtc.:report_to— the process to send events to.
Sends a signalling message from the camera's side of stream to the dashboard.