device

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package device allows communication with an onvif device inspired by https://github.com/use-go/onvif NOTE(Nick S): This code currently isn't cancellable. work needs to be done in order to make it cancellable when viam resource Close or Reconfigure are called.

Index

Constants

This section is empty.

Variables

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",
	"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 Schema.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	User string `json:"user"`
	Pass string `json:"pass"`
}

Credentials contain an onvif device username and password.

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 Params, logger logging.Logger) (*Device, error)

NewDevice function construct a ONVIF Device entity.

func (*Device) GetDeviceInformation

func (dev *Device) GetDeviceInformation() (GetDeviceInformationResponse, error)

GetDeviceInformation returns device information.

func (*Device) GetEndpoint

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

GetEndpoint returns specific ONVIF service endpoint address.

func (*Device) GetProfiles

func (dev *Device) GetProfiles() (GetProfilesResponse, error)

GetProfiles returns the device's profiles.

func (*Device) GetStreamURI

func (dev *Device) GetStreamURI(profile onvif.Profile, creds Credentials) (*url.URL, error)

GetStreamURI returns a device's stream URI for a given profile.

type GetCapabilities

type GetCapabilities struct {
	XMLName  string                   `xml:"tds:GetCapabilities"`
	Category onvif.CapabilityCategory `xml:"tds:Category"`
}

GetCapabilities is a request to the GetCapabilities onvif endpoint.

type GetDeviceInformation

type GetDeviceInformation struct {
	XMLName string `xml:"tds:GetDeviceInformation"`
}

GetDeviceInformation is a request to the GetDeviceInformation onvif endpoint.

type GetDeviceInformationResponse

type GetDeviceInformationResponse struct {
	Manufacturer    string `xml:"Manufacturer"`
	Model           string `xml:"Model"`
	FirmwareVersion string `xml:"FirmwareVersion"`
	SerialNumber    string `xml:"SerialNumber"`
	HardwareID      string `xml:"HardwareId"`
}

GetDeviceInformationResponse is the response to GetDeviceInformation.

type GetDeviceInformationResponseEnvelope

type GetDeviceInformationResponseEnvelope struct {
	XMLName xml.Name `xml:"Envelope"`
	Body    struct {
		GetDeviceInformationResponse GetDeviceInformationResponse `xml:"GetDeviceInformationResponse"`
	} `xml:"Body"`
}

GetDeviceInformationResponseEnvelope is the envelope of the GetDeviceInformationResponse.

type GetProfiles

type GetProfiles struct {
	XMLName string `xml:"trt:GetProfiles"`
}

GetProfiles is a request to the GetProfiles onvif endpoint.

type GetProfilesResponse

type GetProfilesResponse struct {
	Profiles []onvif.Profile `xml:"Profiles"`
}

GetProfilesResponse is the body of the response to the GetProfiles endpoint.

type GetProfilesResponseEnvelope

type GetProfilesResponseEnvelope struct {
	XMLName xml.Name `xml:"Envelope"`
	Body    struct {
		GetProfilesResponse GetProfilesResponse `xml:"GetProfilesResponse"`
	} `xml:"Body"`
}

GetProfilesResponseEnvelope is the envelope of the response to the GetProfiles endpoint.

type GetStreamURI

type GetStreamURI struct {
	XMLName      string               `xml:"trt:GetStreamUri"`
	StreamSetup  onvif.StreamSetup    `xml:"trt:StreamSetup"`
	ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"`
}

GetStreamURI is a request to the GetStreamURI onvif endpoint.

type Params

type Params struct {
	Xaddr      *url.URL
	Username   string
	Password   string
	HTTPClient *http.Client
}

Params configures the device connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳