我对JNA有点问题。通过参数
我的代码:
头C:
#ifndef IOPROTOCOL_H_INCLUDED
#define IOPROTOCOL_H_INCLUDED
typedef signed char INT8;
typedef short INT16;
typedef int INT32;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
/* Types d'IO */
typedef enum { IOT_U1, IOT_U2, IOT_U8, IOT_I8, IOT_U16, IOT_I16, IOT_U32, IOT_I32, IOT_F32, IOT_STRING, IOT_MAX } IoTypeE;
typedef union {
INT32 i;
UINT32 u;
float f;
char * s;
} Value;
typedef struct {
int (*Read) (char *rxbuf, int rxlen, UINT8 interTo);
int (*Write) (char *txbuf,int txlen);
int (*FunctionResponse) (int address, Value value, IoTypeE type);
int (*SendTraceRoute) (char * trace);
} DeviceFuncT;
int readTrame(DeviceFuncT *deviceFunct, UINT32 function, UINT32 address, UINT32 countAddress, UINT32 slave, UINT32 type);
int writeTrame(DeviceFuncT *deviceFunct, UINT32 function, UINT32 address, Value value, UINT32 type, UINT32 slave);
#endif // IOPROTOCOL_H_INCLUDED
DeviceFuncT是用Java创建并在功能readTrame或writeTrame参数传递。我调用C(因为dll ^^)DeviceFuncT - >(* Read)(char * rxbuf,int rxlen,UINT8 interTo);
在java中,
public static interface ReadFunct extends com.sun.jna.Callback{
int invoke(String rxbuf, int rxlen, byte interto);
}
所以char* rxbuf == String rxbu
˚F
我必须用Java处理RXBUF前完成功能后,我处理rxbux EN C,但我不到货具有值在Java中设置C中的函数...
你能帮助解决这个问题吗?请 :)。
对不起,我的说明。
谢谢。