Documentation ¶
Index ¶
- type LiveCameras
- func (s *LiveCameras) CameraAdded(id int64)
- func (s *LiveCameras) CameraChanged(id int64)
- func (s *LiveCameras) CameraFromID(id int64) *camera.Camera
- func (s *LiveCameras) CameraRemoved(id int64)
- func (s *LiveCameras) Cameras() []*camera.Camera
- func (s *LiveCameras) CloseTestCamera()
- func (s *LiveCameras) ConfigurationChanged()
- func (s *LiveCameras) Run()
- func (s *LiveCameras) SaveTestCamera(cfg configdb.Camera, cam *camera.Camera)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LiveCameras ¶
type LiveCameras struct { ShutdownComplete chan bool // ShutdownComplete is closed when we are done shutting down // contains filtered or unexported fields }
LiveCameras manages the list of running cameras. It runs a single thread that is responsible for starting and stopping cameras. Coordination with other systems happens primarily through the configuration database. LiveCameras wakes up every few seconds to see if the current running cameras match the configuration. If anything is out of sync, then cameras are stopped, started, or restarted, as needed. This same system also detects when cameras have stopped sending us packets, in which case the camera is taken offline, and we will then attempt to restart it.
Lock Hierarchy (to avoid deadlocks): If you are going to hold camerasLock and recordStateLock at the same time, then you must first take camerasLock, and then recordStateLock.
func NewLiveCameras ¶
func NewLiveCameras(logger logs.Log, configDB *configdb.ConfigDB, shutdown chan bool, monitor *monitor.Monitor, archive *fsv.Archive, ringBufferSize int) *LiveCameras
Create a new LiveCameras object. archive can be nil, in which case we can't record. shutdown is a channel that the parent system will close when it wants us to shutdown.
func (*LiveCameras) CameraAdded ¶
func (s *LiveCameras) CameraAdded(id int64)
func (*LiveCameras) CameraChanged ¶
func (s *LiveCameras) CameraChanged(id int64)
func (*LiveCameras) CameraFromID ¶
func (s *LiveCameras) CameraFromID(id int64) *camera.Camera
Get camera from ID
func (*LiveCameras) CameraRemoved ¶
func (s *LiveCameras) CameraRemoved(id int64)
func (*LiveCameras) Cameras ¶
func (s *LiveCameras) Cameras() []*camera.Camera
Return a list of running cameras
func (*LiveCameras) CloseTestCamera ¶
func (s *LiveCameras) CloseTestCamera()
func (*LiveCameras) ConfigurationChanged ¶
func (s *LiveCameras) ConfigurationChanged()
If any configuration might have changed, then wake up the auto starter
func (*LiveCameras) Run ¶
func (s *LiveCameras) Run()
Start the runner thread, which is the only thread that starts and stops cameras
func (*LiveCameras) SaveTestCamera ¶
func (s *LiveCameras) SaveTestCamera(cfg configdb.Camera, cam *camera.Camera)