From 47047c3e34f437be2a9e4aedce332610ffa95cb9 Mon Sep 17 00:00:00 2001 From: "hongri8488@163.com" Date: Fri, 1 Nov 2024 08:36:14 +0800 Subject: [PATCH] =?UTF-8?q?onvif.go=20=E6=96=87=E4=BB=B6=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=20Vector2D=20,=20Vector1D=20=E4=B8=A4=E4=B8=AA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=B8=ADSpace=E7=9A=84=E5=A4=87=E6=B3=A8=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=8A=A0=E4=B8=8Aomitempty,=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Space xsd.AnyURI `xml:"space,attr,omitempty"` ``` 否则当Space传空值会报错,引用了PTZ节点不支持的空间。( env:Sender - ter:InvalidArgVal - ter:SpaceNotSupported) 原 ``` type PTZVector struct { PanTilt Vector2D `xml:"onvif:PanTilt"` Zoom Vector1D `xml:"onvif:Zoom"` } ``` 改为 ``` type PTZVector struct { PanTilt Vector2D `xml:"PanTilt"` Zoom Vector1D `xml:"Zoom"` } ``` 否则查询当前位置信息返回值都为0,不能正确解析xml中float的值 --- xsd/onvif/onvif.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xsd/onvif/onvif.go b/xsd/onvif/onvif.go index 6706520b..58f73aa9 100644 --- a/xsd/onvif/onvif.go +++ b/xsd/onvif/onvif.go @@ -555,12 +555,12 @@ type PTZSpeed struct { type Vector2D struct { X float64 `xml:"x,attr"` Y float64 `xml:"y,attr"` - Space xsd.AnyURI `xml:"space,attr"` + Space xsd.AnyURI `xml:"space,attr,omitempty"` } type Vector1D struct { X float64 `xml:"x,attr"` - Space xsd.AnyURI `xml:"space,attr"` + Space xsd.AnyURI `xml:"space,attr,omitempty"` } type PanTiltLimits struct { @@ -1013,8 +1013,8 @@ type PTZPreset struct { } type PTZVector struct { - PanTilt Vector2D `xml:"onvif:PanTilt"` - Zoom Vector1D `xml:"onvif:Zoom"` + PanTilt Vector2D `xml:"PanTilt"` + Zoom Vector1D `xml:"Zoom"` } type PTZStatus struct {