示例#1
0
JNIEXPORT void JNICALL
Java_com_phidgets_Phidget_enableErrorEvents(JNIEnv *env, jobject obj,
  jboolean b)
{
	jlong gr = updateGlobalRef(env, obj, nativeErrorHandler_fid, b);
	CPhidgetHandle h = (CPhidgetHandle)(uintptr_t)(*env)->GetLongField(env,
	    obj, handle_fid);

	CPhidget_set_OnError_Handler(h, b ? error_handler : 0, (void *)(uintptr_t)gr);
}
JNIEXPORT void JNICALL
Java_com_phidgets_Manager_enableServerDisconnectEvents(JNIEnv *env, jobject obj,
  jboolean b)
{
	jlong gr = updateGlobalRef(env, obj, nativeServerDisconnectHandler_fid, b);
	CPhidgetManagerHandle h = (CPhidgetManagerHandle)(uintptr_t)(*env)->GetLongField(env,
	    obj, manager_handle_fid);

	CPhidgetManager_set_OnServerDisconnect_Handler(h, b ? serverDisconnect_handler : 0,
	    (void *)(uintptr_t)gr);
}
JNIEXPORT void JNICALL Java_com_phidgets_RFIDPhidget_enableTagGainEvents (JNIEnv * env, jobject obj, jboolean b)
{
	jlong gr = updateGlobalRef (env, obj, nativeTagGainHandler_fid, b);
	CPhidgetRFIDHandle h = (CPhidgetRFIDHandle) (uintptr_t) (*env)->GetLongField (env, obj, handle_fid);
	CPhidgetRFID_set_OnTag2_Handler (h, b ? tagGain_handler : 0, (void *) (uintptr_t) gr);
} static int CCONV