wiiremotej.event
Class BBButtonEvent

java.lang.Object
  extended by java.util.EventObject
      extended by wiiremotej.event.BBEvent
          extended by wiiremotej.event.BBButtonEvent
All Implemented Interfaces:
java.io.Serializable

public class BBButtonEvent
extends BBEvent

Button event for Nintendo (R) Balance Board (TM). Contains information about whether the balance board's button is currently pressed in this event.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
BBButtonEvent(BalanceBoard source, boolean buttonPressed, BBButtonEvent lastEvent)
          Creates a new BBButtonEvent from the given the given buttonPressed value.
BBButtonEvent(BalanceBoard source, byte[] data, BBButtonEvent lastEvent)
          Creates a new BBButtonEvent from the given input data array.
 
Method Summary
 boolean isPressed()
          Returns true if the balance board's button is pressed; otherwise false.
 boolean wasPressed()
          Returns true if the balance board's button was pressed; otherwise false.
 boolean wasReleased()
          Returns true if the balance board's button was released; otherwise false.
 
Methods inherited from class wiiremotej.event.BBEvent
getSource
 
Methods inherited from class java.util.EventObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BBButtonEvent

public BBButtonEvent(BalanceBoard source,
                     byte[] data,
                     BBButtonEvent lastEvent)
Creates a new BBButtonEvent from the given input data array. This array contains ALL of the bits directly from Balance Board input (including HID header).

Parameters:
source - the BalanceBoard triggering this event.
data - the byte data to process for button presses.
lastEvent - the last button event received. Used to calculate wasPressed and wasReleased information.

BBButtonEvent

public BBButtonEvent(BalanceBoard source,
                     boolean buttonPressed,
                     BBButtonEvent lastEvent)
Creates a new BBButtonEvent from the given the given buttonPressed value.

Parameters:
source - the BalanceBoard triggering this event.
buttonPressed - true if the button is pressed; otherwise, false.
lastEvent - the last button event received. Used to calculate wasPressed and wasReleased information.
Method Detail

isPressed

public boolean isPressed()
Returns true if the balance board's button is pressed; otherwise false. "isPressed" means that the button is currently depressed; it may have just been depressed this event, or it may have been depressed previously.

Returns:
true if the balance board's button is pressed; otherwise false.

wasPressed

public boolean wasPressed()
Returns true if the balance board's button was pressed; otherwise false. "wasPressed" means that the button was not depressed before, and was just depressed this event.

Returns:
true if the balance board's button was pressed; otherwise false.

wasReleased

public boolean wasReleased()
Returns true if the balance board's button was released; otherwise false. "wasReleased" means that the button was previously depressed, and that it was just released this event.

Returns:
true if the balance board's button was released; otherwise false.