From 1536be84f3878137c0243b2b53813219649eb286 Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Mon, 24 Nov 2014 22:53:55 +0000 Subject: [PATCH] Move source files to gradle project layout --- .classpath | 6 + .gitignore | 1 + .gradle/1.12/taskArtifacts/cache.properties | 1 + .../1.12/taskArtifacts/cache.properties.lock | Bin 0 -> 17 bytes .gradle/1.12/taskArtifacts/fileHashes.bin | Bin 0 -> 18790 bytes .gradle/1.12/taskArtifacts/fileSnapshots.bin | Bin 0 -> 18930 bytes .../1.12/taskArtifacts/outputFileStates.bin | Bin 0 -> 18632 bytes .gradle/1.12/taskArtifacts/taskArtifacts.bin | Bin 0 -> 19206 bytes .project | 18 + ...ource.ide.eclipse.gradle.core.import.prefs | 10 + ...springsource.ide.eclipse.gradle.core.prefs | 4 + ...ingsource.ide.eclipse.gradle.refresh.prefs | 9 + WiiUseJ/src/img/classiccontroller.png | Bin 52666 -> 0 bytes WiiUseJ/src/img/wiimote.png | Bin 44340 -> 0 bytes .../main/cpp}/wiiusej_WiiUseApi.c | 1324 ++++++++-------- {WiiUseJC => src/main/headers}/wiiuse.h | 1228 +++++++-------- .../main/headers}/wiiusej_WiiUseApi.def | 68 +- .../main/headers}/wiiusej_WiiUseApi.h | 554 +++---- .../main/java}/wiiusej/WiiUseApi.java | 702 ++++----- .../main/java}/wiiusej/WiiUseApiManager.java | 1328 ++++++++--------- .../main/java}/wiiusej/Wiimote.java | 990 ++++++------ .../AccelerationExpansionEventPanel.java | 0 .../wiiusej/utils/AccelerationPanel.java | 0 .../utils/AccelerationWiimoteEventPanel.java | 0 .../wiiusej/utils/ButtonsEventPanel.java | 0 .../ClassicControllerButtonsEventPanel.java | 0 .../utils/GForceExpansionEventPanel.java | 0 .../main/java}/wiiusej/utils/GForcePanel.java | 0 .../utils/GForceWiimoteEventPanel.java | 0 .../utils/GuitarHero3ButtonsEventPanel.java | 0 .../utils/GuitarHeroJoystickEventPanel.java | 0 .../main/java}/wiiusej/utils/IRPanel.java | 0 .../wiiusej/utils/JoystickEventPanel.java | 0 .../utils/NunchukJoystickEventPanel.java | 0 .../utils/OrientationExpansionEventPanel.java | 0 .../java}/wiiusej/utils/OrientationPanel.java | 0 .../utils/OrientationWiimoteEventPanel.java | 0 .../main/java}/wiiusej/values/GForce.java | 160 +- .../main/java}/wiiusej/values/IRSource.java | 212 +-- .../java}/wiiusej/values/Orientation.java | 234 +-- .../java}/wiiusej/values/RawAcceleration.java | 162 +- .../wiiusej/wiiusejevents/GenericEvent.java | 118 +- .../physicalevents/ButtonsEvent.java | 256 ++-- .../ClassicControllerButtonsEvent.java | 658 ++++---- .../ClassicControllerEvent.java | 354 ++--- .../physicalevents/ExpansionEvent.java | 80 +- .../GuitarHeroButtonsEvent.java | 428 +++--- .../physicalevents/GuitarHeroEvent.java | 238 +-- .../wiiusejevents/physicalevents/IREvent.java | 638 ++++---- .../physicalevents/JoystickEvent.java | 270 ++-- .../physicalevents/MotionSensingEvent.java | 406 ++--- .../physicalevents/NunchukButtonsEvent.java | 178 +-- .../physicalevents/NunchukEvent.java | 338 ++--- .../physicalevents/WiimoteButtonsEvent.java | 534 +++---- .../wiiusejevents/utils/EventsGatherer.java | 1018 ++++++------- .../utils/WiiUseApiListener.java | 74 +- .../wiiusejevents/utils/WiimoteListener.java | 290 ++-- .../ClassicControllerInsertedEvent.java | 92 +- .../ClassicControllerRemovedEvent.java | 94 +- .../wiiuseapievents/DisconnectionEvent.java | 90 +- .../GuitarHeroInsertedEvent.java | 94 +- .../GuitarHeroRemovedEvent.java | 94 +- .../wiiuseapievents/NunchukInsertedEvent.java | 102 +- .../wiiuseapievents/NunchukRemovedEvent.java | 100 +- .../wiiuseapievents/StatusEvent.java | 586 ++++---- .../wiiuseapievents/WiiUseApiEvent.java | 132 +- .../wiiuseapievents/WiimoteEvent.java | 882 +++++------ .../main/resources}/img/classiccontroller.png | Bin .../main/resources}/img/wiimote.png | Bin .../test/java}/ClassicControllerGuiTest.java | 0 .../test/java}/CloseGuiTestCleanly.java | 0 .../test/java}/GuitarHero3GuiTest.java | 0 .../wiiusej/test => src/test/java}/Main.java | 0 .../test/java}/NunchukGuiTest.java | 0 .../wiiusej/test => src/test/java}/Tests.java | 778 +++++----- .../test/java}/WiiuseJGuiTest.java | 0 76 files changed, 7991 insertions(+), 7942 deletions(-) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .gradle/1.12/taskArtifacts/cache.properties create mode 100644 .gradle/1.12/taskArtifacts/cache.properties.lock create mode 100644 .gradle/1.12/taskArtifacts/fileHashes.bin create mode 100644 .gradle/1.12/taskArtifacts/fileSnapshots.bin create mode 100644 .gradle/1.12/taskArtifacts/outputFileStates.bin create mode 100644 .gradle/1.12/taskArtifacts/taskArtifacts.bin create mode 100644 .project create mode 100644 .settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs create mode 100644 .settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs create mode 100644 .settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs delete mode 100644 WiiUseJ/src/img/classiccontroller.png delete mode 100644 WiiUseJ/src/img/wiimote.png rename {WiiUseJC => src/main/cpp}/wiiusej_WiiUseApi.c (97%) rename {WiiUseJC => src/main/headers}/wiiuse.h (97%) rename {WiiUseJC => src/main/headers}/wiiusej_WiiUseApi.def (97%) rename {WiiUseJC => src/main/headers}/wiiusej_WiiUseApi.h (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/WiiUseApi.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/WiiUseApiManager.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/Wiimote.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/AccelerationExpansionEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/AccelerationPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/AccelerationWiimoteEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/ButtonsEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/ClassicControllerButtonsEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/GForceExpansionEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/GForcePanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/GForceWiimoteEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/GuitarHero3ButtonsEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/GuitarHeroJoystickEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/IRPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/JoystickEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/NunchukJoystickEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/OrientationExpansionEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/OrientationPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/utils/OrientationWiimoteEventPanel.java (100%) rename {WiiUseJ/src => src/main/java}/wiiusej/values/GForce.java (94%) rename {WiiUseJ/src => src/main/java}/wiiusej/values/IRSource.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/values/Orientation.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/values/RawAcceleration.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/GenericEvent.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/IREvent.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/utils/EventsGatherer.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/utils/WiiUseApiListener.java (97%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/utils/WiimoteListener.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java (95%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java (96%) rename {WiiUseJ/src => src/main/java}/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java (96%) rename {WiiUseJ => src/main/resources}/img/classiccontroller.png (100%) rename {WiiUseJ => src/main/resources}/img/wiimote.png (100%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/ClassicControllerGuiTest.java (100%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/CloseGuiTestCleanly.java (100%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/GuitarHero3GuiTest.java (100%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/Main.java (100%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/NunchukGuiTest.java (100%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/Tests.java (96%) rename {WiiUseJ/src/wiiusej/test => src/test/java}/WiiuseJGuiTest.java (100%) diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..e4d0db4 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84c048a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/.gradle/1.12/taskArtifacts/cache.properties b/.gradle/1.12/taskArtifacts/cache.properties new file mode 100644 index 0000000..8d0472e --- /dev/null +++ b/.gradle/1.12/taskArtifacts/cache.properties @@ -0,0 +1 @@ +#Mon Nov 24 22:53:03 GMT 2014 diff --git a/.gradle/1.12/taskArtifacts/cache.properties.lock b/.gradle/1.12/taskArtifacts/cache.properties.lock new file mode 100644 index 0000000000000000000000000000000000000000..0088986a20a7080876431f0d13e424ab48aa534e GIT binary patch literal 17 UcmZQpwP093{jIn)0|ZC_03#Cu{r~^~ literal 0 HcmV?d00001 diff --git a/.gradle/1.12/taskArtifacts/fileHashes.bin b/.gradle/1.12/taskArtifacts/fileHashes.bin new file mode 100644 index 0000000000000000000000000000000000000000..ab55474c48e723c6a06371d0ebed73db938a3e7e GIT binary patch literal 18790 zcmeI%Pe_wt9Ki9%k&2_qVi$4vmkwKk2*P%7s0U>eJcyCdze6C19z;bD8mLSeI!rwb zBCtY5p@P$=h?IOvTLW{`-A8AywC4_e!S1~xxPl1 z5LNbEA%u<+Jp~rz>{ZV%t`GQijf?;S2q1s}0tg_000IagfB*srAb! zaYNp~s&7%{vE(04zm-lKQ$n;{mdi___^2gYnvrW2fxqUTgkO&CKNI8YO}gIGY}RvY zsqo2SYCzWm`)0kjeB@?(P1IJX_nCEbR`s;?{;GaYMgRc>5I_I{1Q0*~0R#|0009IL zKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|00D*rIFj{5zH8~p9xFXV@ zJ(1bbIV188uq&AO7>&@+3uHQ(&z7u zzEf?-4+o#fmnt$U-FtaDTGZyfo7xQRei#XUe>SvHX?>-?=KP_y3sEts^5mB7QSm9a z$NFuLJ#%gCuEX?e-<~|XI;FE&?H9svr1F6)eyg}|KK8!$U?*JJIs5g^)yUge;dbY0 Mzl{7bXKu&c7eN4+1^@s6 literal 0 HcmV?d00001 diff --git a/.gradle/1.12/taskArtifacts/fileSnapshots.bin b/.gradle/1.12/taskArtifacts/fileSnapshots.bin new file mode 100644 index 0000000000000000000000000000000000000000..ec53cba4a1c09553d264717a4c3c55a4d004a008 GIT binary patch literal 18930 zcmeI(J4?e*6u|MM4-pY<5wVktk3p~sih_%xf`SMlbc;etLz`MKCMg*zTA?U(bnz<) z3I)6Q0tW{rs7u{N+yoIF+%&N*bSx+i^1pDCd(KUAbAMzD$DS61P~fxDgqpT@cJ*2l zGDH9Y1Q0*~0R#|0009ILKmY**5I_I{1Q0*~fqx=kN1Tl`l{XU_@q7;+?)@9KB?yDf zPU!JJH4fai&v%utnN3vxBpAU`YwFs2SjjI`^VPGPA3xtrl;=4jfB*srAbtcTAJ=>9Kh}l1XoTjfji(s6hGr09MHTa)`QUzZ5Z AegFUf literal 0 HcmV?d00001 diff --git a/.gradle/1.12/taskArtifacts/outputFileStates.bin b/.gradle/1.12/taskArtifacts/outputFileStates.bin new file mode 100644 index 0000000000000000000000000000000000000000..6d992799ea7d6d723813c021f056a54d6be61dd6 GIT binary patch literal 18632 zcmeI%F-QVY0LJl$Xi20TIOyV-LoI@mQ%wnh4K4{nHU&Y0crG^x6%j?z&>*-t=-Sd8 zT;kFY9F7eRQnVJ4HU|2h-UDxLi~oan_ulvM4&HA)XG@5fF?NTT8;!^3@3}2Y1Q0*~ z0R#|0009ILKmY**5I_I{1Q0*~0R#~ECj!o{yvWk*GO=~vbn*5QICd-{lFM@IKeNle z-@vEbtFe8j|0H}xvcsy`UUT!Z&d1Hc#p~6e;N~|v-&s5=ZpP~&H_z)_zg6C`60@2o z0tg_000IagfB*srAbeOFNy+1eoIy3OFMm#>wS@!q$=0n^_qMB*OvJn&?Wy*pztQ!!M&j_@{^-?I WTQI{<-gdv_ubi*s(yDDdWXuV~m1m*= literal 0 HcmV?d00001 diff --git a/.gradle/1.12/taskArtifacts/taskArtifacts.bin b/.gradle/1.12/taskArtifacts/taskArtifacts.bin new file mode 100644 index 0000000000000000000000000000000000000000..3514643722e163e15a1274013e883783a250062d GIT binary patch literal 19206 zcmeI%J&O}T7zgkt(Rdm?Jw@cyR?AH86g&v{p4>(7@Q4I07IKqh$WCs}t}~Ntu*f$M z%R>vX5D^se2`rAoLP%p{p;-6?N9bga8B}009U<00Izz00bZa0SG_<0uX=z1Rwwb2teRJ5g1kNLbCB<7B8j8 z58pmz2BVN@>4ce0PDO4xYtlF^Y20qzX?wCBO4-%Ii9y}0C!0NfT^l;gRl}7%5sf~i V0cHPmMN5jhGW{s`oySkV{su&K87lw) literal 0 HcmV?d00001 diff --git a/.project b/.project new file mode 100644 index 0000000..f1c5988 --- /dev/null +++ b/.project @@ -0,0 +1,18 @@ + + + jlibwiiuse + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.springsource.ide.eclipse.gradle.core.nature + org.eclipse.jdt.core.javanature + + diff --git a/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs b/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs new file mode 100644 index 0000000..b3edc8b --- /dev/null +++ b/.settings/gradle/org.springsource.ide.eclipse.gradle.core.import.prefs @@ -0,0 +1,10 @@ +#org.springsource.ide.eclipse.gradle.core.preferences.GradleImportPreferences +#Mon Nov 24 22:50:21 GMT 2014 +addResourceFilters=true +afterTasks=afterEclipseImport; +beforeTasks=cleanEclipse;eclipse; +enableAfterTasks=true +enableBeforeTasks=true +enableDSLD=false +enableDependendencyManagement=true +projects=; diff --git a/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs b/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs new file mode 100644 index 0000000..a148614 --- /dev/null +++ b/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs @@ -0,0 +1,4 @@ +#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences +#Mon Nov 24 22:50:22 GMT 2014 +org.springsource.ide.eclipse.gradle.linkedresources= +org.springsource.ide.eclipse.gradle.rootprojectloc= diff --git a/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs b/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs new file mode 100644 index 0000000..c1eff12 --- /dev/null +++ b/.settings/gradle/org.springsource.ide.eclipse.gradle.refresh.prefs @@ -0,0 +1,9 @@ +#org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences +#Mon Nov 24 22:50:21 GMT 2014 +addResourceFilters=true +afterTasks=afterEclipseImport; +beforeTasks=cleanEclipse;eclipse; +enableAfterTasks=true +enableBeforeTasks=true +enableDSLD=false +useHierarchicalNames=false diff --git a/WiiUseJ/src/img/classiccontroller.png b/WiiUseJ/src/img/classiccontroller.png deleted file mode 100644 index 87a80f452dfedd34722d519437ce32bc2019ac06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52666 zcmV)|KzzT6P)Px#1ZP1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DsMuo*)dqk9EdFH%REw92$QiPB)#|l2U;Eu%s+|k8kyRtg zvH%vy04sMFpreATO9+5&unk!2tYYfMjhnqA31E{dk{|XOuQRsg#^x>C{KqCg+Q7{H z5d5kBxD@~{1#-L?_^ue>cmc$VBYvC(K9La`>-TFb}uGlN7%G+ zdot|x4I9ypH#(qb$AAm>iOO~%IITkNl+vxp5 zuNAuv=jwdYcH+Tj^nS5p`ZEomueF|m>zy+JZsLg8=7|LS?ycLmnV3rkZFV#OJ3owK zQKaB-5J0k_z0S)H3rHj`z;gW1|EEXcEd#uv2TPd#|GWLjUQ^TVEdT%j07*qoM6N<$ Ef|!^34gdfE diff --git a/WiiUseJC/wiiusej_WiiUseApi.c b/src/main/cpp/wiiusej_WiiUseApi.c similarity index 97% rename from WiiUseJC/wiiusej_WiiUseApi.c rename to src/main/cpp/wiiusej_WiiUseApi.c index e2e01cd..b6f17fd 100644 --- a/WiiUseJC/wiiusej_WiiUseApi.c +++ b/src/main/cpp/wiiusej_WiiUseApi.c @@ -1,662 +1,662 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -#ifndef WIN32 -#include -#else - -#endif - -#include "wiiusej_WiiUseApi.h" -#include "wiiuse.h" -/* - * These are some identifiers for wiimotes - * - * See below in main() for what they are used for. - */ -#define WIIMOTE_STATE_RUMBLE 0x0010 -#define WIIMOTE_STATE_CONNECTED 0x0008 -#define WIIMOTE_IS_SET(wm, s) ((wm->state & (s)) == (s)) -#define WIIMOTE_IS_FLAG_SET(wm, s) ((wm->flags & (s)) == (s)) -#define WIIUSE_GET_IR_SENSITIVITY_CORRECTED(wm, lvl) \ - do { \ - if ((wm->state & 0x0200) == 0x0200) *lvl = 1; \ - else if ((wm->state & 0x0400) == 0x0400) *lvl = 2; \ - else if ((wm->state & 0x0800) == 0x0800) *lvl = 3; \ - else if ((wm->state & 0x1000) == 0x1000) *lvl = 4; \ - else if ((wm->state & 0x2000) == 0x2000) *lvl = 5; \ - else *lvl = 0; \ - } while (0) - -/********************* VARIABLES DECLARATIONS *****************************/ - -/* - * Make a temp array of wiimote ids. - * Here I only anticipate connecting up to - * two wiimotes. Each wiimote connected - * will get one of these ids. - */ -static wiimote** wiimotes; -static int nbMaxWiimotes; - -/****************** GENERAL FUNCTIONS DEFINITIONS *************************/ - -/** - * Connect to a wiimote or wiimotes once an address is known. - * @param nbWiimotes The number of wiimotes. - * @return The number of wiimotes that successfully connected. - */ -JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_connect -(JNIEnv *env, jobject obj, jint nbWiimotes) { - return wiiuse_connect(wiimotes, nbWiimotes); -} - -/** - * Find a wiimote or wiimotes. - * @param nbMaxWiimotes The number of wiimotes. - * @param timeout The number of seconds before the search times out. - * @return The number of wiimotes found. - */ -JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_find -(JNIEnv *env, jobject obj, jint nbMaxWiimotes, jint timeout) { - return wiiuse_find(wiimotes, nbMaxWiimotes, timeout); -} - -/** - * Initialize an array of wiimote structures (for the C side of the library). - * @param nbPossibleWiimotes size of the array. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init -(JNIEnv *env, jobject obj, jint nbPossibleWiimotes) { - wiimotes = wiiuse_init(nbPossibleWiimotes); - nbMaxWiimotes = nbPossibleWiimotes; -} - -/** - * 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 -(JNIEnv *env, jobject obj, jint id) { - wiiuse_disconnect(wiimotes[id]); -} - -/** - * Get unique id of a wiimote in the wiimotes array. - * 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. - */ -JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId -(JNIEnv *env, jobject obj, jint index) { - return wiimotes[index]->unid; -} - -/** - * Shutdown api. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_cleanUp -(JNIEnv *env, jobject obj) { - wiiuse_cleanup(wiimotes, nbMaxWiimotes); -} - -/** - * Activate rumble for the wiimote with the given id. - * @param id the id of the wiimote.Must be 1 or 2. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble -(JNIEnv *env, jobject obj, jint id) { - wiiuse_rumble(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 1); -} - -/** - * Deactivate rumble for the wiimote with the given id. - * @param id the id of the wiimote.Must be 1 or 2. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble -(JNIEnv *env, jobject obj, jint id) { - wiiuse_rumble(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0); -} - -/** - * Activate IR TRacking for the wiimote with the given id. - * @param id the id of the wiimote. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_ir(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 1); -} - -/** - * Deactivate IR TRacking for the wiimote with the given id. - * @param id the id of the wiimote.Must be 1 or 2. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_ir(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0); -} - -/** - * Activate Motion Sensing for the wiimote with the given id. - * @param id the id of the wiimote.Must be 1 or 2. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing -(JNIEnv *env, jobject obj, jint id) { - wiiuse_motion_sensing(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 1); -} - -/** - * Deactivate Motion Sensing for the wiimote with the given id. - * @param id the id of the wiimote.Must be 1 or 2. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing -(JNIEnv *env, jobject obj, jint id) { - wiiuse_motion_sensing(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0); -} - -/** - * Set wiimote leds status. - * @param id the id of the wiimote concerned - * @param led1 status of led1: True=ON, False=OFF - * @param led2 status of led2: True=ON, False=OFF - * @param led3 status of led3: True=ON, False=OFF - * @param led4 status of led4: True=ON, False=OFF - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds -(JNIEnv *env, jobject obj, jint id, jboolean led1, jboolean led2, jboolean led3, jboolean led4) { - int leds = 0; - - if (led1) leds |= WIIMOTE_LED_1; - if (led2) leds |= WIIMOTE_LED_2; - if (led3) leds |= WIIMOTE_LED_3; - if (led4) leds |= WIIMOTE_LED_4; - - wiiuse_set_leds(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), leds); -} - -/** - * Set how many degrees an angle must change to generate an event. - * @param id id of the wiimote concerned - * @param thresh minimum angle detected by an event - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold -(JNIEnv *env, jobject obj, jint id, jfloat thresh) { - wiiuse_set_orient_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), thresh); -} - -/** - * Set how much acceleration must change to generate an event. - * @param id id of the wiimote concerned - * @param val minimum value detected by an event - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAccelThreshold -(JNIEnv *env, jobject obj, jint id, jint val) { - wiiuse_set_accel_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), val); -} - -/** - * Set alpha smoothing parameter for the given id. - * @param id id of the wiimote concerned - * @param value alpha smoothing value - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAlphaSmoothing -(JNIEnv *env, jobject obj, jint id, jfloat val) { - wiiuse_set_smooth_alpha(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), val); -} - -/** - * Try to resync with the wiimote by starting a new handshake. - * @param id id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_reSync -(JNIEnv *env, jobject obj, jint id) { - wiiuse_resync(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id)); -} - -/** - * Make the the accelerometers give smoother results. - * This is set by default. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_SMOOTHING, 0); -} - -/** - * Make the the accelerometers give raw results. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0, WIIUSE_SMOOTHING); -} - -/** - * Make the wiimote generate an event each time we poll. - * Not set by default. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_CONTINUOUS, 0); -} - -/** - * Make the wiimote generate an event only when there is one. - * (default behavior) - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0, WIIUSE_CONTINUOUS); -} - -/** - * Notify wiiuse that your screen has an aspect ratio of 4/3. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio43 -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_aspect_ratio(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_ASPECT_4_3); -} - -/** - * Notify wiiuse that your screen has an aspect ratio of 16/9. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio169 -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_aspect_ratio(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_ASPECT_4_3); -} - -/** - * Notify wiiuse that the sensor bar is above your screen. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarAboveScreen -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_ir_position(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_IR_ABOVE); -} - -/** - * Notify wiiuse that the sensor bar is below your screen. - * @param id the id of the wiimote concerned - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen -(JNIEnv *env, jobject obj, jint id) { - wiiuse_set_ir_position(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_IR_BELOW); -} - -/** - * 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 - * @param x x resolution. - * @param y y resolution. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution -(JNIEnv *env, jobject obj, jint id, jint x, jint y) { - wiiuse_set_ir_vres(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), x, y); -} - -/** - * 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 -(JNIEnv *env, jobject obj, jint id) { - wiiuse_status(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id)); -} - -/** - * Set the normal and expansion handshake timeouts. - * - * @param id - * the id of the wiimote concerned. - * @param normalTimeout - * The timeout in milliseconds for a normal read. - * @param expansionTimeout - * The timeout in millisecondsd to wait for an expansion - * handshake. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout -(JNIEnv *env, jobject obj, jint id, jshort normalTimeout, jshort expansionTimeout) { - wiiuse_set_timeout(wiimotes, nbMaxWiimotes, normalTimeout, expansionTimeout); -} - -/** - * Set the IR sensitivity. - * - * @param id - * the id of the wiimote concerned. - * @param level - * 1-5, same as Wii system sensitivity setting. If the level is < - * 1, then level will be set to 1. If the level is > 5, then - * level will be set to 5. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setIrSensitivity -(JNIEnv *env, jobject obj, jint id, jint level) { - wiiuse_set_ir_sensitivity(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), level); -} - -/** - * Set how many degrees an angle must change to generate an event for the nunchuk. - * @param id id of the wiimote concerned - * @param thresh minimum angle detected by an event - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold -(JNIEnv *env, jobject obj, jint id, jfloat thresh) { - wiiuse_set_nunchuk_orient_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), thresh); -} - -/** - * Set how much acceleration must change to generate an event for the nunchuk. - * @param id id of the wiimote concerned - * @param val minimum value detected by an event - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold -(JNIEnv *env, jobject obj, jint id, jint val) { - 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. - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll -(JNIEnv *env, jobject obj, jobject gath) { - - /* Variables Declarations */ - int i; - short leds = 0; - jclass cls = (*env)->GetObjectClass(env, gath); - jmethodID mid; - - if (wiiuse_poll(wiimotes, nbMaxWiimotes)) { - /* - * This happens if something happened on any wiimote. - * So go through each one and check if anything happened. - */ - for (i=0; i < nbMaxWiimotes; ++i) { - switch (wiimotes[i]->event) { - case WIIUSE_EVENT: - /* a generic event occured */ - mid = (*env)->GetMethodID(env, cls, "prepareWiiMoteEvent", "(ISSS)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid, wiimotes[i]->btns, - wiimotes[i]->btns_released, wiimotes[i]->btns_held); - /* - * If IR tracking is enabled then print the coordinates - * on the virtual screen that the wiimote is pointing to. - * - * Also make sure that we see at least 1 dot. - */ - if (WIIUSE_USING_IR(wiimotes[i])) { - int a; - WIIUSE_GET_IR_SENSITIVITY_CORRECTED(wiimotes[i], &a); - - mid = (*env)->GetMethodID(env, cls, "prepareIRevent", - "(IIFIIIIIISSSF)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, - wiimotes[i]->ir.x, wiimotes[i]->ir.y, wiimotes[i]->ir.z, - wiimotes[i]->ir.ax, wiimotes[i]->ir.ay, - wiimotes[i]->ir.vres[0], wiimotes[i]->ir.vres[1], - wiimotes[i]->ir.offset[0], wiimotes[i]->ir.offset[1], - wiimotes[i]->ir.pos, wiimotes[i]->ir.aspect, - a , wiimotes[i]->ir.distance); - - mid = (*env)->GetMethodID(env, cls, "addIRPointToPreparedWiiMoteEvent", - "(IISSS)V"); - if (mid == 0) { - return; - } - /* go through each of the 4 possible IR sources */ - for (a=0; a < 4; a++) { - /* check if the source is visible */ - if (wiimotes[i]->ir.dot[a].visible) { - (*env)->CallVoidMethod(env, gath, mid, - wiimotes[i]->ir.dot[a].x, wiimotes[i]->ir.dot[a].y, - wiimotes[i]->ir.dot[a].rx, wiimotes[i]->ir.dot[a].ry, - wiimotes[i]->ir.dot[a].size); - } - } - } - - /* Motion Sensing */ - if (WIIUSE_USING_ACC(wiimotes[i])) { - /* set orientation and gravity force */ - mid = (*env)->GetMethodID(env, cls, - "addMotionSensingValues", "(FIZFFFFFFFFFSSS)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, - wiimotes[i]->orient_threshold, wiimotes[i]->accel_threshold, - WIIMOTE_IS_FLAG_SET(wiimotes[i],WIIUSE_SMOOTHING), wiimotes[i]->accel_calib.st_alpha, - wiimotes[i]->orient.roll, wiimotes[i]->orient.pitch, wiimotes[i]->orient.yaw, - wiimotes[i]->orient.a_roll, wiimotes[i]->orient.a_pitch, - 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 */ - if (wiimotes[i]->exp.type == EXP_NUNCHUK) { - /* put nunchuk values in wiimote generic event */ - mid = (*env)->GetMethodID(env, cls, - "addNunchunkEventToPreparedWiimoteEvent", "(SSSFIZFFFFFFFFFSSSFFSSSSSS)V"); - if (mid == 0) { - return; - } - struct nunchuk_t* nc = (nunchuk_t*)&wiimotes[i]->exp.nunchuk; - - (*env)->CallVoidMethod(env, gath, mid, - /* buttons */ - nc->btns,nc->btns_released,nc->btns_held, - /* motion sensing */ - nc->orient_threshold,nc->accel_threshold, - WIIMOTE_IS_FLAG_SET(wiimotes[i],WIIUSE_SMOOTHING),nc->accel_calib.st_alpha, - nc->orient.roll, nc->orient.pitch, nc->orient.yaw, - nc->orient.a_roll, nc->orient.a_pitch, - nc->gforce.x, nc->gforce.y, nc->gforce.z, - nc->accel.x, nc->accel.y, nc->accel.z, - /* joystick */ - nc->js.ang,nc->js.mag, - 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) { - /* put guitar hero values in wiimote generic event */ - mid = (*env)->GetMethodID(env, cls, - "addGuitarHeroEventToPreparedWiimoteEvent", "(SSSFFFSSSSSS)V"); - if (mid == 0) { - return; - } - struct guitar_hero_3_t* gh = (guitar_hero_3_t*)&wiimotes[i]->exp.gh3; - - (*env)->CallVoidMethod(env, gath, mid, - /* buttons */ - gh->btns,gh->btns_released,gh->btns_held, - /* whammy bar */ - gh->whammy_bar, - /* joystick */ - gh->js.ang,gh->js.mag, - 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) { - /* put classic controller values in wiimote generic event */ - mid = (*env)->GetMethodID(env, cls, - "addClassicControllerEventToPreparedWiimoteEvent", "(SSSFFFFSSSSSSFFSSSSSS)V"); - if (mid == 0) { - return; - } - struct classic_ctrl_t* cl = (classic_ctrl_t*)&wiimotes[i]->exp.classic; - - (*env)->CallVoidMethod(env, gath, mid, - /* buttons */ - cl->btns,cl->btns_released,cl->btns_held, - /* shoulder buttons */ - cl->r_shoulder,cl->l_shoulder, - /* joystick left*/ - cl->ljs.ang,cl->ljs.mag, - cl->ljs.max.x,cl->ljs.max.y, - cl->ljs.min.x,cl->ljs.min.y, - cl->ljs.center.x,cl->ljs.center.y, - /* joystick right */ - cl->rjs.ang,cl->rjs.mag, - cl->rjs.max.x,cl->rjs.max.y, - cl->rjs.min.x,cl->rjs.min.y, - cl->rjs.center.x,cl->rjs.center.y); - } - } - - /* add generic event to java object used to gather events in c environment */ - mid = (*env)->GetMethodID(env, cls, "addWiimoteEvent", - "()V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid); - break; - - case WIIUSE_DISCONNECT: - /* the wiimote disconnected */ - mid = (*env)->GetMethodID(env, cls, "addDisconnectionEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_UNEXPECTED_DISCONNECT: - /* the wimote disconnected */ - mid = (*env)->GetMethodID(env, cls, "addDisconnectionEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_NUNCHUK_INSERTED: - /* the nunchuk was just connected */ - mid = (*env)->GetMethodID(env, cls, "addNunchukInsertedEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_NUNCHUK_REMOVED: - /* the nunchuk disconnected */ - mid = (*env)->GetMethodID(env, cls, "addNunchukRemovedEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_GUITAR_HERO_3_CTRL_INSERTED: - /* the guitar hero was just connected */ - mid = (*env)->GetMethodID(env, cls, "addGuitarHeroInsertedEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_GUITAR_HERO_3_CTRL_REMOVED: - /* the guitar hero disconnected */ - mid = (*env)->GetMethodID(env, cls, "addGuitarHeroRemovedEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_CLASSIC_CTRL_INSERTED: - /* the classic controller was just connected */ - mid = (*env)->GetMethodID(env, cls, "addClassicControllerInsertedEvent", "(I)V"); - if (mid == 0) { - return; - } - (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); - break; - - case WIIUSE_CLASSIC_CTRL_REMOVED: - /* the classic controller disconnected */ - mid = (*env)->GetMethodID(env, cls, "addClassicControllerRemovedEvent", "(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"); - if (mid == 0) { - return; - } - /* LEDS */ - if (WIIUSE_IS_LED_SET(wiimotes[i], 1)) leds += 1; - if (WIIUSE_IS_LED_SET(wiimotes[i], 2)) leds += 2; - if (WIIUSE_IS_LED_SET(wiimotes[i], 3)) leds += 4; - if (WIIUSE_IS_LED_SET(wiimotes[i], 4)) leds += 8; - - (*env)->CallVoidMethod(env, gath, mid, - wiimotes[i]->unid, WIIMOTE_IS_SET(wiimotes[i], WIIMOTE_STATE_CONNECTED), - wiimotes[i]->battery_level, leds, WIIUSE_USING_SPEAKER(wiimotes[i]), - wiimotes[i]->exp.type,WIIMOTE_IS_SET(wiimotes[i], WIIMOTE_STATE_RUMBLE), - WIIMOTE_IS_FLAG_SET(wiimotes[i],WIIUSE_CONTINUOUS), - WIIUSE_USING_IR(wiimotes[i]),WIIUSE_USING_ACC(wiimotes[i])); - break; - - default: - break; - } - } - } -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +#ifndef WIN32 +#include +#else + +#endif + +#include "wiiusej_WiiUseApi.h" +#include "wiiuse.h" +/* + * These are some identifiers for wiimotes + * + * See below in main() for what they are used for. + */ +#define WIIMOTE_STATE_RUMBLE 0x0010 +#define WIIMOTE_STATE_CONNECTED 0x0008 +#define WIIMOTE_IS_SET(wm, s) ((wm->state & (s)) == (s)) +#define WIIMOTE_IS_FLAG_SET(wm, s) ((wm->flags & (s)) == (s)) +#define WIIUSE_GET_IR_SENSITIVITY_CORRECTED(wm, lvl) \ + do { \ + if ((wm->state & 0x0200) == 0x0200) *lvl = 1; \ + else if ((wm->state & 0x0400) == 0x0400) *lvl = 2; \ + else if ((wm->state & 0x0800) == 0x0800) *lvl = 3; \ + else if ((wm->state & 0x1000) == 0x1000) *lvl = 4; \ + else if ((wm->state & 0x2000) == 0x2000) *lvl = 5; \ + else *lvl = 0; \ + } while (0) + +/********************* VARIABLES DECLARATIONS *****************************/ + +/* + * Make a temp array of wiimote ids. + * Here I only anticipate connecting up to + * two wiimotes. Each wiimote connected + * will get one of these ids. + */ +static wiimote** wiimotes; +static int nbMaxWiimotes; + +/****************** GENERAL FUNCTIONS DEFINITIONS *************************/ + +/** + * Connect to a wiimote or wiimotes once an address is known. + * @param nbWiimotes The number of wiimotes. + * @return The number of wiimotes that successfully connected. + */ +JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_connect +(JNIEnv *env, jobject obj, jint nbWiimotes) { + return wiiuse_connect(wiimotes, nbWiimotes); +} + +/** + * Find a wiimote or wiimotes. + * @param nbMaxWiimotes The number of wiimotes. + * @param timeout The number of seconds before the search times out. + * @return The number of wiimotes found. + */ +JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_find +(JNIEnv *env, jobject obj, jint nbMaxWiimotes, jint timeout) { + return wiiuse_find(wiimotes, nbMaxWiimotes, timeout); +} + +/** + * Initialize an array of wiimote structures (for the C side of the library). + * @param nbPossibleWiimotes size of the array. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init +(JNIEnv *env, jobject obj, jint nbPossibleWiimotes) { + wiimotes = wiiuse_init(nbPossibleWiimotes); + nbMaxWiimotes = nbPossibleWiimotes; +} + +/** + * 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 +(JNIEnv *env, jobject obj, jint id) { + wiiuse_disconnect(wiimotes[id]); +} + +/** + * Get unique id of a wiimote in the wiimotes array. + * 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. + */ +JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId +(JNIEnv *env, jobject obj, jint index) { + return wiimotes[index]->unid; +} + +/** + * Shutdown api. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_cleanUp +(JNIEnv *env, jobject obj) { + wiiuse_cleanup(wiimotes, nbMaxWiimotes); +} + +/** + * Activate rumble for the wiimote with the given id. + * @param id the id of the wiimote.Must be 1 or 2. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble +(JNIEnv *env, jobject obj, jint id) { + wiiuse_rumble(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 1); +} + +/** + * Deactivate rumble for the wiimote with the given id. + * @param id the id of the wiimote.Must be 1 or 2. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble +(JNIEnv *env, jobject obj, jint id) { + wiiuse_rumble(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0); +} + +/** + * Activate IR TRacking for the wiimote with the given id. + * @param id the id of the wiimote. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_ir(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 1); +} + +/** + * Deactivate IR TRacking for the wiimote with the given id. + * @param id the id of the wiimote.Must be 1 or 2. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_ir(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0); +} + +/** + * Activate Motion Sensing for the wiimote with the given id. + * @param id the id of the wiimote.Must be 1 or 2. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing +(JNIEnv *env, jobject obj, jint id) { + wiiuse_motion_sensing(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 1); +} + +/** + * Deactivate Motion Sensing for the wiimote with the given id. + * @param id the id of the wiimote.Must be 1 or 2. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing +(JNIEnv *env, jobject obj, jint id) { + wiiuse_motion_sensing(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0); +} + +/** + * Set wiimote leds status. + * @param id the id of the wiimote concerned + * @param led1 status of led1: True=ON, False=OFF + * @param led2 status of led2: True=ON, False=OFF + * @param led3 status of led3: True=ON, False=OFF + * @param led4 status of led4: True=ON, False=OFF + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds +(JNIEnv *env, jobject obj, jint id, jboolean led1, jboolean led2, jboolean led3, jboolean led4) { + int leds = 0; + + if (led1) leds |= WIIMOTE_LED_1; + if (led2) leds |= WIIMOTE_LED_2; + if (led3) leds |= WIIMOTE_LED_3; + if (led4) leds |= WIIMOTE_LED_4; + + wiiuse_set_leds(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), leds); +} + +/** + * Set how many degrees an angle must change to generate an event. + * @param id id of the wiimote concerned + * @param thresh minimum angle detected by an event + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold +(JNIEnv *env, jobject obj, jint id, jfloat thresh) { + wiiuse_set_orient_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), thresh); +} + +/** + * Set how much acceleration must change to generate an event. + * @param id id of the wiimote concerned + * @param val minimum value detected by an event + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAccelThreshold +(JNIEnv *env, jobject obj, jint id, jint val) { + wiiuse_set_accel_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), val); +} + +/** + * Set alpha smoothing parameter for the given id. + * @param id id of the wiimote concerned + * @param value alpha smoothing value + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAlphaSmoothing +(JNIEnv *env, jobject obj, jint id, jfloat val) { + wiiuse_set_smooth_alpha(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), val); +} + +/** + * Try to resync with the wiimote by starting a new handshake. + * @param id id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_reSync +(JNIEnv *env, jobject obj, jint id) { + wiiuse_resync(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id)); +} + +/** + * Make the the accelerometers give smoother results. + * This is set by default. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_SMOOTHING, 0); +} + +/** + * Make the the accelerometers give raw results. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0, WIIUSE_SMOOTHING); +} + +/** + * Make the wiimote generate an event each time we poll. + * Not set by default. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_CONTINUOUS, 0); +} + +/** + * Make the wiimote generate an event only when there is one. + * (default behavior) + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_flags(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), 0, WIIUSE_CONTINUOUS); +} + +/** + * Notify wiiuse that your screen has an aspect ratio of 4/3. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio43 +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_aspect_ratio(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_ASPECT_4_3); +} + +/** + * Notify wiiuse that your screen has an aspect ratio of 16/9. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio169 +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_aspect_ratio(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_ASPECT_4_3); +} + +/** + * Notify wiiuse that the sensor bar is above your screen. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarAboveScreen +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_ir_position(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_IR_ABOVE); +} + +/** + * Notify wiiuse that the sensor bar is below your screen. + * @param id the id of the wiimote concerned + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen +(JNIEnv *env, jobject obj, jint id) { + wiiuse_set_ir_position(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), WIIUSE_IR_BELOW); +} + +/** + * 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 + * @param x x resolution. + * @param y y resolution. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution +(JNIEnv *env, jobject obj, jint id, jint x, jint y) { + wiiuse_set_ir_vres(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), x, y); +} + +/** + * 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 +(JNIEnv *env, jobject obj, jint id) { + wiiuse_status(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id)); +} + +/** + * Set the normal and expansion handshake timeouts. + * + * @param id + * the id of the wiimote concerned. + * @param normalTimeout + * The timeout in milliseconds for a normal read. + * @param expansionTimeout + * The timeout in millisecondsd to wait for an expansion + * handshake. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout +(JNIEnv *env, jobject obj, jint id, jshort normalTimeout, jshort expansionTimeout) { + wiiuse_set_timeout(wiimotes, nbMaxWiimotes, normalTimeout, expansionTimeout); +} + +/** + * Set the IR sensitivity. + * + * @param id + * the id of the wiimote concerned. + * @param level + * 1-5, same as Wii system sensitivity setting. If the level is < + * 1, then level will be set to 1. If the level is > 5, then + * level will be set to 5. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setIrSensitivity +(JNIEnv *env, jobject obj, jint id, jint level) { + wiiuse_set_ir_sensitivity(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), level); +} + +/** + * Set how many degrees an angle must change to generate an event for the nunchuk. + * @param id id of the wiimote concerned + * @param thresh minimum angle detected by an event + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold +(JNIEnv *env, jobject obj, jint id, jfloat thresh) { + wiiuse_set_nunchuk_orient_threshold(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), thresh); +} + +/** + * Set how much acceleration must change to generate an event for the nunchuk. + * @param id id of the wiimote concerned + * @param val minimum value detected by an event + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold +(JNIEnv *env, jobject obj, jint id, jint val) { + 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. + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll +(JNIEnv *env, jobject obj, jobject gath) { + + /* Variables Declarations */ + int i; + short leds = 0; + jclass cls = (*env)->GetObjectClass(env, gath); + jmethodID mid; + + if (wiiuse_poll(wiimotes, nbMaxWiimotes)) { + /* + * This happens if something happened on any wiimote. + * So go through each one and check if anything happened. + */ + for (i=0; i < nbMaxWiimotes; ++i) { + switch (wiimotes[i]->event) { + case WIIUSE_EVENT: + /* a generic event occured */ + mid = (*env)->GetMethodID(env, cls, "prepareWiiMoteEvent", "(ISSS)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid, wiimotes[i]->btns, + wiimotes[i]->btns_released, wiimotes[i]->btns_held); + /* + * If IR tracking is enabled then print the coordinates + * on the virtual screen that the wiimote is pointing to. + * + * Also make sure that we see at least 1 dot. + */ + if (WIIUSE_USING_IR(wiimotes[i])) { + int a; + WIIUSE_GET_IR_SENSITIVITY_CORRECTED(wiimotes[i], &a); + + mid = (*env)->GetMethodID(env, cls, "prepareIRevent", + "(IIFIIIIIISSSF)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, + wiimotes[i]->ir.x, wiimotes[i]->ir.y, wiimotes[i]->ir.z, + wiimotes[i]->ir.ax, wiimotes[i]->ir.ay, + wiimotes[i]->ir.vres[0], wiimotes[i]->ir.vres[1], + wiimotes[i]->ir.offset[0], wiimotes[i]->ir.offset[1], + wiimotes[i]->ir.pos, wiimotes[i]->ir.aspect, + a , wiimotes[i]->ir.distance); + + mid = (*env)->GetMethodID(env, cls, "addIRPointToPreparedWiiMoteEvent", + "(IISSS)V"); + if (mid == 0) { + return; + } + /* go through each of the 4 possible IR sources */ + for (a=0; a < 4; a++) { + /* check if the source is visible */ + if (wiimotes[i]->ir.dot[a].visible) { + (*env)->CallVoidMethod(env, gath, mid, + wiimotes[i]->ir.dot[a].x, wiimotes[i]->ir.dot[a].y, + wiimotes[i]->ir.dot[a].rx, wiimotes[i]->ir.dot[a].ry, + wiimotes[i]->ir.dot[a].size); + } + } + } + + /* Motion Sensing */ + if (WIIUSE_USING_ACC(wiimotes[i])) { + /* set orientation and gravity force */ + mid = (*env)->GetMethodID(env, cls, + "addMotionSensingValues", "(FIZFFFFFFFFFSSS)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, + wiimotes[i]->orient_threshold, wiimotes[i]->accel_threshold, + WIIMOTE_IS_FLAG_SET(wiimotes[i],WIIUSE_SMOOTHING), wiimotes[i]->accel_calib.st_alpha, + wiimotes[i]->orient.roll, wiimotes[i]->orient.pitch, wiimotes[i]->orient.yaw, + wiimotes[i]->orient.a_roll, wiimotes[i]->orient.a_pitch, + 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 */ + if (wiimotes[i]->exp.type == EXP_NUNCHUK) { + /* put nunchuk values in wiimote generic event */ + mid = (*env)->GetMethodID(env, cls, + "addNunchunkEventToPreparedWiimoteEvent", "(SSSFIZFFFFFFFFFSSSFFSSSSSS)V"); + if (mid == 0) { + return; + } + struct nunchuk_t* nc = (nunchuk_t*)&wiimotes[i]->exp.nunchuk; + + (*env)->CallVoidMethod(env, gath, mid, + /* buttons */ + nc->btns,nc->btns_released,nc->btns_held, + /* motion sensing */ + nc->orient_threshold,nc->accel_threshold, + WIIMOTE_IS_FLAG_SET(wiimotes[i],WIIUSE_SMOOTHING),nc->accel_calib.st_alpha, + nc->orient.roll, nc->orient.pitch, nc->orient.yaw, + nc->orient.a_roll, nc->orient.a_pitch, + nc->gforce.x, nc->gforce.y, nc->gforce.z, + nc->accel.x, nc->accel.y, nc->accel.z, + /* joystick */ + nc->js.ang,nc->js.mag, + 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) { + /* put guitar hero values in wiimote generic event */ + mid = (*env)->GetMethodID(env, cls, + "addGuitarHeroEventToPreparedWiimoteEvent", "(SSSFFFSSSSSS)V"); + if (mid == 0) { + return; + } + struct guitar_hero_3_t* gh = (guitar_hero_3_t*)&wiimotes[i]->exp.gh3; + + (*env)->CallVoidMethod(env, gath, mid, + /* buttons */ + gh->btns,gh->btns_released,gh->btns_held, + /* whammy bar */ + gh->whammy_bar, + /* joystick */ + gh->js.ang,gh->js.mag, + 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) { + /* put classic controller values in wiimote generic event */ + mid = (*env)->GetMethodID(env, cls, + "addClassicControllerEventToPreparedWiimoteEvent", "(SSSFFFFSSSSSSFFSSSSSS)V"); + if (mid == 0) { + return; + } + struct classic_ctrl_t* cl = (classic_ctrl_t*)&wiimotes[i]->exp.classic; + + (*env)->CallVoidMethod(env, gath, mid, + /* buttons */ + cl->btns,cl->btns_released,cl->btns_held, + /* shoulder buttons */ + cl->r_shoulder,cl->l_shoulder, + /* joystick left*/ + cl->ljs.ang,cl->ljs.mag, + cl->ljs.max.x,cl->ljs.max.y, + cl->ljs.min.x,cl->ljs.min.y, + cl->ljs.center.x,cl->ljs.center.y, + /* joystick right */ + cl->rjs.ang,cl->rjs.mag, + cl->rjs.max.x,cl->rjs.max.y, + cl->rjs.min.x,cl->rjs.min.y, + cl->rjs.center.x,cl->rjs.center.y); + } + } + + /* add generic event to java object used to gather events in c environment */ + mid = (*env)->GetMethodID(env, cls, "addWiimoteEvent", + "()V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid); + break; + + case WIIUSE_DISCONNECT: + /* the wiimote disconnected */ + mid = (*env)->GetMethodID(env, cls, "addDisconnectionEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_UNEXPECTED_DISCONNECT: + /* the wimote disconnected */ + mid = (*env)->GetMethodID(env, cls, "addDisconnectionEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_NUNCHUK_INSERTED: + /* the nunchuk was just connected */ + mid = (*env)->GetMethodID(env, cls, "addNunchukInsertedEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_NUNCHUK_REMOVED: + /* the nunchuk disconnected */ + mid = (*env)->GetMethodID(env, cls, "addNunchukRemovedEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_GUITAR_HERO_3_CTRL_INSERTED: + /* the guitar hero was just connected */ + mid = (*env)->GetMethodID(env, cls, "addGuitarHeroInsertedEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_GUITAR_HERO_3_CTRL_REMOVED: + /* the guitar hero disconnected */ + mid = (*env)->GetMethodID(env, cls, "addGuitarHeroRemovedEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_CLASSIC_CTRL_INSERTED: + /* the classic controller was just connected */ + mid = (*env)->GetMethodID(env, cls, "addClassicControllerInsertedEvent", "(I)V"); + if (mid == 0) { + return; + } + (*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid); + break; + + case WIIUSE_CLASSIC_CTRL_REMOVED: + /* the classic controller disconnected */ + mid = (*env)->GetMethodID(env, cls, "addClassicControllerRemovedEvent", "(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"); + if (mid == 0) { + return; + } + /* LEDS */ + if (WIIUSE_IS_LED_SET(wiimotes[i], 1)) leds += 1; + if (WIIUSE_IS_LED_SET(wiimotes[i], 2)) leds += 2; + if (WIIUSE_IS_LED_SET(wiimotes[i], 3)) leds += 4; + if (WIIUSE_IS_LED_SET(wiimotes[i], 4)) leds += 8; + + (*env)->CallVoidMethod(env, gath, mid, + wiimotes[i]->unid, WIIMOTE_IS_SET(wiimotes[i], WIIMOTE_STATE_CONNECTED), + wiimotes[i]->battery_level, leds, WIIUSE_USING_SPEAKER(wiimotes[i]), + wiimotes[i]->exp.type,WIIMOTE_IS_SET(wiimotes[i], WIIMOTE_STATE_RUMBLE), + WIIMOTE_IS_FLAG_SET(wiimotes[i],WIIUSE_CONTINUOUS), + WIIUSE_USING_IR(wiimotes[i]),WIIUSE_USING_ACC(wiimotes[i])); + break; + + default: + break; + } + } + } +} diff --git a/WiiUseJC/wiiuse.h b/src/main/headers/wiiuse.h similarity index 97% rename from WiiUseJC/wiiuse.h rename to src/main/headers/wiiuse.h index 9dff81c..b84c35f 100644 --- a/WiiUseJC/wiiuse.h +++ b/src/main/headers/wiiuse.h @@ -1,173 +1,173 @@ -/* - * wiiuse - * - * Written By: - * Michael Laforest < para > - * Email: < thepara (--AT--) g m a i l [--DOT--] com > - * - * Copyright 2006-2007 - * - * 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 API header file. - * - * If this file is included from inside the wiiuse source - * and not from a third party program, then wiimote_internal.h - * is also included which extends this file. - */ - -#ifndef WIIUSE_H_INCLUDED -#define WIIUSE_H_INCLUDED - -#ifdef _WIN32 - /* windows */ - #include -#else - /* nix */ - #include -#endif - -#ifdef WIIUSE_INTERNAL_H_INCLUDED - #define WCONST -#else - #define WCONST const -#endif - -/* led bit masks */ -#define WIIMOTE_LED_NONE 0x00 -#define WIIMOTE_LED_1 0x10 -#define WIIMOTE_LED_2 0x20 -#define WIIMOTE_LED_3 0x40 -#define WIIMOTE_LED_4 0x80 - -/* button codes */ -#define WIIMOTE_BUTTON_TWO 0x0001 -#define WIIMOTE_BUTTON_ONE 0x0002 -#define WIIMOTE_BUTTON_B 0x0004 -#define WIIMOTE_BUTTON_A 0x0008 -#define WIIMOTE_BUTTON_MINUS 0x0010 -#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 -#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 -#define WIIMOTE_BUTTON_HOME 0x0080 -#define WIIMOTE_BUTTON_LEFT 0x0100 -#define WIIMOTE_BUTTON_RIGHT 0x0200 -#define WIIMOTE_BUTTON_DOWN 0x0400 -#define WIIMOTE_BUTTON_UP 0x0800 -#define WIIMOTE_BUTTON_PLUS 0x1000 -#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 -#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 -#define WIIMOTE_BUTTON_UNKNOWN 0x8000 -#define WIIMOTE_BUTTON_ALL 0x1F9F - -/* nunchul button codes */ -#define NUNCHUK_BUTTON_Z 0x01 -#define NUNCHUK_BUTTON_C 0x02 -#define NUNCHUK_BUTTON_ALL 0x03 - -/* classic controller button codes */ -#define CLASSIC_CTRL_BUTTON_UP 0x0001 -#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 -#define CLASSIC_CTRL_BUTTON_ZR 0x0004 -#define CLASSIC_CTRL_BUTTON_X 0x0008 -#define CLASSIC_CTRL_BUTTON_A 0x0010 -#define CLASSIC_CTRL_BUTTON_Y 0x0020 -#define CLASSIC_CTRL_BUTTON_B 0x0040 -#define CLASSIC_CTRL_BUTTON_ZL 0x0080 -#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 -#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 -#define CLASSIC_CTRL_BUTTON_HOME 0x0800 -#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 -#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 -#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 -#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 -#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF - -/* guitar hero 3 button codes */ -#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 -#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 -#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 -#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 -#define GUITAR_HERO_3_BUTTON_RED 0x0040 -#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 -#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 -#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 -#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 -#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF - - -/* wiimote option flags */ -#define WIIUSE_SMOOTHING 0x01 -#define WIIUSE_CONTINUOUS 0x02 -#define WIIUSE_ORIENT_THRESH 0x04 -#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) - -#define WIIUSE_ORIENT_PRECISION 100.0f - -/* expansion codes */ -#define EXP_NONE 0 -#define EXP_NUNCHUK 1 -#define EXP_CLASSIC 2 -#define EXP_GUITAR_HERO_3 3 - -/* IR correction types */ -typedef enum ir_position_t { - WIIUSE_IR_ABOVE, - WIIUSE_IR_BELOW -} ir_position_t; - -/** - * @brief Check if a button is pressed. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ -#define IS_PRESSED(dev, button) ((dev->btns & button) == button) - -/** - * @brief Check if a button is being held. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is held, 0 if not. - */ -#define IS_HELD(dev, button) ((dev->btns_held & button) == button) - -/** - * @brief Check if a button is released on this event. \n\n - * This does not mean the button is not pressed, it means \n - * this button was just now released. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is released, 0 if not. - * - */ -#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) - -/** - * @brief Check if a button has just been pressed this event. - * @param dev Pointer to a wiimote_t or expansion structure. - * @param button The button you are interested in. - * @return 1 if the button is pressed, 0 if not. - */ +/* + * wiiuse + * + * Written By: + * Michael Laforest < para > + * Email: < thepara (--AT--) g m a i l [--DOT--] com > + * + * Copyright 2006-2007 + * + * 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 API header file. + * + * If this file is included from inside the wiiuse source + * and not from a third party program, then wiimote_internal.h + * is also included which extends this file. + */ + +#ifndef WIIUSE_H_INCLUDED +#define WIIUSE_H_INCLUDED + +#ifdef _WIN32 + /* windows */ + #include +#else + /* nix */ + #include +#endif + +#ifdef WIIUSE_INTERNAL_H_INCLUDED + #define WCONST +#else + #define WCONST const +#endif + +/* led bit masks */ +#define WIIMOTE_LED_NONE 0x00 +#define WIIMOTE_LED_1 0x10 +#define WIIMOTE_LED_2 0x20 +#define WIIMOTE_LED_3 0x40 +#define WIIMOTE_LED_4 0x80 + +/* button codes */ +#define WIIMOTE_BUTTON_TWO 0x0001 +#define WIIMOTE_BUTTON_ONE 0x0002 +#define WIIMOTE_BUTTON_B 0x0004 +#define WIIMOTE_BUTTON_A 0x0008 +#define WIIMOTE_BUTTON_MINUS 0x0010 +#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 +#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 +#define WIIMOTE_BUTTON_HOME 0x0080 +#define WIIMOTE_BUTTON_LEFT 0x0100 +#define WIIMOTE_BUTTON_RIGHT 0x0200 +#define WIIMOTE_BUTTON_DOWN 0x0400 +#define WIIMOTE_BUTTON_UP 0x0800 +#define WIIMOTE_BUTTON_PLUS 0x1000 +#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 +#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 +#define WIIMOTE_BUTTON_UNKNOWN 0x8000 +#define WIIMOTE_BUTTON_ALL 0x1F9F + +/* nunchul button codes */ +#define NUNCHUK_BUTTON_Z 0x01 +#define NUNCHUK_BUTTON_C 0x02 +#define NUNCHUK_BUTTON_ALL 0x03 + +/* classic controller button codes */ +#define CLASSIC_CTRL_BUTTON_UP 0x0001 +#define CLASSIC_CTRL_BUTTON_LEFT 0x0002 +#define CLASSIC_CTRL_BUTTON_ZR 0x0004 +#define CLASSIC_CTRL_BUTTON_X 0x0008 +#define CLASSIC_CTRL_BUTTON_A 0x0010 +#define CLASSIC_CTRL_BUTTON_Y 0x0020 +#define CLASSIC_CTRL_BUTTON_B 0x0040 +#define CLASSIC_CTRL_BUTTON_ZL 0x0080 +#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 +#define CLASSIC_CTRL_BUTTON_PLUS 0x0400 +#define CLASSIC_CTRL_BUTTON_HOME 0x0800 +#define CLASSIC_CTRL_BUTTON_MINUS 0x1000 +#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 +#define CLASSIC_CTRL_BUTTON_DOWN 0x4000 +#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 +#define CLASSIC_CTRL_BUTTON_ALL 0xFEFF + +/* guitar hero 3 button codes */ +#define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 +#define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 +#define GUITAR_HERO_3_BUTTON_GREEN 0x0010 +#define GUITAR_HERO_3_BUTTON_BLUE 0x0020 +#define GUITAR_HERO_3_BUTTON_RED 0x0040 +#define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 +#define GUITAR_HERO_3_BUTTON_PLUS 0x0400 +#define GUITAR_HERO_3_BUTTON_MINUS 0x1000 +#define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 +#define GUITAR_HERO_3_BUTTON_ALL 0xFEFF + + +/* wiimote option flags */ +#define WIIUSE_SMOOTHING 0x01 +#define WIIUSE_CONTINUOUS 0x02 +#define WIIUSE_ORIENT_THRESH 0x04 +#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH) + +#define WIIUSE_ORIENT_PRECISION 100.0f + +/* expansion codes */ +#define EXP_NONE 0 +#define EXP_NUNCHUK 1 +#define EXP_CLASSIC 2 +#define EXP_GUITAR_HERO_3 3 + +/* IR correction types */ +typedef enum ir_position_t { + WIIUSE_IR_ABOVE, + WIIUSE_IR_BELOW +} ir_position_t; + +/** + * @brief Check if a button is pressed. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ +#define IS_PRESSED(dev, button) ((dev->btns & button) == button) + +/** + * @brief Check if a button is being held. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is held, 0 if not. + */ +#define IS_HELD(dev, button) ((dev->btns_held & button) == button) + +/** + * @brief Check if a button is released on this event. \n\n + * This does not mean the button is not pressed, it means \n + * this button was just now released. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is released, 0 if not. + * + */ +#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) + +/** + * @brief Check if a button has just been pressed this event. + * @param dev Pointer to a wiimote_t or expansion structure. + * @param button The button you are interested in. + * @return 1 if the button is pressed, 0 if not. + */ #define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button)) /** @@ -185,469 +185,469 @@ typedef enum ir_position_t { else if ((wm->state & 0x2000) == 0x2000) *lvl = 5; \ else *lvl = 0; \ } while (0) - -#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) -#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) -#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) -#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) - -#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) - -/* - * Largest known payload is 21 bytes. - * Add 2 for the prefix and round up to a power of 2. - */ -#define MAX_PAYLOAD 32 - -/* - * This is left over from an old hack, but it may actually - * be a useful feature to keep so it wasn't removed. - */ -#ifdef WIN32 - #define WIIMOTE_DEFAULT_TIMEOUT 10 - #define WIIMOTE_EXP_TIMEOUT 10 -#endif - -typedef unsigned char byte; -typedef char sbyte; - -struct wiimote_t; -struct vec3b_t; -struct orient_t; -struct gforce_t; - - -/** - * @brief Callback that handles a read event. - * - * @param wm Pointer to a wiimote_t structure. - * @param data Pointer to the filled data block. - * @param len Length in bytes of the data block. - * - * @see wiiuse_init() - * - * A registered function of this type is called automatically by the wiiuse - * library when the wiimote has returned the full data requested by a previous - * call to wiiuse_read_data(). - */ -typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len); - - -/** - * @struct read_req_t - * @brief Data read request structure. - */ -struct read_req_t { - wiiuse_read_cb cb; /**< read data callback */ - byte* buf; /**< buffer where read data is written */ - unsigned int addr; /**< the offset that the read started at */ - unsigned short size; /**< the length of the data read */ + +#define WIIUSE_USING_ACC(wm) ((wm->state & 0x020) == 0x020) +#define WIIUSE_USING_EXP(wm) ((wm->state & 0x040) == 0x040) +#define WIIUSE_USING_IR(wm) ((wm->state & 0x080) == 0x080) +#define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x100) == 0x100) + +#define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) + +/* + * Largest known payload is 21 bytes. + * Add 2 for the prefix and round up to a power of 2. + */ +#define MAX_PAYLOAD 32 + +/* + * This is left over from an old hack, but it may actually + * be a useful feature to keep so it wasn't removed. + */ +#ifdef WIN32 + #define WIIMOTE_DEFAULT_TIMEOUT 10 + #define WIIMOTE_EXP_TIMEOUT 10 +#endif + +typedef unsigned char byte; +typedef char sbyte; + +struct wiimote_t; +struct vec3b_t; +struct orient_t; +struct gforce_t; + + +/** + * @brief Callback that handles a read event. + * + * @param wm Pointer to a wiimote_t structure. + * @param data Pointer to the filled data block. + * @param len Length in bytes of the data block. + * + * @see wiiuse_init() + * + * A registered function of this type is called automatically by the wiiuse + * library when the wiimote has returned the full data requested by a previous + * call to wiiuse_read_data(). + */ +typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len); + + +/** + * @struct read_req_t + * @brief Data read request structure. + */ +struct read_req_t { + wiiuse_read_cb cb; /**< read data callback */ + byte* buf; /**< buffer where read data is written */ + unsigned int addr; /**< the offset that the read started at */ + unsigned short size; /**< the length of the data read */ unsigned short wait; /**< num bytes still needed to finish read */ - byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ - - struct read_req_t* next; /**< next read request in the queue */ -}; - - -/** - * @struct vec2b_t - * @brief Unsigned x,y byte vector. - */ -typedef struct vec2b_t { - byte x, y; -} vec2b_t; - - -/** - * @struct vec3b_t - * @brief Unsigned x,y,z byte vector. - */ -typedef struct vec3b_t { - byte x, y, z; -} vec3b_t; - - -/** - * @struct vec3f_t - * @brief Signed x,y,z float struct. - */ -typedef struct vec3f_t { - float x, y, z; -} vec3f_t; - - -/** - * @struct orient_t - * @brief Orientation struct. - * - * Yaw, pitch, and roll range from -180 to 180 degrees. - */ -typedef struct orient_t { - float roll; /**< roll, this may be smoothed if enabled */ - float pitch; /**< pitch, this may be smoothed if enabled */ - float yaw; - - float a_roll; /**< absolute roll, unsmoothed */ - float a_pitch; /**< absolute pitch, unsmoothed */ -} orient_t; - - -/** - * @struct gforce_t - * @brief Gravity force struct. - */ -typedef struct gforce_t { - float x, y, z; -} gforce_t; - - -/** - * @struct accel_t - * @brief Accelerometer struct. For any device with an accelerometer. - */ -typedef struct accel_t { - struct vec3b_t cal_zero; /**< zero calibration */ - struct vec3b_t cal_g; /**< 1g difference around 0cal */ - - float st_roll; /**< last smoothed roll value */ - float st_pitch; /**< last smoothed roll pitch */ - float st_alpha; /**< alpha value for smoothing [0-1] */ -} accel_t; - - -/** - * @struct ir_dot_t - * @brief A single IR source. - */ -typedef struct ir_dot_t { - byte visible; /**< if the IR source is visible */ - - unsigned int x; /**< interpolated X coordinate */ - unsigned int y; /**< interpolated Y coordinate */ - - short rx; /**< raw X coordinate (0-1023) */ - short ry; /**< raw Y coordinate (0-767) */ - - byte order; /**< increasing order by x-axis value */ - - byte size; /**< size of the IR dot (0-15) */ -} ir_dot_t; - - -/** - * @enum aspect_t - * @brief Screen aspect ratio. - */ -typedef enum aspect_t { - WIIUSE_ASPECT_4_3, - WIIUSE_ASPECT_16_9 -} aspect_t; - - -/** - * @struct ir_t - * @brief IR struct. Hold all data related to the IR tracking. - */ -typedef struct ir_t { - struct ir_dot_t dot[4]; /**< IR dots */ - byte num_dots; /**< number of dots at this time */ - - enum aspect_t aspect; /**< aspect ratio of the screen */ - - enum ir_position_t pos; /**< IR sensor bar position */ - - unsigned int vres[2]; /**< IR virtual screen resolution */ - int offset[2]; /**< IR XY correction offset */ - int state; /**< keeps track of the IR state */ - - int ax; /**< absolute X coordinate */ - int ay; /**< absolute Y coordinate */ - - int x; /**< calculated X coordinate */ - int y; /**< calculated Y coordinate */ - - float distance; /**< pixel distance between first 2 dots*/ - float z; /**< calculated distance */ -} ir_t; - - -/** - * @struct joystick_t - * @brief Joystick calibration structure. - * - * The angle \a ang is relative to the positive y-axis into quadrant I - * and ranges from 0 to 360 degrees. So if the joystick is held straight - * upwards then angle is 0 degrees. If it is held to the right it is 90, - * down is 180, and left is 270. - * - * The magnitude \a mag is the distance from the center to where the - * joystick is being held. The magnitude ranges from 0 to 1. - * If the joystick is only slightly tilted from the center the magnitude - * will be low, but if it is closer to the outter edge the value will - * be higher. - */ -typedef struct joystick_t { - struct vec2b_t max; /**< maximum joystick values */ - struct vec2b_t min; /**< minimum joystick values */ - struct vec2b_t center; /**< center joystick values */ - - float ang; /**< angle the joystick is being held */ - float mag; /**< magnitude of the joystick (range 0-1) */ -} joystick_t; - - -/** - * @struct nunchuk_t - * @brief Nunchuk expansion device. - */ -typedef struct nunchuk_t { - struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ - struct joystick_t js; /**< joystick calibration */ - - int* flags; /**< options flag (points to wiimote_t.flags) */ - - byte btns; /**< what buttons have just been pressed */ - byte btns_held; /**< what buttons are being held down */ - byte btns_released; /**< what buttons were just released this */ + byte dirty; /**< set to 1 if not using callback and needs to be cleaned up */ + + struct read_req_t* next; /**< next read request in the queue */ +}; + + +/** + * @struct vec2b_t + * @brief Unsigned x,y byte vector. + */ +typedef struct vec2b_t { + byte x, y; +} vec2b_t; + + +/** + * @struct vec3b_t + * @brief Unsigned x,y,z byte vector. + */ +typedef struct vec3b_t { + byte x, y, z; +} vec3b_t; + + +/** + * @struct vec3f_t + * @brief Signed x,y,z float struct. + */ +typedef struct vec3f_t { + float x, y, z; +} vec3f_t; + + +/** + * @struct orient_t + * @brief Orientation struct. + * + * Yaw, pitch, and roll range from -180 to 180 degrees. + */ +typedef struct orient_t { + float roll; /**< roll, this may be smoothed if enabled */ + float pitch; /**< pitch, this may be smoothed if enabled */ + float yaw; + + float a_roll; /**< absolute roll, unsmoothed */ + float a_pitch; /**< absolute pitch, unsmoothed */ +} orient_t; + + +/** + * @struct gforce_t + * @brief Gravity force struct. + */ +typedef struct gforce_t { + float x, y, z; +} gforce_t; + + +/** + * @struct accel_t + * @brief Accelerometer struct. For any device with an accelerometer. + */ +typedef struct accel_t { + struct vec3b_t cal_zero; /**< zero calibration */ + struct vec3b_t cal_g; /**< 1g difference around 0cal */ + + float st_roll; /**< last smoothed roll value */ + float st_pitch; /**< last smoothed roll pitch */ + float st_alpha; /**< alpha value for smoothing [0-1] */ +} accel_t; + + +/** + * @struct ir_dot_t + * @brief A single IR source. + */ +typedef struct ir_dot_t { + byte visible; /**< if the IR source is visible */ + + unsigned int x; /**< interpolated X coordinate */ + unsigned int y; /**< interpolated Y coordinate */ + + short rx; /**< raw X coordinate (0-1023) */ + short ry; /**< raw Y coordinate (0-767) */ + + byte order; /**< increasing order by x-axis value */ + + byte size; /**< size of the IR dot (0-15) */ +} ir_dot_t; + + +/** + * @enum aspect_t + * @brief Screen aspect ratio. + */ +typedef enum aspect_t { + WIIUSE_ASPECT_4_3, + WIIUSE_ASPECT_16_9 +} aspect_t; + + +/** + * @struct ir_t + * @brief IR struct. Hold all data related to the IR tracking. + */ +typedef struct ir_t { + struct ir_dot_t dot[4]; /**< IR dots */ + byte num_dots; /**< number of dots at this time */ + + enum aspect_t aspect; /**< aspect ratio of the screen */ + + enum ir_position_t pos; /**< IR sensor bar position */ + + unsigned int vres[2]; /**< IR virtual screen resolution */ + int offset[2]; /**< IR XY correction offset */ + int state; /**< keeps track of the IR state */ + + int ax; /**< absolute X coordinate */ + int ay; /**< absolute Y coordinate */ + + int x; /**< calculated X coordinate */ + int y; /**< calculated Y coordinate */ + + float distance; /**< pixel distance between first 2 dots*/ + float z; /**< calculated distance */ +} ir_t; + + +/** + * @struct joystick_t + * @brief Joystick calibration structure. + * + * The angle \a ang is relative to the positive y-axis into quadrant I + * and ranges from 0 to 360 degrees. So if the joystick is held straight + * upwards then angle is 0 degrees. If it is held to the right it is 90, + * down is 180, and left is 270. + * + * The magnitude \a mag is the distance from the center to where the + * joystick is being held. The magnitude ranges from 0 to 1. + * If the joystick is only slightly tilted from the center the magnitude + * will be low, but if it is closer to the outter edge the value will + * be higher. + */ +typedef struct joystick_t { + struct vec2b_t max; /**< maximum joystick values */ + struct vec2b_t min; /**< minimum joystick values */ + struct vec2b_t center; /**< center joystick values */ + + float ang; /**< angle the joystick is being held */ + float mag; /**< magnitude of the joystick (range 0-1) */ +} joystick_t; + + +/** + * @struct nunchuk_t + * @brief Nunchuk expansion device. + */ +typedef struct nunchuk_t { + struct accel_t accel_calib; /**< nunchuk accelerometer calibration */ + struct joystick_t js; /**< joystick calibration */ + + int* flags; /**< options flag (points to wiimote_t.flags) */ + + byte btns; /**< what buttons have just been pressed */ + byte btns_held; /**< what buttons are being held down */ + byte btns_released; /**< what buttons were just released this */ float orient_threshold; /**< threshold for orient to generate an event */ int accel_threshold; /**< threshold for accel to generate an event */ - - struct vec3b_t accel; /**< current raw acceleration data */ - struct orient_t orient; /**< current orientation on each axis */ - struct gforce_t gforce; /**< current gravity forces on each axis */ -} nunchuk_t; - - -/** - * @struct classic_ctrl_t - * @brief Classic controller expansion device. - */ -typedef struct classic_ctrl_t { - short btns; /**< what buttons have just been pressed */ - short btns_held; /**< what buttons are being held down */ - short btns_released; /**< what buttons were just released this */ - - float r_shoulder; /**< right shoulder button (range 0-1) */ - float l_shoulder; /**< left shoulder button (range 0-1) */ - - struct joystick_t ljs; /**< left joystick calibration */ - struct joystick_t rjs; /**< right joystick calibration */ -} classic_ctrl_t; - - -/** - * @struct guitar_hero_3_t - * @brief Guitar Hero 3 expansion device. - */ -typedef struct guitar_hero_3_t { - short btns; /**< what buttons have just been pressed */ - short btns_held; /**< what buttons are being held down */ - short btns_released; /**< what buttons were just released this */ - - float whammy_bar; /**< whammy bar (range 0-1) */ - - struct joystick_t js; /**< joystick calibration */ -} guitar_hero_3_t; - - -/** - * @struct expansion_t - * @brief Generic expansion device plugged into wiimote. - */ -typedef struct expansion_t { - int type; /**< type of expansion attached */ - - union { - struct nunchuk_t nunchuk; - struct classic_ctrl_t classic; - struct guitar_hero_3_t gh3; - }; -} expansion_t; - - -/** - * @enum win32_bt_stack_t - * @brief Available bluetooth stacks for Windows. - */ -typedef enum win_bt_stack_t { - WIIUSE_STACK_UNKNOWN, - WIIUSE_STACK_MS, - WIIUSE_STACK_BLUESOLEIL -} win_bt_stack_t; - - -/** - * @struct wiimote_state_t - * @brief Significant data from the previous event. - */ -typedef struct wiimote_state_t { - /* expansion_t */ - float exp_ljs_ang; - float exp_rjs_ang; - float exp_ljs_mag; - float exp_rjs_mag; - unsigned short exp_btns; - struct orient_t exp_orient; + + struct vec3b_t accel; /**< current raw acceleration data */ + struct orient_t orient; /**< current orientation on each axis */ + struct gforce_t gforce; /**< current gravity forces on each axis */ +} nunchuk_t; + + +/** + * @struct classic_ctrl_t + * @brief Classic controller expansion device. + */ +typedef struct classic_ctrl_t { + short btns; /**< what buttons have just been pressed */ + short btns_held; /**< what buttons are being held down */ + short btns_released; /**< what buttons were just released this */ + + float r_shoulder; /**< right shoulder button (range 0-1) */ + float l_shoulder; /**< left shoulder button (range 0-1) */ + + struct joystick_t ljs; /**< left joystick calibration */ + struct joystick_t rjs; /**< right joystick calibration */ +} classic_ctrl_t; + + +/** + * @struct guitar_hero_3_t + * @brief Guitar Hero 3 expansion device. + */ +typedef struct guitar_hero_3_t { + short btns; /**< what buttons have just been pressed */ + short btns_held; /**< what buttons are being held down */ + short btns_released; /**< what buttons were just released this */ + + float whammy_bar; /**< whammy bar (range 0-1) */ + + struct joystick_t js; /**< joystick calibration */ +} guitar_hero_3_t; + + +/** + * @struct expansion_t + * @brief Generic expansion device plugged into wiimote. + */ +typedef struct expansion_t { + int type; /**< type of expansion attached */ + + union { + struct nunchuk_t nunchuk; + struct classic_ctrl_t classic; + struct guitar_hero_3_t gh3; + }; +} expansion_t; + + +/** + * @enum win32_bt_stack_t + * @brief Available bluetooth stacks for Windows. + */ +typedef enum win_bt_stack_t { + WIIUSE_STACK_UNKNOWN, + WIIUSE_STACK_MS, + WIIUSE_STACK_BLUESOLEIL +} win_bt_stack_t; + + +/** + * @struct wiimote_state_t + * @brief Significant data from the previous event. + */ +typedef struct wiimote_state_t { + /* expansion_t */ + float exp_ljs_ang; + float exp_rjs_ang; + float exp_ljs_mag; + float exp_rjs_mag; + unsigned short exp_btns; + struct orient_t exp_orient; struct vec3b_t exp_accel; - float exp_r_shoulder; - float exp_l_shoulder; - - /* ir_t */ - int ir_ax; - int ir_ay; - float ir_distance; - - struct orient_t orient; - unsigned short btns; - - struct vec3b_t accel; -} wiimote_state_t; - - -/** - * @enum WIIUSE_EVENT_TYPE - * @brief Events that wiiuse can generate from a poll. - */ -typedef enum WIIUSE_EVENT_TYPE { - WIIUSE_NONE = 0, - WIIUSE_EVENT, + float exp_r_shoulder; + float exp_l_shoulder; + + /* ir_t */ + int ir_ax; + int ir_ay; + float ir_distance; + + struct orient_t orient; + unsigned short btns; + + struct vec3b_t accel; +} wiimote_state_t; + + +/** + * @enum WIIUSE_EVENT_TYPE + * @brief Events that wiiuse can generate from a poll. + */ +typedef enum WIIUSE_EVENT_TYPE { + WIIUSE_NONE = 0, + WIIUSE_EVENT, WIIUSE_STATUS, - WIIUSE_CONNECT, + WIIUSE_CONNECT, WIIUSE_DISCONNECT, WIIUSE_UNEXPECTED_DISCONNECT, WIIUSE_READ_DATA, - WIIUSE_NUNCHUK_INSERTED, + WIIUSE_NUNCHUK_INSERTED, WIIUSE_NUNCHUK_REMOVED, WIIUSE_CLASSIC_CTRL_INSERTED, WIIUSE_CLASSIC_CTRL_REMOVED, WIIUSE_GUITAR_HERO_3_CTRL_INSERTED, WIIUSE_GUITAR_HERO_3_CTRL_REMOVED -} WIIUSE_EVENT_TYPE; - -/** - * @struct wiimote_t - * @brief Wiimote structure. - */ -typedef struct wiimote_t { - WCONST int unid; /**< user specified id */ - - #ifndef WIN32 - WCONST bdaddr_t bdaddr; /**< bt address */ - WCONST char bdaddr_str[18]; /**< readable bt address */ - WCONST int out_sock; /**< output socket */ - WCONST int in_sock; /**< input socket */ - #else - WCONST HANDLE dev_handle; /**< HID handle */ - WCONST OVERLAPPED hid_overlap; /**< overlap handle */ - WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ - WCONST int timeout; /**< read timeout */ - WCONST byte normal_timeout; /**< normal timeout */ - WCONST byte exp_timeout; /**< timeout for expansion handshake */ - #endif - - WCONST int state; /**< various state flags */ - WCONST byte leds; /**< currently lit leds */ - WCONST float battery_level; /**< battery level */ - +} WIIUSE_EVENT_TYPE; + +/** + * @struct wiimote_t + * @brief Wiimote structure. + */ +typedef struct wiimote_t { + WCONST int unid; /**< user specified id */ + + #ifndef WIN32 + WCONST bdaddr_t bdaddr; /**< bt address */ + WCONST char bdaddr_str[18]; /**< readable bt address */ + WCONST int out_sock; /**< output socket */ + WCONST int in_sock; /**< input socket */ + #else + WCONST HANDLE dev_handle; /**< HID handle */ + WCONST OVERLAPPED hid_overlap; /**< overlap handle */ + WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ + WCONST int timeout; /**< read timeout */ + WCONST byte normal_timeout; /**< normal timeout */ + WCONST byte exp_timeout; /**< timeout for expansion handshake */ + #endif + + WCONST int state; /**< various state flags */ + WCONST byte leds; /**< currently lit leds */ + WCONST float battery_level; /**< battery level */ + WCONST int flags; /**< options flag */ - WCONST byte handshake_state; /**< the state of the connection handshake */ - - WCONST struct read_req_t* read_req; /**< list of data read requests */ - WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ - WCONST struct expansion_t exp; /**< wiimote expansion device */ - - WCONST struct vec3b_t accel; /**< current raw acceleration data */ - WCONST struct orient_t orient; /**< current orientation on each axis */ - WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ - - WCONST struct ir_t ir; /**< IR data */ - - WCONST unsigned short btns; /**< what buttons have just been pressed */ - WCONST unsigned short btns_held; /**< what buttons are being held down */ - WCONST unsigned short btns_released; /**< what buttons were just released this */ - - WCONST float orient_threshold; /**< threshold for orient to generate an event */ - WCONST int accel_threshold; /**< threshold for accel to generate an event */ - - WCONST struct wiimote_state_t lstate; /**< last saved state */ - - WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */ - WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */ -} wiimote; - - -/***************************************** - * - * Include API specific stuff - * - *****************************************/ - -#ifdef _WIN32 - #define WIIUSE_EXPORT_DECL __declspec(dllexport) - #define WIIUSE_IMPORT_DECL __declspec(dllimport) -#else - #define WIIUSE_EXPORT_DECL - #define WIIUSE_IMPORT_DECL -#endif - -#ifdef WIIUSE_COMPILE_LIB - #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL -#else - #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* wiiuse.c */ -WIIUSE_EXPORT extern const char* wiiuse_version(); - -WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); -WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); -WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); -WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, unsigned short len); -WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len); -WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); -WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); -WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); -WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); -WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); -WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); -WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); -WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); -WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); - -/* connect.c */ -WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); -WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); -WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); - -/* events.c */ -WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); - -/* ir.c */ -WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); -WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); -WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); + WCONST byte handshake_state; /**< the state of the connection handshake */ + + WCONST struct read_req_t* read_req; /**< list of data read requests */ + WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ + WCONST struct expansion_t exp; /**< wiimote expansion device */ + + WCONST struct vec3b_t accel; /**< current raw acceleration data */ + WCONST struct orient_t orient; /**< current orientation on each axis */ + WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ + + WCONST struct ir_t ir; /**< IR data */ + + WCONST unsigned short btns; /**< what buttons have just been pressed */ + WCONST unsigned short btns_held; /**< what buttons are being held down */ + WCONST unsigned short btns_released; /**< what buttons were just released this */ + + WCONST float orient_threshold; /**< threshold for orient to generate an event */ + WCONST int accel_threshold; /**< threshold for accel to generate an event */ + + WCONST struct wiimote_state_t lstate; /**< last saved state */ + + WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */ + WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */ +} wiimote; + + +/***************************************** + * + * Include API specific stuff + * + *****************************************/ + +#ifdef _WIN32 + #define WIIUSE_EXPORT_DECL __declspec(dllexport) + #define WIIUSE_IMPORT_DECL __declspec(dllimport) +#else + #define WIIUSE_EXPORT_DECL + #define WIIUSE_IMPORT_DECL +#endif + +#ifdef WIIUSE_COMPILE_LIB + #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL +#else + #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* wiiuse.c */ +WIIUSE_EXPORT extern const char* wiiuse_version(); + +WIIUSE_EXPORT extern struct wiimote_t** wiiuse_init(int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnected(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_cleanup(struct wiimote_t** wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_rumble(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern void wiiuse_toggle_rumble(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_set_leds(struct wiimote_t* wm, int leds); +WIIUSE_EXPORT extern void wiiuse_motion_sensing(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern int wiiuse_read_data(struct wiimote_t* wm, byte* buffer, unsigned int offset, unsigned short len); +WIIUSE_EXPORT extern int wiiuse_write_data(struct wiimote_t* wm, unsigned int addr, byte* data, byte len); +WIIUSE_EXPORT extern void wiiuse_status(struct wiimote_t* wm); +WIIUSE_EXPORT extern struct wiimote_t* wiiuse_get_by_id(struct wiimote_t** wm, int wiimotes, int unid); +WIIUSE_EXPORT extern int wiiuse_set_flags(struct wiimote_t* wm, int enable, int disable); +WIIUSE_EXPORT extern float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha); +WIIUSE_EXPORT extern void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type); +WIIUSE_EXPORT extern void wiiuse_set_orient_threshold(struct wiimote_t* wm, float threshold); +WIIUSE_EXPORT extern void wiiuse_resync(struct wiimote_t* wm); +WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte normal_timeout, byte exp_timeout); +WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int threshold); + +/* connect.c */ +WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); +WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); +WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); + +/* events.c */ +WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); + +/* ir.c */ +WIIUSE_EXPORT extern void wiiuse_set_ir(struct wiimote_t* wm, int status); +WIIUSE_EXPORT extern void wiiuse_set_ir_vres(struct wiimote_t* wm, unsigned int x, unsigned int y); +WIIUSE_EXPORT extern void wiiuse_set_ir_position(struct wiimote_t* wm, enum ir_position_t pos); WIIUSE_EXPORT extern void wiiuse_set_aspect_ratio(struct wiimote_t* wm, enum aspect_t aspect); WIIUSE_EXPORT extern void wiiuse_set_ir_sensitivity(struct wiimote_t* wm, int level); /* nunchuk.c */ WIIUSE_EXPORT extern void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t* wm, float threshold); WIIUSE_EXPORT extern void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* wm, int threshold); - - -#ifdef __cplusplus -} -#endif - - -#endif /* WIIUSE_H_INCLUDED */ - + + +#ifdef __cplusplus +} +#endif + + +#endif /* WIIUSE_H_INCLUDED */ + diff --git a/WiiUseJC/wiiusej_WiiUseApi.def b/src/main/headers/wiiusej_WiiUseApi.def similarity index 97% rename from WiiUseJC/wiiusej_WiiUseApi.def rename to src/main/headers/wiiusej_WiiUseApi.def index e7aebd3..5f1298b 100644 --- a/WiiUseJC/wiiusej_WiiUseApi.def +++ b/src/main/headers/wiiusej_WiiUseApi.def @@ -1,34 +1,34 @@ -EXPORTS -Java_wiiusej_WiiUseApi_connect -Java_wiiusej_WiiUseApi_find -Java_wiiusej_WiiUseApi_init -Java_wiiusej_WiiUseApi_closeConnection -Java_wiiusej_WiiUseApi_getUnId -Java_wiiusej_WiiUseApi_cleanUp -Java_wiiusej_WiiUseApi_activateRumble -Java_wiiusej_WiiUseApi_deactivateRumble -Java_wiiusej_WiiUseApi_activateIRTracking -Java_wiiusej_WiiUseApi_deactivateIRTracking -Java_wiiusej_WiiUseApi_activateMotionSensing -Java_wiiusej_WiiUseApi_deactivateMotionSensing -Java_wiiusej_WiiUseApi_setLeds -Java_wiiusej_WiiUseApi_setOrientThreshold -Java_wiiusej_WiiUseApi_setAccelThreshold -Java_wiiusej_WiiUseApi_setAlphaSmoothing -Java_wiiusej_WiiUseApi_reSync -Java_wiiusej_WiiUseApi_activateSmoothing -Java_wiiusej_WiiUseApi_deactivateSmoothing -Java_wiiusej_WiiUseApi_activateContinuous -Java_wiiusej_WiiUseApi_deactivateContinuous -Java_wiiusej_WiiUseApi_setScreenRatio43 -Java_wiiusej_WiiUseApi_setScreenRatio169 -Java_wiiusej_WiiUseApi_setSensorBarAboveScreen -Java_wiiusej_WiiUseApi_setSensorBarBelowScreen -Java_wiiusej_WiiUseApi_setVirtualScreenResolution -Java_wiiusej_WiiUseApi_getStatus -Java_wiiusej_WiiUseApi_setTimeout -Java_wiiusej_WiiUseApi_setIrSensitivity -Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold -Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold -Java_wiiusej_WiiUseApi_windowsSetBluetoothStack -Java_wiiusej_WiiUseApi_specialPoll +EXPORTS +Java_wiiusej_WiiUseApi_connect +Java_wiiusej_WiiUseApi_find +Java_wiiusej_WiiUseApi_init +Java_wiiusej_WiiUseApi_closeConnection +Java_wiiusej_WiiUseApi_getUnId +Java_wiiusej_WiiUseApi_cleanUp +Java_wiiusej_WiiUseApi_activateRumble +Java_wiiusej_WiiUseApi_deactivateRumble +Java_wiiusej_WiiUseApi_activateIRTracking +Java_wiiusej_WiiUseApi_deactivateIRTracking +Java_wiiusej_WiiUseApi_activateMotionSensing +Java_wiiusej_WiiUseApi_deactivateMotionSensing +Java_wiiusej_WiiUseApi_setLeds +Java_wiiusej_WiiUseApi_setOrientThreshold +Java_wiiusej_WiiUseApi_setAccelThreshold +Java_wiiusej_WiiUseApi_setAlphaSmoothing +Java_wiiusej_WiiUseApi_reSync +Java_wiiusej_WiiUseApi_activateSmoothing +Java_wiiusej_WiiUseApi_deactivateSmoothing +Java_wiiusej_WiiUseApi_activateContinuous +Java_wiiusej_WiiUseApi_deactivateContinuous +Java_wiiusej_WiiUseApi_setScreenRatio43 +Java_wiiusej_WiiUseApi_setScreenRatio169 +Java_wiiusej_WiiUseApi_setSensorBarAboveScreen +Java_wiiusej_WiiUseApi_setSensorBarBelowScreen +Java_wiiusej_WiiUseApi_setVirtualScreenResolution +Java_wiiusej_WiiUseApi_getStatus +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/src/main/headers/wiiusej_WiiUseApi.h similarity index 95% rename from WiiUseJC/wiiusej_WiiUseApi.h rename to src/main/headers/wiiusej_WiiUseApi.h index 3680631..5cbf8ff 100644 --- a/WiiUseJC/wiiusej_WiiUseApi.h +++ b/src/main/headers/wiiusej_WiiUseApi.h @@ -1,277 +1,277 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class wiiusej_WiiUseApi */ - -#ifndef _Included_wiiusej_WiiUseApi -#define _Included_wiiusej_WiiUseApi -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: wiiusej_WiiUseApi - * Method: connect - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_connect - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: find - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_find - (JNIEnv *, jobject, jint, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: init - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: closeConnection - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: getUnId - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: cleanUp - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_cleanUp - (JNIEnv *, jobject); - -/* - * Class: wiiusej_WiiUseApi - * Method: activateRumble - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: deactivateRumble - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: activateIRTracking - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: deactivateIRTracking - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: activateMotionSensing - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: deactivateMotionSensing - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setLeds - * Signature: (IZZZZ)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds - (JNIEnv *, jobject, jint, jboolean, jboolean, jboolean, jboolean); - -/* - * Class: wiiusej_WiiUseApi - * Method: setOrientThreshold - * Signature: (IF)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold - (JNIEnv *, jobject, jint, jfloat); - -/* - * Class: wiiusej_WiiUseApi - * Method: setAccelThreshold - * Signature: (II)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAccelThreshold - (JNIEnv *, jobject, jint, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setAlphaSmoothing - * Signature: (IF)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAlphaSmoothing - (JNIEnv *, jobject, jint, jfloat); - -/* - * Class: wiiusej_WiiUseApi - * Method: reSync - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_reSync - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: activateSmoothing - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: deactivateSmoothing - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: activateContinuous - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: deactivateContinuous - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setScreenRatio43 - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio43 - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setScreenRatio169 - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio169 - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setSensorBarAboveScreen - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarAboveScreen - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setSensorBarBelowScreen - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setVirtualScreenResolution - * Signature: (III)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution - (JNIEnv *, jobject, jint, jint, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: getStatus - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus - (JNIEnv *, jobject, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setTimeout - * Signature: (ISS)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout - (JNIEnv *, jobject, jint, jshort, jshort); - -/* - * Class: wiiusej_WiiUseApi - * Method: setIrSensitivity - * Signature: (II)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setIrSensitivity - (JNIEnv *, jobject, jint, jint); - -/* - * Class: wiiusej_WiiUseApi - * Method: setNunchukOrientationThreshold - * Signature: (IF)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold - (JNIEnv *, jobject, jint, jfloat); - -/* - * Class: wiiusej_WiiUseApi - * Method: setNunchukAccelerationThreshold - * Signature: (II)V - */ -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 - * Signature: (Lwiiusej/wiiusejevents/utils/EventsGatherer;)V - */ -JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll - (JNIEnv *, jobject, jobject); - -#ifdef __cplusplus -} -#endif -#endif +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class wiiusej_WiiUseApi */ + +#ifndef _Included_wiiusej_WiiUseApi +#define _Included_wiiusej_WiiUseApi +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: wiiusej_WiiUseApi + * Method: connect + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_connect + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: find + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_find + (JNIEnv *, jobject, jint, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: init + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: closeConnection + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: getUnId + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: cleanUp + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_cleanUp + (JNIEnv *, jobject); + +/* + * Class: wiiusej_WiiUseApi + * Method: activateRumble + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: deactivateRumble + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: activateIRTracking + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: deactivateIRTracking + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: activateMotionSensing + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: deactivateMotionSensing + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setLeds + * Signature: (IZZZZ)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds + (JNIEnv *, jobject, jint, jboolean, jboolean, jboolean, jboolean); + +/* + * Class: wiiusej_WiiUseApi + * Method: setOrientThreshold + * Signature: (IF)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold + (JNIEnv *, jobject, jint, jfloat); + +/* + * Class: wiiusej_WiiUseApi + * Method: setAccelThreshold + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAccelThreshold + (JNIEnv *, jobject, jint, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setAlphaSmoothing + * Signature: (IF)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setAlphaSmoothing + (JNIEnv *, jobject, jint, jfloat); + +/* + * Class: wiiusej_WiiUseApi + * Method: reSync + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_reSync + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: activateSmoothing + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: deactivateSmoothing + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: activateContinuous + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: deactivateContinuous + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setScreenRatio43 + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio43 + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setScreenRatio169 + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setScreenRatio169 + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setSensorBarAboveScreen + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarAboveScreen + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setSensorBarBelowScreen + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setVirtualScreenResolution + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution + (JNIEnv *, jobject, jint, jint, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: getStatus + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus + (JNIEnv *, jobject, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setTimeout + * Signature: (ISS)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout + (JNIEnv *, jobject, jint, jshort, jshort); + +/* + * Class: wiiusej_WiiUseApi + * Method: setIrSensitivity + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setIrSensitivity + (JNIEnv *, jobject, jint, jint); + +/* + * Class: wiiusej_WiiUseApi + * Method: setNunchukOrientationThreshold + * Signature: (IF)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukOrientationThreshold + (JNIEnv *, jobject, jint, jfloat); + +/* + * Class: wiiusej_WiiUseApi + * Method: setNunchukAccelerationThreshold + * Signature: (II)V + */ +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 + * Signature: (Lwiiusej/wiiusejevents/utils/EventsGatherer;)V + */ +JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll + (JNIEnv *, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/WiiUseJ/src/wiiusej/WiiUseApi.java b/src/main/java/wiiusej/WiiUseApi.java similarity index 96% rename from WiiUseJ/src/wiiusej/WiiUseApi.java rename to src/main/java/wiiusej/WiiUseApi.java index 428f522..d3bfe7c 100644 --- a/WiiUseJ/src/wiiusej/WiiUseApi.java +++ b/src/main/java/wiiusej/WiiUseApi.java @@ -1,351 +1,351 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej; - -import wiiusej.wiiusejevents.utils.EventsGatherer; - -/** - * Singleton used to manipulate WiiUse Api. - * - * @author guiguito - */ -public class WiiUseApi { - - static { - System.loadLibrary("WiiuseJ"); - } - - private static WiiUseApi instance = new WiiUseApi(); - - /** - * Get the only instance of WiiUseApi. - * - * @return the only instace of WiiUseApi. - */ - protected static WiiUseApi getInstance() { - return instance; - } - - /** - * Connect to a wiimote or wiimotes once an address is known. - * - * @param nbWiimotes - * The number of wiimotes. - * @return The number of wiimotes that successfully connected. - */ - synchronized native int connect(int nbWiimotes); - - /** - * Find a wiimote or wiimotes. - * - * @param nbMaxWiimotes - * The number of wiimotes. - * @param timeout - * The number of seconds before the search times out. - * @return The number of wiimotes found. - */ - synchronized native int find(int nbMaxWiimotes, int timeout); - - /** - * Initialize an array of wiimote structures (for the C side of the - * library). - * - * @param nbPossibleWiimotes - * size of the array. - */ - synchronized native void init(int nbPossibleWiimotes); - - /** - * Close connection to the wiimote with the given id. - * - */ - synchronized native void closeConnection(int id); - - /** - * Get unique id of a wiimote in the wiimotes array. 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. - * @return the unid of the wiimote, or a wrong value if the index was false. - * - */ - synchronized native int getUnId(int index); - - /** - * CleanUp Wiiuse API. - */ - synchronized native void cleanUp(); - - /** - * Activate rumble on the wiimote with the given id. - * - * @param id - * the id of the wiimote. - */ - synchronized native void activateRumble(int id); - - /** - * Deactivate rumble on the wiimote with the given id. - * - * @param id - * the id of the wiimote. - */ - synchronized native void deactivateRumble(int id); - - /** - * Activate IR Tracking on the wiimote with the given id. - * - * @param id - * the id of the wiimote. - */ - synchronized native void activateIRTracking(int id); - - /** - * Deactivate IR Tracking on the wiimote with the given id. - * - * @param id - * the id of the wiimote. - */ - synchronized native void deactivateIRTracking(int id); - - /** - * Activate motion sensing on the wiimote with the given id. - * - * @param id - * the id of the wiimote. - */ - synchronized native void activateMotionSensing(int id); - - /** - * Deactivate motion sensing on the wiimote with the given id. - * - * @param id - * the id of the wiimote. - */ - synchronized native void deactivateMotionSensing(int id); - - /** - * Set wiimote leds status. - * - * @param id - * the id of the wiimote concerned. - * @param led1 - * status of led1: True=ON, False=OFF. - * @param led2 - * status of led2: True=ON, False=OFF. - * @param led3 - * status of led3: True=ON, False=OFF. - * @param led4 - * status of led4: True=ON, False=OFF. - */ - synchronized native void setLeds(int id, boolean led1, boolean led2, - boolean led3, boolean led4); - - /** - * Set how many degrees an angle must change to generate an event. - * - * @param id - * id of the wiimote concerned. - * @param angle - * minimum angle detected by an event. - */ - synchronized native void setOrientThreshold(int id, float angle); - - /** - * Set how much acceleration must change to generate an event. - * - * @param id - * id of the wiimote concerned. - * @param value - * minimum value detected by an event. - */ - synchronized native void setAccelThreshold(int id, int value); - - /** - * Set alpha smoothing parameter for the given id. - * - * @param id - * id of the wiimote concerned. - * @param value - * alpha smoothing value. - */ - synchronized native void setAlphaSmoothing(int id, float value); - - /** - * Try to resync with the wiimote by starting a new handshake. - * - * @param id - * id of the wiimote concerned. - */ - synchronized native void reSync(int id); - - /** - * Make the the accelerometers give smoother results. This is set by - * default. - * - * @param id - * the id of the wiimote concerned. - */ - synchronized native void activateSmoothing(int id); - - /** - * Make the the accelerometers give raw results. - * - * @param id - * the id of the wiimote concerned. - */ - synchronized native void deactivateSmoothing(int id); - - /** - * Make the wiimote generate an event each time we poll. Not set by default. - * - * @param id - * the id of the wiimote concerned. - */ - synchronized native void activateContinuous(int id); - - /** - * Make the wiimote generate an event only when there is one. - * - * @param id - * the id of the wiimote concerned. - */ - synchronized native void deactivateContinuous(int id); - - /** - * Notify wiiuse that your screen has an aspect ratio of 4/3. - * - * @param id - * the id of the wiimote of which we want the status. - */ - synchronized native void setScreenRatio43(int id); - - /** - * Notify wiiuse that your screen has an aspect ratio of 16/9. - * - * @param id - * the id of the wiimote of which we want the status. - */ - synchronized native void setScreenRatio169(int id); - - /** - * Notify wiiuse that the sensor bar is above your screen. - * - * @param id - * the id of the wiimote of which we want the status. - */ - synchronized native void setSensorBarAboveScreen(int id); - - /** - * Notify wiiuse that the sensor bar is below your screen. - * - * @param id - * the id of the wiimote of which we want the status. - */ - synchronized native void setSensorBarBelowScreen(int id); - - /** - * 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 of which we want the status. - * @param x - * x resolution. - * @param y - * y resolution. - */ - synchronized native void setVirtualScreenResolution(int id, int x, int y); - - /** - * Get status and values from the wiimotes and send it through callbacks. - * - * @param id - * the id of the wiimote of which we want the status. - */ - synchronized native void getStatus(int id); - - /** - * Set the normal and expansion handshake timeouts. - * - * @param id - * the id of the wiimote concerned. - * @param normalTimeout - * The timeout in milliseconds for a normal read. - * @param expansionTimeout - * The timeout in millisecondsd to wait for an expansion - * handshake. - */ - synchronized native void setTimeout(int id, short normalTimeout, - short expansionTimeout); - - /** - * Set the IR sensitivity. - * - * @param id - * the id of the wiimote concerned. - * @param level - * 1-5, same as Wii system sensitivity setting. If the level is < - * 1, then level will be set to 1. If the level is > 5, then - * level will be set to 5. - */ - synchronized native void setIrSensitivity(int id, int level); - - /** - * Set how many degrees an angle must change to generate an event for the - * nunchuk. - * - * @param id - * id of the wiimote concerned. - * @param angle - * minimum angle detected by an event. - */ - synchronized native void setNunchukOrientationThreshold(int id, float angle); - - /** - * Set how much acceleration must change to generate an event for the - * nunchuk. - * - * @param id - * id of the wiimote concerned. - * @param value - * minimum value detected by an event. - */ - synchronized native void setNunchukAccelerationThreshold(int id, int value); - - /** - * 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. - */ - native void windowsSetBluetoothStack(int bluetoothStackType); - - /** - * Check for new Events and Get it. - * - * @param gath - * the object where we store all the new events. - */ - native void specialPoll(EventsGatherer gath); - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej; + +import wiiusej.wiiusejevents.utils.EventsGatherer; + +/** + * Singleton used to manipulate WiiUse Api. + * + * @author guiguito + */ +public class WiiUseApi { + + static { + System.loadLibrary("WiiuseJ"); + } + + private static WiiUseApi instance = new WiiUseApi(); + + /** + * Get the only instance of WiiUseApi. + * + * @return the only instace of WiiUseApi. + */ + protected static WiiUseApi getInstance() { + return instance; + } + + /** + * Connect to a wiimote or wiimotes once an address is known. + * + * @param nbWiimotes + * The number of wiimotes. + * @return The number of wiimotes that successfully connected. + */ + synchronized native int connect(int nbWiimotes); + + /** + * Find a wiimote or wiimotes. + * + * @param nbMaxWiimotes + * The number of wiimotes. + * @param timeout + * The number of seconds before the search times out. + * @return The number of wiimotes found. + */ + synchronized native int find(int nbMaxWiimotes, int timeout); + + /** + * Initialize an array of wiimote structures (for the C side of the + * library). + * + * @param nbPossibleWiimotes + * size of the array. + */ + synchronized native void init(int nbPossibleWiimotes); + + /** + * Close connection to the wiimote with the given id. + * + */ + synchronized native void closeConnection(int id); + + /** + * Get unique id of a wiimote in the wiimotes array. 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. + * @return the unid of the wiimote, or a wrong value if the index was false. + * + */ + synchronized native int getUnId(int index); + + /** + * CleanUp Wiiuse API. + */ + synchronized native void cleanUp(); + + /** + * Activate rumble on the wiimote with the given id. + * + * @param id + * the id of the wiimote. + */ + synchronized native void activateRumble(int id); + + /** + * Deactivate rumble on the wiimote with the given id. + * + * @param id + * the id of the wiimote. + */ + synchronized native void deactivateRumble(int id); + + /** + * Activate IR Tracking on the wiimote with the given id. + * + * @param id + * the id of the wiimote. + */ + synchronized native void activateIRTracking(int id); + + /** + * Deactivate IR Tracking on the wiimote with the given id. + * + * @param id + * the id of the wiimote. + */ + synchronized native void deactivateIRTracking(int id); + + /** + * Activate motion sensing on the wiimote with the given id. + * + * @param id + * the id of the wiimote. + */ + synchronized native void activateMotionSensing(int id); + + /** + * Deactivate motion sensing on the wiimote with the given id. + * + * @param id + * the id of the wiimote. + */ + synchronized native void deactivateMotionSensing(int id); + + /** + * Set wiimote leds status. + * + * @param id + * the id of the wiimote concerned. + * @param led1 + * status of led1: True=ON, False=OFF. + * @param led2 + * status of led2: True=ON, False=OFF. + * @param led3 + * status of led3: True=ON, False=OFF. + * @param led4 + * status of led4: True=ON, False=OFF. + */ + synchronized native void setLeds(int id, boolean led1, boolean led2, + boolean led3, boolean led4); + + /** + * Set how many degrees an angle must change to generate an event. + * + * @param id + * id of the wiimote concerned. + * @param angle + * minimum angle detected by an event. + */ + synchronized native void setOrientThreshold(int id, float angle); + + /** + * Set how much acceleration must change to generate an event. + * + * @param id + * id of the wiimote concerned. + * @param value + * minimum value detected by an event. + */ + synchronized native void setAccelThreshold(int id, int value); + + /** + * Set alpha smoothing parameter for the given id. + * + * @param id + * id of the wiimote concerned. + * @param value + * alpha smoothing value. + */ + synchronized native void setAlphaSmoothing(int id, float value); + + /** + * Try to resync with the wiimote by starting a new handshake. + * + * @param id + * id of the wiimote concerned. + */ + synchronized native void reSync(int id); + + /** + * Make the the accelerometers give smoother results. This is set by + * default. + * + * @param id + * the id of the wiimote concerned. + */ + synchronized native void activateSmoothing(int id); + + /** + * Make the the accelerometers give raw results. + * + * @param id + * the id of the wiimote concerned. + */ + synchronized native void deactivateSmoothing(int id); + + /** + * Make the wiimote generate an event each time we poll. Not set by default. + * + * @param id + * the id of the wiimote concerned. + */ + synchronized native void activateContinuous(int id); + + /** + * Make the wiimote generate an event only when there is one. + * + * @param id + * the id of the wiimote concerned. + */ + synchronized native void deactivateContinuous(int id); + + /** + * Notify wiiuse that your screen has an aspect ratio of 4/3. + * + * @param id + * the id of the wiimote of which we want the status. + */ + synchronized native void setScreenRatio43(int id); + + /** + * Notify wiiuse that your screen has an aspect ratio of 16/9. + * + * @param id + * the id of the wiimote of which we want the status. + */ + synchronized native void setScreenRatio169(int id); + + /** + * Notify wiiuse that the sensor bar is above your screen. + * + * @param id + * the id of the wiimote of which we want the status. + */ + synchronized native void setSensorBarAboveScreen(int id); + + /** + * Notify wiiuse that the sensor bar is below your screen. + * + * @param id + * the id of the wiimote of which we want the status. + */ + synchronized native void setSensorBarBelowScreen(int id); + + /** + * 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 of which we want the status. + * @param x + * x resolution. + * @param y + * y resolution. + */ + synchronized native void setVirtualScreenResolution(int id, int x, int y); + + /** + * Get status and values from the wiimotes and send it through callbacks. + * + * @param id + * the id of the wiimote of which we want the status. + */ + synchronized native void getStatus(int id); + + /** + * Set the normal and expansion handshake timeouts. + * + * @param id + * the id of the wiimote concerned. + * @param normalTimeout + * The timeout in milliseconds for a normal read. + * @param expansionTimeout + * The timeout in millisecondsd to wait for an expansion + * handshake. + */ + synchronized native void setTimeout(int id, short normalTimeout, + short expansionTimeout); + + /** + * Set the IR sensitivity. + * + * @param id + * the id of the wiimote concerned. + * @param level + * 1-5, same as Wii system sensitivity setting. If the level is < + * 1, then level will be set to 1. If the level is > 5, then + * level will be set to 5. + */ + synchronized native void setIrSensitivity(int id, int level); + + /** + * Set how many degrees an angle must change to generate an event for the + * nunchuk. + * + * @param id + * id of the wiimote concerned. + * @param angle + * minimum angle detected by an event. + */ + synchronized native void setNunchukOrientationThreshold(int id, float angle); + + /** + * Set how much acceleration must change to generate an event for the + * nunchuk. + * + * @param id + * id of the wiimote concerned. + * @param value + * minimum value detected by an event. + */ + synchronized native void setNunchukAccelerationThreshold(int id, int value); + + /** + * 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. + */ + native void windowsSetBluetoothStack(int bluetoothStackType); + + /** + * Check for new Events and Get it. + * + * @param gath + * the object where we store all the new events. + */ + native void specialPoll(EventsGatherer gath); + +} diff --git a/WiiUseJ/src/wiiusej/WiiUseApiManager.java b/src/main/java/wiiusej/WiiUseApiManager.java similarity index 96% rename from WiiUseJ/src/wiiusej/WiiUseApiManager.java rename to src/main/java/wiiusej/WiiUseApiManager.java index 05797c5..4d6d1e4 100644 --- a/WiiUseJ/src/wiiusej/WiiUseApiManager.java +++ b/src/main/java/wiiusej/WiiUseApiManager.java @@ -1,664 +1,664 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej; - -import java.util.concurrent.Semaphore; -import java.util.concurrent.atomic.AtomicBoolean; - -import javax.swing.event.EventListenerList; - -import wiiusej.wiiusejevents.utils.EventsGatherer; -import wiiusej.wiiusejevents.utils.WiiUseApiListener; -import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; - -/** - * Class that manages the use of Wiiuse API. - * - * @author guiguito - */ -public class WiiUseApiManager extends Thread { - - private static WiiUseApiManager instance = new WiiUseApiManager(); - - private final EventListenerList listeners = new EventListenerList(); - - private Semaphore semaphore = new Semaphore(0); - - private Wiimote[] wiimotes; - - private WiiUseApi wiiuse = WiiUseApi.getInstance(); - - private int connected = -1; - - private AtomicBoolean running = new AtomicBoolean(false); - - private boolean leave = false; - - public static int WIIUSE_STACK_UNKNOWN = 0; - public static int WIIUSE_STACK_MS = 1; - public static int WIIUSE_STACK_BLUESOLEIL = 2; - - public static WiiUseApiManager getInstance() { - return instance; - } - - /** - * Get wiimotes. Load library if necessary. Connect to wiimotes if - * necessary. Start polling if necessary. Return an array with the connected - * wiimotes. - * - * @param nb - * try to connect nb wiimotes. - * @param rumble - * make the connected wiimotes rumble. - * - * @return an array with connected wiimotes or NULL. - */ - public static Wiimote[] getWiimotes(int nb, boolean rumble) { - return getWiimotesPrivate(nb, rumble, false, WIIUSE_STACK_UNKNOWN); - } - - /** - * Get wiimotes. Load library if necessary. Connect to wiimotes if - * necessary. Start polling if necessary. Return an array with the connected - * wiimotes. - * - * @param nb - * try to connect nb wiimotes. - * @param rumble - * make the connected wiimotes rumble.* - * @param stackType - * the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or - * WiiUseApiManager.WIIUSE_STACK_MS or - * WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL - * - * @return an array with connected wiimotes or NULL. - */ - public static Wiimote[] getWiimotes(int nb, boolean rumble, int stackType) { - return getWiimotesPrivate(nb, rumble, true, stackType); - } - - /** - * Get wiimotes. Load library if necessary. Connect to wiimotes if - * necessary. Start polling if necessary. Return an array with the connected - * wiimotes. - * - * @param nb - * try to connect nb wiimotes. - * @param rumble - * make the connected wiimotes rumble.* - * @param forceStackType - * true if we want to force the stack type. - * @param stackType - * the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or - * WiiUseApiManager.WIIUSE_STACK_MS or - * WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL - * - * @return an array with connected wiimotes or NULL. - */ - private synchronized static Wiimote[] getWiimotesPrivate(int nb, - boolean rumble, boolean forceStackType, int stackType) { - WiiUseApiManager manager = getInstance(); - - if (manager.leave) - return null;// wiiusej definitively stopped - - if (manager.connected <= 0 && !manager.running.get()) { - // connect wiimotes. - int nbWiimotes = manager.connectWiimotes(nb, rumble, - forceStackType, stackType); - manager.wiimotes = new Wiimote[nbWiimotes]; - for (int i = 0; i < nbWiimotes; i++) { - Wiimote wim = new Wiimote(WiiUseApi.getInstance().getUnId(i), - manager); - manager.wiimotes[i] = wim; - manager.addWiiUseApiListener(wim); - } - // Set leds on wiimote - for (Wiimote wiimote : manager.wiimotes) { - int id = wiimote.getId(); - if (id % 4 == 0) { - wiimote.setLeds(true, true, true, true); - } else if (id % 4 == 1) { - wiimote.setLeds(true, false, false, false); - } else if (id % 4 == 2) { - wiimote.setLeds(true, true, false, false); - } else if (id % 4 == 3) { - wiimote.setLeds(true, true, true, false); - } - } - // make the connected wiimotes rumble - if (rumble) { - for (Wiimote wiimote : manager.wiimotes) { - wiimote.activateRumble(); - } - try { - sleep(500); - } catch (InterruptedException e) { - } - for (Wiimote wiimote : manager.wiimotes) { - wiimote.deactivateRumble(); - } - } - } - - if (manager.connected == 0) {// no wiimote connected - // return empty array - return new Wiimote[0]; - } - - if (!manager.isAlive())// start wiiuseJ polling - manager.start(); - - manager.semaphore.release(1); - - return manager.wiimotes; - } - - /** - * Connect wiimote and get the number of wiimotes connected. Supposed to be - * used once. - * - * @param nb - * try to connect nb wiimotes - * @param rumble - * make the connected wiimotes rumble - * @param forceStackType - * true if we want to force the stack type. - * @param stackType - * the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or - * WiiUseApiManager.WIIUSE_STACK_MS or - * WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL - * @return 0 if nothing connected or the number of wiimotes connected. - */ - private int connectWiimotes(int nb, boolean rumble, boolean forceStackType, - int stackType) { - if (connected <= 0) { - int nbWiimotesFound; - wiiuse.init(nb); - // force bluetooth stack type ? - if (forceStackType) - setBlueToothstackType(stackType); - nbWiimotesFound = wiiuse.find(nb, 3); - connected = wiiuse.connect(nbWiimotesFound); - return connected; - } else {// library not loaded, no wiimotes connected - return 0; - } - } - - /** - * Ask the thread to close a connection. - * - * @param id - * id of the wiimote to disconnect. - */ - protected void closeConnection(int id) { - int index = 0; - boolean found = false; - while (index < wiimotes.length && !found) { - if (wiimotes[index]!=null && wiimotes[index].getId() == id) {// we have a wiimote with this - // id - // remove the wiimote - removeWiiUseApiListener(wiimotes[index]); - wiimotes[index] = null; - connected--; - if (connected == 0) {// stop this thread if there is - // no more wiimotes connected. - // stop thread - running.set(false); - } - /* Close connection in wiiuse */ - wiiuse.closeConnection(index); - } - index++; - } - } - - /** - * Get the number of wiimotes connected. - * - * @return the number of wiimotes connected. - */ - public static int getNbConnectedWiimotes() { - return getInstance().connected; - } - - /** - * Stop thread and shutdown wiiuse Api. - */ - public static void shutdown() { - WiiUseApiManager manager = getInstance(); - int pastConnected = manager.connected; - if (manager.connected > 0) { - for (Wiimote wim : manager.wiimotes) { - if (wim != null) - wim.disconnect(); - } - } - manager.running.set(false); - if (pastConnected > 0) { - manager.wiiuse.cleanUp(); - } - } - - /** - * Stop wiiuseJ definitively for this program. It finishes Wiiusej thread - * and shutdown wiiuse API. - */ - public static void definitiveShutdown() { - getInstance().leave = true; - shutdown(); - } - - /** - * Activate the rumble for the wiimote with the given id. - * - * @param id - * id of the wiimote. - */ - protected void activateRumble(int id) { - wiiuse.activateRumble(id); - } - - /** - * Deactivate the rumble for the wiimote with the given id. - * - * @param id - * id of the wiimote. - */ - protected void deactivateRumble(int id) { - wiiuse.deactivateRumble(id); - } - - /** - * Activate IR Tracking for the wiimote with the given id. - * - * @param id - * id of the wiimote. - */ - protected void activateIRTRacking(int id) { - wiiuse.activateIRTracking(id); - } - - /** - * Deactivate IR Tracking for the wiimote with the given id. - * - * @param id - * id of the wiimote. - */ - protected void deactivateIRTRacking(int id) { - wiiuse.deactivateIRTracking(id); - } - - /** - * Activate motion sensing for the wiimote with the given id. - * - * @param id - * id of the wiimote. - */ - protected void activateMotionSensing(int id) { - wiiuse.activateMotionSensing(id); - } - - /** - * Deactivate motion sensing for the wiimoter with the given id. - * - * @param id - * id of the wiimote. - */ - protected void deactivateMotionSensing(int id) { - wiiuse.deactivateMotionSensing(id); - } - - /** - * Activate smoothing the wiimotes with the given id. - * - * @param id - * id of the wiimote. - */ - protected void activateSmoothing(int id) { - wiiuse.activateSmoothing(id); - } - - /** - * Deactivate smoothing the wiimotes with the given id. - * - * @param id - * id of the wiimote. - */ - protected void deactivateSmoothing(int id) { - wiiuse.deactivateSmoothing(id); - } - - /** - * Activate continuous for the wiimotes with the given id. - * - * @param id - * id of the wiimote. - */ - protected void activateContinuous(int id) { - wiiuse.activateContinuous(id); - } - - /** - * Deactivate continuous for the wiimotes with the given id. - * - * @param id - * id of the wiimote. - */ - protected void deactivateContinuous(int id) { - wiiuse.deactivateContinuous(id); - } - - /** - * Set leds for the wiimotes with the given id. - * - * @param id - * id of the wiimote - * @param l1 - * status of led1. True : ON, False : OFF. - * @param l2 - * status of led2. True : ON, False : OFF. - * @param l3 - * status of led3. True : ON, False : OFF. - * @param l4 - * status of led4. True : ON, False : OFF. - */ - protected void setLeds(int id, boolean l1, boolean l2, boolean l3, - boolean l4) { - wiiuse.setLeds(id, l1, l2, l3, l4); - } - - /** - * Set the orientation threshold for the given id. (minimum angle between - * two events) - * - * @param id - * id of the wiimote. - * @param th - * threshold in degrees. - */ - protected void setOrientationThreshold(int id, float th) { - wiiuse.setOrientThreshold(id, th); - } - - /** - * Set the acceleration threshold for the given id. (minimum angle between - * two events) - * - * @param id - * id of the wiimote. - * @param th - * threshold. - */ - protected void setAccelerationThreshold(int id, int th) { - wiiuse.setAccelThreshold(id, th); - } - - /** - * Set alpha smoothing for the given id. - * - * @param id - * id of the wiimote. - * @param th - * threshold. - */ - protected void setAlphaSmoothing(int id, float th) { - wiiuse.setAlphaSmoothing(id, th); - } - - /** - * Try to resync with the wiimote by starting a new handshake. - * - * @param id - * id of the wiimote. - */ - protected void reSync(int id) { - wiiuse.reSync(id); - } - - /** - * Set screen aspect ratio to 4/3 for the given id. - * - * @param id - * id of the wiimote. - */ - protected void setScreenAspectRatio43(int id) { - wiiuse.setScreenRatio43(id); - } - - /** - * Set screen aspect ratio to 16/9 for the given id. - * - * @param id - * id of the wiimote. - */ - protected void setScreenAspectRatio169(int id) { - wiiuse.setScreenRatio169(id); - } - - /** - * Set the sensor bar to be above the screen. - * - * @param id - * id of the wiimote. - */ - protected void setSensorBarAboveScreen(int id) { - wiiuse.setSensorBarAboveScreen(id); - } - - /** - * Set the sensor bar to be below the screen. - * - * @param id - * id of the wiimote. - */ - protected void setSensorBarBelowScreen(int id) { - wiiuse.setSensorBarBelowScreen(id); - } - - /** - * Set virtual 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 - * id of the wiimote. - * @param x - * x resolution. - * @param y - * y resolution. - */ - protected void setVirtualResolution(int id, int x, int y) { - wiiuse.setVirtualScreenResolution(id, x, y); - } - - /** - * Get Status for the wiimote for the given id. - * - * @param id - * id of the wiimote. - */ - protected void getStatus(int id) { - wiiuse.getStatus(id); - } - - /** - * Set the normal and expansion handshake timeouts. - * - * @param id - * the id of the wiimote concerned. - * @param normalTimeout - * The timeout in milliseconds for a normal read. - * @param expansionTimeout - * The timeout in millisecondsd to wait for an expansion - * handshake. - */ - protected void setTimeout(int id, short normalTimeout, - short expansionTimeout) { - wiiuse.setTimeout(id, normalTimeout, expansionTimeout); - } - - /** - * Set the IR sensitivity. - * - * @param id - * the id of the wiimote concerned. - * @param level - * 1-5, same as Wii system sensitivity setting. If the level is < - * 1, then level will be set to 1. If the level is > 5, then - * level will be set to 5. - */ - protected void setIrSensitivity(int id, int level) { - wiiuse.setIrSensitivity(id, level); - } - - /** - * Set the nunchuk orientation threshold for the given id. (minimum angle - * between two events) - * - * @param id - * id of the wiimote. - * @param th - * threshold in degrees. - */ - protected void setNunchukOrientationThreshold(int id, float th) { - wiiuse.setNunchukOrientationThreshold(id, th); - } - - /** - * Set the nunchuk acceleration threshold for the given id. (minimum angle - * between two events) - * - * @param id - * id of the wiimote. - * @param th - * threshold. - */ - protected void setNunchukAccelerationThreshold(int id, int th) { - wiiuse.setNunchukAccelerationThreshold(id, th); - } - - /** - * Force the bluetooth stack type.(useful only for windows) - * - * @param type - * must be WIIUSE_STACK_UNKNOWN or WIIUSE_STACK_MS or - * WIIUSE_STACK_BLUESOLEIL. - */ - private void setBlueToothstackType(int type) { - wiiuse.windowsSetBluetoothStack(type); - } - - @Override - public void run() { - - while (!leave) { - try { - semaphore.acquire(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - if (connected > 0) { - running.set(true); - - EventsGatherer gather = new EventsGatherer(connected); - - // Start polling and tell the observers when there are Wiimote - // events - while (running.get() && connected > 0) { - - /* Polling */ - wiiuse.specialPoll(gather); - - /* deal with events gathered in Wiiuse API */ - for (WiiUseApiEvent evt : gather.getEvents()) { - if (evt.getWiimoteId() != -1) {// event filled - // there is an event notify observers - notifyWiiUseApiListener(evt); - if (evt.getEventType() == WiiUseApiEvent.DISCONNECTION_EVENT) { - // check if it was a disconnection - // in this case disconnect the wiimote - closeConnection(evt.getWiimoteId()); - } - } else { - System.out - .println("There is an event with id == -1 ??? there is a problem !!! : " - + evt); - } - } - gather.clearEvents(); - } - }/* else { - if (connected <= 0) { - System.out.println("No wiimotes connected !"); - } - }*/ - }// end while true - } - - /** - * Add WiiUseApiListener to the listeners list. - * - * @param listener - * a WiiUseApiListener - */ - protected void addWiiUseApiListener(WiiUseApiListener listener) { - listeners.add(WiiUseApiListener.class, listener); - } - - /** - * Remove WiiUseApiListener from the listeners list. - * - * @param listener - * a WiiUseApiListener - */ - protected void removeWiiUseApiListener(WiiUseApiListener listener) { - listeners.remove(WiiUseApiListener.class, listener); - } - - /** - * Get the list of WiiUseApiListeners. - * - * @return the list of WiiUseApiListeners. - */ - protected WiiUseApiListener[] getWiiUseApiListeners() { - return listeners.getListeners(WiiUseApiListener.class); - } - - /** - * Notify WiiUseApiListeners that an event occured. - * - * @param evt - * GenericEvent occured - */ - private void notifyWiiUseApiListener(WiiUseApiEvent evt) { - for (WiiUseApiListener listener : getWiiUseApiListeners()) { - listener.onWiiUseApiEvent(evt); - } - } - - /** - * Called by the garbage collector at the end. - */ - protected void finalize() throws Throwable { - shutdown(); - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej; + +import java.util.concurrent.Semaphore; +import java.util.concurrent.atomic.AtomicBoolean; + +import javax.swing.event.EventListenerList; + +import wiiusej.wiiusejevents.utils.EventsGatherer; +import wiiusej.wiiusejevents.utils.WiiUseApiListener; +import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; + +/** + * Class that manages the use of Wiiuse API. + * + * @author guiguito + */ +public class WiiUseApiManager extends Thread { + + private static WiiUseApiManager instance = new WiiUseApiManager(); + + private final EventListenerList listeners = new EventListenerList(); + + private Semaphore semaphore = new Semaphore(0); + + private Wiimote[] wiimotes; + + private WiiUseApi wiiuse = WiiUseApi.getInstance(); + + private int connected = -1; + + private AtomicBoolean running = new AtomicBoolean(false); + + private boolean leave = false; + + public static int WIIUSE_STACK_UNKNOWN = 0; + public static int WIIUSE_STACK_MS = 1; + public static int WIIUSE_STACK_BLUESOLEIL = 2; + + public static WiiUseApiManager getInstance() { + return instance; + } + + /** + * Get wiimotes. Load library if necessary. Connect to wiimotes if + * necessary. Start polling if necessary. Return an array with the connected + * wiimotes. + * + * @param nb + * try to connect nb wiimotes. + * @param rumble + * make the connected wiimotes rumble. + * + * @return an array with connected wiimotes or NULL. + */ + public static Wiimote[] getWiimotes(int nb, boolean rumble) { + return getWiimotesPrivate(nb, rumble, false, WIIUSE_STACK_UNKNOWN); + } + + /** + * Get wiimotes. Load library if necessary. Connect to wiimotes if + * necessary. Start polling if necessary. Return an array with the connected + * wiimotes. + * + * @param nb + * try to connect nb wiimotes. + * @param rumble + * make the connected wiimotes rumble.* + * @param stackType + * the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or + * WiiUseApiManager.WIIUSE_STACK_MS or + * WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL + * + * @return an array with connected wiimotes or NULL. + */ + public static Wiimote[] getWiimotes(int nb, boolean rumble, int stackType) { + return getWiimotesPrivate(nb, rumble, true, stackType); + } + + /** + * Get wiimotes. Load library if necessary. Connect to wiimotes if + * necessary. Start polling if necessary. Return an array with the connected + * wiimotes. + * + * @param nb + * try to connect nb wiimotes. + * @param rumble + * make the connected wiimotes rumble.* + * @param forceStackType + * true if we want to force the stack type. + * @param stackType + * the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or + * WiiUseApiManager.WIIUSE_STACK_MS or + * WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL + * + * @return an array with connected wiimotes or NULL. + */ + private synchronized static Wiimote[] getWiimotesPrivate(int nb, + boolean rumble, boolean forceStackType, int stackType) { + WiiUseApiManager manager = getInstance(); + + if (manager.leave) + return null;// wiiusej definitively stopped + + if (manager.connected <= 0 && !manager.running.get()) { + // connect wiimotes. + int nbWiimotes = manager.connectWiimotes(nb, rumble, + forceStackType, stackType); + manager.wiimotes = new Wiimote[nbWiimotes]; + for (int i = 0; i < nbWiimotes; i++) { + Wiimote wim = new Wiimote(WiiUseApi.getInstance().getUnId(i), + manager); + manager.wiimotes[i] = wim; + manager.addWiiUseApiListener(wim); + } + // Set leds on wiimote + for (Wiimote wiimote : manager.wiimotes) { + int id = wiimote.getId(); + if (id % 4 == 0) { + wiimote.setLeds(true, true, true, true); + } else if (id % 4 == 1) { + wiimote.setLeds(true, false, false, false); + } else if (id % 4 == 2) { + wiimote.setLeds(true, true, false, false); + } else if (id % 4 == 3) { + wiimote.setLeds(true, true, true, false); + } + } + // make the connected wiimotes rumble + if (rumble) { + for (Wiimote wiimote : manager.wiimotes) { + wiimote.activateRumble(); + } + try { + sleep(500); + } catch (InterruptedException e) { + } + for (Wiimote wiimote : manager.wiimotes) { + wiimote.deactivateRumble(); + } + } + } + + if (manager.connected == 0) {// no wiimote connected + // return empty array + return new Wiimote[0]; + } + + if (!manager.isAlive())// start wiiuseJ polling + manager.start(); + + manager.semaphore.release(1); + + return manager.wiimotes; + } + + /** + * Connect wiimote and get the number of wiimotes connected. Supposed to be + * used once. + * + * @param nb + * try to connect nb wiimotes + * @param rumble + * make the connected wiimotes rumble + * @param forceStackType + * true if we want to force the stack type. + * @param stackType + * the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or + * WiiUseApiManager.WIIUSE_STACK_MS or + * WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL + * @return 0 if nothing connected or the number of wiimotes connected. + */ + private int connectWiimotes(int nb, boolean rumble, boolean forceStackType, + int stackType) { + if (connected <= 0) { + int nbWiimotesFound; + wiiuse.init(nb); + // force bluetooth stack type ? + if (forceStackType) + setBlueToothstackType(stackType); + nbWiimotesFound = wiiuse.find(nb, 3); + connected = wiiuse.connect(nbWiimotesFound); + return connected; + } else {// library not loaded, no wiimotes connected + return 0; + } + } + + /** + * Ask the thread to close a connection. + * + * @param id + * id of the wiimote to disconnect. + */ + protected void closeConnection(int id) { + int index = 0; + boolean found = false; + while (index < wiimotes.length && !found) { + if (wiimotes[index]!=null && wiimotes[index].getId() == id) {// we have a wiimote with this + // id + // remove the wiimote + removeWiiUseApiListener(wiimotes[index]); + wiimotes[index] = null; + connected--; + if (connected == 0) {// stop this thread if there is + // no more wiimotes connected. + // stop thread + running.set(false); + } + /* Close connection in wiiuse */ + wiiuse.closeConnection(index); + } + index++; + } + } + + /** + * Get the number of wiimotes connected. + * + * @return the number of wiimotes connected. + */ + public static int getNbConnectedWiimotes() { + return getInstance().connected; + } + + /** + * Stop thread and shutdown wiiuse Api. + */ + public static void shutdown() { + WiiUseApiManager manager = getInstance(); + int pastConnected = manager.connected; + if (manager.connected > 0) { + for (Wiimote wim : manager.wiimotes) { + if (wim != null) + wim.disconnect(); + } + } + manager.running.set(false); + if (pastConnected > 0) { + manager.wiiuse.cleanUp(); + } + } + + /** + * Stop wiiuseJ definitively for this program. It finishes Wiiusej thread + * and shutdown wiiuse API. + */ + public static void definitiveShutdown() { + getInstance().leave = true; + shutdown(); + } + + /** + * Activate the rumble for the wiimote with the given id. + * + * @param id + * id of the wiimote. + */ + protected void activateRumble(int id) { + wiiuse.activateRumble(id); + } + + /** + * Deactivate the rumble for the wiimote with the given id. + * + * @param id + * id of the wiimote. + */ + protected void deactivateRumble(int id) { + wiiuse.deactivateRumble(id); + } + + /** + * Activate IR Tracking for the wiimote with the given id. + * + * @param id + * id of the wiimote. + */ + protected void activateIRTRacking(int id) { + wiiuse.activateIRTracking(id); + } + + /** + * Deactivate IR Tracking for the wiimote with the given id. + * + * @param id + * id of the wiimote. + */ + protected void deactivateIRTRacking(int id) { + wiiuse.deactivateIRTracking(id); + } + + /** + * Activate motion sensing for the wiimote with the given id. + * + * @param id + * id of the wiimote. + */ + protected void activateMotionSensing(int id) { + wiiuse.activateMotionSensing(id); + } + + /** + * Deactivate motion sensing for the wiimoter with the given id. + * + * @param id + * id of the wiimote. + */ + protected void deactivateMotionSensing(int id) { + wiiuse.deactivateMotionSensing(id); + } + + /** + * Activate smoothing the wiimotes with the given id. + * + * @param id + * id of the wiimote. + */ + protected void activateSmoothing(int id) { + wiiuse.activateSmoothing(id); + } + + /** + * Deactivate smoothing the wiimotes with the given id. + * + * @param id + * id of the wiimote. + */ + protected void deactivateSmoothing(int id) { + wiiuse.deactivateSmoothing(id); + } + + /** + * Activate continuous for the wiimotes with the given id. + * + * @param id + * id of the wiimote. + */ + protected void activateContinuous(int id) { + wiiuse.activateContinuous(id); + } + + /** + * Deactivate continuous for the wiimotes with the given id. + * + * @param id + * id of the wiimote. + */ + protected void deactivateContinuous(int id) { + wiiuse.deactivateContinuous(id); + } + + /** + * Set leds for the wiimotes with the given id. + * + * @param id + * id of the wiimote + * @param l1 + * status of led1. True : ON, False : OFF. + * @param l2 + * status of led2. True : ON, False : OFF. + * @param l3 + * status of led3. True : ON, False : OFF. + * @param l4 + * status of led4. True : ON, False : OFF. + */ + protected void setLeds(int id, boolean l1, boolean l2, boolean l3, + boolean l4) { + wiiuse.setLeds(id, l1, l2, l3, l4); + } + + /** + * Set the orientation threshold for the given id. (minimum angle between + * two events) + * + * @param id + * id of the wiimote. + * @param th + * threshold in degrees. + */ + protected void setOrientationThreshold(int id, float th) { + wiiuse.setOrientThreshold(id, th); + } + + /** + * Set the acceleration threshold for the given id. (minimum angle between + * two events) + * + * @param id + * id of the wiimote. + * @param th + * threshold. + */ + protected void setAccelerationThreshold(int id, int th) { + wiiuse.setAccelThreshold(id, th); + } + + /** + * Set alpha smoothing for the given id. + * + * @param id + * id of the wiimote. + * @param th + * threshold. + */ + protected void setAlphaSmoothing(int id, float th) { + wiiuse.setAlphaSmoothing(id, th); + } + + /** + * Try to resync with the wiimote by starting a new handshake. + * + * @param id + * id of the wiimote. + */ + protected void reSync(int id) { + wiiuse.reSync(id); + } + + /** + * Set screen aspect ratio to 4/3 for the given id. + * + * @param id + * id of the wiimote. + */ + protected void setScreenAspectRatio43(int id) { + wiiuse.setScreenRatio43(id); + } + + /** + * Set screen aspect ratio to 16/9 for the given id. + * + * @param id + * id of the wiimote. + */ + protected void setScreenAspectRatio169(int id) { + wiiuse.setScreenRatio169(id); + } + + /** + * Set the sensor bar to be above the screen. + * + * @param id + * id of the wiimote. + */ + protected void setSensorBarAboveScreen(int id) { + wiiuse.setSensorBarAboveScreen(id); + } + + /** + * Set the sensor bar to be below the screen. + * + * @param id + * id of the wiimote. + */ + protected void setSensorBarBelowScreen(int id) { + wiiuse.setSensorBarBelowScreen(id); + } + + /** + * Set virtual 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 + * id of the wiimote. + * @param x + * x resolution. + * @param y + * y resolution. + */ + protected void setVirtualResolution(int id, int x, int y) { + wiiuse.setVirtualScreenResolution(id, x, y); + } + + /** + * Get Status for the wiimote for the given id. + * + * @param id + * id of the wiimote. + */ + protected void getStatus(int id) { + wiiuse.getStatus(id); + } + + /** + * Set the normal and expansion handshake timeouts. + * + * @param id + * the id of the wiimote concerned. + * @param normalTimeout + * The timeout in milliseconds for a normal read. + * @param expansionTimeout + * The timeout in millisecondsd to wait for an expansion + * handshake. + */ + protected void setTimeout(int id, short normalTimeout, + short expansionTimeout) { + wiiuse.setTimeout(id, normalTimeout, expansionTimeout); + } + + /** + * Set the IR sensitivity. + * + * @param id + * the id of the wiimote concerned. + * @param level + * 1-5, same as Wii system sensitivity setting. If the level is < + * 1, then level will be set to 1. If the level is > 5, then + * level will be set to 5. + */ + protected void setIrSensitivity(int id, int level) { + wiiuse.setIrSensitivity(id, level); + } + + /** + * Set the nunchuk orientation threshold for the given id. (minimum angle + * between two events) + * + * @param id + * id of the wiimote. + * @param th + * threshold in degrees. + */ + protected void setNunchukOrientationThreshold(int id, float th) { + wiiuse.setNunchukOrientationThreshold(id, th); + } + + /** + * Set the nunchuk acceleration threshold for the given id. (minimum angle + * between two events) + * + * @param id + * id of the wiimote. + * @param th + * threshold. + */ + protected void setNunchukAccelerationThreshold(int id, int th) { + wiiuse.setNunchukAccelerationThreshold(id, th); + } + + /** + * Force the bluetooth stack type.(useful only for windows) + * + * @param type + * must be WIIUSE_STACK_UNKNOWN or WIIUSE_STACK_MS or + * WIIUSE_STACK_BLUESOLEIL. + */ + private void setBlueToothstackType(int type) { + wiiuse.windowsSetBluetoothStack(type); + } + + @Override + public void run() { + + while (!leave) { + try { + semaphore.acquire(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + if (connected > 0) { + running.set(true); + + EventsGatherer gather = new EventsGatherer(connected); + + // Start polling and tell the observers when there are Wiimote + // events + while (running.get() && connected > 0) { + + /* Polling */ + wiiuse.specialPoll(gather); + + /* deal with events gathered in Wiiuse API */ + for (WiiUseApiEvent evt : gather.getEvents()) { + if (evt.getWiimoteId() != -1) {// event filled + // there is an event notify observers + notifyWiiUseApiListener(evt); + if (evt.getEventType() == WiiUseApiEvent.DISCONNECTION_EVENT) { + // check if it was a disconnection + // in this case disconnect the wiimote + closeConnection(evt.getWiimoteId()); + } + } else { + System.out + .println("There is an event with id == -1 ??? there is a problem !!! : " + + evt); + } + } + gather.clearEvents(); + } + }/* else { + if (connected <= 0) { + System.out.println("No wiimotes connected !"); + } + }*/ + }// end while true + } + + /** + * Add WiiUseApiListener to the listeners list. + * + * @param listener + * a WiiUseApiListener + */ + protected void addWiiUseApiListener(WiiUseApiListener listener) { + listeners.add(WiiUseApiListener.class, listener); + } + + /** + * Remove WiiUseApiListener from the listeners list. + * + * @param listener + * a WiiUseApiListener + */ + protected void removeWiiUseApiListener(WiiUseApiListener listener) { + listeners.remove(WiiUseApiListener.class, listener); + } + + /** + * Get the list of WiiUseApiListeners. + * + * @return the list of WiiUseApiListeners. + */ + protected WiiUseApiListener[] getWiiUseApiListeners() { + return listeners.getListeners(WiiUseApiListener.class); + } + + /** + * Notify WiiUseApiListeners that an event occured. + * + * @param evt + * GenericEvent occured + */ + private void notifyWiiUseApiListener(WiiUseApiEvent evt) { + for (WiiUseApiListener listener : getWiiUseApiListeners()) { + listener.onWiiUseApiEvent(evt); + } + } + + /** + * Called by the garbage collector at the end. + */ + protected void finalize() throws Throwable { + shutdown(); + } + +} diff --git a/WiiUseJ/src/wiiusej/Wiimote.java b/src/main/java/wiiusej/Wiimote.java similarity index 96% rename from WiiUseJ/src/wiiusej/Wiimote.java rename to src/main/java/wiiusej/Wiimote.java index aabb0f0..b7bca21 100644 --- a/WiiUseJ/src/wiiusej/Wiimote.java +++ b/src/main/java/wiiusej/Wiimote.java @@ -1,495 +1,495 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej; - -import javax.swing.event.EventListenerList; - -import wiiusej.wiiusejevents.utils.WiiUseApiListener; -import wiiusej.wiiusejevents.utils.WiimoteListener; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; -import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; -import wiiusej.wiiusejevents.wiiuseapievents.WiimoteEvent; - -/** - * Class that represents a wiimote. You can register as an observer of this - * wiimote to listen events from it. You manage it. - * - * @author guiguito - */ -public class Wiimote implements WiiUseApiListener { - - private int id = -1;// wiimote id - - private EventListenerList listeners = new EventListenerList(); - - private WiiUseApiManager manager; - - /** - * Constructor. - * - * @param idd - * id of the wiimote - * @param manager - * manager wo built it. - */ - public Wiimote(int idd, WiiUseApiManager manager) { - id = idd; - this.manager = manager; - } - - /** - * Get the unique id of the wiimote. - * - * @return the id - */ - public int getId() { - return id; - } - - /** - * Disconnect this wiimote. - */ - public void disconnect() { - deactivateIRTRacking(); - deactivateMotionSensing(); - deactivateRumble(); - manager.closeConnection(id); - } - - /** - * Activate the rumble. - */ - public void activateRumble() { - manager.activateRumble(id); - } - - /** - * Deactivate the rumble. - */ - public void deactivateRumble() { - manager.deactivateRumble(id); - } - - /** - * Activate IR Tracking. - */ - public void activateIRTRacking() { - manager.activateIRTRacking(id); - } - - /** - * Deactivate IR Tracking. - */ - public void deactivateIRTRacking() { - manager.deactivateIRTRacking(id); - } - - /** - * Activate motion sensing. - */ - public void activateMotionSensing() { - manager.activateMotionSensing(id); - } - - /** - * Deactivate motion sensing. - */ - public void deactivateMotionSensing() { - manager.deactivateMotionSensing(id); - } - - /** - * Activate smoothing. - */ - public void activateSmoothing() { - manager.activateSmoothing(id); - } - - /** - * Deactivate smoothing. - */ - public void deactivateSmoothing() { - manager.deactivateSmoothing(id); - } - - /** - * Activate continuous. - */ - public void activateContinuous() { - manager.activateContinuous(id); - } - - /** - * Deactivate continuous. - */ - public void deactivateContinuous() { - manager.deactivateContinuous(id); - - } - - /** - * Set leds status. - * - * @param l1 - * status of led1. True : ON, False : OFF - * @param l2 - * status of led2. True : ON, False : OFF - * @param l3 - * status of led3. True : ON, False : OFF - * @param l4 - * status of led4. True : ON, False : OFF - */ - public void setLeds(boolean l1, boolean l2, boolean l3, boolean l4) { - manager.setLeds(id, l1, l2, l3, l4); - } - - /** - * Set the orientation threshold (minimum angle between two degrees with - * accelerometer). - * - * @param th - * threshold in degrees - */ - public void setOrientationThreshold(float th) { - manager.setOrientationThreshold(id, th); - } - - /** - * Set the acceleration threshold(minimum angle between two degrees with - * accelerometer). - * - * @param th - * threshold - */ - public void setAccelerationThreshold(int th) { - manager.setAccelerationThreshold(id, th); - } - - /** - * Set the alpha smoothing value. - * - * @param th - * threshold - */ - public void setAlphaSmoothingValue(float th) { - manager.setAlphaSmoothing(id, th); - } - - /** - * Set the screen aspect ratio to be considered as 4/3. - */ - public void setScreenAspectRatio43() { - manager.setScreenAspectRatio43(id); - } - - /** - * Set the screen aspect ratio to be considered as 16/9. - */ - public void setScreenAspectRatio169() { - manager.setScreenAspectRatio169(id); - } - - /** - * Set the sensor bar to be considered above the screen. - */ - public void setSensorBarAboveScreen() { - manager.setSensorBarAboveScreen(id); - } - - /** - * Set the sensor bar to be considered below the screen. - */ - public void setSensorBarBelowScreen() { - manager.setSensorBarBelowScreen(id); - } - - /** - * Set the screen resolution of the you are pointing at with your wiimote. - * - * @param x - * x resolution. - * @param y - * y resolution. - */ - public void setVirtualResolution(int x, int y) { - manager.setVirtualResolution(id, x, y); - } - - /** - * Set the nunchuk orientation threshold for the given id. (minimum angle - * between two events) - * - * @param th - * threshold in degrees. - */ - public void setNunchukOrientationThreshold(float th) { - manager.setNunchukOrientationThreshold(id, th); - } - - /** - * Set the nunchuk acceleration threshold for the given id. (minimum angle - * between two events) - * - * @param th - * threshold. - */ - public void setNunchukAccelerationThreshold(int th) { - manager.setNunchukAccelerationThreshold(id, th); - } - - /** - * Try to resync the wiimote by starting a new handshake. - */ - public void reSync() { - manager.reSync(id); - } - - /** - * Ask for the status of the wiimote. The result will be received in a - * status event object. Implements onStatusEvent on wiimote listener to get - * it. - */ - public void getStatus() { - manager.getStatus(id); - } - - /** - * Set the normal and expansion handshake timeouts for this wiimote. Normal - * time out is for classic polling. The expansion timeout is used when an - * expansion is detected until the expansion successfully handshakes. - * - * @param normalTimeout - * The timeout in milliseconds for a normal read. - * @param expansionTimeout - * The timeout in millisecondsd to wait for an expansion - * handshake. - */ - public void setTimeout(short normalTimeout, short expansionTimeout) { - manager.setTimeout(id, normalTimeout, expansionTimeout); - } - - /** - * Set the IR sensitivity. - * - * @param level - * 1-5, same as Wii system sensitivity setting. If the level is < - * 1, then level will be set to 1. If the level is > 5, then - * level will be set to 5. - */ - public void setIrSensitivity(int level) { - manager.setIrSensitivity(id, level); - } - - /** - * Method called when a WiiUseApiEvent occurs. - * - * @param e - * the WiiUseApiEvent. - */ - public void onWiiUseApiEvent(WiiUseApiEvent e) { - if (e.getWiimoteId() == id) { - if (e.getEventType() == WiiUseApiEvent.GENERIC_EVENT) { - notifyWiiMoteEventListeners((WiimoteEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.STATUS_EVENT) { - notifyStatusEventListeners((StatusEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.DISCONNECTION_EVENT) { - notifyDisconnectionEventListeners((DisconnectionEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_NUNCHUK_INSERTED) { - notifyNunchukInsertedEventListeners((NunchukInsertedEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_NUNCHUK_REMOVED) { - notifyNunchukRemovedEventListeners((NunchukRemovedEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_INSERTED) { - notifyGuitarHeroInsertedEventListeners((GuitarHeroInsertedEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_REMOVED) { - notifyGuitarHeroRemovedEventListeners((GuitarHeroRemovedEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_INSERTED) { - notifyClassicControllerInsertedEventListeners((ClassicControllerInsertedEvent) e); - } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_REMOVED) { - notifyClassicControllerRemovedEventListeners((ClassicControllerRemovedEvent) e); - } - /* - * events not managed yet || e.getEventType() == WIIUSE_READ_DATA - * WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_INSERTED || e.getEventType() == - * WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_REMOVED || e.getEventType() == - * WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_INSERTED || - * e.getEventType() == - * WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_REMOVED - */ - } - } - - /** - * Add a WiimoteListener to the listeners list. - * - * @param listener - * a WiimoteListener - */ - public void addWiiMoteEventListeners(WiimoteListener listener) { - listeners.add(WiimoteListener.class, listener); - } - - /** - * Remove a WiimoteListener from the listeners list. - * - * @param listener - * a WiimoteListener - */ - public void removeWiiMoteEventListeners(WiimoteListener listener) { - listeners.remove(WiimoteListener.class, listener); - } - - /** - * Get the list of WiimoteListener. - * - * @return the list of WiimoteListener. - */ - public WiimoteListener[] getWiiMoteEventListeners() { - return listeners.getListeners(WiimoteListener.class); - } - - /** - * Notify WiimoteListeners that an event occured. Notify in first the - * listeners for Buttons Events. In second the listeners for IR Events. In - * third the listeners for Motion sensing events. - * - * @param evt - * GenericEvent occured - */ - private void notifyWiiMoteEventListeners(WiimoteEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onButtonsEvent(evt.getButtonsEvent()); - if (evt.isThereIrEvent()) { - listener.onIrEvent(evt.getIREvent()); - } - if (evt.isThereMotionSensingEvent()) { - listener.onMotionSensingEvent(evt.getMotionSensingEvent()); - } - if (evt.isThereExpansionEvent()) { - listener.onExpansionEvent(evt.getExpansionEvent()); - } - } - } - - /** - * Notify WiimoteListener that a status event occured. - * - * @param evt - * status event occured - */ - private void notifyStatusEventListeners(StatusEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onStatusEvent(evt); - } - } - - /** - * Notify WiimoteListener that a disconnection event occured. - * - * @param evt - * disconnection event occured - */ - private void notifyDisconnectionEventListeners(DisconnectionEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onDisconnectionEvent(evt); - } - } - - /** - * Notify WiimoteListener that a NunchukInserted Event occured. - * - * @param evt - * NunchukInserted Event occured - */ - private void notifyNunchukInsertedEventListeners(NunchukInsertedEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onNunchukInsertedEvent(evt); - } - } - - /** - * Notify WiimoteListener that a NunchukRemoved Event occured. - * - * @param evt - * NunchukRemoved Event occured - */ - private void notifyNunchukRemovedEventListeners(NunchukRemovedEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onNunchukRemovedEvent(evt); - } - } - - /** - * Notify WiimoteListener that a GuitarHeroInserted Event occured. - * - * @param evt - * GuitarHeroInserted Event occured - */ - private void notifyGuitarHeroInsertedEventListeners(GuitarHeroInsertedEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onGuitarHeroInsertedEvent(evt); - } - } - - /** - * Notify WiimoteListener that a GuitarHeroRemoved Event occured. - * - * @param evt - * GuitarHeroRemoved Event occured - */ - private void notifyGuitarHeroRemovedEventListeners(GuitarHeroRemovedEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onGuitarHeroRemovedEvent(evt); - } - } - - /** - * Notify WiimoteListener that a ClassicControllerInserted Event occured. - * - * @param evt - * ClassicControllerInserted Event occured - */ - private void notifyClassicControllerInsertedEventListeners(ClassicControllerInsertedEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onClassicControllerInsertedEvent(evt); - } - } - - /** - * Notify WiimoteListener that a ClassicControllerRemoved Event occured. - * - * @param evt - * ClassicControllerRemoved Event occured - */ - private void notifyClassicControllerRemovedEventListeners(ClassicControllerRemovedEvent evt) { - for (WiimoteListener listener : getWiiMoteEventListeners()) { - listener.onClassicControllerRemovedEvent(evt); - } - } - - @Override - public String toString() { - return "Wiimote with ID : " + id; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej; + +import javax.swing.event.EventListenerList; + +import wiiusej.wiiusejevents.utils.WiiUseApiListener; +import wiiusej.wiiusejevents.utils.WiimoteListener; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; +import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; +import wiiusej.wiiusejevents.wiiuseapievents.WiimoteEvent; + +/** + * Class that represents a wiimote. You can register as an observer of this + * wiimote to listen events from it. You manage it. + * + * @author guiguito + */ +public class Wiimote implements WiiUseApiListener { + + private int id = -1;// wiimote id + + private EventListenerList listeners = new EventListenerList(); + + private WiiUseApiManager manager; + + /** + * Constructor. + * + * @param idd + * id of the wiimote + * @param manager + * manager wo built it. + */ + public Wiimote(int idd, WiiUseApiManager manager) { + id = idd; + this.manager = manager; + } + + /** + * Get the unique id of the wiimote. + * + * @return the id + */ + public int getId() { + return id; + } + + /** + * Disconnect this wiimote. + */ + public void disconnect() { + deactivateIRTRacking(); + deactivateMotionSensing(); + deactivateRumble(); + manager.closeConnection(id); + } + + /** + * Activate the rumble. + */ + public void activateRumble() { + manager.activateRumble(id); + } + + /** + * Deactivate the rumble. + */ + public void deactivateRumble() { + manager.deactivateRumble(id); + } + + /** + * Activate IR Tracking. + */ + public void activateIRTRacking() { + manager.activateIRTRacking(id); + } + + /** + * Deactivate IR Tracking. + */ + public void deactivateIRTRacking() { + manager.deactivateIRTRacking(id); + } + + /** + * Activate motion sensing. + */ + public void activateMotionSensing() { + manager.activateMotionSensing(id); + } + + /** + * Deactivate motion sensing. + */ + public void deactivateMotionSensing() { + manager.deactivateMotionSensing(id); + } + + /** + * Activate smoothing. + */ + public void activateSmoothing() { + manager.activateSmoothing(id); + } + + /** + * Deactivate smoothing. + */ + public void deactivateSmoothing() { + manager.deactivateSmoothing(id); + } + + /** + * Activate continuous. + */ + public void activateContinuous() { + manager.activateContinuous(id); + } + + /** + * Deactivate continuous. + */ + public void deactivateContinuous() { + manager.deactivateContinuous(id); + + } + + /** + * Set leds status. + * + * @param l1 + * status of led1. True : ON, False : OFF + * @param l2 + * status of led2. True : ON, False : OFF + * @param l3 + * status of led3. True : ON, False : OFF + * @param l4 + * status of led4. True : ON, False : OFF + */ + public void setLeds(boolean l1, boolean l2, boolean l3, boolean l4) { + manager.setLeds(id, l1, l2, l3, l4); + } + + /** + * Set the orientation threshold (minimum angle between two degrees with + * accelerometer). + * + * @param th + * threshold in degrees + */ + public void setOrientationThreshold(float th) { + manager.setOrientationThreshold(id, th); + } + + /** + * Set the acceleration threshold(minimum angle between two degrees with + * accelerometer). + * + * @param th + * threshold + */ + public void setAccelerationThreshold(int th) { + manager.setAccelerationThreshold(id, th); + } + + /** + * Set the alpha smoothing value. + * + * @param th + * threshold + */ + public void setAlphaSmoothingValue(float th) { + manager.setAlphaSmoothing(id, th); + } + + /** + * Set the screen aspect ratio to be considered as 4/3. + */ + public void setScreenAspectRatio43() { + manager.setScreenAspectRatio43(id); + } + + /** + * Set the screen aspect ratio to be considered as 16/9. + */ + public void setScreenAspectRatio169() { + manager.setScreenAspectRatio169(id); + } + + /** + * Set the sensor bar to be considered above the screen. + */ + public void setSensorBarAboveScreen() { + manager.setSensorBarAboveScreen(id); + } + + /** + * Set the sensor bar to be considered below the screen. + */ + public void setSensorBarBelowScreen() { + manager.setSensorBarBelowScreen(id); + } + + /** + * Set the screen resolution of the you are pointing at with your wiimote. + * + * @param x + * x resolution. + * @param y + * y resolution. + */ + public void setVirtualResolution(int x, int y) { + manager.setVirtualResolution(id, x, y); + } + + /** + * Set the nunchuk orientation threshold for the given id. (minimum angle + * between two events) + * + * @param th + * threshold in degrees. + */ + public void setNunchukOrientationThreshold(float th) { + manager.setNunchukOrientationThreshold(id, th); + } + + /** + * Set the nunchuk acceleration threshold for the given id. (minimum angle + * between two events) + * + * @param th + * threshold. + */ + public void setNunchukAccelerationThreshold(int th) { + manager.setNunchukAccelerationThreshold(id, th); + } + + /** + * Try to resync the wiimote by starting a new handshake. + */ + public void reSync() { + manager.reSync(id); + } + + /** + * Ask for the status of the wiimote. The result will be received in a + * status event object. Implements onStatusEvent on wiimote listener to get + * it. + */ + public void getStatus() { + manager.getStatus(id); + } + + /** + * Set the normal and expansion handshake timeouts for this wiimote. Normal + * time out is for classic polling. The expansion timeout is used when an + * expansion is detected until the expansion successfully handshakes. + * + * @param normalTimeout + * The timeout in milliseconds for a normal read. + * @param expansionTimeout + * The timeout in millisecondsd to wait for an expansion + * handshake. + */ + public void setTimeout(short normalTimeout, short expansionTimeout) { + manager.setTimeout(id, normalTimeout, expansionTimeout); + } + + /** + * Set the IR sensitivity. + * + * @param level + * 1-5, same as Wii system sensitivity setting. If the level is < + * 1, then level will be set to 1. If the level is > 5, then + * level will be set to 5. + */ + public void setIrSensitivity(int level) { + manager.setIrSensitivity(id, level); + } + + /** + * Method called when a WiiUseApiEvent occurs. + * + * @param e + * the WiiUseApiEvent. + */ + public void onWiiUseApiEvent(WiiUseApiEvent e) { + if (e.getWiimoteId() == id) { + if (e.getEventType() == WiiUseApiEvent.GENERIC_EVENT) { + notifyWiiMoteEventListeners((WiimoteEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.STATUS_EVENT) { + notifyStatusEventListeners((StatusEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.DISCONNECTION_EVENT) { + notifyDisconnectionEventListeners((DisconnectionEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_NUNCHUK_INSERTED) { + notifyNunchukInsertedEventListeners((NunchukInsertedEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_NUNCHUK_REMOVED) { + notifyNunchukRemovedEventListeners((NunchukRemovedEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_INSERTED) { + notifyGuitarHeroInsertedEventListeners((GuitarHeroInsertedEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_REMOVED) { + notifyGuitarHeroRemovedEventListeners((GuitarHeroRemovedEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_INSERTED) { + notifyClassicControllerInsertedEventListeners((ClassicControllerInsertedEvent) e); + } else if (e.getEventType() == WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_REMOVED) { + notifyClassicControllerRemovedEventListeners((ClassicControllerRemovedEvent) e); + } + /* + * events not managed yet || e.getEventType() == WIIUSE_READ_DATA + * WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_INSERTED || e.getEventType() == + * WiiUseApiEvent.WIIUSE_CLASSIC_CTRL_REMOVED || e.getEventType() == + * WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_INSERTED || + * e.getEventType() == + * WiiUseApiEvent.WIIUSE_GUITAR_HERO_3_CTRL_REMOVED + */ + } + } + + /** + * Add a WiimoteListener to the listeners list. + * + * @param listener + * a WiimoteListener + */ + public void addWiiMoteEventListeners(WiimoteListener listener) { + listeners.add(WiimoteListener.class, listener); + } + + /** + * Remove a WiimoteListener from the listeners list. + * + * @param listener + * a WiimoteListener + */ + public void removeWiiMoteEventListeners(WiimoteListener listener) { + listeners.remove(WiimoteListener.class, listener); + } + + /** + * Get the list of WiimoteListener. + * + * @return the list of WiimoteListener. + */ + public WiimoteListener[] getWiiMoteEventListeners() { + return listeners.getListeners(WiimoteListener.class); + } + + /** + * Notify WiimoteListeners that an event occured. Notify in first the + * listeners for Buttons Events. In second the listeners for IR Events. In + * third the listeners for Motion sensing events. + * + * @param evt + * GenericEvent occured + */ + private void notifyWiiMoteEventListeners(WiimoteEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onButtonsEvent(evt.getButtonsEvent()); + if (evt.isThereIrEvent()) { + listener.onIrEvent(evt.getIREvent()); + } + if (evt.isThereMotionSensingEvent()) { + listener.onMotionSensingEvent(evt.getMotionSensingEvent()); + } + if (evt.isThereExpansionEvent()) { + listener.onExpansionEvent(evt.getExpansionEvent()); + } + } + } + + /** + * Notify WiimoteListener that a status event occured. + * + * @param evt + * status event occured + */ + private void notifyStatusEventListeners(StatusEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onStatusEvent(evt); + } + } + + /** + * Notify WiimoteListener that a disconnection event occured. + * + * @param evt + * disconnection event occured + */ + private void notifyDisconnectionEventListeners(DisconnectionEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onDisconnectionEvent(evt); + } + } + + /** + * Notify WiimoteListener that a NunchukInserted Event occured. + * + * @param evt + * NunchukInserted Event occured + */ + private void notifyNunchukInsertedEventListeners(NunchukInsertedEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onNunchukInsertedEvent(evt); + } + } + + /** + * Notify WiimoteListener that a NunchukRemoved Event occured. + * + * @param evt + * NunchukRemoved Event occured + */ + private void notifyNunchukRemovedEventListeners(NunchukRemovedEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onNunchukRemovedEvent(evt); + } + } + + /** + * Notify WiimoteListener that a GuitarHeroInserted Event occured. + * + * @param evt + * GuitarHeroInserted Event occured + */ + private void notifyGuitarHeroInsertedEventListeners(GuitarHeroInsertedEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onGuitarHeroInsertedEvent(evt); + } + } + + /** + * Notify WiimoteListener that a GuitarHeroRemoved Event occured. + * + * @param evt + * GuitarHeroRemoved Event occured + */ + private void notifyGuitarHeroRemovedEventListeners(GuitarHeroRemovedEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onGuitarHeroRemovedEvent(evt); + } + } + + /** + * Notify WiimoteListener that a ClassicControllerInserted Event occured. + * + * @param evt + * ClassicControllerInserted Event occured + */ + private void notifyClassicControllerInsertedEventListeners(ClassicControllerInsertedEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onClassicControllerInsertedEvent(evt); + } + } + + /** + * Notify WiimoteListener that a ClassicControllerRemoved Event occured. + * + * @param evt + * ClassicControllerRemoved Event occured + */ + private void notifyClassicControllerRemovedEventListeners(ClassicControllerRemovedEvent evt) { + for (WiimoteListener listener : getWiiMoteEventListeners()) { + listener.onClassicControllerRemovedEvent(evt); + } + } + + @Override + public String toString() { + return "Wiimote with ID : " + id; + } + +} diff --git a/WiiUseJ/src/wiiusej/utils/AccelerationExpansionEventPanel.java b/src/main/java/wiiusej/utils/AccelerationExpansionEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/AccelerationExpansionEventPanel.java rename to src/main/java/wiiusej/utils/AccelerationExpansionEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/AccelerationPanel.java b/src/main/java/wiiusej/utils/AccelerationPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/AccelerationPanel.java rename to src/main/java/wiiusej/utils/AccelerationPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/AccelerationWiimoteEventPanel.java b/src/main/java/wiiusej/utils/AccelerationWiimoteEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/AccelerationWiimoteEventPanel.java rename to src/main/java/wiiusej/utils/AccelerationWiimoteEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/ButtonsEventPanel.java b/src/main/java/wiiusej/utils/ButtonsEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/ButtonsEventPanel.java rename to src/main/java/wiiusej/utils/ButtonsEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/ClassicControllerButtonsEventPanel.java b/src/main/java/wiiusej/utils/ClassicControllerButtonsEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/ClassicControllerButtonsEventPanel.java rename to src/main/java/wiiusej/utils/ClassicControllerButtonsEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/GForceExpansionEventPanel.java b/src/main/java/wiiusej/utils/GForceExpansionEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/GForceExpansionEventPanel.java rename to src/main/java/wiiusej/utils/GForceExpansionEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/GForcePanel.java b/src/main/java/wiiusej/utils/GForcePanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/GForcePanel.java rename to src/main/java/wiiusej/utils/GForcePanel.java diff --git a/WiiUseJ/src/wiiusej/utils/GForceWiimoteEventPanel.java b/src/main/java/wiiusej/utils/GForceWiimoteEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/GForceWiimoteEventPanel.java rename to src/main/java/wiiusej/utils/GForceWiimoteEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/GuitarHero3ButtonsEventPanel.java b/src/main/java/wiiusej/utils/GuitarHero3ButtonsEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/GuitarHero3ButtonsEventPanel.java rename to src/main/java/wiiusej/utils/GuitarHero3ButtonsEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/GuitarHeroJoystickEventPanel.java b/src/main/java/wiiusej/utils/GuitarHeroJoystickEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/GuitarHeroJoystickEventPanel.java rename to src/main/java/wiiusej/utils/GuitarHeroJoystickEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/IRPanel.java b/src/main/java/wiiusej/utils/IRPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/IRPanel.java rename to src/main/java/wiiusej/utils/IRPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/JoystickEventPanel.java b/src/main/java/wiiusej/utils/JoystickEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/JoystickEventPanel.java rename to src/main/java/wiiusej/utils/JoystickEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/NunchukJoystickEventPanel.java b/src/main/java/wiiusej/utils/NunchukJoystickEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/NunchukJoystickEventPanel.java rename to src/main/java/wiiusej/utils/NunchukJoystickEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/OrientationExpansionEventPanel.java b/src/main/java/wiiusej/utils/OrientationExpansionEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/OrientationExpansionEventPanel.java rename to src/main/java/wiiusej/utils/OrientationExpansionEventPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/OrientationPanel.java b/src/main/java/wiiusej/utils/OrientationPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/OrientationPanel.java rename to src/main/java/wiiusej/utils/OrientationPanel.java diff --git a/WiiUseJ/src/wiiusej/utils/OrientationWiimoteEventPanel.java b/src/main/java/wiiusej/utils/OrientationWiimoteEventPanel.java similarity index 100% rename from WiiUseJ/src/wiiusej/utils/OrientationWiimoteEventPanel.java rename to src/main/java/wiiusej/utils/OrientationWiimoteEventPanel.java diff --git a/WiiUseJ/src/wiiusej/values/GForce.java b/src/main/java/wiiusej/values/GForce.java similarity index 94% rename from WiiUseJ/src/wiiusej/values/GForce.java rename to src/main/java/wiiusej/values/GForce.java index da79ed2..45be3dc 100644 --- a/WiiUseJ/src/wiiusej/values/GForce.java +++ b/src/main/java/wiiusej/values/GForce.java @@ -1,80 +1,80 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.values; - -/** - * Represents gravity force on each axis. - * - * @author guiguito - */ -public class GForce { - - private float x; - private float y; - private float z; - - /** - * Default constructor; - */ - public GForce() { - x = 0; - y = 0; - z = 0; - } - - /** - * Constructor with gravity force on each axis. - * - * @param xx - * x value - * @param yy - * x value - * @param zz - * x value - */ - public GForce(float xx, float yy, float zz) { - x = xx; - y = yy; - z = zz; - } - - /** - * @return the x - */ - public float getX() { - return x; - } - - /** - * @return the y - */ - public float getY() { - return y; - } - - /** - * @return the z - */ - public float getZ() { - return z; - } - - @Override - public String toString() { - return "Gravity force : (" + x + ", " + y + "," + z + ")"; - } -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.values; + +/** + * Represents gravity force on each axis. + * + * @author guiguito + */ +public class GForce { + + private float x; + private float y; + private float z; + + /** + * Default constructor; + */ + public GForce() { + x = 0; + y = 0; + z = 0; + } + + /** + * Constructor with gravity force on each axis. + * + * @param xx + * x value + * @param yy + * x value + * @param zz + * x value + */ + public GForce(float xx, float yy, float zz) { + x = xx; + y = yy; + z = zz; + } + + /** + * @return the x + */ + public float getX() { + return x; + } + + /** + * @return the y + */ + public float getY() { + return y; + } + + /** + * @return the z + */ + public float getZ() { + return z; + } + + @Override + public String toString() { + return "Gravity force : (" + x + ", " + y + "," + z + ")"; + } +} diff --git a/WiiUseJ/src/wiiusej/values/IRSource.java b/src/main/java/wiiusej/values/IRSource.java similarity index 95% rename from WiiUseJ/src/wiiusej/values/IRSource.java rename to src/main/java/wiiusej/values/IRSource.java index a738c05..fc4790a 100644 --- a/WiiUseJ/src/wiiusej/values/IRSource.java +++ b/src/main/java/wiiusej/values/IRSource.java @@ -1,106 +1,106 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.values; - -/** - * Class used for IR sources. - * - * @author guiguito - */ -public class IRSource { - - private int x; - private int y; - private short rx; - private short ry; - private short size; - - /** - * Build an IR source with all details. - * - * @param xx - * xx interpolated coordinates. - * @param yy - * yy interpolated coordinates. - * @param rxx - * raw X coordinate (0-1023). - * @param ryy - * raw Y coordinate (0-1023). - * @param si - * size of the IR dot (0-15). - */ - public IRSource(int xx, int yy, short rxx, short ryy, short si) { - x = xx; - y = yy; - rx = rxx; - ry = ryy; - size = si; - } - - /** - * Return x interpolated coordinates. - * - * @return the x - */ - public int getX() { - return x; - } - - /** - * Return y interpolated coordinates. - * - * @return the y - */ - public int getY() { - return y; - } - - /** - * Return raw X coordinate (0-1023). - * - * @return the rx - */ - public short getRx() { - return rx; - } - - /** - * Return raw Y coordinate (0-1023). - * - * @return the ry - */ - public short getRy() { - return ry; - } - - /** - * Return size of the IR dot (0-15). - * - * @return the size - */ - public short getSize() { - return size; - } - - @Override - public String toString() { - return "Interpolated coordinates (" + x + "," + y - + "), Raw coordinates(" + rx + "," + ry + "), source size : " - + size + ")"; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.values; + +/** + * Class used for IR sources. + * + * @author guiguito + */ +public class IRSource { + + private int x; + private int y; + private short rx; + private short ry; + private short size; + + /** + * Build an IR source with all details. + * + * @param xx + * xx interpolated coordinates. + * @param yy + * yy interpolated coordinates. + * @param rxx + * raw X coordinate (0-1023). + * @param ryy + * raw Y coordinate (0-1023). + * @param si + * size of the IR dot (0-15). + */ + public IRSource(int xx, int yy, short rxx, short ryy, short si) { + x = xx; + y = yy; + rx = rxx; + ry = ryy; + size = si; + } + + /** + * Return x interpolated coordinates. + * + * @return the x + */ + public int getX() { + return x; + } + + /** + * Return y interpolated coordinates. + * + * @return the y + */ + public int getY() { + return y; + } + + /** + * Return raw X coordinate (0-1023). + * + * @return the rx + */ + public short getRx() { + return rx; + } + + /** + * Return raw Y coordinate (0-1023). + * + * @return the ry + */ + public short getRy() { + return ry; + } + + /** + * Return size of the IR dot (0-15). + * + * @return the size + */ + public short getSize() { + return size; + } + + @Override + public String toString() { + return "Interpolated coordinates (" + x + "," + y + + "), Raw coordinates(" + rx + "," + ry + "), source size : " + + size + ")"; + } + +} diff --git a/WiiUseJ/src/wiiusej/values/Orientation.java b/src/main/java/wiiusej/values/Orientation.java similarity index 95% rename from WiiUseJ/src/wiiusej/values/Orientation.java rename to src/main/java/wiiusej/values/Orientation.java index 124d890..9513e30 100644 --- a/WiiUseJ/src/wiiusej/values/Orientation.java +++ b/src/main/java/wiiusej/values/Orientation.java @@ -1,117 +1,117 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.values; - -/** - * Class that represents the orientation of the wiimote. - * - * @author guiguito - */ -public class Orientation { - - private float roll; - private float pitch; - private float yaw; - private float a_roll; - private float a_pitch; - - /** - * Default constructor. - */ - public Orientation() { - roll = 0; - pitch = 0; - yaw = 0; - a_roll = 0; - a_pitch = 0; - } - - /** - * Contructor with raw, pitch , yaw. - * - * @param r - * roll (can be smoothed) - * @param p - * pitch (can be smoothed) - * @param y - * yaw - * @param ar - * absolute roll - * @param ap - * absolute pitch - */ - public Orientation(float r, float p, float y, float ar, float ap) { - roll = r; - pitch = p; - yaw = y; - a_roll = ar; - a_pitch = ap; - } - - /** - * Get the roll (can be smoothed). - * - * @return the roll - */ - public float getRoll() { - return roll; - } - - /** - * Get the pitch (can be smoothed). - * - * @return the pitch - */ - public float getPitch() { - return pitch; - } - - /** - * Get the yaw. - * - * @return the yaw - */ - public float getYaw() { - return yaw; - } - - /** - * Get absolute roll (can not be smoothed). - * - * @return the a_roll - */ - public float getARoll() { - return a_roll; - } - - /** - * Get absolute pitch (can not be smoothed). - * - * @return the a_pitch - */ - public float getAPitch() { - return a_pitch; - } - - @Override - public String toString() { - return "Orientation : (roll: " + roll + ", pitch: " + pitch + ", yaw: " - + yaw + ", absolute roll: " + a_roll + ", absolute pitch: " - + a_pitch + ")"; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.values; + +/** + * Class that represents the orientation of the wiimote. + * + * @author guiguito + */ +public class Orientation { + + private float roll; + private float pitch; + private float yaw; + private float a_roll; + private float a_pitch; + + /** + * Default constructor. + */ + public Orientation() { + roll = 0; + pitch = 0; + yaw = 0; + a_roll = 0; + a_pitch = 0; + } + + /** + * Contructor with raw, pitch , yaw. + * + * @param r + * roll (can be smoothed) + * @param p + * pitch (can be smoothed) + * @param y + * yaw + * @param ar + * absolute roll + * @param ap + * absolute pitch + */ + public Orientation(float r, float p, float y, float ar, float ap) { + roll = r; + pitch = p; + yaw = y; + a_roll = ar; + a_pitch = ap; + } + + /** + * Get the roll (can be smoothed). + * + * @return the roll + */ + public float getRoll() { + return roll; + } + + /** + * Get the pitch (can be smoothed). + * + * @return the pitch + */ + public float getPitch() { + return pitch; + } + + /** + * Get the yaw. + * + * @return the yaw + */ + public float getYaw() { + return yaw; + } + + /** + * Get absolute roll (can not be smoothed). + * + * @return the a_roll + */ + public float getARoll() { + return a_roll; + } + + /** + * Get absolute pitch (can not be smoothed). + * + * @return the a_pitch + */ + public float getAPitch() { + return a_pitch; + } + + @Override + public String toString() { + return "Orientation : (roll: " + roll + ", pitch: " + pitch + ", yaw: " + + yaw + ", absolute roll: " + a_roll + ", absolute pitch: " + + a_pitch + ")"; + } + +} diff --git a/WiiUseJ/src/wiiusej/values/RawAcceleration.java b/src/main/java/wiiusej/values/RawAcceleration.java similarity index 95% rename from WiiUseJ/src/wiiusej/values/RawAcceleration.java rename to src/main/java/wiiusej/values/RawAcceleration.java index 83f9578..249a097 100644 --- a/WiiUseJ/src/wiiusej/values/RawAcceleration.java +++ b/src/main/java/wiiusej/values/RawAcceleration.java @@ -1,81 +1,81 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.values; - -/** - * Represents raw acceleration on each axis. - * - * @author guiguito - */ -public class RawAcceleration { - - private short x; - private short y; - private short z; - - /** - * Default constructor; - */ - public RawAcceleration() { - x = 0; - y = 0; - z = 0; - } - - /** - * Constructor with raw acceleration on each axis. - * - * @param xx - * x value - * @param yy - * x value - * @param zz - * x value - */ - public RawAcceleration(short xx, short yy, short zz) { - x = xx; - y = yy; - z = zz; - } - - /** - * @return the x - */ - public short getX() { - return x; - } - - /** - * @return the y - */ - public short getY() { - return y; - } - - /** - * @return the z - */ - public short getZ() { - return z; - } - - @Override - public String toString() { - return "Raw acceleration : (" + x + ", " + y + "," + z + ")"; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.values; + +/** + * Represents raw acceleration on each axis. + * + * @author guiguito + */ +public class RawAcceleration { + + private short x; + private short y; + private short z; + + /** + * Default constructor; + */ + public RawAcceleration() { + x = 0; + y = 0; + z = 0; + } + + /** + * Constructor with raw acceleration on each axis. + * + * @param xx + * x value + * @param yy + * x value + * @param zz + * x value + */ + public RawAcceleration(short xx, short yy, short zz) { + x = xx; + y = yy; + z = zz; + } + + /** + * @return the x + */ + public short getX() { + return x; + } + + /** + * @return the y + */ + public short getY() { + return y; + } + + /** + * @return the z + */ + public short getZ() { + return z; + } + + @Override + public String toString() { + return "Raw acceleration : (" + x + ", " + y + "," + z + ")"; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/GenericEvent.java b/src/main/java/wiiusej/wiiusejevents/GenericEvent.java similarity index 95% rename from WiiUseJ/src/wiiusej/wiiusejevents/GenericEvent.java rename to src/main/java/wiiusej/wiiusejevents/GenericEvent.java index 18d8429..a44d664 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/GenericEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/GenericEvent.java @@ -1,59 +1,59 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents; - -/** - * Abstract mother class representing an event with a wiimote id. - * - * @author guiguito - */ -public abstract class GenericEvent { - - /* ID */ - private int wiimoteId = -1; - - /** - * Construct the WiiUseApiEvent setting up the id. - * - * @param id - * the Wiimote id - */ - public GenericEvent(int id) { - wiimoteId = id; - } - - /** - * Get Wiimote ID - * - * @return the wiimote id. - */ - public int getWiimoteId() { - return wiimoteId; - } - - /** - * Set Wiimote ID - * - * @param wiimoteId - * id of the wiimote - */ - void setWiimoteId(int wiimoteId) { - this.wiimoteId = wiimoteId; - } - - public abstract String toString(); -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents; + +/** + * Abstract mother class representing an event with a wiimote id. + * + * @author guiguito + */ +public abstract class GenericEvent { + + /* ID */ + private int wiimoteId = -1; + + /** + * Construct the WiiUseApiEvent setting up the id. + * + * @param id + * the Wiimote id + */ + public GenericEvent(int id) { + wiimoteId = id; + } + + /** + * Get Wiimote ID + * + * @return the wiimote id. + */ + public int getWiimoteId() { + return wiimoteId; + } + + /** + * Set Wiimote ID + * + * @param wiimoteId + * id of the wiimote + */ + void setWiimoteId(int wiimoteId) { + this.wiimoteId = wiimoteId; + } + + public abstract String toString(); +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java index b07aa43..2e12a22 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/ButtonsEvent.java @@ -1,128 +1,128 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -import wiiusej.wiiusejevents.GenericEvent; - -/** - * Class which represents a buttons event. - * - * @author guiguito - */ -public abstract class ButtonsEvent extends GenericEvent { - - /* Buttons */ - private short buttonsJustPressed = 0; - private short buttonsJustReleased = 0; - private short buttonsHeld = 0; - - /** - * Constructor of the button Event. - * - * @param id - * id of the wiimote concerned. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just held. - */ - public ButtonsEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - super(id); - setAllButtons(buttonsJustPressed, buttonsJustReleased, buttonsHeld); - } - - /** - * Set all buttons in one method. - * - * @param buttonsJustPressed - * @param buttonsJustReleased - * @param buttonsHeld - */ - private void setAllButtons(short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - this.buttonsJustPressed = buttonsJustPressed; - this.buttonsJustReleased = buttonsJustReleased; - this.buttonsHeld = buttonsHeld; - } - - /** - * Get the short storing the buttons just pressed - * - * @return the short storing the buttons just pressed - */ - public short getButtonsJustPressed() { - return buttonsJustPressed; - } - - /** - * Get the short storing the buttons just released - * - * @return the short storing the buttons just released - */ - public short getButtonsJustReleased() { - return buttonsJustReleased; - } - - /** - * get the short storing the buttons held - * - * @return the short storing the buttons held - */ - public short getButtonsHeld() { - return buttonsHeld; - } - - /** **************** BUTTONS Methods ***************** */ - /* generic button functions */ - - protected boolean buttonTest(int buttonBitsDefinition, int buttons) { - return (buttons & buttonBitsDefinition) == buttonBitsDefinition; - } - - protected boolean isButtonJustPressed(int buttonBitsDefinition) { - return buttonTest(buttonBitsDefinition, buttonsJustPressed) - && !isButtonHeld(buttonBitsDefinition); - } - - protected boolean isButtonJustReleased(int buttonBitsDefinition) { - return buttonTest(buttonBitsDefinition, buttonsJustReleased); - } - - protected boolean isButtonHeld(int buttonBitsDefinition) { - return buttonTest(buttonBitsDefinition, buttonsHeld); - } - - protected boolean isButtonPressed(int buttonBitsDefinition) { - return isButtonHeld(buttonBitsDefinition) - || isButtonJustPressed(buttonBitsDefinition); - } - - @Override - public String toString() { - String out = ""; - /* Display buttons */ - out += "/******** Buttons ********/\n"; - out += "--- Buttons just pressed : " + buttonsJustPressed + "\n"; - out += "--- Buttons just released : " + buttonsJustReleased + "\n"; - out += "--- Buttons held : " + buttonsHeld + "\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +import wiiusej.wiiusejevents.GenericEvent; + +/** + * Class which represents a buttons event. + * + * @author guiguito + */ +public abstract class ButtonsEvent extends GenericEvent { + + /* Buttons */ + private short buttonsJustPressed = 0; + private short buttonsJustReleased = 0; + private short buttonsHeld = 0; + + /** + * Constructor of the button Event. + * + * @param id + * id of the wiimote concerned. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just held. + */ + public ButtonsEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + super(id); + setAllButtons(buttonsJustPressed, buttonsJustReleased, buttonsHeld); + } + + /** + * Set all buttons in one method. + * + * @param buttonsJustPressed + * @param buttonsJustReleased + * @param buttonsHeld + */ + private void setAllButtons(short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + this.buttonsJustPressed = buttonsJustPressed; + this.buttonsJustReleased = buttonsJustReleased; + this.buttonsHeld = buttonsHeld; + } + + /** + * Get the short storing the buttons just pressed + * + * @return the short storing the buttons just pressed + */ + public short getButtonsJustPressed() { + return buttonsJustPressed; + } + + /** + * Get the short storing the buttons just released + * + * @return the short storing the buttons just released + */ + public short getButtonsJustReleased() { + return buttonsJustReleased; + } + + /** + * get the short storing the buttons held + * + * @return the short storing the buttons held + */ + public short getButtonsHeld() { + return buttonsHeld; + } + + /** **************** BUTTONS Methods ***************** */ + /* generic button functions */ + + protected boolean buttonTest(int buttonBitsDefinition, int buttons) { + return (buttons & buttonBitsDefinition) == buttonBitsDefinition; + } + + protected boolean isButtonJustPressed(int buttonBitsDefinition) { + return buttonTest(buttonBitsDefinition, buttonsJustPressed) + && !isButtonHeld(buttonBitsDefinition); + } + + protected boolean isButtonJustReleased(int buttonBitsDefinition) { + return buttonTest(buttonBitsDefinition, buttonsJustReleased); + } + + protected boolean isButtonHeld(int buttonBitsDefinition) { + return buttonTest(buttonBitsDefinition, buttonsHeld); + } + + protected boolean isButtonPressed(int buttonBitsDefinition) { + return isButtonHeld(buttonBitsDefinition) + || isButtonJustPressed(buttonBitsDefinition); + } + + @Override + public String toString() { + String out = ""; + /* Display buttons */ + out += "/******** Buttons ********/\n"; + out += "--- Buttons just pressed : " + buttonsJustPressed + "\n"; + out += "--- Buttons just released : " + buttonsJustReleased + "\n"; + out += "--- Buttons held : " + buttonsHeld + "\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java index 347e27c..99c5bc9 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/ClassicControllerButtonsEvent.java @@ -1,329 +1,329 @@ -/* This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * Class which represents a buttons event from a Classic controller. - * - * @author guiguito - */ -public class ClassicControllerButtonsEvent extends ButtonsEvent{ - - private static short CLASSIC_CTRL_BUTTON_UP = 0x0001; - private static short CLASSIC_CTRL_BUTTON_LEFT = 0x0002; - private static short CLASSIC_CTRL_BUTTON_ZR = 0x0004; - private static short CLASSIC_CTRL_BUTTON_X = 0x0008; - private static short CLASSIC_CTRL_BUTTON_A = 0x0010; - private static short CLASSIC_CTRL_BUTTON_Y = 0x0020; - private static short CLASSIC_CTRL_BUTTON_B = 0x0040; - private static short CLASSIC_CTRL_BUTTON_ZL = 0x0080; - private static short CLASSIC_CTRL_BUTTON_FULL_R = 0x0200; - private static short CLASSIC_CTRL_BUTTON_PLUS = 0x0400; - private static short CLASSIC_CTRL_BUTTON_HOME = 0x0800; - private static short CLASSIC_CTRL_BUTTON_MINUS = 0x1000; - private static short CLASSIC_CTRL_BUTTON_FULL_L = 0x2000; - private static short CLASSIC_CTRL_BUTTON_DOWN = 0x4000; - private static int CLASSIC_CTRL_BUTTON_RIGHT = 0x8000; - private static int CLASSIC_CTRL_BUTTON_ALL = 0xFEFF; - - /** - * Constructor of the classic controller buttons Event. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - */ - public ClassicControllerButtonsEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); - } - - /* Button LEFT */ - - public boolean isButtonLeftJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_LEFT); - } - - public boolean isButtonLeftJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_LEFT); - } - - public boolean isButtonLeftHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_LEFT); - } - - public boolean isButtonLeftPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_LEFT); - } - - /* Button RIGHT */ - - public boolean isButtonRightJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_RIGHT); - } - - public boolean isButtonRightJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_RIGHT); - } - - public boolean isButtonRightHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_RIGHT); - } - - public boolean isButtonRightPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_RIGHT); - } - - /* Button UP */ - - public boolean isButtonUpJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_UP); - } - - public boolean isButtonUpJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_UP); - } - - public boolean isButtonUpHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_UP); - } - - public boolean isButtonUpPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_UP); - } - - /* Button DOWN */ - - public boolean isButtonDownJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_DOWN); - } - - public boolean isButtonDownJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_DOWN); - } - - public boolean isButtonDownHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_DOWN); - } - - public boolean isButtonDownPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_DOWN); - } - - /* Button A */ - - public boolean isButtonAJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_A); - } - - public boolean isButtonAJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_A); - } - - public boolean isButtonAHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_A); - } - - public boolean isButtonAPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_A); - } - - /* Button B */ - - public boolean isButtonBJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_B); - } - - public boolean isButtonBJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_B); - } - - public boolean isButtonBHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_B); - } - - public boolean isButtonBPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_B); - } - - /* Button X */ - - public boolean isButtonXJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_X); - } - - public boolean isButtonXJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_X); - } - - public boolean isButtonXHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_X); - } - - public boolean isButtonXPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_X); - } - - /* Button Y */ - - public boolean isButtonYJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_Y); - } - - public boolean isButtonYJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_Y); - } - - public boolean isButtonYHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_Y); - } - - public boolean isButtonYPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_Y); - } - - /* Button FullLeft */ - - public boolean isButtonFullLeftJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_L); - } - - public boolean isButtonFullLeftJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_FULL_L); - } - - public boolean isButtonFullLeftHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_FULL_L); - } - - public boolean isButtonFullLeftPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_L); - } - - /* Button FullRight */ - - public boolean isButtonFullRightJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_R); - } - - public boolean isButtonFullRightJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_FULL_R); - } - - public boolean isButtonFullRightHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_FULL_R); - } - - public boolean isButtonFullRightPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_R); - } - - /* Button Home */ - - public boolean isButtonHomeJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_HOME); - } - - public boolean isButtonHomeJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_HOME); - } - - public boolean isButtonHomeHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_HOME); - } - - public boolean isButtonHomePressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_HOME); - } - - /* Button Minus */ - - public boolean isButtonMinusJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_MINUS); - } - - public boolean isButtonMinusJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_MINUS); - } - - public boolean isButtonMinusHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_MINUS); - } - - public boolean isButtonMinusPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_MINUS); - } - - /* Button Plus */ - - public boolean isButtonPlusJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_PLUS); - } - - public boolean isButtonPlusJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_PLUS); - } - - public boolean isButtonPlusHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_PLUS); - } - - public boolean isButtonPlusPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_PLUS); - } - - /* Button ZL */ - - public boolean isButtonZLJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZL); - } - - public boolean isButtonZLJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_ZL); - } - - public boolean isButtonZLHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_ZL); - } - - public boolean isButtonZLPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_ZL); - } - - /* Button ZR */ - - public boolean isButtonZRJustPressed() { - return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZR); - } - - public boolean isButtonZRJustReleased() { - return isButtonJustReleased(CLASSIC_CTRL_BUTTON_ZR); - } - - public boolean isButtonZRHeld() { - return isButtonHeld(CLASSIC_CTRL_BUTTON_ZR); - } - - public boolean isButtonZRPressed() { - return isButtonPressed(CLASSIC_CTRL_BUTTON_ZR); - } - -} +/* This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * Class which represents a buttons event from a Classic controller. + * + * @author guiguito + */ +public class ClassicControllerButtonsEvent extends ButtonsEvent{ + + private static short CLASSIC_CTRL_BUTTON_UP = 0x0001; + private static short CLASSIC_CTRL_BUTTON_LEFT = 0x0002; + private static short CLASSIC_CTRL_BUTTON_ZR = 0x0004; + private static short CLASSIC_CTRL_BUTTON_X = 0x0008; + private static short CLASSIC_CTRL_BUTTON_A = 0x0010; + private static short CLASSIC_CTRL_BUTTON_Y = 0x0020; + private static short CLASSIC_CTRL_BUTTON_B = 0x0040; + private static short CLASSIC_CTRL_BUTTON_ZL = 0x0080; + private static short CLASSIC_CTRL_BUTTON_FULL_R = 0x0200; + private static short CLASSIC_CTRL_BUTTON_PLUS = 0x0400; + private static short CLASSIC_CTRL_BUTTON_HOME = 0x0800; + private static short CLASSIC_CTRL_BUTTON_MINUS = 0x1000; + private static short CLASSIC_CTRL_BUTTON_FULL_L = 0x2000; + private static short CLASSIC_CTRL_BUTTON_DOWN = 0x4000; + private static int CLASSIC_CTRL_BUTTON_RIGHT = 0x8000; + private static int CLASSIC_CTRL_BUTTON_ALL = 0xFEFF; + + /** + * Constructor of the classic controller buttons Event. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + */ + public ClassicControllerButtonsEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); + } + + /* Button LEFT */ + + public boolean isButtonLeftJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_LEFT); + } + + public boolean isButtonLeftJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_LEFT); + } + + public boolean isButtonLeftHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_LEFT); + } + + public boolean isButtonLeftPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_LEFT); + } + + /* Button RIGHT */ + + public boolean isButtonRightJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_RIGHT); + } + + public boolean isButtonRightJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_RIGHT); + } + + public boolean isButtonRightHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_RIGHT); + } + + public boolean isButtonRightPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_RIGHT); + } + + /* Button UP */ + + public boolean isButtonUpJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_UP); + } + + public boolean isButtonUpJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_UP); + } + + public boolean isButtonUpHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_UP); + } + + public boolean isButtonUpPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_UP); + } + + /* Button DOWN */ + + public boolean isButtonDownJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_DOWN); + } + + public boolean isButtonDownJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_DOWN); + } + + public boolean isButtonDownHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_DOWN); + } + + public boolean isButtonDownPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_DOWN); + } + + /* Button A */ + + public boolean isButtonAJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_A); + } + + public boolean isButtonAJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_A); + } + + public boolean isButtonAHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_A); + } + + public boolean isButtonAPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_A); + } + + /* Button B */ + + public boolean isButtonBJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_B); + } + + public boolean isButtonBJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_B); + } + + public boolean isButtonBHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_B); + } + + public boolean isButtonBPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_B); + } + + /* Button X */ + + public boolean isButtonXJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_X); + } + + public boolean isButtonXJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_X); + } + + public boolean isButtonXHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_X); + } + + public boolean isButtonXPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_X); + } + + /* Button Y */ + + public boolean isButtonYJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_Y); + } + + public boolean isButtonYJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_Y); + } + + public boolean isButtonYHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_Y); + } + + public boolean isButtonYPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_Y); + } + + /* Button FullLeft */ + + public boolean isButtonFullLeftJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_L); + } + + public boolean isButtonFullLeftJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_FULL_L); + } + + public boolean isButtonFullLeftHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_FULL_L); + } + + public boolean isButtonFullLeftPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_L); + } + + /* Button FullRight */ + + public boolean isButtonFullRightJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_R); + } + + public boolean isButtonFullRightJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_FULL_R); + } + + public boolean isButtonFullRightHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_FULL_R); + } + + public boolean isButtonFullRightPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_R); + } + + /* Button Home */ + + public boolean isButtonHomeJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_HOME); + } + + public boolean isButtonHomeJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_HOME); + } + + public boolean isButtonHomeHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_HOME); + } + + public boolean isButtonHomePressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_HOME); + } + + /* Button Minus */ + + public boolean isButtonMinusJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_MINUS); + } + + public boolean isButtonMinusJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_MINUS); + } + + public boolean isButtonMinusHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_MINUS); + } + + public boolean isButtonMinusPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_MINUS); + } + + /* Button Plus */ + + public boolean isButtonPlusJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_PLUS); + } + + public boolean isButtonPlusJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_PLUS); + } + + public boolean isButtonPlusHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_PLUS); + } + + public boolean isButtonPlusPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_PLUS); + } + + /* Button ZL */ + + public boolean isButtonZLJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZL); + } + + public boolean isButtonZLJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_ZL); + } + + public boolean isButtonZLHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_ZL); + } + + public boolean isButtonZLPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_ZL); + } + + /* Button ZR */ + + public boolean isButtonZRJustPressed() { + return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZR); + } + + public boolean isButtonZRJustReleased() { + return isButtonJustReleased(CLASSIC_CTRL_BUTTON_ZR); + } + + public boolean isButtonZRHeld() { + return isButtonHeld(CLASSIC_CTRL_BUTTON_ZR); + } + + public boolean isButtonZRPressed() { + return isButtonPressed(CLASSIC_CTRL_BUTTON_ZR); + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java index ce04bd7..214e030 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/ClassicControllerEvent.java @@ -1,177 +1,177 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * This class represents the values from the classic controller and its events. - * - * @author guiguito - */ -public class ClassicControllerEvent extends ExpansionEvent { - - private float rightShoulder; - private float leftShoulder; - private ClassicControllerButtonsEvent buttonsEvent; - private JoystickEvent classicControllerRightJoystickEvent; - private JoystickEvent classicControllerLeftJoystickEvent; - - /** - * Constructor of ClassicControllerEvent. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param rightShoulder - * right shoulder button (range 0-1). - * @param leftShoulder - * left shoulder button (range 0-1). - * @param langle - * angle the left joystick is being held. - * @param lmagnitude - * magnitude of the left joystick (range 0-1). - * @param lmax1 - * maximum left joystick value 1. - * @param lmax2 - * maximum left joystick value 2. - * @param lmin1 - * minimum left joystick value 1. - * @param lmin2 - * minimum left joystick value 2. - * @param lcenter1 - * center left joystick value 1. - * @param lcenter2 - * center left joystick value 2. - * @param rangle - * angle the right joystick is being held. - * @param rmagnitude - * magnitude of the right joystick (range 0-1). - * @param rmax1 - * maximum right joystick value 1. - * @param rmax2 - * maximum right joystick value 2. - * @param rmin1 - * minimum right joystick value 1. - * @param rmin2 - * minimum right joystick value 2. - * @param rcenter1 - * center right joystick value 1. - * @param rcenter2 - * center right joystick value 2. - */ - public ClassicControllerEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, float rightShoulder, - float leftShoulder, float langle, float lmagnitude, short lmax1, - short lmax2, short lmin1, short lmin2, short lcenter1, - short lcenter2, float rangle, float rmagnitude, short rmax1, - short rmax2, short rmin1, short rmin2, short rcenter1, - short rcenter2) { - super(id); - this.leftShoulder = leftShoulder; - this.rightShoulder = rightShoulder; - buttonsEvent = new ClassicControllerButtonsEvent(id, - buttonsJustPressed, buttonsJustReleased, buttonsHeld); - classicControllerLeftJoystickEvent = new JoystickEvent(id, langle, - lmagnitude, lmax1, lmax2, lmin1, lmin2, lcenter1, lcenter2); - classicControllerRightJoystickEvent = new JoystickEvent(id, rangle, - rmagnitude, rmax1, rmax2, rmin1, rmin2, rcenter1, rcenter2); - } - - /** - * Tell if there is a classic controller left joystick event. - * - * @return TRUE if there is a classic controller left joystick event, false - * otherwise. - */ - public boolean isThereClassicControllerLeftJoystickEvent() { - return classicControllerLeftJoystickEvent != null; - } - - /** - * Tell if there is a classic controller right joystick event. - * - * @return TRUE if there is a classic controller right joystick event, false - * otherwise. - */ - public boolean isThereClassicControllerRightJoystickEvent() { - return classicControllerRightJoystickEvent != null; - } - - /** - * Get the right shoulder button(range 0-1). - * - * @return value of the rightShoulder button. - */ - public float getRightShoulder() { - return rightShoulder; - } - - /** - * Get the left shoulder button(range 0-1). - * - * @return value of the leftShoulder button. - */ - public float getLeftShoulder() { - return leftShoulder; - } - - /** - * Get buttons event for the classic controller. - * - * @return the classic controller buttons event if there is one or null. - */ - public ClassicControllerButtonsEvent getButtonsEvent() { - return buttonsEvent; - } - - /** - * Get event from the right joystick of the classic controller. - * - * @return the classic controller right Joystick Event if there is one or null. - */ - public JoystickEvent getClassicControllerRightJoystickEvent() { - return classicControllerRightJoystickEvent; - } - - /** - * Get event from the left joystick of the classic controller. - * - * @return the classic controller left Joystick Event if there is one or null. - */ - public JoystickEvent getClassicControllerLeftJoystickEvent() { - return classicControllerLeftJoystickEvent; - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** Classic Controller EVENT : WIIMOTE ID :" - + getWiimoteId() + " ********/\n"; - out += buttonsEvent; - out += "Left shoulder : " + leftShoulder + "\n"; - out += "Right shoulder : " + rightShoulder + "\n"; - out += classicControllerLeftJoystickEvent; - out += classicControllerRightJoystickEvent; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * This class represents the values from the classic controller and its events. + * + * @author guiguito + */ +public class ClassicControllerEvent extends ExpansionEvent { + + private float rightShoulder; + private float leftShoulder; + private ClassicControllerButtonsEvent buttonsEvent; + private JoystickEvent classicControllerRightJoystickEvent; + private JoystickEvent classicControllerLeftJoystickEvent; + + /** + * Constructor of ClassicControllerEvent. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param rightShoulder + * right shoulder button (range 0-1). + * @param leftShoulder + * left shoulder button (range 0-1). + * @param langle + * angle the left joystick is being held. + * @param lmagnitude + * magnitude of the left joystick (range 0-1). + * @param lmax1 + * maximum left joystick value 1. + * @param lmax2 + * maximum left joystick value 2. + * @param lmin1 + * minimum left joystick value 1. + * @param lmin2 + * minimum left joystick value 2. + * @param lcenter1 + * center left joystick value 1. + * @param lcenter2 + * center left joystick value 2. + * @param rangle + * angle the right joystick is being held. + * @param rmagnitude + * magnitude of the right joystick (range 0-1). + * @param rmax1 + * maximum right joystick value 1. + * @param rmax2 + * maximum right joystick value 2. + * @param rmin1 + * minimum right joystick value 1. + * @param rmin2 + * minimum right joystick value 2. + * @param rcenter1 + * center right joystick value 1. + * @param rcenter2 + * center right joystick value 2. + */ + public ClassicControllerEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, float rightShoulder, + float leftShoulder, float langle, float lmagnitude, short lmax1, + short lmax2, short lmin1, short lmin2, short lcenter1, + short lcenter2, float rangle, float rmagnitude, short rmax1, + short rmax2, short rmin1, short rmin2, short rcenter1, + short rcenter2) { + super(id); + this.leftShoulder = leftShoulder; + this.rightShoulder = rightShoulder; + buttonsEvent = new ClassicControllerButtonsEvent(id, + buttonsJustPressed, buttonsJustReleased, buttonsHeld); + classicControllerLeftJoystickEvent = new JoystickEvent(id, langle, + lmagnitude, lmax1, lmax2, lmin1, lmin2, lcenter1, lcenter2); + classicControllerRightJoystickEvent = new JoystickEvent(id, rangle, + rmagnitude, rmax1, rmax2, rmin1, rmin2, rcenter1, rcenter2); + } + + /** + * Tell if there is a classic controller left joystick event. + * + * @return TRUE if there is a classic controller left joystick event, false + * otherwise. + */ + public boolean isThereClassicControllerLeftJoystickEvent() { + return classicControllerLeftJoystickEvent != null; + } + + /** + * Tell if there is a classic controller right joystick event. + * + * @return TRUE if there is a classic controller right joystick event, false + * otherwise. + */ + public boolean isThereClassicControllerRightJoystickEvent() { + return classicControllerRightJoystickEvent != null; + } + + /** + * Get the right shoulder button(range 0-1). + * + * @return value of the rightShoulder button. + */ + public float getRightShoulder() { + return rightShoulder; + } + + /** + * Get the left shoulder button(range 0-1). + * + * @return value of the leftShoulder button. + */ + public float getLeftShoulder() { + return leftShoulder; + } + + /** + * Get buttons event for the classic controller. + * + * @return the classic controller buttons event if there is one or null. + */ + public ClassicControllerButtonsEvent getButtonsEvent() { + return buttonsEvent; + } + + /** + * Get event from the right joystick of the classic controller. + * + * @return the classic controller right Joystick Event if there is one or null. + */ + public JoystickEvent getClassicControllerRightJoystickEvent() { + return classicControllerRightJoystickEvent; + } + + /** + * Get event from the left joystick of the classic controller. + * + * @return the classic controller left Joystick Event if there is one or null. + */ + public JoystickEvent getClassicControllerLeftJoystickEvent() { + return classicControllerLeftJoystickEvent; + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** Classic Controller EVENT : WIIMOTE ID :" + + getWiimoteId() + " ********/\n"; + out += buttonsEvent; + out += "Left shoulder : " + leftShoulder + "\n"; + out += "Right shoulder : " + rightShoulder + "\n"; + out += classicControllerLeftJoystickEvent; + out += classicControllerRightJoystickEvent; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java index 868f33c..0b71a4c 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/ExpansionEvent.java @@ -1,40 +1,40 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -import wiiusej.wiiusejevents.GenericEvent; - -/** - * Mother Class of all expansions event. - * - * @author guiguito - */ -public abstract class ExpansionEvent extends GenericEvent { - - /** - * Constructor of an ExpansionEvent. - * - * @param id - * id of the wiimote to which the expansion is connected. - */ - public ExpansionEvent(int id) { - super(id); - } - - public abstract String toString(); - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +import wiiusej.wiiusejevents.GenericEvent; + +/** + * Mother Class of all expansions event. + * + * @author guiguito + */ +public abstract class ExpansionEvent extends GenericEvent { + + /** + * Constructor of an ExpansionEvent. + * + * @param id + * id of the wiimote to which the expansion is connected. + */ + public ExpansionEvent(int id) { + super(id); + } + + public abstract String toString(); + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java index df04048..92d139e 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/GuitarHeroButtonsEvent.java @@ -1,214 +1,214 @@ -/* This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * Class which represents a buttons event from a Guitar Hero controller. - * - * @author guiguito - */ -public class GuitarHeroButtonsEvent extends ButtonsEvent { - - private static short GUITAR_HERO_3_BUTTON_STRUM_UP = 0x0001; - private static short GUITAR_HERO_3_BUTTON_YELLOW = 0x0008; - private static short GUITAR_HERO_3_BUTTON_GREEN = 0x0010; - private static short GUITAR_HERO_3_BUTTON_BLUE = 0x0020; - private static short GUITAR_HERO_3_BUTTON_RED = 0x0040; - private static short GUITAR_HERO_3_BUTTON_ORANGE = 0x0080; - private static short GUITAR_HERO_3_BUTTON_PLUS = 0x0400; - private static short GUITAR_HERO_3_BUTTON_MINUS = 0x1000; - private static short GUITAR_HERO_3_BUTTON_STRUM_DOWN = 0x4000; - private static int GUITAR_HERO_3_BUTTON_ALL = 0xFEFF; - - /** - * Constructor of the guitar hero buttons Event. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - */ - public GuitarHeroButtonsEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); - } - - /* Button Strum Up */ - - public boolean isButtonStrumUpJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_UP); - } - - public boolean isButtonStrumUpJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_STRUM_UP); - } - - public boolean isButtonStrumUpeHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_STRUM_UP); - } - - public boolean isButtonStrumUpPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_UP); - } - - /* Button Strum Down */ - - public boolean isButtonStrumDownJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN); - } - - public boolean isButtonStrumDownJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_STRUM_DOWN); - } - - public boolean isButtonStrumDowneHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_STRUM_DOWN); - } - - public boolean isButtonStrumDownPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN); - } - - /* Button blue */ - - public boolean isButtonBlueJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_BLUE); - } - - public boolean isButtonBlueJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_BLUE); - } - - public boolean isButtonBlueHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_BLUE); - } - - public boolean isButtonBluePressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_BLUE); - } - - /* Button Green */ - - public boolean isButtonGreenJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_GREEN); - } - - public boolean isButtonGreenJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_GREEN); - } - - public boolean isButtonGreenHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_GREEN); - } - - public boolean isButtonGreenPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_GREEN); - } - - /* Button Minus */ - - public boolean isButtonMinusJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_MINUS); - } - - public boolean isButtonMinusJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_MINUS); - } - - public boolean isButtonMinusHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_MINUS); - } - - public boolean isButtonMinusPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_MINUS); - } - - /* Button Orange */ - - public boolean isButtonOrangeJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_ORANGE); - } - - public boolean isButtonOrangeJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_ORANGE); - } - - public boolean isButtonOrangeHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_ORANGE); - } - - public boolean isButtonOrangePressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_ORANGE); - } - - /* Button Plus */ - - public boolean isButtonPlusJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_PLUS); - } - - public boolean isButtonPlusJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_PLUS); - } - - public boolean isButtonPlusHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_PLUS); - } - - public boolean isButtonPlusPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_PLUS); - } - - /* Button Red */ - - public boolean isButtonRedJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_RED); - } - - public boolean isButtonRedJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_RED); - } - - public boolean isButtonRedHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_RED); - } - - public boolean isButtonRedPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_RED); - } - - /* Button Yellow */ - - public boolean isButtonYellowJustPressed() { - return isButtonJustPressed(GUITAR_HERO_3_BUTTON_YELLOW); - } - - public boolean isButtonYellowJustReleased() { - return isButtonJustReleased(GUITAR_HERO_3_BUTTON_YELLOW); - } - - public boolean isButtonYellowHeld() { - return isButtonHeld(GUITAR_HERO_3_BUTTON_YELLOW); - } - - public boolean isButtonYellowPressed() { - return isButtonPressed(GUITAR_HERO_3_BUTTON_YELLOW); - } -} +/* This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * Class which represents a buttons event from a Guitar Hero controller. + * + * @author guiguito + */ +public class GuitarHeroButtonsEvent extends ButtonsEvent { + + private static short GUITAR_HERO_3_BUTTON_STRUM_UP = 0x0001; + private static short GUITAR_HERO_3_BUTTON_YELLOW = 0x0008; + private static short GUITAR_HERO_3_BUTTON_GREEN = 0x0010; + private static short GUITAR_HERO_3_BUTTON_BLUE = 0x0020; + private static short GUITAR_HERO_3_BUTTON_RED = 0x0040; + private static short GUITAR_HERO_3_BUTTON_ORANGE = 0x0080; + private static short GUITAR_HERO_3_BUTTON_PLUS = 0x0400; + private static short GUITAR_HERO_3_BUTTON_MINUS = 0x1000; + private static short GUITAR_HERO_3_BUTTON_STRUM_DOWN = 0x4000; + private static int GUITAR_HERO_3_BUTTON_ALL = 0xFEFF; + + /** + * Constructor of the guitar hero buttons Event. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + */ + public GuitarHeroButtonsEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); + } + + /* Button Strum Up */ + + public boolean isButtonStrumUpJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_UP); + } + + public boolean isButtonStrumUpJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_STRUM_UP); + } + + public boolean isButtonStrumUpeHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_STRUM_UP); + } + + public boolean isButtonStrumUpPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_UP); + } + + /* Button Strum Down */ + + public boolean isButtonStrumDownJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN); + } + + public boolean isButtonStrumDownJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_STRUM_DOWN); + } + + public boolean isButtonStrumDowneHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_STRUM_DOWN); + } + + public boolean isButtonStrumDownPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN); + } + + /* Button blue */ + + public boolean isButtonBlueJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_BLUE); + } + + public boolean isButtonBlueJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_BLUE); + } + + public boolean isButtonBlueHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_BLUE); + } + + public boolean isButtonBluePressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_BLUE); + } + + /* Button Green */ + + public boolean isButtonGreenJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_GREEN); + } + + public boolean isButtonGreenJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_GREEN); + } + + public boolean isButtonGreenHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_GREEN); + } + + public boolean isButtonGreenPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_GREEN); + } + + /* Button Minus */ + + public boolean isButtonMinusJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_MINUS); + } + + public boolean isButtonMinusJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_MINUS); + } + + public boolean isButtonMinusHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_MINUS); + } + + public boolean isButtonMinusPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_MINUS); + } + + /* Button Orange */ + + public boolean isButtonOrangeJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_ORANGE); + } + + public boolean isButtonOrangeJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_ORANGE); + } + + public boolean isButtonOrangeHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_ORANGE); + } + + public boolean isButtonOrangePressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_ORANGE); + } + + /* Button Plus */ + + public boolean isButtonPlusJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_PLUS); + } + + public boolean isButtonPlusJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_PLUS); + } + + public boolean isButtonPlusHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_PLUS); + } + + public boolean isButtonPlusPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_PLUS); + } + + /* Button Red */ + + public boolean isButtonRedJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_RED); + } + + public boolean isButtonRedJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_RED); + } + + public boolean isButtonRedHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_RED); + } + + public boolean isButtonRedPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_RED); + } + + /* Button Yellow */ + + public boolean isButtonYellowJustPressed() { + return isButtonJustPressed(GUITAR_HERO_3_BUTTON_YELLOW); + } + + public boolean isButtonYellowJustReleased() { + return isButtonJustReleased(GUITAR_HERO_3_BUTTON_YELLOW); + } + + public boolean isButtonYellowHeld() { + return isButtonHeld(GUITAR_HERO_3_BUTTON_YELLOW); + } + + public boolean isButtonYellowPressed() { + return isButtonPressed(GUITAR_HERO_3_BUTTON_YELLOW); + } +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java index d4796a3..6fb9e8c 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/GuitarHeroEvent.java @@ -1,119 +1,119 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * This class represents the values from the GuitarHero and its events. - * - * @author guiguito - */ -public class GuitarHeroEvent extends ExpansionEvent{ - - private float whammyBar; - private GuitarHeroButtonsEvent buttonsEvent; - private JoystickEvent guitarHeroJoystickEvent; - - /** - * Constructor of GuitarHeroEvent. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param whammyBar - * whammy bar (range 0-1). - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public GuitarHeroEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, float whammyBar, - float angle, float magnitude, short max1, - short max2, short min1, short min2, short center1, - short center2) { - super(id); - this.whammyBar = whammyBar; - buttonsEvent = new GuitarHeroButtonsEvent(id, - buttonsJustPressed, buttonsJustReleased, buttonsHeld); - guitarHeroJoystickEvent = new JoystickEvent(id, angle, - magnitude, max1, max2, min1, min2, center1, center2); - - } - - /** - * Tell if there is a Guitar Hero joystick event. - * - * @return TRUE if there is a Guitar Hero joystick event, false otherwise. - */ - public boolean isThereGuitarHeroJoystickEvent() { - return guitarHeroJoystickEvent != null; - } - - /** - * Whammy bar (range 0-1). - * @return the whammyBar value. - */ - public float getWhammyBar() { - return whammyBar; - } - - /** - * Get buttons event for the guitar hero controller. - * @return the guitar hero controller buttons event if there is one or null. - */ - public GuitarHeroButtonsEvent getButtonsEvent() { - return buttonsEvent; - } - - /** - * Get event from the joystick of the guitar hero controller. - * @return the guitar hero controller joystick Event if there is one or null. - */ - public JoystickEvent getGuitarHeroJoystickEvent() { - return guitarHeroJoystickEvent; - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** Guitar Hero 3 EVENT : WIIMOTE ID :" + getWiimoteId() - + " ********/\n"; - out += buttonsEvent; - out += "Whammy Bar : "+whammyBar+"\n"; - out += guitarHeroJoystickEvent; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * This class represents the values from the GuitarHero and its events. + * + * @author guiguito + */ +public class GuitarHeroEvent extends ExpansionEvent{ + + private float whammyBar; + private GuitarHeroButtonsEvent buttonsEvent; + private JoystickEvent guitarHeroJoystickEvent; + + /** + * Constructor of GuitarHeroEvent. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param whammyBar + * whammy bar (range 0-1). + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public GuitarHeroEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, float whammyBar, + float angle, float magnitude, short max1, + short max2, short min1, short min2, short center1, + short center2) { + super(id); + this.whammyBar = whammyBar; + buttonsEvent = new GuitarHeroButtonsEvent(id, + buttonsJustPressed, buttonsJustReleased, buttonsHeld); + guitarHeroJoystickEvent = new JoystickEvent(id, angle, + magnitude, max1, max2, min1, min2, center1, center2); + + } + + /** + * Tell if there is a Guitar Hero joystick event. + * + * @return TRUE if there is a Guitar Hero joystick event, false otherwise. + */ + public boolean isThereGuitarHeroJoystickEvent() { + return guitarHeroJoystickEvent != null; + } + + /** + * Whammy bar (range 0-1). + * @return the whammyBar value. + */ + public float getWhammyBar() { + return whammyBar; + } + + /** + * Get buttons event for the guitar hero controller. + * @return the guitar hero controller buttons event if there is one or null. + */ + public GuitarHeroButtonsEvent getButtonsEvent() { + return buttonsEvent; + } + + /** + * Get event from the joystick of the guitar hero controller. + * @return the guitar hero controller joystick Event if there is one or null. + */ + public JoystickEvent getGuitarHeroJoystickEvent() { + return guitarHeroJoystickEvent; + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** Guitar Hero 3 EVENT : WIIMOTE ID :" + getWiimoteId() + + " ********/\n"; + out += buttonsEvent; + out += "Whammy Bar : "+whammyBar+"\n"; + out += guitarHeroJoystickEvent; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/IREvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/IREvent.java similarity index 95% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/IREvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/IREvent.java index 06648a1..74d4f2c 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/IREvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/IREvent.java @@ -1,319 +1,319 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -import wiiusej.values.IRSource; -import wiiusej.wiiusejevents.GenericEvent; - -/** - * Class which represents an IR event. - * - * @author guiguito - */ -public class IREvent extends GenericEvent { - - /* IR Tracking */ - private IRSource[] IRPoints; - private short indexPoints = 0; - private int x; - private int y; - private float z;// distance from the sensor bar - private int ax; - private int ay; - private int xVRes; - private int yVRes; - private int xOffset; - private int yOffset; - private short sensorBarPostion; - private short screenAsPectRatio; - private short irSensitivity; - private float distance; - - static private short WIIUSE_IR_ABOVE = 0; - static private short WIIUSE_IR_BELOW = 1; - static private short WIIUSE_SCREEN_RATIO_4_3 = 0; - static private short WIIUSE_SCREEN_RATIO_16_9 = 1; - - private static short NB_POINTS = 4;// number of points IR can track - - /** - * Constructor of IREvent with full infos. - * - * @param id - * d of the wiimote concerned. - * @param x - * calculated X coordinate. - * @param y - * calculated Y coordinate. - * @param z - * calculated distance. - * @param ax - * absolute X coordinate. - * @param ay - * absolute Y coordinate - * @param xVRes - * IR virtual screen x resolution. - * @param yVRes - * IR virtual screen y resolution. - * @param xOffset - * IR X correction offset. - * @param yOffset - * IR Y correction offset. - * @param sensorBarPostion - * aspect ratio of the screen. - * @param screenAsPectRatio - * IR sensor bar position. - * @param irSensitivity - * Sensitivity of the infrared camera. - * @param distance - * Pixel Distance between first two dots - */ - public IREvent(int id, int x, int y, float z, int ax, int ay, int xVRes, - int yVRes, int xOffset, int yOffset, short sensorBarPostion, - short screenAsPectRatio, short irSensitivity, float distance) { - super(id); - this.x = x; - this.y = y; - this.z = z; - this.ax = ax; - this.ay = ay; - this.xVRes = xVRes; - this.yVRes = yVRes; - this.xOffset = xOffset; - this.yOffset = yOffset; - this.sensorBarPostion = sensorBarPostion; - this.screenAsPectRatio = screenAsPectRatio; - this.irSensitivity = irSensitivity; - this.distance = distance; - IRPoints = new IRSource[NB_POINTS]; - } - - /** - * Get list of IR points. - * - * @return the list of 2D points - */ - public IRSource[] getIRPoints() { - IRSource[] ir = new IRSource[indexPoints]; - System.arraycopy(IRPoints, 0, ir, 0, indexPoints); - return ir; - } - - /** - * Add IR Point in the list (Max 4 points) - * - * @param x - * x value - * @param y - * y value - * @param rx - * raw X coordinate (0-1023). - * @param ry - * raw Y coordinate (0-1023). - * @param size - * size of the IR dot (0-15). - */ - public void addIRpoint(int x, int y, short rx, short ry, short size) { - IRPoints[indexPoints] = new IRSource(x, y, rx, ry, size); - indexPoints++; - return; - } - - /** - * Return calculated X coordinate. - * - * @return the x - */ - public int getX() { - return x; - } - - /** - * Return calculated Y coordinate. - * - * @return the y - */ - public int getY() { - return y; - } - - /** - * Return calculated distance. - * - * @return the z - */ - public float getZ() { - return z; - } - - /** - * Return absolute X coordinate. - * - * @return the ax - */ - public int getAx() { - return ax; - } - - /** - * Return absolute Y coordinate. - * - * @return the ay - */ - public int getAy() { - return ay; - } - - /** - * Return IR virtual screen x resolution. - * - * @return the xVRes - */ - public int getXVRes() { - return xVRes; - } - - /** - * Return IR virtual screen y resolution. - * - * @return the yVRes - */ - public int getYVRes() { - return yVRes; - } - - /** - * Return IR X correction offset. - * - * @return the xOffset - */ - public int getXOffset() { - return xOffset; - } - - /** - * Return IR Y correction offset. - * - * @return the yOffset - */ - public int getYOffset() { - return yOffset; - } - - /** - * Return true if the sensor bar is above. - * - * @return true if the sensor bar is above. - */ - public boolean isSensorBarAbove() { - return sensorBarPostion == WIIUSE_IR_ABOVE; - } - - /** - * Return true if the sensor bar is below. - * - * @return true if the sensor bar is below. - */ - public boolean isSensorBarBelow() { - return sensorBarPostion == WIIUSE_IR_BELOW; - } - - /** - * Return true if screen aspect ratio set is 4/3. - * - * @return true if screen aspect ratio set is 4/3. - */ - public boolean isScreenAspectRatio43() { - return screenAsPectRatio == WIIUSE_SCREEN_RATIO_4_3; - } - - /** - * Return true if screen aspect ratio set is 16/9. - * - * @return true if screen aspect ratio set is 16/9. - */ - public boolean isScreenAspectRatio169() { - return screenAsPectRatio == WIIUSE_SCREEN_RATIO_16_9; - } - - /** - * Return aspect ratio of the screen. - * - * @return the screenAsPectRatio - */ - public short getScreenAsPectRatio() { - return screenAsPectRatio; - } - - /** - * The sensitivity of the IR camera can be turned up or down depending on - * your needs. Like the Wii, wiiusej and wiiuse can set the camera - * sensitivity to a degree between 1 (lowest) and 5 (highest). The default - * is 3. - * - * @return the irSensitivity - */ - public short getIrSensitivity() { - return irSensitivity; - } - - /** - * Pixel distance between first 2 dots. - * - * @return the distance between first 2 dots. - */ - public float getDistance() { - return distance; - } - - @Override - public String toString() { - String out = ""; - /* Display IR Tracking */ - out += "/******** IR Tracking ********/\n"; - out += "--- Active : true\n"; - out += "--- calculated X coordinate : " + x + "\n"; - out += "--- calculated Y coordinate : " + y + "\n"; - out += "--- calculated Z coordinate : " + z + "\n"; - out += "--- calculated distance : " + distance + "\n"; - out += "--- absolute X coordinate : " + ax + "\n"; - out += "--- absolute Y coordinate : " + ay + "\n"; - out += "--- IR virtual screen x resolution : " + xVRes + "\n"; - out += "--- IR virtual screen y resolution : " + yVRes + "\n"; - out += "--- IR X correction offset : " + xOffset + "\n"; - out += "--- IR Y correction offset : " + yOffset + "\n"; - out += "--- IR Sensitivity (between 1-5) : " + irSensitivity + "\n"; - if (isScreenAspectRatio43()) { - out += "--- aspect ratio of the screen : 4/3\n"; - } else if (isScreenAspectRatio169()) { - out += "--- aspect ratio of the screen : 16/9\n"; - } - if (isSensorBarAbove()) { - out += "--- IR sensor bar position. : Above\n"; - } else if (isSensorBarBelow()) { - out += "--- IR sensor bar position. : Below\n"; - } - out += "--- Seen points\n"; - for (int i = 0; i < IRPoints.length; i++) { - if (IRPoints[i] != null) { - out += IRPoints[i].toString(); - } - } - out += "\n"; - return out; - } -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +import wiiusej.values.IRSource; +import wiiusej.wiiusejevents.GenericEvent; + +/** + * Class which represents an IR event. + * + * @author guiguito + */ +public class IREvent extends GenericEvent { + + /* IR Tracking */ + private IRSource[] IRPoints; + private short indexPoints = 0; + private int x; + private int y; + private float z;// distance from the sensor bar + private int ax; + private int ay; + private int xVRes; + private int yVRes; + private int xOffset; + private int yOffset; + private short sensorBarPostion; + private short screenAsPectRatio; + private short irSensitivity; + private float distance; + + static private short WIIUSE_IR_ABOVE = 0; + static private short WIIUSE_IR_BELOW = 1; + static private short WIIUSE_SCREEN_RATIO_4_3 = 0; + static private short WIIUSE_SCREEN_RATIO_16_9 = 1; + + private static short NB_POINTS = 4;// number of points IR can track + + /** + * Constructor of IREvent with full infos. + * + * @param id + * d of the wiimote concerned. + * @param x + * calculated X coordinate. + * @param y + * calculated Y coordinate. + * @param z + * calculated distance. + * @param ax + * absolute X coordinate. + * @param ay + * absolute Y coordinate + * @param xVRes + * IR virtual screen x resolution. + * @param yVRes + * IR virtual screen y resolution. + * @param xOffset + * IR X correction offset. + * @param yOffset + * IR Y correction offset. + * @param sensorBarPostion + * aspect ratio of the screen. + * @param screenAsPectRatio + * IR sensor bar position. + * @param irSensitivity + * Sensitivity of the infrared camera. + * @param distance + * Pixel Distance between first two dots + */ + public IREvent(int id, int x, int y, float z, int ax, int ay, int xVRes, + int yVRes, int xOffset, int yOffset, short sensorBarPostion, + short screenAsPectRatio, short irSensitivity, float distance) { + super(id); + this.x = x; + this.y = y; + this.z = z; + this.ax = ax; + this.ay = ay; + this.xVRes = xVRes; + this.yVRes = yVRes; + this.xOffset = xOffset; + this.yOffset = yOffset; + this.sensorBarPostion = sensorBarPostion; + this.screenAsPectRatio = screenAsPectRatio; + this.irSensitivity = irSensitivity; + this.distance = distance; + IRPoints = new IRSource[NB_POINTS]; + } + + /** + * Get list of IR points. + * + * @return the list of 2D points + */ + public IRSource[] getIRPoints() { + IRSource[] ir = new IRSource[indexPoints]; + System.arraycopy(IRPoints, 0, ir, 0, indexPoints); + return ir; + } + + /** + * Add IR Point in the list (Max 4 points) + * + * @param x + * x value + * @param y + * y value + * @param rx + * raw X coordinate (0-1023). + * @param ry + * raw Y coordinate (0-1023). + * @param size + * size of the IR dot (0-15). + */ + public void addIRpoint(int x, int y, short rx, short ry, short size) { + IRPoints[indexPoints] = new IRSource(x, y, rx, ry, size); + indexPoints++; + return; + } + + /** + * Return calculated X coordinate. + * + * @return the x + */ + public int getX() { + return x; + } + + /** + * Return calculated Y coordinate. + * + * @return the y + */ + public int getY() { + return y; + } + + /** + * Return calculated distance. + * + * @return the z + */ + public float getZ() { + return z; + } + + /** + * Return absolute X coordinate. + * + * @return the ax + */ + public int getAx() { + return ax; + } + + /** + * Return absolute Y coordinate. + * + * @return the ay + */ + public int getAy() { + return ay; + } + + /** + * Return IR virtual screen x resolution. + * + * @return the xVRes + */ + public int getXVRes() { + return xVRes; + } + + /** + * Return IR virtual screen y resolution. + * + * @return the yVRes + */ + public int getYVRes() { + return yVRes; + } + + /** + * Return IR X correction offset. + * + * @return the xOffset + */ + public int getXOffset() { + return xOffset; + } + + /** + * Return IR Y correction offset. + * + * @return the yOffset + */ + public int getYOffset() { + return yOffset; + } + + /** + * Return true if the sensor bar is above. + * + * @return true if the sensor bar is above. + */ + public boolean isSensorBarAbove() { + return sensorBarPostion == WIIUSE_IR_ABOVE; + } + + /** + * Return true if the sensor bar is below. + * + * @return true if the sensor bar is below. + */ + public boolean isSensorBarBelow() { + return sensorBarPostion == WIIUSE_IR_BELOW; + } + + /** + * Return true if screen aspect ratio set is 4/3. + * + * @return true if screen aspect ratio set is 4/3. + */ + public boolean isScreenAspectRatio43() { + return screenAsPectRatio == WIIUSE_SCREEN_RATIO_4_3; + } + + /** + * Return true if screen aspect ratio set is 16/9. + * + * @return true if screen aspect ratio set is 16/9. + */ + public boolean isScreenAspectRatio169() { + return screenAsPectRatio == WIIUSE_SCREEN_RATIO_16_9; + } + + /** + * Return aspect ratio of the screen. + * + * @return the screenAsPectRatio + */ + public short getScreenAsPectRatio() { + return screenAsPectRatio; + } + + /** + * The sensitivity of the IR camera can be turned up or down depending on + * your needs. Like the Wii, wiiusej and wiiuse can set the camera + * sensitivity to a degree between 1 (lowest) and 5 (highest). The default + * is 3. + * + * @return the irSensitivity + */ + public short getIrSensitivity() { + return irSensitivity; + } + + /** + * Pixel distance between first 2 dots. + * + * @return the distance between first 2 dots. + */ + public float getDistance() { + return distance; + } + + @Override + public String toString() { + String out = ""; + /* Display IR Tracking */ + out += "/******** IR Tracking ********/\n"; + out += "--- Active : true\n"; + out += "--- calculated X coordinate : " + x + "\n"; + out += "--- calculated Y coordinate : " + y + "\n"; + out += "--- calculated Z coordinate : " + z + "\n"; + out += "--- calculated distance : " + distance + "\n"; + out += "--- absolute X coordinate : " + ax + "\n"; + out += "--- absolute Y coordinate : " + ay + "\n"; + out += "--- IR virtual screen x resolution : " + xVRes + "\n"; + out += "--- IR virtual screen y resolution : " + yVRes + "\n"; + out += "--- IR X correction offset : " + xOffset + "\n"; + out += "--- IR Y correction offset : " + yOffset + "\n"; + out += "--- IR Sensitivity (between 1-5) : " + irSensitivity + "\n"; + if (isScreenAspectRatio43()) { + out += "--- aspect ratio of the screen : 4/3\n"; + } else if (isScreenAspectRatio169()) { + out += "--- aspect ratio of the screen : 16/9\n"; + } + if (isSensorBarAbove()) { + out += "--- IR sensor bar position. : Above\n"; + } else if (isSensorBarBelow()) { + out += "--- IR sensor bar position. : Below\n"; + } + out += "--- Seen points\n"; + for (int i = 0; i < IRPoints.length; i++) { + if (IRPoints[i] != null) { + out += IRPoints[i].toString(); + } + } + out += "\n"; + return out; + } +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java similarity index 95% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java index 5dc7f2f..cab6b1d 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/JoystickEvent.java @@ -1,135 +1,135 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -import wiiusej.wiiusejevents.GenericEvent; - -/** - * Class that stores values on a joystick Event. - * - * @author guiguito - */ -public class JoystickEvent extends GenericEvent { - - private float angle; - private float magnitude; - private short[] max; - private short[] min; - private short[] center; - - /** - * Constructor of a JoystickEvent. - * - * @param id - * id of the wiimote connected. - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public JoystickEvent(int id, float angle, float magnitude, short max1, - short max2, short min1, short min2, short center1, short center2) { - super(id); - this.angle = angle; - this.magnitude = magnitude; - max = new short[2]; - max[0] = max1; - max[1] = max2; - min = new short[2]; - min[0] = min1; - min[1] = min2; - center = new short[2]; - center[0] = center1; - center[1] = center2; - } - - /** - * Get angle the joystick is being held. - * - * @return the angle angle the joystick. - */ - public float getAngle() { - return angle; - } - - /** - * Get magnitude of the joystick (range 0-1). - * - * @return the magnitude magnitude of the joystick. - */ - public float getMagnitude() { - return magnitude; - } - - /** - * Maximum joystick values. - * - * @return the max - */ - public short[] getMax() { - return max; - } - - /** - * Minimum joystick values. - * - * @return the min - */ - public short[] getMin() { - return min; - } - - /** - * Center joystick values. - * - * @return the center - */ - public short[] getCenter() { - return center; - } - - /* - * (non-Javadoc) - * - * @see wiiusej.wiiusejevents.GenericEvent#toString() - */ - @Override - public String toString() { - String out = ""; - /* Display IR Tracking */ - out += "/******** Joystick ********/\n"; - out += "--- angle : " + angle + "\n"; - out += "--- magnitude : " + magnitude + "\n"; - out += "--- maximum values : " + max[0] + "," + max[1] + "\n"; - out += "--- minimum values : " + min[0] + "," + min[1] + "\n"; - out += "--- center values : " + center[0] + "," + center[1] + "\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +import wiiusej.wiiusejevents.GenericEvent; + +/** + * Class that stores values on a joystick Event. + * + * @author guiguito + */ +public class JoystickEvent extends GenericEvent { + + private float angle; + private float magnitude; + private short[] max; + private short[] min; + private short[] center; + + /** + * Constructor of a JoystickEvent. + * + * @param id + * id of the wiimote connected. + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public JoystickEvent(int id, float angle, float magnitude, short max1, + short max2, short min1, short min2, short center1, short center2) { + super(id); + this.angle = angle; + this.magnitude = magnitude; + max = new short[2]; + max[0] = max1; + max[1] = max2; + min = new short[2]; + min[0] = min1; + min[1] = min2; + center = new short[2]; + center[0] = center1; + center[1] = center2; + } + + /** + * Get angle the joystick is being held. + * + * @return the angle angle the joystick. + */ + public float getAngle() { + return angle; + } + + /** + * Get magnitude of the joystick (range 0-1). + * + * @return the magnitude magnitude of the joystick. + */ + public float getMagnitude() { + return magnitude; + } + + /** + * Maximum joystick values. + * + * @return the max + */ + public short[] getMax() { + return max; + } + + /** + * Minimum joystick values. + * + * @return the min + */ + public short[] getMin() { + return min; + } + + /** + * Center joystick values. + * + * @return the center + */ + public short[] getCenter() { + return center; + } + + /* + * (non-Javadoc) + * + * @see wiiusej.wiiusejevents.GenericEvent#toString() + */ + @Override + public String toString() { + String out = ""; + /* Display IR Tracking */ + out += "/******** Joystick ********/\n"; + out += "--- angle : " + angle + "\n"; + out += "--- magnitude : " + magnitude + "\n"; + out += "--- maximum values : " + max[0] + "," + max[1] + "\n"; + out += "--- minimum values : " + min[0] + "," + min[1] + "\n"; + out += "--- center values : " + center[0] + "," + center[1] + "\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java index 0945a48..e177fbd 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/MotionSensingEvent.java @@ -1,203 +1,203 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -import wiiusej.values.GForce; -import wiiusej.values.Orientation; -import wiiusej.values.RawAcceleration; -import wiiusej.wiiusejevents.GenericEvent; - -/** - * Class which represents a motion sensing event. - * - * @author guiguito - */ -public class MotionSensingEvent extends GenericEvent { - - /* Motion Sensing */ - private Orientation orientation; - private GForce gforce; - private RawAcceleration acceleration; - - private float orientationThreshold = 0; - private int accelerationThreshold = 0; - private float alphaSmoothing = 0; - private boolean isSmoothingActive = false; - - /** - * Constructor for a Motion Sensing Event. - * - * @param id - * id of the wiimote concerned. - * @param orientationThreshold - * value of the minimum angle between two events with the - * accelerometer. - * @param accelerationThreshold - * value of the value variation between two events with the - * accelerometer. - * @param smoothingState - * true if smoothing flag is activated. - * @param alphaSmooth - * value of the alpha smoothing parameter. - * @param r - * roll. - * @param p - * pitch. - * @param ya - * yaw. - * @param ar - * absolute roll. - * @param ap - * absolute pitch. - * @param x - * gravity force on x axis. - * @param y - * gravity force on y axis. - * @param z - * gravity force on z axis. - * @param xx - * raw acceleration on x axis. - * @param yy - * raw acceleration on y axis. - * @param zz - * raw acceleration on z axis. - */ - public MotionSensingEvent(int id, float orientationThreshold, - int accelerationThreshold, boolean smoothingState, - float alphaSmooth, float r, float p, float ya, float ar, float ap, - float x, float y, float z, short xx, short yy, short zz) { - super(id); - this.orientationThreshold = orientationThreshold; - this.accelerationThreshold = accelerationThreshold; - this.isSmoothingActive = smoothingState; - this.alphaSmoothing = alphaSmooth; - setOrientationAndGforce(r, p, ya, ar, ap, x, y, z, xx, yy, zz); - } - - /** - * Set orientation, gravity force and raw acceleration. - * - * @param r - * roll - * @param p - * pitch - * @param ya - * yaw - * @param ar - * absolute roll - * @param ap - * absolute pitch - * @param x - * gravity force on x axis - * @param y - * gravity force on y axis - * @param z - * gravity force on z axis - * @param xx - * raw acceleration on x axis - * @param yy - * raw acceleration on y axis - * @param zz - * raw acceleration on z axis - */ - private void setOrientationAndGforce(float r, float p, float ya, float ar, - float ap, float x, float y, float z, short xx, short yy, short zz) { - this.orientation = new Orientation(r, p, ya, ar, ap); - this.gforce = new GForce(x, y, z); - this.acceleration = new RawAcceleration(xx, yy, zz); - } - - /** - * @return the orientation - */ - public Orientation getOrientation() { - return orientation; - } - - /** - * Get the gravity force. - * - * @return the gforce - */ - public GForce getGforce() { - return gforce; - } - - /** - * Get the raw acceleration. - * - * @return the raw acceleration - */ - public RawAcceleration getRawAcceleration() { - return acceleration; - } - - /** - * Get orientation threshold. - * - * @return the orientationThreshold - */ - public float getOrientationThreshold() { - return orientationThreshold; - } - - /** - * Get acceleration threshold. - * - * @return the accelerationThreshold - */ - public int getAccelerationThreshold() { - return accelerationThreshold; - } - - /** - * Get alpha smoothing. - * - * @return the alphaSmoothing - */ - public float getAlphaSmoothing() { - return alphaSmoothing; - } - - /** - * Tell if the option SMOOTHING is activated. - * - * @return the isSmoothingActive - */ - public boolean isSmoothingActive() { - return isSmoothingActive; - } - - @Override - public String toString() { - String out = ""; - /* Motion sensing */ - out += "/******** Motion sensing ********/\n"; - out += "--- Motion sensing : true \n"; - out += "--- Orientation threshold value ? : " + orientationThreshold - + "\n"; - out += "--- Acceleration threshold value ? : " + accelerationThreshold - + "\n"; - out += "--- Alpha smoothing threshold value ? : " + alphaSmoothing - + "\n"; - out += "--- Smoothing ? : " + isSmoothingActive + "\n"; - out += "--- " + orientation + "\n"; - out += "--- " + gforce + "\n"; - out += "--- " + acceleration + "\n"; - return out; - } -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +import wiiusej.values.GForce; +import wiiusej.values.Orientation; +import wiiusej.values.RawAcceleration; +import wiiusej.wiiusejevents.GenericEvent; + +/** + * Class which represents a motion sensing event. + * + * @author guiguito + */ +public class MotionSensingEvent extends GenericEvent { + + /* Motion Sensing */ + private Orientation orientation; + private GForce gforce; + private RawAcceleration acceleration; + + private float orientationThreshold = 0; + private int accelerationThreshold = 0; + private float alphaSmoothing = 0; + private boolean isSmoothingActive = false; + + /** + * Constructor for a Motion Sensing Event. + * + * @param id + * id of the wiimote concerned. + * @param orientationThreshold + * value of the minimum angle between two events with the + * accelerometer. + * @param accelerationThreshold + * value of the value variation between two events with the + * accelerometer. + * @param smoothingState + * true if smoothing flag is activated. + * @param alphaSmooth + * value of the alpha smoothing parameter. + * @param r + * roll. + * @param p + * pitch. + * @param ya + * yaw. + * @param ar + * absolute roll. + * @param ap + * absolute pitch. + * @param x + * gravity force on x axis. + * @param y + * gravity force on y axis. + * @param z + * gravity force on z axis. + * @param xx + * raw acceleration on x axis. + * @param yy + * raw acceleration on y axis. + * @param zz + * raw acceleration on z axis. + */ + public MotionSensingEvent(int id, float orientationThreshold, + int accelerationThreshold, boolean smoothingState, + float alphaSmooth, float r, float p, float ya, float ar, float ap, + float x, float y, float z, short xx, short yy, short zz) { + super(id); + this.orientationThreshold = orientationThreshold; + this.accelerationThreshold = accelerationThreshold; + this.isSmoothingActive = smoothingState; + this.alphaSmoothing = alphaSmooth; + setOrientationAndGforce(r, p, ya, ar, ap, x, y, z, xx, yy, zz); + } + + /** + * Set orientation, gravity force and raw acceleration. + * + * @param r + * roll + * @param p + * pitch + * @param ya + * yaw + * @param ar + * absolute roll + * @param ap + * absolute pitch + * @param x + * gravity force on x axis + * @param y + * gravity force on y axis + * @param z + * gravity force on z axis + * @param xx + * raw acceleration on x axis + * @param yy + * raw acceleration on y axis + * @param zz + * raw acceleration on z axis + */ + private void setOrientationAndGforce(float r, float p, float ya, float ar, + float ap, float x, float y, float z, short xx, short yy, short zz) { + this.orientation = new Orientation(r, p, ya, ar, ap); + this.gforce = new GForce(x, y, z); + this.acceleration = new RawAcceleration(xx, yy, zz); + } + + /** + * @return the orientation + */ + public Orientation getOrientation() { + return orientation; + } + + /** + * Get the gravity force. + * + * @return the gforce + */ + public GForce getGforce() { + return gforce; + } + + /** + * Get the raw acceleration. + * + * @return the raw acceleration + */ + public RawAcceleration getRawAcceleration() { + return acceleration; + } + + /** + * Get orientation threshold. + * + * @return the orientationThreshold + */ + public float getOrientationThreshold() { + return orientationThreshold; + } + + /** + * Get acceleration threshold. + * + * @return the accelerationThreshold + */ + public int getAccelerationThreshold() { + return accelerationThreshold; + } + + /** + * Get alpha smoothing. + * + * @return the alphaSmoothing + */ + public float getAlphaSmoothing() { + return alphaSmoothing; + } + + /** + * Tell if the option SMOOTHING is activated. + * + * @return the isSmoothingActive + */ + public boolean isSmoothingActive() { + return isSmoothingActive; + } + + @Override + public String toString() { + String out = ""; + /* Motion sensing */ + out += "/******** Motion sensing ********/\n"; + out += "--- Motion sensing : true \n"; + out += "--- Orientation threshold value ? : " + orientationThreshold + + "\n"; + out += "--- Acceleration threshold value ? : " + accelerationThreshold + + "\n"; + out += "--- Alpha smoothing threshold value ? : " + alphaSmoothing + + "\n"; + out += "--- Smoothing ? : " + isSmoothingActive + "\n"; + out += "--- " + orientation + "\n"; + out += "--- " + gforce + "\n"; + out += "--- " + acceleration + "\n"; + return out; + } +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java index d1af6af..4cab0ae 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/NunchukButtonsEvent.java @@ -1,89 +1,89 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * Class which represents a buttons event from a Nunchuk. - * - * @author guiguito - */ -public class NunchukButtonsEvent extends ButtonsEvent { - - private static short NUNCHUK_BUTTON_Z = 0x01; - private static short NUNCHUK_BUTTON_C = 0x02; - private static short NUNCHUK_BUTTON_ALL = 0x03; - - /** - * Constructor of the nunchuk buttons Event. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - */ - public NunchukButtonsEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); - } - - /* Button Z */ - - public boolean isButtonZJustPressed() { - return isButtonJustPressed(NUNCHUK_BUTTON_Z); - } - - public boolean isButtonZJustReleased() { - return isButtonJustReleased(NUNCHUK_BUTTON_Z); - } - - public boolean isButtonZeHeld() { - return isButtonHeld(NUNCHUK_BUTTON_Z); - } - - public boolean isButtonZPressed() { - return isButtonPressed(NUNCHUK_BUTTON_Z); - } - - /* Button Z */ - - public boolean isButtonCJustPressed() { - return isButtonJustPressed(NUNCHUK_BUTTON_C); - } - - public boolean isButtonCJustReleased() { - return isButtonJustReleased(NUNCHUK_BUTTON_C); - } - - public boolean isButtonCHeld() { - return isButtonHeld(NUNCHUK_BUTTON_C); - } - - public boolean isButtonCPressed() { - return isButtonPressed(NUNCHUK_BUTTON_C); - } - - @Override - public String toString() { - return "/******** Buttons for Nunchuk Event ********/\n" - + super.toString(); - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * Class which represents a buttons event from a Nunchuk. + * + * @author guiguito + */ +public class NunchukButtonsEvent extends ButtonsEvent { + + private static short NUNCHUK_BUTTON_Z = 0x01; + private static short NUNCHUK_BUTTON_C = 0x02; + private static short NUNCHUK_BUTTON_ALL = 0x03; + + /** + * Constructor of the nunchuk buttons Event. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + */ + public NunchukButtonsEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); + } + + /* Button Z */ + + public boolean isButtonZJustPressed() { + return isButtonJustPressed(NUNCHUK_BUTTON_Z); + } + + public boolean isButtonZJustReleased() { + return isButtonJustReleased(NUNCHUK_BUTTON_Z); + } + + public boolean isButtonZeHeld() { + return isButtonHeld(NUNCHUK_BUTTON_Z); + } + + public boolean isButtonZPressed() { + return isButtonPressed(NUNCHUK_BUTTON_Z); + } + + /* Button Z */ + + public boolean isButtonCJustPressed() { + return isButtonJustPressed(NUNCHUK_BUTTON_C); + } + + public boolean isButtonCJustReleased() { + return isButtonJustReleased(NUNCHUK_BUTTON_C); + } + + public boolean isButtonCHeld() { + return isButtonHeld(NUNCHUK_BUTTON_C); + } + + public boolean isButtonCPressed() { + return isButtonPressed(NUNCHUK_BUTTON_C); + } + + @Override + public String toString() { + return "/******** Buttons for Nunchuk Event ********/\n" + + super.toString(); + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java index d990f60..12a8275 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/NunchukEvent.java @@ -1,169 +1,169 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * This class represents the values from the joystick and its events. - * - * @author guiguito - */ -public class NunchukEvent extends ExpansionEvent { - - private NunchukButtonsEvent buttonsEvent; - private MotionSensingEvent nunchukMotionSensingEvent; - private JoystickEvent nunchukJoystickEvent; - - /** - * Constructor of NunchukEvent. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param orientationThreshold - * value of the minimum angle between two events with the - * accelerometer. - * @param accelerationThreshold - * value of the value variation between two events with the - * accelerometer. - * @param smoothingState - * true if smoothing flag is activated. - * @param alphaSmooth - * value of the alpha smoothing parameter. - * @param r - * roll. - * @param p - * pitch. - * @param ya - * yaw. - * @param ar - * absolute roll. - * @param ap - * absolute pitch. - * @param x - * gravity force on x axis. - * @param y - * gravity force on y axis. - * @param z - * gravity force on z axis. - * @param xx - * raw acceleration on x axis. - * @param yy - * raw acceleration on y axis. - * @param zz - * raw acceleration on z axis. - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public NunchukEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, - float orientationThreshold, int accelerationThreshold, - boolean smoothingState, float alphaSmooth, float r, float p, - float ya, float ar, float ap, float x, float y, float z, short xx, - short yy, short zz, float angle, float magnitude, short max1, - short max2, short min1, short min2, short center1, short center2) { - super(id); - buttonsEvent = new NunchukButtonsEvent(id, buttonsJustPressed, - buttonsJustReleased, buttonsHeld); - nunchukMotionSensingEvent = new MotionSensingEvent(id, - orientationThreshold, accelerationThreshold, smoothingState, - alphaSmooth, r, p, ya, ar, ap, x, y, z, xx, yy, zz); - nunchukJoystickEvent = new JoystickEvent(id, angle, magnitude, max1, - max2, min1, min2, center1, center2); - } - - /** - * Tell if there is a nunchuk motion sensing Event. - * - * @return TRUE if there is a nunchuk motion sensing event, false otherwise. - */ - public boolean isThereMotionSensingEvent() { - return nunchukMotionSensingEvent != null; - } - - /** - * Tell if there is a nunchuk joystick event. - * - * @return TRUE if there is a nunchuk joystick event, false otherwise. - */ - public boolean isThereNunchukJoystickEvent() { - return nunchukJoystickEvent != null; - } - - /** - * Get nunchuk buttons event. - * - * @return the nunchuk buttons event if there is one or null. - */ - public NunchukButtonsEvent getButtonsEvent() { - return buttonsEvent; - } - - /** - * Get the nunchuk motion sensing event. - * - * @return the nunchuk motion sensing event if there is one or null. - */ - public MotionSensingEvent getNunchukMotionSensingEvent() { - return nunchukMotionSensingEvent; - } - - /** - * Get the nunchuk joystick event. - * - * @return the nunchuk Joystick Event if there is one or null. - */ - public JoystickEvent getNunchukJoystickEvent() { - return nunchukJoystickEvent; - } - - /* - * (non-Javadoc) - * - * @see wiiusej.wiiusejevents.GenericEvent#toString() - */ - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** Nunchuk EVENT : WIIMOTE ID :" + getWiimoteId() - + " ********/\n"; - out += buttonsEvent; - out += nunchukJoystickEvent; - out += nunchukMotionSensingEvent; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * This class represents the values from the joystick and its events. + * + * @author guiguito + */ +public class NunchukEvent extends ExpansionEvent { + + private NunchukButtonsEvent buttonsEvent; + private MotionSensingEvent nunchukMotionSensingEvent; + private JoystickEvent nunchukJoystickEvent; + + /** + * Constructor of NunchukEvent. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param orientationThreshold + * value of the minimum angle between two events with the + * accelerometer. + * @param accelerationThreshold + * value of the value variation between two events with the + * accelerometer. + * @param smoothingState + * true if smoothing flag is activated. + * @param alphaSmooth + * value of the alpha smoothing parameter. + * @param r + * roll. + * @param p + * pitch. + * @param ya + * yaw. + * @param ar + * absolute roll. + * @param ap + * absolute pitch. + * @param x + * gravity force on x axis. + * @param y + * gravity force on y axis. + * @param z + * gravity force on z axis. + * @param xx + * raw acceleration on x axis. + * @param yy + * raw acceleration on y axis. + * @param zz + * raw acceleration on z axis. + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public NunchukEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, + float orientationThreshold, int accelerationThreshold, + boolean smoothingState, float alphaSmooth, float r, float p, + float ya, float ar, float ap, float x, float y, float z, short xx, + short yy, short zz, float angle, float magnitude, short max1, + short max2, short min1, short min2, short center1, short center2) { + super(id); + buttonsEvent = new NunchukButtonsEvent(id, buttonsJustPressed, + buttonsJustReleased, buttonsHeld); + nunchukMotionSensingEvent = new MotionSensingEvent(id, + orientationThreshold, accelerationThreshold, smoothingState, + alphaSmooth, r, p, ya, ar, ap, x, y, z, xx, yy, zz); + nunchukJoystickEvent = new JoystickEvent(id, angle, magnitude, max1, + max2, min1, min2, center1, center2); + } + + /** + * Tell if there is a nunchuk motion sensing Event. + * + * @return TRUE if there is a nunchuk motion sensing event, false otherwise. + */ + public boolean isThereMotionSensingEvent() { + return nunchukMotionSensingEvent != null; + } + + /** + * Tell if there is a nunchuk joystick event. + * + * @return TRUE if there is a nunchuk joystick event, false otherwise. + */ + public boolean isThereNunchukJoystickEvent() { + return nunchukJoystickEvent != null; + } + + /** + * Get nunchuk buttons event. + * + * @return the nunchuk buttons event if there is one or null. + */ + public NunchukButtonsEvent getButtonsEvent() { + return buttonsEvent; + } + + /** + * Get the nunchuk motion sensing event. + * + * @return the nunchuk motion sensing event if there is one or null. + */ + public MotionSensingEvent getNunchukMotionSensingEvent() { + return nunchukMotionSensingEvent; + } + + /** + * Get the nunchuk joystick event. + * + * @return the nunchuk Joystick Event if there is one or null. + */ + public JoystickEvent getNunchukJoystickEvent() { + return nunchukJoystickEvent; + } + + /* + * (non-Javadoc) + * + * @see wiiusej.wiiusejevents.GenericEvent#toString() + */ + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** Nunchuk EVENT : WIIMOTE ID :" + getWiimoteId() + + " ********/\n"; + out += buttonsEvent; + out += nunchukJoystickEvent; + out += nunchukMotionSensingEvent; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java b/src/main/java/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java rename to src/main/java/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java index 106fc1c..9af3249 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/physicalevents/WiimoteButtonsEvent.java @@ -1,267 +1,267 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.physicalevents; - -/** - * Class which represents a buttons event for a generic event. It means buttons - * from a wiimote. - * - * @author guiguito - */ -public class WiimoteButtonsEvent extends ButtonsEvent { - - /* Buttons MACRO */ - private static short WIIMOTE_BUTTON_TWO = 0x0001; - private static short WIIMOTE_BUTTON_ONE = 0x0002; - private static short WIIMOTE_BUTTON_B = 0x0004; - private static short WIIMOTE_BUTTON_A = 0x0008; - private static short WIIMOTE_BUTTON_MINUS = 0x0010; - private static short WIIMOTE_BUTTON_ZACCEL_BIT6 = 0x0020; - private static short WIIMOTE_BUTTON_ZACCEL_BIT7 = 0x0040; - private static short WIIMOTE_BUTTON_HOME = 0x0080; - private static short WIIMOTE_BUTTON_LEFT = 0x0100; - private static short WIIMOTE_BUTTON_RIGHT = 0x0200; - private static short WIIMOTE_BUTTON_DOWN = 0x0400; - private static short WIIMOTE_BUTTON_UP = 0x0800; - private static short WIIMOTE_BUTTON_PLUS = 0x1000; - private static short WIIMOTE_BUTTON_ZACCEL_BIT4 = 0x2000; - private static short WIIMOTE_BUTTON_ZACCEL_BIT5 = 0x4000; - private static int WIIMOTE_BUTTON_UNKNOWN = 0x8000; - private static short WIIMOTE_BUTTON_ALL = 0x1F9F; - - /** - * Constructor of the wiimote button Event. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons held. - */ - public WiimoteButtonsEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); - } - - /* Button ONE */ - - public boolean isButtonOneJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_ONE); - } - - public boolean isButtonOneJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_ONE); - } - - public boolean isButtonOneHeld() { - return isButtonHeld(WIIMOTE_BUTTON_ONE); - } - - public boolean isButtonOnePressed() { - return isButtonPressed(WIIMOTE_BUTTON_ONE); - } - - /* Button TWO */ - - public boolean isButtonTwoJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_TWO); - } - - public boolean isButtonTwoJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_TWO); - } - - public boolean isButtonTwoHeld() { - return isButtonHeld(WIIMOTE_BUTTON_TWO); - } - - public boolean isButtonTwoPressed() { - return isButtonPressed(WIIMOTE_BUTTON_TWO); - } - - /* Button A */ - - public boolean isButtonAJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_A); - } - - public boolean isButtonAJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_A); - } - - public boolean isButtonAHeld() { - return isButtonHeld(WIIMOTE_BUTTON_A); - } - - public boolean isButtonAPressed() { - return isButtonPressed(WIIMOTE_BUTTON_A); - } - - /* Button B */ - - public boolean isButtonBJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_B); - } - - public boolean isButtonBJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_B); - } - - public boolean isButtonBHeld() { - return isButtonHeld(WIIMOTE_BUTTON_B); - } - - public boolean isButtonBPressed() { - return isButtonPressed(WIIMOTE_BUTTON_B); - } - - /* Button LEFT */ - - public boolean isButtonLeftJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_LEFT); - } - - public boolean isButtonLeftJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_LEFT); - } - - public boolean isButtonLeftHeld() { - return isButtonHeld(WIIMOTE_BUTTON_LEFT); - } - - public boolean isButtonLeftPressed() { - return isButtonPressed(WIIMOTE_BUTTON_LEFT); - } - - /* Button RIGHT */ - - public boolean isButtonRightJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_RIGHT); - } - - public boolean isButtonRightJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_RIGHT); - } - - public boolean isButtonRightHeld() { - return isButtonHeld(WIIMOTE_BUTTON_RIGHT); - } - - public boolean isButtonRightPressed() { - return isButtonPressed(WIIMOTE_BUTTON_RIGHT); - } - - /* Button UP */ - - public boolean isButtonUpJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_UP); - } - - public boolean isButtonUpJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_UP); - } - - public boolean isButtonUpHeld() { - return isButtonHeld(WIIMOTE_BUTTON_UP); - } - - public boolean isButtonUpPressed() { - return isButtonPressed(WIIMOTE_BUTTON_UP); - } - - /* Button DOWN */ - - public boolean isButtonDownJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_DOWN); - } - - public boolean isButtonDownJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_DOWN); - } - - public boolean isButtonDownHeld() { - return isButtonHeld(WIIMOTE_BUTTON_DOWN); - } - - public boolean isButtonDownPressed() { - return isButtonPressed(WIIMOTE_BUTTON_DOWN); - } - - /* Button - */ - - public boolean isButtonMinusJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_MINUS); - } - - public boolean isButtonMinusJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_MINUS); - } - - public boolean isButtonMinusHeld() { - return isButtonHeld(WIIMOTE_BUTTON_MINUS); - } - - public boolean isButtonMinusPressed() { - return isButtonPressed(WIIMOTE_BUTTON_MINUS); - } - - /* Button + */ - - public boolean isButtonPlusJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_PLUS); - } - - public boolean isButtonPlusJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_PLUS); - } - - public boolean isButtonPlusHeld() { - return isButtonHeld(WIIMOTE_BUTTON_PLUS); - } - - public boolean isButtonPlusPressed() { - return isButtonPressed(WIIMOTE_BUTTON_PLUS); - } - - /* Button HOME */ - - public boolean isButtonHomeJustPressed() { - return isButtonJustPressed(WIIMOTE_BUTTON_HOME); - } - - public boolean isButtonHomeJustReleased() { - return isButtonJustReleased(WIIMOTE_BUTTON_HOME); - } - - public boolean isButtonHomeHeld() { - return isButtonHeld(WIIMOTE_BUTTON_HOME); - } - - public boolean isButtonHomePressed() { - return isButtonPressed(WIIMOTE_BUTTON_HOME); - } - - @Override - public String toString() { - return "/******** Buttons for Wiimote generic Event ********/\n" - + super.toString(); - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.physicalevents; + +/** + * Class which represents a buttons event for a generic event. It means buttons + * from a wiimote. + * + * @author guiguito + */ +public class WiimoteButtonsEvent extends ButtonsEvent { + + /* Buttons MACRO */ + private static short WIIMOTE_BUTTON_TWO = 0x0001; + private static short WIIMOTE_BUTTON_ONE = 0x0002; + private static short WIIMOTE_BUTTON_B = 0x0004; + private static short WIIMOTE_BUTTON_A = 0x0008; + private static short WIIMOTE_BUTTON_MINUS = 0x0010; + private static short WIIMOTE_BUTTON_ZACCEL_BIT6 = 0x0020; + private static short WIIMOTE_BUTTON_ZACCEL_BIT7 = 0x0040; + private static short WIIMOTE_BUTTON_HOME = 0x0080; + private static short WIIMOTE_BUTTON_LEFT = 0x0100; + private static short WIIMOTE_BUTTON_RIGHT = 0x0200; + private static short WIIMOTE_BUTTON_DOWN = 0x0400; + private static short WIIMOTE_BUTTON_UP = 0x0800; + private static short WIIMOTE_BUTTON_PLUS = 0x1000; + private static short WIIMOTE_BUTTON_ZACCEL_BIT4 = 0x2000; + private static short WIIMOTE_BUTTON_ZACCEL_BIT5 = 0x4000; + private static int WIIMOTE_BUTTON_UNKNOWN = 0x8000; + private static short WIIMOTE_BUTTON_ALL = 0x1F9F; + + /** + * Constructor of the wiimote button Event. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons held. + */ + public WiimoteButtonsEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); + } + + /* Button ONE */ + + public boolean isButtonOneJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_ONE); + } + + public boolean isButtonOneJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_ONE); + } + + public boolean isButtonOneHeld() { + return isButtonHeld(WIIMOTE_BUTTON_ONE); + } + + public boolean isButtonOnePressed() { + return isButtonPressed(WIIMOTE_BUTTON_ONE); + } + + /* Button TWO */ + + public boolean isButtonTwoJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_TWO); + } + + public boolean isButtonTwoJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_TWO); + } + + public boolean isButtonTwoHeld() { + return isButtonHeld(WIIMOTE_BUTTON_TWO); + } + + public boolean isButtonTwoPressed() { + return isButtonPressed(WIIMOTE_BUTTON_TWO); + } + + /* Button A */ + + public boolean isButtonAJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_A); + } + + public boolean isButtonAJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_A); + } + + public boolean isButtonAHeld() { + return isButtonHeld(WIIMOTE_BUTTON_A); + } + + public boolean isButtonAPressed() { + return isButtonPressed(WIIMOTE_BUTTON_A); + } + + /* Button B */ + + public boolean isButtonBJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_B); + } + + public boolean isButtonBJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_B); + } + + public boolean isButtonBHeld() { + return isButtonHeld(WIIMOTE_BUTTON_B); + } + + public boolean isButtonBPressed() { + return isButtonPressed(WIIMOTE_BUTTON_B); + } + + /* Button LEFT */ + + public boolean isButtonLeftJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_LEFT); + } + + public boolean isButtonLeftJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_LEFT); + } + + public boolean isButtonLeftHeld() { + return isButtonHeld(WIIMOTE_BUTTON_LEFT); + } + + public boolean isButtonLeftPressed() { + return isButtonPressed(WIIMOTE_BUTTON_LEFT); + } + + /* Button RIGHT */ + + public boolean isButtonRightJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_RIGHT); + } + + public boolean isButtonRightJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_RIGHT); + } + + public boolean isButtonRightHeld() { + return isButtonHeld(WIIMOTE_BUTTON_RIGHT); + } + + public boolean isButtonRightPressed() { + return isButtonPressed(WIIMOTE_BUTTON_RIGHT); + } + + /* Button UP */ + + public boolean isButtonUpJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_UP); + } + + public boolean isButtonUpJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_UP); + } + + public boolean isButtonUpHeld() { + return isButtonHeld(WIIMOTE_BUTTON_UP); + } + + public boolean isButtonUpPressed() { + return isButtonPressed(WIIMOTE_BUTTON_UP); + } + + /* Button DOWN */ + + public boolean isButtonDownJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_DOWN); + } + + public boolean isButtonDownJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_DOWN); + } + + public boolean isButtonDownHeld() { + return isButtonHeld(WIIMOTE_BUTTON_DOWN); + } + + public boolean isButtonDownPressed() { + return isButtonPressed(WIIMOTE_BUTTON_DOWN); + } + + /* Button - */ + + public boolean isButtonMinusJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_MINUS); + } + + public boolean isButtonMinusJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_MINUS); + } + + public boolean isButtonMinusHeld() { + return isButtonHeld(WIIMOTE_BUTTON_MINUS); + } + + public boolean isButtonMinusPressed() { + return isButtonPressed(WIIMOTE_BUTTON_MINUS); + } + + /* Button + */ + + public boolean isButtonPlusJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_PLUS); + } + + public boolean isButtonPlusJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_PLUS); + } + + public boolean isButtonPlusHeld() { + return isButtonHeld(WIIMOTE_BUTTON_PLUS); + } + + public boolean isButtonPlusPressed() { + return isButtonPressed(WIIMOTE_BUTTON_PLUS); + } + + /* Button HOME */ + + public boolean isButtonHomeJustPressed() { + return isButtonJustPressed(WIIMOTE_BUTTON_HOME); + } + + public boolean isButtonHomeJustReleased() { + return isButtonJustReleased(WIIMOTE_BUTTON_HOME); + } + + public boolean isButtonHomeHeld() { + return isButtonHeld(WIIMOTE_BUTTON_HOME); + } + + public boolean isButtonHomePressed() { + return isButtonPressed(WIIMOTE_BUTTON_HOME); + } + + @Override + public String toString() { + return "/******** Buttons for Wiimote generic Event ********/\n" + + super.toString(); + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/utils/EventsGatherer.java b/src/main/java/wiiusej/wiiusejevents/utils/EventsGatherer.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/utils/EventsGatherer.java rename to src/main/java/wiiusej/wiiusejevents/utils/EventsGatherer.java index d89c994..cc5382e 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/utils/EventsGatherer.java +++ b/src/main/java/wiiusej/wiiusejevents/utils/EventsGatherer.java @@ -1,509 +1,509 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.utils; - -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; -import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; -import wiiusej.wiiusejevents.wiiuseapievents.WiimoteEvent; - -/** - * This class is used to gather events during a call to the Wiiuse API. - * - * @author guiguito - */ -public class EventsGatherer { - - private WiiUseApiEvent[] events; - private int index = 0; - private WiimoteEvent genericEvent = null; - - /** - * Create EventsGatherer. - * - * @param nbWiimotes - * nb wiimotes (nb a of events possible in a call to Wiiuse API). - */ - public EventsGatherer(int nbWiimotes) { - events = new WiiUseApiEvent[nbWiimotes]; - } - - /** - * Add an event to the array. - * - * @param e - * the event to add. - */ - private void addEvent(WiiUseApiEvent e) { - events[index] = e; - index++; - } - - /** - * Prepare a wiimote event to add. - * - * @param id - * id of the wiimote. - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons held. - */ - public void prepareWiiMoteEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - genericEvent = new WiimoteEvent(id, buttonsJustPressed, - buttonsJustReleased, buttonsHeld); - } - - /** - * Prepare an IR event to populate. - * - * @param x - * calculated X coordinate. - * @param y - * calculated Y coordinate. - * @param z - * calculated distance. - * @param ax - * absolute X coordinate. - * @param ay - * absolute Y coordinate. - * @param xVRes - * IR virtual screen x resolution. - * @param yVRes - * IR virtual screen y resolution. - * @param xOffset - * IR X correction offset. - * @param yOffset - * IR Y correction offset. - * @param sensorBarPostion - * aspect ratio of the screen. - * @param screenAsPectRatio - * IR sensor bar position. - * @param irSensitivity - * Sensitivity of the infrared camera. - * @param distance - * Pixel Distance between first two dots. - */ - public void prepareIRevent(int x, int y, float z, int ax, int ay, - int xVRes, int yVRes, int xOffset, int yOffset, - short sensorBarPostion, short screenAsPectRatio, - short irSensitivity, float distance) { - genericEvent.prepareIRevent(x, y, z, ax, ay, xVRes, yVRes, xOffset, - yOffset, sensorBarPostion, screenAsPectRatio, irSensitivity, - distance); - - } - - /** - * Add an IR point to the WiiMoteEvent prepared. - * - * @param x - * x coordinates. - * @param y - * y coordinates. - * @param rx - * raw X coordinate (0-1023). - * @param ry - * raw Y coordinate (0-1023). - * @param size - * size of the IR dot (0-15). - */ - public void addIRPointToPreparedWiiMoteEvent(int x, int y, short rx, - short ry, short size) { - if (genericEvent != null) { - genericEvent.addIRpoint(x, y, rx, ry, size); - } - } - - /** - * Set orientation and gravity force of the prepared event. - * - * @param orientationThreshold - * value of the minimum angle between two events with the - * accelerometer. - * @param accelerationThreshold - * value of the value variation between two events with the - * accelerometer. - * @param smoothingState - * true if smoothing flag is activated. - * @param alphaSmooth - * value of the alpha smoothing parameter. - * @param r - * roll. - * @param p - * pitch. - * @param ya - * yaw. - * @param ar - * absolute roll. - * @param ap - * absolute pitch. - * @param x - * gravity force on x axis. - * @param y - * gravity force on y axis. - * @param z - * gravity force on z axis. - * @param xx - * raw acceleration on x axis. - * @param yy - * raw acceleration on y axis. - * @param zz - * raw acceleration on z axis. - */ - public void addMotionSensingValues(float orientationThreshold, - int accelerationThreshold, boolean smoothingState, - float alphaSmooth, float r, float p, float ya, float ar, float ap, - float x, float y, float z, short xx, short yy, short zz) { - if (genericEvent != null) { - genericEvent.setMotionSensingEvent(orientationThreshold, - accelerationThreshold, smoothingState, alphaSmooth, r, p, - ya, ar, ap, x, y, z, xx, yy, zz); - } - } - - /** - * Set a NunchukEvent to the prepared WiimoteEvent. - * - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param orientationThreshold - * value of the minimum angle between two events with the - * accelerometer. - * @param accelerationThreshold - * value of the value variation between two events with the - * accelerometer. - * @param smoothingState - * true if smoothing flag is activated. - * @param alphaSmooth - * value of the alpha smoothing parameter. - * @param r - * roll. - * @param p - * pitch. - * @param ya - * yaw. - * @param ar - * absolute roll. - * @param ap - * absolute pitch. - * @param x - * gravity force on x axis. - * @param y - * gravity force on y axis. - * @param z - * gravity force on z axis. - * @param xx - * raw acceleration on x axis. - * @param yy - * raw acceleration on y axis. - * @param zz - * raw acceleration on z axis. - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public void addNunchunkEventToPreparedWiimoteEvent( - short buttonsJustPressed, short buttonsJustReleased, - short buttonsHeld, float orientationThreshold, - int accelerationThreshold, boolean smoothingState, - float alphaSmooth, float r, float p, float ya, float ar, float ap, - float x, float y, float z, short xx, short yy, short zz, - float angle, float magnitude, short max1, short max2, short min1, - short min2, short center1, short center2) { - if (genericEvent != null) { - genericEvent.setNunchukEvent(buttonsJustPressed, - buttonsJustReleased, buttonsHeld, orientationThreshold, - accelerationThreshold, smoothingState, alphaSmooth, r, p, - ya, ar, ap, x, y, z, xx, yy, zz, angle, magnitude, max1, - max2, min1, min2, center1, center2); - } - } - - /** - * Set a GuitarHeroEvent to the prepared WiimoteEvent. - * - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param whammyBar - * whammy bar (range 0-1). - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public void addGuitarHeroEventToPreparedWiimoteEvent( - short buttonsJustPressed, short buttonsJustReleased, - short buttonsHeld, float whammyBar, float angle, float magnitude, - short max1, short max2, short min1, short min2, short center1, - short center2) { - if (genericEvent != null) { - genericEvent.setGuitarHeroEvent(buttonsJustPressed, - buttonsJustReleased, buttonsHeld, whammyBar, angle, - magnitude, max1, max2, min1, min2, center1, center2); - } - } - - /** - * Set a ClassicControllerEvent to the prepared WiimoteEvent. - * - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param rightShoulder - * right shoulder button (range 0-1). - * @param leftShoulder - * left shoulder button (range 0-1). - * @param langle - * angle the left joystick is being held. - * @param lmagnitude - * magnitude of the left joystick (range 0-1). - * @param lmax1 - * maximum left joystick value 1. - * @param lmax2 - * maximum left joystick value 2. - * @param lmin1 - * minimum left joystick value 1. - * @param lmin2 - * minimum left joystick value 2. - * @param lcenter1 - * center left joystick value 1. - * @param lcenter2 - * center left joystick value 2. - * @param rangle - * angle the right joystick is being held. - * @param rmagnitude - * magnitude of the right joystick (range 0-1). - * @param rmax1 - * maximum right joystick value 1. - * @param rmax2 - * maximum right joystick value 2. - * @param rmin1 - * minimum right joystick value 1. - * @param rmin2 - * minimum right joystick value 2. - * @param rcenter1 - * center right joystick value 1. - * @param rcenter2 - * center right joystick value 2. - */ - public void addClassicControllerEventToPreparedWiimoteEvent(short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, float rightShoulder, - float leftShoulder, float langle, float lmagnitude, short lmax1, - short lmax2, short lmin1, short lmin2, short lcenter1, - short lcenter2, float rangle, float rmagnitude, short rmax1, - short rmax2, short rmin1, short rmin2, short rcenter1, - short rcenter2) { - if (genericEvent != null) { - genericEvent.setClassicControllerEvent(buttonsJustPressed, - buttonsJustReleased, buttonsHeld, rightShoulder, - leftShoulder, langle, lmagnitude, lmax1, lmax2, lmin1, - lmin2, lcenter1, lcenter2, rangle, rmagnitude, rmax1, - rmax2, rmin1, rmin2, rcenter1, rcenter2); - } - } - - /** - * Add the prepared WiimoteEvent to the gatherer. - */ - public void addWiimoteEvent() { - if (genericEvent != null) { - addEvent(genericEvent); - genericEvent = null; - } - } - - /** - * Add a StatusEvent to the gatherer. - * - * @param id - * id of the wiimote. - * @param connect - * true if the wiimote is connected. - * @param batt - * battery level. - * @param led - * status of leds. - * @param speak - * speakers status. - * @param attach - * attachment status. - * @param rumbleState - * true if rumble is active. - * @param continuousState - * true if continuous flag is activated. - * @param irState - * true if ir is active. - * @param motionSensingState - * true if accelerometer is active. - */ - public void addStatusEvent(int id, boolean connect, float batt, short led, - boolean speak, int attach, boolean rumbleState, - boolean continuousState, boolean irState, boolean motionSensingState) { - StatusEvent evt = new StatusEvent(id, connect, batt, led, speak, - attach, rumbleState, continuousState, irState, - motionSensingState); - addEvent(evt); - } - - /** - * Add a DisconnectionEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addDisconnectionEvent(int id) { - DisconnectionEvent evt = new DisconnectionEvent(id); - addEvent(evt); - } - - /** - * Add a NunchukInsertedEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addNunchukInsertedEvent(int id) { - NunchukInsertedEvent evt = new NunchukInsertedEvent(id); - addEvent(evt); - } - - /** - * Add a NunchukRemovedEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addNunchukRemovedEvent(int id) { - NunchukRemovedEvent evt = new NunchukRemovedEvent(id); - addEvent(evt); - } - - /** - * Add a GuitarHeroInsertedEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addGuitarHeroInsertedEvent(int id) { - GuitarHeroInsertedEvent evt = new GuitarHeroInsertedEvent(id); - addEvent(evt); - } - - /** - * Add a GuitarHeroRemovedEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addGuitarHeroRemovedEvent(int id) { - GuitarHeroRemovedEvent evt = new GuitarHeroRemovedEvent(id); - addEvent(evt); - } - - /** - * Add a ClassicControllerInsertedEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addClassicControllerInsertedEvent(int id) { - ClassicControllerInsertedEvent evt = new ClassicControllerInsertedEvent( - id); - addEvent(evt); - } - - /** - * Add a ClassicControllerRemovedEvent to the gatherer. - * - * @param id - * id of the wiimote. - */ - public void addClassicControllerRemovedEvent(int id) { - ClassicControllerRemovedEvent evt = new ClassicControllerRemovedEvent( - id); - addEvent(evt); - } - - /** - * Return an array containing the events. - * - * @return events received. - */ - public WiiUseApiEvent[] getEvents() { - WiiUseApiEvent[] ev = new WiiUseApiEvent[index]; - System.arraycopy(events, 0, ev, 0, index); - return ev; - } - - /** - * Clear the gatherer and remove objects. - */ - public void clearEvents() { - for (int i = 0; i < events.length; i++) { - events[i] = null; - } - genericEvent = null; - index = 0; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.utils; + +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; +import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; +import wiiusej.wiiusejevents.wiiuseapievents.WiimoteEvent; + +/** + * This class is used to gather events during a call to the Wiiuse API. + * + * @author guiguito + */ +public class EventsGatherer { + + private WiiUseApiEvent[] events; + private int index = 0; + private WiimoteEvent genericEvent = null; + + /** + * Create EventsGatherer. + * + * @param nbWiimotes + * nb wiimotes (nb a of events possible in a call to Wiiuse API). + */ + public EventsGatherer(int nbWiimotes) { + events = new WiiUseApiEvent[nbWiimotes]; + } + + /** + * Add an event to the array. + * + * @param e + * the event to add. + */ + private void addEvent(WiiUseApiEvent e) { + events[index] = e; + index++; + } + + /** + * Prepare a wiimote event to add. + * + * @param id + * id of the wiimote. + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons held. + */ + public void prepareWiiMoteEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + genericEvent = new WiimoteEvent(id, buttonsJustPressed, + buttonsJustReleased, buttonsHeld); + } + + /** + * Prepare an IR event to populate. + * + * @param x + * calculated X coordinate. + * @param y + * calculated Y coordinate. + * @param z + * calculated distance. + * @param ax + * absolute X coordinate. + * @param ay + * absolute Y coordinate. + * @param xVRes + * IR virtual screen x resolution. + * @param yVRes + * IR virtual screen y resolution. + * @param xOffset + * IR X correction offset. + * @param yOffset + * IR Y correction offset. + * @param sensorBarPostion + * aspect ratio of the screen. + * @param screenAsPectRatio + * IR sensor bar position. + * @param irSensitivity + * Sensitivity of the infrared camera. + * @param distance + * Pixel Distance between first two dots. + */ + public void prepareIRevent(int x, int y, float z, int ax, int ay, + int xVRes, int yVRes, int xOffset, int yOffset, + short sensorBarPostion, short screenAsPectRatio, + short irSensitivity, float distance) { + genericEvent.prepareIRevent(x, y, z, ax, ay, xVRes, yVRes, xOffset, + yOffset, sensorBarPostion, screenAsPectRatio, irSensitivity, + distance); + + } + + /** + * Add an IR point to the WiiMoteEvent prepared. + * + * @param x + * x coordinates. + * @param y + * y coordinates. + * @param rx + * raw X coordinate (0-1023). + * @param ry + * raw Y coordinate (0-1023). + * @param size + * size of the IR dot (0-15). + */ + public void addIRPointToPreparedWiiMoteEvent(int x, int y, short rx, + short ry, short size) { + if (genericEvent != null) { + genericEvent.addIRpoint(x, y, rx, ry, size); + } + } + + /** + * Set orientation and gravity force of the prepared event. + * + * @param orientationThreshold + * value of the minimum angle between two events with the + * accelerometer. + * @param accelerationThreshold + * value of the value variation between two events with the + * accelerometer. + * @param smoothingState + * true if smoothing flag is activated. + * @param alphaSmooth + * value of the alpha smoothing parameter. + * @param r + * roll. + * @param p + * pitch. + * @param ya + * yaw. + * @param ar + * absolute roll. + * @param ap + * absolute pitch. + * @param x + * gravity force on x axis. + * @param y + * gravity force on y axis. + * @param z + * gravity force on z axis. + * @param xx + * raw acceleration on x axis. + * @param yy + * raw acceleration on y axis. + * @param zz + * raw acceleration on z axis. + */ + public void addMotionSensingValues(float orientationThreshold, + int accelerationThreshold, boolean smoothingState, + float alphaSmooth, float r, float p, float ya, float ar, float ap, + float x, float y, float z, short xx, short yy, short zz) { + if (genericEvent != null) { + genericEvent.setMotionSensingEvent(orientationThreshold, + accelerationThreshold, smoothingState, alphaSmooth, r, p, + ya, ar, ap, x, y, z, xx, yy, zz); + } + } + + /** + * Set a NunchukEvent to the prepared WiimoteEvent. + * + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param orientationThreshold + * value of the minimum angle between two events with the + * accelerometer. + * @param accelerationThreshold + * value of the value variation between two events with the + * accelerometer. + * @param smoothingState + * true if smoothing flag is activated. + * @param alphaSmooth + * value of the alpha smoothing parameter. + * @param r + * roll. + * @param p + * pitch. + * @param ya + * yaw. + * @param ar + * absolute roll. + * @param ap + * absolute pitch. + * @param x + * gravity force on x axis. + * @param y + * gravity force on y axis. + * @param z + * gravity force on z axis. + * @param xx + * raw acceleration on x axis. + * @param yy + * raw acceleration on y axis. + * @param zz + * raw acceleration on z axis. + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public void addNunchunkEventToPreparedWiimoteEvent( + short buttonsJustPressed, short buttonsJustReleased, + short buttonsHeld, float orientationThreshold, + int accelerationThreshold, boolean smoothingState, + float alphaSmooth, float r, float p, float ya, float ar, float ap, + float x, float y, float z, short xx, short yy, short zz, + float angle, float magnitude, short max1, short max2, short min1, + short min2, short center1, short center2) { + if (genericEvent != null) { + genericEvent.setNunchukEvent(buttonsJustPressed, + buttonsJustReleased, buttonsHeld, orientationThreshold, + accelerationThreshold, smoothingState, alphaSmooth, r, p, + ya, ar, ap, x, y, z, xx, yy, zz, angle, magnitude, max1, + max2, min1, min2, center1, center2); + } + } + + /** + * Set a GuitarHeroEvent to the prepared WiimoteEvent. + * + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param whammyBar + * whammy bar (range 0-1). + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public void addGuitarHeroEventToPreparedWiimoteEvent( + short buttonsJustPressed, short buttonsJustReleased, + short buttonsHeld, float whammyBar, float angle, float magnitude, + short max1, short max2, short min1, short min2, short center1, + short center2) { + if (genericEvent != null) { + genericEvent.setGuitarHeroEvent(buttonsJustPressed, + buttonsJustReleased, buttonsHeld, whammyBar, angle, + magnitude, max1, max2, min1, min2, center1, center2); + } + } + + /** + * Set a ClassicControllerEvent to the prepared WiimoteEvent. + * + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param rightShoulder + * right shoulder button (range 0-1). + * @param leftShoulder + * left shoulder button (range 0-1). + * @param langle + * angle the left joystick is being held. + * @param lmagnitude + * magnitude of the left joystick (range 0-1). + * @param lmax1 + * maximum left joystick value 1. + * @param lmax2 + * maximum left joystick value 2. + * @param lmin1 + * minimum left joystick value 1. + * @param lmin2 + * minimum left joystick value 2. + * @param lcenter1 + * center left joystick value 1. + * @param lcenter2 + * center left joystick value 2. + * @param rangle + * angle the right joystick is being held. + * @param rmagnitude + * magnitude of the right joystick (range 0-1). + * @param rmax1 + * maximum right joystick value 1. + * @param rmax2 + * maximum right joystick value 2. + * @param rmin1 + * minimum right joystick value 1. + * @param rmin2 + * minimum right joystick value 2. + * @param rcenter1 + * center right joystick value 1. + * @param rcenter2 + * center right joystick value 2. + */ + public void addClassicControllerEventToPreparedWiimoteEvent(short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, float rightShoulder, + float leftShoulder, float langle, float lmagnitude, short lmax1, + short lmax2, short lmin1, short lmin2, short lcenter1, + short lcenter2, float rangle, float rmagnitude, short rmax1, + short rmax2, short rmin1, short rmin2, short rcenter1, + short rcenter2) { + if (genericEvent != null) { + genericEvent.setClassicControllerEvent(buttonsJustPressed, + buttonsJustReleased, buttonsHeld, rightShoulder, + leftShoulder, langle, lmagnitude, lmax1, lmax2, lmin1, + lmin2, lcenter1, lcenter2, rangle, rmagnitude, rmax1, + rmax2, rmin1, rmin2, rcenter1, rcenter2); + } + } + + /** + * Add the prepared WiimoteEvent to the gatherer. + */ + public void addWiimoteEvent() { + if (genericEvent != null) { + addEvent(genericEvent); + genericEvent = null; + } + } + + /** + * Add a StatusEvent to the gatherer. + * + * @param id + * id of the wiimote. + * @param connect + * true if the wiimote is connected. + * @param batt + * battery level. + * @param led + * status of leds. + * @param speak + * speakers status. + * @param attach + * attachment status. + * @param rumbleState + * true if rumble is active. + * @param continuousState + * true if continuous flag is activated. + * @param irState + * true if ir is active. + * @param motionSensingState + * true if accelerometer is active. + */ + public void addStatusEvent(int id, boolean connect, float batt, short led, + boolean speak, int attach, boolean rumbleState, + boolean continuousState, boolean irState, boolean motionSensingState) { + StatusEvent evt = new StatusEvent(id, connect, batt, led, speak, + attach, rumbleState, continuousState, irState, + motionSensingState); + addEvent(evt); + } + + /** + * Add a DisconnectionEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addDisconnectionEvent(int id) { + DisconnectionEvent evt = new DisconnectionEvent(id); + addEvent(evt); + } + + /** + * Add a NunchukInsertedEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addNunchukInsertedEvent(int id) { + NunchukInsertedEvent evt = new NunchukInsertedEvent(id); + addEvent(evt); + } + + /** + * Add a NunchukRemovedEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addNunchukRemovedEvent(int id) { + NunchukRemovedEvent evt = new NunchukRemovedEvent(id); + addEvent(evt); + } + + /** + * Add a GuitarHeroInsertedEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addGuitarHeroInsertedEvent(int id) { + GuitarHeroInsertedEvent evt = new GuitarHeroInsertedEvent(id); + addEvent(evt); + } + + /** + * Add a GuitarHeroRemovedEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addGuitarHeroRemovedEvent(int id) { + GuitarHeroRemovedEvent evt = new GuitarHeroRemovedEvent(id); + addEvent(evt); + } + + /** + * Add a ClassicControllerInsertedEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addClassicControllerInsertedEvent(int id) { + ClassicControllerInsertedEvent evt = new ClassicControllerInsertedEvent( + id); + addEvent(evt); + } + + /** + * Add a ClassicControllerRemovedEvent to the gatherer. + * + * @param id + * id of the wiimote. + */ + public void addClassicControllerRemovedEvent(int id) { + ClassicControllerRemovedEvent evt = new ClassicControllerRemovedEvent( + id); + addEvent(evt); + } + + /** + * Return an array containing the events. + * + * @return events received. + */ + public WiiUseApiEvent[] getEvents() { + WiiUseApiEvent[] ev = new WiiUseApiEvent[index]; + System.arraycopy(events, 0, ev, 0, index); + return ev; + } + + /** + * Clear the gatherer and remove objects. + */ + public void clearEvents() { + for (int i = 0; i < events.length; i++) { + events[i] = null; + } + genericEvent = null; + index = 0; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/utils/WiiUseApiListener.java b/src/main/java/wiiusej/wiiusejevents/utils/WiiUseApiListener.java similarity index 97% rename from WiiUseJ/src/wiiusej/wiiusejevents/utils/WiiUseApiListener.java rename to src/main/java/wiiusej/wiiusejevents/utils/WiiUseApiListener.java index ee1ce80..b38f0f5 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/utils/WiiUseApiListener.java +++ b/src/main/java/wiiusej/wiiusejevents/utils/WiiUseApiListener.java @@ -1,37 +1,37 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.utils; - -import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; - -/** - * This is the interface to implement to listen to events from the wiiuse API. - * - * @author guiguito - */ -public interface WiiUseApiListener extends java.util.EventListener { - - /** - * Method called when a WiiUseApiEvent occurs. A WiiUseApiEvent can be : - - * WiimoteEvent (Storing ButtonsEvent and eventually IREvent and - * MotionSensingEvent) - StatusEvent - DisconnectionEvent - * - * @param e - */ - void onWiiUseApiEvent(WiiUseApiEvent e); - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.utils; + +import wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent; + +/** + * This is the interface to implement to listen to events from the wiiuse API. + * + * @author guiguito + */ +public interface WiiUseApiListener extends java.util.EventListener { + + /** + * Method called when a WiiUseApiEvent occurs. A WiiUseApiEvent can be : - + * WiimoteEvent (Storing ButtonsEvent and eventually IREvent and + * MotionSensingEvent) - StatusEvent - DisconnectionEvent + * + * @param e + */ + void onWiiUseApiEvent(WiiUseApiEvent e); + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/utils/WiimoteListener.java b/src/main/java/wiiusej/wiiusejevents/utils/WiimoteListener.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/utils/WiimoteListener.java rename to src/main/java/wiiusej/wiiusejevents/utils/WiimoteListener.java index fd1017f..d97293d 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/utils/WiimoteListener.java +++ b/src/main/java/wiiusej/wiiusejevents/utils/WiimoteListener.java @@ -1,145 +1,145 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.utils; - -import wiiusej.wiiusejevents.physicalevents.ExpansionEvent; -import wiiusej.wiiusejevents.physicalevents.IREvent; -import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent; -import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; - -/** - * This is the interface to implement to listen to events from wiimotes. The - * differents methods are called in this order : onButtonsEvent, onIrEvent, - * onMotionSensingEvent, onExpansionEvent, onStatusEvent, onDisconnectionEvent - * onNunchukInsertedEvent, onNunchukRemovedEvent. - * - * @author guiguito - */ -public interface WiimoteListener extends java.util.EventListener { - - /** - * Method called on a button Event. - * - * @param e - * the buttonEvent with the last informations about the buttons - * of the wiimote. - */ - void onButtonsEvent(WiimoteButtonsEvent e); - - /** - * Method called when an IR event occurs. - * - * @param e - * the IREvent with the IR points seen. - */ - void onIrEvent(IREvent e); - - /** - * Method called when a motion sensing event occurs. - * - * @param e - * the motion sensing event with orientation and acceleration. - */ - void onMotionSensingEvent(MotionSensingEvent e); - - /** - * Method called when an expansion event occurs. - * - * @param e - * the expansion event occured. - */ - void onExpansionEvent(ExpansionEvent e); - - /** - * Method called on a status event. A status event occurs when : - we ask it - - * an expansion controller has been plugged - an expansion controller has - * been unplugged This is where you can get the different values of the - * parameters setup on your wiimote. - * - * @param e - * the status event. - */ - void onStatusEvent(StatusEvent e); - - /** - * This is the method called when a disconnection event occurs. A - * disconnection event happens when : - there are no battery left - the - * wiimote has just been turned off - the connection is dropped - * - * @param e - * the disconnection event. - */ - void onDisconnectionEvent(DisconnectionEvent e); - - /** - * This is the method called when a NunchukInsertedEvent occurs. - * - * @param e - * the NunchukInsertedEvent. - */ - void onNunchukInsertedEvent(NunchukInsertedEvent e); - - /** - * This is the method called when a NunchukRemovedEvent occurs. - * - * @param e - * the NunchukRemovedEvent. - */ - void onNunchukRemovedEvent(NunchukRemovedEvent e); - - - /** - * This is the method called when a GuitarHeroInsertedEvent occurs. - * - * @param e - * the GuitarHeroInsertedEvent. - */ - void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent e); - - /** - * This is the method called when a GuitarHeroRemovedEvent occurs. - * - * @param e - * the GuitarHeroRemovedEvent. - */ - void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent e); - - /** - * This is the method called when a ClassicControllerInsertedEvent occurs. - * - * @param e - * the ClassicControllerInsertedEvent. - */ - void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent e); - - /** - * This is the method called when a ClassicControllerRemovedEvent occurs. - * - * @param e - * the ClassicControllerRemovedEvent. - */ - void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent e); - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.utils; + +import wiiusej.wiiusejevents.physicalevents.ExpansionEvent; +import wiiusej.wiiusejevents.physicalevents.IREvent; +import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent; +import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; + +/** + * This is the interface to implement to listen to events from wiimotes. The + * differents methods are called in this order : onButtonsEvent, onIrEvent, + * onMotionSensingEvent, onExpansionEvent, onStatusEvent, onDisconnectionEvent + * onNunchukInsertedEvent, onNunchukRemovedEvent. + * + * @author guiguito + */ +public interface WiimoteListener extends java.util.EventListener { + + /** + * Method called on a button Event. + * + * @param e + * the buttonEvent with the last informations about the buttons + * of the wiimote. + */ + void onButtonsEvent(WiimoteButtonsEvent e); + + /** + * Method called when an IR event occurs. + * + * @param e + * the IREvent with the IR points seen. + */ + void onIrEvent(IREvent e); + + /** + * Method called when a motion sensing event occurs. + * + * @param e + * the motion sensing event with orientation and acceleration. + */ + void onMotionSensingEvent(MotionSensingEvent e); + + /** + * Method called when an expansion event occurs. + * + * @param e + * the expansion event occured. + */ + void onExpansionEvent(ExpansionEvent e); + + /** + * Method called on a status event. A status event occurs when : - we ask it - + * an expansion controller has been plugged - an expansion controller has + * been unplugged This is where you can get the different values of the + * parameters setup on your wiimote. + * + * @param e + * the status event. + */ + void onStatusEvent(StatusEvent e); + + /** + * This is the method called when a disconnection event occurs. A + * disconnection event happens when : - there are no battery left - the + * wiimote has just been turned off - the connection is dropped + * + * @param e + * the disconnection event. + */ + void onDisconnectionEvent(DisconnectionEvent e); + + /** + * This is the method called when a NunchukInsertedEvent occurs. + * + * @param e + * the NunchukInsertedEvent. + */ + void onNunchukInsertedEvent(NunchukInsertedEvent e); + + /** + * This is the method called when a NunchukRemovedEvent occurs. + * + * @param e + * the NunchukRemovedEvent. + */ + void onNunchukRemovedEvent(NunchukRemovedEvent e); + + + /** + * This is the method called when a GuitarHeroInsertedEvent occurs. + * + * @param e + * the GuitarHeroInsertedEvent. + */ + void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent e); + + /** + * This is the method called when a GuitarHeroRemovedEvent occurs. + * + * @param e + * the GuitarHeroRemovedEvent. + */ + void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent e); + + /** + * This is the method called when a ClassicControllerInsertedEvent occurs. + * + * @param e + * the ClassicControllerInsertedEvent. + */ + void onClassicControllerInsertedEvent(ClassicControllerInsertedEvent e); + + /** + * This is the method called when a ClassicControllerRemovedEvent occurs. + * + * @param e + * the ClassicControllerRemovedEvent. + */ + void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent e); + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java index 5480c04..f61be56 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerInsertedEvent.java @@ -1,46 +1,46 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Event that represents the connection of a classic controller to a wiimote. - * - * @author guiguito - * - */ -public class ClassicControllerInsertedEvent extends WiiUseApiEvent { - - /** - * Construct the ClassicControllerInsertedEvent setting up the id. - * - * @param id - * id of the wiimote. - */ - public ClassicControllerInsertedEvent(int id) { - super(id, WIIUSE_CLASSIC_CTRL_INSERTED); - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** CLASSIC CONTROLLER INSERTED EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Event that represents the connection of a classic controller to a wiimote. + * + * @author guiguito + * + */ +public class ClassicControllerInsertedEvent extends WiiUseApiEvent { + + /** + * Construct the ClassicControllerInsertedEvent setting up the id. + * + * @param id + * id of the wiimote. + */ + public ClassicControllerInsertedEvent(int id) { + super(id, WIIUSE_CLASSIC_CTRL_INSERTED); + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** CLASSIC CONTROLLER INSERTED EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java index c0c72b2..d3407bc 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/ClassicControllerRemovedEvent.java @@ -1,47 +1,47 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Event that represents the disconnection of a classic controller from a - * wiimote. - * - * @author guiguito - * - */ -public class ClassicControllerRemovedEvent extends WiiUseApiEvent { - - /** - * Construct the ClassicControllerRemovedEvent setting up the id. - * - * @param id - * id of the wiimote. - */ - public ClassicControllerRemovedEvent(int id) { - super(id, WIIUSE_CLASSIC_CTRL_REMOVED); - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** CLASSIC CONTROLLER REMOVED EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Event that represents the disconnection of a classic controller from a + * wiimote. + * + * @author guiguito + * + */ +public class ClassicControllerRemovedEvent extends WiiUseApiEvent { + + /** + * Construct the ClassicControllerRemovedEvent setting up the id. + * + * @param id + * id of the wiimote. + */ + public ClassicControllerRemovedEvent(int id) { + super(id, WIIUSE_CLASSIC_CTRL_REMOVED); + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** CLASSIC CONTROLLER REMOVED EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java index 1c844c7..660642f 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/DisconnectionEvent.java @@ -1,45 +1,45 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Class representing a disconnection event. - * - * @author guiguito - */ -public class DisconnectionEvent extends WiiUseApiEvent { - - /** - * Construct the DisconnectionEvent setting up the id. - * - * @param id - * the Wiimote id - */ - public DisconnectionEvent(int id) { - super(id, WiiUseApiEvent.DISCONNECTION_EVENT); - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** DISCONNECTION EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Class representing a disconnection event. + * + * @author guiguito + */ +public class DisconnectionEvent extends WiiUseApiEvent { + + /** + * Construct the DisconnectionEvent setting up the id. + * + * @param id + * the Wiimote id + */ + public DisconnectionEvent(int id) { + super(id, WiiUseApiEvent.DISCONNECTION_EVENT); + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** DISCONNECTION EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java index 18eda40..4fb041e 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroInsertedEvent.java @@ -1,47 +1,47 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Event that represents the connection of a Guitar hero controller to a - * wiimote. - * - * @author guiguito - * - */ -public class GuitarHeroInsertedEvent extends WiiUseApiEvent { - - /** - * Construct the GuitarHeroInsertedEvent setting up the id. - * - * @param id - * id of the wiimote. - */ - public GuitarHeroInsertedEvent(int id) { - super(id, WIIUSE_GUITAR_HERO_3_CTRL_INSERTED); - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** GUITAR HERO INSERTED EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Event that represents the connection of a Guitar hero controller to a + * wiimote. + * + * @author guiguito + * + */ +public class GuitarHeroInsertedEvent extends WiiUseApiEvent { + + /** + * Construct the GuitarHeroInsertedEvent setting up the id. + * + * @param id + * id of the wiimote. + */ + public GuitarHeroInsertedEvent(int id) { + super(id, WIIUSE_GUITAR_HERO_3_CTRL_INSERTED); + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** GUITAR HERO INSERTED EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java index e5ab258..c8c6a95 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/GuitarHeroRemovedEvent.java @@ -1,47 +1,47 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Event that represents the disconnection of a guitar hero controller from a - * wiimote. - * - * @author guiguito - * - */ -public class GuitarHeroRemovedEvent extends WiiUseApiEvent { - - /** - * Construct the GuitarHeroRemovedEvent setting up the id. - * - * @param id - * id of the wiimote. - */ - public GuitarHeroRemovedEvent(int id) { - super(id, WIIUSE_GUITAR_HERO_3_CTRL_REMOVED); - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** GUITAR HERO REMOVED EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Event that represents the disconnection of a guitar hero controller from a + * wiimote. + * + * @author guiguito + * + */ +public class GuitarHeroRemovedEvent extends WiiUseApiEvent { + + /** + * Construct the GuitarHeroRemovedEvent setting up the id. + * + * @param id + * id of the wiimote. + */ + public GuitarHeroRemovedEvent(int id) { + super(id, WIIUSE_GUITAR_HERO_3_CTRL_REMOVED); + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** GUITAR HERO REMOVED EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java index 6aff636..a4a388b 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/NunchukInsertedEvent.java @@ -1,51 +1,51 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Event that represents the connection of a nunchuk to a wiimote. - * - * @author guiguito - * - */ -public class NunchukInsertedEvent extends WiiUseApiEvent { - - /** - * Construct the NunchukInsertedEvent setting up the id. - * - * @param id - * id of the wiimote. - */ - public NunchukInsertedEvent(int id) { - super(id, WIIUSE_NUNCHUK_INSERTED); - } - - /* - * (non-Javadoc) - * - * @see wiiusej.wiiusejevents.WiiUseApiEvent#toString() - */ - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** NUNCHUK INSERTED EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Event that represents the connection of a nunchuk to a wiimote. + * + * @author guiguito + * + */ +public class NunchukInsertedEvent extends WiiUseApiEvent { + + /** + * Construct the NunchukInsertedEvent setting up the id. + * + * @param id + * id of the wiimote. + */ + public NunchukInsertedEvent(int id) { + super(id, WIIUSE_NUNCHUK_INSERTED); + } + + /* + * (non-Javadoc) + * + * @see wiiusej.wiiusejevents.WiiUseApiEvent#toString() + */ + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** NUNCHUK INSERTED EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java index 869207a..9173c86 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/NunchukRemovedEvent.java @@ -1,50 +1,50 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Event that represents the disconnection of a nunchuk from a wiimote. - * - * @author guiguito - */ -public class NunchukRemovedEvent extends WiiUseApiEvent { - - /** - * Construct the NunchukInsertedEvent setting up the id. - * - * @param id - * id of the wiimote. - */ - public NunchukRemovedEvent(int id) { - super(id, WIIUSE_NUNCHUK_REMOVED); - } - - /* - * (non-Javadoc) - * - * @see wiiusej.wiiusejevents.WiiUseApiEvent#toString() - */ - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** NUNCHUK REMOVED EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Event that represents the disconnection of a nunchuk from a wiimote. + * + * @author guiguito + */ +public class NunchukRemovedEvent extends WiiUseApiEvent { + + /** + * Construct the NunchukInsertedEvent setting up the id. + * + * @param id + * id of the wiimote. + */ + public NunchukRemovedEvent(int id) { + super(id, WIIUSE_NUNCHUK_REMOVED); + } + + /* + * (non-Javadoc) + * + * @see wiiusej.wiiusejevents.WiiUseApiEvent#toString() + */ + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** NUNCHUK REMOVED EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java similarity index 95% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java index d200bb7..4544845 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/StatusEvent.java @@ -1,293 +1,293 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -/** - * Class used to represent a status event. This class is used to know what are - * the settings of the wiimote. - * - * @author guiguito - */ -public class StatusEvent extends WiiUseApiEvent { - - protected static short WIIMOTE_LED_1 = 1; - protected static short WIIMOTE_LED_2 = 2; - protected static short WIIMOTE_LED_3 = 4; - protected static short WIIMOTE_LED_4 = 8; - - /* ATTACHMENT CONSTANTS */ - - private static short EXP_NONE = 0; - private static short EXP_NUNCHUK = 1; - private static short EXP_CLASSIC = 2; - private static short EXP_GUITAR_HERO_3 = 3; - - /* Status variables */ - private boolean connected = false; - - private float batteryLevel = -1; - - private short leds = 0; - - private boolean isSpeakerEnabled = false; - - private int attachment = 0; - - private boolean isRumbleActive = false; - - private boolean isContinuousActive = false; - - private boolean isIrActive = false; - - private boolean isMotionSensingActive = false; - - /** - * Construct the StatusEvent setting up the id. - * - * @param id - * the Wiimote id - */ - public StatusEvent(int id) { - super(id, WiiUseApiEvent.STATUS_EVENT); - } - - /** - * Build a StatusEvent with all fields set. - * - * @param id - * id of the wiimote - * @param connect - * true if the wiimote is connected - * @param batt - * battery level - * @param led - * status of leds - * @param speak - * speakers status - * @param attach - * attachment status - * @param rumbleState - * true if rumble is active - * @param continuousState - * true if continuous flag is activated - * @param irState - * true if ir is active - * @param motionSensingState - * true if accelerometer is active - */ - public StatusEvent(int id, boolean connect, float batt, short led, - boolean speak, int attach, boolean rumbleState, - boolean continuousState, boolean irState, boolean motionSensingState) { - super(id, WiiUseApiEvent.STATUS_EVENT); - connected = connect; - this.batteryLevel = batt; - this.leds = led; - this.isSpeakerEnabled = speak; - this.attachment = attach; - isRumbleActive = rumbleState; - isContinuousActive = continuousState; - isIrActive = irState; - isMotionSensingActive = motionSensingState; - } - - /** - * True if the wiimote is connected false otherwise. - * - * @return return the connected status. - */ - public boolean isConnected() { - return connected; - } - - /** - * Get battery level. - * - * @return battery level. 1 = 100% - */ - public float getBatteryLevel() { - return batteryLevel; - } - - /** - * Get status of the leds . - * - * @return a short representing LEDS turned on. - */ - public short getLeds() { - return leds; - } - - /** - * Tells if the given led is turned on according to the leds status int. - * - * @param led - * the int encoding a led. - * @return true if the led is turned on false otherwise. - */ - private boolean ledStatusCheck(short led) { - if ((leds & led) > 0) { - return true; - } else { - return false; - } - } - - /** - * Get led1 status. - * - * @return true if the led is set. - */ - public boolean isLed1Set() { - return ledStatusCheck(WIIMOTE_LED_1); - } - - /** - * Get led2 status. - * - * @return true if the led is set. - */ - public boolean isLed2Set() { - return ledStatusCheck(WIIMOTE_LED_2); - } - - /** - * Get led3 status. - * - * @return true if the led is set. - */ - public boolean isLed3Set() { - return ledStatusCheck(WIIMOTE_LED_3); - } - - /** - * Get led4 status. - * - * @return true if the led is set. - */ - public boolean isLed4Set() { - return ledStatusCheck(WIIMOTE_LED_4); - } - - /** - * Tell if the speaker is enable for this wiimote - * - * @return TRUE if it enabled false otherwise - */ - public boolean isSpeakerEnabled() { - return isSpeakerEnabled; - } - - /** - * Get the int representing the attachment type. - * - * @return value of the Attachment Type - */ - public int getAttachment() { - return attachment; - } - - /** - * Get the status of rumble. - * - * @return true if the rumble is active false otherwise - */ - public boolean isRumbleActive() { - return isRumbleActive; - } - - /** - * Tell if the CONTINUOUS option is activated. - * - * @return the isContinuousActive - */ - public boolean isContinuousActive() { - return isContinuousActive; - } - - /** - * Tell if the IR Tracking is active. - * - * @return TRUE if it is active or false otherwise. - */ - public boolean isIrActive() { - return isIrActive; - } - - /** - * Get the flag indicating if the motion sensing is active. - * - * @return true if the motion sensing is active false otherwise - */ - public boolean isMotionSensingActive() { - return isMotionSensingActive; - } - - /** - * Tells if an attachment is connected. - * - * @return true if anything is connected to the wiimote false otherwise. - */ - public boolean isAttachmentConnected() { - return attachment == EXP_NONE; - } - - /** - * Tells if a nunchuk is connected. - * - * @return true if a nunchuk is connected to the wiimote false otherwise. - */ - public boolean isNunchukConnected() { - return attachment == EXP_NUNCHUK; - } - - /** - * Tells if a classic controller is connected. - * - * @return true if a classic controller is connected to the wiimote false otherwise. - */ - public boolean isClassicControllerConnected() { - return attachment == EXP_CLASSIC; - } - - /** - * Tells if a guitar hero controller is connected. - * - * @return true if a guitar hero controllerr is connected to the wiimote false otherwise. - */ - public boolean isGuitarHeroConnected() { - return attachment == EXP_GUITAR_HERO_3; - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** STATUS EVENT : WIIMOTE ID :" - + super.getWiimoteId() + " ********/\n"; - out += "--- connected : " + connected + "\n"; - out += "--- Battery level : " + batteryLevel + "\n"; - out += "--- Leds : " + leds + "\n"; - out += "--- Speaker enabled : " + isSpeakerEnabled + "\n"; - out += "--- Attachment ? : " + attachment + "\n"; - out += "--- Rumble ? : " + isRumbleActive + "\n"; - out += "--- Continuous ? : " + isContinuousActive + "\n"; - out += "--- IR active ? : " + isIrActive + "\n"; - out += "--- Motion sensing active ? : " + isMotionSensingActive + "\n"; - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +/** + * Class used to represent a status event. This class is used to know what are + * the settings of the wiimote. + * + * @author guiguito + */ +public class StatusEvent extends WiiUseApiEvent { + + protected static short WIIMOTE_LED_1 = 1; + protected static short WIIMOTE_LED_2 = 2; + protected static short WIIMOTE_LED_3 = 4; + protected static short WIIMOTE_LED_4 = 8; + + /* ATTACHMENT CONSTANTS */ + + private static short EXP_NONE = 0; + private static short EXP_NUNCHUK = 1; + private static short EXP_CLASSIC = 2; + private static short EXP_GUITAR_HERO_3 = 3; + + /* Status variables */ + private boolean connected = false; + + private float batteryLevel = -1; + + private short leds = 0; + + private boolean isSpeakerEnabled = false; + + private int attachment = 0; + + private boolean isRumbleActive = false; + + private boolean isContinuousActive = false; + + private boolean isIrActive = false; + + private boolean isMotionSensingActive = false; + + /** + * Construct the StatusEvent setting up the id. + * + * @param id + * the Wiimote id + */ + public StatusEvent(int id) { + super(id, WiiUseApiEvent.STATUS_EVENT); + } + + /** + * Build a StatusEvent with all fields set. + * + * @param id + * id of the wiimote + * @param connect + * true if the wiimote is connected + * @param batt + * battery level + * @param led + * status of leds + * @param speak + * speakers status + * @param attach + * attachment status + * @param rumbleState + * true if rumble is active + * @param continuousState + * true if continuous flag is activated + * @param irState + * true if ir is active + * @param motionSensingState + * true if accelerometer is active + */ + public StatusEvent(int id, boolean connect, float batt, short led, + boolean speak, int attach, boolean rumbleState, + boolean continuousState, boolean irState, boolean motionSensingState) { + super(id, WiiUseApiEvent.STATUS_EVENT); + connected = connect; + this.batteryLevel = batt; + this.leds = led; + this.isSpeakerEnabled = speak; + this.attachment = attach; + isRumbleActive = rumbleState; + isContinuousActive = continuousState; + isIrActive = irState; + isMotionSensingActive = motionSensingState; + } + + /** + * True if the wiimote is connected false otherwise. + * + * @return return the connected status. + */ + public boolean isConnected() { + return connected; + } + + /** + * Get battery level. + * + * @return battery level. 1 = 100% + */ + public float getBatteryLevel() { + return batteryLevel; + } + + /** + * Get status of the leds . + * + * @return a short representing LEDS turned on. + */ + public short getLeds() { + return leds; + } + + /** + * Tells if the given led is turned on according to the leds status int. + * + * @param led + * the int encoding a led. + * @return true if the led is turned on false otherwise. + */ + private boolean ledStatusCheck(short led) { + if ((leds & led) > 0) { + return true; + } else { + return false; + } + } + + /** + * Get led1 status. + * + * @return true if the led is set. + */ + public boolean isLed1Set() { + return ledStatusCheck(WIIMOTE_LED_1); + } + + /** + * Get led2 status. + * + * @return true if the led is set. + */ + public boolean isLed2Set() { + return ledStatusCheck(WIIMOTE_LED_2); + } + + /** + * Get led3 status. + * + * @return true if the led is set. + */ + public boolean isLed3Set() { + return ledStatusCheck(WIIMOTE_LED_3); + } + + /** + * Get led4 status. + * + * @return true if the led is set. + */ + public boolean isLed4Set() { + return ledStatusCheck(WIIMOTE_LED_4); + } + + /** + * Tell if the speaker is enable for this wiimote + * + * @return TRUE if it enabled false otherwise + */ + public boolean isSpeakerEnabled() { + return isSpeakerEnabled; + } + + /** + * Get the int representing the attachment type. + * + * @return value of the Attachment Type + */ + public int getAttachment() { + return attachment; + } + + /** + * Get the status of rumble. + * + * @return true if the rumble is active false otherwise + */ + public boolean isRumbleActive() { + return isRumbleActive; + } + + /** + * Tell if the CONTINUOUS option is activated. + * + * @return the isContinuousActive + */ + public boolean isContinuousActive() { + return isContinuousActive; + } + + /** + * Tell if the IR Tracking is active. + * + * @return TRUE if it is active or false otherwise. + */ + public boolean isIrActive() { + return isIrActive; + } + + /** + * Get the flag indicating if the motion sensing is active. + * + * @return true if the motion sensing is active false otherwise + */ + public boolean isMotionSensingActive() { + return isMotionSensingActive; + } + + /** + * Tells if an attachment is connected. + * + * @return true if anything is connected to the wiimote false otherwise. + */ + public boolean isAttachmentConnected() { + return attachment == EXP_NONE; + } + + /** + * Tells if a nunchuk is connected. + * + * @return true if a nunchuk is connected to the wiimote false otherwise. + */ + public boolean isNunchukConnected() { + return attachment == EXP_NUNCHUK; + } + + /** + * Tells if a classic controller is connected. + * + * @return true if a classic controller is connected to the wiimote false otherwise. + */ + public boolean isClassicControllerConnected() { + return attachment == EXP_CLASSIC; + } + + /** + * Tells if a guitar hero controller is connected. + * + * @return true if a guitar hero controllerr is connected to the wiimote false otherwise. + */ + public boolean isGuitarHeroConnected() { + return attachment == EXP_GUITAR_HERO_3; + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** STATUS EVENT : WIIMOTE ID :" + + super.getWiimoteId() + " ********/\n"; + out += "--- connected : " + connected + "\n"; + out += "--- Battery level : " + batteryLevel + "\n"; + out += "--- Leds : " + leds + "\n"; + out += "--- Speaker enabled : " + isSpeakerEnabled + "\n"; + out += "--- Attachment ? : " + attachment + "\n"; + out += "--- Rumble ? : " + isRumbleActive + "\n"; + out += "--- Continuous ? : " + isContinuousActive + "\n"; + out += "--- IR active ? : " + isIrActive + "\n"; + out += "--- Motion sensing active ? : " + isMotionSensingActive + "\n"; + return out; + } + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java index 0527b13..c4f001d 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/WiiUseApiEvent.java @@ -1,66 +1,66 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -import wiiusej.wiiusejevents.GenericEvent; - -/** - * This class describes the structure of an event from the WiiUse API event. - * - * @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; - public static int DISCONNECTION_EVENT = 3; - public static int WIIUSE_READ_DATA = 4; - public static int WIIUSE_NUNCHUK_INSERTED = 5; - public static int WIIUSE_NUNCHUK_REMOVED = 6; - public static int WIIUSE_CLASSIC_CTRL_INSERTED = 7; - 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; - - /* Event Type */ - private int eventType; - - /** - * Construct the WiiUseApiEvent setting up the id. - * - * @param id - * the Wiimote id - * @param type - * type of the event - */ - public WiiUseApiEvent(int id, int type) { - super(id); - eventType = type; - } - - /** - * Get the event type. - * @return the eventType - */ - public int getEventType() { - return eventType; - } - - public abstract String toString(); - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +import wiiusej.wiiusejevents.GenericEvent; + +/** + * This class describes the structure of an event from the WiiUse API event. + * + * @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; + public static int DISCONNECTION_EVENT = 3; + public static int WIIUSE_READ_DATA = 4; + public static int WIIUSE_NUNCHUK_INSERTED = 5; + public static int WIIUSE_NUNCHUK_REMOVED = 6; + public static int WIIUSE_CLASSIC_CTRL_INSERTED = 7; + 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; + + /* Event Type */ + private int eventType; + + /** + * Construct the WiiUseApiEvent setting up the id. + * + * @param id + * the Wiimote id + * @param type + * type of the event + */ + public WiiUseApiEvent(int id, int type) { + super(id); + eventType = type; + } + + /** + * Get the event type. + * @return the eventType + */ + public int getEventType() { + return eventType; + } + + public abstract String toString(); + +} diff --git a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java similarity index 96% rename from WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java rename to src/main/java/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java index d1dfb7e..582b33b 100644 --- a/WiiUseJ/src/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java +++ b/src/main/java/wiiusej/wiiusejevents/wiiuseapievents/WiimoteEvent.java @@ -1,441 +1,441 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.wiiusejevents.wiiuseapievents; - -import wiiusej.wiiusejevents.physicalevents.ClassicControllerEvent; -import wiiusej.wiiusejevents.physicalevents.ExpansionEvent; -import wiiusej.wiiusejevents.physicalevents.GuitarHeroEvent; -import wiiusej.wiiusejevents.physicalevents.IREvent; -import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent; -import wiiusej.wiiusejevents.physicalevents.NunchukEvent; -import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent; - -/** - * Class that is a bean to be filled by the wiiuse API on an event that occurs - * on a wiimote. - * - * @author guiguito - */ -public class WiimoteEvent extends WiiUseApiEvent { - - private WiimoteButtonsEvent buttonsEvent = null; - private IREvent infraredEvent = null; - private MotionSensingEvent motionSensingEvent = null; - private ExpansionEvent expansionEvent = null; - - /** - * Construct the Wiimote setting up the id. - * - * @param id - * the Wiimote id - */ - public WiimoteEvent(int id) { - super(id, WiiUseApiEvent.GENERIC_EVENT); - } - - /** - * Construct the Wiimote setting up the id and the buttons. - * - * @param id - * the Wiimote id - * @param buttonsJustPressed - * buttons just pressed - * @param buttonsJustReleased - * buttons just released - * @param buttonsHeld - * buttons held - */ - public WiimoteEvent(int id, short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld) { - super(id, WiiUseApiEvent.GENERIC_EVENT); - buttonsEvent = new WiimoteButtonsEvent(id, buttonsJustPressed, - buttonsJustReleased, buttonsHeld); - } - - /** - * Tell if there is an IR Event. - * - * @return TRUE if there is an IR event. - */ - public boolean isThereIrEvent() { - return infraredEvent != null; - } - - /** - * Tell if there is a motion sensing Event. - * - * @return TRUE if there is a motion sensing event. - */ - public boolean isThereMotionSensingEvent() { - return motionSensingEvent != null; - } - - /** - * Tell if there is an expansion Event. - * - * @return TRUE if there is an expansion event. - */ - public boolean isThereExpansionEvent() { - return expansionEvent != null; - } - - /** - * Get buttons event. - * - * @return the buttons event. - */ - public WiimoteButtonsEvent getButtonsEvent() { - return buttonsEvent; - } - - /** - * Get the IR event. - * - * @return the IR event if there is one or null. - */ - public IREvent getIREvent() { - return infraredEvent; - } - - /** - * Get the motion sensing event. - * - * @return the motion sensing event if there is one or null. - */ - public MotionSensingEvent getMotionSensingEvent() { - return motionSensingEvent; - } - - /** - * Get the expansion event. - * - * @return the expansion event if there is one or null. - */ - public ExpansionEvent getExpansionEvent() { - return expansionEvent; - } - - /** - * Prepare an IR event to populate. - * - * @param x - * calculated X coordinate. - * @param y - * calculated Y coordinate. - * @param z - * calculated distance. - * @param ax - * absolute X coordinate. - * @param ay - * absolute Y coordinate - * @param xVRes - * IR virtual screen x resolution. - * @param yVRes - * IR virtual screen y resolution. - * @param xOffset - * IR X correction offset. - * @param yOffset - * IR Y correction offset. - * @param sensorBarPostion - * aspect ratio of the screen. - * @param screenAsPectRatio - * IR sensor bar position. - * @param irSensitivity - * Sensitivity of the infrared camera. - * @param distance - * Pixel Distance between first two dots - */ - public void prepareIRevent(int x, int y, float z, int ax, int ay, - int xVRes, int yVRes, int xOffset, int yOffset, - short sensorBarPostion, short screenAsPectRatio, - short irSensitivity, float distance) { - if (infraredEvent == null) { - infraredEvent = new IREvent(getWiimoteId(), x, y, z, ax, ay, xVRes, - yVRes, xOffset, yOffset, sensorBarPostion, - screenAsPectRatio, irSensitivity, distance); - } - } - - /** - * Add an IR point to the generic event. Create an IR Event if it's not - * created yet. - * - * @param x - * x coordinates. - * @param y - * y coordinates - * @param rx - * raw X coordinate (0-1023). - * @param ry - * raw Y coordinate (0-1023). - * @param size - * size of the IR dot (0-15). - */ - public void addIRpoint(int x, int y, short rx, short ry, short size) { - if (infraredEvent != null) - infraredEvent.addIRpoint(x, y, rx, ry, size); - } - - /** - * Set the Motion Sensing Event. - * - * @param orientationThreshold - * value of the minimum angle between two events with the - * accelerometer. - * @param accelerationThreshold - * value of the value variation between two events with the - * accelerometer. - * @param smoothingState - * true if smoothing flag is activated. - * @param alphaSmooth - * value of the alpha smoothing parameter. - * @param r - * roll. - * @param p - * pitch. - * @param ya - * yaw. - * @param ar - * absolute roll. - * @param ap - * absolute pitch. - * @param x - * gravity force on x axis. - * @param y - * gravity force on y axis. - * @param z - * gravity force on z axis. - * @param xx - * raw acceleration on x axis. - * @param yy - * raw acceleration on y axis. - * @param zz - * raw acceleration on z axis. - */ - public void setMotionSensingEvent(float orientationThreshold, - int accelerationThreshold, boolean smoothingState, - float alphaSmooth, float r, float p, float ya, float ar, float ap, - float x, float y, float z, short xx, short yy, short zz) { - motionSensingEvent = new MotionSensingEvent(getWiimoteId(), - orientationThreshold, accelerationThreshold, smoothingState, - alphaSmooth, r, p, ya, ar, ap, x, y, z, xx, yy, zz); - } - - /** - * Set a NunchukEvent for the expansion event. - * - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param orientationThreshold - * value of the minimum angle between two events with the - * accelerometer. - * @param accelerationThreshold - * value of the value variation between two events with the - * accelerometer. - * @param smoothingState - * true if smoothing flag is activated. - * @param alphaSmooth - * value of the alpha smoothing parameter. - * @param r - * roll. - * @param p - * pitch. - * @param ya - * yaw. - * @param ar - * absolute roll. - * @param ap - * absolute pitch. - * @param x - * gravity force on x axis. - * @param y - * gravity force on y axis. - * @param z - * gravity force on z axis. - * @param xx - * raw acceleration on x axis. - * @param yy - * raw acceleration on y axis. - * @param zz - * raw acceleration on z axis. - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public void setNunchukEvent(short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, - float orientationThreshold, int accelerationThreshold, - boolean smoothingState, float alphaSmooth, float r, float p, - float ya, float ar, float ap, float x, float y, float z, short xx, - short yy, short zz, float angle, float magnitude, short max1, - short max2, short min1, short min2, short center1, short center2) { - expansionEvent = new NunchukEvent(getWiimoteId(), buttonsJustPressed, - buttonsJustReleased, buttonsHeld, orientationThreshold, - accelerationThreshold, smoothingState, alphaSmooth, r, p, ya, - ar, ap, x, y, z, xx, yy, zz, angle, magnitude, max1, max2, - min1, min2, center1, center2); - } - - /** - * Set a ClassicControllerEvent for the expansionEvent. - * - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param rightShoulder - * right shoulder button (range 0-1). - * @param leftShoulder - * left shoulder button (range 0-1). - * @param langle - * angle the left joystick is being held. - * @param lmagnitude - * magnitude of the left joystick (range 0-1). - * @param lmax1 - * maximum left joystick value 1. - * @param lmax2 - * maximum left joystick value 2. - * @param lmin1 - * minimum left joystick value 1. - * @param lmin2 - * minimum left joystick value 2. - * @param lcenter1 - * center left joystick value 1. - * @param lcenter2 - * center left joystick value 2. - * @param rangle - * angle the right joystick is being held. - * @param rmagnitude - * magnitude of the right joystick (range 0-1). - * @param rmax1 - * maximum right joystick value 1. - * @param rmax2 - * maximum right joystick value 2. - * @param rmin1 - * minimum right joystick value 1. - * @param rmin2 - * minimum right joystick value 2. - * @param rcenter1 - * center right joystick value 1. - * @param rcenter2 - * center right joystick value 2. - */ - public void setClassicControllerEvent(short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, float rightShoulder, - float leftShoulder, float langle, float lmagnitude, short lmax1, - short lmax2, short lmin1, short lmin2, short lcenter1, - short lcenter2, float rangle, float rmagnitude, short rmax1, - short rmax2, short rmin1, short rmin2, short rcenter1, - short rcenter2) { - expansionEvent = new ClassicControllerEvent(getWiimoteId(), - buttonsJustPressed, buttonsJustReleased, buttonsHeld, - rightShoulder, leftShoulder, langle, lmagnitude, lmax1, lmax2, - lmin1, lmin2, lcenter1, lcenter2, rangle, rmagnitude, rmax1, - rmax2, rmin1, rmin2, rcenter1, rcenter2); - } - - /** - * Set a GuitarHeroEvent for the expansionEvent. - * - * @param buttonsJustPressed - * buttons just pressed. - * @param buttonsJustReleased - * buttons just released. - * @param buttonsHeld - * buttons just pressed. - * @param whammyBar - * whammy bar (range 0-1). - * @param angle - * angle the joystick is being held. - * @param magnitude - * magnitude of the joystick (range 0-1). - * @param max1 - * maximum joystick value 1. - * @param max2 - * maximum joystick value 2. - * @param min1 - * minimum joystick value 1. - * @param min2 - * minimum joystick value 2. - * @param center1 - * center joystick value 1. - * @param center2 - * center joystick value 2. - */ - public void setGuitarHeroEvent(short buttonsJustPressed, - short buttonsJustReleased, short buttonsHeld, float whammyBar, - float angle, float magnitude, short max1, short max2, short min1, - short min2, short center1, short center2) { - expansionEvent = new GuitarHeroEvent(getWiimoteId(), - buttonsJustPressed, buttonsJustReleased, buttonsHeld, - whammyBar, angle, magnitude, max1, max2, min1, min2, center1, - center2); - } - - @Override - public String toString() { - String out = ""; - /* Status */ - out += "/*********** GENERIC EVENT : WIIMOTE ID :" + getWiimoteId() - + " ********/\n"; - - out += buttonsEvent; - - if (infraredEvent != null) { - out += infraredEvent; - } else { - out += "/******** IR Tracking ********/\n"; - out += "--- Active : false\n"; - } - - if (motionSensingEvent != null) { - out += motionSensingEvent; - } else { - out += "/******** Motion sensing ********/\n"; - out += "--- Motion sensing : false \n"; - } - - if (expansionEvent != null) { - out += expansionEvent; - } else { - out += "/******** Expansion ********/\n"; - out += "--- No expansion connected \n"; - } - - return out; - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.wiiusejevents.wiiuseapievents; + +import wiiusej.wiiusejevents.physicalevents.ClassicControllerEvent; +import wiiusej.wiiusejevents.physicalevents.ExpansionEvent; +import wiiusej.wiiusejevents.physicalevents.GuitarHeroEvent; +import wiiusej.wiiusejevents.physicalevents.IREvent; +import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent; +import wiiusej.wiiusejevents.physicalevents.NunchukEvent; +import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent; + +/** + * Class that is a bean to be filled by the wiiuse API on an event that occurs + * on a wiimote. + * + * @author guiguito + */ +public class WiimoteEvent extends WiiUseApiEvent { + + private WiimoteButtonsEvent buttonsEvent = null; + private IREvent infraredEvent = null; + private MotionSensingEvent motionSensingEvent = null; + private ExpansionEvent expansionEvent = null; + + /** + * Construct the Wiimote setting up the id. + * + * @param id + * the Wiimote id + */ + public WiimoteEvent(int id) { + super(id, WiiUseApiEvent.GENERIC_EVENT); + } + + /** + * Construct the Wiimote setting up the id and the buttons. + * + * @param id + * the Wiimote id + * @param buttonsJustPressed + * buttons just pressed + * @param buttonsJustReleased + * buttons just released + * @param buttonsHeld + * buttons held + */ + public WiimoteEvent(int id, short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld) { + super(id, WiiUseApiEvent.GENERIC_EVENT); + buttonsEvent = new WiimoteButtonsEvent(id, buttonsJustPressed, + buttonsJustReleased, buttonsHeld); + } + + /** + * Tell if there is an IR Event. + * + * @return TRUE if there is an IR event. + */ + public boolean isThereIrEvent() { + return infraredEvent != null; + } + + /** + * Tell if there is a motion sensing Event. + * + * @return TRUE if there is a motion sensing event. + */ + public boolean isThereMotionSensingEvent() { + return motionSensingEvent != null; + } + + /** + * Tell if there is an expansion Event. + * + * @return TRUE if there is an expansion event. + */ + public boolean isThereExpansionEvent() { + return expansionEvent != null; + } + + /** + * Get buttons event. + * + * @return the buttons event. + */ + public WiimoteButtonsEvent getButtonsEvent() { + return buttonsEvent; + } + + /** + * Get the IR event. + * + * @return the IR event if there is one or null. + */ + public IREvent getIREvent() { + return infraredEvent; + } + + /** + * Get the motion sensing event. + * + * @return the motion sensing event if there is one or null. + */ + public MotionSensingEvent getMotionSensingEvent() { + return motionSensingEvent; + } + + /** + * Get the expansion event. + * + * @return the expansion event if there is one or null. + */ + public ExpansionEvent getExpansionEvent() { + return expansionEvent; + } + + /** + * Prepare an IR event to populate. + * + * @param x + * calculated X coordinate. + * @param y + * calculated Y coordinate. + * @param z + * calculated distance. + * @param ax + * absolute X coordinate. + * @param ay + * absolute Y coordinate + * @param xVRes + * IR virtual screen x resolution. + * @param yVRes + * IR virtual screen y resolution. + * @param xOffset + * IR X correction offset. + * @param yOffset + * IR Y correction offset. + * @param sensorBarPostion + * aspect ratio of the screen. + * @param screenAsPectRatio + * IR sensor bar position. + * @param irSensitivity + * Sensitivity of the infrared camera. + * @param distance + * Pixel Distance between first two dots + */ + public void prepareIRevent(int x, int y, float z, int ax, int ay, + int xVRes, int yVRes, int xOffset, int yOffset, + short sensorBarPostion, short screenAsPectRatio, + short irSensitivity, float distance) { + if (infraredEvent == null) { + infraredEvent = new IREvent(getWiimoteId(), x, y, z, ax, ay, xVRes, + yVRes, xOffset, yOffset, sensorBarPostion, + screenAsPectRatio, irSensitivity, distance); + } + } + + /** + * Add an IR point to the generic event. Create an IR Event if it's not + * created yet. + * + * @param x + * x coordinates. + * @param y + * y coordinates + * @param rx + * raw X coordinate (0-1023). + * @param ry + * raw Y coordinate (0-1023). + * @param size + * size of the IR dot (0-15). + */ + public void addIRpoint(int x, int y, short rx, short ry, short size) { + if (infraredEvent != null) + infraredEvent.addIRpoint(x, y, rx, ry, size); + } + + /** + * Set the Motion Sensing Event. + * + * @param orientationThreshold + * value of the minimum angle between two events with the + * accelerometer. + * @param accelerationThreshold + * value of the value variation between two events with the + * accelerometer. + * @param smoothingState + * true if smoothing flag is activated. + * @param alphaSmooth + * value of the alpha smoothing parameter. + * @param r + * roll. + * @param p + * pitch. + * @param ya + * yaw. + * @param ar + * absolute roll. + * @param ap + * absolute pitch. + * @param x + * gravity force on x axis. + * @param y + * gravity force on y axis. + * @param z + * gravity force on z axis. + * @param xx + * raw acceleration on x axis. + * @param yy + * raw acceleration on y axis. + * @param zz + * raw acceleration on z axis. + */ + public void setMotionSensingEvent(float orientationThreshold, + int accelerationThreshold, boolean smoothingState, + float alphaSmooth, float r, float p, float ya, float ar, float ap, + float x, float y, float z, short xx, short yy, short zz) { + motionSensingEvent = new MotionSensingEvent(getWiimoteId(), + orientationThreshold, accelerationThreshold, smoothingState, + alphaSmooth, r, p, ya, ar, ap, x, y, z, xx, yy, zz); + } + + /** + * Set a NunchukEvent for the expansion event. + * + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param orientationThreshold + * value of the minimum angle between two events with the + * accelerometer. + * @param accelerationThreshold + * value of the value variation between two events with the + * accelerometer. + * @param smoothingState + * true if smoothing flag is activated. + * @param alphaSmooth + * value of the alpha smoothing parameter. + * @param r + * roll. + * @param p + * pitch. + * @param ya + * yaw. + * @param ar + * absolute roll. + * @param ap + * absolute pitch. + * @param x + * gravity force on x axis. + * @param y + * gravity force on y axis. + * @param z + * gravity force on z axis. + * @param xx + * raw acceleration on x axis. + * @param yy + * raw acceleration on y axis. + * @param zz + * raw acceleration on z axis. + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public void setNunchukEvent(short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, + float orientationThreshold, int accelerationThreshold, + boolean smoothingState, float alphaSmooth, float r, float p, + float ya, float ar, float ap, float x, float y, float z, short xx, + short yy, short zz, float angle, float magnitude, short max1, + short max2, short min1, short min2, short center1, short center2) { + expansionEvent = new NunchukEvent(getWiimoteId(), buttonsJustPressed, + buttonsJustReleased, buttonsHeld, orientationThreshold, + accelerationThreshold, smoothingState, alphaSmooth, r, p, ya, + ar, ap, x, y, z, xx, yy, zz, angle, magnitude, max1, max2, + min1, min2, center1, center2); + } + + /** + * Set a ClassicControllerEvent for the expansionEvent. + * + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param rightShoulder + * right shoulder button (range 0-1). + * @param leftShoulder + * left shoulder button (range 0-1). + * @param langle + * angle the left joystick is being held. + * @param lmagnitude + * magnitude of the left joystick (range 0-1). + * @param lmax1 + * maximum left joystick value 1. + * @param lmax2 + * maximum left joystick value 2. + * @param lmin1 + * minimum left joystick value 1. + * @param lmin2 + * minimum left joystick value 2. + * @param lcenter1 + * center left joystick value 1. + * @param lcenter2 + * center left joystick value 2. + * @param rangle + * angle the right joystick is being held. + * @param rmagnitude + * magnitude of the right joystick (range 0-1). + * @param rmax1 + * maximum right joystick value 1. + * @param rmax2 + * maximum right joystick value 2. + * @param rmin1 + * minimum right joystick value 1. + * @param rmin2 + * minimum right joystick value 2. + * @param rcenter1 + * center right joystick value 1. + * @param rcenter2 + * center right joystick value 2. + */ + public void setClassicControllerEvent(short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, float rightShoulder, + float leftShoulder, float langle, float lmagnitude, short lmax1, + short lmax2, short lmin1, short lmin2, short lcenter1, + short lcenter2, float rangle, float rmagnitude, short rmax1, + short rmax2, short rmin1, short rmin2, short rcenter1, + short rcenter2) { + expansionEvent = new ClassicControllerEvent(getWiimoteId(), + buttonsJustPressed, buttonsJustReleased, buttonsHeld, + rightShoulder, leftShoulder, langle, lmagnitude, lmax1, lmax2, + lmin1, lmin2, lcenter1, lcenter2, rangle, rmagnitude, rmax1, + rmax2, rmin1, rmin2, rcenter1, rcenter2); + } + + /** + * Set a GuitarHeroEvent for the expansionEvent. + * + * @param buttonsJustPressed + * buttons just pressed. + * @param buttonsJustReleased + * buttons just released. + * @param buttonsHeld + * buttons just pressed. + * @param whammyBar + * whammy bar (range 0-1). + * @param angle + * angle the joystick is being held. + * @param magnitude + * magnitude of the joystick (range 0-1). + * @param max1 + * maximum joystick value 1. + * @param max2 + * maximum joystick value 2. + * @param min1 + * minimum joystick value 1. + * @param min2 + * minimum joystick value 2. + * @param center1 + * center joystick value 1. + * @param center2 + * center joystick value 2. + */ + public void setGuitarHeroEvent(short buttonsJustPressed, + short buttonsJustReleased, short buttonsHeld, float whammyBar, + float angle, float magnitude, short max1, short max2, short min1, + short min2, short center1, short center2) { + expansionEvent = new GuitarHeroEvent(getWiimoteId(), + buttonsJustPressed, buttonsJustReleased, buttonsHeld, + whammyBar, angle, magnitude, max1, max2, min1, min2, center1, + center2); + } + + @Override + public String toString() { + String out = ""; + /* Status */ + out += "/*********** GENERIC EVENT : WIIMOTE ID :" + getWiimoteId() + + " ********/\n"; + + out += buttonsEvent; + + if (infraredEvent != null) { + out += infraredEvent; + } else { + out += "/******** IR Tracking ********/\n"; + out += "--- Active : false\n"; + } + + if (motionSensingEvent != null) { + out += motionSensingEvent; + } else { + out += "/******** Motion sensing ********/\n"; + out += "--- Motion sensing : false \n"; + } + + if (expansionEvent != null) { + out += expansionEvent; + } else { + out += "/******** Expansion ********/\n"; + out += "--- No expansion connected \n"; + } + + return out; + } + +} diff --git a/WiiUseJ/img/classiccontroller.png b/src/main/resources/img/classiccontroller.png similarity index 100% rename from WiiUseJ/img/classiccontroller.png rename to src/main/resources/img/classiccontroller.png diff --git a/WiiUseJ/img/wiimote.png b/src/main/resources/img/wiimote.png similarity index 100% rename from WiiUseJ/img/wiimote.png rename to src/main/resources/img/wiimote.png diff --git a/WiiUseJ/src/wiiusej/test/ClassicControllerGuiTest.java b/src/test/java/ClassicControllerGuiTest.java similarity index 100% rename from WiiUseJ/src/wiiusej/test/ClassicControllerGuiTest.java rename to src/test/java/ClassicControllerGuiTest.java diff --git a/WiiUseJ/src/wiiusej/test/CloseGuiTestCleanly.java b/src/test/java/CloseGuiTestCleanly.java similarity index 100% rename from WiiUseJ/src/wiiusej/test/CloseGuiTestCleanly.java rename to src/test/java/CloseGuiTestCleanly.java diff --git a/WiiUseJ/src/wiiusej/test/GuitarHero3GuiTest.java b/src/test/java/GuitarHero3GuiTest.java similarity index 100% rename from WiiUseJ/src/wiiusej/test/GuitarHero3GuiTest.java rename to src/test/java/GuitarHero3GuiTest.java diff --git a/WiiUseJ/src/wiiusej/test/Main.java b/src/test/java/Main.java similarity index 100% rename from WiiUseJ/src/wiiusej/test/Main.java rename to src/test/java/Main.java diff --git a/WiiUseJ/src/wiiusej/test/NunchukGuiTest.java b/src/test/java/NunchukGuiTest.java similarity index 100% rename from WiiUseJ/src/wiiusej/test/NunchukGuiTest.java rename to src/test/java/NunchukGuiTest.java diff --git a/WiiUseJ/src/wiiusej/test/Tests.java b/src/test/java/Tests.java similarity index 96% rename from WiiUseJ/src/wiiusej/test/Tests.java rename to src/test/java/Tests.java index fcd4ef0..88fe873 100644 --- a/WiiUseJ/src/wiiusej/test/Tests.java +++ b/src/test/java/Tests.java @@ -1,389 +1,389 @@ -/** - * This file is part of WiiuseJ. - * - * WiiuseJ 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. - * - * WiiuseJ 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 WiiuseJ. If not, see . - */ -package wiiusej.test; - -import java.awt.AWTException; -import java.awt.Robot; -import java.awt.event.InputEvent; - -import wiiusej.WiiUseApiManager; -import wiiusej.Wiimote; -import wiiusej.values.IRSource; -import wiiusej.wiiusejevents.physicalevents.ExpansionEvent; -import wiiusej.wiiusejevents.physicalevents.IREvent; -import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent; -import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent; -import wiiusej.wiiusejevents.utils.WiimoteListener; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; -import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; - -/** - * This class used to test WiiuseJ in text mode. - * - * @author guiguito - */ -public class Tests implements WiimoteListener { - - Robot robot; - - private static int DISPLAY_EACH_VALUE = 1; - private static int DUMP = 2; - private static int MOVE_MOUSE = 3; - private static int TEST_LEDS = 5; - - private Wiimote wiimote; - - int dump = DISPLAY_EACH_VALUE; - - public Tests(Wiimote wim) { - wiimote = wim; - wiimote.addWiiMoteEventListeners(this); - try { - robot = new Robot(); - } catch (AWTException e) { - e.printStackTrace(); - } - } - - public void onButtonsEvent(WiimoteButtonsEvent e) { - if (dump == DISPLAY_EACH_VALUE) { - // System.out.println("*********** WIIMOTE ID : "+ - // e.getWiimoteId() + " **************"); - /* button ONE */ - if (e.isButtonOneJustPressed()) { - System.out.println("button one pressed"); - } - if (e.isButtonOneHeld()) { - System.out.println("button one held"); - } - if (e.isButtonOneJustReleased()) { - System.out.println("button one released"); - } - - /* button TWO */ - if (e.isButtonTwoJustPressed()) { - System.out.println("button two pressed"); - } - if (e.isButtonTwoHeld()) { - System.out.println("button two held"); - } - if (e.isButtonTwoJustReleased()) { - System.out.println("button two released"); - } - - /* button A */ - if (e.isButtonAJustPressed()) { - System.out.println("button A pressed"); - } - if (e.isButtonAHeld()) { - System.out.println("button A held"); - } - if (e.isButtonAJustReleased()) { - System.out.println("button A released"); - } - - /* button B */ - if (e.isButtonBJustPressed()) { - System.out.println("button B pressed"); - } - if (e.isButtonBHeld()) { - System.out.println("button B held"); - } - if (e.isButtonBJustReleased()) { - System.out.println("button B released"); - } - - /* button LEFT */ - if (e.isButtonLeftJustPressed()) { - System.out.println("button Left pressed"); - } - if (e.isButtonLeftHeld()) { - System.out.println("button Left held"); - } - if (e.isButtonLeftJustReleased()) { - System.out.println("button Left released"); - } - - /* button RIGHT */ - if (e.isButtonRightJustPressed()) { - System.out.println("button Right pressed"); - } - if (e.isButtonRightHeld()) { - System.out.println("button Right held"); - } - if (e.isButtonRightJustReleased()) { - System.out.println("button Right released"); - } - - /* button UP */ - if (e.isButtonUpJustPressed()) { - System.out.println("button UP pressed"); - } - if (e.isButtonUpHeld()) { - System.out.println("button UP held"); - } - if (e.isButtonUpJustReleased()) { - System.out.println("button UP released"); - } - - /* button DOWN */ - if (e.isButtonDownJustPressed()) { - System.out.println("button DOWN pressed"); - } - if (e.isButtonDownHeld()) { - System.out.println("button DOWN held"); - } - if (e.isButtonDownJustReleased()) { - System.out.println("button DOWN released"); - } - - /* button MINUS */ - if (e.isButtonMinusJustPressed()) { - System.out.println("button MINUS pressed"); - } - if (e.isButtonMinusHeld()) { - System.out.println("button MINUS held"); - } - if (e.isButtonMinusJustReleased()) { - System.out.println("button MINUS released"); - } - - /* button PLUS */ - if (e.isButtonPlusJustPressed()) { - System.out.println("button PLUS pressed"); - } - if (e.isButtonPlusHeld()) { - System.out.println("button PLUS held"); - } - if (e.isButtonPlusJustReleased()) { - System.out.println("button PLUS released"); - } - - /* button HOME */ - if (e.isButtonHomeJustPressed()) { - System.out.println("button HOME pressed"); - } - if (e.isButtonHomeHeld()) { - System.out.println("button HOME held"); - } - if (e.isButtonHomeJustReleased()) { - System.out.println("button HOME released"); - } - - /* get status */ - if (e.isButtonUpJustPressed()) { - wiimote.getStatus(); - } - - /* Activate rumble */ - if (e.isButtonOneJustPressed()) { - System.out.println("Rumble Activated"); - wiimote.activateRumble(); - } - if (e.isButtonTwoJustPressed()) { - System.out.println("Rumble Deactivated"); - wiimote.deactivateRumble(); - } - - /* Activate IR Tracking */ - if (e.isButtonAJustPressed()) { - System.out.println("IR Activated"); - wiimote.activateIRTRacking(); - } - if (e.isButtonBJustPressed()) { - System.out.println("IR Deactivated"); - wiimote.deactivateIRTRacking(); - } - - /* Activate Motion sensing */ - if (e.isButtonPlusJustPressed()) { - System.out.println("Motion sensing Activated"); - wiimote.activateMotionSensing(); - } - if (e.isButtonMinusJustPressed()) { - System.out.println("Motion sensing Deactivated"); - wiimote.deactivateMotionSensing(); - } - - /* leave test */ - if (e.isButtonHomeJustPressed()) { - System.out.println("LEAVING TEST"); - wiimote.disconnect(); - WiiUseApiManager.definitiveShutdown(); - } - - } else if (dump == DUMP) { - System.out.println(e); - /* Activate all */ - if (e.isButtonAJustPressed()) { - System.out.println("IR, rumble and motion sensing Activated"); - wiimote.activateIRTRacking(); - wiimote.activateMotionSensing(); - wiimote.activateRumble(); - } - if (e.isButtonBJustPressed()) { - System.out.println("IR, rumble and motion sensing Deactivated"); - wiimote.deactivateIRTRacking(); - wiimote.deactivateMotionSensing(); - wiimote.deactivateRumble(); - } - - /* leave test */ - if (e.isButtonHomeJustPressed()) { - System.out.println("LEAVING TEST"); - wiimote.disconnect(); - } - } else if (dump == MOVE_MOUSE) { - /* Activate IR Tracking */ - if (e.isButtonOneJustPressed()) { - System.out.println("IR Activated"); - wiimote.activateIRTRacking(); - } - if (e.isButtonTwoJustPressed()) { - System.out.println("IR Deactivated"); - wiimote.deactivateIRTRacking(); - } - - /* button A */ - if (e.isButtonAJustPressed()) { - robot.mousePress(InputEvent.BUTTON1_MASK); - } - if (e.isButtonAJustReleased()) { - robot.mouseRelease(InputEvent.BUTTON1_MASK); - } - - /* button B */ - if (e.isButtonBJustPressed()) { - robot.mousePress(InputEvent.BUTTON2_MASK); - } - if (e.isButtonBJustReleased()) { - robot.mouseRelease(InputEvent.BUTTON2_MASK); - } - - /* leave test */ - if (e.isButtonHomeJustPressed()) { - System.out.println("LEAVING TEST"); - wiimote.disconnect(); - } - } else if (dump == TEST_LEDS) { - wiimote.activateMotionSensing(); - if (e.isButtonUpJustPressed()) { - wiimote.setLeds(true, false, false, false); - } - if (e.isButtonDownJustPressed()) { - wiimote.setLeds(false, true, false, false); - } - if (e.isButtonLeftJustPressed()) { - wiimote.setLeds(false, false, true, false); - } - if (e.isButtonRightJustPressed()) { - wiimote.setLeds(false, false, false, true); - } - - /* leave test */ - if (e.isButtonHomeJustPressed()) { - System.out.println("LEAVING TEST"); - wiimote.disconnect(); - } - } - - } - - public void onIrEvent(IREvent e) { - if (dump == MOVE_MOUSE) { - IRSource[] list = e.getIRPoints(); - if (list.length > 0) { - int x1 = (int) list[0].getX(); - int y1 = (int) list[0].getY(); - - int mousex = (int) Math.round(((double) x1 / 1024.0) * 1280.0); - int mousey = (int) Math.round(((double) y1 / 768.0) * 1024.0); - robot.mouseMove(mousex, mousey); - } - } else { - System.out.println(e); - } - } - - public void onMotionSensingEvent(MotionSensingEvent e) { - /* display motion sensing */ - System.out.println(e); - } - - public void onExpansionEvent(ExpansionEvent e) { - System.out.println(e); - } - - public void onStatusEvent(StatusEvent e) { - // Display status variables - System.out.println(e); - } - - public void onDisconnectionEvent(DisconnectionEvent e) { - System.out.println(" wiimote " + e.getWiimoteId() - + "has been disconnected !!"); - } - - public void onNunchukInsertedEvent(NunchukInsertedEvent e) { - System.out.println(e); - } - - public void onNunchukRemovedEvent(NunchukRemovedEvent e) { - System.out.println(e); - } - - public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent e) { - System.out.println(e); - } - - public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent e) { - System.out.println(e); - } - - public void onClassicControllerInsertedEvent( - ClassicControllerInsertedEvent e) { - System.out.println(e); - } - - public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent e) { - System.out.println(e); - } - - /** - * @param args - */ - public static void main(String[] args) { - Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true); - if (wiimotes.length > 0) { - System.out.println(wiimotes[0]); - new Tests(wiimotes[0]); - } else { - System.out.println("No wiimotes found !!!"); - } - - // java.util.Timer timer = new java.util.Timer(); - // timer.scheduleAtFixedRate(new LedsTask(), 0, 100); - - } - -} +/** + * This file is part of WiiuseJ. + * + * WiiuseJ 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. + * + * WiiuseJ 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 WiiuseJ. If not, see . + */ +package wiiusej.test; + +import java.awt.AWTException; +import java.awt.Robot; +import java.awt.event.InputEvent; + +import wiiusej.WiiUseApiManager; +import wiiusej.Wiimote; +import wiiusej.values.IRSource; +import wiiusej.wiiusejevents.physicalevents.ExpansionEvent; +import wiiusej.wiiusejevents.physicalevents.IREvent; +import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent; +import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent; +import wiiusej.wiiusejevents.utils.WiimoteListener; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.GuitarHeroRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent; +import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent; + +/** + * This class used to test WiiuseJ in text mode. + * + * @author guiguito + */ +public class Tests implements WiimoteListener { + + Robot robot; + + private static int DISPLAY_EACH_VALUE = 1; + private static int DUMP = 2; + private static int MOVE_MOUSE = 3; + private static int TEST_LEDS = 5; + + private Wiimote wiimote; + + int dump = DISPLAY_EACH_VALUE; + + public Tests(Wiimote wim) { + wiimote = wim; + wiimote.addWiiMoteEventListeners(this); + try { + robot = new Robot(); + } catch (AWTException e) { + e.printStackTrace(); + } + } + + public void onButtonsEvent(WiimoteButtonsEvent e) { + if (dump == DISPLAY_EACH_VALUE) { + // System.out.println("*********** WIIMOTE ID : "+ + // e.getWiimoteId() + " **************"); + /* button ONE */ + if (e.isButtonOneJustPressed()) { + System.out.println("button one pressed"); + } + if (e.isButtonOneHeld()) { + System.out.println("button one held"); + } + if (e.isButtonOneJustReleased()) { + System.out.println("button one released"); + } + + /* button TWO */ + if (e.isButtonTwoJustPressed()) { + System.out.println("button two pressed"); + } + if (e.isButtonTwoHeld()) { + System.out.println("button two held"); + } + if (e.isButtonTwoJustReleased()) { + System.out.println("button two released"); + } + + /* button A */ + if (e.isButtonAJustPressed()) { + System.out.println("button A pressed"); + } + if (e.isButtonAHeld()) { + System.out.println("button A held"); + } + if (e.isButtonAJustReleased()) { + System.out.println("button A released"); + } + + /* button B */ + if (e.isButtonBJustPressed()) { + System.out.println("button B pressed"); + } + if (e.isButtonBHeld()) { + System.out.println("button B held"); + } + if (e.isButtonBJustReleased()) { + System.out.println("button B released"); + } + + /* button LEFT */ + if (e.isButtonLeftJustPressed()) { + System.out.println("button Left pressed"); + } + if (e.isButtonLeftHeld()) { + System.out.println("button Left held"); + } + if (e.isButtonLeftJustReleased()) { + System.out.println("button Left released"); + } + + /* button RIGHT */ + if (e.isButtonRightJustPressed()) { + System.out.println("button Right pressed"); + } + if (e.isButtonRightHeld()) { + System.out.println("button Right held"); + } + if (e.isButtonRightJustReleased()) { + System.out.println("button Right released"); + } + + /* button UP */ + if (e.isButtonUpJustPressed()) { + System.out.println("button UP pressed"); + } + if (e.isButtonUpHeld()) { + System.out.println("button UP held"); + } + if (e.isButtonUpJustReleased()) { + System.out.println("button UP released"); + } + + /* button DOWN */ + if (e.isButtonDownJustPressed()) { + System.out.println("button DOWN pressed"); + } + if (e.isButtonDownHeld()) { + System.out.println("button DOWN held"); + } + if (e.isButtonDownJustReleased()) { + System.out.println("button DOWN released"); + } + + /* button MINUS */ + if (e.isButtonMinusJustPressed()) { + System.out.println("button MINUS pressed"); + } + if (e.isButtonMinusHeld()) { + System.out.println("button MINUS held"); + } + if (e.isButtonMinusJustReleased()) { + System.out.println("button MINUS released"); + } + + /* button PLUS */ + if (e.isButtonPlusJustPressed()) { + System.out.println("button PLUS pressed"); + } + if (e.isButtonPlusHeld()) { + System.out.println("button PLUS held"); + } + if (e.isButtonPlusJustReleased()) { + System.out.println("button PLUS released"); + } + + /* button HOME */ + if (e.isButtonHomeJustPressed()) { + System.out.println("button HOME pressed"); + } + if (e.isButtonHomeHeld()) { + System.out.println("button HOME held"); + } + if (e.isButtonHomeJustReleased()) { + System.out.println("button HOME released"); + } + + /* get status */ + if (e.isButtonUpJustPressed()) { + wiimote.getStatus(); + } + + /* Activate rumble */ + if (e.isButtonOneJustPressed()) { + System.out.println("Rumble Activated"); + wiimote.activateRumble(); + } + if (e.isButtonTwoJustPressed()) { + System.out.println("Rumble Deactivated"); + wiimote.deactivateRumble(); + } + + /* Activate IR Tracking */ + if (e.isButtonAJustPressed()) { + System.out.println("IR Activated"); + wiimote.activateIRTRacking(); + } + if (e.isButtonBJustPressed()) { + System.out.println("IR Deactivated"); + wiimote.deactivateIRTRacking(); + } + + /* Activate Motion sensing */ + if (e.isButtonPlusJustPressed()) { + System.out.println("Motion sensing Activated"); + wiimote.activateMotionSensing(); + } + if (e.isButtonMinusJustPressed()) { + System.out.println("Motion sensing Deactivated"); + wiimote.deactivateMotionSensing(); + } + + /* leave test */ + if (e.isButtonHomeJustPressed()) { + System.out.println("LEAVING TEST"); + wiimote.disconnect(); + WiiUseApiManager.definitiveShutdown(); + } + + } else if (dump == DUMP) { + System.out.println(e); + /* Activate all */ + if (e.isButtonAJustPressed()) { + System.out.println("IR, rumble and motion sensing Activated"); + wiimote.activateIRTRacking(); + wiimote.activateMotionSensing(); + wiimote.activateRumble(); + } + if (e.isButtonBJustPressed()) { + System.out.println("IR, rumble and motion sensing Deactivated"); + wiimote.deactivateIRTRacking(); + wiimote.deactivateMotionSensing(); + wiimote.deactivateRumble(); + } + + /* leave test */ + if (e.isButtonHomeJustPressed()) { + System.out.println("LEAVING TEST"); + wiimote.disconnect(); + } + } else if (dump == MOVE_MOUSE) { + /* Activate IR Tracking */ + if (e.isButtonOneJustPressed()) { + System.out.println("IR Activated"); + wiimote.activateIRTRacking(); + } + if (e.isButtonTwoJustPressed()) { + System.out.println("IR Deactivated"); + wiimote.deactivateIRTRacking(); + } + + /* button A */ + if (e.isButtonAJustPressed()) { + robot.mousePress(InputEvent.BUTTON1_MASK); + } + if (e.isButtonAJustReleased()) { + robot.mouseRelease(InputEvent.BUTTON1_MASK); + } + + /* button B */ + if (e.isButtonBJustPressed()) { + robot.mousePress(InputEvent.BUTTON2_MASK); + } + if (e.isButtonBJustReleased()) { + robot.mouseRelease(InputEvent.BUTTON2_MASK); + } + + /* leave test */ + if (e.isButtonHomeJustPressed()) { + System.out.println("LEAVING TEST"); + wiimote.disconnect(); + } + } else if (dump == TEST_LEDS) { + wiimote.activateMotionSensing(); + if (e.isButtonUpJustPressed()) { + wiimote.setLeds(true, false, false, false); + } + if (e.isButtonDownJustPressed()) { + wiimote.setLeds(false, true, false, false); + } + if (e.isButtonLeftJustPressed()) { + wiimote.setLeds(false, false, true, false); + } + if (e.isButtonRightJustPressed()) { + wiimote.setLeds(false, false, false, true); + } + + /* leave test */ + if (e.isButtonHomeJustPressed()) { + System.out.println("LEAVING TEST"); + wiimote.disconnect(); + } + } + + } + + public void onIrEvent(IREvent e) { + if (dump == MOVE_MOUSE) { + IRSource[] list = e.getIRPoints(); + if (list.length > 0) { + int x1 = (int) list[0].getX(); + int y1 = (int) list[0].getY(); + + int mousex = (int) Math.round(((double) x1 / 1024.0) * 1280.0); + int mousey = (int) Math.round(((double) y1 / 768.0) * 1024.0); + robot.mouseMove(mousex, mousey); + } + } else { + System.out.println(e); + } + } + + public void onMotionSensingEvent(MotionSensingEvent e) { + /* display motion sensing */ + System.out.println(e); + } + + public void onExpansionEvent(ExpansionEvent e) { + System.out.println(e); + } + + public void onStatusEvent(StatusEvent e) { + // Display status variables + System.out.println(e); + } + + public void onDisconnectionEvent(DisconnectionEvent e) { + System.out.println(" wiimote " + e.getWiimoteId() + + "has been disconnected !!"); + } + + public void onNunchukInsertedEvent(NunchukInsertedEvent e) { + System.out.println(e); + } + + public void onNunchukRemovedEvent(NunchukRemovedEvent e) { + System.out.println(e); + } + + public void onGuitarHeroInsertedEvent(GuitarHeroInsertedEvent e) { + System.out.println(e); + } + + public void onGuitarHeroRemovedEvent(GuitarHeroRemovedEvent e) { + System.out.println(e); + } + + public void onClassicControllerInsertedEvent( + ClassicControllerInsertedEvent e) { + System.out.println(e); + } + + public void onClassicControllerRemovedEvent(ClassicControllerRemovedEvent e) { + System.out.println(e); + } + + /** + * @param args + */ + public static void main(String[] args) { + Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true); + if (wiimotes.length > 0) { + System.out.println(wiimotes[0]); + new Tests(wiimotes[0]); + } else { + System.out.println("No wiimotes found !!!"); + } + + // java.util.Timer timer = new java.util.Timer(); + // timer.scheduleAtFixedRate(new LedsTask(), 0, 100); + + } + +} diff --git a/WiiUseJ/src/wiiusej/test/WiiuseJGuiTest.java b/src/test/java/WiiuseJGuiTest.java similarity index 100% rename from WiiUseJ/src/wiiusej/test/WiiuseJGuiTest.java rename to src/test/java/WiiuseJGuiTest.java