|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wiigee.device.Device
org.wiigee.device.Wiimote
public class Wiimote
This class represents the basic functions of the wiimote. If you want your wiimote to e.g. vibrate you'll do this here.
| Field Summary | |
|---|---|
static int |
BUTTON_1
|
static int |
BUTTON_2
|
static int |
BUTTON_A
|
static int |
BUTTON_B
|
static int |
BUTTON_DOWN
|
static int |
BUTTON_HOME
|
static int |
BUTTON_LEFT
|
static int |
BUTTON_MINUS
|
static int |
BUTTON_PLUS
|
static int |
BUTTON_RIGHT
|
static int |
BUTTON_UP
|
static byte |
CMD_SET_REPORT
|
protected java.util.Vector<InfraredListener> |
infraredlistener
|
static byte |
IR_MODE_EXTENDED
|
static byte |
IR_MODE_STANDARD
|
static byte |
MODE_BUTTONS
|
static byte |
MODE_BUTTONS_ACCELERATION
|
static byte |
MODE_BUTTONS_ACCELERATION_INFRARED
|
protected java.util.Vector<RotationListener> |
rotationListener
|
protected java.util.Vector<org.wiigee.filter.Filter> |
rotfilters
|
| Fields inherited from class org.wiigee.device.Device |
|---|
accelerationEnabled, accelerationlistener, accfilters, buttonlistener, closegesturebutton, MOTION, processingunit, recognitionbutton, trainbutton |
| Constructor Summary | |
|---|---|
Wiimote(java.lang.String btaddress,
boolean autofiltering,
boolean autoconnect)
Creates a new wiimote-device with a specific bluetooth mac-adress. |
|
| Method Summary | |
|---|---|
void |
addInfraredListener(InfraredListener listener)
The added Listener will be notified about detected infrated events. |
void |
addRotationFilter(org.wiigee.filter.Filter filter)
Adds a filter to process the rotation speed data of the wiimote with an attached Wii Motion Plus. |
void |
addRotationListener(RotationListener listener)
The added Listener will be notified about detected orientation changes. |
void |
connect()
Creates the two needed connections to send and receive commands to and from the wiimote-device. |
void |
disconnect()
Disconnects the wiimote and closes the two connections. |
void |
fireInfraredEvent(int[][] coordinates,
int[] size)
Fires a infrared event, containig coordinate pairs (x,y) and a size of the detected IR spot. |
void |
fireRotationEvent(double pitch,
double roll,
double yaw)
Fires the current relative orientation of the Wiimote to all RotationListeners. |
void |
fireRotationSpeedEvent(double[] vector)
If a Wii Motion Plus is attached and activated properly this event could be fired within every change of orientation of the device. |
double |
getPitch()
|
javax.bluetooth.L2CAPConnection |
getReceiveConnection()
|
double |
getRoll()
|
double |
getYaw()
|
void |
readEEPROM(byte[] offset,
byte[] size)
Reads data out of the EEPROM of the wiimote. |
void |
readRegister(byte[] offset,
byte[] size)
Makes the Wiimote respond the data of an register. |
void |
resetRotationFilters()
Resets all filters which are applied to the rotation data from the Wii Motion Plus. |
void |
sendRaw(byte[] raw)
Sends pure hexdata to the wiimote. |
void |
setAccelerationEnabled(boolean enabled)
Activates the acceleration sensor. |
void |
setInfraredCameraEnabled(boolean enabled)
Enables or disables the infrared camera of the wiimote with the default values. |
void |
setInfraredCameraEnabled(boolean enabled,
byte infraredMode)
Enables the infrared camera in front of the wiimote to track IR sources in the field of view of the camera. |
void |
setLED(int value)
Enables one or more LEDs, where the value could be between 0 and 8. |
void |
setWiiMotionPlusEnabled(boolean enabled)
To enable the Wii Motion Plus extension. |
void |
streamData(boolean value)
This method makes the Wiimote-Class reacting to incoming data. |
void |
vibrateForTime(long milliseconds)
With this method you gain access over the vibrate function of the wiimote. |
void |
writeRegister(byte[] offset,
byte[] data)
Write data to a register inside of the wiimote. |
| Methods inherited from class org.wiigee.device.Device |
|---|
addAccelerationFilter, addAccelerationListener, addButtonListener, addGestureListener, fireAccelerationEvent, fireButtonPressedEvent, fireButtonReleasedEvent, fireMotionStartEvent, fireMotionStopEvent, getCloseGestureButton, getProcessingUnit, getRecognitionButton, getTrainButton, loadGesture, resetAccelerationFilters, saveGesture, setCloseGestureButton, setRecognitionButton, setTrainButton |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int BUTTON_2
public static final int BUTTON_1
public static final int BUTTON_B
public static final int BUTTON_A
public static final int BUTTON_MINUS
public static final int BUTTON_HOME
public static final int BUTTON_LEFT
public static final int BUTTON_RIGHT
public static final int BUTTON_DOWN
public static final int BUTTON_UP
public static final int BUTTON_PLUS
public static final byte CMD_SET_REPORT
public static final byte IR_MODE_STANDARD
public static final byte IR_MODE_EXTENDED
public static final byte MODE_BUTTONS
public static final byte MODE_BUTTONS_ACCELERATION
public static final byte MODE_BUTTONS_ACCELERATION_INFRARED
protected java.util.Vector<org.wiigee.filter.Filter> rotfilters
protected java.util.Vector<InfraredListener> infraredlistener
protected java.util.Vector<RotationListener> rotationListener
| Constructor Detail |
|---|
public Wiimote(java.lang.String btaddress,
boolean autofiltering,
boolean autoconnect)
throws java.io.IOException
btaddress - String representation of the mac-adress e.g. 00191D68B57C.autofiltering - If set the wiimote would automatically add the IdleStateFilter.autoconnect - If set the wiimote would automatically be connected.
java.io.IOException| Method Detail |
|---|
public void connect()
throws java.io.IOException
java.io.IOExceptionpublic void disconnect()
public javax.bluetooth.L2CAPConnection getReceiveConnection()
public void streamData(boolean value)
value - true, if the class should react to incoming data.
false, if you only want to send commands to wiimote and
only the control-connection is used.public void addInfraredListener(InfraredListener listener)
listener - The Listener to be added.public void addRotationListener(RotationListener listener)
listener - The Listener to be added.public void addRotationFilter(org.wiigee.filter.Filter filter)
filter - The Filter to be added.public void resetRotationFilters()
public void writeRegister(byte[] offset,
byte[] data)
throws java.io.IOException
offset - The memory offset, 3 bytes.data - The data to be written, max. 16 bytes.
java.io.IOException
public void readRegister(byte[] offset,
byte[] size)
throws java.io.IOException
offset - The memory offset.size - The size which has to be read out.
java.io.IOException
public void readEEPROM(byte[] offset,
byte[] size)
throws java.io.IOException
offset - The memory offset.size - The size.
java.io.IOException
public void sendRaw(byte[] raw)
throws java.io.IOException
raw - byte representation of an command
java.io.IOException
public void setLED(int value)
throws java.io.IOException
value - Between 0 and 8, indicating which LEDs should light up
java.io.IOException
public void setAccelerationEnabled(boolean enabled)
throws java.io.IOException
setAccelerationEnabled in class org.wiigee.device.Devicejava.io.IOException
public void setInfraredCameraEnabled(boolean enabled)
throws java.io.IOException
e - Should the Infrared Camera be enabled.
java.io.IOException - In case of a connection error.
public void setInfraredCameraEnabled(boolean enabled,
byte infraredMode)
throws java.io.IOException
e - Should the Infrared Camera be enabled.infraredMode - The choosen Infrared Camera Mode.
java.io.IOException - In case of a connection error.
public void setWiiMotionPlusEnabled(boolean enabled)
throws java.io.IOException
java.io.IOException
public void vibrateForTime(long milliseconds)
throws java.io.IOException
milliseconds - Time the wiimote would approx. vibrate.
java.io.IOExceptionpublic double getPitch()
public double getYaw()
public double getRoll()
public void fireInfraredEvent(int[][] coordinates,
int[] size)
coordinates - X and Y display coordinates.size - The size of the spot.
public void fireRotationEvent(double pitch,
double roll,
double yaw)
yaw - Orientation around Z axis.roll - Orientation around Y axis.pitch - Orientation around X axis.public void fireRotationSpeedEvent(double[] vector)
vector - The rotational speed vector, containing:
phi - Rotational speed of x axis (pitch)
theta - Rotational speed of y axis (roll)
psi - Rotational speed of z axis (yaw)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||