fixed comments.

Added  GPL.

did some tests

git-svn-id: http://wiiusej.googlecode.com/svn/trunk@66 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
guilhem.duche
2008-03-01 18:26:40 +00:00
parent bc3d89009c
commit 4f8258d895
23 changed files with 725 additions and 99 deletions

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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 {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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){

View File

@@ -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;
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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 {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.values;
/**
* Represents gravity force on each axis.
* @author gduche
*
* @author guiguito
*/
public class GForce {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.values;
/**
* Class that represents the orientation of the wiimote.
* @author gduche
*
* @author guiguito
*/
public class Orientation {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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;

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.wiiuseapievents;
/**
* Class representing a disconnection event.
* @author guiguito
*/
public class DisconnectionEvent extends WiiUseApiEvent {
/**

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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 {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
/**

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.wiiuseapievents;
import wiiusej.values.Point2DInteger;
/**
* Class which represents an IR event.
*
* @author guiguito
*
*/
public class IREvent extends WiimoteEvent{

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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{

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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;

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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;

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.wiiuseapievents;
/**
* Abstract mother class representing an event with a wiimote id.
*
* @author guiguito
*/
public abstract class WiimoteEvent {
/* ID */

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.wiiuseapirequest;
/**
* Represents a request with a float value to pass to wiiuse API.
* @author gduche
*
*
* @author guiguito
*/
public class FloatValueRequest extends WiiUseApiRequest {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.wiiuseapirequest;
/**
* Represents a request with an int value to pass to wiiuse API.
* @author gduche
*
*
* @author guiguito
*/
public class IntValueRequest extends WiiUseApiRequest {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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 {

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
package wiiusej.wiiuseapirequest;
/**
* Represents a request we could do to the WiiUse API.
*
* @author gduche
*
* @author guiguito
*/
public class WiiUseApiRequest {