onvif

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 28 Imported by: 0

README

Go-ONVIF

Go-ONVIF is a Go package for communicating with network camera which supports the ONVIF specifications. ONVIF (Open Network Video Interface) is an open industry forum promoting and developing global standards for interfaces of IP-based physical security products such as network cameras. Recently, almost all network cameras support ONVIF specifications, especially network camera that made in China, which usually can bought with cheap price.

Progress

This package is still in develoment following guide from ONVIF, with several features already available.

License

Go-ONVIF is distributed using MIT license, which means you can use it however you want as long as you preserve copyright and license notices of this package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug logs a message at level Debug on the standard logger.

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs a message at level Debug on the standard logger.

func Debugln

func Debugln(args ...interface{})

Debugln logs a message at level Debug on the standard logger.

func Error

func Error(args ...interface{})

Error logs a message at level Error on the standard logger.

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs a message at level Error on the standard logger.

func Errorln

func Errorln(args ...interface{})

Errorln logs a message at level Error on the standard logger.

func Fatal

func Fatal(args ...interface{})

Fatal logs a message at level Fatal on the standard logger.

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf logs a message at level Fatal on the standard logger.

func Fatalln

func Fatalln(args ...interface{})

Fatalln logs a message at level Fatal on the standard logger.

func Info

func Info(args ...interface{})

Info logs a message at level Info on the standard logger.

func Infof

func Infof(format string, args ...interface{})

Infof logs a message at level Info on the standard logger.

func Infoln

func Infoln(args ...interface{})

Infoln logs a message at level Info on the standard logger.

func Panic

func Panic(args ...interface{})

Panic logs a message at level Panic on the standard logger.

func Panicf

func Panicf(format string, args ...interface{})

Panicf logs a message at level Panic on the standard logger.

func Panicln

func Panicln(args ...interface{})

Panicln logs a message at level Panic on the standard logger.

func Print

func Print(args ...interface{})

Print logs a message at level Info on the standard logger.

func Printf

func Printf(format string, args ...interface{})

Printf logs a message at level Info on the standard logger.

func Println

func Println(args ...interface{})

Println logs a message at level Info on the standard logger.

func Set

func Set(level string) error

func Warn

func Warn(args ...interface{})

Warn logs a message at level Warn on the standard logger.

func Warnf

func Warnf(format string, args ...interface{})

Warnf logs a message at level Warn on the standard logger.

func Warnln

func Warnln(args ...interface{})

Warnln logs a message at level Warn on the standard logger.

Types

type AudioEncoderConfig

type AudioEncoderConfig struct {
	Name           string
	Token          string
	Encoding       string
	Bitrate        int
	SampleRate     int
	SessionTimeout string
}

AudioEncoderConfig contains configuration of an audio encoder

type DateTime added in v0.0.10

type DateTime struct {
	Time Time_
	Date Date_
}

type Date_ added in v0.0.10

type Date_ struct {
	Year  int
	Month int
	Day   int
}

type Device

type Device struct {
	ID       string
	Name     string
	MACAddr  string
	XAddr    string
	User     string
	Password string
	Services map[string]Service
}

Device contains data of ONVIF camera

func StartDiscovery

func StartDiscovery(duration time.Duration) ([]*Device, error)

StartDiscovery send a WS-Discovery message and wait for all matching device to respond

func StartDiscoveryWithContext

func StartDiscoveryWithContext(ctx context.Context, addrs []net.Addr, duration time.Duration) ([]*Device, error)

func (*Device) GetCapabilities

func (device *Device) GetCapabilities() (DeviceCapabilities, error)

GetCapabilities fetch info of ONVIF camera's capabilities

func (*Device) GetDiscoveryMode

func (device *Device) GetDiscoveryMode() (string, error)

GetDiscoveryMode fetch network discovery mode of an ONVIF camera

func (*Device) GetHostname

func (device *Device) GetHostname() (HostnameInformation, error)

GetHostname fetch hostname of an ONVIF camera

func (*Device) GetImagingSettings

func (device *Device) GetImagingSettings(videoSourceToken string) (ImagingSettings, error)

GetImagingSettings fetch the ImagingConfiguration for the requested VideoSource.

func (*Device) GetInformation

func (device *Device) GetInformation() (DeviceInformation, error)

GetInformation fetch information of ONVIF camera

func (*Device) GetNTP added in v0.0.10

func (device *Device) GetNTP() (NTPInformation, error)

func (*Device) GetNetworkInterfaces

func (device *Device) GetNetworkInterfaces() (NetworkInterfaces, error)

GetNetworkInterfaces fetches the Network Interfaces of an ONVIF camera

func (Device) GetNetworkProtocols

func (device Device) GetNetworkProtocols() ([]NetworkProtocol, error)

GetNetworkProtocols fetches the network protocols that you can access the device on.

func (*Device) GetOSDs

func (device *Device) GetOSDs() ([]OSD, error)

GetStreamURI fetch stream URI of a media profile. Possible protocol is UDP, HTTP or RTSP

func (*Device) GetProfiles

func (device *Device) GetProfiles() ([]MediaProfile, error)

GetProfiles fetch available media profiles of ONVIF camera

func (*Device) GetScopes

func (device *Device) GetScopes() ([]string, error)

GetScopes fetch scopes of an ONVIF camera

func (*Device) GetServices

func (device *Device) GetServices() (services []Service, err error)

GetNetworkInterfaces fetches the Network Interfaces of an ONVIF camera

func (*Device) GetStreamURI

func (device *Device) GetStreamURI(profileToken, protocol string) (MediaURI, error)

GetStreamURI fetch stream URI of a media profile. Possible protocol is UDP, HTTP or RTSP

func (*Device) GetSystemDateAndTime added in v0.0.10

func (device *Device) GetSystemDateAndTime() (SystemDateAndTime, error)

func (*Device) SetAudioEncoderConfiguration

func (device *Device) SetAudioEncoderConfiguration(config AudioEncoderConfig) error

func (*Device) SetDeviceName added in v0.0.8

func (device *Device) SetDeviceName(name, location string) error

func (*Device) SetHostname

func (device *Device) SetHostname(name string) error

func (*Device) SetImagingSettings added in v0.0.12

func (device *Device) SetImagingSettings(exposureTime string) error

func (*Device) SetNTP

func (device *Device) SetNTP(ntpServer string) error

func (*Device) SetNetworkInterfaces added in v0.0.11

func (device *Device) SetNetworkInterfaces() error

func (*Device) SetOSD

func (device *Device) SetOSD(token string, text string) error

func (*Device) SetOSD1

func (device *Device) SetOSD1(token string, text string) error

func (*Device) SetSystemDateAndTime

func (device *Device) SetSystemDateAndTime(useNTP bool, t time.Time) error

func (*Device) SetVideoEncoderConfiguration

func (device *Device) SetVideoEncoderConfiguration(config VideoEncoderConfig) error

func (*Device) SetVideoEncoderConfiguration1

func (device *Device) SetVideoEncoderConfiguration1(config VideoEncoderConfig) error

type DeviceCapabilities

type DeviceCapabilities struct {
	Network   NetworkCapabilities
	Events    map[string]bool
	Streaming map[string]bool
}

DeviceCapabilities contains capabilities of an ONVIF camera

type DeviceInformation

type DeviceInformation struct {
	FirmwareVersion string
	HardwareID      string
	Manufacturer    string
	Model           string
	SerialNumber    string
}

DeviceInformation contains information of ONVIF camera

type ErrNewUnsupportedError

type ErrNewUnsupportedError OnvifErr

func NewUnsupportedError

func NewUnsupportedError(subCode, detail string) ErrNewUnsupportedError

func (ErrNewUnsupportedError) Error

func (e ErrNewUnsupportedError) Error() string

type ErrOperationProhibited

type ErrOperationProhibited OnvifErr

func NewErrOperationProhibited

func NewErrOperationProhibited(detail string) ErrOperationProhibited

func (ErrOperationProhibited) Error

func (e ErrOperationProhibited) Error() string

type Exposure20

type Exposure20 struct {
	Mode            string  `json:"Mode"`
	Priority        string  `json:"Priority"`
	MinExposureTime float64 `json:"MinExposureTime"`
	MaxExposureTime float64 `json:"MaxExposureTime"`
	MinGain         float64 `json:"MinGain"`
	MaxGain         float64 `json:"MaxGain"`
	MinIris         float64 `json:"MinIris"`
	MaxIris         float64 `json:"MaxIris"`
	ExposureTime    float64 `json:"ExposureTime"`
	Gain            float64 `json:"Gain"`
	Iris            float64 `json:"Iris"`
}

type FocusConfiguration20

type FocusConfiguration20 struct {
	AutoFocusMode string  `json:"AutoFocusMode"`
	DefaultSpeed  float64 `json:"DefaultSpeed"`
	NearLimit     float64 `json:"NearLimit"`
	FarLimit      float64 `json:"FarLimit"`
}

type FromDHCP

type FromDHCP struct {
	Address      string
	PrefixLength string
}

type HostnameInformation

type HostnameInformation struct {
	Name     string
	FromDHCP bool
}

HostnameInformation contains hostname info of an ONVIF camera

type IPv4

type IPv4 struct {
	Enabled    string
	IPv4Config IPv4Config `json:"Config"`
}

type IPv4Config

type IPv4Config struct {
	DHCP     string
	FromDHCP FromDHCP `json:"FromDHCP"`
}

type ImagingSettings

type ImagingSettings struct {
	BacklightCompensation ModeAndLevel
	Brightness            float64 `json:"Brightness"`
	ColorSaturation       float64 `json:"ColorSaturation"`
	Contrast              float64 `json:"Contrast"`
	Exposure              Exposure20
	Focus                 FocusConfiguration20
	IrCutFilter           string  `json:"IrCutFilter"`
	Sharpness             float64 `json:"Sharpness"`
	WideDynamicRange      ModeAndLevel
	WhiteBalance          WhiteBalance20
}

type Level

type Level uint8

type MediaBounds

type MediaBounds struct {
	Height int
	Width  int
}

MediaBounds contains resolution of a video media

type MediaProfile

type MediaProfile struct {
	Name               string
	Token              string
	VideoSourceConfig  MediaSourceConfig
	VideoEncoderConfig VideoEncoderConfig
	AudioSourceConfig  MediaSourceConfig
	AudioEncoderConfig AudioEncoderConfig
	PTZConfig          PTZConfig
}

MediaProfile contains media profile of an ONVIF camera

type MediaSourceConfig

type MediaSourceConfig struct {
	Name        string
	Token       string
	SourceToken string
	Bounds      MediaBounds
}

MediaSourceConfig contains configuration of a media source

type MediaURI

type MediaURI struct {
	URI                 string
	Timeout             string
	InvalidAfterConnect bool
	InvalidAfterReboot  bool
}

MediaURI contains streaming URI of an ONVIF camera

type ModeAndLevel

type ModeAndLevel struct {
	Mode  string  `json:"Mode"`
	Level float64 `json:"Level"`
}

type NTPInformation added in v0.0.10

type NTPInformation struct {
	FromDHCP    bool
	NTPFromDHCP NetworkHost
	NTPManual   NetworkHost
}

type NetworkCapabilities

type NetworkCapabilities struct {
	DynDNS     bool
	IPFilter   bool
	IPVersion6 bool
	ZeroConfig bool
}

NetworkCapabilities contains networking capabilities of ONVIF camera

type NetworkHost added in v0.0.10

type NetworkHost struct {
	Type        string
	IPv4Address string
	IPv6Address string
	DNSname     string
}

type NetworkInfo

type NetworkInfo struct {
	HwAddress string
}

type NetworkInterfaces

type NetworkInterfaces struct {
	Enabled string
	IPv4    IPv4
	// IPv6    IPv6
	Info NetworkInfo
}

type NetworkProtocol

type NetworkProtocol struct {
	Enabled bool
	Name    string
	Port    int64
}

type NetworkProtocolsResponse

type NetworkProtocolsResponse struct {
	NetworkProtocols []networkProtocol `json:"NetworkProtocols"`
}

type OSD

type OSD struct {
	Token            string
	VideoSourceToken string
	Type             string
	Pos              Position
	Text             TextString
}

type OSDColor

type OSDColor struct {
	Transparent int
}

type OnvifErr

type OnvifErr struct {
	Detail string
	// contains filtered or unexported fields
}

type PTZConfig

type PTZConfig struct {
	Name      string
	Token     string
	NodeToken string
}

PTZConfig contains configuration of a PTZ control in camera

type PosXY

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

MediaOSDS contains streaming URI of an ONVIF camera

type Position

type Position struct {
	Type string
	Pos  PosXY
}

type SOAP

type SOAP struct {
	Body     string
	XMLNs    []string
	User     string
	Password string
	TokenAge time.Duration
	//authHeaders func(method string) []string
	AuthHeaders string
	URI         string
	Method      string
}

SOAP contains data for SOAP request

func (*SOAP) SendRequest

func (soap *SOAP) SendRequest(xaddr string) (mxj.Map, error)

SendRequest sends SOAP request to xAddr

type Service

type Service struct {
	NameSpace string
	XAddr     string
	Version   Version
}

type SystemDateAndTime added in v0.0.10

type SystemDateAndTime struct {
	DateTimeType    string
	DaylightSavings bool
	TimeZone        TimeZone_
	UTCDateTime     DateTime
	LocalDateTime   DateTime
}

type TextString

type TextString struct {
	IsPersistentText bool
	Type             string
	DateFormat       string
	TimeFormat       string
	FontSize         int
	FontColor        OSDColor
	BackgroundColor  OSDColor
	PlainText        string
}

type TimeZone_ added in v0.0.10

type TimeZone_ struct {
	TZ string
}

type Time_ added in v0.0.10

type Time_ struct {
	Hour   int
	Minute int
	Second int
}

type Version

type Version struct {
	Major int
	Minor int
}

type VideoEncoderConfig

type VideoEncoderConfig struct {
	Name           string
	Token          string
	Encoding       string
	Quality        int
	GovLength      int
	RateControl    VideoRateControl
	Resolution     MediaBounds
	SessionTimeout string
}

VideoEncoderConfig contains configuration of a video encoder

type VideoRateControl

type VideoRateControl struct {
	BitrateLimit     int
	EncodingInterval int
	FrameRateLimit   int
	ConstantBitRate  bool
}

VideoRateControl contains rate control of a video

type WhiteBalance20

type WhiteBalance20 struct {
	Mode   string  `json:"Mode"`
	CrGain float64 `json:"CrGain"`
	CbGain float64 `json:"CbGain"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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