C#:OnvifClientPTZ
我正在尝试开发一个带有ONVIF的控制IP摄像头。但是我在连接ONVIF的PTZ服务器时遇到了一个小问题。 这是我的密码:C#:OnvifClientPTZ,c#,camera,zooming,pan,onvif,C#,Camera,Zooming,Pan,Onvif,我正在尝试开发一个带有ONVIF的控制IP摄像头。但是我在连接ONVIF的PTZ服务器时遇到了一个小问题。 这是我的密码: private void PTZTest(DeviceClient client, double deviceTimeOffset, string ip, int port) { // Create Media object string xaddr = string.Format("http://{0}/onvif/device_s
private void PTZTest(DeviceClient client, double deviceTimeOffset, string ip, int port)
{
// Create Media object
string xaddr = string.Format("http://{0}/onvif/device_service", txtIP.Text);
MediaClient mediaService = OnvifServices.GetOnvifMediaClient(xaddr, deviceTimeOffset, txtUser.Text, txtPassword.Text);
// Create PTZ object
string xaddr2 = string.Format("http://{0}/onvif/ptz_service",txtIP.Text);
PTZClient ptzService = OnvifServices.GetOnvifPTZClient(xaddr2, deviceTimeOffset, txtUser.Text, txtPassword.Text);
// Get target profile
Profile[] mediaProfiles = mediaService.GetProfiles();
Profile mediaProfile = mediaService.GetProfile(mediaProfiles[0].token);
PTZConfigurationOptions ptzConfigurationOptions = ptzService.GetConfigurationOptions(mediaProfile.PTZConfiguration.token);
PTZ.PTZSpeed velocity = new PTZ.PTZSpeed();
velocity.Zoom = new PTZ.Vector1D() { x = speed * ptzConfigurationOptions.Spaces.ContinuousZoomVelocitySpace[0].XRange.Max };
当我在该行设置断点时
PTZConfigurationOptions PTZConfigurationOptions=ptzService.GetConfigurationOptions(mediaProfile.PTZConfiguration.token)代码>我收到了此错误消息:
上没有侦听终结点
这可以接受这个信息。
这通常是由于不正确的SOAP地址或操作造成的。如果有,
有关更多信息,请参见InnerException元素
但是我不明白为什么我可以拥有PTZ服务的列表和所有关于mediaService的信息,但是我无法获得PTZ配置选项
有人知道到底是什么问题吗?我该怎么解决呢,拜托 并非每个onvif设备都将在同一端点上承载其PTZ服务。通常使用的方法是从DeviceService查询GetServices/GetCapabilities调用。这是唯一一个通常始终具有相同URL的服务-“”
因此,使用的方法是(伪代码)
您不使用device_服务器进行任何ptz_服务调用,只需使用它查找设备服务的正确URL。如果您进行GetService调用,响应将包括以下内容
<tds:Service> <tds:Namespace>onvif.org/ver20/ptz/wsdl</tds:Namespace> <tds:XAddr>ip/onvif/ptz</tds:XAddr> </tds:Service>
onvif.org/ver20/ptz/wsdl-ip/onvif/ptz
有关更多详细信息,请参见我需要查看响应中的状态代码。使用像wireshark或fiddler这样的嗅探器捕获请求和响应。如果您有一个工作申请,则将第一个工作申请与非工作申请进行比较。然后使c#非工作请求看起来像工作请求。正常故障状态代码为400s或500s错误。感谢提供信息。但是,如果我使用尝试获取ptzConfigurationOptions,则得到了(400)个错误请求。这意味着PTZ服务的正确IP是<>,不是吗?请多解释一下,谢谢
<tds:Service> <tds:Namespace>onvif.org/ver20/ptz/wsdl</tds:Namespace> <tds:XAddr>ip/onvif/ptz</tds:XAddr> </tds:Service>