org.wiigee.device
Class Device

java.lang.Object
  extended by org.wiigee.device.Device

public class Device
extends java.lang.Object

Abstract representation of a device with very basic functionalities. This class should be derived from, if anybody plans to add a new class of devices, like Wiimote or AndroidDevice does. This class mainly consist of filter management, recognition control and core event control.


Field Summary
protected  boolean accelerationEnabled
           
protected  java.util.Vector<AccelerationListener> accelerationlistener
           
protected  java.util.Vector<Filter> accfilters
           
protected  java.util.Vector<ButtonListener> buttonlistener
           
protected  int closegesturebutton
           
static int MOTION
           
protected  ProcessingUnit processingunit
           
protected  int recognitionbutton
           
protected  int trainbutton
           
 
Constructor Summary
Device(boolean autofiltering)
           
 
Method Summary
 void addAccelerationFilter(Filter filter)
          Adds a Filter for processing the acceleration values.
 void addAccelerationListener(AccelerationListener listener)
          Adds an AccelerationListener to the Device.
 void addButtonListener(ButtonListener listener)
          Adds a ButtonListener to the Device.
 void addGestureListener(GestureListener listener)
          Adds a GestureListener to the Device.
 void fireAccelerationEvent(double[] vector)
          Fires an acceleration event.
 void fireButtonPressedEvent(int button)
          Fires a button pressed event.
 void fireButtonReleasedEvent(int button)
          Fires a button released event.
 void fireMotionStartEvent()
          Fires a motion start event.
 void fireMotionStopEvent()
          Fires a motion stop event.
 int getCloseGestureButton()
           
 ProcessingUnit getProcessingUnit()
           
 int getRecognitionButton()
           
 int getTrainButton()
           
 void loadGesture(java.lang.String filename)
           
 void resetAccelerationFilters()
          Resets all the accfilters, which are resetable.
 void saveGesture(int id, java.lang.String filename)
           
 void setAccelerationEnabled(boolean enabled)
           
 void setCloseGestureButton(int b)
           
 void setRecognitionButton(int b)
           
 void setTrainButton(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOTION

public static final int MOTION
See Also:
Constant Field Values

recognitionbutton

protected int recognitionbutton

trainbutton

protected int trainbutton

closegesturebutton

protected int closegesturebutton

accelerationEnabled

protected boolean accelerationEnabled

accfilters

protected java.util.Vector<Filter> accfilters

accelerationlistener

protected java.util.Vector<AccelerationListener> accelerationlistener

buttonlistener

protected java.util.Vector<ButtonListener> buttonlistener

processingunit

protected ProcessingUnit processingunit
Constructor Detail

Device

public Device(boolean autofiltering)
Method Detail

addAccelerationFilter

public void addAccelerationFilter(Filter filter)
Adds a Filter for processing the acceleration values.

Parameters:
filter - The Filter instance.

resetAccelerationFilters

public void resetAccelerationFilters()
Resets all the accfilters, which are resetable. Sometimes they have to be resettet if a new gesture starts.


addAccelerationListener

public void addAccelerationListener(AccelerationListener listener)
Adds an AccelerationListener to the Device. Everytime an acceleration on the Device is performed the AccelerationListener would receive an event of this action.

Parameters:
listener - The Listener.

addButtonListener

public void addButtonListener(ButtonListener listener)
Adds a ButtonListener to the Device. Everytime a Button has been pressed or released, the Listener would be notified about this via the corresponding Events.

Parameters:
listener - The Listener.

addGestureListener

public void addGestureListener(GestureListener listener)
Adds a GestureListener to the Device. Everytime a gesture is performed the GestureListener would receive an event of this gesture.

Parameters:
listener - The Listener.

getRecognitionButton

public int getRecognitionButton()

setRecognitionButton

public void setRecognitionButton(int b)

getTrainButton

public int getTrainButton()

setTrainButton

public void setTrainButton(int b)

getCloseGestureButton

public int getCloseGestureButton()

setCloseGestureButton

public void setCloseGestureButton(int b)

getProcessingUnit

public ProcessingUnit getProcessingUnit()

setAccelerationEnabled

public void setAccelerationEnabled(boolean enabled)
                            throws java.io.IOException
Throws:
java.io.IOException

loadGesture

public void loadGesture(java.lang.String filename)

saveGesture

public void saveGesture(int id,
                        java.lang.String filename)

fireAccelerationEvent

public void fireAccelerationEvent(double[] vector)
Fires an acceleration event.

Parameters:
vector - Consists of three values: acceleration on X, Y and Z axis.

fireButtonPressedEvent

public void fireButtonPressedEvent(int button)
Fires a button pressed event.

Parameters:
button - Integer value of the pressed button.

fireButtonReleasedEvent

public void fireButtonReleasedEvent(int button)
Fires a button released event.


fireMotionStartEvent

public void fireMotionStartEvent()
Fires a motion start event.


fireMotionStopEvent

public void fireMotionStopEvent()
Fires a motion stop event.