我正在尝试使用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对象,看看我是否可以调用这些函数而且它似乎可以。
关于发生了什么的任何想法,至少我如何进一步调试它?