viamonvif

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: 19 Imported by: 0

Documentation

Overview

Package viamonvif provides ONVIF integration to the viamrtsp module

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRTSPStreamURIsFromProfiles

func GetRTSPStreamURIsFromProfiles(dev OnvifDevice, creds device.Credentials, logger logging.Logger) ([]string, error)

GetRTSPStreamURIsFromProfiles uses the ONVIF Media service to get the RTSP stream URLs for all available profiles.

func SendProbe

func SendProbe(interfaceName string, logger logging.Logger) ([]string, error)

SendProbe makes a WS-Discovery Probe call.

func WSDiscovery

func WSDiscovery(ctx context.Context, logger logging.Logger, iface net.Interface) ([]*url.URL, error)

WSDiscovery runs WS-Discovery on the network interface.

Types

type CameraInfo

type CameraInfo struct {
	Host            string   `json:"host"`
	RTSPURLs        []string `json:"rtsp_urls"`
	Manufacturer    string   `json:"manufacturer"`
	Model           string   `json:"model"`
	SerialNumber    string   `json:"serial_number"`
	FirmwareVersion string   `json:"firmware_version"`
	HardwareID      string   `json:"hardware_id"`
}

CameraInfo holds both the RTSP URLs and supplementary camera details.

func DiscoverCameraInfo

func DiscoverCameraInfo(
	ctx context.Context,
	xaddr *url.URL,
	creds []device.Credentials,
	logger logging.Logger,
) (CameraInfo, error)

DiscoverCameraInfo discovers camera information on a given uri using onvif the xaddr should be the URL of the onvif camera's device service URI.

func GetCameraInfo

func GetCameraInfo(dev OnvifDevice, xaddr *url.URL, creds device.Credentials, logger logging.Logger) (CameraInfo, error)

GetCameraInfo uses the ONVIF Media service to get the RTSP stream URLs and camera details.

func (*CameraInfo) Name

func (cam *CameraInfo) Name(urlNum int) string

Name creates generates a name for the camera based on discovered information about the camera.

type CameraInfoList

type CameraInfoList struct {
	Cameras []CameraInfo `json:"cameras"`
}

CameraInfoList is a struct containing a list of CameraInfo structs.

func DiscoverCameras

func DiscoverCameras(
	ctx context.Context,
	creds []device.Credentials,
	manualXAddrs []*url.URL,
	logger logging.Logger,
) (*CameraInfoList, error)

DiscoverCameras performs WS-Discovery then uses ONVIF queries to get available RTSP addresses and supplementary info.

type OnvifDevice

type OnvifDevice interface {
	GetDeviceInformation() (device.GetDeviceInformationResponse, error)
	GetProfiles() (device.GetProfilesResponse, error)
	GetStreamURI(profile onvif.Profile, creds device.Credentials) (*url.URL, error)
}

OnvifDevice is an interface to abstract device methods used in the code. Used instead of onvif.Device to allow for mocking in tests.

Directories

Path Synopsis
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.
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.
Package gosoap provides a minimal soap client for viamonvif
Package gosoap provides a minimal soap client for viamonvif
xsd
Package xsd provides base onvif types inspired by https://github.com/use-go/onvif
Package xsd provides base onvif types inspired by https://github.com/use-go/onvif
iso8601
Package iso8601 provides minimal iso8601 support inspired by https://github.com/use-go/onvif
Package iso8601 provides minimal iso8601 support inspired by https://github.com/use-go/onvif
onvif
Package onvif provides base onvif types inspired by https://github.com/use-go/onvif
Package onvif provides base onvif types inspired by https://github.com/use-go/onvif

Jump to

Keyboard shortcuts

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