bugfix:PTZ Move中,Xaddr的XAddr构建bug。

bugfix:onvif的PTZ的文档中的move方法,JSON结构错误,导致无法反序列化,另外不写Space参数,如果加了这个参数,海康会报错。
This commit is contained in:
uliian
2025-09-23 10:35:47 +08:00
committed by banshan
parent bd24230dde
commit 6b3a3ad801
2 changed files with 9 additions and 9 deletions

View File

@@ -930,14 +930,14 @@ POST /onvif/api/ptz
```json ```json
{ {
"PanTilt": { "Move":{
"X": 1, "PanTilt": {
"Y": 1, "X": 1,
"Space": "http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace" "Y": 1
}, },
"Zoom": { "Zoom": {
"X": 1, "X": 1
"Space": "http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace" }
} }
} }
``` ```

View File

@@ -253,7 +253,7 @@ func (d *DeviceStatus) SetPtzPreset(name string, presetToken string) (*onvifType
// PtzMove PTZ移动控制 // PtzMove PTZ移动控制
func (d *DeviceStatus) PtzMove(mode int, move ptz.Vector, speed ptz.Speed) error { func (d *DeviceStatus) PtzMove(mode int, move ptz.Vector, speed ptz.Speed) error {
dev, err := donvif.NewDevice(donvif.DeviceParams{ dev, err := donvif.NewDevice(donvif.DeviceParams{
Xaddr: fmt.Sprintf("http://%s/onvif/device_service", d.IP), Xaddr: fmt.Sprintf("%s:%s", d.IP, d.Port),
Username: d.Username, Username: d.Username,
Password: d.Password, Password: d.Password,
}) })