monitor

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: MIT Imports: 17 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) 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) Stop

func (a *Alert) Stop()

Stop 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"`
	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"`
}

Config contains the parameters for Monitor

func NewConfig

func NewConfig(configPath string) *Config

NewConfig creates a new Config

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) GetReaderInStats

func (m *Monitor) GetReaderInStats() *videosource.VideoStats

GetReaderInStats returns the reader source stats

func (*Monitor) GetReaderOutStats

func (m *Monitor) GetReaderOutStats() *videosource.VideoStats

GetReaderOutStats returns the reader output 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) 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(key string) <-chan videosource.ProcessedImage

Subscribe to video images

func (*Monitor) Unsubscribe

func (m *Monitor) Unsubscribe(key string)

Unsubscribe 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"`
}

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