|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwiiremotej.WiiRemote
public class WiiRemote
A class representing a Nintendo (R) Wii Remote (TM). It has commands to control all of the WiiRemotes features.
You can register a WiiRemoteListener with addWiiRemoteListener.
WiiRemoteJ uses the Java logging API. The log for the package is named "wiiremotej" and can be obtained through the java.util.logging.Logger class.
Note that this document uses the following notation to represent hexadecimal numbers: 0x--. A hexadecimal number is simply a number in base-16. This convention is used
because it is easier to represent a single unsigned byte (256 in decimal) in hexadecimal: 0xFF.
Regarding data input reports (reports are sort of like channels): There are 11 input reports used for getting input from the buttons, accelerometer,
IR sensor, and extension port. These various devices (accelerometer, IR sensor, and extension) have different modes requiring different amounts of data.
Unfortunately, the Wii Remote does not support all three on their most data-intensive modes. Therefore, if you try to enable a device that requires a mode that lacks
space for a currently enabled device, an IllegalStateException will be thrown. You must first disbale/change the mode of already enabled devices. Note that you can
enable the extension-only report (which has no button data) without any warnings about lost button data; other inputs must still be disbaled. For
details on the reports available, see the constant field values, labeled I_BUTTONS, I_ACCELEROMETER, etc (all of them have values greater than or equal to 0x30,
which is 48 in decimal). Data is returned from the inputs whenever there is a change in the data. If continuous input is enabled (see enableContinuous()), data is
returned at a rate of 100 reports per second (half that rate when using Full IR mode).
Note that reading data from the remote will disrupt all other data input (except buttons). So if you're using accelerometer data, for example, performing a data read
will temporarily disrupt the accelerometer information stream. Also note that plugging in an extension will require a data read as calibration information is obtained.
Keep this in mind when programming.
Regarding the various "setEnabled" methods: You can enable something that is already enabled. The program will send the usual enabling information, etc. and
this should have no ill effects. Be aware, though, that any settings set on enabling will be reset to their default values.
Regarding extensions: You may add custom extensions (like the Nunchuk, Classic Controller, etc) using WiiRemoteExtensionFactory. When an extension is
connected, WiiRemote asks the WiiRemoteExtensionFactory to return a WiiRemoteExtension object based on the extension's code (obtained by the application
from the extension). Once a non-null WiiRemoteExtension is returned, that extension becomes the active extension. WiiRemoteExtensions specify payload
information and provide a method to get an event for the given extension. You can add WiiRemoteExtensions to the factory with the
WiiRemoteExtensionFactory.registerWiiRemoteExtension() method. Note the difference between an extension being connected and being enabled: "connected" refers
to the physical state of the extension: is it plugged into the physical Wii Remote and set up for input? "Enabled" refers to the program's view of the
extension: should WRExtensionEvents be passed to the listeners and do we need to use an input report that supports this extension? By default, the Nunchuk,
the Wii Guitar, and the Classic Controller are registered.
When the remote is disconnected (either via the disconnect() method or by an action from the remote), the remote clears pointers to all variables to free up
memory. Do not try to get status of the lights or any other information from the remote after it has disconnected, as you will probably end up throwing
NullPointerExceptions. The only methods guaranteed to work after the remote has been disconnected are the isConnected() method (will always return false
)
and the getBluetoothAddress() method.
Field Summary | |
---|---|
static byte |
I_ACCELEROMETER
Input channel for button information (2 byte payload) and accelerometer information (3 byte payload). |
static byte |
I_ACCELEROMETER_EXTENSION
Input channel for button information (2 byte payload), accelerometer information (3 byte payload), and extension information (16 byte payload). |
static byte |
I_ACCELEROMETER_IR
Input channel for button information (2 byte payload), accelerometer information (3 byte payload), and extended IR information (12 byte payload). |
static byte |
I_ACCELEROMETER_IR_EXTENSION
Input channel for button information (2 byte payload), accelerometer information (3 byte payload), basic IR information (10 byte payload), and extension information (6 byte payload). |
static byte |
I_BUTTONS
Input channel for button information (2 byte payload) only. |
static byte |
I_EXTENSION
Input channel for button information (2 byte payload) and extension information (8 byte payload). |
static byte |
I_EXTENSION2
Input channel for button information (2 byte payload) and extension information (19 byte payload). |
static byte |
I_EXTENSION3
Input channel for extension information (21 byte payload). |
static byte |
I_INTERLEAVED_ACCELEROMETER_IR1
Interleaved input channel for button information (2 byte payload), accelerometer information (1 byte payload), and full IR information (18 byte payload). |
static byte |
I_INTERLEAVED_ACCELEROMETER_IR2
Interleaved input channel for button information (2 byte payload), accelerometer information (1 byte payload), and full IR information (18 byte payload). |
static byte |
I_IR_EXTENSION
Input channel for button information (2 byte payload), basic IR information (10 byte payload), and extension information (9 byte payload). |
int |
reportsProcessed
|
static byte |
SF_ADPCM4U
Speaker output format: unsigned 4-bit ADPCM (Yamaha variant). |
static byte |
SF_PCM8S
Speaker output format: signed 8-bit PCM. |
Constructor Summary | |
---|---|
WiiRemote(AccelerationConstants accelConstants)
Constructs a blank WiiRemote that is not connected to an actual Wii Remote using the passed in parameters. |
Method Summary | |
---|---|
void |
addWiiRemoteListener(WiiRemoteListener listener)
Adds the specified WiiRemoteListener to this WiiRemote. |
static PrebufferedSound |
bufferSound(javax.sound.sampled.AudioInputStream audioIn)
Creates a prebuffered sound from the given AudioInputStream by reading audio data and packing it into ready-to-go sound reports. |
void |
disconnect()
Disconnects from the Wii Remote. |
void |
enableContinuous()
Enables a continuous data stream. |
boolean |
equals(java.lang.Object other)
Compares WiiRemotes based on their bluetooth addresses. |
AccelerationConstants |
getAccelerationConstants()
Returns the acceleration constants located on the WiiRemote. |
java.lang.String |
getBluetoothAddress()
Returns the bluetooth address of the WiiRemote. |
java.util.Vector<ButtonMap> |
getButtonMaps()
Returns the Vector containing all the button mappings (button(s) -> action(s)). |
WiiRemoteExtension |
getExtension()
Returns the currently connected extension or null if no extension is connected. |
WiiRemoteExtensionFactory |
getExtensionFactory()
Returns the extension factory responsible for recognizing connected extensions and creating WiiRemoteExtension objects. |
byte |
getInputReport()
Returns the input report the remote is currently using to receive data. |
int |
getIRMode()
Returns the current IRMode. |
boolean[] |
getLEDLights()
Returns the status of the LED lights. |
WiiRemoteMouse |
getMouse()
Returns the current mouse. |
double |
getSpeakerVolume()
Returns the current volume of the playing speaker as a percent from 0 to 1. |
boolean |
getUseMouse()
Gets the value of useMouse. |
boolean |
isAccelerometerEnabled()
Returns true if the accelerometer is enabled; otherwise false . |
boolean |
isConnected()
Returns true if connected to the Wii Remote; otherwise false . |
boolean |
isContinuousEnabled()
Returns true if continuous data streaming is enabled; otherwise false . |
boolean |
isExtensionConnected()
Returns true if an extension is connected and set up for input; otherwise false . |
boolean |
isExtensionEnabled()
Returns true if the extension is enabled (events will fire); otherwise false . |
boolean |
isIRSensorEnabled()
Returns true if the IR sensor is enabled; otherwise false . |
boolean |
isLEDIlluminated(int light)
Returns true if the specified LED is illuminated; otherwise false . |
boolean |
isModulatedVibrating()
Returns true if the remote is modulated vibrating; otherwise false . |
boolean |
isPlayingSound()
Returns true if the speaker is currently playing sound; otherwise false . |
boolean |
isReadingData()
Returns true if reading data; otherwise false . |
boolean |
isSpeakerEnabled()
Returns true if the speaker is enabled (sound can be played); otherwise false . |
boolean |
isSpeakerMuted()
Returns true if the speaker is muted; otherwise false . |
boolean |
isVibrating()
Returns true if the remote is vibrating; otherwise false . |
void |
modulatedVibrateFor(long time,
long interval)
Vibrates for the specified time, turning on and off at the specified interval. |
void |
muteSpeaker()
Mutes the speaker. |
void |
playPrebufferedSound(PrebufferedSound soundIn,
byte format)
Plays the given PrebufferedSound in the given format over the speaker. |
void |
playSound(javax.sound.sampled.AudioInputStream audioIn,
byte format)
Plays the given AudioInputStream in the given format over the speaker. |
int |
readData(byte[] address,
byte[] buffer,
int firstIndex,
int numBytes)
Reads data from the WiiRemote at the specified address. |
byte[] |
readData(byte[] address,
int numBytes)
Reads data from the WiiRemote at the specified address. |
void |
removeWiiRemoteListener(WiiRemoteListener listener)
Removes the specified WiiRemoteListener from this WiiRemote. |
void |
requestStatus()
Requests status of the WiiRemote, including battery level, LED status, etc. |
void |
setAccelerometerEnabled(boolean enabled)
Enables or disables the accelerometer. |
void |
setExtensionEnabled(boolean enabled)
Enables or disables the extension port. |
void |
setExtensionPayload(int payload)
Changes the extension payload to the specified value, if possible. |
void |
setIRSensorEnabled(boolean enabled,
int mode)
Enables or disables the IR sensor. |
void |
setIRSensorEnabled(boolean enabled,
int mode,
byte[] sens1,
byte[] sens2)
Deprecated. As of release 1.5, replaced by setIRSensorEnabled(boolean enabled, int mode, IRSensitivitySettings sensitivitySettings) .
This method may be made private in future releases! |
void |
setIRSensorEnabled(boolean enabled,
int mode,
IRSensitivitySettings sensitivitySettings)
Enables or disables the IR sensor. |
void |
setLEDIlluminated(int light,
boolean illuminated)
Sets the specified LED light to illuminated, where true is on and false is off. |
void |
setLEDLights(boolean[] lightStatus)
Sets all of the lights to the values specified in the status array, where true is on and false is off. |
void |
setMouse(WiiRemoteMouse mouse)
Turns the WiiRemote into a mouse. |
void |
setSpeakerEnabled(boolean enabled)
Enables or disables the speaker. |
void |
setSpeakerVolume(double volume)
Sets the speaker volume to the given volume (percent). |
void |
setUseMouse(boolean useMouse)
Sets the value of useMouse to the given value. |
void |
startModulatedVibrating(long interval)
Starts modulated vibrating, turning on and off at the specified interval. |
void |
startVibrating()
Starts vibration. |
void |
stopModulatedVibrating()
Stops modulated vibration. |
void |
stopSound()
Cuts off the current sound. |
void |
stopVibrating()
Stops vibration. |
void |
unmuteSpeaker()
Unmutes the speaker. |
void |
vibrateFor(long time)
Vibrates for the specified time. |
void |
waitForDataReadCompletion()
Waits for the current readData operation to complete before returning. |
void |
writeData(byte[] address,
byte[] data)
Writes data to the WiiRemote at the specified address. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int reportsProcessed
public static final byte SF_PCM8S
public static final byte SF_ADPCM4U
public static final byte I_BUTTONS
public static final byte I_ACCELEROMETER
public static final byte I_EXTENSION
public static final byte I_ACCELEROMETER_IR
public static final byte I_EXTENSION2
public static final byte I_ACCELEROMETER_EXTENSION
public static final byte I_IR_EXTENSION
public static final byte I_ACCELEROMETER_IR_EXTENSION
public static final byte I_EXTENSION3
public static final byte I_INTERLEAVED_ACCELEROMETER_IR1
public static final byte I_INTERLEAVED_ACCELEROMETER_IR2
Constructor Detail |
---|
public WiiRemote(AccelerationConstants accelConstants)
accelConstants
- information used in interpreting the Wii Remote's accelerometer data.Method Detail |
---|
public void requestStatus() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void setLEDIlluminated(int light, boolean illuminated) throws java.lang.IllegalArgumentException, java.io.IOException
true
is on and false
is off.
light
- the light to set. 0 specifies the first light, 1 the second, etc.illuminated
- if true
, turns the light on; otherwise, turns the light off.
java.lang.IllegalArgumentException
- if light is not an integer from 0 to 3.
java.io.IOException
- if there is an error sending data to the Wii Remote.public void setLEDLights(boolean[] lightStatus) throws java.lang.IllegalArgumentException, java.io.IOException
true
is on and false
is off.
lightStatus
- the status of each light. Every true
in the array represents a light that is on, every false
a light that is off.
java.lang.IllegalArgumentException
- if status does not have four entries.
java.io.IOException
- if there is an error sending data to the Wii Remote.public static PrebufferedSound bufferSound(javax.sound.sampled.AudioInputStream audioIn) throws java.io.IOException
audioIn
- the audio to buffer, correctly encoded in the format you plan to play it in.
java.io.IOException
- if there's an error reading the sound file.public void playPrebufferedSound(PrebufferedSound soundIn, byte format) throws java.io.IOException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
soundIn
- the sound to play.format
- a speaker format specified by a constant prefaced with SF_.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- if format is not a valid format.
java.lang.IllegalStateException
- if the speaker is not enabled.
java.lang.IllegalStateException
- if the speaker is already playing sound.SF_PCM8S
public void playSound(javax.sound.sampled.AudioInputStream audioIn, byte format) throws java.io.IOException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
audioIn
- the audio to play, correctly encoded in the given format.format
- a speaker format specified by a constant prefaced with SF_.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- if format is not a valid format.
java.lang.IllegalStateException
- if the speaker is not enabled.
java.lang.IllegalStateException
- if the speaker is already playing sound.SF_PCM8S
public void stopSound() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the speaker is not enabled.public void writeData(byte[] address, byte[] data) throws java.io.IOException, java.lang.IllegalArgumentException
address
- the address to write to. Must be 4 bytes. The first byte of the address indicates whether to write to memory (0x00) or registers (0x04).data
- the data to write. Must be between 1 and 16 bytes in length.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- if address is not 4 bytes long.
java.lang.IllegalArgumentException
- if data.length is not between 1 and 16.public byte[] readData(byte[] address, int numBytes) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.InterruptedException
address
- the address to read from. Must be 4 bytes. The first byte of the address indicates whether to read from memory (0x00) or registers (0x04).numBytes
- the length of the data to read (in bytes).
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- if address is not 4 bytes in length or if numBytes is less than 1.
java.lang.IllegalStateException
- if data is already being read.
java.io.IOException
- if there is an error reading the data. See WRDataEvent constant field values for details.
java.lang.InterruptedException
- if interrupted waiting for the data read to complete.waitForDataReadCompletion()
public int readData(byte[] address, byte[] buffer, int firstIndex, int numBytes) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.InterruptedException
address
- the address to read from. Must be 4 bytes. The first byte of the address indicates whether to read from memory (0x00) or registers (0x04).buffer
- the array to read data into.firstIndex
- the first index of buffer to add data to.numBytes
- the length of the data to read (in bytes). Must be between 1 and 65535 (0xFFFF).
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- if address is not 4 bytes in length or if numBytes is less than 1 or greater than 65535 (0xFFFF).
java.lang.IllegalStateException
- if data is already being read.
java.io.IOException
- if there is an error reading the data. See WRDataEvent constant field values for details.
java.lang.InterruptedException
- if interrupted waiting for the data read to complete.waitForDataReadCompletion()
public void waitForDataReadCompletion() throws java.lang.InterruptedException
java.lang.InterruptedException
- if interrupted waiting for the data read to complete.public void enableContinuous() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void setAccelerometerEnabled(boolean enabled) throws java.io.IOException, java.lang.IllegalStateException
enabled
- if true
, enables the accelerometer; otherwise, it disables the accelerometer.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalStateException
- if there are no input reports that will support the addition of the accelerometer. This is rare, as most reports
support the accelerometer. See static variables I_BUTTONS, I_ACCELEROMETER, etc for details.public void setIRSensorEnabled(boolean enabled, int mode) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException
false
, the other inputs are ignored.
enabled
- if true
, enables the IR sensor and continuous input; otherwise, it disables the IR sensor.mode
- the mode of the IR Sensor, specified in WRIREvent.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- enabled is true
and the specified mode is not recgonized.
java.lang.IllegalStateException
- if enabled is true
and there are no input reports that will support the addition of the given mode of IR.
The payload must match exactly (i.e. you can not use basic IR (10 bytes) with a report that supports extended (12 bytes)). If Full mode is enabled,
no extensions can be enabled.public void setIRSensorEnabled(boolean enabled, int mode, IRSensitivitySettings sensitivitySettings) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException
false
, the other inputs are ignored.
enabled
- if true
, enables the IR sensor and continuous input; otherwise, it disables the IR sensor.mode
- the mode of the IR Sensor, specified in WRIREvent.sensitivitySettings
- sensitivity settings for the IR camera.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- enabled is true
and the specified mode is not recgonized.
java.lang.IllegalStateException
- if enabled is true
and there are no input reports that will support the addition of the given mode of IR.
The payload must match exactly (i.e. you can not use basic IR (10 bytes) with a report that supports extended (12 bytes)). If Full mode is enabled,
no extensions can be enabled.@Deprecated public void setIRSensorEnabled(boolean enabled, int mode, byte[] sens1, byte[] sens2) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException
setIRSensorEnabled(boolean enabled, int mode, IRSensitivitySettings sensitivitySettings)
.
This method may be made private in future releases!
false
, the other inputs are ignored.
enabled
- if true
, enables the IR sensor and continuous input; otherwise, it disables the IR sensor.mode
- the mode of the IR Sensor, specified in WRIREvent.sens1
- the first sensitivity settings array. Must be 9 bytes long!sens2
- the second sensitivity settings array. Must be 2 bytes long!
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- enabled is true
and the specified mode is not recgonized.
java.lang.IllegalStateException
- if enabled is true
and there are no input reports that will support the addition of the given mode of IR.
The payload must match exactly (i.e. you can not use basic IR (10 bytes) with a report that supports extended (12 bytes)). If Full mode is enabled,
no extensions can be enabled.public void setSpeakerEnabled(boolean enabled) throws java.io.IOException
enabled
- if true
, enables the speaker; otherwise, it disables the speaker.
java.io.IOException
- if there is an error sending data to the Wii Remote.public void muteSpeaker() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void unmuteSpeaker() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void setExtensionEnabled(boolean enabled) throws java.io.IOException, java.lang.IllegalStateException
enabled
- if true
, enables the extension port; otherwise, it disables the extension port.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalStateException
- if enabled is true
and the extension is not connected.
java.lang.IllegalStateException
- if there are no input reports that will support the addition of the current extension. See static variables I_BUTTONS,
I_ACCELEROMETER, etc for details.public void setExtensionPayload(int payload) throws java.io.IOException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
payload
- the new extension payload.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalStateException
- if the extension is not enabled.
java.lang.IllegalArgumentException
- if the payload is not valid for this extension.
java.lang.IllegalStateException
- if there are no input reports that will support the modified payload (in addition to accelerometer, IR, etc: whatever's
enabled). See static variables I_BUTTONS, I_ACCELEROMETER, etc for details.public void startVibrating() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void startModulatedVibrating(long interval)
interval
- the the number of milliseconds to modulate with. Smaller values will produce lower-intensity vibrations over all. Note that values under 10 ms have
caused problems on Windows computers. Do not use modulated vibration unless it is necessary, and keep the interval above 10 ms if you plan on deploying to Windows
machines.public void stopVibrating() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void stopModulatedVibrating() throws java.io.IOException
java.io.IOException
- if there is an error sending data to the Wii Remote.public void modulatedVibrateFor(long time, long interval) throws java.lang.IllegalArgumentException
time
- the number of milliseconds to vibrate for.interval
- the the number of milliseconds to modulate with. Note that values under 10 ms have caused problems on Windows computers. Do not use modulated
vibration unless it is necessary, and keep the interval above 10 ms if you plan on deploying to Windows machines.
java.lang.IllegalArgumentException
- if interval is greater than time.public void vibrateFor(long time) throws java.io.IOException
time
- the number of milliseconds to vibrate for.
java.io.IOException
- if there is an error sending data to the Wii Remote.public void disconnect()
disconnect
in interface WiiDevice
public boolean isConnected()
true
if connected to the Wii Remote; otherwise false
.
isConnected
in interface WiiDevice
true
if connected to the Wii Remote; otherwise false
.public boolean isContinuousEnabled()
true
if continuous data streaming is enabled; otherwise false
. If true
, data is returned at a rate of 100 reports per
second.
true
if continuous data streaming is enabled; otherwise false
.public boolean isAccelerometerEnabled()
true
if the accelerometer is enabled; otherwise false
.
true
if the accelerometer is enabled; otherwise false
.public boolean isIRSensorEnabled()
true
if the IR sensor is enabled; otherwise false
.
true
if the IR sensor is enabled; otherwise false
.public boolean isVibrating()
true
if the remote is vibrating; otherwise false
.
true
if the remote is vibrating; otherwise false
.public boolean isModulatedVibrating()
true
if the remote is modulated vibrating; otherwise false
. Modulated vibrating simply means that the remote is turning vibration
on and off at a given interval to create different intensity vibrations. Therefore, isVibrating() could return true
or false
depending on
where in the cycle the modulated vibrating thread is (though there is more vibrating than not, so chances are it will return true
).
true
if the remote is modulated vibrating; otherwise false
.public boolean isExtensionConnected()
true
if an extension is connected and set up for input; otherwise false
.
true
if an extension is connected and set up for input; otherwise false
.public boolean isExtensionEnabled()
true
if the extension is enabled (events will fire); otherwise false
.
true
if the extension is enabled (events will fire); otherwise false
.public boolean isSpeakerEnabled()
true
if the speaker is enabled (sound can be played); otherwise false
. Note that if sound is currently being played, this
method will still return true, but attempting to play sound will result in an exception.
true
if the speaker is enabled (sound can be played); otherwise false
.public boolean isSpeakerMuted()
true
if the speaker is muted; otherwise false
. Note that you can still call playSound() on a muted speaker, however,
you just won't hear anything. If the speaker is unmuted in the middle of the sound, the sound will pick up where it was before.
true
if the speaker is muted; otherwise false
.public boolean isPlayingSound()
true
if the speaker is currently playing sound; otherwise false
. You can only play one sound at a time.
true
if the speaker is currently playing sound; otherwise false
.public boolean isReadingData()
true
if reading data; otherwise false
.
true
if reading data; otherwise false
.public boolean[] getLEDLights()
true
means illuminated.
public boolean isLEDIlluminated(int light)
true
if the specified LED is illuminated; otherwise false
.
light
- the number of the light to check. Ranges from 0 to 3.
true
if the specified LED is illuminated; otherwise false
.
java.lang.IllegalArgumentException
- if light is not an integer from 0 to 3.public double getSpeakerVolume()
public void setSpeakerVolume(double volume) throws java.io.IOException, java.lang.IllegalArgumentException
volume
- the volume as a percent from 0 to 1.
java.io.IOException
- if there is an error sending data to the Wii Remote.
java.lang.IllegalArgumentException
- if volume is less than 0 or greater than 1.public int getIRMode()
public WiiRemoteExtension getExtension()
null
if no extension is connected.
null
if no extension is connected.public WiiRemoteExtensionFactory getExtensionFactory()
public AccelerationConstants getAccelerationConstants()
public void setMouse(WiiRemoteMouse mouse)
null
to disable the mouse.
mouse
- the mouse to enable or null
to disable.public WiiRemoteMouse getMouse()
null
, in which case the mouse is disabled.
public java.util.Vector<ButtonMap> getButtonMaps()
public byte getInputReport()
public void addWiiRemoteListener(WiiRemoteListener listener)
listener
- the listener to add.public void removeWiiRemoteListener(WiiRemoteListener listener)
listener
- the listener to remove.public java.lang.String getBluetoothAddress()
getBluetoothAddress
in interface WiiDevice
public void setUseMouse(boolean useMouse)
true
, then the WiiRemote will parse all mouse actions when processing events.
If false
, then the WiiRemote will omit parsing some mouse actions so that devices without mice may still use the program. However, it is still the
user's responsibility not to add mice or to map mice to button presses, etc.
useMouse
- true
if mice should be used. false
otherwise.public boolean getUseMouse()
true
, then the WiiRemote will parse all mouse actions when processing events.
If false
, then the WiiRemote will omit parsing some mouse actions so that devices without mice may still use the program. However, it is still the
user's responsibility not to add mice or to map mice to button presses, etc.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
true
if the WiiRemotes are the same (have the same Bluetooth address); otherwise false
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |