axisevents

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

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

Go to latest
Published: Jun 25, 2018 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 interface {
	// NotifyEmptyQueryString will set an empty query string
	NotifyEmptyQueryString() RecipientsHandler
	// Notify message = testing, parameters = source=livingroom will give the result Message=testing&source=livingroom
	Notify(message string, parameters string) RecipientsHandler
}

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

type MotionDetectionHandler

type MotionDetectionHandler interface {
	// Send http notifications when motion is detected.
	HttpNotification() HTTPNotificationHandler
	// Record motion.
	Record() RecordVideoHandler
}

MotionDetectionHandler defines operations to use when a device detects motion.

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.

type RecipientsHandler

type RecipientsHandler interface {
	// Http get request.
	HTTP(url string, username string, password string, proxy string, proxyPort string, proxyUsername string, proxyPassword string, qos string) Command
}

RecipientsHandler definies recipients such as http, https etc.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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