Search Results

Search found 1 results on 1 pages for 'tyeh26'.

Page 1/1 | 1 

  • JNA Passing Structure By Reference Help

    - by tyeh26
    Hi all, I'm trying to use JNA to talk over a USB device plugged into the computer. Using Java and a .dll that was provided to me. I am having trouble with the Write function: C code: typedef struct { unsigned int id; unsigned int timestamp; unsigned char flags; unsigned char len; unsigned char data[16]; } CANMsg; CAN_STATUS canplus_Write( CANHANDLE handle, //long CANMsg *msg ); Java Equivalent: public class CANMsg extends Structure{ public int id = 0; public int timestamp = 0; public byte flags = 0; public byte len = 8; public byte data[] = new byte[16]; } int canplus_Write(NativeLong handle, CANMsg msg); I have confirmed that I can open and close the device. The close requires the NativeLong handle, so i am assuming that the CANMsg msg is the issue here. I have also confirmed that the device works when tested with C only code. I have read the the JNA documentation thoroughly... I think. Any pointers. Thanks all.

    Read the article

1