From de3e5d1bbfaf2e22dff5c40559425fa85e61fecf Mon Sep 17 00:00:00 2001 From: "guilhem.duche" Date: Sat, 24 May 2008 09:42:32 +0000 Subject: [PATCH] wiiuseJ 0.12 work in progress. Added method to force stack type and fixed IR.z value and nunchul thresholds. git-svn-id: http://wiiusej.googlecode.com/svn/trunk@143 ae48ae66-6a45-0410-b38e-211266189506 --- WiiUseJC/wiiusej_WiiUseApi.c | 20 +++++++++++++++++++- WiiUseJC/wiiusej_WiiUseApi.def | 1 + WiiUseJC/wiiusej_WiiUseApi.h | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/WiiUseJC/wiiusej_WiiUseApi.c b/WiiUseJC/wiiusej_WiiUseApi.c index 4fad079..b1d3b77 100644 --- a/WiiUseJC/wiiusej_WiiUseApi.c +++ b/WiiUseJC/wiiusej_WiiUseApi.c @@ -377,6 +377,24 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold wiiuse_set_nunchuk_accel_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), val); } +/** + * Force the bluetooth stack type.(useful only for windows) + * + * @param bluetoothStackType + * must be WiiUseApi.WIIUSE_STACK_UNKNOWN or WiiUseApi.WIIUSE_STACK_MS or + * WiiUseApi.WIIUSE_STACK_BLUESOLEIL. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_windowsSetBluetoothStack +(JNIEnv *env, jobject obj, jint bluetoothStackType) { + if (bluetoothStackType == 0){ + wiiuse_set_bluetooth_stack(wiimotes, nbMaxWiimotes, WIIUSE_STACK_UNKNOWN); + }else if (bluetoothStackType == 1){ + wiiuse_set_bluetooth_stack(wiimotes, nbMaxWiimotes, WIIUSE_STACK_MS); + }else if (bluetoothStackType == 2){ + wiiuse_set_bluetooth_stack(wiimotes, nbMaxWiimotes, WIIUSE_STACK_BLUESOLEIL); + } +} + /** * Get status and values from the wiimotes and send it through callbacks. * @param wim the wiimote object to fill with the datas. @@ -416,7 +434,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll WIIUSE_GET_IR_SENSITIVITY_CORRECTED(wiimotes[i], &a); mid = (*env)->GetMethodID(env, cls, "prepareIRevent", - "(IIIIIIIIISSSF)V"); + "(IIFIIIIIISSSF)V"); if (mid == 0) { return; } diff --git a/WiiUseJC/wiiusej_WiiUseApi.def b/WiiUseJC/wiiusej_WiiUseApi.def index 3b6de9c..e7aebd3 100644 --- a/WiiUseJC/wiiusej_WiiUseApi.def +++ b/WiiUseJC/wiiusej_WiiUseApi.def @@ -30,4 +30,5 @@ Java_wiiusej_WiiUseApi_setTimeout Java_wiiusej_WiiUseApi_setIrSensitivity Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold +Java_wiiusej_WiiUseApi_windowsSetBluetoothStack Java_wiiusej_WiiUseApi_specialPoll diff --git a/WiiUseJC/wiiusej_WiiUseApi.h b/WiiUseJC/wiiusej_WiiUseApi.h index bdc289a..3680631 100644 --- a/WiiUseJC/wiiusej_WiiUseApi.h +++ b/WiiUseJC/wiiusej_WiiUseApi.h @@ -255,6 +255,14 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold (JNIEnv *, jobject, jint, jint); +/* + * Class: wiiusej_WiiUseApi + * Method: windowsSetBluetoothStack + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_windowsSetBluetoothStack + (JNIEnv *, jobject, jint); + /* * Class: wiiusej_WiiUseApi * Method: specialPoll