开发商给了一个sdk开发包,我用jna调用时可以里面的方法。但是获取不了设备采集的信息。通过java类里的指针类获取不了里面的数据。那位仁兄有这方面的经验,提供点代码参观一下。

解决方案 »

  1.   

    http://blog.csdn.net/shendl/archive/2008/12/23/3589676.aspx
    这个也许能帮到你。
      

  2.   

    这个人的文章看到过 我可以用jna调用sdk的方法 但是sdk方法为
    short GetNetAccessImage(unsigned char *pSourceImg) 
    当调用该方法时 unsigned char *pSourceImg 将图像写到
    *pSourceImg 我在jna中声明引用该方法 
    public interface CLibrary extends Library {
            public static Pointer  parray = new Pointer(101376);
            CLibrary INSTANCE = (CLibrary)
     
                Native.loadLibrary((Platform.isWindows() ? "BioNetAcsDll" : "c"),CLibrary.class);public short GetNetAccessImage(Pointer  parray);
     public static void main(String[] args) {
        d =  CLibrary.INSTANCE.GetNetAccessImage(parray);  
     
     }
    }报错 虚拟机错误 就这里过不去
    #
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0aea33c3, pid=2600, tid=4000
    #
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
    # Problematic frame:
    # C  [BioNetAcsDll.dll+0x33c3]
    #
    # An error report file with more information is saved as hs_err_pid2600.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #
      

  3.   


     public short GetNetAccessImage(ByteArrayInputStream bis); public static void main(String[] args) {
    d = CLibrary.INSTANCE.GetNetAccessImage(bis); }
    Exception in thread "main" java.lang.IllegalArgumentException: Unsupported argument type java.io.ByteArrayInputStream at parameter 0 of function GetNetAccessImage
    at com.sun.jna.Function.convertArgument(Function.java:552)
    at com.sun.jna.Function.invoke(Function.java:259)
    at com.sun.jna.Library$Handler.invoke(Library.java:216)
    at $Proxy0.GetNetAccessImage(Unknown Source)
    at HelloWorld.main(HelloWorld.java:77)
    不行失败