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:
@@ -43,9 +43,11 @@ public class Tests implements WiimoteListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int nb = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void wiimoteEvent(WiiMoteEvent e) {
|
public void wiimoteEvent(WiiMoteEvent e) {
|
||||||
|
System.out.println("Number of events : "+nb++);
|
||||||
if (dump == DISPLAY_EACH_VALUE) {
|
if (dump == DISPLAY_EACH_VALUE) {
|
||||||
// System.out.println("*********** WIIMOTE ID : "+
|
// System.out.println("*********** WIIMOTE ID : "+
|
||||||
// e.getWiimoteId() + " **************");
|
// e.getWiimoteId() + " **************");
|
||||||
@@ -171,7 +173,7 @@ public class Tests implements WiimoteListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get status */
|
/* get status */
|
||||||
if (e.isButtonMinusJustPressed() && e.isButtonPlusJustPressed()) {
|
if (e.isButtonUpJustPressed()) {
|
||||||
wiimote.getStatus();
|
wiimote.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ public class WiiUseApiManager extends Thread {
|
|||||||
if (manager.connected < 0) {
|
if (manager.connected < 0) {
|
||||||
int nbWiimotes = manager.connectWiimotes(nb);
|
int nbWiimotes = manager.connectWiimotes(nb);
|
||||||
manager.wiimotes = new Wiimote[nbWiimotes];
|
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);
|
Wiimote wim = new Wiimote(i, manager);
|
||||||
manager.wiimotes[i] = wim;
|
manager.wiimotes[i-1] = wim;
|
||||||
manager.addWiiUseApiListener(wim);
|
manager.addWiiUseApiListener(wim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,8 +99,8 @@ public class WiiUseApiManager extends Thread {
|
|||||||
* id of the wiimote to disconnect.
|
* id of the wiimote to disconnect.
|
||||||
*/
|
*/
|
||||||
public void closeConnection(int id) {
|
public void closeConnection(int id) {
|
||||||
removeWiiUseApiListener(wiimotes[id]);
|
removeWiiUseApiListener(wiimotes[id-1]);
|
||||||
wiimotes[id] = null;
|
wiimotes[id-1] = null;
|
||||||
requests.add(new WiiUseApiRequest(id,
|
requests.add(new WiiUseApiRequest(id,
|
||||||
WiiUseApiRequest.WIIUSE_CLOSE_CONNECTION_REQUEST));
|
WiiUseApiRequest.WIIUSE_CLOSE_CONNECTION_REQUEST));
|
||||||
System.out.println("Wiimote " + id + " disconnected !");
|
System.out.println("Wiimote " + id + " disconnected !");
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class EventsGatherer {
|
|||||||
*/
|
*/
|
||||||
public void addStatusEvent(int id, boolean connect, float batt, short led,
|
public void addStatusEvent(int id, boolean connect, float batt, short led,
|
||||||
boolean speak, int attach, boolean rumbleState,
|
boolean speak, int attach, boolean rumbleState,
|
||||||
float orientationThreshold, float accelerationThreshold,
|
float orientationThreshold, int accelerationThreshold,
|
||||||
float alphaSmooth, boolean continuousState, boolean smoothingState,
|
float alphaSmooth, boolean continuousState, boolean smoothingState,
|
||||||
boolean irState, boolean motionSensingState) {
|
boolean irState, boolean motionSensingState) {
|
||||||
StatusEvent evt = new StatusEvent(id, connect, batt, led, speak,
|
StatusEvent evt = new StatusEvent(id, connect, batt, led, speak,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class StatusEvent extends WiiUseApiEvent {
|
|||||||
|
|
||||||
private float orientationThreshold = 0;
|
private float orientationThreshold = 0;
|
||||||
|
|
||||||
private float accelerationThreshold = 0;
|
private int accelerationThreshold = 0;
|
||||||
|
|
||||||
private float alphaSmoothing = 0;
|
private float alphaSmoothing = 0;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public class StatusEvent extends WiiUseApiEvent {
|
|||||||
*/
|
*/
|
||||||
public StatusEvent(int id, boolean connect, float batt, short led,
|
public StatusEvent(int id, boolean connect, float batt, short led,
|
||||||
boolean speak, int attach, boolean rumbleState,
|
boolean speak, int attach, boolean rumbleState,
|
||||||
float orientationThreshold, float accelerationThreshold,
|
float orientationThreshold, int accelerationThreshold,
|
||||||
float alphaSmooth, boolean continuousState, boolean smoothingState,
|
float alphaSmooth, boolean continuousState, boolean smoothingState,
|
||||||
boolean irState, boolean motionSensingState) {
|
boolean irState, boolean motionSensingState) {
|
||||||
super(id, WiiUseApiEvent.STATUS_EVENT);
|
super(id, WiiUseApiEvent.STATUS_EVENT);
|
||||||
@@ -174,7 +174,7 @@ public class StatusEvent extends WiiUseApiEvent {
|
|||||||
*
|
*
|
||||||
* @return the accelerationThreshold
|
* @return the accelerationThreshold
|
||||||
*/
|
*/
|
||||||
public float getAccelerationThreshold() {
|
public int getAccelerationThreshold() {
|
||||||
return accelerationThreshold;
|
return accelerationThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user