diff --git a/WiiUseJ/src/wiiusej/WiiUseApi.java b/WiiUseJ/src/wiiusej/WiiUseApi.java
index d8b48c0..4c580e1 100644
--- a/WiiUseJ/src/wiiusej/WiiUseApi.java
+++ b/WiiUseJ/src/wiiusej/WiiUseApi.java
@@ -1,11 +1,26 @@
+/**
+ * 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.wiiuseapievents.EventsGatherer;
/**
* Singleton used to manipulate WiiUse Api.
- * @author gduche
- *
+ * @author guiguito
*/
public class WiiUseApi {
@@ -157,35 +172,5 @@ public class WiiUseApi {
* @param gath the object where we store all the new events.
*/
native void specialPoll(EventsGatherer gath);
-
-
- /* Tests */
- public static void main(String[] args) {
-
- /* Test JNI Side */
- /*
- WiiUseApi manager = new WiiUseApi();
-
- int value = manager.loadLibrary();
- System.out.println("loadLibrary : " + value);
-
- value = manager.doConnections();
- System.out.println("doConnections : " + value);
- WiiMoteEvent mote = new WiiMoteEvent();
-
-
- manager.getStatus(1);
- System.out.println("Status : \n" + mote);
-
- System.out.println("");
- System.out.println("!!!!!!!!!!!!!! Polling !!!!!!!!!");
- while (true) {
- manager.specialPoll(mote);
- System.out.println(mote);
- mote.EmptyIRPoints();
- }
- */
- // manager.closeConnectionsAndShutDown();
- }
}
diff --git a/WiiUseJ/src/wiiusej/WiiUseApiManager.java b/WiiUseJ/src/wiiusej/WiiUseApiManager.java
index b6e3770..1f5bb4c 100644
--- a/WiiUseJ/src/wiiusej/WiiUseApiManager.java
+++ b/WiiUseJ/src/wiiusej/WiiUseApiManager.java
@@ -1,3 +1,19 @@
+/**
+ * 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.ConcurrentLinkedQueue;
@@ -14,10 +30,9 @@ import wiiusej.wiiuseapirequest.LedsRequest;
import wiiusej.wiiuseapirequest.WiiUseApiRequest;
/**
- * Class that manage the use of Wiiuse API.
- *
- * @author gduche
+ * Class that manages the use of Wiiuse API.
*
+ * @author guiguito
*/
public class WiiUseApiManager extends Thread {
diff --git a/WiiUseJ/src/wiiusej/Wiimote.java b/WiiUseJ/src/wiiusej/Wiimote.java
index ebe18e7..0179f60 100644
--- a/WiiUseJ/src/wiiusej/Wiimote.java
+++ b/WiiUseJ/src/wiiusej/Wiimote.java
@@ -1,3 +1,19 @@
+/**
+ * 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;
@@ -13,8 +29,7 @@ import wiiusej.wiiuseapievents.WiimoteListener;
* Class that represents a wiimote.
* You can register as an observer of this wiimote to listen events from it.
* You manage it.
- * @author gduche
- *
+ * @author guiguito
*/
public class Wiimote implements WiiUseApiListener {
@@ -162,12 +177,15 @@ public class Wiimote implements WiiUseApiListener {
//TODO resync ?
/**
- * Get Status of the wiimote.
+ * 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);
}
-
+
+
public void onWiiUseApiEvent(WiiUseApiEvent e) {
if (e.getWiimoteId() == id){
if (e.getEventType() == WiiUseApiEvent.GENERIC_EVENT){
diff --git a/WiiUseJ/src/wiiusej/test/LedsTask.java b/WiiUseJ/src/wiiusej/test/LedsTask.java
deleted file mode 100644
index 1d9e98c..0000000
--- a/WiiUseJ/src/wiiusej/test/LedsTask.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package wiiusej.test;
-
-import java.util.TimerTask;
-
-import wiiusej.WiiUseApiManager;
-
-public class LedsTask extends TimerTask {
-
- private int i = 0;
- private int inc = 1;
-
- @Override
- public void run() {
- if(i==0){
- WiiUseApiManager.getInstance().setLeds(1, true, false, false, false);
- }else if(i==1){
- WiiUseApiManager.getInstance().setLeds(1, false, true, false, false);
- }else if(i==2){
- WiiUseApiManager.getInstance().setLeds(1, false, false, true, false);
- }else if(i==3){
- WiiUseApiManager.getInstance().setLeds(1, false, false, false, true);
- }
- if (i==0) i=1;
- if (i==3) i=-1;
- i = i+inc;
-
- }
-
-}
-
diff --git a/WiiUseJ/src/wiiusej/test/Tests.java b/WiiUseJ/src/wiiusej/test/Tests.java
index 4fd411f..63a2f8b 100644
--- a/WiiUseJ/src/wiiusej/test/Tests.java
+++ b/WiiUseJ/src/wiiusej/test/Tests.java
@@ -1,3 +1,19 @@
+/**
+ * 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;
@@ -16,10 +32,9 @@ import wiiusej.wiiuseapievents.GenericEvent;
import wiiusej.wiiuseapievents.WiimoteListener;
/**
- * This class used to test this API.
- *
- * @author gduche
+ * This class used to test WiiuseJ.
*
+ * @author guiguito
*/
public class Tests implements WiimoteListener {
diff --git a/WiiUseJ/src/wiiusej/values/GForce.java b/WiiUseJ/src/wiiusej/values/GForce.java
index ccc9d52..144024e 100644
--- a/WiiUseJ/src/wiiusej/values/GForce.java
+++ b/WiiUseJ/src/wiiusej/values/GForce.java
@@ -1,9 +1,24 @@
+/**
+ * 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 gduche
- *
+ * @author guiguito
*/
public class GForce {
diff --git a/WiiUseJ/src/wiiusej/values/Orientation.java b/WiiUseJ/src/wiiusej/values/Orientation.java
index 6fa0b3b..7afe928 100644
--- a/WiiUseJ/src/wiiusej/values/Orientation.java
+++ b/WiiUseJ/src/wiiusej/values/Orientation.java
@@ -1,9 +1,24 @@
+/**
+ * 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 gduche
- *
+ * @author guiguito
*/
public class Orientation {
diff --git a/WiiUseJ/src/wiiusej/values/Point2DInteger.java b/WiiUseJ/src/wiiusej/values/Point2DInteger.java
index 364d60d..a717882 100644
--- a/WiiUseJ/src/wiiusej/values/Point2DInteger.java
+++ b/WiiUseJ/src/wiiusej/values/Point2DInteger.java
@@ -1,7 +1,27 @@
+/**
+ * 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;
import java.awt.geom.Point2D;
+/**
+ * Class used for IR sources.
+ * @author guiguito
+ */
public class Point2DInteger extends Point2D {
private int x;
private int y;
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/ButtonsEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/ButtonsEvent.java
new file mode 100644
index 0000000..b79818e
--- /dev/null
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/ButtonsEvent.java
@@ -0,0 +1,288 @@
+/**
+ * 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.wiiuseapievents;
+
+/**
+ * Class which represents a buttons event.
+ * @author guiguito
+ */
+public class ButtonsEvent extends WiimoteEvent{
+
+ /* 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;
+
+ /* 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 */
+
+ private boolean buttonTest(short buttonBitsDefinition, short buttons) {
+ return (buttons & buttonBitsDefinition) == buttonBitsDefinition;
+ }
+
+ private boolean isButtonJustPressed(short buttonBitsDefinition) {
+ return buttonTest(buttonBitsDefinition, buttonsJustPressed)
+ && !isButtonHeld(buttonBitsDefinition);
+ }
+
+ private boolean isButtonJustReleased(short buttonBitsDefinition) {
+ return buttonTest(buttonBitsDefinition, buttonsJustReleased);
+ }
+
+ private boolean isButtonHeld(short buttonBitsDefinition) {
+ return buttonTest(buttonBitsDefinition, 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ @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/wiiuseapievents/DisconnectionEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/DisconnectionEvent.java
index 8c0da63..341b626 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/DisconnectionEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/DisconnectionEvent.java
@@ -1,5 +1,25 @@
+/**
+ * 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.wiiuseapievents;
+/**
+ * Class representing a disconnection event.
+ * @author guiguito
+ */
public class DisconnectionEvent extends WiiUseApiEvent {
/**
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/EventsGatherer.java b/WiiUseJ/src/wiiusej/wiiuseapievents/EventsGatherer.java
index d0a38b6..5014901 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/EventsGatherer.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/EventsGatherer.java
@@ -1,11 +1,26 @@
+/**
+ * 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.wiiuseapievents;
/**
- * Gather events during a call to the Wiiuse API.
- *
- * @author gduche
+ * This class is used to gather events during a call to the Wiiuse API.
*
+ * @author guiguito
*/
public class EventsGatherer {
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/GenericEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/GenericEvent.java
index 4ebcd79..f534ff0 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/GenericEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/GenericEvent.java
@@ -1,11 +1,26 @@
+/**
+ * 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.wiiuseapievents;
/**
* Class that is a bean to be filled by the wiiuse API.
*
- * @author gduche
- *
+ * @author guiguito
*/
public class GenericEvent extends WiiUseApiEvent {
@@ -48,7 +63,7 @@ public class GenericEvent extends WiiUseApiEvent {
* @return TRUE if there is an IR event.
*/
public boolean isThereIrEvent() {
- return infraredEvent == null;
+ return infraredEvent != null;
}
/**
@@ -57,7 +72,7 @@ public class GenericEvent extends WiiUseApiEvent {
* @return TRUE if there is a motion sensing event.
*/
public boolean isThereMotionSensingEvent() {
- return motionSensingEvent == null;
+ return motionSensingEvent != null;
}
/**
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/IREvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/IREvent.java
index 5a2e5a5..568fb4e 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/IREvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/IREvent.java
@@ -1,11 +1,27 @@
+/**
+ * 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.wiiuseapievents;
import wiiusej.values.Point2DInteger;
/**
* Class which represents an IR event.
+ *
* @author guiguito
- *
*/
public class IREvent extends WiimoteEvent{
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/MotionSensingEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/MotionSensingEvent.java
index eac648b..305c346 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/MotionSensingEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/MotionSensingEvent.java
@@ -1,3 +1,19 @@
+/**
+ * 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.wiiuseapievents;
import wiiusej.values.GForce;
@@ -5,8 +21,8 @@ import wiiusej.values.Orientation;
/**
* Class which represents a motion sensing event.
+ *
* @author guiguito
- *
*/
public class MotionSensingEvent extends WiimoteEvent{
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/StatusEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/StatusEvent.java
index c11b98f..e45410c 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/StatusEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/StatusEvent.java
@@ -1,5 +1,26 @@
+/**
+ * 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.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 {
private static short WIIMOTE_LED_1 = 1;
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiEvent.java
index d46f4a7..4c5b032 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiEvent.java
@@ -1,5 +1,26 @@
+/**
+ * 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.wiiuseapievents;
+/**
+ * This class describes the structure of an event from the WiiUse API event.
+ *
+ * @author guiguito
+ */
public abstract class WiiUseApiEvent extends WiimoteEvent{
public static int GENERIC_EVENT = 1;
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiListener.java b/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiListener.java
index 8ac8a75..3f6bb22 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiListener.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/WiiUseApiListener.java
@@ -1,15 +1,39 @@
+/**
+ * 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.wiiuseapievents;
/**
- * Interface defining the methods a WiiUseApiListener must have
- * @author gduche
- *
+ * 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 :
+ * - GenericEvent (Storing ButtonsEvent and
+ * eventually IREvent and MotionSensingEvent)
+ * - StatusEvent
+ * - DisconnectionEvent
+ * @param e
+ */
void onWiiUseApiEvent(WiiUseApiEvent e);
-
-
+
}
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteEvent.java b/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteEvent.java
index 4e73e9e..1504a37 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteEvent.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteEvent.java
@@ -1,5 +1,26 @@
+/**
+ * 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.wiiuseapievents;
+/**
+ * Abstract mother class representing an event with a wiimote id.
+ *
+ * @author guiguito
+ */
public abstract class WiimoteEvent {
/* ID */
diff --git a/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteListener.java b/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteListener.java
index 2078581..3ea3c05 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteListener.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapievents/WiimoteListener.java
@@ -1,16 +1,69 @@
+/**
+ * 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.wiiuseapievents;
-
+/**
+ * This is the interface to implement to listen to events from wiimotes.
+ * The differents methods are called in this order :
+ * onButtonsEvent, onIrEvent, onMotionSensingEvent, onStatusEvent, onDisconnectionEvent.
+ *
+ * @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(ButtonsEvent 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 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);
}
diff --git a/WiiUseJ/src/wiiusej/wiiuseapirequest/FloatValueRequest.java b/WiiUseJ/src/wiiusej/wiiuseapirequest/FloatValueRequest.java
index 238ca48..a003239 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapirequest/FloatValueRequest.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapirequest/FloatValueRequest.java
@@ -1,9 +1,25 @@
+/**
+ * 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.wiiuseapirequest;
/**
* Represents a request with a float value to pass to wiiuse API.
- * @author gduche
- *
+ *
+ * @author guiguito
*/
public class FloatValueRequest extends WiiUseApiRequest {
diff --git a/WiiUseJ/src/wiiusej/wiiuseapirequest/IntValueRequest.java b/WiiUseJ/src/wiiusej/wiiuseapirequest/IntValueRequest.java
index 137c977..b2a9a14 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapirequest/IntValueRequest.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapirequest/IntValueRequest.java
@@ -1,9 +1,25 @@
+/**
+ * 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.wiiuseapirequest;
/**
* Represents a request with an int value to pass to wiiuse API.
- * @author gduche
- *
+ *
+ * @author guiguito
*/
public class IntValueRequest extends WiiUseApiRequest {
diff --git a/WiiUseJ/src/wiiusej/wiiuseapirequest/LedsRequest.java b/WiiUseJ/src/wiiusej/wiiuseapirequest/LedsRequest.java
index b52d2c3..1a21024 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapirequest/LedsRequest.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapirequest/LedsRequest.java
@@ -1,9 +1,25 @@
+/**
+ * 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.wiiuseapirequest;
/**
* Represents a request to set leds of the wiimote with WiiUse API.
- * @author gduche
- *
+ *
+ * @author guiguito
*/
public class LedsRequest extends wiiusej.wiiuseapirequest.WiiUseApiRequest {
diff --git a/WiiUseJ/src/wiiusej/wiiuseapirequest/WiiUseApiRequest.java b/WiiUseJ/src/wiiusej/wiiuseapirequest/WiiUseApiRequest.java
index 59ef9c1..679213f 100644
--- a/WiiUseJ/src/wiiusej/wiiuseapirequest/WiiUseApiRequest.java
+++ b/WiiUseJ/src/wiiusej/wiiuseapirequest/WiiUseApiRequest.java
@@ -1,10 +1,25 @@
+/**
+ * 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.wiiuseapirequest;
/**
* Represents a request we could do to the WiiUse API.
*
- * @author gduche
- *
+ * @author guiguito
*/
public class WiiUseApiRequest {