BB.Camera.Info (bb_camera v0.1.1)

Copy Markdown View Source

What BB.Camera.discover/1 reports about one camera.

There is deliberately no :options field

A camera's DSL options are where its device path, its URL and - for a network camera - its credentials live. Discovery is what a user interface enumerates to draw a list of cameras, and a struct that carried those options would put them one careless inspect away from a rendered page or a log line. Discovery reads them to call BB.Camera.stream_info/1 and keeps them.

Status

  • :declared - in the DSL, no hub alive. The robot isn't started, the sensor crashed, or the hardware isn't there. Reported rather than omitted: a camera that should exist and doesn't is exactly what an operator needs to see. stream_info is then the declared one, or nil if the driver couldn't derive one from options alone.
  • :running - hub alive, nobody watching, no capture in progress.
  • :capturing - hub alive and the driver has confirmed capture is running.

Summary

Types

status()

@type status() :: :capturing | :running | :declared

t()

@type t() :: %BB.Camera.Info{
  attached_to: {:link, atom()} | {:joint, atom()} | :robot,
  module: module(),
  name: atom(),
  path: [atom()],
  pid: pid() | nil,
  robot: module(),
  status: status(),
  stream_info: BB.Camera.StreamInfo.t() | nil,
  topic: [atom()]
}