wiiusej.wiiusejevents.wiiuseapievents
Class WiimoteEvent

java.lang.Object
  extended by wiiusej.wiiusejevents.GenericEvent
      extended by wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent
          extended by wiiusej.wiiusejevents.wiiuseapievents.WiimoteEvent

public class WiimoteEvent
extends WiiUseApiEvent

Class that is a bean to be filled by the wiiuse API on an event that occurs on a wiimote.

Author:
guiguito

Field Summary
(package private)  WiimoteButtonsEvent buttonsEvent
           
(package private)  ExpansionEvent expansionEvent
           
(package private)  IREvent infraredEvent
           
(package private)  MotionSensingEvent motionSensingEvent
           
 
Fields inherited from class wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent
DISCONNECTION_EVENT, GENERIC_EVENT, NONE_EVENT, STATUS_EVENT, WIIUSE_CLASSIC_CTRL_INSERTED, WIIUSE_CLASSIC_CTRL_REMOVED, WIIUSE_GUITAR_HERO_3_CTRL_INSERTED, WIIUSE_GUITAR_HERO_3_CTRL_REMOVED, WIIUSE_NUNCHUK_INSERTED, WIIUSE_NUNCHUK_REMOVED, WIIUSE_READ_DATA
 
Constructor Summary
WiimoteEvent(int id)
          Construct the Wiimote setting up the id.
WiimoteEvent(int id, short buttonsJustPressed, short buttonsJustReleased, short buttonsHeld)
          Construct the Wiimote setting up the id and the buttons.
 
Method Summary
 void addIRpoint(int x, int y, short rx, short ry, short size)
          Add an IR point to the generic event.
 WiimoteButtonsEvent getButtonsEvent()
          Get buttons event.
 ExpansionEvent getExpansionEvent()
          Get the expansion event.
 IREvent getIREvent()
          Get the IR event.
 MotionSensingEvent getMotionSensingEvent()
          Get the motion sensing event.
 boolean isThereExpansionEvent()
          Tell if there is an expansion Event.
 boolean isThereIrEvent()
          Tell if there is an IR Event.
 boolean isThereMotionSensingEvent()
          Tell if there is a motion sensing Event.
 void prepareIRevent(int x, int y, float z, int ax, int ay, int xVRes, int yVRes, int xOffset, int yOffset, short sensorBarPostion, short screenAsPectRatio, short irSensitivity, float distance)
          Prepare an IR event to populate.
 void setClassicControllerEvent()
           
 void setMotionSensingEvent(float orientationThreshold, int accelerationThreshold, boolean smoothingState, float alphaSmooth, float r, float p, float ya, float ar, float ap, float x, float y, float z, short xx, short yy, short zz)
          Set the Motion Sensing Event.
 void setNunchukEvent(short buttonsJustPressed, short buttonsJustReleased, short buttonsHeld, float orientationThreshold, int accelerationThreshold, boolean smoothingState, float alphaSmooth, float r, float p, float ya, float ar, float ap, float x, float y, float z, short xx, short yy, short zz, float angle, float magnitude, short max1, short max2, short min1, short min2, short center1, short center2)
          Set a NunchukEvent for the expansion event.
 java.lang.String toString()
           
 
Methods inherited from class wiiusej.wiiusejevents.wiiuseapievents.WiiUseApiEvent
getEventType
 
Methods inherited from class wiiusej.wiiusejevents.GenericEvent
getWiimoteId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttonsEvent

WiimoteButtonsEvent buttonsEvent

infraredEvent

IREvent infraredEvent

motionSensingEvent

MotionSensingEvent motionSensingEvent

expansionEvent

ExpansionEvent expansionEvent
Constructor Detail

WiimoteEvent

public WiimoteEvent(int id)
Construct the Wiimote setting up the id.

Parameters:
id - the Wiimote id

WiimoteEvent

public WiimoteEvent(int id,
                    short buttonsJustPressed,
                    short buttonsJustReleased,
                    short buttonsHeld)
Construct the Wiimote setting up the id and the buttons.

Parameters:
id - the Wiimote id
buttonsJustPressed - buttons just pressed
buttonsJustReleased - buttons just released
buttonsHeld - buttons held
Method Detail

isThereIrEvent

public boolean isThereIrEvent()
Tell if there is an IR Event.

Returns:
TRUE if there is an IR event.

isThereMotionSensingEvent

public boolean isThereMotionSensingEvent()
Tell if there is a motion sensing Event.

Returns:
TRUE if there is a motion sensing event.

isThereExpansionEvent

public boolean isThereExpansionEvent()
Tell if there is an expansion Event.

Returns:
TRUE if there is an expansion event.

getButtonsEvent

public WiimoteButtonsEvent getButtonsEvent()
Get buttons event.

Returns:
the buttons event.

getIREvent

public IREvent getIREvent()
Get the IR event.

Returns:
the IR event if there is one or null.

getMotionSensingEvent

public MotionSensingEvent getMotionSensingEvent()
Get the motion sensing event.

Returns:
the motion sensing event if there is one or null.

getExpansionEvent

public ExpansionEvent getExpansionEvent()
Get the expansion event.

Returns:
the expansion event if there is one or null.

prepareIRevent

public void prepareIRevent(int x,
                           int y,
                           float z,
                           int ax,
                           int ay,
                           int xVRes,
                           int yVRes,
                           int xOffset,
                           int yOffset,
                           short sensorBarPostion,
                           short screenAsPectRatio,
                           short irSensitivity,
                           float distance)
Prepare an IR event to populate.

Parameters:
x - calculated X coordinate.
y - calculated Y coordinate.
z - calculated distance.
ax - absolute X coordinate.
ay - absolute Y coordinate
xVRes - IR virtual screen x resolution.
yVRes - IR virtual screen y resolution.
xOffset - IR X correction offset.
yOffset - IR Y correction offset.
sensorBarPostion - aspect ratio of the screen.
screenAsPectRatio - IR sensor bar position.
irSensitivity - Sensitivity of the infrared camera.
distance - Pixel Distance between first two dots

addIRpoint

public void addIRpoint(int x,
                       int y,
                       short rx,
                       short ry,
                       short size)
Add an IR point to the generic event. Create an IR Event if it's not created yet.

Parameters:
x - x coordinates.
y - y coordinates
rx - raw X coordinate (0-1023).
ry - raw Y coordinate (0-1023).
size - size of the IR dot (0-15).

setMotionSensingEvent

public void setMotionSensingEvent(float orientationThreshold,
                                  int accelerationThreshold,
                                  boolean smoothingState,
                                  float alphaSmooth,
                                  float r,
                                  float p,
                                  float ya,
                                  float ar,
                                  float ap,
                                  float x,
                                  float y,
                                  float z,
                                  short xx,
                                  short yy,
                                  short zz)
Set the Motion Sensing Event.

Parameters:
orientationThreshold - value of the minimum angle between two events with the accelerometer.
accelerationThreshold - value of the value variation between two events with the accelerometer.
smoothingState - true if smoothing flag is activated.
alphaSmooth - value of the alpha smoothing parameter.
r - roll.
p - pitch.
ya - yaw.
ar - absolute roll.
ap - absolute pitch.
x - gravity force on x axis.
y - gravity force on y axis.
z - gravity force on z axis.
xx - raw acceleration on x axis.
yy - raw acceleration on y axis.
zz - raw acceleration on z axis.

setNunchukEvent

public void setNunchukEvent(short buttonsJustPressed,
                            short buttonsJustReleased,
                            short buttonsHeld,
                            float orientationThreshold,
                            int accelerationThreshold,
                            boolean smoothingState,
                            float alphaSmooth,
                            float r,
                            float p,
                            float ya,
                            float ar,
                            float ap,
                            float x,
                            float y,
                            float z,
                            short xx,
                            short yy,
                            short zz,
                            float angle,
                            float magnitude,
                            short max1,
                            short max2,
                            short min1,
                            short min2,
                            short center1,
                            short center2)
Set a NunchukEvent for the expansion event.

Parameters:
buttonsJustPressed - buttons just pressed.
buttonsJustReleased - buttons just released.
buttonsHeld - buttons just pressed.
orientationThreshold - value of the minimum angle between two events with the accelerometer.
accelerationThreshold - value of the value variation between two events with the accelerometer.
smoothingState - true if smoothing flag is activated.
alphaSmooth - value of the alpha smoothing parameter.
r - roll.
p - pitch.
ya - yaw.
ar - absolute roll.
ap - absolute pitch.
x - gravity force on x axis.
y - gravity force on y axis.
z - gravity force on z axis.
xx - raw acceleration on x axis.
yy - raw acceleration on y axis.
zz - raw acceleration on z axis.
angle - angle the joystick is being held.
magnitude - magnitude of the joystick (range 0-1).
max1 - maximum joystick value 1.
max2 - maximum joystick value 2.
min1 - minimum joystick value 1.
min2 - minimum joystick value 2.
center1 - center joystick value 1.
center2 - center joystick value 2.

setClassicControllerEvent

public void setClassicControllerEvent()

toString

public java.lang.String toString()
Specified by:
toString in class WiiUseApiEvent