Documentation ¶
Overview ¶
Package onvif is developed to provide an ONVIF client implementation on Go programming language
Index ¶
- Constants
- Variables
- type Device
- func (dev *Device) CallMethod(method interface{}) (*http.Response, error)
- func (dev *Device) CallOnvifFunction(serviceName, functionName string, data []byte) (interface{}, error)
- func (dev *Device) GetDeviceInfo() DeviceInfo
- func (dev *Device) GetDeviceParams() DeviceParams
- func (dev *Device) GetEndpoint(name string) string
- func (dev *Device) GetEndpointByRequestStruct(requestStruct interface{}) (string, error)
- func (dev *Device) GetServices() map[string]string
- func (dev *Device) SendSoap(endpoint string, xmlRequestBody string) (resp *http.Response, err error)
- type DeviceInfo
- type DeviceParams
- type DeviceType
- type DigestClient
- type Function
Constants ¶
const ( DeviceWebService = "Device" EventWebService = "Event" MediaWebService = "Media" Media2WebService = "Media2" PTZWebService = "PTZ" AnalyticsWebService = "Analytics" )
Onvif WebService
const ( // WebService - Device GetHostname = "GetHostname" SetHostname = "SetHostname" GetDNS = "GetDNS" SetDNS = "SetDNS" GetNetworkInterfaces = "GetNetworkInterfaces" SetNetworkInterfaces = "SetNetworkInterfaces" GetNetworkProtocols = "GetNetworkProtocols" SetNetworkProtocols = "SetNetworkProtocols" GetNetworkDefaultGateway = "GetNetworkDefaultGateway" SetNetworkDefaultGateway = "SetNetworkDefaultGateway" GetDeviceInformation = "GetDeviceInformation" GetSystemDateAndTime = "GetSystemDateAndTime" SetSystemDateAndTime = "SetSystemDateAndTime" SetSystemFactoryDefault = "SetSystemFactoryDefault" SystemReboot = "SystemReboot" GetUsers = "GetUsers" CreateUsers = "CreateUsers" DeleteUsers = "DeleteUsers" SetUser = "SetUser" GetDiscoveryMode = "GetDiscoveryMode" SetDiscoveryMode = "SetDiscoveryMode" GetScopes = "GetScopes" SetScopes = "SetScopes" AddScopes = "AddScopes" RemoveScopes = "RemoveScopes" // WebService - Media GetMetadataConfiguration = "GetMetadataConfiguration" GetMetadataConfigurations = "GetMetadataConfigurations" AddMetadataConfiguration = "AddMetadataConfiguration" RemoveMetadataConfiguration = "RemoveMetadataConfiguration" SetMetadataConfiguration = "SetMetadataConfiguration" GetCompatibleMetadataConfigurations = "GetCompatibleMetadataConfigurations" GetMetadataConfigurationOptions = "GetMetadataConfigurationOptions" GetProfiles = "GetProfiles" GetStreamUri = "GetStreamUri" GetVideoEncoderConfiguration = "GetVideoEncoderConfiguration" GetVideoEncoderConfigurations = "GetVideoEncoderConfigurations" SetVideoEncoderConfiguration = "SetVideoEncoderConfiguration" GetVideoEncoderConfigurationOptions = "GetVideoEncoderConfigurationOptions" // WebService - Media2 GetAnalyticsConfigurations = "GetAnalyticsConfigurations" AddConfiguration = "AddConfiguration" RemoveConfiguration = "RemoveConfiguration" // WebService - PTZ GetNodes = "GetNodes" GetNode = "GetNode" GetConfigurations = "GetConfigurations" GetConfiguration = "GetConfiguration" GetConfigurationOptions = "GetConfigurationOptions" SetConfiguration = "SetConfiguration" AddPTZConfiguration = "AddPTZConfiguration" RemovePTZConfiguration = "RemovePTZConfiguration" AbsoluteMove = "AbsoluteMove" RelativeMove = "RelativeMove" ContinuousMove = "ContinuousMove" Stop = "Stop" GetStatus = "GetStatus" SetPreset = "SetPreset" GetPresets = "GetPresets" GotoPreset = "GotoPreset" RemovePreset = "RemovePreset" GotoHomePosition = "GotoHomePosition" SetHomePosition = "SetHomePosition" SendAuxiliaryCommand = "SendAuxiliaryCommand" // WebService - Event GetEventProperties = "GetEventProperties" CreatePullPointSubscription = "CreatePullPointSubscription" PullMessages = "PullMessages" Unsubscribe = "Unsubscribe" Subscribe = "Subscribe" Renew = "Renew" // WebService - Analytics GetSupportedAnalyticsModules = "GetSupportedAnalyticsModules" GetAnalyticsModules = "GetAnalyticsModules" CreateAnalyticsModules = "CreateAnalyticsModules" DeleteAnalyticsModules = "DeleteAnalyticsModules" GetAnalyticsModuleOptions = "GetAnalyticsModuleOptions" ModifyAnalyticsModules = "ModifyAnalyticsModules" GetSupportedRules = "GetSupportedRules" GetRules = "GetRules" CreateRules = "CreateRules" DeleteRules = "DeleteRules" GetRuleOptions = "GetRuleOptions" ModifyRules = "ModifyRules" )
Onvif WebService function
const ( DigestAuth = "digest" UsernameTokenAuth = "usernametoken" Both = "both" NoAuth = "none" )
Onvif Auth Mode
Variables ¶
var AnalyticsFunctionMap = map[string]Function{ GetSupportedAnalyticsModules: &analytics.GetSupportedAnalyticsModulesFunction{}, GetAnalyticsModules: &analytics.GetAnalyticsModulesFunction{}, CreateAnalyticsModules: &analytics.CreateAnalyticsModulesFunction{}, DeleteAnalyticsModules: &analytics.DeleteAnalyticsModulesFunction{}, GetAnalyticsModuleOptions: &analytics.GetAnalyticsModuleOptionsFunction{}, ModifyAnalyticsModules: &analytics.ModifyAnalyticsModulesFunction{}, GetSupportedRules: &analytics.GetSupportedRulesFunction{}, GetRules: &analytics.GetRulesFunction{}, CreateRules: &analytics.CreateRulesFunction{}, DeleteRules: &analytics.DeleteRulesFunction{}, GetRuleOptions: &analytics.GetRuleOptionsFunction{}, ModifyRules: &analytics.ModifyRulesFunction{}, }
var DeviceFunctionMap = map[string]Function{ GetHostname: &device.GetHostnameFunction{}, SetHostname: &device.SetHostnameFunction{}, GetDNS: &device.GetDNSFunction{}, SetDNS: &device.SetDNSFunction{}, GetNetworkInterfaces: &device.GetNetworkInterfacesFunction{}, SetNetworkInterfaces: &device.SetNetworkInterfacesFunction{}, GetNetworkProtocols: &device.GetNetworkProtocolsFunction{}, SetNetworkProtocols: &device.SetNetworkProtocolsFunction{}, GetNetworkDefaultGateway: &device.GetNetworkDefaultGatewayFunction{}, SetNetworkDefaultGateway: &device.SetNetworkDefaultGatewayFunction{}, GetDeviceInformation: &device.GetDeviceInformationFunction{}, GetSystemDateAndTime: &device.GetSystemDateAndTimeFunction{}, SetSystemDateAndTime: &device.SetSystemDateAndTimeFunction{}, SetSystemFactoryDefault: &device.SetSystemFactoryDefaultFunction{}, SystemReboot: &device.SystemRebootFunction{}, GetUsers: &device.GetUsersFunction{}, SetUser: &device.SetUserFunction{}, CreateUsers: &device.CreateUsersFunction{}, DeleteUsers: &device.DeleteUsersFunction{}, GetDiscoveryMode: &device.GetDiscoveryModeFunction{}, SetDiscoveryMode: &device.SetDiscoveryModeFunction{}, GetScopes: &device.GetScopesFunction{}, SetScopes: &device.SetScopesFunction{}, AddScopes: &device.AddScopesFunction{}, RemoveScopes: &device.RemoveScopesFunction{}, }
var EventFunctionMap = map[string]Function{ GetEventProperties: &event.GetEventPropertiesFunction{}, CreatePullPointSubscription: &event.CreatePullPointSubscriptionFunction{}, PullMessages: &event.PullMessagesFunction{}, Unsubscribe: &event.UnsubscribeFunction{}, Subscribe: &event.SubscribeFunction{}, Renew: &event.RenewFunction{}, }
var Media2FunctionMap = map[string]Function{ GetProfiles: &media2.GetProfilesFunction{}, GetAnalyticsConfigurations: &media2.GetAnalyticsConfigurationsFunction{}, AddConfiguration: &media2.AddConfigurationFunction{}, RemoveConfiguration: &media2.RemoveConfigurationFunction{}, }
var MediaFunctionMap = map[string]Function{ GetMetadataConfiguration: &media.GetMetadataConfigurationFunction{}, GetMetadataConfigurations: &media.GetMetadataConfigurationsFunction{}, AddMetadataConfiguration: &media.AddMetadataConfigurationFunction{}, RemoveMetadataConfiguration: &media.RemoveMetadataConfigurationFunction{}, SetMetadataConfiguration: &media.SetMetadataConfigurationFunction{}, GetCompatibleMetadataConfigurations: &media.GetCompatibleMetadataConfigurationsFunction{}, GetMetadataConfigurationOptions: &media.GetMetadataConfigurationOptionsFunction{}, GetProfiles: &media.GetProfilesFunction{}, GetStreamUri: &media.GetStreamUriFunction{}, GetVideoEncoderConfiguration: &media.GetVideoEncoderConfigurationFunction{}, GetVideoEncoderConfigurations: &media.GetVideoEncoderConfigurationsFunction{}, SetVideoEncoderConfiguration: &media.SetVideoEncoderConfigurationFunction{}, GetVideoEncoderConfigurationOptions: &media.GetVideoEncoderConfigurationOptionsFunction{}, AddPTZConfiguration: &media.AddPTZConfigurationFunction{}, RemovePTZConfiguration: &media.RemovePTZConfigurationFunction{}, }
var PTZFunctionMap = map[string]Function{ GetNodes: &ptz.GetNodesFunction{}, GetNode: &ptz.GetNodeFunction{}, GetConfigurations: &ptz.GetConfigurationsFunction{}, GetConfiguration: &ptz.GetConfigurationFunction{}, GetConfigurationOptions: &ptz.GetConfigurationOptionsFunction{}, SetConfiguration: &ptz.SetConfigurationFunction{}, AbsoluteMove: &ptz.AbsoluteMoveFunction{}, RelativeMove: &ptz.RelativeMoveFunction{}, ContinuousMove: &ptz.ContinuousMoveFunction{}, Stop: &ptz.StopFunction{}, GetStatus: &ptz.GetStatusFunction{}, SetPreset: &ptz.SetPresetFunction{}, GetPresets: &ptz.GetPresetsFunction{}, GotoPreset: &ptz.GotoPresetFunction{}, RemovePreset: &ptz.RemovePresetFunction{}, GotoHomePosition: &ptz.GotoHomePositionFunction{}, SetHomePosition: &ptz.SetHomePositionFunction{}, SendAuxiliaryCommand: &ptz.SendAuxiliaryCommandFunction{}, }
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",
}
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 ¶
CallMethod functions call an method, defined <method> struct. You should use Authenticate method to call authorized requests.
func (*Device) CallOnvifFunction ¶
func (*Device) GetDeviceInfo ¶
func (dev *Device) GetDeviceInfo() DeviceInfo
GetServices return available endpoints
func (*Device) GetDeviceParams ¶
func (dev *Device) GetDeviceParams() DeviceParams
func (*Device) GetEndpoint ¶
GetEndpoint returns specific ONVIF service endpoint address
func (*Device) GetEndpointByRequestStruct ¶
func (*Device) GetServices ¶
GetServices return available endpoints
type DeviceInfo ¶
type DeviceInfo struct { Manufacturer string Model string FirmwareVersion string SerialNumber string HardwareId string }
DeviceInfo struct contains general information about ONVIF device
type DeviceParams ¶
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