monitor

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxTextFileSize = 300000 // 300 KB

	NewLine = "<br>"
)

Alert Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	LastAlert AlertTimes
	// contains filtered or unexported fields
}

Alert buffers ProcessedImages and sends notifications

func NewAlert

func NewAlert(name string, notifier *notify.Notify, notifyRxConf *notify.RxConfig, saveDirectory string, alertConf *AlertConfig) *Alert

NewAlert creates a new Alert

func (*Alert) Close added in v1.37.0

func (a *Alert) Close()

Close the processes

func (*Alert) Push

func (a *Alert) Push(img *videosource.ProcessedImage)

Push a processed image to buffer

func (*Alert) Start

func (a *Alert) Start()

Start the processes

func (*Alert) Wait

func (a *Alert) Wait()

Wait until done

type AlertConfig

type AlertConfig struct {
	IntervalMinutes           int  `yaml:"intervalMinutes,omitempty"`
	MaxImagesPerInterval      int  `yaml:"maxImagesPerInterval,omitempty"`
	MaxSendAttachmentsPerHour int  `yaml:"maxSendAttachmentsPerHour,omitempty"`
	SaveQuality               int  `yaml:"saveQuality,omitempty"`
	SaveOriginal              bool `yaml:"saveOriginal,omitempty"`
	SaveHighlighted           bool `yaml:"saveHighlighted,omitempty"`
	SaveObjectsCount          int  `yaml:"saveObjectsCount,omitempty"`
	SaveFacesCount            int  `yaml:"saveFacesCount,omitempty"`
	TextAttachments           bool `yaml:"textAttachments,omitempty"`
	DeleteAfterHours          int  `yaml:"deleteAfterHours,omitempty"`
	DeleteAfterGB             int  `yaml:"deleteAfterGB,omitempty"`
}

AlertConfig contains the parameters for alert notification settings

func NewAlertConfig

func NewAlertConfig(configPath string) *AlertConfig

NewAlertConfig creates a new AlertConfig

type AlertTimes

type AlertTimes struct {
	Object time.Time
	Person time.Time
	Face   time.Time
}

AlertTimes for alerts

type Config

type Config struct {
	Filename           string `yaml:"filename,omitempty"`
	URL                string `yaml:"url,omitempty"`
	MaxSourceFps       int    `yaml:"maxSourceFps,omitempty"`
	MaxOutputFps       int    `yaml:"maxOutputFps,omitempty"`
	Quality            int    `yaml:"quality,omitempty"`
	StaleTimeout       int    `yaml:"staleTimeout,omitempty"`
	StaleMaxRetry      int    `yaml:"staleMaxRetry,omitempty"`
	BufferSeconds      int    `yaml:"bufferSeconds,omitempty"`
	MotionFilename     string `yaml:"motion,omitempty"`
	TensorFilename     string `yaml:"tensor,omitempty"`
	CaffeFilename      string `yaml:"caffe,omitempty"`
	FaceFilename       string `yaml:"face,omitempty"`
	NotifyRxFilename   string `yaml:"notifyRx,omitempty"`
	AlertFilename      string `yaml:"alert,omitempty"`
	RecordFilename     string `yaml:"record,omitempty"`
	ContinuousFilename string `yaml:"continuous,omitempty"`
}

Config contains the parameters for Monitor

func NewConfig

func NewConfig(configPath string) *Config

NewConfig creates a new Config

type Continuous added in v1.18.0

type Continuous struct {
	ContinuousConf *ContinuousConfig
	// contains filtered or unexported fields
}

Continuous buffers ProcessedImages and writes to disk

func NewContinuous added in v1.18.0

func NewContinuous(name string, saveDirectory string, continuousConf *ContinuousConfig, outFps int) *Continuous

NewContinuous creates a new Continuous

func (*Continuous) Close added in v1.18.0

func (c *Continuous) Close()

Close notified by caller that input stream is done/closed

func (*Continuous) Send added in v1.18.0

func (c *Continuous) Send(img *videosource.ProcessedImage)

Send a processed image to buffer

func (*Continuous) Start added in v1.18.0

func (c *Continuous) Start()

Start the processes

func (*Continuous) Wait added in v1.18.0

func (c *Continuous) Wait()

Wait until done

type ContinuousConfig added in v1.18.0

type ContinuousConfig struct {
	TimeoutSec       int    `yaml:"timeoutSec,omitempty"`
	MaxSec           int    `yaml:"maxSec,omitempty"`
	DeleteAfterHours int    `yaml:"deleteAfterHours,omitempty"`
	DeleteAfterGB    int    `yaml:"deleteAfterGB,omitempty"`
	Codec            string `yaml:"codec,omitempty"`
	FileType         string `yaml:"fileType,omitempty"`
	BufferSeconds    int    `yaml:"bufferSeconds,omitempty"`
	PortableOnly     bool   `yaml:"portableOnly,omitempty"`
}

ContinuousConfig contains the parameters for record settings

func NewContinuousConfig added in v1.18.0

func NewContinuousConfig(configPath string) *ContinuousConfig

NewContinuousConfig creates a new ContinuousConfig

type Map

type Map map[string]*Monitor

Map is a map of names to Monitor

type Monitor

type Monitor struct {
	Name string

	ConfigPaths []string

	StaleRetry    int
	StaleMaxRetry int
	IsStale       bool
	// contains filtered or unexported fields
}

Monitor contains the video source

func NewMonitor

func NewMonitor(name string, reader *videosource.VideoReader) *Monitor

NewMonitor creates a new Monitor

func (*Monitor) GetAlertTimes

func (m *Monitor) GetAlertTimes() (result AlertTimes)

GetAlertTimes returns the alert times

func (*Monitor) GetMonitorFrameStats added in v1.26.0

func (m *Monitor) GetMonitorFrameStats(timeoutMs int) (result *videosource.FrameStatsCombo)

GetMonitorFrameStats returns the monitor's frame stats

func (*Monitor) SetAlert

func (m *Monitor) SetAlert(notifier *notify.Notify, notifyRxConf *notify.RxConfig, saveDirectory string, alertConf *AlertConfig)

SetAlert sets the alert notification

func (*Monitor) SetBufferSeconds added in v1.22.0

func (m *Monitor) SetBufferSeconds(sec int)

func (*Monitor) SetContinuous added in v1.18.0

func (m *Monitor) SetContinuous(saveDirectory string, continuousConf *ContinuousConfig)

SetContinuous sets the continuous recording

func (*Monitor) SetFace

func (m *Monitor) SetFace(config *face.Config)

SetFace sets the Face Config

func (*Monitor) SetMotion

func (m *Monitor) SetMotion(config *motion.Config)

SetMotion sets the Motion Config

func (*Monitor) SetRecord

func (m *Monitor) SetRecord(saveDirectory string, recordConf *RecordConfig)

SetRecord sets the recorder

func (*Monitor) SetStaleConfig

func (m *Monitor) SetStaleConfig(timeout int, maxRetry int)

SetStaleConfig sets the stale configuration

func (*Monitor) SetTensor

func (m *Monitor) SetTensor(config *tensor.Config)

SetTensor sets the Tensor Config

func (*Monitor) Start

func (m *Monitor) Start()

Start will run the processes

func (*Monitor) Stop

func (m *Monitor) Stop()

Stop will stop the processes

func (*Monitor) Subscribe

func (m *Monitor) Subscribe() (result *pubsubmutex.Subscriber)

Subscribe to video images

func (*Monitor) Wait

func (m *Monitor) Wait()

Wait until done

type Record

type Record struct {
	RecordConf *RecordConfig
	// contains filtered or unexported fields
}

Record buffers ProcessedImages and writes to disk

func NewRecord

func NewRecord(name string, saveDirectory string, recordConf *RecordConfig, outFps int) *Record

NewRecord creates a new Record

func (*Record) Close

func (r *Record) Close()

Close notified by caller that input stream is done/closed

func (*Record) Send

func (r *Record) Send(img *videosource.ProcessedImage)

Send a processed image to buffer

func (*Record) Start

func (r *Record) Start()

Start the processes

func (*Record) Wait

func (r *Record) Wait()

Wait until done

type RecordConfig

type RecordConfig struct {
	RecordObjects    bool   `yaml:"recordObjects,omitempty"`
	MaxPreSec        int    `yaml:"maxPreSec,omitempty"`
	TimeoutSec       int    `yaml:"timeoutSec,omitempty"`
	MaxSec           int    `yaml:"maxSec,omitempty"`
	DeleteAfterHours int    `yaml:"deleteAfterHours,omitempty"`
	DeleteAfterGB    int    `yaml:"deleteAfterGB,omitempty"`
	Codec            string `yaml:"codec,omitempty"`
	FileType         string `yaml:"fileType,omitempty"`
	BufferSeconds    int    `yaml:"bufferSeconds,omitempty"`
	PortableOnly     bool   `yaml:"portableOnly,omitempty"`
}

RecordConfig contains the parameters for record settings

func NewRecordConfig

func NewRecordConfig(configPath string) *RecordConfig

NewRecordConfig creates a new RecordConfig

Jump to

Keyboard shortcuts

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