4

我正在尝试使用 ActiveX COM 对象库 ocx 来控制 Java 中的相机。

我尝试使用 JACOB lib 调用 lib,但调用任何函数甚至 put 时出现以下错误:

run:
The Library been loaded, and an activeX component been created
The Library been loaded, and an activeX component been created
Exception in thread "main" com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: EnablePTZ
Description: 8000ffff / Catastrophic failure

    at com.jacob.com.Dispatch.invokev(Native Method)
    at com.jacob.com.Dispatch.invokev(Dispatch.java:625)
    at com.jacob.com.Dispatch.callN(Dispatch.java:453)
    at com.jacob.com.Dispatch.call(Dispatch.java:529)
    at au.com.ricor.ACTICamWrapper.<init>(ACTICamWrapper.java:39)
    at au.com.ricor.CameraPanel.main(CameraPanel.java:56)

JACOB 代码实现如下:

  //Loading the library:
    ActiveXComponent ACTICam = new ActiveXComponent("NVUNIFIEDCONTROL.nvUnifiedControlCtrl.1");     
    System.out.println("The Library been loaded, and an activeX component been created");

        ActiveXComponent xmlhttp = new ActiveXComponent("Microsoft.XMLHTTP") ;
        System.out.println("The Library been loaded, and an activeX component been created");

        String strURL = "http://192.168.1.100:80" ;
        strURL = strURL + "/cgi-bin/system?USER=Admin&PWD=123456&SYSTEM_INFO";
        Dispatch.call(xmlhttp,"Open","get",strURL, false);
        Dispatch.call(xmlhttp,"setRequestHeader","Content-Type", "application/x-www-form-urlencoded");
       // Dispatch.call(xmlhttp,"send");

        int test = 1;
        //configure Camerra and connection
        //Dispatch.call(ACTICam,"SetControlActive", true);
        //Dispatch.put(ACTICam, "CodecType",5);
        //Dispatch.put(ACTICam, "MediaType",1);
        //Dispatch.put(ACTICam, "ID",5);
        Dispatch.call(ACTICam, "EnablePTZ");
        Dispatch.call(ACTICam, "PTZIris","AUTO");
        Dispatch.call(ACTICam, "PTZDayNight","ON");
        Dispatch.put(ACTICam, "MediaSource","192.168.10.242");
        ....

注意我已经尝试了另一个 AciveX 对象来查看是否可以调用这些函数,并且似乎可以。

关于正在发生的事情的任何想法,至少我可以如何进一步调试它?

4

0 回答 0