Renamed package namespaces to assure a better usability with other libraries.
git-svn-id: svn://svn.code.sf.net/p/wiigee/code/trunk@81 c7eff9ee-dd40-0410-8832-91a4d88773cf
This commit is contained in:
85
src/org/wiigee/event/AccelerationEvent.java
Executable file
85
src/org/wiigee/event/AccelerationEvent.java
Executable file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import org.wiigee.device.*;
|
||||
|
||||
/**
|
||||
* This Event would be generated if an acceleration has been detected.
|
||||
* It contains information about the force applied to the device in each
|
||||
* direction (x, y, z). Further it contains the absolute value of this
|
||||
* vector and the source which generated this event (wiimote).
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*
|
||||
*/
|
||||
public class AccelerationEvent extends EventObject {
|
||||
|
||||
double X, Y, Z;
|
||||
double absvalue;
|
||||
Device source;
|
||||
|
||||
/**
|
||||
* Create a WiimoteAccelerationEvent with a specific source,
|
||||
* all the three acceleration values and the calculated absolute
|
||||
* value.
|
||||
*
|
||||
* @param source The source which has been accelerated (Wiimote).
|
||||
* @param X The value of acceleration in the x direction.
|
||||
* @param Y The value of acceleration in the y direction.
|
||||
* @param Z The value of acceleration in the z direction.
|
||||
* @param absvalue The absolute value of this acceleration vector.
|
||||
*/
|
||||
public AccelerationEvent(Device source, double X, double Y, double Z, double absvalue) {
|
||||
super(source);
|
||||
this.source=source;
|
||||
this.X=X;
|
||||
this.Y=Y;
|
||||
this.Z=Z;
|
||||
this.absvalue=absvalue;
|
||||
}
|
||||
|
||||
public Device getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return X;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return Y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return Z;
|
||||
}
|
||||
|
||||
public double getAbsValue() {
|
||||
return absvalue;
|
||||
}
|
||||
}
|
||||
83
src/org/wiigee/event/ActionStartEvent.java
Executable file
83
src/org/wiigee/event/ActionStartEvent.java
Executable file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class ActionStartEvent extends EventObject {
|
||||
|
||||
protected Device source;
|
||||
protected boolean trainbutton;
|
||||
protected boolean recognitionbutton;
|
||||
protected boolean closegesturebutton;
|
||||
|
||||
public ActionStartEvent(Device source) {
|
||||
super(source);
|
||||
this.source=source;
|
||||
}
|
||||
|
||||
public Device getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is true if this button press has been done by the
|
||||
* individual defined RecognitionButton which has to be
|
||||
* set during initialization of a Wiimote.
|
||||
*
|
||||
* @return Is this button press initiated by the recognition button.
|
||||
* @see device.Wiimote#setRecognitionButton(int) setRecognitionButton()
|
||||
*/
|
||||
public boolean isRecognitionInitEvent() {
|
||||
return this.recognitionbutton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is true if this button press has been done by the
|
||||
* individual defined TrainButton which has to be
|
||||
* set during initialization of a Wiimote.
|
||||
*
|
||||
* @return Is this button pres initiated by the training button.
|
||||
* @see device.Wiimote#setTrainButton(int) setTrainButton()
|
||||
*/
|
||||
public boolean isTrainInitEvent() {
|
||||
return this.trainbutton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is true if this button press has been done by the
|
||||
* individual defined CloseGestureButton which has to be
|
||||
* set during initialization of a Wiimote.
|
||||
*
|
||||
* @return Is this button press initiated by the close gesture button.
|
||||
* @see device.Wiimote#setCloseGestureButton(int) setCloseGestureButton()
|
||||
*/
|
||||
public boolean isCloseGestureInitEvent() {
|
||||
return this.closegesturebutton;
|
||||
}
|
||||
|
||||
}
|
||||
43
src/org/wiigee/event/ActionStopEvent.java
Executable file
43
src/org/wiigee/event/ActionStopEvent.java
Executable file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class ActionStopEvent extends EventObject {
|
||||
|
||||
protected Device source;
|
||||
|
||||
public ActionStopEvent(Device source) {
|
||||
super(source);
|
||||
this.source=source;
|
||||
}
|
||||
|
||||
public Device getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
}
|
||||
97
src/org/wiigee/event/ButtonPressedEvent.java
Executable file
97
src/org/wiigee/event/ButtonPressedEvent.java
Executable file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import org.wiigee.device.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* This Event would be generated if a button on a wiimote has been
|
||||
* pressed by user. It contains the source (wiimote) and an integer
|
||||
* representation of which button has been pressed. Please note that
|
||||
* there exist enumeration constants in the class, so you don't
|
||||
* have to use this integer values directly.
|
||||
*
|
||||
* Button 1 matches button "2" on wiimote
|
||||
* Button 2 matches button "1" on wiimote
|
||||
* Button 3 matches button "B" on wiimote
|
||||
* Button 4 matches button "A" on wiimote
|
||||
* Button 5 matches button "MINUS" on wiimote
|
||||
* Button 6 unknown
|
||||
* Button 7 unknown
|
||||
* Button 8 matches button "HOME" on wiimote
|
||||
* Button 9 matches "CROSS LEFT" on wiimote
|
||||
* Button 10 matches "CROSS RIGHT" on wiimote
|
||||
* Button 11 matches "CROSS DOWN" on wiimote
|
||||
* Button 12 matches "CROSS UP" on wiimote
|
||||
* Button 13 matches button "PLUS" on wiimote
|
||||
* Button 14 unknown
|
||||
* Button 15 unknown
|
||||
* Button 16 unknown
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public class ButtonPressedEvent extends ActionStartEvent {
|
||||
|
||||
// Fixed number values.
|
||||
public static final int BUTTON_2 = 1;
|
||||
public static final int BUTTON_1 = 2;
|
||||
public static final int BUTTON_B = 3;
|
||||
public static final int BUTTON_A = 4;
|
||||
public static final int BUTTON_MINUS = 5;
|
||||
public static final int BUTTON_HOME = 8;
|
||||
public static final int BUTTON_LEFT = 9;
|
||||
public static final int BUTTON_RIGHT = 10;
|
||||
public static final int BUTTON_DOWN = 11;
|
||||
public static final int BUTTON_UP = 12;
|
||||
public static final int BUTTON_PLUS = 13;
|
||||
|
||||
int button;
|
||||
|
||||
/**
|
||||
* Create a WiimoteButtonPressedEvent with the Wiimote source whose
|
||||
* Button has been pressed and the integer representation of the button.
|
||||
*
|
||||
* @param source
|
||||
* @param button
|
||||
*/
|
||||
public ButtonPressedEvent(Device source, int button) {
|
||||
super(source);
|
||||
this.button=button;
|
||||
|
||||
if(source.getRecognitionButton()==button) {
|
||||
this.recognitionbutton=true;
|
||||
} else if(source.getTrainButton()==button) {
|
||||
this.trainbutton=true;
|
||||
} else if(source.getCloseGestureButton()==button) {
|
||||
this.closegesturebutton=true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getButton() {
|
||||
return this.button;
|
||||
}
|
||||
|
||||
}
|
||||
45
src/org/wiigee/event/ButtonReleasedEvent.java
Executable file
45
src/org/wiigee/event/ButtonReleasedEvent.java
Executable file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import org.wiigee.device.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* This event would be generated if a button was released.
|
||||
* contains: source (wiimote).
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public class ButtonReleasedEvent extends ActionStopEvent {
|
||||
|
||||
public ButtonReleasedEvent(Device source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
83
src/org/wiigee/event/DeviceListener.java
Executable file
83
src/org/wiigee/event/DeviceListener.java
Executable file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface has to be implemented if the application should react
|
||||
* to pure acceleration data or button press/release. This could be
|
||||
* useful if you want to graphically display the acceleration data or
|
||||
* something else in your application.
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public interface DeviceListener extends EventListener {
|
||||
|
||||
/**
|
||||
* This method would be called if a Wiimote source has been accelerated.
|
||||
*
|
||||
* @param event The acceleration representation as an event.
|
||||
*/
|
||||
public abstract void accelerationReceived(AccelerationEvent event);
|
||||
|
||||
/**
|
||||
* This method would be called if a Wiimote button has been pressed.
|
||||
*
|
||||
* @param event The button representation as an event.
|
||||
*/
|
||||
public abstract void buttonPressReceived(ButtonPressedEvent event);
|
||||
|
||||
/**
|
||||
* This method would be called if a Wiimote button has been released.
|
||||
*
|
||||
* @param event This is actually a meta-event NOT containing which button
|
||||
* has been released.
|
||||
*/
|
||||
public abstract void buttonReleaseReceived(ButtonReleasedEvent event);
|
||||
|
||||
/**
|
||||
* This method would be called if a Wiimote is in idle state and then a
|
||||
* motion starts or if a Wiimote is in motion and then the motion stops and
|
||||
* the Wiimote is in idle state.
|
||||
*
|
||||
* @param event This is the event which contains if the Wiimote is now
|
||||
* in motion or not.
|
||||
*/
|
||||
public abstract void motionStartReceived(MotionStartEvent event);
|
||||
|
||||
/**
|
||||
* This method would be called if a Wiimote is in motion and then the motion
|
||||
* stops and the Wiimote is in idle state.
|
||||
*
|
||||
* @param event This is the event which contains if the Wiimote is now
|
||||
* in motion or not.
|
||||
*/
|
||||
public abstract void motionStopReceived(MotionStopEvent event);
|
||||
|
||||
public abstract void infraredReceived(InfraredEvent event);
|
||||
|
||||
|
||||
}
|
||||
66
src/org/wiigee/event/GestureEvent.java
Executable file
66
src/org/wiigee/event/GestureEvent.java
Executable file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
|
||||
/**
|
||||
* This event would be generated if a gesture has been detected.
|
||||
* It contains information about the gesture "name" or type,
|
||||
* the accelerationstreamanalyzer which generated the event (source)
|
||||
* and the probability calculated from the bayes classifier.
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public class GestureEvent {
|
||||
|
||||
int id;
|
||||
double probability;
|
||||
ProcessingUnit analyzer;
|
||||
|
||||
/** Create a GestureEvent
|
||||
*
|
||||
* @param source The Source, which detected the gesture.
|
||||
* @param id A gesture ID for identifying a gesture.
|
||||
* @param probability The Bayes-Classifier calculated probability.
|
||||
*/
|
||||
public GestureEvent(ProcessingUnit source, int id, double probability) {
|
||||
this.analyzer=source;
|
||||
this.id=id;
|
||||
this.probability=probability;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public double getProbability() {
|
||||
return this.probability;
|
||||
}
|
||||
|
||||
public ProcessingUnit getSource() {
|
||||
return this.analyzer;
|
||||
}
|
||||
}
|
||||
57
src/org/wiigee/event/GestureListener.java
Executable file
57
src/org/wiigee/event/GestureListener.java
Executable file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* This is the GestureListener interface which has to be implemented
|
||||
* by any application which should receive recognized gestures.
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*
|
||||
*/
|
||||
public interface GestureListener extends EventListener {
|
||||
|
||||
/**
|
||||
* This method would be called if a gesture has been recognized.
|
||||
*
|
||||
* @param event The GestureEvent containing information about
|
||||
* the recognized gesture.
|
||||
*/
|
||||
public abstract void gestureReceived(GestureEvent event);
|
||||
|
||||
/**
|
||||
* This method would be called if the gesture-recognizing system
|
||||
* switched the state from recognition to training or otherwise.
|
||||
*
|
||||
* @param event The StateEvent containing information about the
|
||||
* state-change.
|
||||
*/
|
||||
public abstract void stateReceived(StateEvent event);
|
||||
|
||||
|
||||
}
|
||||
63
src/org/wiigee/event/InfraredEvent.java
Executable file
63
src/org/wiigee/event/InfraredEvent.java
Executable file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import org.wiigee.device.Wiimote;
|
||||
|
||||
public class InfraredEvent extends EventObject {
|
||||
|
||||
protected Wiimote wiimote;
|
||||
protected int[][] coordinates;
|
||||
protected int[] size;
|
||||
protected boolean[] valid;
|
||||
|
||||
public InfraredEvent(Wiimote source, int[][] coordinates, int[] size) {
|
||||
super(source);
|
||||
this.coordinates=coordinates;
|
||||
this.size=size;
|
||||
this.valid = new boolean[4];
|
||||
for(int i=0; i<this.coordinates.length; i++) {
|
||||
this.valid[i] = (this.coordinates[i][0]<1023 && this.coordinates[i][1]<1023);
|
||||
}
|
||||
}
|
||||
|
||||
public Wiimote getSource() {
|
||||
return this.wiimote;
|
||||
}
|
||||
|
||||
public boolean isValid(int i) {
|
||||
return this.valid[i];
|
||||
}
|
||||
|
||||
public int[][] getCoordinates() {
|
||||
return this.coordinates;
|
||||
}
|
||||
|
||||
public int[] getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
}
|
||||
58
src/org/wiigee/event/MotionStartEvent.java
Executable file
58
src/org/wiigee/event/MotionStartEvent.java
Executable file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class MotionStartEvent extends ActionStartEvent {
|
||||
|
||||
public MotionStartEvent(Device source) {
|
||||
super(source);
|
||||
|
||||
if(source.getRecognitionButton()==Device.MOTION) {
|
||||
this.recognitionbutton=true;
|
||||
} else if(source.getTrainButton()==Device.MOTION) {
|
||||
this.trainbutton=true;
|
||||
} else if(source.getCloseGestureButton()==Device.MOTION) {
|
||||
this.closegesturebutton=true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrainInitEvent() {
|
||||
return this.trainbutton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCloseGestureInitEvent() {
|
||||
return this.closegesturebutton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecognitionInitEvent() {
|
||||
return this.recognitionbutton;
|
||||
}
|
||||
|
||||
}
|
||||
43
src/org/wiigee/event/MotionStopEvent.java
Executable file
43
src/org/wiigee/event/MotionStopEvent.java
Executable file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
/**
|
||||
*
|
||||
* This event would be generated if a motion stops.
|
||||
* contains: source (wiimote).
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public class MotionStopEvent extends ActionStopEvent {
|
||||
|
||||
public MotionStopEvent(Device source) {
|
||||
super(source);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
67
src/org/wiigee/event/StateEvent.java
Executable file
67
src/org/wiigee/event/StateEvent.java
Executable file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: benjamin.poppinga@informatik.uni-oldenburg.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
* This is a StateEvent, telling the listeners in which state of recognition
|
||||
* the tool is:
|
||||
* 1 = training,
|
||||
* 2 = recognition
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public class StateEvent extends EventObject {
|
||||
|
||||
public final int STATE_LEARNING=1;
|
||||
public final int STATE_RECOGNIZING=2;
|
||||
|
||||
int state;
|
||||
ProcessingUnit analyzer;
|
||||
|
||||
/**
|
||||
* Create a StateEvent.
|
||||
*
|
||||
* @param source The source of which the state has changed.
|
||||
* @param state The state the source has switched to.
|
||||
*/
|
||||
public StateEvent(ProcessingUnit source, int state) {
|
||||
super(source);
|
||||
this.analyzer=source;
|
||||
this.state=state;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public ProcessingUnit getSource() {
|
||||
return this.analyzer;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user