onvif

package module
v0.0.0-...-ad4f507 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Enhanced and Improved from: goonvif http://www.8fe.com/jiaocheng/7439.html

  1. 备注 需要特别注意: 1、import use-go/onvif 相关包的时候,一定要加上别名。 2、摄像头的地址一定要可以ping通,并且username和password不是登陆摄像头管理后台的用户,而是协议用户:

海康摄像头的配置路径:管理后台 -> 配置 -> 网络 -> 高级配置 -> 集成协议

  • interfacename: WLAN # 网卡名称 或者"以太网" "eth0"等,使用ipconfig 或者 ifconfig 查看网卡名称 以太网 2

Onvif云台控制 云台控制说明:

x、y、z 范围都在0-1之间。 x为负数,表示左转,x为正数,表示右转。 y为负数,表示下转,y为正数,表示上转。 z为正数,表示拉近,z为负数,表示拉远。 通过x和y的组合,来实现云台的控制。 通过z的组合,来实现焦距控制。

void frmPtz::moveAbsolute() { OnvifDevice *device = frm->getCurrentDevice(); if (device) { QString profile = frm->getProfile(); device->moveAbsolute(profile, x, y, z); frm->append(5, QString("执行绝对移动-> x: %1 y: %2 z: %3").arg(x).arg(y).arg(z)); } }

void frmPtz::moveRelative() { OnvifDevice *device = frm->getCurrentDevice(); if (device) { QString profile = frm->getProfile(); device->moveRelative(profile, x, y, z); frm->append(5, QString("执行相对移动-> x: %1 y: %2 z: %3").arg(x).arg(y).arg(z)); } }

void frmPtz::setFrm(frmMain *frm) { this->frm = frm; }

void frmPtz::on_btnPtzUp_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.0; y = 0.1; z = 0.0; moveRelative(); } else { y = 0.1; moveAbsolute(); } }

void frmPtz::on_btnPtzDown_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.0; y = -0.1; z = 0.0; moveRelative(); } else { y = -0.0; moveAbsolute(); } }

void frmPtz::on_btnPtzLeft_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = -0.1; y = 0.0; z = 0.0; moveRelative(); } else { x = 0.0; moveAbsolute(); } }

void frmPtz::on_btnPtzRight_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.1; y = 0.0; z = 0.0; moveRelative(); } else { x = 0.1; moveAbsolute(); } }

void frmPtz::on_btnPtzLeftUp_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = -0.1; y = 0.1; z = 0.0; moveRelative(); } else { x = 0.0; y = 0.0; moveAbsolute(); } }

void frmPtz::on_btnPtzLeftDown_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = -0.1; y = -0.1; z = 0.0; moveRelative(); } else { x = 0.1; y = 0.1; moveAbsolute(); } }

void frmPtz::on_btnPtzRightUp_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.1; y = 0.1; z = 0.0; moveRelative(); } else { x = 0.0; y = 0.0; moveAbsolute(); } }

void frmPtz::on_btnPtzRightDown_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.1; y = -0.1; z = 0.0; moveRelative(); } else { x = 0.1; y = 0.1; moveAbsolute(); } }

void frmPtz::on_btnPtzZoomIn_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.0; y = 0.0; z = 0.01; moveRelative(); } else { z = 0.01; moveAbsolute(); } }

void frmPtz::on_btnPtzZoomOut_clicked() { if (ui->rbtnMoveRelative->isChecked()) { x = 0.0; y = 0.0; z = -0.01; moveRelative(); } else { z = 0.0; moveAbsolute(); } }

void frmPtz::on_btnPtzStop_clicked() { OnvifDevice *device = frm->getCurrentDevice(); if (device) { frm->setText("ptzStop"); QString profile = frm->getProfile(); device->moveStop(profile); } }

void frmPtz::on_btnPtzReset_clicked() { x = 0.0; y = 0.0; z = 0.0; moveAbsolute(); }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoveryDevice

func DiscoveryDevice()

Types

type Device

type Device struct {
	Dev *goonvif.Device
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(params DeviceParams) (*Device, error)

func (*Device) ControlPTZ

func (dev *Device) ControlPTZ(control_type int32, control bool, speed float64) error

func (*Device) GetDeviceInformation

func (dev *Device) GetDeviceInformation(ctx context.Context)

GetDeviceInformation 读取设备基础信息 @author: Sen @date : 2023-03-09 16:36:16

func (*Device) GetDownSnapshot

func (dev *Device) GetDownSnapshot(url, path string) error

func (*Device) GetDownSnapshotData

func (dev *Device) GetDownSnapshotData(url string) ([]byte, error)

func (*Device) GetSnapshotUri

func (dev *Device) GetSnapshotUri() (string, error)

func (*Device) GetStreamUri

func (dev *Device) GetStreamUri() (string, error)

func (*Device) SearchDevice

func (dev *Device) SearchDevice() error

*

  • @Description: 搜索设备,返回搜索到的设备列表
  • @Author:ZY
  • @time: 2021-03-25 14:23:04
  • @receiver client
  • @return returnInfo

type DeviceParams

type DeviceParams struct {
	Xaddr      string
	Username   string
	Password   string
	HttpClient *http.Client
}

type Host

type Host struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

type PtzType

type PtzType int32

设备类型

const (
	PTZ_UP       PtzType = 0
	PTZ_DOWN     PtzType = 1
	PTZ_LEFT     PtzType = 2
	PTZ_LEFTUP   PtzType = 3
	PTZ_LEFTDOWN PtzType = 4

	PTZ_RIGHT     PtzType = 5
	PTZ_RIGHTUP   PtzType = 6
	PTZ_RIGHTDOWN PtzType = 7

	PTZ_ZOOMIN  PtzType = 8
	PTZ_ZOOMOUT PtzType = 9
)

Jump to

Keyboard shortcuts

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