onvif4go

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 11 Imported by: 0

README

onvif4go

device := onvif4go.NewOnvifDevice("192.168.1.1:80")
device.Auth("admin", "1234456")
err := device.Initialize()
...
deviceInformation, err := device.Device.GetDeviceInformation()
...
err := device.Media.AddVideoAnalyticsConfiguration("Profile_0", "VideoAnalyticsConfiguration_000")
...
response := CustomDeviceResponse{}
err := device.Device.Call(CustomDeviceRequest{}, &response)
...
response := trt.GetProfilesResponse{}
media, ok := device.On("media")
err := media.Call(trt.GetProfiles{}, &response)
...
response := xsd.AnyType{}
analytics, _ := device.On("analytics")
err = analytics.Call(xsd.AnyType{
    XMLName: xml.Name{"http://www.onvif.org/ver20/analytics/wsdl", "GetSupportedAnalyticsModules"},
    Childs: []xsd.AnyType{
        xsd.AnyType{
            XMLName: xml.Name{"http://www.onvif.org/ver20/analytics/wsdl", "ConfigurationToken"},
            Text:    "VideoAnalyticsConfiguration_000",
        },
    },
}, &response)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOnvifClient

func NewOnvifClient(endpoint string, auth *onvifAuth) *onvifClient

Types

type DeviceService

type DeviceService struct {
	Client onvifCaller
}

func NewDeviceService

func NewDeviceService(onvifDevice *OnvifDevice) *DeviceService

func (*DeviceService) AddScopes

func (s *DeviceService) AddScopes(scopeURIs []string) (err error)

AddScopes adds new configurable scope parameters to a device. The scope parameters are used in the device discovery to match a probe message. The device shall support addition of discovery scope parameters through the AddScopes command.

func (*DeviceService) CreateUser

func (s *DeviceService) CreateUser(users ...tt.User) (err error)

CreateUsers creates new device users and corresponding credentials on a device for authentication purposes. The device shall support creation of device users and their credentials through the CreateUsers command. Either all users are created successfully or a fault message shall be returned without creating any user.

ONVIF compliant devices are recommended to support password length of at least 28 bytes, as clients may follow the password derivation mechanism which results in 'password equivalent' of length 28 bytes, as described in section 3.1.2 of the ONVIF security white paper.

func (*DeviceService) DeleteUsers

func (s *DeviceService) DeleteUsers(usernames []string) (err error)

DeleteUsers deletes users on a device. The device shall support deletion of device users and their credentials through the DeleteUsers command. A device may have one or more fixed users that cannot be deleted to ensure access to the unit. Either all users are deleted successfully or a fault message shall be returned and no users be deleted.

func (*DeviceService) GetAccessPolicy

func (s *DeviceService) GetAccessPolicy() (res tds.GetAccessPolicyResponse, err error)

GetAccessPolicy -- Access to different services and sub-sets of services should be subject to access control. The WS-Security framework gives the prerequisite for end-point authentication. Authorization decisions can then be taken using an access security policy. This standard does not mandate any particular policy description format or security policy but this is up to the device manufacturer or system provider to choose policy and policy description format of choice. However, an access policy (in arbitrary format) can be requested using this command. If the device supports access policy settings based on WS-Security authentication, then the device shall support this command.

func (*DeviceService) GetCapabilities

func (s *DeviceService) GetCapabilities(categories ...string) (res tds.GetCapabilitiesResponse, err error)

GetCapabilities method has been replaced by the more generic GetServices method. For capabilities of individual services refer to the GetServiceCapabilities methods.

func (*DeviceService) GetDNS

func (s *DeviceService) GetDNS() (res tds.GetDNSResponse, err error)

GetDNS gets the DNS settings from a device. The device shall return its DNS configurations through the GetDNS command.

func (*DeviceService) GetDPAddresses

func (s *DeviceService) GetDPAddresses() (res tds.GetDPAddressesResponse, err error)

GetDPAddresses gets the remote DP address or addresses from a device. If the device supports remote discovery, as specified in Section 7.4, the device shall support retrieval of the remote DP address(es) through the GetDPAddresses command.

func (*DeviceService) GetDeviceInformation

func (s *DeviceService) GetDeviceInformation() (res tds.GetDeviceInformationResponse, err error)

GetDeviceInformation gets basic device information from the device.

func (*DeviceService) GetDiscoveryMode

func (s *DeviceService) GetDiscoveryMode() (res tds.GetDiscoveryModeResponse, err error)

GetDiscoveryMode gets the discovery mode of a device. See Section 7.2 for the definition of the different device discovery modes. The device shall support retrieval of the discovery mode setting through the GetDiscoveryMode command.

func (*DeviceService) GetDynamicDNS

func (s *DeviceService) GetDynamicDNS() (res tds.GetDynamicDNSResponse, err error)

GetDynamicDNS gets the dynamic DNS settings from a device. If the device supports dynamic DNS as specified in [RFC 2136] and [RFC 4702], it shall be possible to get the type, name and TTL through the GetDynamicDNS command.

func (*DeviceService) GetEndpointReference

func (s *DeviceService) GetEndpointReference() (res tds.GetEndpointReferenceResponse, err error)

GetEndpointReference -- A client can ask for the device service endpoint reference address property that can be used to derive the password equivalent for remote user operation. The device shall support the GetEndpointReference command returning the address property of the device service endpoint reference.

func (*DeviceService) GetHostname

func (s *DeviceService) GetHostname() (res tds.GetHostnameResponse, err error)

GetHostname is used by an endpoint to get the hostname from a device. The device shall return its hostname configurations through the GetHostname command.

func (*DeviceService) GetIPAddressFilter

func (s *DeviceService) GetIPAddressFilter() (res tds.GetIPAddressFilterResponse, err error)

GetIPAddressFilter gets the IP address filter settings from a device. If the device supports device access control based on IP filtering rules (denied or accepted ranges of IP addresses), the device shall support the GetIPAddressFilter command.

func (*DeviceService) GetNTP

func (s *DeviceService) GetNTP() (res tds.GetNTPResponse, err error)

GetNTP gets the NTP settings from a device. If the device supports NTP, it shall be possible to get the NTP server settings through the GetNTP command.

func (*DeviceService) GetNetworkDefaultGateway

func (s *DeviceService) GetNetworkDefaultGateway() (res tds.GetNetworkDefaultGatewayResponse, err error)

GetNetworkDefaultGateway gets the default gateway settings from a device. The device shall support the GetNetworkDefaultGateway command returning configured default gateway address(es).

func (*DeviceService) GetNetworkInterfaces

func (s *DeviceService) GetNetworkInterfaces() (res tds.GetNetworkInterfacesResponse, err error)

GetNetworkInterfaces gets the network interface configuration from a device. The device shall support return of network interface configuration settings as defined by the NetworkInterface type through the GetNetworkInterfaces command.

func (*DeviceService) GetNetworkProtocols

func (s *DeviceService) GetNetworkProtocols() (res tds.GetNetworkProtocolsResponse, err error)

GetNetworkProtocols gets defined network protocols from a device. The device shall support the GetNetworkProtocols command returning configured network protocols.

func (*DeviceService) GetRemoteDiscoveryMode

func (s *DeviceService) GetRemoteDiscoveryMode() (res tds.GetRemoteDiscoveryModeResponse, err error)

GetRemoteDiscoveryMode gets the remote discovery mode of a device. See Section 7.4 for the definition of remote discovery extensions. A device that supports remote discovery shall support retrieval of the remote discovery mode setting through the GetRemoteDiscoveryMode command.

func (*DeviceService) GetRemoteUser

func (s *DeviceService) GetRemoteUser() (res tds.GetRemoteUserResponse, err error)

GetRemoteUser returns the configured remote user (if any). A device supporting remote user handling shall support this operation. The user is only valid for the WS-UserToken profile or as a HTTP / RTSP user.

The algorithm to use for deriving the password is described in section 5.12.2.1 of the core specification.

func (*DeviceService) GetScopes

func (s *DeviceService) GetScopes() (res tds.GetScopesResponse, err error)

GetScopes requests the scope parameters of a device. The scope parameters are used in the device discovery to match a probe message, see Section 7. The Scope parameters are of two different types:

  • Fixed
  • Configurable

Fixed scope parameters are permanent device characteristics and cannot be removed through the device management interface. The scope type is indicated in the scope list returned in the get scope parameters response. A device shall support retrieval of discovery scope parameters through the GetScopes command. As some scope parameters are mandatory, the device shall return a non-empty scope list in the response.

func (*DeviceService) GetServiceCapabilities

func (s *DeviceService) GetServiceCapabilities() (res tds.GetServiceCapabilitiesResponse, err error)

GetServiceCapabilities Returns the capabilities of the device service. The result is returned in a typed answer.

func (*DeviceService) GetServices

func (s *DeviceService) GetServices(includeCapability bool) (res tds.GetServicesResponse, err error)

GetServices returns information about services on the device.

func (*DeviceService) GetSystemDateAndTime

func (s *DeviceService) GetSystemDateAndTime() (res tds.GetSystemDateAndTimeResponse, err error)

GetSystemDateAndTime gets the device system date and time. The device shall support the return of the daylight saving setting and of the manual system date and time (if applicable) or indication of NTP time (if applicable) through the GetSystemDateAndTime command.

A device shall provide the UTCDateTime information.

func (*DeviceService) GetSystemLog

func (s *DeviceService) GetSystemLog(logType string) (res tds.GetSystemLogResponse, err error)

GetSystemLog gets a system log from the device. The exact format of the system logs is outside the scope of this standard.

func (*DeviceService) GetSystemSupportInformation

func (s *DeviceService) GetSystemSupportInformation() (res tds.GetSystemSupportInformationResponse, err error)

GetSystemSupportInformation gets arbitary device diagnostics information from the device.

func (*DeviceService) GetUsers

func (s *DeviceService) GetUsers() (res tds.GetUsersResponse, err error)

GetUsers lists the registered users and corresponding credentials on a device. The device shall support retrieval of registered device users and their credentials for the user token through the GetUsers command.

func (*DeviceService) GetWsdlUrl

func (s *DeviceService) GetWsdlUrl() (res tds.GetWsdlUrlResponse, err error)

It is possible for an endpoint to request a URL that can be used to retrieve the complete schema and WSDL definitions of a device. The command gives in return a URL entry point where all the necessary product specific WSDL and schema definitions can be retrieved. The device shall provide a URL for WSDL and schema download through the GetWsdlUrl command.

func (*DeviceService) GetZeroConfiguration

func (s *DeviceService) GetZeroConfiguration() (res tds.GetZeroConfigurationResponse, err error)

GetZeroConfiguration gets the zero-configuration from a device. If the device supports dynamic IP configuration according to [RFC3927], it shall support the return of IPv4 zero configuration address and status through the GetZeroConfiguration command.

func (*DeviceService) RemoveScopes

func (s *DeviceService) RemoveScopes(scopeURIs []string) (res tds.RemoveScopesResponse, err error)

RemoveScopes deletes scope-configurable scope parameters from a device. The scope parameters are used in the device discovery to match a probe message, see Section 7. The device shall support deletion of discovery scope parameters through the RemoveScopes command.

func (*DeviceService) SetDNS

func (s *DeviceService) SetDNS(fromDHCP bool, searchDomain []string, ipAddresses []tt.IPAddress) (res tds.SetDNSResponse, err error)

SetDNS sets the DNS settings on a device. It shall be possible to set the device DNS configurations through the SetDNS command.

func (*DeviceService) SetDiscoveryMode

func (s *DeviceService) SetDiscoveryMode(discoveryMode string) (err error)

SetDiscoveryMode sets the discovery mode operation of a device. See Section 7.2 for the definition of the different device discovery modes. The device shall support configuration of the discovery mode setting through the SetDiscoveryMode command.

func (*DeviceService) SetHostname

func (s *DeviceService) SetHostname(hostname string) (err error)

SetHostname sets the hostname on a device. It shall be possible to set the device hostname configurations through the SetHostname command.

A device shall accept string formated according to RFC 1123 section 2.1 or alternatively to RFC 952, other string shall be considered as invalid strings.

func (*DeviceService) SetHostnameFromDHCP

func (s *DeviceService) SetHostnameFromDHCP(fromDHCP bool) (res tds.SetHostnameFromDHCP, err error)

SetHostnameFromDHCP controls whether the hostname is set manually or retrieved via DHCP.

func (*DeviceService) SetRemoteDiscoveryMode

func (s *DeviceService) SetRemoteDiscoveryMode(remoteDiscoveryMode string) (err error)

SetRemoteDiscoveryMode sets the remote discovery mode of operation of a device. See Section 7.4 for the definition of remote discovery remote extensions. A device that supports remote discovery shall support configuration of the discovery mode setting through the SetRemoteDiscoveryMode command.

func (*DeviceService) SetRemoteUser

func (s *DeviceService) SetRemoteUser(remoteUser *tt.RemoteUser) (err error)

SetRemoteUser sets the remote user. A device supporting remote user handling shall support this operation. The user is only valid for the WS-UserToken profile or as a HTTP / RTSP user.<br/> The password that is set shall always be the original (not derived) password.

If UseDerivedPassword is set password derivation shall be done by the device when connecting to a remote device.The algorithm to use for deriving the password is described in section 5.12.2.1 of the core specification.

To remove the remote user SetRemoteUser should be called without the RemoteUser parameter.

func (*DeviceService) SetScopes

func (s *DeviceService) SetScopes(scopeURIs []string) (err error)

SetScopes sets the scope parameters of a device. The scope parameters are used in the device discovery to match a probe message. This operation replaces all existing configurable scope parameters (not fixed parameters). If this shall be avoided, one should use the scope add command instead. The device shall support configuration of discovery scope parameters through the SetScopes command.

func (*DeviceService) SetSystemDateAndTime

func (s *DeviceService) SetSystemDateAndTime(req tds.SetSystemDateAndTime) (err error)

SetSystemDateAndTime sets the device system date and time. The device shall support the configuration of the daylight saving setting and of the manual system date and time (if applicable) or indication of NTP time (if applicable) through the SetSystemDateAndTime command.

func (*DeviceService) SetUser

func (s *DeviceService) SetUser(users ...tt.User) (err error)

SetUser updates the settings for one or several users on a device for authentication purposes. The device shall support update of device users and their credentials through the SetUser command. Either all change requests are processed successfully or a fault message shall be returned and no change requests be processed.

func (*DeviceService) SystemReboot

func (s *DeviceService) SystemReboot() (res tds.SystemRebootResponse, err error)

SystemReboot reboots the device.

func (*DeviceService) WithoutAuth

func (s *DeviceService) WithoutAuth() *DeviceService

type EventsService

type EventsService struct {
	Client onvifCaller
	// contains filtered or unexported fields
}

func NewEventsService

func NewEventsService(endpoint string, onvifDevice *OnvifDevice) *EventsService

func (*EventsService) CreatePullPointSubscription

func (s *EventsService) CreatePullPointSubscription(filter string, changeOnly bool, initialTerminationTime *tev.AbsoluteOrRelativeTimeType) (res tev.CreatePullPointSubscriptionResponse, err error)

CreatePullPointSubscription returns a PullPointSubscription that can be polled using PullMessages. This message contains the same elements as the SubscriptionRequest of the WS-BaseNotification without the ConsumerReference.

If no Filter is specified the pullpoint notifies all occurring events to the client.

func (*EventsService) GetEventProperties

func (s *EventsService) GetEventProperties() (res tev.GetEventPropertiesResponse, err error)

GetEventProperties returns information about the FilterDialects, Schema files and topics supported by the device.

The WS-BaseNotification specification defines a set of OPTIONAL WS-ResouceProperties. This specification does not require the implementation of the WS-ResourceProperty interface. Instead, the subsequent direct interface shall be implemented by an ONVIF compliant device in order to provide information about the FilterDialects, Schema files and topics supported by the device.

func (*EventsService) GetServiceCapabilities

func (s *EventsService) GetServiceCapabilities() (res tev.GetServiceCapabilitiesResponse, err error)

GetServiceCapabilities returns the capabilities of the event service.

type MediaService

type MediaService struct {
	Client onvifCaller
}

func NewMediaService

func NewMediaService(endpoint string, onvifDevice *OnvifDevice) *MediaService

func (*MediaService) AddAudioDecoderConfiguration

func (s *MediaService) AddAudioDecoderConfiguration(profileToken, configurationToken string) error

AddAudioDecoderConfiguration adds an AudioDecoderConfiguration to an existing media profile. If a configuration exists in the media profile, it shall be replaced. The change shall be persistent.

func (*MediaService) AddAudioEncoderConfiguration

func (s *MediaService) AddAudioEncoderConfiguration(profileToken, configurationToken string) error

AddAudioEncoderConfiguration adds a AudioEncoderConfiguration to an existing media profile. If such a configuration exists in the media profile, it will be replaced. The change shall be persistent.

A device shall support adding a compatible AudioEncoderConfiguration to a profile containing an AudioSourceConfiguration and shall support streaming audio data of such a profile.

func (*MediaService) AddAudioOutputConfiguration

func (s *MediaService) AddAudioOutputConfiguration(profileToken, configurationToken string) error

AddAudioOutputConfiguration adds an AudioOutputConfiguration to an existing media profile. If a configuration exists in the media profile, it will be replaced. The change shall be persistent.

func (*MediaService) AddAudioSourceConfiguration

func (s *MediaService) AddAudioSourceConfiguration(profileToken, configurationToken string) error

AddAudioSourceConfiguration adds an AudioSourceConfiguration to an existing media profile. If a configuration exists in the media profile, it will be replaced. The change shall be persistent.

func (*MediaService) AddMetadataConfiguration

func (s *MediaService) AddMetadataConfiguration(profileToken, configurationToken string) error

AddMetadataConfiguration adds a Metadata configuration to an existing media profile. If a configuration exists in the media profile, it will be replaced. The change shall be persistent.

Adding a MetadataConfiguration to a Profile means that streams using that profile contain metadata. Metadata can consist of events, PTZ status, and/or video analytics data.

func (*MediaService) AddPTZConfiguration

func (s *MediaService) AddPTZConfiguration(profileToken, configurationToken string) error

AddPTZConfiguration adds a PTZConfiguration to an existing media profile. If a configuration exists in the media profile, it will be replaced. The change shall be persistent. Adding a PTZConfiguration to a media profile means that streams using that media profile can contain PTZ status (in the metadata), and that the media profile can be used for controlling PTZ movement.

func (*MediaService) AddVideoAnalyticsConfiguration

func (s *MediaService) AddVideoAnalyticsConfiguration(profileToken, configurationToken string) error

AddVideoAnalyticsConfiguration adds a VideoAnalytics configuration to an existing media profile. If a configuration exists in the media profile, it will be replaced. The change shall be persistent.

Adding a VideoAnalyticsConfiguration to a media profile means that streams using that media profile can contain video analytics data (in the metadata) as defined by the submitted configuration reference. A profile containing only a video analytics configuration but no video source configuration is incomplete. Therefore, a client should first add a video source configuration to a profile before adding a video analytics configuration. The device can deny adding of a video analytics configuration before a video source configuration.

func (*MediaService) AddVideoEncoderConfiguration

func (s *MediaService) AddVideoEncoderConfiguration(profileToken, configurationToken string) error

AddVideoEncoderConfiguration adds a VideoEncoderConfiguration to an existing media profile. If a configuration exists in the media profile, it will be replaced. The change shall be persistent. A device shall support adding a compatible VideoEncoderConfiguration to a Profile containing a VideoSourceConfiguration and shall support streaming video data of such a profile.

func (*MediaService) AddVideoSourceConfiguration

func (s *MediaService) AddVideoSourceConfiguration(profileToken, configurationToken string) error

AddVideoSourceConfiguration adds a VideoSourceConfiguration to an existing media profile. If such a configuration exists in the media profile, it will be replaced. The change shall be persistent.

func (*MediaService) CreateOSD

func (s *MediaService) CreateOSD(configuration tt.OSDConfiguration) (res trt.CreateOSDResponse, err error)

CreateOSD create the OSD

func (*MediaService) CreateProfile

func (s *MediaService) CreateProfile(token, name string) (res trt.CreateProfileResponse, err error)

CreateProfile creates a new empty media profile. The media profile shall be created in the device and shall be persistent (remain after reboot).

A created profile shall be deletable and a device shall set the “fixed” attribute to false in the returned Profile.

func (*MediaService) DeleteOSD

func (s *MediaService) DeleteOSD(osdToken string) (res trt.DeleteOSDResponse, err error)

DeleteOSD delete the OSD

func (*MediaService) DeleteProfile

func (s *MediaService) DeleteProfile(profileToken string) error

DeleteProfile deletes a profile. This change shall always be persistent. Deletion of a profile is only possible for non-fixed profiles

func (*MediaService) GetAudioDecoderConfiguration

func (s *MediaService) GetAudioDecoderConfiguration(configurationToken string) (res trt.GetAudioDecoderConfigurationResponse, err error)

GetAudioDecoderConfiguration return the AudioDecoderConfiguration if the configuration token is known

func (*MediaService) GetAudioDecoderConfigurations

func (s *MediaService) GetAudioDecoderConfigurations() (res trt.GetAudioDecoderConfigurationsResponse, err error)

GetAudioDecoderConfigurations lists all existing AudioDecoderConfigurations of a device. The NVC need not know anything apriori about the audio decoder configurations in order to use this command.

func (*MediaService) GetAudioEncoderConfiguration

func (s *MediaService) GetAudioEncoderConfiguration(configurationToken string) (res trt.GetAudioEncoderConfigurationResponse, err error)

GetAudioEncoderConfiguration return the AudioEncoderConfiguration if the configuration token is known

func (*MediaService) GetAudioEncoderConfigurations

func (s *MediaService) GetAudioEncoderConfigurations() (res trt.GetAudioEncoderConfigurationsResponse, err error)

GetAudioEncoderConfigurations lists all existing device audio encoder configurations. The client need not know anything apriori about the audio encoder configurations in order to use the command.

func (*MediaService) GetAudioOutputConfiguration

func (s *MediaService) GetAudioOutputConfiguration(configurationToken string) (res trt.GetAudioOutputConfigurationResponse, err error)

GetAudioOutputConfiguration return the AudioOutputConfiguration if the configuration token is known

func (*MediaService) GetAudioOutputConfigurations

func (s *MediaService) GetAudioOutputConfigurations() (res trt.GetAudioOutputConfigurationsResponse, err error)

GetAudioOutputConfigurations lists all existing AudioOutputConfigurations of a device. The NVC need not know anything apriori about the audio configurations to use this command.

func (*MediaService) GetAudioOutputs

func (s *MediaService) GetAudioOutputs() (res trt.GetAudioOutputsResponse, err error)

GetAudioOutputs lists all available physical audio outputs of the device.

func (*MediaService) GetAudioSourceConfiguration

func (s *MediaService) GetAudioSourceConfiguration(configurationToken string) (res trt.GetAudioSourceConfigurationResponse, err error)

GetAudioSourceConfiguration return the AudioSourceConfiguration if the configuration token is known

func (*MediaService) GetAudioSourceConfigurations

func (s *MediaService) GetAudioSourceConfigurations() (res trt.GetAudioSourceConfigurationsResponse, err error)

GetAudioSourceConfigurations lists all existing audio source configurations of a device. The client need not know anything apriori about the audio source configurations in order to use the command.

func (*MediaService) GetAudioSources

func (s *MediaService) GetAudioSources() (res trt.GetAudioSourcesResponse, err error)

GetAudioSources lists all available physical audio inputs of the device.

func (*MediaService) GetCompatibleAudioDecoderConfigurations

func (s *MediaService) GetCompatibleAudioDecoderConfigurations(profileToken string) (res trt.GetCompatibleAudioDecoderConfigurationsResponse, err error)

GetCompatibleAudioDecoderConfigurations lists all the audio decoder configurations of the device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddAudioDecoderConfiguration command on the media profile.

func (*MediaService) GetCompatibleAudioEncoderConfigurations

func (s *MediaService) GetCompatibleAudioEncoderConfigurations(profileToken string) (res trt.GetCompatibleAudioEncoderConfigurationsResponse, err error)

GetCompatibleAudioEncoderConfigurations requests all audio encoder configurations of a device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddAudioSourceConfiguration command on the media profile. The result varies depending on the capabilities, configurations and settings in the device.

func (*MediaService) GetCompatibleAudioOutputConfigurations

func (s *MediaService) GetCompatibleAudioOutputConfigurations(profileToken string) (res trt.GetCompatibleAudioOutputConfigurationsResponse, err error)

GetCompatibleAudioOutputConfigurations lists all audio output configurations of a device that are compatible with a certain media profile. Each returned configuration shall be a valid input for the AddAudioOutputConfiguration command.

func (*MediaService) GetCompatibleAudioSourceConfigurations

func (s *MediaService) GetCompatibleAudioSourceConfigurations(profileToken string) (res trt.GetCompatibleAudioSourceConfigurationsResponse, err error)

GetCompatibleAudioSourceConfigurations requests all audio source configurations of the device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddAudioEncoderConfiguration command on the media profile. The result varies depending on the capabilities, configurations and settings in the device.

func (*MediaService) GetCompatibleMetadataConfigurations

func (s *MediaService) GetCompatibleMetadataConfigurations(profileToken string) (res trt.GetCompatibleMetadataConfigurationsResponse, err error)

GetCompatibleMetadataConfigurations requests all the metadata configurations of the device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddMetadataConfiguration command on the media profile. The result varies depending on the capabilities, configurations and settings in the device.

func (*MediaService) GetCompatibleVideoAnalyticsConfigurations

func (s *MediaService) GetCompatibleVideoAnalyticsConfigurations(profileToken string) (res trt.GetCompatibleVideoAnalyticsConfigurationsResponse, err error)

GetCompatibleVideoAnalyticsConfigurations requests all video analytic configurations of the device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddVideoAnalyticsConfiguration command on the media profile. The result varies depending on the capabilities, configurations and settings in the device.

func (*MediaService) GetCompatibleVideoEncoderConfigurations

func (s *MediaService) GetCompatibleVideoEncoderConfigurations(profileToken string) (res trt.GetCompatibleVideoEncoderConfigurationsResponse, err error)

GetCompatibleVideoEncoderConfigurations lists all the video encoder configurations of the device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddVideoEncoderConfiguration command on the media profile. The result will vary depending on the capabilities, configurations and settings in the device.

func (*MediaService) GetCompatibleVideoSourceConfigurations

func (s *MediaService) GetCompatibleVideoSourceConfigurations(profileToken string) (res trt.GetCompatibleVideoSourceConfigurationsResponse, err error)

GetCompatibleVideoSourceConfigurations requests all the video source configurations of the device that are compatible with a certain media profile. Each of the returned configurations shall be a valid input parameter for the AddVideoSourceConfiguration command on the media profile. The result will vary depending on the capabilities, configurations and settings in the device.

func (*MediaService) GetMetadataConfiguration

func (s *MediaService) GetMetadataConfiguration(configurationToken string) (res trt.GetMetadataConfigurationResponse, err error)

GetMetadataConfiguration return the MetadataConfiguration if the configuration token is known

func (*MediaService) GetMetadataConfigurations

func (s *MediaService) GetMetadataConfigurations() (res trt.GetMetadataConfigurationsResponse, err error)

GetMetadataConfigurations lists all existing metadata configurations. The client need not know anything apriori about the metadata in order to use the command.

func (*MediaService) GetOSD

func (s *MediaService) GetOSD(osdToken string) (res trt.GetOSDResponse, err error)

GetOSD return the OSD

func (*MediaService) GetOSDOptions

func (s *MediaService) GetOSDOptions(configurationToken string) (res trt.GetOSDOptionsResponse, err error)

GetOSDOptions return the OSD Options.

func (*MediaService) GetOSDs

func (s *MediaService) GetOSDs(configurationToken string) (res trt.GetOSDsResponse, err error)

GetOSDs returns the OSDs on specified VideoSourceConfiguration

func (*MediaService) GetProfile

func (s *MediaService) GetProfile(profileToken string) (res trt.GetProfileResponse, err error)

GetProfile return profile is the profile token is already known

func (*MediaService) GetProfiles

func (s *MediaService) GetProfiles() (res trt.GetProfilesResponse, err error)

GetProfiles using for ask the existing media profiles of a device Pre-configured or dynamically configured profiles can be retrieved using this command. This command lists all configured profiles in a device. The client does not need to know the media profile in order to use the command.

func (*MediaService) GetServiceCapabilities

func (s *MediaService) GetServiceCapabilities() (res trt.GetServiceCapabilitiesResponse, err error)

GetServiceCapabilities returns the capabilities of the media service.

func (*MediaService) GetSnapshotURI

func (s *MediaService) GetSnapshotURI(profileToken string) (res trt.GetSnapshotUriResponse, err error)

GetSnapshotURI uses to obtain a JPEG snapshot from the device. The returned URI shall remain valid indefinitely even if the profile is changed. The ValidUntilConnect, ValidUntilReboot and Timeout Parameter shall be set accordingly (ValidUntilConnect=false, ValidUntilReboot=false, timeout=PT0S). The URI can be used for acquiring a JPEG image through a HTTP GET operation. The image encoding will always be JPEG regardless of the encoding setting in the media profile. The Jpeg settings (like resolution or quality) may be taken from the profile if suitable. The provided image will be updated automatically and independent from calls to GetSnapshotUri.

func (*MediaService) GetStreamURI

func (s *MediaService) GetStreamURI(profileToken, streamType, transportProtocol string) (res trt.GetStreamUriResponse, err error)

GetStreamURI requests a URI that can be used to initiate a live media stream using RTSP as the control protocol. The returned URI shall remain valid indefinitely even if the profile is changed. The ValidUntilConnect, ValidUntilReboot and Timeout Parameter shall be set accordingly (ValidUntilConnect=false, ValidUntilReboot=false, timeout=PT0S).

The correct syntax for the StreamSetup element for these media stream setups defined in 5.1.1 of the streaming specification are as follows:

  • RTP unicast over UDP: StreamType = "RTP_unicast", TransportProtocol = "UDP"
  • RTP over RTSP over HTTP over TCP: StreamType = "RTP_unicast", TransportProtocol = "HTTP"
  • RTP over RTSP over TCP: StreamType = "RTP_unicast", TransportProtocol = "RTSP"

If a multicast stream is requested the VideoEncoderConfiguration, AudioEncoderConfiguration and MetadataConfiguration element inside the corresponding media profile must be configured with valid multicast settings.

For full compatibility with other ONVIF services a device should not generate Uris longer than 128 octets.

func (*MediaService) GetVideoAnalyticsConfiguration

func (s *MediaService) GetVideoAnalyticsConfiguration(configurationToken string) (res trt.GetVideoAnalyticsConfigurationResponse, err error)

GetVideoAnalyticsConfiguration return the VideoAnalyticsConfiguration if the configuration token is known

func (*MediaService) GetVideoAnalyticsConfigurations

func (s *MediaService) GetVideoAnalyticsConfigurations() (res trt.GetVideoAnalyticsConfigurationsResponse, err error)

GetVideoAnalyticsConfigurations lists all video analytics configurations of a device. The client need not know anything apriori about the video analytics in order to use the command.

func (*MediaService) GetVideoEncoderConfiguration

func (s *MediaService) GetVideoEncoderConfiguration(configurationToken string) (res trt.GetVideoEncoderConfigurationResponse, err error)

GetVideoEncoderConfiguration return the VideoEncoderConfiguration if the configuration token is known

func (*MediaService) GetVideoEncoderConfigurations

func (s *MediaService) GetVideoEncoderConfigurations() (res trt.GetVideoEncoderConfigurationsResponse, err error)

GetVideoEncoderConfigurations lists all existing video encoder configurations of a device. The client need not know anything apriori about the video encoder configurations in order to use the command.

func (*MediaService) GetVideoSourceConfiguration

func (s *MediaService) GetVideoSourceConfiguration(configurationToken string) (res trt.GetVideoSourceConfigurationResponse, err error)

GetVideoSourceConfiguration return the VideoSourceConfiguration if the configuration token is known

func (*MediaService) GetVideoSourceConfigurations

func (s *MediaService) GetVideoSourceConfigurations() (res trt.GetVideoSourceConfigurationsResponse, err error)

GetVideoSourceConfigurations lists all existing video source configurations for a device. The client need not know anything about the video source configurations in order to use the command.

func (*MediaService) GetVideoSourceModes

func (s *MediaService) GetVideoSourceModes(videoSourceToken string) (res trt.GetVideoSourceModesResponse, err error)

GetVideoSourceModes returns the information for current video source mode and settable video source modes of specified video source. A device that indicates a capability of VideoSourceModes shall support this command.

func (*MediaService) GetVideoSources

func (s *MediaService) GetVideoSources() (res trt.GetVideoSourcesResponse, err error)

GetVideoSources lists all available physical video inputs of the device.

func (*MediaService) RemoveAudioDecoderConfiguration

func (s *MediaService) RemoveAudioDecoderConfiguration(profileToken string) error

RemoveAudioDecoderConfiguration removes an AudioDecoderConfiguration from an existing media profile. If the media profile does not contain an AudioDecoderConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemoveAudioEncoderConfiguration

func (s *MediaService) RemoveAudioEncoderConfiguration(profileToken string) error

RemoveAudioEncoderConfiguration removes an AudioEncoderConfiguration from an existing media profile. If the media profile does not contain an AudioEncoderConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemoveAudioOutputConfiguration

func (s *MediaService) RemoveAudioOutputConfiguration(profileToken string) error

RemoveAudioOutputConfiguration removes an AudioOutputConfiguration from an existing media profile. If the media profile does not contain an AudioOutputConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemoveAudioSourceConfiguration

func (s *MediaService) RemoveAudioSourceConfiguration(profileToken string) error

RemoveAudioSourceConfiguration removes an AudioSourceConfiguration from an existing media profile. If the media profile does not contain an AudioSourceConfiguration, the operation has no effect. The removal shall be persistent.

Audio source configurations should only be removed after removing an AudioEncoderConfiguration from the media profile.

func (*MediaService) RemoveMetadataConfiguration

func (s *MediaService) RemoveMetadataConfiguration(profileToken string) error

RemoveMetadataConfiguration removes a MetadataConfiguration from an existing media profile. If the media profile does not contain a MetadataConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemovePTZConfiguration

func (s *MediaService) RemovePTZConfiguration(profileToken string) error

RemovePTZConfiguration removes a PTZConfiguration from an existing media profile. If the media profile does not contain a PTZConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemoveVideoAnalyticsConfiguration

func (s *MediaService) RemoveVideoAnalyticsConfiguration(profileToken string) error

RemoveVideoAnalyticsConfiguration removes a VideoAnalyticsConfiguration from an existing media profile. If the media profile does not contain a VideoAnalyticsConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemoveVideoEncoderConfiguration

func (s *MediaService) RemoveVideoEncoderConfiguration(profileToken string) error

RemoveVideoEncoderConfiguration removes a VideoEncoderConfiguration from an existing media profile. If the media profile does not contain a VideoEncoderConfiguration, the operation has no effect. The removal shall be persistent.

func (*MediaService) RemoveVideoSourceConfiguration

func (s *MediaService) RemoveVideoSourceConfiguration(profileToken string) error

RemoveVideoSourceConfiguration removes a VideoSourceConfiguration from an existing media profile. If the media profile does not contain a VideoSourceConfiguration, the operation has no effect. The removal shall be persistent. Video source configurations should only be removed after removing a VideoEncoderConfiguration from the media profile.

func (*MediaService) SetMetadataConfiguration

func (s *MediaService) SetMetadataConfiguration(configuration tt.MetadataConfiguration) (res trt.SetMetadataConfigurationResponse, err error)

SetMetadataConfiguration modifies a metadata configuration. The ForcePersistence flag indicates if the changes shall remain after reboot of the device. Changes in the Multicast settings shall always be persistent. Running streams using this configuration may be updated immediately according to the new settings. The changes are not guaranteed to take effect unless the client requests a new stream URI and restarts any affected streams. NVC methods for changing a running stream are out of scope for this specification.

func (*MediaService) SetOSD

func (s *MediaService) SetOSD(configuration tt.OSDConfiguration) (res trt.SetOSDResponse, err error)

SetOSD set the OSD

func (*MediaService) SetVideoSourceMode

func (s *MediaService) SetVideoSourceMode(videoSourceToken, videoSourceModeToken string) (res trt.SetVideoSourceModeResponse, err error)

SetVideoSourceMode changes the media profile structure relating to video source for the specified video source mode. A device that indicates a capability of VideoSourceModes shall support this command. The behavior after changing the mode is not defined in this specification.

func (*MediaService) WithoutAuth

func (s *MediaService) WithoutAuth() *MediaService

type OnvifDevice

type OnvifDevice struct {
	Capabilities onvif.Capabilities

	Device *DeviceService
	Media  *MediaService
	Events *EventsService
	// contains filtered or unexported fields
}

func NewOnvifDevice

func NewOnvifDevice(xaddr string) *OnvifDevice

func (*OnvifDevice) Auth

func (onvifDevice *OnvifDevice) Auth(login, password string)

func (*OnvifDevice) Call

func (onvifDevice *OnvifDevice) Call(request, response interface{}) error

func (*OnvifDevice) Initialize

func (onvifDevice *OnvifDevice) Initialize() error

func (*OnvifDevice) On

func (onvifDevice *OnvifDevice) On(endpoint string) (caller onvifCaller, ok bool)

type PullPointSubscription

type PullPointSubscription struct {
	Client   onvifCaller
	Settings tev.CreatePullPointSubscriptionResponse
}

func NewPullPointSubscription

func NewPullPointSubscription(settings tev.CreatePullPointSubscriptionResponse, onvifDevice *OnvifDevice) *PullPointSubscription

func (*PullPointSubscription) PullMessages

func (s *PullPointSubscription) PullMessages(timeout time.Duration, messageLimit int) (res tev.PullMessagesResponse, err error)

PullMessages pulls one or more messages from a PullPoint. The device shall provide the following PullMessages command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. This method shall not wait until the requested number of messages is available but return as soon as at least one message is available.

The command shall at least support a Timeout of one minute. In case a device supports retrieval of less messages than requested it shall return these without generating a fault.

func (*PullPointSubscription) Seek

func (s *PullPointSubscription) Seek(time time.Time, reverse bool) (err error)

Seek readjusts the pull pointer into the past. A device supporting persistent notification storage shall provide the following Seek command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. The optional Reverse argument can be used to reverse the pull direction of the PullMessages command.

The UtcTime argument will be matched against the UtcTime attribute on a NotificationMessage.

func (*PullPointSubscription) SetSynchronizationPoint

func (s *PullPointSubscription) SetSynchronizationPoint() (err error)

SetSynchronizationPoint inform a client about property creation, changes and deletion in a uniform way. When a client wants to synchronize its properties with the properties of the device, it can request a synchronization point which repeats the current status of all properties to which a client has subscribed. The PropertyOperation of all produced notifications is set to “Initialized”. The Synchronization Point is requested directly from the SubscriptionManager which was returned in either the SubscriptionResponse or in the CreatePullPointSubscriptionResponse. The property update is transmitted via the notification transportation of the notification interface. This method is mandatory.

func (*PullPointSubscription) Unsubscribe

func (s *PullPointSubscription) Unsubscribe() (err error)

Unsubscribe shall terminate the lifetime of a pull point

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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