wiiusej.wiiuseapievents
Class GenericEvent

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

public class GenericEvent
extends WiiUseApiEvent

Class that is a bean to be filled by the wiiuse API.

Author:
guiguito

Field Summary
(package private)  ButtonsEvent buttonsEvent
           
(package private)  IREvent infraredEvent
           
(package private)  MotionSensingEvent motionSensingEvent
           
 
Fields inherited from class wiiusej.wiiuseapievents.WiiUseApiEvent
DISCONNECTION_EVENT, GENERIC_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
 
Constructor Summary
GenericEvent(int id)
          Construct the Wiimote setting up the id.
GenericEvent(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.
 ButtonsEvent getButtonsEvent()
          Get buttons event.
 IREvent getIREvent()
          Get IR event.
 MotionSensingEvent getMotionSensingEvent()
          Get motion sensing 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, int z, int ax, int ay, int xVRes, int yVRes, int xOffset, int yOffset, short sensorBarPostion, short screenAsPectRatio)
          Prepare an IR event to populate.
 void setMotionSensingEvent(float orientationThreshold, int accelerationThreshold, boolean smoothingState, float alphaSmooth, float r, float p, float ya, float x, float y, float z, short xx, short yy, short zz)
          Set the Motion Sensing Event.
 java.lang.String toString()
           
 
Methods inherited from class wiiusej.wiiuseapievents.WiiUseApiEvent
getEventType
 
Methods inherited from class wiiusej.wiiuseapievents.WiimoteEvent
getWiimoteId, setWiimoteId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttonsEvent

ButtonsEvent buttonsEvent

infraredEvent

IREvent infraredEvent

motionSensingEvent

MotionSensingEvent motionSensingEvent
Constructor Detail

GenericEvent

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

Parameters:
id - the Wiimote id

GenericEvent

public GenericEvent(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.

getButtonsEvent

public ButtonsEvent getButtonsEvent()
Get buttons event.

Returns:
the buttons event.

getIREvent

public IREvent getIREvent()
Get IR event.

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

getMotionSensingEvent

public MotionSensingEvent getMotionSensingEvent()
Get motion sensing event.

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

prepareIRevent

public void prepareIRevent(int x,
                           int y,
                           int z,
                           int ax,
                           int ay,
                           int xVRes,
                           int yVRes,
                           int xOffset,
                           int yOffset,
                           short sensorBarPostion,
                           short screenAsPectRatio)
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.

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 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
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

toString

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