wiiremotej.event
Class BBMassEvent
java.lang.Object
java.util.EventObject
wiiremotej.event.BBEvent
wiiremotej.event.BBMassEvent
- All Implemented Interfaces:
- java.io.Serializable
public class BBMassEvent
- extends BBEvent
Mass event for Nintendo (R) Balance Board (TM). Contains data returned from mass sensors.
- See Also:
- Serialized Form
Fields inherited from class java.util.EventObject |
source |
Constructor Summary |
BBMassEvent(BalanceBoard source,
byte[] data)
Creates a new BBMassEvent from the given input data array. |
BBMassEvent(BalanceBoard source,
double topRightMass,
double bottomRightMass,
double topLeftMass,
double bottomLeftMass)
Creates a new BBMassEvent from the given mass values. |
Method Summary |
double |
getMass(int row,
int col)
Returns the mass on the given sensor in kilograms. |
double |
getTotalMass()
Returns the total mass on the board in kilograms. |
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 |
BBMassEvent
public BBMassEvent(BalanceBoard source,
byte[] data)
- Creates a new BBMassEvent 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 mass data.
BBMassEvent
public BBMassEvent(BalanceBoard source,
double topRightMass,
double bottomRightMass,
double topLeftMass,
double bottomLeftMass)
- Creates a new BBMassEvent from the given mass values.
- Parameters:
source
- the BalanceBoard triggering this event.topRightMass
- the mass detected by the top right sensor (in kgs).bottomRightMass
- the mass detected by the bottom right sensor (in kgs).topLeftMass
- the mass detected by the top left sensor (in kgs).bottomLeftMass
- the mass detected by the bottom left sensor (in kgs).
getMass
public double getMass(int row,
int col)
throws java.lang.IllegalArgumentException
- Returns the mass on the given sensor in kilograms. See MassConstants for row/column constants.
- Returns:
- the mass on the given sensor in kilograms.
- Throws:
java.lang.IllegalArgumentException
- if row is less than TOP or greater than BOTTOM or col is less than RIGHT or greater than LEFT.- See Also:
MassConstants
getTotalMass
public double getTotalMass()
- Returns the total mass on the board in kilograms.
- Returns:
- the total mass on the board in kilograms.