wiiremotej.event
Class WRStatusEvent

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

public class WRStatusEvent
extends WREvent

Status reported event for Nintendo (R) Wii Remote (TM). Contains data from a status report.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
WRStatusEvent(WiiRemote source, boolean extensionConnected, boolean speakerEnabled, boolean continuousEnabled, boolean[] LEDStatus, double batteryLevel)
          Creates a new WRStatusEvent from the given parameters.
WRStatusEvent(WiiRemote source, byte[] data)
          Creates a new WRStatusEvent from the given input data array.
 
Method Summary
 double getBatteryLevel()
          Returns the battery level of the remote.
 boolean[] getLEDStatus()
          Returns the status of the LED lights.
 boolean getLEDStatus(int light)
          Returns the status of the specified light.
 boolean isContinuousEnabled()
          Returns the status of continuous reporting.
 boolean isExtensionConnected()
          Returns the status of the extension port.
 boolean isSpeakerEnabled()
          Returns the status of the speaker.
 
Methods inherited from class wiiremotej.event.WREvent
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

WRStatusEvent

public WRStatusEvent(WiiRemote source,
                     byte[] data)
Creates a new WRStatusEvent from the given input data array. This array contains ALL of the bits directly from input.

Parameters:
source - the WiiRemote triggering this event.
data - the byte data to process for status information.

WRStatusEvent

public WRStatusEvent(WiiRemote source,
                     boolean extensionConnected,
                     boolean speakerEnabled,
                     boolean continuousEnabled,
                     boolean[] LEDStatus,
                     double batteryLevel)
Creates a new WRStatusEvent from the given parameters.

Parameters:
source - the WiiRemote triggering this event.
extensionConnected - true if an extension is connected; otherwise false.
speakerEnabled - true if the speaker is enabled; otherwise false.
continuousEnabled - true if continuous output is enabled; otherwise false.
LEDStatus - the status of each of the LED lights where true indicates on and false indicates off.
batteryLevel - the battery level (percent).
Method Detail

isExtensionConnected

public boolean isExtensionConnected()
Returns the status of the extension port.

Returns:
true if an extension is connected; otherwise false.

isSpeakerEnabled

public boolean isSpeakerEnabled()
Returns the status of the speaker.

Returns:
true if the speaker is enabled; otherwise false.

isContinuousEnabled

public boolean isContinuousEnabled()
Returns the status of continuous reporting.

Returns:
true if continuous reporting is enabled; otherwise false.

getLEDStatus

public boolean[] getLEDStatus()
Returns the status of the LED lights.

Returns:
status of the LED lights. In the array, true indicates the light is on and false indicates it is off.

getLEDStatus

public boolean getLEDStatus(int light)
                     throws java.lang.IllegalArgumentException
Returns the status of the specified light.

Parameters:
light - the light to check the status of. 0 is the first light, 1 the second, etc.
Returns:
true if light is on; otherwise false.
Throws:
IllegalArgument - Exception if light is not one of 0, 1, 2, or 3.
java.lang.IllegalArgumentException

getBatteryLevel

public double getBatteryLevel()
Returns the battery level of the remote. This a percent value (ranges from 0 to 1, e.g. 0.5 is 50%).

Returns:
the battery level of the remote.