driver

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER        = "User"
	PASSWORD    = "Password"
	AUTH_METHOD = "AuthMethod"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver implements the sdkModel.ProtocolDriver interface for the device service

func NewProtocolDriver

func NewProtocolDriver() *Driver

NewProtocolDriver initializes the singleton Driver and returns it to the caller

func (*Driver) AddDevice

func (d *Driver) AddDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error

AddDevice is a callback function that is invoked when a new Device associated with this Device Service is added

func (*Driver) DisconnectDevice

func (d *Driver) DisconnectDevice(deviceName string, protocols map[string]contract.ProtocolProperties) error

DisconnectDevice handles protocol-specific cleanup when a device is removed.

func (*Driver) HandleReadCommands

func (d *Driver) HandleReadCommands(deviceName string, protocols map[string]contract.ProtocolProperties, reqs []sdkModel.CommandRequest) ([]*sdkModel.CommandValue, error)

HandleReadCommands triggers a protocol Read operation for the specified device.

func (*Driver) HandleWriteCommands

func (d *Driver) HandleWriteCommands(deviceName string, protocols map[string]contract.ProtocolProperties, reqs []sdkModel.CommandRequest, params []*sdkModel.CommandValue) error

HandleWriteCommands passes a slice of CommandRequest struct each representing a ResourceOperation for a specific device resource (aka DeviceObject). Since the commands are actuation commands, params provide parameters for the individual command.

func (*Driver) Initialize

func (d *Driver) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModel.AsyncValues, deviceCh chan<- []sdkModel.DiscoveredDevice) error

Initialize performs protocol-specific initialization for the device service.

func (*Driver) RemoveDevice

func (d *Driver) RemoveDevice(deviceName string, protocols map[string]contract.ProtocolProperties) error

RemoveDevice is a callback function that is invoked when a Device associated with this Device Service is removed

func (*Driver) Stop

func (d *Driver) Stop(force bool) error

Stop the protocol-specific DS code to shutdown gracefully, or if the force parameter is 'true', immediately. The driver is responsible for closing any in-use channels, including the channel used to send async readings (if supported).

func (*Driver) UpdateDevice

func (d *Driver) UpdateDevice(deviceName string, protocols map[string]contract.ProtocolProperties, adminState contract.AdminState) error

UpdateDevice is a callback function that is invoked when a Device associated with this Device Service is updated

type OnvifClient

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

OnvifClient manages the state required to issue ONVIF requests to a camera

func NewOnvifClient

func NewOnvifClient(ipAddress string, user string, password string, cameraAuth string, lc logger.LoggingClient) *OnvifClient

NewOnvifClient returns an OnvifClient for a single camera

func (*OnvifClient) CreateUser

func (c *OnvifClient) CreateUser(user onvif.User) error

CreateUser creates a new ONVIF User for the device

func (*OnvifClient) GetDNS

func (c *OnvifClient) GetDNS() (string, error)

GetDNS returns the DNS settings as reported by the ONVIF GetDNS command

func (*OnvifClient) GetDeviceInformation

func (c *OnvifClient) GetDeviceInformation() (string, error)

GetDeviceInformation makes an ONVIF GetDeviceInformation request to the camera

func (*OnvifClient) GetHostname

func (c *OnvifClient) GetHostname() (string, error)

GetHostname returns the hostname reported by the device via the ONVIF GetHostname command

func (*OnvifClient) GetNTP

func (c *OnvifClient) GetNTP() (string, error)

GetNTP returns the results of the ONVIF GetNTP command

func (*OnvifClient) GetNetworkDefaultGateway

func (c *OnvifClient) GetNetworkDefaultGateway() (string, error)

GetNetworkDefaultGateway returns the results of the ONVIF GetNetworkDefaultGateway command

func (*OnvifClient) GetNetworkInterfaces

func (c *OnvifClient) GetNetworkInterfaces() (string, error)

GetNetworkInterfaces returns the results of the ONVIF GetNetworkInterfaces command

func (*OnvifClient) GetNetworkProtocols

func (c *OnvifClient) GetNetworkProtocols() (string, error)

GetNetworkProtocols returns the resutls of the ONVIF GetNetworkProtocols command

func (*OnvifClient) GetProfileInformation

func (c *OnvifClient) GetProfileInformation() (string, error)

GetProfileInformation makes an ONVIF GetProfiles request to the camera

func (*OnvifClient) GetSnapshot

func (c *OnvifClient) GetSnapshot() ([]byte, error)

GetSnapshot returns a snapshot from the camera as a slice of bytes

func (*OnvifClient) GetStreamURI

func (c *OnvifClient) GetStreamURI() (string, error)

GetStreamURI returns the RTSP URI for the first media profile returned by the camera

func (*OnvifClient) GetSystemDateAndTime

func (c *OnvifClient) GetSystemDateAndTime() (string, error)

GetSystemDateAndTime returns the current date and time as reported by the ONVIF GetSystemDateAndTime command

func (*OnvifClient) GetUsers

func (c *OnvifClient) GetUsers() (string, error)

GetUsers requests the Users associated with the device via ONVIF

func (*OnvifClient) Reboot

func (c *OnvifClient) Reboot() (string, error)

Reboot requests a device system reboot via ONVIF

func (*OnvifClient) SetHostname

func (c *OnvifClient) SetHostname(name string) error

SetHostname requests a change to the camera's hostname via the ONFVIF SetHostname command

func (*OnvifClient) SetHostnameFromDHCP

func (c *OnvifClient) SetHostnameFromDHCP() error

SetHostnameFromDHCP requests the camera to base its hostname from DHCP

func (*OnvifClient) SetSystemDateAndTime

func (c *OnvifClient) SetSystemDateAndTime(datetime time.Time) error

SetSystemDateAndTime changes the camera's system time via the SetSystemDateAndTime ONVIF command

Jump to

Keyboard shortcuts

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