org.wiigee.filter
Class MotionDetectFilter

java.lang.Object
  extended by org.wiigee.filter.Filter
      extended by org.wiigee.filter.MotionDetectFilter

public class MotionDetectFilter
extends Filter

This filter uses time to determine if the wiimote actually is in motion or not. This filter only works together with the IdleStateFilter.


Constructor Summary
MotionDetectFilter(Device device)
          Detects wheather the wiimote receives acceleration or not and raises an event, if the device starts or stops.
 
Method Summary
 double[] filter(double[] vector)
          The actual called method to filter anything.
 double[] filterAlgorithm(double[] vector)
          A filter receives a triple of acceleration values within the variable 'vector'.
 int getMotionChangeTime()
           
 void reset()
           
 void setMotionChangeTime(int time)
          Defines the time the wiimote has to be in idle state before a new motion change event appears.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MotionDetectFilter

public MotionDetectFilter(Device device)
Detects wheather the wiimote receives acceleration or not and raises an event, if the device starts or stops. This is actual a null filter, not manipulating anything. But looks pretty good in this datatype since it could be removed easily.

Parameters:
wiimote - The Wiimote object which is controlled by the filter.
Method Detail

reset

public void reset()
Specified by:
reset in class Filter

filter

public double[] filter(double[] vector)
Description copied from class: Filter
The actual called method to filter anything. It checks if the vector is already set to NULL by another filter and won't process it anymore. If it's not NULL it would be forwarded to the actual implemented method - filterAlgorithm().

Overrides:
filter in class Filter
Parameters:
vector - The acceleration vector, encoding: 0/x, 1/y, 2/z
Returns:
a new, filtered acceleration vector, encoded the same way

filterAlgorithm

public double[] filterAlgorithm(double[] vector)
Description copied from class: Filter
A filter receives a triple of acceleration values within the variable 'vector'. It's encoded as vector[0]=x, vector[1]=y, vector[2]=z. This is not an object since the processing of the filter should be really fast, since every acceleration of the wiimote passes the filter.

Specified by:
filterAlgorithm in class Filter
Returns:

setMotionChangeTime

public void setMotionChangeTime(int time)
Defines the time the wiimote has to be in idle state before a new motion change event appears. The default value 500ms should work well, only change it if you are sure about what you're doing.

Parameters:
time - Time in ms

getMotionChangeTime

public int getMotionChangeTime()