onvif

package module
v0.0.0-...-582ba90 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 26 Imported by: 0

README

Onvif library

Simple management of onvif IP-devices cameras. onvif is an implementation of ONVIF protocol for managing onvif IP devices. The purpose of this library is convenient and easy management of IP cameras and other devices that support ONVIF standard.

Overview

This repository is forked from: use-go/onvif

Supported services

The following services are implemented:

  • Device
  • Media
  • PTZ
  • Event
  • Discovery

Using

General concept
  1. Connecting to the device
  2. Authentication (if necessary)
  3. Defining Data Types
  4. Carrying out the required method
Connecting to the device

If there is a device on the network at the address 192.168.13.42, and its ONVIF services use the 1234 port, then you can connect to the device in the following way:

dev, err := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.13.42:1234"})

The ONVIF port may differ depending on the device , to find out which port to use, you can go to the web interface of the device. Usually this is 80 port.

Authentication

If any function of the ONVIF services requires authentication, you must use the Authenticate method.

device := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.13.42:1234", Username: "username", Password: password})
Defining Data Types

Each ONVIF service in this library has its own package, in which all data types of this service are defined, and the package name is identical to the service name and begins with a capital letter. onvif defines the structures for each function of each ONVIF service supported by this library. Define the data type of the GetCapabilities function of the Device service. This is done as follows:

capabilities := device.GetCapabilities{Category:"All"}

Why does the GetCapabilities structure have the Category field and why is the value of this field All?

The figure below shows the documentation for the GetCapabilities. It can be seen that the function takes one Category parameter and its value should be one of the following: 'All', 'Analytics',' Device ',' Events', 'Imaging', 'Media' or 'PTZ'`.

Device GetCapabilities

An example of defining the data type of GetServiceCapabilities function in PTZ:

ptzCapabilities := ptz.GetServiceCapabilities{}

The figure below shows that GetServiceCapabilities does not accept any arguments.

PTZ GetServiceCapabilities

Common data types are in the xsd/onvif package. The types of data (structures) that can be shared by all services are defined in the onvif package.

An example of how to define the data type of the CreateUsers function in Devicemgmt:

createUsers := device.CreateUsers{User: onvif.User{Username:"admin", Password:"qwerty", UserLevel:"User"}}

The figure below shows that ,in this example, the CreateUsers structure field must be a User whose data type is the User structure containing the Username, Password, UserLevel, and optional Extension fields. The User structure is in the onvif package.

Device CreateUsers

Carrying out the required method

To perform any function of one of the ONVIF services whose structure has been defined, you must use the CallMethod of the device object.

createUsers := device.CreateUsers{User: onvif.User{Username:"admin", Password:"qwerty", UserLevel:"User"}}
device := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.13.42:1234", Username: "username", Password: password})
device.Authenticate("username", "password")
resp, err := dev.CallMethod(createUsers)

Development

See here

Documentation

Overview

Package onvif is developed to provide an ONVIF client implementation on Go programming language

Index

Constants

View Source
const (
	DigestAuth        = "digest"
	UsernameTokenAuth = "usernametoken"
	Both              = "both"
	NoAuth            = "none"
)

Onvif Auth Mode

View Source
const (
	AnalyticsWebService = "Analytics"
	DeviceWebService    = "Device"
	EventWebService     = "Event"
	ImagingWebService   = "Imaging"
	MediaWebService     = "Media"
	Media2WebService    = "Media2"
	PTZWebService       = "PTZ"
	RecordingWebService = "Recording"
)

Onvif WebService

View Source
const (
	CreateAnalyticsModules       = "CreateAnalyticsModules"
	CreateRules                  = "CreateRules"
	DeleteAnalyticsModules       = "DeleteAnalyticsModules"
	DeleteRules                  = "DeleteRules"
	GetAnalyticsModuleOptions    = "GetAnalyticsModuleOptions"
	GetAnalyticsModules          = "GetAnalyticsModules"
	GetRuleOptions               = "GetRuleOptions"
	GetRules                     = "GetRules"
	GetSupportedAnalyticsModules = "GetSupportedAnalyticsModules"
	GetSupportedRules            = "GetSupportedRules"
	ModifyAnalyticsModules       = "ModifyAnalyticsModules"
	ModifyRules                  = "ModifyRules"
)

WebService - Analytics

View Source
const (
	AddIPAddressFilter            = "AddIPAddressFilter"
	AddScopes                     = "AddScopes"
	CreateCertificate             = "CreateCertificate"
	CreateDot1XConfiguration      = "CreateDot1XConfiguration"
	CreateStorageConfiguration    = "CreateStorageConfiguration"
	CreateUsers                   = "CreateUsers"
	DeleteCertificates            = "DeleteCertificates"
	DeleteDot1XConfiguration      = "DeleteDot1XConfiguration"
	DeleteGeoLocation             = "DeleteGeoLocation"
	DeleteStorageConfiguration    = "DeleteStorageConfiguration"
	DeleteUsers                   = "DeleteUsers"
	GetAccessPolicy               = "GetAccessPolicy"
	GetCACertificates             = "GetCACertificates"
	GetCapabilities               = "GetCapabilities"
	GetCertificateInformation     = "GetCertificateInformation"
	GetCertificates               = "GetCertificates"
	GetCertificatesStatus         = "GetCertificatesStatus"
	GetClientCertificateMode      = "GetClientCertificateMode"
	GetDNS                        = "GetDNS"
	GetDPAddresses                = "GetDPAddresses"
	GetDeviceInformation          = "GetDeviceInformation"
	GetDiscoveryMode              = "GetDiscoveryMode"
	GetDot11Capabilities          = "GetDot11Capabilities"
	GetDot11Status                = "GetDot11Status"
	GetDot1XConfiguration         = "GetDot1XConfiguration"
	GetDot1XConfigurations        = "GetDot1XConfigurations"
	GetDynamicDNS                 = "GetDynamicDNS"
	GetEndpointReference          = "GetEndpointReference"
	GetGeoLocation                = "GetGeoLocation"
	GetHostname                   = "GetHostname"
	GetIPAddressFilter            = "GetIPAddressFilter"
	GetNTP                        = "GetNTP"
	GetNetworkDefaultGateway      = "GetNetworkDefaultGateway"
	GetNetworkInterfaces          = "GetNetworkInterfaces"
	GetNetworkProtocols           = "GetNetworkProtocols"
	GetPkcs10Request              = "GetPkcs10Request"
	GetRelayOutputs               = "GetRelayOutputs"
	GetRemoteDiscoveryMode        = "GetRemoteDiscoveryMode"
	GetRemoteUser                 = "GetRemoteUser"
	GetScopes                     = "GetScopes"
	GetServiceCapabilities        = "GetServiceCapabilities"
	GetServices                   = "GetServices"
	GetStorageConfiguration       = "GetStorageConfiguration"
	GetStorageConfigurations      = "GetStorageConfigurations"
	GetSystemBackup               = "GetSystemBackup"
	GetSystemDateAndTime          = "GetSystemDateAndTime"
	GetSystemLog                  = "GetSystemLog"
	GetSystemSupportInformation   = "GetSystemSupportInformation"
	GetSystemUris                 = "GetSystemUris"
	GetUsers                      = "GetUsers"
	GetWsdlUrl                    = "GetWsdlUrl"
	GetZeroConfiguration          = "GetZeroConfiguration"
	LoadCACertificates            = "LoadCACertificates"
	LoadCertificateWithPrivateKey = "LoadCertificateWithPrivateKey"
	LoadCertificates              = "LoadCertificates"
	RemoveIPAddressFilter         = "RemoveIPAddressFilter"
	RemoveScopes                  = "RemoveScopes"
	RestoreSystem                 = "RestoreSystem"
	ScanAvailableDot11Networks    = "ScanAvailableDot11Networks"
	SendAuxiliaryCommand          = "SendAuxiliaryCommand"
	SetAccessPolicy               = "SetAccessPolicy"
	SetCertificatesStatus         = "SetCertificatesStatus"
	SetClientCertificateMode      = "SetClientCertificateMode"
	SetDNS                        = "SetDNS"
	SetDPAddresses                = "SetDPAddresses"
	SetDiscoveryMode              = "SetDiscoveryMode"
	SetDot1XConfiguration         = "SetDot1XConfiguration"
	SetDynamicDNS                 = "SetDynamicDNS"
	SetGeoLocation                = "SetGeoLocation"
	SetHostname                   = "SetHostname"
	SetHostnameFromDHCP           = "SetHostnameFromDHCP"
	SetIPAddressFilter            = "SetIPAddressFilter"
	SetNTP                        = "SetNTP"
	SetNetworkDefaultGateway      = "SetNetworkDefaultGateway"
	SetNetworkInterfaces          = "SetNetworkInterfaces"
	SetNetworkProtocols           = "SetNetworkProtocols"
	SetRelayOutputSettings        = "SetRelayOutputSettings"
	SetRelayOutputState           = "SetRelayOutputState"
	SetRemoteDiscoveryMode        = "SetRemoteDiscoveryMode"
	SetRemoteUser                 = "SetRemoteUser"
	SetScopes                     = "SetScopes"
	SetStorageConfiguration       = "SetStorageConfiguration"
	SetSystemDateAndTime          = "SetSystemDateAndTime"
	SetSystemFactoryDefault       = "SetSystemFactoryDefault"
	SetUser                       = "SetUser"
	SetZeroConfiguration          = "SetZeroConfiguration"
	StartFirmwareUpgrade          = "StartFirmwareUpgrade"
	StartSystemRestore            = "StartSystemRestore"
	SystemReboot                  = "SystemReboot"
	UpgradeSystemFirmware         = "UpgradeSystemFirmware"
)

WebService - Device

View Source
const (
	CreatePullPointSubscription = "CreatePullPointSubscription"
	GetEventProperties          = "GetEventProperties"
	PullMessages                = "PullMessages"
	Renew                       = "Renew"
	Seek                        = "Seek"
	SetSynchronizationPoint     = "SetSynchronizationPoint"
	Subscribe                   = "Subscribe"
	SubscriptionReference       = "SubscriptionReference"
	Unsubscribe                 = "Unsubscribe"
)

WebService - Event

View Source
const (
	GetCurrentPreset   = "GetCurrentPreset"
	GetImagingSettings = "GetImagingSettings"
	GetMoveOptions     = "GetMoveOptions"
	GetOptions         = "GetOptions"
	GetPresets         = "GetPresets"
	GetStatus          = "GetStatus"
	Move               = "Move"
	SetCurrentPreset   = "SetCurrentPreset"
	SetImagingSettings = "SetImagingSettings"
	Stop               = "Stop"
)

WebService - Imaging

View Source
const (
	AddAudioDecoderConfiguration               = "AddAudioDecoderConfiguration"
	AddAudioEncoderConfiguration               = "AddAudioEncoderConfiguration"
	AddAudioOutputConfiguration                = "AddAudioOutputConfiguration"
	AddAudioSourceConfiguration                = "AddAudioSourceConfiguration"
	AddMetadataConfiguration                   = "AddMetadataConfiguration"
	AddPTZConfiguration                        = "AddPTZConfiguration"
	AddVideoAnalyticsConfiguration             = "AddVideoAnalyticsConfiguration"
	AddVideoEncoderConfiguration               = "AddVideoEncoderConfiguration"
	AddVideoSourceConfiguration                = "AddVideoSourceConfiguration"
	CreateOSD                                  = "CreateOSD"
	CreateProfile                              = "CreateProfile"
	DeleteOSD                                  = "DeleteOSD"
	DeleteProfile                              = "DeleteProfile"
	GetAudioDecoderConfiguration               = "GetAudioDecoderConfiguration"
	GetAudioDecoderConfigurationOptions        = "GetAudioDecoderConfigurationOptions"
	GetAudioDecoderConfigurations              = "GetAudioDecoderConfigurations"
	GetAudioEncoderConfiguration               = "GetAudioEncoderConfiguration"
	GetAudioEncoderConfigurationOptions        = "GetAudioEncoderConfigurationOptions"
	GetAudioEncoderConfigurations              = "GetAudioEncoderConfigurations"
	GetAudioOutputConfiguration                = "GetAudioOutputConfiguration"
	GetAudioOutputConfigurationOptions         = "GetAudioOutputConfigurationOptions"
	GetAudioOutputConfigurations               = "GetAudioOutputConfigurations"
	GetAudioOutputs                            = "GetAudioOutputs"
	GetAudioSourceConfiguration                = "GetAudioSourceConfiguration"
	GetAudioSourceConfigurationOptions         = "GetAudioSourceConfigurationOptions"
	GetAudioSourceConfigurations               = "GetAudioSourceConfigurations"
	GetAudioSources                            = "GetAudioSources"
	GetCompatibleAudioDecoderConfigurations    = "GetCompatibleAudioDecoderConfigurations"
	GetCompatibleAudioEncoderConfigurations    = "GetCompatibleAudioEncoderConfigurations"
	GetCompatibleAudioOutputConfigurations     = "GetCompatibleAudioOutputConfigurations"
	GetCompatibleAudioSourceConfigurations     = "GetCompatibleAudioSourceConfigurations"
	GetCompatibleMetadataConfigurations        = "GetCompatibleMetadataConfigurations"
	GetCompatibleVideoAnalyticsConfigurations  = "GetCompatibleVideoAnalyticsConfigurations"
	GetCompatibleVideoEncoderConfigurations    = "GetCompatibleVideoEncoderConfigurations"
	GetCompatibleVideoSourceConfigurations     = "GetCompatibleVideoSourceConfigurations"
	GetGuaranteedNumberOfVideoEncoderInstances = "GetGuaranteedNumberOfVideoEncoderInstances"
	GetMetadataConfiguration                   = "GetMetadataConfiguration"
	GetMetadataConfigurationOptions            = "GetMetadataConfigurationOptions"
	GetMetadataConfigurations                  = "GetMetadataConfigurations"
	GetOSD                                     = "GetOSD"
	GetOSDOptions                              = "GetOSDOptions"
	GetOSDs                                    = "GetOSDs"
	GetProfile                                 = "GetProfile"
	GetProfiles                                = "GetProfiles"
	GetSnapshotUri                             = "GetSnapshotUri"
	GetStreamUri                               = "GetStreamUri"
	GetVideoAnalyticsConfiguration             = "GetVideoAnalyticsConfiguration"
	GetVideoAnalyticsConfigurations            = "GetVideoAnalyticsConfigurations"
	GetVideoEncoderConfiguration               = "GetVideoEncoderConfiguration"
	GetVideoEncoderConfigurationOptions        = "GetVideoEncoderConfigurationOptions"
	GetVideoEncoderConfigurations              = "GetVideoEncoderConfigurations"
	GetVideoSourceConfiguration                = "GetVideoSourceConfiguration"
	GetVideoSourceConfigurationOptions         = "GetVideoSourceConfigurationOptions"
	GetVideoSourceConfigurations               = "GetVideoSourceConfigurations"
	GetVideoSourceModes                        = "GetVideoSourceModes"
	GetVideoSources                            = "GetVideoSources"
	RemoveAudioDecoderConfiguration            = "RemoveAudioDecoderConfiguration"
	RemoveAudioEncoderConfiguration            = "RemoveAudioEncoderConfiguration"
	RemoveAudioOutputConfiguration             = "RemoveAudioOutputConfiguration"
	RemoveAudioSourceConfiguration             = "RemoveAudioSourceConfiguration"
	RemoveMetadataConfiguration                = "RemoveMetadataConfiguration"
	RemovePTZConfiguration                     = "RemovePTZConfiguration"
	RemoveVideoAnalyticsConfiguration          = "RemoveVideoAnalyticsConfiguration"
	RemoveVideoEncoderConfiguration            = "RemoveVideoEncoderConfiguration"
	RemoveVideoSourceConfiguration             = "RemoveVideoSourceConfiguration"
	SetAudioDecoderConfiguration               = "SetAudioDecoderConfiguration"
	SetAudioEncoderConfiguration               = "SetAudioEncoderConfiguration"
	SetAudioOutputConfiguration                = "SetAudioOutputConfiguration"
	SetAudioSourceConfiguration                = "SetAudioSourceConfiguration"
	SetMetadataConfiguration                   = "SetMetadataConfiguration"
	SetOSD                                     = "SetOSD"
	SetVideoAnalyticsConfiguration             = "SetVideoAnalyticsConfiguration"
	SetVideoEncoderConfiguration               = "SetVideoEncoderConfiguration"
	SetVideoSourceConfiguration                = "SetVideoSourceConfiguration"
	SetVideoSourceMode                         = "SetVideoSourceMode"
	StartMulticastStreaming                    = "StartMulticastStreaming"
	StopMulticastStreaming                     = "StopMulticastStreaming"
)

WebService - Media

View Source
const (
	AddConfiguration           = "AddConfiguration"
	GetAnalyticsConfigurations = "GetAnalyticsConfigurations"
	RemoveConfiguration        = "RemoveConfiguration"
)

WebService - Media2

View Source
const (
	AbsoluteMove                = "AbsoluteMove"
	ContinuousMove              = "ContinuousMove"
	CreatePresetTour            = "CreatePresetTour"
	GeoMove                     = "GeoMove"
	GetCompatibleConfigurations = "GetCompatibleConfigurations"
	GetConfiguration            = "GetConfiguration"
	GetConfigurationOptions     = "GetConfigurationOptions"
	GetConfigurations           = "GetConfigurations"
	GetNode                     = "GetNode"
	GetNodes                    = "GetNodes"
	GetPresetTour               = "GetPresetTour"
	GetPresetTourOptions        = "GetPresetTourOptions"
	GetPresetTours              = "GetPresetTours"
	GotoHomePosition            = "GotoHomePosition"
	GotoPreset                  = "GotoPreset"
	ModifyPresetTour            = "ModifyPresetTour"
	OperatePresetTour           = "OperatePresetTour"
	RelativeMove                = "RelativeMove"
	RemovePreset                = "RemovePreset"
	RemovePresetTour            = "RemovePresetTour"
	SetConfiguration            = "SetConfiguration"
	SetHomePosition             = "SetHomePosition"
	SetPreset                   = "SetPreset"
)

WebService - PTZ

View Source
const (
	CreateRecording              = "CreateRecording"
	CreateRecordingJob           = "CreateRecordingJob"
	CreateTrack                  = "CreateTrack"
	DeleteRecording              = "DeleteRecording"
	DeleteRecordingJob           = "DeleteRecordingJob"
	DeleteTrack                  = "DeleteTrack"
	ExportRecordedData           = "ExportRecordedData"
	GetExportRecordedDataState   = "GetExportRecordedDataState"
	GetRecordingConfiguration    = "GetRecordingConfiguration"
	GetRecordingJobConfiguration = "GetRecordingJobConfiguration"
	GetRecordingJobState         = "GetRecordingJobState"
	GetRecordingJobs             = "GetRecordingJobs"
	GetRecordingOptions          = "GetRecordingOptions"
	GetRecordings                = "GetRecordings"
	GetTrackConfiguration        = "GetTrackConfiguration"
	SetRecordingConfiguration    = "SetRecordingConfiguration"
	SetRecordingJobConfiguration = "SetRecordingJobConfiguration"
	SetRecordingJobMode          = "SetRecordingJobMode"
	SetTrackConfiguration        = "SetTrackConfiguration"
	StopExportRecordedData       = "StopExportRecordedData"
)

WebService - Recording

Variables

View Source
var AnalyticsFunctionMap = map[string]Function{
	CreateAnalyticsModules:       &analytics.CreateAnalyticsModulesFunction{},
	CreateRules:                  &analytics.CreateRulesFunction{},
	DeleteAnalyticsModules:       &analytics.DeleteAnalyticsModulesFunction{},
	DeleteRules:                  &analytics.DeleteRulesFunction{},
	GetAnalyticsModuleOptions:    &analytics.GetAnalyticsModuleOptionsFunction{},
	GetAnalyticsModules:          &analytics.GetAnalyticsModulesFunction{},
	GetRuleOptions:               &analytics.GetRuleOptionsFunction{},
	GetRules:                     &analytics.GetRulesFunction{},
	GetSupportedAnalyticsModules: &analytics.GetSupportedAnalyticsModulesFunction{},
	GetSupportedRules:            &analytics.GetSupportedRulesFunction{},
	ModifyAnalyticsModules:       &analytics.ModifyAnalyticsModulesFunction{},
	ModifyRules:                  &analytics.ModifyRulesFunction{},
}
View Source
var DeviceFunctionMap = map[string]Function{
	AddIPAddressFilter:            &device.AddIPAddressFilterFunction{},
	AddScopes:                     &device.AddScopesFunction{},
	CreateCertificate:             &device.CreateCertificateFunction{},
	CreateDot1XConfiguration:      &device.CreateDot1XConfigurationFunction{},
	CreateStorageConfiguration:    &device.CreateStorageConfigurationFunction{},
	CreateUsers:                   &device.CreateUsersFunction{},
	DeleteCertificates:            &device.DeleteCertificatesFunction{},
	DeleteDot1XConfiguration:      &device.DeleteDot1XConfigurationFunction{},
	DeleteGeoLocation:             &device.DeleteGeoLocationFunction{},
	DeleteStorageConfiguration:    &device.DeleteStorageConfigurationFunction{},
	DeleteUsers:                   &device.DeleteUsersFunction{},
	GetAccessPolicy:               &device.GetAccessPolicyFunction{},
	GetCACertificates:             &device.GetCACertificatesFunction{},
	GetCapabilities:               &device.GetCapabilitiesFunction{},
	GetCertificateInformation:     &device.GetCertificateInformationFunction{},
	GetCertificates:               &device.GetCertificatesFunction{},
	GetCertificatesStatus:         &device.GetCertificatesStatusFunction{},
	GetClientCertificateMode:      &device.GetClientCertificateModeFunction{},
	GetDNS:                        &device.GetDNSFunction{},
	GetDPAddresses:                &device.GetDPAddressesFunction{},
	GetDeviceInformation:          &device.GetDeviceInformationFunction{},
	GetDiscoveryMode:              &device.GetDiscoveryModeFunction{},
	GetDot11Capabilities:          &device.GetDot11CapabilitiesFunction{},
	GetDot11Status:                &device.GetDot11StatusFunction{},
	GetDot1XConfiguration:         &device.GetDot1XConfigurationFunction{},
	GetDot1XConfigurations:        &device.GetDot1XConfigurationsFunction{},
	GetDynamicDNS:                 &device.GetDynamicDNSFunction{},
	GetEndpointReference:          &device.GetEndpointReferenceFunction{},
	GetGeoLocation:                &device.GetGeoLocationFunction{},
	GetHostname:                   &device.GetHostnameFunction{},
	GetIPAddressFilter:            &device.GetIPAddressFilterFunction{},
	GetNTP:                        &device.GetNTPFunction{},
	GetNetworkDefaultGateway:      &device.GetNetworkDefaultGatewayFunction{},
	GetNetworkInterfaces:          &device.GetNetworkInterfacesFunction{},
	GetNetworkProtocols:           &device.GetNetworkProtocolsFunction{},
	GetPkcs10Request:              &device.GetPkcs10RequestFunction{},
	GetRelayOutputs:               &device.GetRelayOutputsFunction{},
	GetRemoteDiscoveryMode:        &device.GetRemoteDiscoveryModeFunction{},
	GetRemoteUser:                 &device.GetRemoteUserFunction{},
	GetScopes:                     &device.GetScopesFunction{},
	GetServiceCapabilities:        &device.GetServiceCapabilitiesFunction{},
	GetServices:                   &device.GetServicesFunction{},
	GetStorageConfiguration:       &device.GetStorageConfigurationFunction{},
	GetStorageConfigurations:      &device.GetStorageConfigurationsFunction{},
	GetSystemBackup:               &device.GetSystemBackupFunction{},
	GetSystemDateAndTime:          &device.GetSystemDateAndTimeFunction{},
	GetSystemLog:                  &device.GetSystemLogFunction{},
	GetSystemSupportInformation:   &device.GetSystemSupportInformationFunction{},
	GetSystemUris:                 &device.GetSystemUrisFunction{},
	GetUsers:                      &device.GetUsersFunction{},
	GetWsdlUrl:                    &device.GetWsdlUrlFunction{},
	GetZeroConfiguration:          &device.GetZeroConfigurationFunction{},
	LoadCACertificates:            &device.LoadCACertificatesFunction{},
	LoadCertificateWithPrivateKey: &device.LoadCertificateWithPrivateKeyFunction{},
	LoadCertificates:              &device.LoadCertificatesFunction{},
	RemoveIPAddressFilter:         &device.RemoveIPAddressFilterFunction{},
	RemoveScopes:                  &device.RemoveScopesFunction{},
	RestoreSystem:                 &device.RestoreSystemFunction{},
	ScanAvailableDot11Networks:    &device.ScanAvailableDot11NetworksFunction{},
	SendAuxiliaryCommand:          &device.SendAuxiliaryCommandFunction{},
	SetAccessPolicy:               &device.SetAccessPolicyFunction{},
	SetCertificatesStatus:         &device.SetCertificatesStatusFunction{},
	SetClientCertificateMode:      &device.SetClientCertificateModeFunction{},
	SetDNS:                        &device.SetDNSFunction{},
	SetDPAddresses:                &device.SetDPAddressesFunction{},
	SetDiscoveryMode:              &device.SetDiscoveryModeFunction{},
	SetDot1XConfiguration:         &device.SetDot1XConfigurationFunction{},
	SetDynamicDNS:                 &device.SetDynamicDNSFunction{},
	SetGeoLocation:                &device.SetGeoLocationFunction{},
	SetHostname:                   &device.SetHostnameFunction{},
	SetHostnameFromDHCP:           &device.SetHostnameFromDHCPFunction{},
	SetIPAddressFilter:            &device.SetIPAddressFilterFunction{},
	SetNTP:                        &device.SetNTPFunction{},
	SetNetworkDefaultGateway:      &device.SetNetworkDefaultGatewayFunction{},
	SetNetworkInterfaces:          &device.SetNetworkInterfacesFunction{},
	SetNetworkProtocols:           &device.SetNetworkProtocolsFunction{},
	SetRelayOutputSettings:        &device.SetRelayOutputSettingsFunction{},
	SetRelayOutputState:           &device.SetRelayOutputStateFunction{},
	SetRemoteDiscoveryMode:        &device.SetRemoteDiscoveryModeFunction{},
	SetRemoteUser:                 &device.SetRemoteUserFunction{},
	SetScopes:                     &device.SetScopesFunction{},
	SetStorageConfiguration:       &device.SetStorageConfigurationFunction{},
	SetSystemDateAndTime:          &device.SetSystemDateAndTimeFunction{},
	SetSystemFactoryDefault:       &device.SetSystemFactoryDefaultFunction{},
	SetUser:                       &device.SetUserFunction{},
	SetZeroConfiguration:          &device.SetZeroConfigurationFunction{},
	StartFirmwareUpgrade:          &device.StartFirmwareUpgradeFunction{},
	StartSystemRestore:            &device.StartSystemRestoreFunction{},
	SystemReboot:                  &device.SystemRebootFunction{},
	UpgradeSystemFirmware:         &device.UpgradeSystemFirmwareFunction{},
}
View Source
var EventFunctionMap = map[string]Function{
	CreatePullPointSubscription: &event.CreatePullPointSubscriptionFunction{},
	GetEventProperties:          &event.GetEventPropertiesFunction{},
	GetServiceCapabilities:      &event.GetServiceCapabilitiesFunction{},
	PullMessages:                &event.PullMessagesFunction{},
	Renew:                       &event.RenewFunction{},
	Seek:                        &event.SeekFunction{},
	SetSynchronizationPoint:     &event.SetSynchronizationPointFunction{},
	Subscribe:                   &event.SubscribeFunction{},
	SubscriptionReference:       &event.SubscriptionReferenceFunction{},
	Unsubscribe:                 &event.UnsubscribeFunction{},
}
View Source
var ImagingFunctionMap = map[string]Function{
	GetCurrentPreset:       &imaging.GetCurrentPresetFunction{},
	GetImagingSettings:     &imaging.GetImagingSettingsFunction{},
	GetMoveOptions:         &imaging.GetMoveOptionsFunction{},
	GetOptions:             &imaging.GetOptionsFunction{},
	GetPresets:             &imaging.GetPresetsFunction{},
	GetServiceCapabilities: &imaging.GetServiceCapabilitiesFunction{},
	GetStatus:              &imaging.GetStatusFunction{},
	Move:                   &imaging.MoveFunction{},
	SetCurrentPreset:       &imaging.SetCurrentPresetFunction{},
	SetImagingSettings:     &imaging.SetImagingSettingsFunction{},
	Stop:                   &imaging.StopFunction{},
}
View Source
var Media2FunctionMap = map[string]Function{
	AddConfiguration:           &media2.AddConfigurationFunction{},
	GetAnalyticsConfigurations: &media2.GetAnalyticsConfigurationsFunction{},
	GetProfiles:                &media2.GetProfilesFunction{},
	RemoveConfiguration:        &media2.RemoveConfigurationFunction{},
}
View Source
var MediaFunctionMap = map[string]Function{
	AddAudioDecoderConfiguration:               &media.AddAudioDecoderConfigurationFunction{},
	AddAudioEncoderConfiguration:               &media.AddAudioEncoderConfigurationFunction{},
	AddAudioOutputConfiguration:                &media.AddAudioOutputConfigurationFunction{},
	AddAudioSourceConfiguration:                &media.AddAudioSourceConfigurationFunction{},
	AddMetadataConfiguration:                   &media.AddMetadataConfigurationFunction{},
	AddPTZConfiguration:                        &media.AddPTZConfigurationFunction{},
	AddVideoAnalyticsConfiguration:             &media.AddVideoAnalyticsConfigurationFunction{},
	AddVideoEncoderConfiguration:               &media.AddVideoEncoderConfigurationFunction{},
	AddVideoSourceConfiguration:                &media.AddVideoSourceConfigurationFunction{},
	CreateOSD:                                  &media.CreateOSDFunction{},
	CreateProfile:                              &media.CreateProfileFunction{},
	DeleteOSD:                                  &media.DeleteOSDFunction{},
	DeleteProfile:                              &media.DeleteProfileFunction{},
	GetAudioDecoderConfiguration:               &media.GetAudioDecoderConfigurationFunction{},
	GetAudioDecoderConfigurationOptions:        &media.GetAudioDecoderConfigurationOptionsFunction{},
	GetAudioDecoderConfigurations:              &media.GetAudioDecoderConfigurationsFunction{},
	GetAudioEncoderConfiguration:               &media.GetAudioEncoderConfigurationFunction{},
	GetAudioEncoderConfigurationOptions:        &media.GetAudioEncoderConfigurationOptionsFunction{},
	GetAudioEncoderConfigurations:              &media.GetAudioEncoderConfigurationsFunction{},
	GetAudioOutputConfiguration:                &media.GetAudioOutputConfigurationFunction{},
	GetAudioOutputConfigurationOptions:         &media.GetAudioOutputConfigurationOptionsFunction{},
	GetAudioOutputConfigurations:               &media.GetAudioOutputConfigurationsFunction{},
	GetAudioOutputs:                            &media.GetAudioOutputsFunction{},
	GetAudioSourceConfiguration:                &media.GetAudioSourceConfigurationFunction{},
	GetAudioSourceConfigurationOptions:         &media.GetAudioSourceConfigurationOptionsFunction{},
	GetAudioSourceConfigurations:               &media.GetAudioSourceConfigurationsFunction{},
	GetAudioSources:                            &media.GetAudioSourcesFunction{},
	GetCompatibleAudioDecoderConfigurations:    &media.GetCompatibleAudioDecoderConfigurationsFunction{},
	GetCompatibleAudioEncoderConfigurations:    &media.GetCompatibleAudioEncoderConfigurationsFunction{},
	GetCompatibleAudioOutputConfigurations:     &media.GetCompatibleAudioOutputConfigurationsFunction{},
	GetCompatibleAudioSourceConfigurations:     &media.GetCompatibleAudioSourceConfigurationsFunction{},
	GetCompatibleMetadataConfigurations:        &media.GetCompatibleMetadataConfigurationsFunction{},
	GetCompatibleVideoAnalyticsConfigurations:  &media.GetCompatibleVideoAnalyticsConfigurationsFunction{},
	GetCompatibleVideoEncoderConfigurations:    &media.GetCompatibleVideoEncoderConfigurationsFunction{},
	GetCompatibleVideoSourceConfigurations:     &media.GetCompatibleVideoSourceConfigurationsFunction{},
	GetGuaranteedNumberOfVideoEncoderInstances: &media.GetGuaranteedNumberOfVideoEncoderInstancesFunction{},
	GetMetadataConfiguration:                   &media.GetMetadataConfigurationFunction{},
	GetMetadataConfigurationOptions:            &media.GetMetadataConfigurationOptionsFunction{},
	GetMetadataConfigurations:                  &media.GetMetadataConfigurationsFunction{},
	GetOSD:                                     &media.GetOSDFunction{},
	GetOSDOptions:                              &media.GetOSDOptionsFunction{},
	GetOSDs:                                    &media.GetOSDsFunction{},
	GetProfile:                                 &media.GetProfileFunction{},
	GetProfiles:                                &media.GetProfilesFunction{},
	GetServiceCapabilities:                     &media.GetServiceCapabilitiesFunction{},
	GetSnapshotUri:                             &media.GetSnapshotUriFunction{},
	GetStreamUri:                               &media.GetStreamUriFunction{},
	GetVideoAnalyticsConfiguration:             &media.GetVideoAnalyticsConfigurationFunction{},
	GetVideoAnalyticsConfigurations:            &media.GetVideoAnalyticsConfigurationsFunction{},
	GetVideoEncoderConfiguration:               &media.GetVideoEncoderConfigurationFunction{},
	GetVideoEncoderConfigurationOptions:        &media.GetVideoEncoderConfigurationOptionsFunction{},
	GetVideoEncoderConfigurations:              &media.GetVideoEncoderConfigurationsFunction{},
	GetVideoSourceConfiguration:                &media.GetVideoSourceConfigurationFunction{},
	GetVideoSourceConfigurationOptions:         &media.GetVideoSourceConfigurationOptionsFunction{},
	GetVideoSourceConfigurations:               &media.GetVideoSourceConfigurationsFunction{},
	GetVideoSourceModes:                        &media.GetVideoSourceModesFunction{},
	GetVideoSources:                            &media.GetVideoSourcesFunction{},
	RemoveAudioDecoderConfiguration:            &media.RemoveAudioDecoderConfigurationFunction{},
	RemoveAudioEncoderConfiguration:            &media.RemoveAudioEncoderConfigurationFunction{},
	RemoveAudioOutputConfiguration:             &media.RemoveAudioOutputConfigurationFunction{},
	RemoveAudioSourceConfiguration:             &media.RemoveAudioSourceConfigurationFunction{},
	RemoveMetadataConfiguration:                &media.RemoveMetadataConfigurationFunction{},
	RemovePTZConfiguration:                     &media.RemovePTZConfigurationFunction{},
	RemoveVideoAnalyticsConfiguration:          &media.RemoveVideoAnalyticsConfigurationFunction{},
	RemoveVideoEncoderConfiguration:            &media.RemoveVideoEncoderConfigurationFunction{},
	RemoveVideoSourceConfiguration:             &media.RemoveVideoSourceConfigurationFunction{},
	SetAudioDecoderConfiguration:               &media.SetAudioDecoderConfigurationFunction{},
	SetAudioEncoderConfiguration:               &media.SetAudioEncoderConfigurationFunction{},
	SetAudioOutputConfiguration:                &media.SetAudioOutputConfigurationFunction{},
	SetAudioSourceConfiguration:                &media.SetAudioSourceConfigurationFunction{},
	SetMetadataConfiguration:                   &media.SetMetadataConfigurationFunction{},
	SetOSD:                                     &media.SetOSDFunction{},
	SetSynchronizationPoint:                    &media.SetSynchronizationPointFunction{},
	SetVideoAnalyticsConfiguration:             &media.SetVideoAnalyticsConfigurationFunction{},
	SetVideoEncoderConfiguration:               &media.SetVideoEncoderConfigurationFunction{},
	SetVideoSourceConfiguration:                &media.SetVideoSourceConfigurationFunction{},
	SetVideoSourceMode:                         &media.SetVideoSourceModeFunction{},
	StartMulticastStreaming:                    &media.StartMulticastStreamingFunction{},
	StopMulticastStreaming:                     &media.StopMulticastStreamingFunction{},
}
View Source
var PTZFunctionMap = map[string]Function{
	AbsoluteMove:                &ptz.AbsoluteMoveFunction{},
	ContinuousMove:              &ptz.ContinuousMoveFunction{},
	CreatePresetTour:            &ptz.CreatePresetTourFunction{},
	GeoMove:                     &ptz.GeoMoveFunction{},
	GetCompatibleConfigurations: &ptz.GetCompatibleConfigurationsFunction{},
	GetConfiguration:            &ptz.GetConfigurationFunction{},
	GetConfigurationOptions:     &ptz.GetConfigurationOptionsFunction{},
	GetConfigurations:           &ptz.GetConfigurationsFunction{},
	GetNode:                     &ptz.GetNodeFunction{},
	GetNodes:                    &ptz.GetNodesFunction{},
	GetPresetTour:               &ptz.GetPresetTourFunction{},
	GetPresetTourOptions:        &ptz.GetPresetTourOptionsFunction{},
	GetPresetTours:              &ptz.GetPresetToursFunction{},
	GetPresets:                  &ptz.GetPresetsFunction{},
	GetServiceCapabilities:      &ptz.GetServiceCapabilitiesFunction{},
	GetStatus:                   &ptz.GetStatusFunction{},
	GotoHomePosition:            &ptz.GotoHomePositionFunction{},
	GotoPreset:                  &ptz.GotoPresetFunction{},
	ModifyPresetTour:            &ptz.ModifyPresetTourFunction{},
	OperatePresetTour:           &ptz.OperatePresetTourFunction{},
	RelativeMove:                &ptz.RelativeMoveFunction{},
	RemovePreset:                &ptz.RemovePresetFunction{},
	RemovePresetTour:            &ptz.RemovePresetTourFunction{},
	SendAuxiliaryCommand:        &ptz.SendAuxiliaryCommandFunction{},
	SetConfiguration:            &ptz.SetConfigurationFunction{},
	SetHomePosition:             &ptz.SetHomePositionFunction{},
	SetPreset:                   &ptz.SetPresetFunction{},
	Stop:                        &ptz.StopFunction{},
}
View Source
var RecordingFunctionMap = map[string]Function{
	CreateRecording:              &recording.CreateRecordingFunction{},
	CreateRecordingJob:           &recording.CreateRecordingJobFunction{},
	CreateTrack:                  &recording.CreateTrackFunction{},
	DeleteRecording:              &recording.DeleteRecordingFunction{},
	DeleteRecordingJob:           &recording.DeleteRecordingJobFunction{},
	DeleteTrack:                  &recording.DeleteTrackFunction{},
	ExportRecordedData:           &recording.ExportRecordedDataFunction{},
	GetExportRecordedDataState:   &recording.GetExportRecordedDataStateFunction{},
	GetRecordingConfiguration:    &recording.GetRecordingConfigurationFunction{},
	GetRecordingJobConfiguration: &recording.GetRecordingJobConfigurationFunction{},
	GetRecordingJobState:         &recording.GetRecordingJobStateFunction{},
	GetRecordingJobs:             &recording.GetRecordingJobsFunction{},
	GetRecordingOptions:          &recording.GetRecordingOptionsFunction{},
	GetRecordings:                &recording.GetRecordingsFunction{},
	GetServiceCapabilities:       &recording.GetServiceCapabilitiesFunction{},
	GetTrackConfiguration:        &recording.GetTrackConfigurationFunction{},
	SetRecordingConfiguration:    &recording.SetRecordingConfigurationFunction{},
	SetRecordingJobConfiguration: &recording.SetRecordingJobConfigurationFunction{},
	SetRecordingJobMode:          &recording.SetRecordingJobModeFunction{},
	SetTrackConfiguration:        &recording.SetTrackConfigurationFunction{},
	StopExportRecordedData:       &recording.StopExportRecordedDataFunction{},
}
View Source
var Xlmns = map[string]string{
	"onvif":   "http://www.onvif.org/ver10/schema",
	"tds":     "http://www.onvif.org/ver10/device/wsdl",
	"trt":     "http://www.onvif.org/ver10/media/wsdl",
	"tr2":     "http://www.onvif.org/ver20/media/wsdl",
	"tev":     "http://www.onvif.org/ver10/events/wsdl",
	"tptz":    "http://www.onvif.org/ver20/ptz/wsdl",
	"timg":    "http://www.onvif.org/ver20/imaging/wsdl",
	"tan":     "http://www.onvif.org/ver20/analytics/wsdl",
	"xmime":   "http://www.w3.org/2005/05/xmlmime",
	"wsnt":    "http://docs.oasis-open.org/wsn/b-2",
	"xop":     "http://www.w3.org/2004/08/xop/include",
	"wsa":     "http://www.w3.org/2005/08/addressing",
	"wstop":   "http://docs.oasis-open.org/wsn/t-1",
	"wsntw":   "http://docs.oasis-open.org/wsn/bw-2",
	"wsrf-rw": "http://docs.oasis-open.org/wsrf/rw-2",
	"wsaw":    "http://www.w3.org/2006/05/addressing/wsdl",
	"tt":      "http://www.onvif.org/ver10/recording/wsdl",
	"wsse":    "http://docs.oasis-open.org/wss/2004/01/oasis-200401",
	"wsu":     "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd",
}

Xlmns XML Scheam

Functions

This section is empty.

Types

type Device

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

Device for a new device of onvif and DeviceInfo struct represents an abstract ONVIF device. It contains methods, which helps to communicate with ONVIF device

func NewDevice

func NewDevice(params DeviceParams) (*Device, error)

NewDevice function construct a ONVIF Device entity

func (*Device) CallMethod

func (dev *Device) CallMethod(method interface{}) (*http.Response, error)

CallMethod functions call an method, defined <method> struct. You should use Authenticate method to call authorized requests.

func (*Device) CallOnvifFunction

func (dev *Device) CallOnvifFunction(serviceName, functionName string, data []byte) (interface{}, error)

func (*Device) GetDeviceInfo

func (dev *Device) GetDeviceInfo() DeviceInfo

GetServices return available endpoints

func (*Device) GetDeviceParams

func (dev *Device) GetDeviceParams() DeviceParams

func (*Device) GetEndpoint

func (dev *Device) GetEndpoint(name string) string

GetEndpoint returns specific ONVIF service endpoint address

func (*Device) GetEndpointByRequestStruct

func (dev *Device) GetEndpointByRequestStruct(requestStruct interface{}) (string, error)

func (*Device) GetServices

func (dev *Device) GetServices() map[string]string

GetServices return available endpoints

func (*Device) SendGetSnapshotRequest

func (dev *Device) SendGetSnapshotRequest(url string) (resp *http.Response, err error)

SendGetSnapshotRequest sends the Get request to retrieve the snapshot from the Onvif camera The parameter url is come from the "GetSnapshotURI" command.

func (*Device) SendSoap

func (dev *Device) SendSoap(endpoint string, xmlRequestBody string) (resp *http.Response, err error)

func (*Device) SetDeviceInfoFromScopes

func (dev *Device) SetDeviceInfoFromScopes(scopes []string)

SetDeviceInfoFromScopes goes through the scopes and sets the device info fields for supported categories (currently name and hardware). See 7.3.2.2 Scopes in the ONVIF Core Specification (https://www.onvif.org/specs/core/ONVIF-Core-Specification.pdf).

type DeviceInfo

type DeviceInfo struct {
	Name            string
	Manufacturer    string
	Model           string
	FirmwareVersion string
	SerialNumber    string
	HardwareId      string
}

DeviceInfo struct contains general information about ONVIF device

type DeviceParams

type DeviceParams struct {
	Xaddr              string
	EndpointRefAddress string
	Username           string
	Password           string
	HttpClient         *http.Client
	AuthMode           string
}

type DeviceType

type DeviceType int

DeviceType alias for int

const (
	NVD DeviceType = iota
	NVS
	NVA
	NVT

	ContentType = "Content-Type"
)

Onvif Device Tyoe

func (DeviceType) String

func (devType DeviceType) String() string

type DigestClient

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

DigestClient represents an HTTP client used for making requests authenticated with http digest authentication.

func NewDigestClient

func NewDigestClient(stdClient *http.Client, username string, password string) *DigestClient

NewDigestClient returns a DigestClient that wraps a given standard library http Client with the given username and password

func (*DigestClient) Do

func (dc *DigestClient) Do(httpMethod string, endpoint string, soap string) (*http.Response, error)

type Function

type Function interface {
	Request() interface{}
	Response() interface{}
}

func FunctionByServiceAndFunctionName

func FunctionByServiceAndFunctionName(serviceName, functionName string) (Function, error)

Jump to

Keyboard shortcuts

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