alarms

package
v0.2.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package alarms follows a camera's own detection state: it holds a Baichuan session subscribed to alarm events (message 31, then 33 pushes) and reports each change -- motion starting or stopping, an object type appearing or going away. It only listens; nothing on the camera changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Watch

func Watch(ctx context.Context, camera string, dial func(context.Context) (*baichuan.Conn, error), fn func(Change))

Watch follows one camera until ctx ends, reconnecting with backoff, and calls fn for every change. A lost connection ends whatever was on, so a listener is never left believing motion continues.

Types

type Change

type Change struct {
	Camera string
	Time   time.Time
	// Kind is "motion" or an object type; On says it started.
	Kind string
	On   bool
}

Change is one transition.

type State

type State struct {
	Motion bool
	// Objects are the AI types the camera names, normalized: person,
	// vehicle, animal, face, package, visitor.
	Objects []string
}

State is what a camera currently reports.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL