Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#:OnvifClientPTZ_C#_Camera_Zooming_Pan_Onvif - Fatal编程技术网

C#:OnvifClientPTZ

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

我正在尝试开发一个带有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_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>