new send requests logic
git-svn-id: http://wiiusej.googlecode.com/svn/trunk@126 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
@@ -51,18 +51,18 @@ public class WiiUseApi {
|
|||||||
* @return 0 if there is an error otherwise it returns the number of
|
* @return 0 if there is an error otherwise it returns the number of
|
||||||
* wiimotes connected.
|
* wiimotes connected.
|
||||||
*/
|
*/
|
||||||
native int doConnections(int nb, boolean rumble);
|
synchronized native int doConnections(int nb, boolean rumble);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close connection to the wiimote with the given id.
|
* Close connection to the wiimote with the given id.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
native void closeConnection(int id);
|
synchronized native void closeConnection(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shutdown Wiiuse API.
|
* Shutdown Wiiuse API.
|
||||||
*/
|
*/
|
||||||
native void shutdownApi();
|
synchronized native void shutdownApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate rumble on the wiimote with the given id.
|
* Activate rumble on the wiimote with the given id.
|
||||||
@@ -70,7 +70,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote.
|
* the id of the wiimote.
|
||||||
*/
|
*/
|
||||||
native void activateRumble(int id);
|
synchronized native void activateRumble(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deactivate rumble on the wiimote with the given id.
|
* Deactivate rumble on the wiimote with the given id.
|
||||||
@@ -78,7 +78,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote.
|
* the id of the wiimote.
|
||||||
*/
|
*/
|
||||||
native void deactivateRumble(int id);
|
synchronized native void deactivateRumble(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate IR Tracking on the wiimote with the given id.
|
* Activate IR Tracking on the wiimote with the given id.
|
||||||
@@ -86,7 +86,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote.
|
* the id of the wiimote.
|
||||||
*/
|
*/
|
||||||
native void activateIRTracking(int id);
|
synchronized native void activateIRTracking(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deactivate IR Tracking on the wiimote with the given id.
|
* Deactivate IR Tracking on the wiimote with the given id.
|
||||||
@@ -94,7 +94,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote.
|
* the id of the wiimote.
|
||||||
*/
|
*/
|
||||||
native void deactivateIRTracking(int id);
|
synchronized native void deactivateIRTracking(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate motion sensing on the wiimote with the given id.
|
* Activate motion sensing on the wiimote with the given id.
|
||||||
@@ -102,7 +102,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote.
|
* the id of the wiimote.
|
||||||
*/
|
*/
|
||||||
native void activateMotionSensing(int id);
|
synchronized native void activateMotionSensing(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deactivate motion sensing on the wiimote with the given id.
|
* Deactivate motion sensing on the wiimote with the given id.
|
||||||
@@ -110,7 +110,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote.
|
* the id of the wiimote.
|
||||||
*/
|
*/
|
||||||
native void deactivateMotionSensing(int id);
|
synchronized native void deactivateMotionSensing(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set wiimote leds status.
|
* Set wiimote leds status.
|
||||||
@@ -126,7 +126,7 @@ public class WiiUseApi {
|
|||||||
* @param led4
|
* @param led4
|
||||||
* status of led4: True=ON, False=OFF
|
* status of led4: True=ON, False=OFF
|
||||||
*/
|
*/
|
||||||
native void setLeds(int id, boolean led1, boolean led2, boolean led3,
|
synchronized native void setLeds(int id, boolean led1, boolean led2, boolean led3,
|
||||||
boolean led4);
|
boolean led4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,7 +137,7 @@ public class WiiUseApi {
|
|||||||
* @param angle
|
* @param angle
|
||||||
* minimum angle detected by an event
|
* minimum angle detected by an event
|
||||||
*/
|
*/
|
||||||
native void setOrientThreshold(int id, float angle);
|
synchronized native void setOrientThreshold(int id, float angle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set how much acceleration must change to generate an event.
|
* Set how much acceleration must change to generate an event.
|
||||||
@@ -147,7 +147,7 @@ public class WiiUseApi {
|
|||||||
* @param value
|
* @param value
|
||||||
* minimum value detected by an event
|
* minimum value detected by an event
|
||||||
*/
|
*/
|
||||||
native void setAccelThreshold(int id, int value);
|
synchronized native void setAccelThreshold(int id, int value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set alpha smoothing parameter for the given id.
|
* Set alpha smoothing parameter for the given id.
|
||||||
@@ -157,7 +157,7 @@ public class WiiUseApi {
|
|||||||
* @param value
|
* @param value
|
||||||
* alpha smoothing value
|
* alpha smoothing value
|
||||||
*/
|
*/
|
||||||
native void setAlphaSmoothing(int id, float value);
|
synchronized native void setAlphaSmoothing(int id, float value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to resync with the wiimote by starting a new handshake.
|
* Try to resync with the wiimote by starting a new handshake.
|
||||||
@@ -165,7 +165,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* id of the wiimote concerned
|
* id of the wiimote concerned
|
||||||
*/
|
*/
|
||||||
native void reSync(int id);
|
synchronized native void reSync(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the the accelerometers give smoother results. This is set by
|
* Make the the accelerometers give smoother results. This is set by
|
||||||
@@ -174,7 +174,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote concerned
|
* the id of the wiimote concerned
|
||||||
*/
|
*/
|
||||||
native void activateSmoothing(int id);
|
synchronized native void activateSmoothing(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the the accelerometers give raw results.
|
* Make the the accelerometers give raw results.
|
||||||
@@ -182,7 +182,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote concerned
|
* the id of the wiimote concerned
|
||||||
*/
|
*/
|
||||||
native void deactivateSmoothing(int id);
|
synchronized native void deactivateSmoothing(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the wiimote generate an event each time we poll. Not set by default.
|
* Make the wiimote generate an event each time we poll. Not set by default.
|
||||||
@@ -190,7 +190,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote concerned
|
* the id of the wiimote concerned
|
||||||
*/
|
*/
|
||||||
native void activateContinuous(int id);
|
synchronized native void activateContinuous(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the wiimote generate an event only when there is one.
|
* Make the wiimote generate an event only when there is one.
|
||||||
@@ -198,7 +198,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote concerned
|
* the id of the wiimote concerned
|
||||||
*/
|
*/
|
||||||
native void deactivateContinuous(int id);
|
synchronized native void deactivateContinuous(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify wiiuse that your screen has an aspect ratio of 4/3.
|
* Notify wiiuse that your screen has an aspect ratio of 4/3.
|
||||||
@@ -206,7 +206,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote of which we want the status.
|
* the id of the wiimote of which we want the status.
|
||||||
*/
|
*/
|
||||||
native void setScreenRatio43(int id);
|
synchronized native void setScreenRatio43(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify wiiuse that your screen has an aspect ratio of 16/9.
|
* Notify wiiuse that your screen has an aspect ratio of 16/9.
|
||||||
@@ -214,7 +214,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote of which we want the status.
|
* the id of the wiimote of which we want the status.
|
||||||
*/
|
*/
|
||||||
native void setScreenRatio169(int id);
|
synchronized native void setScreenRatio169(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify wiiuse that the sensor bar is above your screen.
|
* Notify wiiuse that the sensor bar is above your screen.
|
||||||
@@ -222,7 +222,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote of which we want the status.
|
* the id of the wiimote of which we want the status.
|
||||||
*/
|
*/
|
||||||
native void setSensorBarAboveScreen(int id);
|
synchronized native void setSensorBarAboveScreen(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify wiiuse that the sensor bar is below your screen.
|
* Notify wiiuse that the sensor bar is below your screen.
|
||||||
@@ -230,7 +230,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote of which we want the status.
|
* the id of the wiimote of which we want the status.
|
||||||
*/
|
*/
|
||||||
native void setSensorBarBelowScreen(int id);
|
synchronized native void setSensorBarBelowScreen(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set virtual screen resolution. It is used to automatically compute the
|
* Set virtual screen resolution. It is used to automatically compute the
|
||||||
@@ -244,7 +244,7 @@ public class WiiUseApi {
|
|||||||
* @param y
|
* @param y
|
||||||
* y resolution.
|
* y resolution.
|
||||||
*/
|
*/
|
||||||
native void setVirtualScreenResolution(int id, int x, int y);
|
synchronized native void setVirtualScreenResolution(int id, int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get status and values from the wiimotes and send it through callbacks.
|
* Get status and values from the wiimotes and send it through callbacks.
|
||||||
@@ -252,7 +252,7 @@ public class WiiUseApi {
|
|||||||
* @param id
|
* @param id
|
||||||
* the id of the wiimote of which we want the status.
|
* the id of the wiimote of which we want the status.
|
||||||
*/
|
*/
|
||||||
native void getStatus(int id);
|
synchronized native void getStatus(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for new Events and Get it.
|
* Check for new Events and Get it.
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package wiiusej;
|
package wiiusej;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import javax.swing.event.EventListenerList;
|
import javax.swing.event.EventListenerList;
|
||||||
@@ -24,11 +23,6 @@ import javax.swing.event.EventListenerList;
|
|||||||
import wiiusej.wiiuseapievents.EventsGatherer;
|
import wiiusej.wiiuseapievents.EventsGatherer;
|
||||||
import wiiusej.wiiuseapievents.WiiUseApiEvent;
|
import wiiusej.wiiuseapievents.WiiUseApiEvent;
|
||||||
import wiiusej.wiiuseapievents.WiiUseApiListener;
|
import wiiusej.wiiuseapievents.WiiUseApiListener;
|
||||||
import wiiusej.wiiuseapirequest.FloatValueRequest;
|
|
||||||
import wiiusej.wiiuseapirequest.IntValueRequest;
|
|
||||||
import wiiusej.wiiuseapirequest.LedsRequest;
|
|
||||||
import wiiusej.wiiuseapirequest.TwoIntValueRequest;
|
|
||||||
import wiiusej.wiiuseapirequest.WiiUseApiRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that manages the use of Wiiuse API.
|
* Class that manages the use of Wiiuse API.
|
||||||
@@ -49,9 +43,6 @@ public class WiiUseApiManager extends Thread {
|
|||||||
|
|
||||||
private AtomicBoolean running = new AtomicBoolean(false);
|
private AtomicBoolean running = new AtomicBoolean(false);
|
||||||
|
|
||||||
private WiiUseApiRequestsManager requestManager = WiiUseApiRequestsManager
|
|
||||||
.getInstance();
|
|
||||||
|
|
||||||
public static WiiUseApiManager getInstance() {
|
public static WiiUseApiManager getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -83,10 +74,8 @@ public class WiiUseApiManager extends Thread {
|
|||||||
return new Wiimote[0];
|
return new Wiimote[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!manager.isAlive()){
|
if (!manager.isAlive())
|
||||||
manager.start();
|
manager.start();
|
||||||
manager.requestManager.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
return manager.wiimotes;
|
return manager.wiimotes;
|
||||||
}
|
}
|
||||||
@@ -122,12 +111,12 @@ public class WiiUseApiManager extends Thread {
|
|||||||
connected--;
|
connected--;
|
||||||
if (connected == 0) {// stop this thread if there is
|
if (connected == 0) {// stop this thread if there is
|
||||||
// no more wiimotes connected.
|
// no more wiimotes connected.
|
||||||
//stop thread
|
// stop thread
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
|
||||||
WiiUseApiRequest.WIIUSE_CLOSE_CONNECTION_REQUEST));
|
/* Close connections requests */
|
||||||
// System.out.println("Wiimote " + id + " disconnected !");
|
wiiuse.closeConnection(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,8 +149,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void activateRumble(int id) {
|
public void activateRumble(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.activateRumble(id);
|
||||||
WiiUseApiRequest.WIIUSE_ACTIVATE_RUMBLE_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,8 +159,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void deactivateRumble(int id) {
|
public void deactivateRumble(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.deactivateRumble(id);
|
||||||
WiiUseApiRequest.WIIUSE_DEACTIVATE_RUMBLE_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,8 +169,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void activateIRTRacking(int id) {
|
public void activateIRTRacking(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.activateIRTracking(id);
|
||||||
WiiUseApiRequest.WIIUSE_ACTIVATE_IR_TRACKING_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,8 +179,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void deactivateIRTRacking(int id) {
|
public void deactivateIRTRacking(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.deactivateIRTracking(id);
|
||||||
WiiUseApiRequest.WIIUSE_DEACTIVATE_IR_TRACKING_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,8 +189,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void activateMotionSensing(int id) {
|
public void activateMotionSensing(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.activateMotionSensing(id);
|
||||||
WiiUseApiRequest.WIIUSE_ACTIVATE_MOTION_SENSING_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,8 +199,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void deactivateMotionSensing(int id) {
|
public void deactivateMotionSensing(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.deactivateMotionSensing(id);
|
||||||
WiiUseApiRequest.WIIUSE_DEACTIVATE_MOTION_SENSING_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,8 +209,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void activateSmoothing(int id) {
|
public void activateSmoothing(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.activateSmoothing(id);
|
||||||
WiiUseApiRequest.WIIUSE_ACTIVATE_SMOOTHING_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,8 +219,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void deactivateSmoothing(int id) {
|
public void deactivateSmoothing(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.deactivateSmoothing(id);
|
||||||
WiiUseApiRequest.WIIUSE_DEACTIVATE_SMOOTHING_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,8 +229,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote.
|
* id of the wiimote.
|
||||||
*/
|
*/
|
||||||
public void activateContinuous(int id) {
|
public void activateContinuous(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.activateContinuous(id);
|
||||||
WiiUseApiRequest.WIIUSE_ACTIVATE_CONTINUOUS_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,8 +239,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void deactivateContinuous(int id) {
|
public void deactivateContinuous(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.deactivateContinuous(id);
|
||||||
WiiUseApiRequest.WIIUSE_DEACTIVATE_CONTINUOUS_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,8 +257,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* status of led4. True : ON, False : OFF
|
* status of led4. True : ON, False : OFF
|
||||||
*/
|
*/
|
||||||
public void setLeds(int id, boolean l1, boolean l2, boolean l3, boolean l4) {
|
public void setLeds(int id, boolean l1, boolean l2, boolean l3, boolean l4) {
|
||||||
requestManager.addRequests(new LedsRequest(id,
|
wiiuse.setLeds(id, l1, l2, l3, l4);
|
||||||
WiiUseApiRequest.WIIUSE_LEDS_REQUEST, l1, l2, l3, l4));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,8 +269,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* threshold in degrees
|
* threshold in degrees
|
||||||
*/
|
*/
|
||||||
public void setOrientationThreshold(int id, float th) {
|
public void setOrientationThreshold(int id, float th) {
|
||||||
requestManager.addRequests(new FloatValueRequest(id,
|
wiiuse.setOrientThreshold(id, th);
|
||||||
WiiUseApiRequest.WIIUSE_ORIENT_THRESHOLHD_REQUEST, th));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -304,8 +281,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* threshold
|
* threshold
|
||||||
*/
|
*/
|
||||||
public void setAccelerationThreshold(int id, int th) {
|
public void setAccelerationThreshold(int id, int th) {
|
||||||
requestManager.addRequests(new IntValueRequest(id,
|
wiiuse.setAccelThreshold(id, th);
|
||||||
WiiUseApiRequest.WIIUSE_ACCEL_THRESHOLHD_REQUEST, th));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -317,8 +293,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* threshold
|
* threshold
|
||||||
*/
|
*/
|
||||||
public void setAlphaSmoothing(int id, float th) {
|
public void setAlphaSmoothing(int id, float th) {
|
||||||
requestManager.addRequests(new FloatValueRequest(id,
|
wiiuse.setAlphaSmoothing(id, th);
|
||||||
WiiUseApiRequest.WIIUSE_ALPHA_SMOOTHING_REQUEST, th));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -328,8 +303,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void reSync(int id) {
|
public void reSync(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.reSync(id);
|
||||||
WiiUseApiRequest.WIIUSE_RESYNC));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -339,8 +313,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void setScreenAspectRatio43(int id) {
|
public void setScreenAspectRatio43(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.setScreenRatio43(id);
|
||||||
WiiUseApiRequest.WIIUSE_ASPECT_RATIO_4_3));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,8 +323,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void setScreenAspectRatio169(int id) {
|
public void setScreenAspectRatio169(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.setScreenRatio169(id);
|
||||||
WiiUseApiRequest.WIIUSE_ASPECT_RATIO_16_9));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -361,8 +333,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void setSensorBarAboveScreen(int id) {
|
public void setSensorBarAboveScreen(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.setSensorBarAboveScreen(id);
|
||||||
WiiUseApiRequest.WIIUSE_SENSOR_BAR_ABOVE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -372,8 +343,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void setSensorBarBelowScreen(int id) {
|
public void setSensorBarBelowScreen(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.setSensorBarBelowScreen(id);
|
||||||
WiiUseApiRequest.WIIUSE_SENSOR_BAR_BELOW));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -389,8 +359,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* y resolution
|
* y resolution
|
||||||
*/
|
*/
|
||||||
public void setVirtualResolution(int id, int x, int y) {
|
public void setVirtualResolution(int id, int x, int y) {
|
||||||
requestManager.addRequests(new TwoIntValueRequest(id,
|
wiiuse.setVirtualScreenResolution(id, x, y);
|
||||||
WiiUseApiRequest.WIIUSE_SET_VIRTUAL_RESOLUTION, x, y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -400,8 +369,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote
|
* id of the wiimote
|
||||||
*/
|
*/
|
||||||
public void getStatus(int id) {
|
public void getStatus(int id) {
|
||||||
requestManager.addRequests(new WiiUseApiRequest(id,
|
wiiuse.getStatus(id);
|
||||||
WiiUseApiRequest.WIIUSE_STATUS_REQUEST));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -417,9 +385,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
while (running.get() && connected > 0) {
|
while (running.get() && connected > 0) {
|
||||||
|
|
||||||
/* Polling */
|
/* Polling */
|
||||||
synchronized (wiiuse) {
|
|
||||||
wiiuse.specialPoll(gather);
|
wiiuse.specialPoll(gather);
|
||||||
}
|
|
||||||
|
|
||||||
/* deal with events gathered in Wiiuse API */
|
/* deal with events gathered in Wiiuse API */
|
||||||
for (WiiUseApiEvent evt : gather.getEvents()) {
|
for (WiiUseApiEvent evt : gather.getEvents()) {
|
||||||
|
|||||||
@@ -19,12 +19,11 @@ package wiiusej;
|
|||||||
import javax.swing.event.EventListenerList;
|
import javax.swing.event.EventListenerList;
|
||||||
|
|
||||||
import wiiusej.wiiuseapievents.DisconnectionEvent;
|
import wiiusej.wiiuseapievents.DisconnectionEvent;
|
||||||
import wiiusej.wiiuseapievents.StatusEvent;
|
|
||||||
import wiiusej.wiiuseapievents.GenericEvent;
|
import wiiusej.wiiuseapievents.GenericEvent;
|
||||||
|
import wiiusej.wiiuseapievents.StatusEvent;
|
||||||
import wiiusej.wiiuseapievents.WiiUseApiEvent;
|
import wiiusej.wiiuseapievents.WiiUseApiEvent;
|
||||||
import wiiusej.wiiuseapievents.WiiUseApiListener;
|
import wiiusej.wiiuseapievents.WiiUseApiListener;
|
||||||
import wiiusej.wiiuseapievents.WiimoteListener;
|
import wiiusej.wiiuseapievents.WiimoteListener;
|
||||||
import wiiusej.wiiuseapirequest.WiiUseApiRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that represents a wiimote.
|
* Class that represents a wiimote.
|
||||||
|
|||||||
Reference in New Issue
Block a user