I have now implemented callbacks in Java, (JNA) seems to work just fine.
Snippet for the callbacks:
Code: Select all
// typedef void (WINAPI *TDDeviceEvent)(int deviceId, int method, const char *data, int callbackId, void *context);
interface TDDeviceEvent extends Callback{
void invoke(int deviceId, int method, Pointer data, int callbackId, Pointer context);
}
// TELLSTICK_API int WINAPI tdRegisterDeviceEvent( TDDeviceEvent eventFunction, void *context );
public int tdRegisterDeviceEvent( TDDeviceEvent eventFunction, Pointer context );
// typedef void (WINAPI *TDDeviceChangeEvent)(int deviceId, int changeEvent, int changeType, int callbackId, void *context);
interface TDDeviceChangeEvent extends Callback{
void invoke(int deviceId, int changeEvent, int changeType, int callbackId, Pointer context);
}
// TELLSTICK_API int WINAPI tdRegisterDeviceChangeEvent( TDDeviceChangeEvent eventFunction, void *context);
public int tdRegisterDeviceChangeEvent( TDDeviceChangeEvent eventFunction, Pointer context);
// typedef void (WINAPI *TDRawDeviceEvent)(const char *data, int controllerId, int callbackId, void *context);
interface TDRawDeviceEvent extends Callback{
void invoke(Pointer data, int controllerId, int callbackId, Pointer context);
}
// TELLSTICK_API int WINAPI tdRegisterRawDeviceEvent( TDRawDeviceEvent eventFunction, void *context );
public int tdRegisterRawDeviceEvent( TDRawDeviceEvent eventFunction, Pointer context );