first working version on wiiuse 0.10
git-svn-id: http://wiiusej.googlecode.com/svn/trunk@59 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
@@ -42,10 +42,12 @@ public class Tests implements WiimoteListener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int nb = 0;
|
||||
|
||||
@Override
|
||||
public void wiimoteEvent(WiiMoteEvent e) {
|
||||
|
||||
System.out.println("Number of events : "+nb++);
|
||||
if (dump == DISPLAY_EACH_VALUE) {
|
||||
// System.out.println("*********** WIIMOTE ID : "+
|
||||
// e.getWiimoteId() + " **************");
|
||||
@@ -171,7 +173,7 @@ public class Tests implements WiimoteListener {
|
||||
}
|
||||
|
||||
/* get status */
|
||||
if (e.isButtonMinusJustPressed() && e.isButtonPlusJustPressed()) {
|
||||
if (e.isButtonUpJustPressed()) {
|
||||
wiimote.getStatus();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ public class WiiUseApiManager extends Thread {
|
||||
if (manager.connected < 0) {
|
||||
int nbWiimotes = manager.connectWiimotes(nb);
|
||||
manager.wiimotes = new Wiimote[nbWiimotes];
|
||||
for (int i = 0; i < nbWiimotes; i++) {
|
||||
for (int i = 1; i <= nbWiimotes; i++) {
|
||||
Wiimote wim = new Wiimote(i, manager);
|
||||
manager.wiimotes[i] = wim;
|
||||
manager.wiimotes[i-1] = wim;
|
||||
manager.addWiiUseApiListener(wim);
|
||||
}
|
||||
}
|
||||
@@ -99,8 +99,8 @@ public class WiiUseApiManager extends Thread {
|
||||
* id of the wiimote to disconnect.
|
||||
*/
|
||||
public void closeConnection(int id) {
|
||||
removeWiiUseApiListener(wiimotes[id]);
|
||||
wiimotes[id] = null;
|
||||
removeWiiUseApiListener(wiimotes[id-1]);
|
||||
wiimotes[id-1] = null;
|
||||
requests.add(new WiiUseApiRequest(id,
|
||||
WiiUseApiRequest.WIIUSE_CLOSE_CONNECTION_REQUEST));
|
||||
System.out.println("Wiimote " + id + " disconnected !");
|
||||
|
||||
@@ -30,7 +30,7 @@ public class EventsGatherer {
|
||||
* @param e
|
||||
* the event to add.
|
||||
*/
|
||||
private void addEvent(WiiUseApiEvent e) {
|
||||
private void addEvent(WiiUseApiEvent e) {
|
||||
events[index] = e;
|
||||
index++;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class EventsGatherer {
|
||||
*/
|
||||
public void addStatusEvent(int id, boolean connect, float batt, short led,
|
||||
boolean speak, int attach, boolean rumbleState,
|
||||
float orientationThreshold, float accelerationThreshold,
|
||||
float orientationThreshold, int accelerationThreshold,
|
||||
float alphaSmooth, boolean continuousState, boolean smoothingState,
|
||||
boolean irState, boolean motionSensingState) {
|
||||
StatusEvent evt = new StatusEvent(id, connect, batt, led, speak,
|
||||
|
||||
@@ -29,7 +29,7 @@ public class StatusEvent extends WiiUseApiEvent {
|
||||
|
||||
private float orientationThreshold = 0;
|
||||
|
||||
private float accelerationThreshold = 0;
|
||||
private int accelerationThreshold = 0;
|
||||
|
||||
private float alphaSmoothing = 0;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class StatusEvent extends WiiUseApiEvent {
|
||||
*/
|
||||
public StatusEvent(int id, boolean connect, float batt, short led,
|
||||
boolean speak, int attach, boolean rumbleState,
|
||||
float orientationThreshold, float accelerationThreshold,
|
||||
float orientationThreshold, int accelerationThreshold,
|
||||
float alphaSmooth, boolean continuousState, boolean smoothingState,
|
||||
boolean irState, boolean motionSensingState) {
|
||||
super(id, WiiUseApiEvent.STATUS_EVENT);
|
||||
@@ -174,7 +174,7 @@ public class StatusEvent extends WiiUseApiEvent {
|
||||
*
|
||||
* @return the accelerationThreshold
|
||||
*/
|
||||
public float getAccelerationThreshold() {
|
||||
public int getAccelerationThreshold() {
|
||||
return accelerationThreshold;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user