wiiremotej.event
Class WRDataEvent

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

public class WRDataEvent
extends WREvent

Read data event for Nintendo (R) Wii Remote (TM). Contains data returned from reading the flash memory or control registers.

See Also:
Serialized Form

Field Summary
static int BYTES_DO_NOT_EXIST_ERROR
          An error code for readData.
static int NO_ERROR
          An error code for readData.
static int WRITE_ONLY_REGISTER_ERROR
          An error code for readData.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
WRDataEvent(WiiRemote source, byte[] data)
          Creates a new WRDataEvent from the given input data array.
WRDataEvent(WiiRemote source, byte[] readData, int errorCode, int dataOffset)
          Creates a new WRDataEvent from the given input data array.
 
Method Summary
 byte[] getData()
          Returns the data read from the flash memory/control register in the last read event.
 int getDataOffset()
          Returns the lower 2 bytes of the data offset of this read event.
 int getErrorCode()
          Returns the error code of this read event.
 
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
 

Field Detail

BYTES_DO_NOT_EXIST_ERROR

public static final int BYTES_DO_NOT_EXIST_ERROR
An error code for readData. Means some (or all) of the bytes you tried to read do not exist.

See Also:
Constant Field Values

WRITE_ONLY_REGISTER_ERROR

public static final int WRITE_ONLY_REGISTER_ERROR
An error code for readData. Means some (or all) of the bytes you tried to read reside in a write-only register.

See Also:
Constant Field Values

NO_ERROR

public static final int NO_ERROR
An error code for readData. Means there was no error reading bytes (this is good).

See Also:
Constant Field Values
Constructor Detail

WRDataEvent

public WRDataEvent(WiiRemote source,
                   byte[] data)
Creates a new WRDataEvent 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 from the Wii Remote to process for flash memory/control register data.

WRDataEvent

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

Parameters:
source - the WiiRemote triggering this event.
readData - the data read in this WRDataEvent.
errorCode - the error code returned from the data read operation (see Constant Field Values).
dataOffset - the lower two bytes of the address of the first byte of data.
Method Detail

getErrorCode

public int getErrorCode()
Returns the error code of this read event. See static field values BYTES_DO_NOT_EXIST_ERROR, WRITE_REGISTER_ONLY_ERROR, and NO_ERROR for details.

Returns:
the error code of this read event.

getDataOffset

public int getDataOffset()
Returns the lower 2 bytes of the data offset of this read event. Flash memory only covers 2 bytes of address space anyway, so this isn't a problem.

Returns:
the lower 2 bytes of the data offset of this read event. Returns -1 if there was an error.

getData

public byte[] getData()
Returns the data read from the flash memory/control register in the last read event.

Returns:
the data read from the flash memory/control register in the last read event. Returns null if there was an error.