axisevents

package module
v0.0.0-...-dcad63e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

A go library to simplify configuration of events such as record video when motion is detected. The library only targets Axis Communication cameras.

Table of contents


How to

var device = Device{
	Address:  address,
	Username: username,
	Password: password,
}

// Record video to the cameras sd-card when motion is detected.
err := NewMotionDetectionHandler("yourname", true).Record().Video().SdCard().ExecuteOn(context.TODO(), device)

// and/or

// Send a http get request when motion is detected
err := NewMotionDetectionHandler("yourname", true).HttpNotification().Notify("testing", "source=livingroom").HTTP("http://192.168.1.106", "", "", "", "", "", "", "").ExecuteOn(context.TODO(), device)

Installation

TODO

Prerequisites

The library support cameras with the following characteristics:

  • Property: Properties.API.HTTP.Version=3
  • Firmware: 5.50 and later

Documentation

Overview

Package axisevents simplifies the configuration of events such as record video to sd-card when the device detects motion detection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// With specify your Do function.
	With(do func(req *http.Request)) Command
	// ExecuteOn the event on the specified device.
	ExecuteOn(ctx context.Context, device Device) error
}

Command executes the request.

type Device

type Device struct {
	Username string
	Password string
	Address  string // Address must be in format of http://ip/ or http://hostname/ or if the device is configured for ssl https://ip/
}

Device holds the connection info for the device

type HttpNotificationHandler

type HttpNotificationHandler struct {
	// contains filtered or unexported fields
}

HttpNotificationHandler configures the querystring e.g. http://192.168.1.106?Message=testing&source=livingroom

func (*HttpNotificationHandler) Notify

func (h *HttpNotificationHandler) Notify(message string, parameters string) *RecipientsHandler

func (*HttpNotificationHandler) NotifyEmptyQueryString

func (h *HttpNotificationHandler) NotifyEmptyQueryString() *RecipientsHandler

type MotionDetectionHandler

type MotionDetectionHandler struct {
	// contains filtered or unexported fields
}

func NewMotionDetectionHandler

func NewMotionDetectionHandler(
	name string,
	enabled bool,
	version int,
) *MotionDetectionHandler

NewMotionDetectionHandler creates a new MotionDetectionHandler which is used to define what happens when a device detects motion.

Supported versions: 2,3,4 defaults to version 2 Supported actions: Record video to the device SD-card.

func (*MotionDetectionHandler) HttpNotification

func (h *MotionDetectionHandler) HttpNotification() *HttpNotificationHandler

HttpNotification sends http notifications when motion is detected.

func (*MotionDetectionHandler) Record

Record motion.

func (*MotionDetectionHandler) VideoClip

func (h *MotionDetectionHandler) VideoClip() *SendVideoClipper

Send video clip.

type RecipientsHandler

type RecipientsHandler struct {
	// contains filtered or unexported fields
}

func (*RecipientsHandler) HTTP

func (h *RecipientsHandler) HTTP(
	url string,
	username string,
	password string,
	proxy string,
	proxyPort string,
	proxyUsername string,
	proxyPassword string,
	qos string) Command

HTTP get request.

func (*RecipientsHandler) HTTPS

func (h *RecipientsHandler) HTTPS(
	url string,
	validateServerCert bool,
	username string,
	password string,
	proxy string,
	proxyPort string,
	proxyUsername string,
	proxyPassword string,
	qos string) Command

HTTP get request.

type RecordVideoHandler

type RecordVideoHandler interface {
	Video() SdCardHandler
	VideoCustom(prebuffer int, postbuffer int, streamprofile string) SdCardHandler
}

RecordVideoHandler settings for the video.

type SdCardHandler

type SdCardHandler interface {
	SdCard() Command
}

SdCardHandler record to the device sd-card.

type SendVideoClipper

type SendVideoClipper struct {
	// contains filtered or unexported fields
}

func (*SendVideoClipper) Send

func (h *SendVideoClipper) Send(
	filename string,
	customParams string,
	folder string,
	prebuffer int,
	postbuffer int,
) *RecipientsHandler

func (*SendVideoClipper) SendDefault

func (h *SendVideoClipper) SendDefault(
	filename string,
	customParams string,
) *RecipientsHandler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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