mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-30 10:31:25 +08:00
接入萤石摄像头后端
This commit is contained in:
37
pkg/ys/ptz.go
Normal file
37
pkg/ys/ptz.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package ys
|
||||
|
||||
const (
|
||||
//云台控制开始
|
||||
URLPTZSTAR = "https://open.ys7.com/api/lapp/device/ptz/start"
|
||||
//云台控制结束
|
||||
URLPTZSTOP = "https://open.ys7.com/api/lapp/device/ptz/stop"
|
||||
)
|
||||
|
||||
// StartPtz 开始云台控制
|
||||
func (ys *Ys) StartPtz(deviceSerial string, channelNo, direction, speed int) (err error) {
|
||||
params := make(map[string]interface{})
|
||||
params["deviceSerial"] = deviceSerial
|
||||
params["channelNo"] = channelNo
|
||||
params["direction"] = direction
|
||||
params["speed"] = speed
|
||||
|
||||
_, err = ys.authorizeRequset("POST", URLPTZSTAR, params, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StopPtz 停止云台转动
|
||||
func (ys *Ys) StopPtz(deviceSerial string, channelNo, direction int) (err error) {
|
||||
params := make(map[string]interface{})
|
||||
params["deviceSerial"] = deviceSerial
|
||||
params["channelNo"] = channelNo
|
||||
params["direction"] = direction
|
||||
|
||||
_, err = ys.authorizeRequset("POST", URLPTZSTOP, params, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user