|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
wiiusej.WiiUseApiManager
public class WiiUseApiManager
Class that manages the use of Wiiuse API.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private int |
connected
|
private static WiiUseApiManager |
instance
|
private boolean |
leave
|
private javax.swing.event.EventListenerList |
listeners
|
private java.util.concurrent.atomic.AtomicBoolean |
running
|
private java.util.concurrent.Semaphore |
semaphore
|
private Wiimote[] |
wiimotes
|
private WiiUseApi |
wiiuse
|
static int |
WIIUSE_STACK_BLUESOLEIL
|
static int |
WIIUSE_STACK_MS
|
static int |
WIIUSE_STACK_UNKNOWN
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
WiiUseApiManager()
|
Method Summary | |
---|---|
protected void |
activateContinuous(int id)
Activate continuous for the wiimotes with the given id. |
protected void |
activateIRTRacking(int id)
Activate IR Tracking for the wiimote with the given id. |
protected void |
activateMotionSensing(int id)
Activate motion sensing for the wiimote with the given id. |
protected void |
activateRumble(int id)
Activate the rumble for the wiimote with the given id. |
protected void |
activateSmoothing(int id)
Activate smoothing the wiimotes with the given id. |
protected void |
addWiiUseApiListener(WiiUseApiListener listener)
Add WiiUseApiListener to the listeners list. |
protected void |
closeConnection(int id)
Ask the thread to close a connection. |
private int |
connectWiimotes(int nb,
boolean rumble,
boolean forceStackType,
int stackType)
Connect wiimote and get the number of wiimotes connected. |
protected void |
deactivateContinuous(int id)
Deactivate continuous for the wiimotes with the given id. |
protected void |
deactivateIRTRacking(int id)
Deactivate IR Tracking for the wiimote with the given id. |
protected void |
deactivateMotionSensing(int id)
Deactivate motion sensing for the wiimoter with the given id. |
protected void |
deactivateRumble(int id)
Deactivate the rumble for the wiimote with the given id. |
protected void |
deactivateSmoothing(int id)
Deactivate smoothing the wiimotes with the given id. |
static void |
definitiveShutdown()
Stop wiiuseJ definitively for this program. |
protected void |
finalize()
Called by the garbage collector at the end. |
private static WiiUseApiManager |
getInstance()
|
static int |
getNbConnectedWiimotes()
Get the number of wiimotes connected. |
protected void |
getStatus(int id)
Get Status for the wiimote for the given id. |
static Wiimote[] |
getWiimotes(int nb,
boolean rumble)
Get wiimotes. |
static Wiimote[] |
getWiimotes(int nb,
boolean rumble,
int stackType)
Get wiimotes. |
private static Wiimote[] |
getWiimotesPrivate(int nb,
boolean rumble,
boolean forceStackType,
int stackType)
Get wiimotes. |
protected WiiUseApiListener[] |
getWiiUseApiListeners()
Get the list of WiiUseApiListeners. |
private void |
notifyWiiUseApiListener(WiiUseApiEvent evt)
Notify WiiUseApiListeners that an event occured. |
protected void |
removeWiiUseApiListener(WiiUseApiListener listener)
Remove WiiUseApiListener from the listeners list. |
protected void |
reSync(int id)
Try to resync with the wiimote by starting a new handshake. |
void |
run()
|
protected void |
setAccelerationThreshold(int id,
int th)
Set the acceleration threshold for the given id. |
protected void |
setAlphaSmoothing(int id,
float th)
Set alpha smoothing for the given id. |
private void |
setBlueToothstackType(int type)
Force the bluetooth stack type. |
protected void |
setIrSensitivity(int id,
int level)
Set the IR sensitivity. |
protected void |
setLeds(int id,
boolean l1,
boolean l2,
boolean l3,
boolean l4)
Set leds for the wiimotes with the given id. |
protected void |
setNunchukAccelerationThreshold(int id,
int th)
Set the nunchuk acceleration threshold for the given id. |
protected void |
setNunchukOrientationThreshold(int id,
float th)
Set the nunchuk orientation threshold for the given id. |
protected void |
setOrientationThreshold(int id,
float th)
Set the orientation threshold for the given id. |
protected void |
setScreenAspectRatio169(int id)
Set screen aspect ratio to 16/9 for the given id. |
protected void |
setScreenAspectRatio43(int id)
Set screen aspect ratio to 4/3 for the given id. |
protected void |
setSensorBarAboveScreen(int id)
Set the sensor bar to be above the screen. |
protected void |
setSensorBarBelowScreen(int id)
Set the sensor bar to be below the screen. |
protected void |
setTimeout(int id,
short normalTimeout,
short expansionTimeout)
Set the normal and expansion handshake timeouts. |
protected void |
setVirtualResolution(int id,
int x,
int y)
Set virtual resolution. |
static void |
shutdown()
Stop thread and shutdown wiiuse Api. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static WiiUseApiManager instance
private final javax.swing.event.EventListenerList listeners
private java.util.concurrent.Semaphore semaphore
private Wiimote[] wiimotes
private WiiUseApi wiiuse
private int connected
private java.util.concurrent.atomic.AtomicBoolean running
private boolean leave
public static int WIIUSE_STACK_UNKNOWN
public static int WIIUSE_STACK_MS
public static int WIIUSE_STACK_BLUESOLEIL
Constructor Detail |
---|
public WiiUseApiManager()
Method Detail |
---|
private static WiiUseApiManager getInstance()
public static Wiimote[] getWiimotes(int nb, boolean rumble)
nb
- try to connect nb wiimotes.rumble
- make the connected wiimotes rumble.
public static Wiimote[] getWiimotes(int nb, boolean rumble, int stackType)
nb
- try to connect nb wiimotes.rumble
- make the connected wiimotes rumble.*stackType
- the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or
WiiUseApiManager.WIIUSE_STACK_MS or
WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL
private static Wiimote[] getWiimotesPrivate(int nb, boolean rumble, boolean forceStackType, int stackType)
nb
- try to connect nb wiimotes.rumble
- make the connected wiimotes rumble.*forceStackType
- true if we want to force the stack type.stackType
- the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or
WiiUseApiManager.WIIUSE_STACK_MS or
WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL
private int connectWiimotes(int nb, boolean rumble, boolean forceStackType, int stackType)
nb
- try to connect nb wiimotesrumble
- make the connected wiimotes rumbleforceStackType
- true if we want to force the stack type.stackType
- the stack type : WiiUseApiManager.WIIUSE_STACK_UNKNOWN or
WiiUseApiManager.WIIUSE_STACK_MS or
WiiUseApiManager.WIIUSE_STACK_BLUESOLEIL
protected void closeConnection(int id)
id
- id of the wiimote to disconnect.public static int getNbConnectedWiimotes()
public static void shutdown()
public static void definitiveShutdown()
protected void activateRumble(int id)
id
- id of the wiimote.protected void deactivateRumble(int id)
id
- id of the wiimote.protected void activateIRTRacking(int id)
id
- id of the wiimote.protected void deactivateIRTRacking(int id)
id
- id of the wiimote.protected void activateMotionSensing(int id)
id
- id of the wiimote.protected void deactivateMotionSensing(int id)
id
- id of the wiimote.protected void activateSmoothing(int id)
id
- id of the wiimote.protected void deactivateSmoothing(int id)
id
- id of the wiimote.protected void activateContinuous(int id)
id
- id of the wiimote.protected void deactivateContinuous(int id)
id
- id of the wiimote.protected void setLeds(int id, boolean l1, boolean l2, boolean l3, boolean l4)
id
- id of the wiimotel1
- status of led1. True : ON, False : OFF.l2
- status of led2. True : ON, False : OFF.l3
- status of led3. True : ON, False : OFF.l4
- status of led4. True : ON, False : OFF.protected void setOrientationThreshold(int id, float th)
id
- id of the wiimote.th
- threshold in degrees.protected void setAccelerationThreshold(int id, int th)
id
- id of the wiimote.th
- threshold.protected void setAlphaSmoothing(int id, float th)
id
- id of the wiimote.th
- threshold.protected void reSync(int id)
id
- id of the wiimote.protected void setScreenAspectRatio43(int id)
id
- id of the wiimote.protected void setScreenAspectRatio169(int id)
id
- id of the wiimote.protected void setSensorBarAboveScreen(int id)
id
- id of the wiimote.protected void setSensorBarBelowScreen(int id)
id
- id of the wiimote.protected void setVirtualResolution(int id, int x, int y)
id
- id of the wiimote.x
- x resolution.y
- y resolution.protected void getStatus(int id)
id
- id of the wiimote.protected void setTimeout(int id, short normalTimeout, short expansionTimeout)
id
- the id of the wiimote concerned.normalTimeout
- The timeout in milliseconds for a normal read.expansionTimeout
- The timeout in millisecondsd to wait for an expansion
handshake.protected void setIrSensitivity(int id, int level)
id
- the id of the wiimote concerned.level
- 1-5, same as Wii system sensitivity setting. If the level is <
1, then level will be set to 1. If the level is > 5, then
level will be set to 5.protected void setNunchukOrientationThreshold(int id, float th)
id
- id of the wiimote.th
- threshold in degrees.protected void setNunchukAccelerationThreshold(int id, int th)
id
- id of the wiimote.th
- threshold.private void setBlueToothstackType(int type)
type
- must be WIIUSE_STACK_UNKNOWN or WIIUSE_STACK_MS or
WIIUSE_STACK_BLUESOLEIL.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void addWiiUseApiListener(WiiUseApiListener listener)
listener
- a WiiUseApiListenerprotected void removeWiiUseApiListener(WiiUseApiListener listener)
listener
- a WiiUseApiListenerprotected WiiUseApiListener[] getWiiUseApiListeners()
private void notifyWiiUseApiListener(WiiUseApiEvent evt)
evt
- GenericEvent occuredprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |