diff --git a/cpp/wiiscan/lib/wiiuse.lib b/cpp/wiiscan/lib/wiiuse.lib
index 4f1b69b..906e164 100644
Binary files a/cpp/wiiscan/lib/wiiuse.lib and b/cpp/wiiscan/lib/wiiuse.lib differ
diff --git a/cpp/wiiuse/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/cpp/wiiuse/.settings/org.eclipse.cdt.managedbuilder.core.prefs
index c7c1e64..5b3588a 100644
--- a/cpp/wiiuse/.settings/org.eclipse.cdt.managedbuilder.core.prefs
+++ b/cpp/wiiuse/.settings/org.eclipse.cdt.managedbuilder.core.prefs
@@ -1,4 +1,4 @@
-#Wed Jul 20 23:54:48 CEST 2011
+#Wed Oct 19 11:47:57 CEST 2011
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/CPATH/operation=remove
@@ -6,6 +6,12 @@ environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/appendContributed=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/CPATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/appendContributed=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339/C_INCLUDE_PATH/delimiter=;
diff --git a/cpp/wiiuse/src/balance_board.c b/cpp/wiiuse/src/balance_board.c
index 502005f..b765c09 100644
--- a/cpp/wiiuse/src/balance_board.c
+++ b/cpp/wiiuse/src/balance_board.c
@@ -1,140 +1,140 @@
-/*
- * wiiuse
- *
- * Written By:
- * Michael Laforest < para >
- * Email: < thepara (--AT--) g m a i l [--DOT--] com >
- * This file:
- * Bertho Stultiens < para >
- *
- * Copyright 2009
- *
- * This file is part of wiiuse.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- * $Header$
- *
- */
-
-/**
- * @file
- * @brief Balance Board expansion device.
- */
-
-#include
-#include
-#include
-
-#ifdef WIN32
- #include
-#endif
-
-#include "definitions.h"
-#include "wiiuse_internal.h"
-#include "dynamics.h"
-#include "events.h"
-#include "balance_board.h"
-
-/**
- * @brief Handle the handshake data from the guitar.
- *
- * @param cc A pointer to a classic_ctrl_t structure.
- * @param data The data read in from the device.
- * @param len The length of the data block, in bytes.
- *
- * @return Returns 1 if handshake was successful, 0 if not.
- */
-int balance_board_handshake(struct wiimote_t* wm, struct balance_board_t* bb, byte* data, unsigned short len) {
- int i;
-
- bb->tr = 0.0;
- bb->br = 0.0;
- bb->tl = 0.0;
- bb->br = 0.0;
-
- if (len < 0xe0)
- return 0;
-
- if (data[0xdc] != 0xa4) {
- /* decrypt data */
- for (i = 0; i < len; ++i)
- data[i] = (data[i] ^ 0x17) + 0x17;
- }
-
- /* See: http://wiibrew.org/wiki/Wii_Balance_Board */
- /* Unknown data at 0xa40020..23 (mine says: 0x44 0x69 0x00 0x00) */
- bb->cal_0.tr = (data[0x04] << 8) + data[0x05];
- bb->cal_0.br = (data[0x06] << 8) + data[0x07];
- bb->cal_0.tl = (data[0x08] << 8) + data[0x09];
- bb->cal_0.bl = (data[0x0a] << 8) + data[0x0b];
- bb->cal_17.tr = (data[0x0c] << 8) + data[0x0d];
- bb->cal_17.br = (data[0x0e] << 8) + data[0x0f];
- bb->cal_17.tl = (data[0x10] << 8) + data[0x11];
- bb->cal_17.bl = (data[0x12] << 8) + data[0x13];
- bb->cal_34.tr = (data[0x14] << 8) + data[0x15];
- bb->cal_34.br = (data[0x16] << 8) + data[0x17];
- bb->cal_34.tl = (data[0x18] << 8) + data[0x19];
- bb->cal_34.bl = (data[0x1a] << 8) + data[0x1b];
- /* Unknown data at 0xa4003c..3f (mine says: 0x4c 0x81 0x59 0x95) */
-
- WIIUSE_DEBUG("calibration 0: %04x %04x %04x %04x\n", bb->cal_0.tr, bb->cal_0.br, bb->cal_0.tl, bb->cal_0.br);
- WIIUSE_DEBUG("calibration 17: %04x %04x %04x %04x\n", bb->cal_17.tr, bb->cal_17.br, bb->cal_17.tl, bb->cal_17.br);
- WIIUSE_DEBUG("calibration 34: %04x %04x %04x %04x\n", bb->cal_34.tr, bb->cal_34.br, bb->cal_34.tl, bb->cal_34.br);
-
- /* handshake done */
- wm->exp.type = EXP_BALANCE_BOARD;
-
- #ifdef WIN32
- wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
- #endif
-
- return 1;
-}
-
-
-/**
- * @brief The balance board disconnected.
- *
- * @param cc A pointer to a balance_board_t structure.
- */
-void balance_board_disconnected(struct balance_board_t* bb) {
- memset(bb, 0, sizeof(*bb));
-}
-
-
-
-/**
- * @brief Handle balance board event.
- *
- * @param cc A pointer to a balance board_t structure.
- * @param msg The message specified in the event packet.
- */
-#define set_bbval(x) do {\
- if(bb->raw.x < bb->cal_17.x) \
- bb->x = 17.0 * (float)(bb->raw.x - bb->cal_0.x) / (float)(bb->cal_17.x - bb->cal_0.x); \
- else \
- bb->x = 17.0 * (1.0 + (float)(bb->raw.x - bb->cal_17.x) / (float)(bb->cal_34.x - bb->cal_17.x)); \
- } while(0)
-void balance_board_event(struct balance_board_t* bb, byte* msg) {
- bb->raw.tr = (msg[0] << 8) + msg[1];
- bb->raw.br = (msg[2] << 8) + msg[3];
- bb->raw.tl = (msg[4] << 8) + msg[5];
- bb->raw.bl = (msg[6] << 8) + msg[7];
- set_bbval(tr);
- set_bbval(br);
- set_bbval(tl);
- set_bbval(bl);
-}
-
+/*
+ * wiiuse
+ *
+ * Written By:
+ * Michael Laforest < para >
+ * Email: < thepara (--AT--) g m a i l [--DOT--] com >
+ * This file:
+ * Bertho Stultiens < para >
+ *
+ * Copyright 2009
+ *
+ * This file is part of wiiuse.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * $Header$
+ *
+ */
+
+/**
+ * @file
+ * @brief Balance Board expansion device.
+ */
+
+#include
+#include
+#include
+
+#ifdef WIN32
+ #include
+#endif
+
+#include "definitions.h"
+#include "wiiuse_internal.h"
+#include "dynamics.h"
+#include "events.h"
+#include "balance_board.h"
+
+/**
+ * @brief Handle the handshake data from the guitar.
+ *
+ * @param cc A pointer to a classic_ctrl_t structure.
+ * @param data The data read in from the device.
+ * @param len The length of the data block, in bytes.
+ *
+ * @return Returns 1 if handshake was successful, 0 if not.
+ */
+int balance_board_handshake(struct wiimote_t* wm, struct balance_board_t* bb, byte* data, unsigned short len) {
+ int i;
+
+ bb->tr = 0.0;
+ bb->br = 0.0;
+ bb->tl = 0.0;
+ bb->br = 0.0;
+
+ if (len < 0xe0)
+ return 0;
+
+ if (data[0xdc] != 0xa4) {
+ /* decrypt data */
+ for (i = 0; i < len; ++i)
+ data[i] = (data[i] ^ 0x17) + 0x17;
+ }
+
+ /* See: http://wiibrew.org/wiki/Wii_Balance_Board */
+ /* Unknown data at 0xa40020..23 (mine says: 0x44 0x69 0x00 0x00) */
+ bb->cal_0.tr = (data[0x04] << 8) + data[0x05];
+ bb->cal_0.br = (data[0x06] << 8) + data[0x07];
+ bb->cal_0.tl = (data[0x08] << 8) + data[0x09];
+ bb->cal_0.bl = (data[0x0a] << 8) + data[0x0b];
+ bb->cal_17.tr = (data[0x0c] << 8) + data[0x0d];
+ bb->cal_17.br = (data[0x0e] << 8) + data[0x0f];
+ bb->cal_17.tl = (data[0x10] << 8) + data[0x11];
+ bb->cal_17.bl = (data[0x12] << 8) + data[0x13];
+ bb->cal_34.tr = (data[0x14] << 8) + data[0x15];
+ bb->cal_34.br = (data[0x16] << 8) + data[0x17];
+ bb->cal_34.tl = (data[0x18] << 8) + data[0x19];
+ bb->cal_34.bl = (data[0x1a] << 8) + data[0x1b];
+ /* Unknown data at 0xa4003c..3f (mine says: 0x4c 0x81 0x59 0x95) */
+
+ WIIUSE_DEBUG("calibration 0: %04x %04x %04x %04x\n", bb->cal_0.tr, bb->cal_0.br, bb->cal_0.tl, bb->cal_0.br);
+ WIIUSE_DEBUG("calibration 17: %04x %04x %04x %04x\n", bb->cal_17.tr, bb->cal_17.br, bb->cal_17.tl, bb->cal_17.br);
+ WIIUSE_DEBUG("calibration 34: %04x %04x %04x %04x\n", bb->cal_34.tr, bb->cal_34.br, bb->cal_34.tl, bb->cal_34.br);
+
+ /* handshake done */
+ wm->exp.type = EXP_BALANCE_BOARD;
+
+ #ifdef WIN32
+ wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
+ #endif
+
+ return 1;
+}
+
+
+/**
+ * @brief The balance board disconnected.
+ *
+ * @param cc A pointer to a balance_board_t structure.
+ */
+void balance_board_disconnected(struct balance_board_t* bb) {
+ memset(bb, 0, sizeof(*bb));
+}
+
+
+
+/**
+ * @brief Handle balance board event.
+ *
+ * @param cc A pointer to a balance board_t structure.
+ * @param msg The message specified in the event packet.
+ */
+#define set_bbval(x) do {\
+ if(bb->raw.x < bb->cal_17.x) \
+ bb->x = 17.0 * (float)(bb->raw.x - bb->cal_0.x) / (float)(bb->cal_17.x - bb->cal_0.x); \
+ else \
+ bb->x = 17.0 * (1.0 + (float)(bb->raw.x - bb->cal_17.x) / (float)(bb->cal_34.x - bb->cal_17.x)); \
+ } while(0)
+void balance_board_event(struct balance_board_t* bb, byte* msg) {
+ bb->raw.tr = (msg[0] << 8) + msg[1];
+ bb->raw.br = (msg[2] << 8) + msg[3];
+ bb->raw.tl = (msg[4] << 8) + msg[5];
+ bb->raw.bl = (msg[6] << 8) + msg[7];
+ set_bbval(tr);
+ set_bbval(br);
+ set_bbval(tl);
+ set_bbval(bl);
+}
+
diff --git a/cpp/wiiusej/.cproject b/cpp/wiiusej/.cproject
index 7d4e8d1..9f6b0cd 100644
--- a/cpp/wiiusej/.cproject
+++ b/cpp/wiiusej/.cproject
@@ -50,6 +50,7 @@
+
@@ -103,7 +104,7 @@
-
+
@@ -124,6 +125,7 @@
+
@@ -143,6 +145,7 @@
+
diff --git a/cpp/wiiusej/Release/libwiiusej.dll b/cpp/wiiusej/Release/libwiiusej.dll
deleted file mode 100644
index 0e213fa..0000000
Binary files a/cpp/wiiusej/Release/libwiiusej.dll and /dev/null differ
diff --git a/cpp/wiiusej/lib/wiiuse.lib b/cpp/wiiusej/lib/wiiuse.lib
index a23c43d..906e164 100644
Binary files a/cpp/wiiusej/lib/wiiuse.lib and b/cpp/wiiusej/lib/wiiuse.lib differ
diff --git a/cpp/wiiusej/src/wiiusej_WiiUseApi.c b/cpp/wiiusej/src/wiiusej_WiiUseApi.c
index dfc1844..fe3b4a8 100644
--- a/cpp/wiiusej/src/wiiusej_WiiUseApi.c
+++ b/cpp/wiiusej/src/wiiusej_WiiUseApi.c
@@ -20,7 +20,6 @@
#include "wiiusej_WiiUseApi.h"
#include "wiiuse.h"
-#include
/*
* These are some identifiers for wiimotes
*
@@ -86,7 +85,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init
/**
* Close connection to the wiimote with the given id.
- *
+ *
* @param id the id of the wiimote to disconnect.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
@@ -96,10 +95,10 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
/**
* Get unique id of a wiimote in the wiimotes array.
- * Please make sure you call an existing index with a
+ * Please make sure you call an existing index with a
* wiimote initialized at this index,
* other wise you'll get a wrong value.
- * @param index index of the wiimote in the wiimotes array.
+ * @param index index of the wiimote in the wiimotes array.
*/
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId
(JNIEnv *env, jobject obj, jint index) {
@@ -303,7 +302,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen
}
/**
- * Set virtual screen resolution. It is used to automatically
+ * Set virtual screen resolution. It is used to automatically
* compute the position of a cursor on this virtual screen
* using the sensor bar. These results come in the IREvent.
* @param id the id of the wiimote concerned
@@ -317,7 +316,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution
/**
* Get status from the wiimotes and send it through call backs.
- *
+ *
* @param id the id of the wiimote. Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
@@ -327,7 +326,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
/**
* Set the normal and expansion handshake timeouts.
- *
+ *
* @param id
* the id of the wiimote concerned.
* @param normalTimeout
@@ -343,7 +342,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout
/**
* Set the IR sensitivity.
- *
+ *
* @param id
* the id of the wiimote concerned.
* @param level
@@ -378,7 +377,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold
/**
* 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.
@@ -418,7 +417,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
switch (wiimotes[i]->event) {
case WIIUSE_EVENT:
/* a generic event occured */
-
+
//printf("Generic event\n");
mid = (*env)->GetMethodID(env, cls, "prepareWiiMoteEvent", "(ISSS)V");
if (mid == 0) {
@@ -483,7 +482,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
wiimotes[i]->gforce.x, wiimotes[i]->gforce.y, wiimotes[i]->gforce.z,
wiimotes[i]->accel.x, wiimotes[i]->accel.y, wiimotes[i]->accel.z);
}
-
+
/* Expansions support support*/
if (WIIUSE_USING_EXP(wiimotes[i])) {
/* Nunchuk support */
@@ -511,8 +510,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
nc->js.max.x,nc->js.max.y,
nc->js.min.x,nc->js.min.y,
nc->js.center.x,nc->js.center.y);
- }
- else if (wiimotes[i]->exp.type == EXP_GUITAR_HERO_3) {
+ } else if (wiimotes[i]->exp.type == EXP_GUITAR_HERO_3) {
/* put guitar hero values in wiimote generic event */
mid = (*env)->GetMethodID(env, cls,
"addGuitarHeroEventToPreparedWiimoteEvent", "(SSSFFFSSSSSS)V");
@@ -531,7 +529,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
gh->js.max.x,gh->js.max.y,
gh->js.min.x,gh->js.min.y,
gh->js.center.x,gh->js.center.y);
- }if (wiimotes[i]->exp.type == EXP_CLASSIC) {
+ } else if (wiimotes[i]->exp.type == EXP_CLASSIC) {
/* put classic controller values in wiimote generic event */
mid = (*env)->GetMethodID(env, cls,
"addClassicControllerEventToPreparedWiimoteEvent", "(SSSFFFFSSSSSSFFSSSSSS)V");
@@ -555,12 +553,25 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
cl->rjs.max.x,cl->rjs.max.y,
cl->rjs.min.x,cl->rjs.min.y,
cl->rjs.center.x,cl->rjs.center.y);
+ } else if (wiimotes[i]->exp.type == EXP_BALANCE_BOARD) {
+ /* put balance board values in wiimote generic event */
+ mid = (*env)->GetMethodID(env, cls,
+ "addBalanceBoardEventToPreparedWiimoteEvent", "(FFFF)V");
+ if (mid == 0) {
+ return;
+ }
+ struct balance_board_t* bb = (balance_board_t*)&wiimotes[i]->exp.bb;
+ (*env)->CallVoidMethod(env, gath, mid,
+ /* weight */
+ bb->tr,
+ bb->br,
+ bb->bl,
+ bb->tl);
}
}
/* add generic event to java object used to gather events in c environment */
- mid = (*env)->GetMethodID(env, cls, "addWiimoteEvent",
- "()V");
+ mid = (*env)->GetMethodID(env, cls, "addWiimoteEvent", "()V");
if (mid == 0) {
return;
}
@@ -639,6 +650,24 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
(*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid);
break;
+ case WIIUSE_BALANCE_BOARD_CTRL_INSERTED:
+ /* the balance board was just connected */
+ mid = (*env)->GetMethodID(env, cls, "addBalanceBoardInsertedEvent", "(I)V");
+ if (mid == 0) {
+ return;
+ }
+ (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid);
+ break;
+
+ case WIIUSE_BALANCE_BOARD_CTRL_REMOVED:
+ /* the balance board disconnected */
+ mid = (*env)->GetMethodID(env, cls, "addBalanceBoardRemovedEvent", "(I)V");
+ if (mid == 0) {
+ return;
+ }
+ (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid);
+ break;
+
case WIIUSE_STATUS:
/* a status event occured */
mid = (*env)->GetMethodID(env, cls, "addStatusEvent", "(IZFSZIZZZZ)V");
@@ -736,5 +765,4 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_streamSpeakerData(JNIEnv *env, job
}*/
wiiuse_speaker_data(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), (byte*) jbData, len);
(*env)->ReleaseByteArrayElements(env, jbArray, jbData, JNI_FALSE);
-
}
diff --git a/cpp/wiiusej/src/wiiusej_WiiUseApi.h b/cpp/wiiusej/src/wiiusej_WiiUseApi.h
index 7d6e19b..aeed446 100644
--- a/cpp/wiiusej/src/wiiusej_WiiUseApi.h
+++ b/cpp/wiiusej/src/wiiusej_WiiUseApi.h
@@ -1,7 +1,6 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
#include
-/* Header for class wiiusej_WiiUseApi */
+/* Header for class wiiusej_WiiUseApi */
#ifndef _Included_wiiusej_WiiUseApi
#define _Included_wiiusej_WiiUseApi
#ifdef __cplusplus
diff --git a/java/build.xml b/java/build.xml
new file mode 100644
index 0000000..9d86d58
--- /dev/null
+++ b/java/build.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/java/client.bat b/java/client.bat
deleted file mode 100644
index d157b2c..0000000
--- a/java/client.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-set path="C:\Program Files (x86)\Java\jdk1.6.0_24\bin";%path%;native
-java -cp bin;cfg;resource;lib/commons-logging-1.1.1.jar;lib/jacob-1.15-M3.jar;lib/TableLayout.jar;lib/nativecall-0.4.1.jar;lib/nativeloader-200505172341.jar mimis.Client
-pause
\ No newline at end of file
diff --git a/java/jar/DelcomDLL.dll b/java/jar/DelcomDLL.dll
deleted file mode 100644
index ecfa470..0000000
Binary files a/java/jar/DelcomDLL.dll and /dev/null differ
diff --git a/java/jar/NativeCall.dll b/java/jar/NativeCall.dll
deleted file mode 100644
index 6e2cad1..0000000
Binary files a/java/jar/NativeCall.dll and /dev/null differ
diff --git a/java/jar/WiiUseJ.dll b/java/jar/WiiUseJ.dll
deleted file mode 100644
index a34e1b5..0000000
Binary files a/java/jar/WiiUseJ.dll and /dev/null differ
diff --git a/java/jar/client.jar b/java/jar/client.jar
deleted file mode 100644
index 1f1b831..0000000
Binary files a/java/jar/client.jar and /dev/null differ
diff --git a/java/jar/jacob-1.15-M3-x86.dll b/java/jar/jacob-1.15-M3-x86.dll
deleted file mode 100644
index 34876a0..0000000
Binary files a/java/jar/jacob-1.15-M3-x86.dll and /dev/null differ
diff --git a/java/jar/jintellitype.dll b/java/jar/jintellitype.dll
deleted file mode 100644
index 839236b..0000000
Binary files a/java/jar/jintellitype.dll and /dev/null differ
diff --git a/java/jar/jxinput.dll b/java/jar/jxinput.dll
deleted file mode 100644
index 720b9bb..0000000
Binary files a/java/jar/jxinput.dll and /dev/null differ
diff --git a/java/jar/list.exe b/java/jar/list.exe
deleted file mode 100644
index 17d5b4f..0000000
Binary files a/java/jar/list.exe and /dev/null differ
diff --git a/java/jar/main.jar b/java/jar/main.jar
deleted file mode 100644
index 7fa0435..0000000
Binary files a/java/jar/main.jar and /dev/null differ
diff --git a/java/jar/msvcr100.dll b/java/jar/msvcr100.dll
deleted file mode 100644
index 1055773..0000000
Binary files a/java/jar/msvcr100.dll and /dev/null differ
diff --git a/java/jar/wiiscan.exe b/java/jar/wiiscan.exe
deleted file mode 100644
index 9e9e443..0000000
Binary files a/java/jar/wiiscan.exe and /dev/null differ
diff --git a/java/jar/wiiuse.dll b/java/jar/wiiuse.dll
deleted file mode 100644
index 260aeb0..0000000
Binary files a/java/jar/wiiuse.dll and /dev/null differ
diff --git a/java/jar/wpcom.dll b/java/jar/wpcom.dll
deleted file mode 100644
index 3d8f765..0000000
Binary files a/java/jar/wpcom.dll and /dev/null differ
diff --git a/java/main.bat b/java/main.bat
deleted file mode 100644
index 49d4524..0000000
--- a/java/main.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-set path="C:\Program Files (x86)\Java\jdk1.6.0_24\bin";%path%;native
-java -cp bin;cfg;resource;lib/commons-logging-1.1.1.jar;lib/jacob-1.15-M3.jar;lib/TableLayout.jar;lib/nativecall-0.4.1.jar;lib/nativeloader-200505172341.jar mimis.Main
-pause
\ No newline at end of file
diff --git a/java/src/mimis/device/wiimote/WiimoteDevice.java b/java/src/mimis/device/wiimote/WiimoteDevice.java
index 317e289..8d7d91a 100644
--- a/java/src/mimis/device/wiimote/WiimoteDevice.java
+++ b/java/src/mimis/device/wiimote/WiimoteDevice.java
@@ -77,7 +77,6 @@ public class WiimoteDevice extends Device implements GestureListener {
}
if (!connected) {
try {
- log.debug("!");
connect();
} catch (DeviceNotFoundException e) {
disconnect = true;
@@ -98,7 +97,6 @@ public class WiimoteDevice extends Device implements GestureListener {
}
wiimoteDiscovery.disconnect();
disconnect = false;
- //start();
}
}
@@ -168,11 +166,12 @@ public class WiimoteDevice extends Device implements GestureListener {
}
/* Connectivity */
- public void connect() throws DeviceNotFoundException {
+ public synchronized void connect() throws DeviceNotFoundException {
wiimote = wiimoteService.getDevice(this);
- log.debug("Connected");
+ //wiimote.activateContinuous();
wiimoteDiscovery.stop();
- ledWorker.start();
+ //ledWorker.start();
+ sleep(10000);
}
/* Listeners */
diff --git a/java/src/mimis/device/wiimote/WiimoteDiscovery.java b/java/src/mimis/device/wiimote/WiimoteDiscovery.java
index 11edd5f..c4eca93 100644
--- a/java/src/mimis/device/wiimote/WiimoteDiscovery.java
+++ b/java/src/mimis/device/wiimote/WiimoteDiscovery.java
@@ -9,6 +9,7 @@ import mimis.exception.worker.ActivateException;
import mimis.exception.worker.DeactivateException;
public class WiimoteDiscovery extends Worker {
+ protected static final String WIISCAN = "wiiscan-bb.exe";
protected static final int TIMEOUT = 1000;
protected WiimoteDevice wiimoteDevice;
protected Process process;
@@ -29,7 +30,7 @@ public class WiimoteDiscovery extends Worker {
}
public boolean execute(String parameters) {
- String command = "wiiscan.exe -l none " + parameters;
+ String command = WIISCAN + " -l none " + parameters;
try {
process = Runtime.getRuntime().exec(command);
Scanner scanner = new Scanner(process.getInputStream());
diff --git a/java/src/mimis/device/wiimote/WiimoteService.java b/java/src/mimis/device/wiimote/WiimoteService.java
index 10f6b7e..bfd3771 100644
--- a/java/src/mimis/device/wiimote/WiimoteService.java
+++ b/java/src/mimis/device/wiimote/WiimoteService.java
@@ -16,6 +16,8 @@ import wiiusej.wiiusejevents.physicalevents.IREvent;
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
import wiiusej.wiiusejevents.utils.WiimoteListener;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardInsertedEvent;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
@@ -30,8 +32,7 @@ public class WiimoteService extends WiiUseApiManager implements WiimoteListener
public static void main(String[] args) {
Log log = LogFactory.getLog(WiimoteService.class);
- WiimoteService wiimoteService = new WiimoteService();
- for (Wiimote wm : wiimoteService.getWiimotes(1, false)) {
+ for (Wiimote wm : WiiUseApiManager.getWiimotes(1, false)) {
log.debug(wm);
}
}
@@ -88,6 +89,7 @@ public class WiimoteService extends WiiUseApiManager implements WiimoteListener
}
public void onStatusEvent(StatusEvent event) {
+ log.debug(event);
if (event.isConnected()) {
WiimoteDevice wiimoteDevice = getWiimoteDevice(event);
wiimoteDevice.connected = true;
@@ -106,4 +108,12 @@ public class WiimoteService extends WiiUseApiManager implements WiimoteListener
public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent event) {}
public void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent event) {}
public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent event) {}
+
+ public void onBalanceBoardInsertedEvent(BalanceBoardInsertedEvent e) {
+ log.debug(e);
+ }
+
+ public void onBalanceBoardRemovedEvent(BalanceBoardRemovedEvent e) {
+
+ }
}
diff --git a/java/src/wiiusej/Wiimote.java b/java/src/wiiusej/Wiimote.java
index 8194f40..d5b7c29 100644
--- a/java/src/wiiusej/Wiimote.java
+++ b/java/src/wiiusej/Wiimote.java
@@ -20,6 +20,8 @@ import javax.swing.event.EventListenerList;
import wiiusej.wiiusejevents.utils.WiiUseApiListener;
import wiiusej.wiiusejevents.utils.WiimoteListener;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardInsertedEvent;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
@@ -327,7 +329,11 @@ public class Wiimote implements WiiUseApiListener {
notifyClassicControllerInsertedEventListeners((ClassicControllerInsertedEvent) e);
} else if (e.getEventType() == WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_REMOVED) {
notifyClassicControllerRemovedEventListeners((ClassicControllerRemovedEvent) e);
- }
+ } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_BALANCE_BOARD_CTRL_INSERTED) {
+ notifyBalanceBoardInsertedEventListeners((BalanceBoardInsertedEvent) e);
+ } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_BALANCE_BOARD_CTRL_REMOVED) {
+ notifyBalanceBoardRemovedEventListeners((BalanceBoardRemovedEvent) e);
+ }
/*
* events not managed yet || e.getEventType() == WIIUSE_READ_DATA
* WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_INSERTED || e.getEventType() ==
@@ -486,6 +492,18 @@ public class Wiimote implements WiiUseApiListener {
listener.onClassicControllerRemovedEvent(evt);
}
}
+
+ protected void notifyBalanceBoardInsertedEventListeners(BalanceBoardInsertedEvent evt) {
+ for (WiimoteListener listener : getWiiMoteEventListeners()) {
+ listener.onBalanceBoardInsertedEvent(evt);
+ }
+ }
+
+ protected void notifyBalanceBoardRemovedEventListeners(BalanceBoardRemovedEvent evt) {
+ for (WiimoteListener listener : getWiiMoteEventListeners()) {
+ listener.onBalanceBoardRemovedEvent(evt);
+ }
+ }
@Override
public String toString() {
diff --git a/java/src/wiiusej/values/Calibration.java b/java/src/wiiusej/values/Calibration.java
index ecc1d68..1c89147 100644
--- a/java/src/wiiusej/values/Calibration.java
+++ b/java/src/wiiusej/values/Calibration.java
@@ -12,11 +12,6 @@ public class Calibration {
(short) (gAcceleration.getX() - zeroAcceleration.getX()),
(short) (gAcceleration.getY() - zeroAcceleration.getY()),
(short) (gAcceleration.getZ() - zeroAcceleration.getZ()));
- System.out.println(zeroAcceleration);
- System.out.println(gAcceleration);
- System.out.println(differenceAcceleration);
- System.out.println("<");
- //System.exit(0);
}
public RawAcceleration getZeroAcceleration() {
diff --git a/java/src/wiiusej/wiiusejevents/physicalevents/BalanceBoardButtonsEvent.java b/java/src/wiiusej/wiiusejevents/physicalevents/BalanceBoardButtonsEvent.java
new file mode 100644
index 0000000..420fbd0
--- /dev/null
+++ b/java/src/wiiusej/wiiusejevents/physicalevents/BalanceBoardButtonsEvent.java
@@ -0,0 +1,11 @@
+package wiiusej.wiiusejevents.physicalevents;
+
+public class BalanceBoardButtonsEvent extends ButtonsEvent {
+ protected static short BALANCE_BOARD_BUTTON = 0x0001;
+
+ public BalanceBoardButtonsEvent(int id, short buttonsJustPressed,
+ short buttonsJustReleased, short buttonsHeld) {
+ super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
+ }
+
+}
diff --git a/java/src/wiiusej/wiiusejevents/physicalevents/BalanceBoardEvent.java b/java/src/wiiusej/wiiusejevents/physicalevents/BalanceBoardEvent.java
new file mode 100644
index 0000000..87e8950
--- /dev/null
+++ b/java/src/wiiusej/wiiusejevents/physicalevents/BalanceBoardEvent.java
@@ -0,0 +1,33 @@
+package wiiusej.wiiusejevents.physicalevents;
+
+public class BalanceBoardEvent extends ExpansionEvent {
+ protected BalanceBoardButtonsEvent buttonsEvent;
+ protected JoystickEvent balanceBoardJoystickEvent;
+
+ public BalanceBoardEvent(int id, float topRight, float bottomRight,
+ float bottomLeft, float topLeft) {
+ super(id);
+
+ System.out.println(String.format("%f %f %f %f", topRight, bottomRight, bottomLeft, topLeft));
+ /*balanceBoardJoystickEvent = new JoystickEvent(id, angle,
+ magnitude, max1, max2, min1, min2, center1, center2);*/
+ }
+
+ public boolean isThereBalanceBoardJoystickEvent() {
+ return balanceBoardJoystickEvent != null;
+ }
+
+ public JoystickEvent getBalanceBoardJoystickEvent() {
+ return balanceBoardJoystickEvent;
+ }
+
+ public String toString() {
+ String out = "";
+ /* Status */
+ out += "/*********** Balance Board EVENT : WIIMOTE ID :" + getWiimoteId()
+ + " ********/\n";
+ out += balanceBoardJoystickEvent;
+ return out;
+ }
+
+}
diff --git a/java/src/wiiusej/wiiusejevents/utils/EventsGatherer.java b/java/src/wiiusej/wiiusejevents/utils/EventsGatherer.java
index d89c994..48051e8 100644
--- a/java/src/wiiusej/wiiusejevents/utils/EventsGatherer.java
+++ b/java/src/wiiusej/wiiusejevents/utils/EventsGatherer.java
@@ -16,6 +16,8 @@
*/
package wiiusej.wiiusejevents.utils;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardInsertedEvent;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
@@ -362,6 +364,14 @@ public class EventsGatherer {
}
}
+ public void addBalanceBoardEventToPreparedWiimoteEvent(float topRight,
+ float bottomRight, float bottomLeft, float topLeft) {
+ if (genericEvent != null) {
+ genericEvent.setBalanceBoardEvent(topRight, bottomRight,
+ bottomLeft, topLeft);
+ }
+ }
+
/**
* Add the prepared WiimoteEvent to the gatherer.
*/
@@ -484,6 +494,16 @@ public class EventsGatherer {
addEvent(evt);
}
+ public void addBalanceBoardInsertedEvent(int id) {
+ BalanceBoardInsertedEvent evt = new BalanceBoardInsertedEvent(id);
+ addEvent(evt);
+ }
+
+ public void addBalanceBoardRemovedEvent(int id) {
+ BalanceBoardRemovedEvent evt = new BalanceBoardRemovedEvent(id);
+ addEvent(evt);
+ }
+
/**
* Return an array containing the events.
*
diff --git a/java/src/wiiusej/wiiusejevents/utils/WiimoteListener.java b/java/src/wiiusej/wiiusejevents/utils/WiimoteListener.java
index fd1017f..0a67f95 100644
--- a/java/src/wiiusej/wiiusejevents/utils/WiimoteListener.java
+++ b/java/src/wiiusej/wiiusejevents/utils/WiimoteListener.java
@@ -20,6 +20,8 @@ import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
import wiiusej.wiiusejevents.physicalevents.IREvent;
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardInsertedEvent;
+import wiiusej.wiiusejevents.wiiuseapievents.BalanceBoardRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
@@ -142,4 +144,6 @@ public interface WiimoteListener extends java.util.EventListener {
*/
void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent e);
+ void onBalanceBoardInsertedEvent(BalanceBoardInsertedEvent e);
+ void onBalanceBoardRemovedEvent(BalanceBoardRemovedEvent e);
}
diff --git a/java/src/wiiusej/wiiusejevents/wiiuseapievents/BalanceBoardInsertedEvent.java b/java/src/wiiusej/wiiusejevents/wiiuseapievents/BalanceBoardInsertedEvent.java
new file mode 100644
index 0000000..3c82a4c
--- /dev/null
+++ b/java/src/wiiusej/wiiusejevents/wiiuseapievents/BalanceBoardInsertedEvent.java
@@ -0,0 +1,15 @@
+package wiiusej.wiiusejevents.wiiuseapievents;
+
+public class BalanceBoardInsertedEvent extends WiiUseApiEvent {
+ public BalanceBoardInsertedEvent(int id) {
+ super(id, WIIUSE_BALANCE_BOARD_CTRL_INSERTED);
+ }
+
+ public String toString() {
+ String out = "";
+ /* Status */
+ out += "/*********** BALANCE BOARD INSERTED EVENT : WIIMOTE ID :"
+ + super.getWiimoteId() + " ********/\n";
+ return out;
+ }
+}
\ No newline at end of file
diff --git a/java/src/wiiusej/wiiusejevents/wiiuseapievents/BalanceBoardRemovedEvent.java b/java/src/wiiusej/wiiusejevents/wiiuseapievents/BalanceBoardRemovedEvent.java
new file mode 100644
index 0000000..559207d
--- /dev/null
+++ b/java/src/wiiusej/wiiusejevents/wiiuseapievents/BalanceBoardRemovedEvent.java
@@ -0,0 +1,17 @@
+package wiiusej.wiiusejevents.wiiuseapievents;
+
+import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent;
+
+public class BalanceBoardRemovedEvent extends WiiUseApiEvent {
+ public BalanceBoardRemovedEvent(int id) {
+ super(id, WIIUSE_BALANCE_BOARD_CTRL_REMOVED);
+ }
+
+ public String toString() {
+ String out = "";
+ /* Status */
+ out += "/*********** BALANCE BOARD INSERTED EVENT : WIIMOTE ID :"
+ + super.getWiimoteId() + " ********/\n";
+ return out;
+ }
+}
\ No newline at end of file
diff --git a/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java b/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java
index 0527b13..1a3555e 100644
--- a/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java
+++ b/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java
@@ -24,7 +24,6 @@ import wiiusej.wiiusejevents.GenericEvent;
* @author guiguito
*/
public abstract class WiiUseApiEvent extends GenericEvent{
-
public static int NONE_EVENT = 0;
public static int GENERIC_EVENT = 1;
public static int STATUS_EVENT = 2;
@@ -36,7 +35,9 @@ public abstract class WiiUseApiEvent extends GenericEvent{
public static int WIIUSE_CLASSIC_CTRL_REMOVED = 8;
public static int WIIUSE_GUITAR_HERO_3_CTRL_INSERTED = 9;
public static int WIIUSE_GUITAR_HERO_3_CTRL_REMOVED = 10;
-
+ public static int WIIUSE_BALANCE_BOARD_CTRL_INSERTED = 11;
+ public static int WIIUSE_BALANCE_BOARD_CTRL_REMOVED = 12;
+
/* Event Type */
private int eventType;
diff --git a/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java b/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java
index d1dfb7e..c524e11 100644
--- a/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java
+++ b/java/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java
@@ -16,6 +16,7 @@
*/
package wiiusej.wiiusejevents.wiiuseapievents;
+import wiiusej.wiiusejevents.physicalevents.BalanceBoardEvent;
import wiiusej.wiiusejevents.physicalevents.ClassicControllerEvent;
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
import wiiusej.wiiusejevents.physicalevents.GuitarHeroEvent;
@@ -405,6 +406,12 @@ public class WiimoteEvent extends WiiUseApiEvent {
center2);
}
+ public void setBalanceBoardEvent(float topRight, float bottomRight,
+ float bottomLeft, float topLeft) {
+ expansionEvent = new BalanceBoardEvent(getWiimoteId(), topRight,
+ bottomRight, bottomLeft, topLeft);
+ }
+
@Override
public String toString() {
String out = "";
@@ -437,5 +444,4 @@ public class WiimoteEvent extends WiiUseApiEvent {
return out;
}
-
}
diff --git a/java/wiiuse.dll b/java/wiiuse.dll
index b6356cd..7774620 100644
Binary files a/java/wiiuse.dll and b/java/wiiuse.dll differ
diff --git a/java/wiiusej.dll b/java/wiiusej.dll
index 0d9093f..708f8fb 100644
Binary files a/java/wiiusej.dll and b/java/wiiusej.dll differ