git-svn-id: http://wiiusej.googlecode.com/svn/trunk@10 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
guilhem.duche
2008-02-05 15:55:04 +00:00
parent b72e940b34
commit 9b7530625b
23 changed files with 0 additions and 4540 deletions

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WiiUseJ</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

Binary file not shown.

View File

@@ -1,30 +0,0 @@
package tests;
import java.util.TimerTask;
import wiiusej.WiiUseApiManager;
public class LedsTask extends TimerTask {
private int i = 0;
private int inc = 1;
@Override
public void run() {
if(i==0){
WiiUseApiManager.getInstance().setLeds(1, true, false, false, false);
}else if(i==1){
WiiUseApiManager.getInstance().setLeds(1, false, true, false, false);
}else if(i==2){
WiiUseApiManager.getInstance().setLeds(1, false, false, true, false);
}else if(i==3){
WiiUseApiManager.getInstance().setLeds(1, false, false, false, true);
}
if (i==0) i=1;
if (i==3) i=-1;
i = i+inc;
}
}

View File

@@ -1,374 +0,0 @@
package tests;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.util.ArrayList;
import wiiusej.Point2DInteger;
import wiiusej.WiiMoteEvent;
import wiiusej.WiiUseApiListener;
import wiiusej.WiiUseApiManager;
public class Tests implements WiiUseApiListener {
Robot robot;
private static int DISPLAY_EACH_VALUE = 1;
private static int DUMP = 2;
private static int MOVE_MOUSE = 3;
private static int ORIENT_THRESH_CONT = 4;
private static int TEST_LEDS = 5;
int dump = ORIENT_THRESH_CONT;
public Tests() {
try {
robot = new Robot();
} catch (AWTException e) {
e.printStackTrace();
}
}
@Override
public void wiimoteEvent(WiiMoteEvent e) {
/* leave if nothing is connected */
if (WiiUseApiManager.getInstance().getNbConnectedWiimotes() == 0) {
WiiUseApiManager.getInstance().shutdown();
}
if (dump == DISPLAY_EACH_VALUE) {
if (e.isConnected()) {
// System.out.println("*********** WIIMOTE ID : "+
// e.getWiimoteId() + " **************");
/* button ONE */
if (e.isButtonOneJustPressed()) {
System.out.println("button one pressed");
}
if (e.isButtonOneHeld()) {
System.out.println("button one held");
}
if (e.isButtonOneJustReleased()) {
System.out.println("button one released");
}
/* button TWO */
if (e.isButtonTwoJustPressed()) {
System.out.println("button two pressed");
}
if (e.isButtonTwoHeld()) {
System.out.println("button two held");
}
if (e.isButtonTwoJustReleased()) {
System.out.println("button two released");
}
/* button A */
if (e.isButtonAJustPressed()) {
System.out.println("button A pressed");
}
if (e.isButtonAHeld()) {
System.out.println("button A held");
}
if (e.isButtonAJustReleased()) {
System.out.println("button A released");
}
/* button B */
if (e.isButtonBJustPressed()) {
System.out.println("button B pressed");
}
if (e.isButtonBHeld()) {
System.out.println("button B held");
}
if (e.isButtonBJustReleased()) {
System.out.println("button B released");
}
/* button LEFT */
if (e.isButtonLeftJustPressed()) {
System.out.println("button Left pressed");
}
if (e.isButtonLeftHeld()) {
System.out.println("button Left held");
}
if (e.isButtonLeftJustReleased()) {
System.out.println("button Left released");
}
/* button RIGHT */
if (e.isButtonRightJustPressed()) {
System.out.println("button Right pressed");
}
if (e.isButtonRightHeld()) {
System.out.println("button Right held");
}
if (e.isButtonRightJustReleased()) {
System.out.println("button Right released");
}
/* button UP */
if (e.isButtonUpJustPressed()) {
System.out.println("button UP pressed");
}
if (e.isButtonUpHeld()) {
System.out.println("button UP held");
}
if (e.isButtonUpJustReleased()) {
System.out.println("button UP released");
}
/* button DOWN */
if (e.isButtonDownJustPressed()) {
System.out.println("button DOWN pressed");
}
if (e.isButtonDownHeld()) {
System.out.println("button DOWN held");
}
if (e.isButtonDownJustReleased()) {
System.out.println("button DOWN released");
}
/* button MINUS */
if (e.isButtonMinusJustPressed()) {
System.out.println("button MINUS pressed");
}
if (e.isButtonMinusHeld()) {
System.out.println("button MINUS held");
}
if (e.isButtonMinusJustReleased()) {
System.out.println("button MINUS released");
}
/* button PLUS */
if (e.isButtonPlusJustPressed()) {
System.out.println("button PLUS pressed");
}
if (e.isButtonPlusHeld()) {
System.out.println("button PLUS held");
}
if (e.isButtonPlusJustReleased()) {
System.out.println("button PLUS released");
}
/* button HOME */
if (e.isButtonHomeJustPressed()) {
System.out.println("button HOME pressed");
}
if (e.isButtonHomeHeld()) {
System.out.println("button HOME held");
}
if (e.isButtonHomeJustReleased()) {
System.out.println("button HOME released");
}
/* get status */
if (e.isButtonMinusJustPressed()&&e.isButtonPlusJustPressed()) {
WiiUseApiManager.getInstance().getStatus(1);
}
/* Activate rumble */
if (e.isButtonOneJustPressed()) {
System.out.println("Rumble Activated");
WiiUseApiManager.getInstance().activateRumble(1);
}
if (e.isButtonTwoJustPressed()) {
System.out.println("Rumble Deactivated");
WiiUseApiManager.getInstance().deactivateRumble(1);
}
/* Activate IR Tracking */
if (e.isButtonAJustPressed()) {
System.out.println("IR Activated");
WiiUseApiManager.getInstance().activateIRTRacking(1);
}
if (e.isButtonBJustPressed()) {
System.out.println("IR Deactivated");
WiiUseApiManager.getInstance().deactivateIRTRacking(1);
}
/* Activate Motion sensing */
if (e.isButtonPlusJustPressed()){
System.out.println("Motion sensing Activated");
WiiUseApiManager.getInstance().activateMotionSensing(1);
}
if (e.isButtonMinusJustPressed()){
System.out.println("Motion sensing Deactivated");
WiiUseApiManager.getInstance().deactivateMotionSensing(1);
}
/* display status */
if (e.getBatteryLevel() != -1) {
System.out
.println("battery level : " + e.getBatteryLevel());
System.out.println("= --- Leds : " + e.getLeds() + "\n");
System.out.println("= --- Rumble : " + e.isRumbleActive() + "\n");
}
/* display ir points */
if (e.isIrActive()) {
Point2DInteger[] list = e.getIRPoints();
for (int i = 0; i < list.length; i++) {
if (list[i] != null)
System.out.print("Point :(" + list[i].getX() + ","
+ list[i].getY() + ") ");
}
System.out.println("");
}
/* display motion sensing */
if (e.isMotionSensingActive()){
System.out.println("Motion Sensing :"+e.getOrientation()+" , "+e.getGforce());
}
/* leave test */
if (e.isButtonHomeJustPressed()) {
System.out.println("LEAVING TEST");
WiiUseApiManager.getInstance().closeConnection(1);
}
} else {
System.out.println(" WIIMOTE ID : " + e.getWiimoteId()
+ " DISCONNECTED !!!!!");
WiiUseApiManager.getInstance().closeConnection(1);
}
} else if (dump == DUMP) {
System.out.println(e);
/* Activate all */
if (e.isButtonAJustPressed()) {
System.out.println("IR Activated");
WiiUseApiManager.getInstance().activateIRTRacking(1);
WiiUseApiManager.getInstance().activateMotionSensing(1);
WiiUseApiManager.getInstance().activateRumble(1);
}
if (e.isButtonBJustPressed()) {
System.out.println("IR Deactivated");
WiiUseApiManager.getInstance().deactivateIRTRacking(1);
WiiUseApiManager.getInstance().deactivateMotionSensing(1);
WiiUseApiManager.getInstance().deactivateRumble(1);
}
/* leave test */
if (e.isButtonHomeJustPressed()) {
System.out.println("LEAVING TEST");
WiiUseApiManager.getInstance().closeConnection(1);
if (WiiUseApiManager.getInstance().getNbConnectedWiimotes() == 0) {
WiiUseApiManager.getInstance().shutdown();
}
}
} else if (dump == MOVE_MOUSE) {
/* Activate IR Tracking */
if (e.isButtonOneJustPressed()) {
System.out.println("IR Activated");
WiiUseApiManager.getInstance().activateIRTRacking(1);
}
if (e.isButtonTwoJustPressed()) {
System.out.println("IR Deactivated");
WiiUseApiManager.getInstance().deactivateIRTRacking(1);
}
/* button A */
if (e.isButtonAJustPressed()) {
robot.mousePress(InputEvent.BUTTON1_MASK);
}
if (e.isButtonAJustReleased()) {
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
/* button B */
if (e.isButtonBJustPressed()) {
robot.mousePress(InputEvent.BUTTON2_MASK);
}
if (e.isButtonBJustReleased()) {
robot.mouseRelease(InputEvent.BUTTON2_MASK);
}
Point2DInteger[] list = e.getIRPoints();
if (e.isIrActive() && list[0] != null) {
int x1 = (int) list[0].getX();
int y1 = (int) list[0].getY();
int mousex = (int) Math.round(((double) x1 / 1024.0) * 1280.0);
int mousey = (int) Math.round(((double) y1 / 768.0) * 1024.0);
robot.mouseMove(mousex, mousey);
}
/* leave test */
if (e.isButtonHomeJustPressed()) {
System.out.println("LEAVING TEST");
WiiUseApiManager.getInstance().closeConnection(1);
}
}else if(dump == ORIENT_THRESH_CONT){
WiiUseApiManager.getInstance().activateMotionSensing(1);
if (e.isButtonOneJustPressed()) {
System.out.println("Continous activated");
WiiUseApiManager.getInstance().activateContinuous(1);
}
if (e.isButtonTwoJustPressed()) {
System.out.println("Continous deactivated");
WiiUseApiManager.getInstance().deactivateContinuous(1);
}
if (e.isButtonAJustPressed()) {
System.out.println("Smoothing activated");
WiiUseApiManager.getInstance().activateSmoothing(1);
}
if (e.isButtonBJustPressed()) {
System.out.println("Smoothing deactivated");
WiiUseApiManager.getInstance().deactivateSmoothing(1);
}
if (e.isButtonPlusJustPressed()) {
System.out.println("Threshold orientation 10 degrees");
WiiUseApiManager.getInstance().setOrientationThreshold(1, 10);
}
if (e.isButtonMinusJustPressed()) {
System.out.println("Threshold orientation 0.5 degrees");
WiiUseApiManager.getInstance().setOrientationThreshold(1, (float)0.5);
}
System.out.println(e);
/* leave test */
if (e.isButtonHomeJustPressed()) {
System.out.println("LEAVING TEST");
WiiUseApiManager.getInstance().closeConnection(1);
}
}else if(dump == TEST_LEDS){
WiiUseApiManager.getInstance().activateMotionSensing(1);
if (e.isButtonUpJustPressed()) {
WiiUseApiManager.getInstance().setLeds(1, true, false, false, false);
}
if (e.isButtonDownJustPressed()) {
WiiUseApiManager.getInstance().setLeds(1, false, true, false, false);
}
if (e.isButtonLeftJustPressed()) {
WiiUseApiManager.getInstance().setLeds(1, false, false, true, false);
}
if (e.isButtonRightJustPressed()) {
WiiUseApiManager.getInstance().setLeds(1, false, false, false, true);
}
/* leave test */
if (e.isButtonHomeJustPressed()) {
System.out.println("LEAVING TEST");
WiiUseApiManager.getInstance().closeConnection(1);
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
Tests tests = new Tests();
WiiUseApiManager manager = WiiUseApiManager.getInstance();
manager.addWiiUseApiListener(tests);
manager.loadLibrary();
manager.connectWiimotes();
manager.start();
// java.util.Timer timer = new java.util.Timer();
// timer.scheduleAtFixedRate(new LedsTask(), 0, 100);
}
}

View File

@@ -1,81 +0,0 @@
package wiiusej;
/**
* Represents gravity force on each axis.
* @author gduche
*
*/
public class GForce {
private float x;
private float y;
private float z;
/**
* Default constructor;
*/
public GForce(){
x = 0;
y = 0;
z = 0;
}
/**
* Constructor with gravity force on each axis.
* @param xx x value
* @param yy x value
* @param zz x value
*/
public GForce(float xx, float yy, float zz){
x = xx;
y = yy;
z = zz;
}
/**
* @return the x
*/
public float getX() {
return x;
}
/**
* @param x the x to set
*/
public void setX(float x) {
this.x = x;
}
/**
* @return the y
*/
public float getY() {
return y;
}
/**
* @param y the y to set
*/
public void setY(float y) {
this.y = y;
}
/**
* @return the z
*/
public float getZ() {
return z;
}
/**
* @param z the z to set
*/
public void setZ(float z) {
this.z = z;
}
@Override
public String toString() {
return "Gravity force : ("+x+", "+y+","+z+")";
}
}

View File

@@ -1,109 +0,0 @@
package wiiusej;
/**
* Represents a request to set leds of the wiimote with WiiUse API.
* @author gduche
*
*/
public class LedsRequest extends wiiusej.WiiUseApiRequest {
private boolean led1, led2, led3, led4;
/**
* Constructor setting the id of the wiimote concerned.
*
* @param id
* id of the wiimote concerned
* @param type
* type of the request
*/
public LedsRequest(int id, int type) {
super(id, type);
}
/**
* Constructor setting the id of the wiimote concerned.
*
* @param id
* id of the wiimote concerned
* @param type
* type of the request
* @param l1
* led1 status. True=ON, False=OFF
* @param l2
* led2 status. True=ON, False=OFF
* @param l3
* led3 status. True=ON, False=OFF
* @param l4
* led4 status. True=ON, False=OFF
*/
public LedsRequest(int id, int type, boolean l1, boolean l2, boolean l3,
boolean l4) {
super(id, type);
led1 = l1;
led2 = l2;
led3 = l3;
led4 = l4;
}
/**
* @return the led1
*/
public boolean isLed1() {
return led1;
}
/**
* @param led1
* the led1 to set
*/
public void setLed1(boolean led1) {
this.led1 = led1;
}
/**
* @return the led2
*/
public boolean isLed2() {
return led2;
}
/**
* @param led2
* the led2 to set
*/
public void setLed2(boolean led2) {
this.led2 = led2;
}
/**
* @return the led3
*/
public boolean isLed3() {
return led3;
}
/**
* @param led3
* the led3 to set
*/
public void setLed3(boolean led3) {
this.led3 = led3;
}
/**
* @return the led4
*/
public boolean isLed4() {
return led4;
}
/**
* @param led4
* the led4 to set
*/
public void setLed4(boolean led4) {
this.led4 = led4;
}
}

View File

@@ -1,54 +0,0 @@
package wiiusej;
/**
* Represents a request to set orientation Threshold in Wiiuse API.
* Orientation Threshold is the minimum angle (in degrees) between two events.
* @author gduche
*
*/
public class OrientThresholdRequest extends WiiUseApiRequest {
private float thresholhd;
/**
* Constructor setting the id of the wiimote concerned.
*
* @param id
* the id of the wiimote concerned.
*/
public OrientThresholdRequest(int id, int type) {
super(id, type);
}
/**
* Constructor setting the id of the wiimote concerned.
*
* @param id
* the id of the wiimote concerned.
* @param type
* type of the request
* @param th
* threshold in degrees
*/
public OrientThresholdRequest(int id, int type, float th) {
super(id, type);
thresholhd = th;
}
/**
* @return the thresholhd
*/
public float getThresholhd() {
return thresholhd;
}
/**
* @param thresholhd the thresholhd to set
*/
public void setThresholhd(float thresholhd) {
this.thresholhd = thresholhd;
}
}

View File

@@ -1,77 +0,0 @@
package wiiusej;
/**
* Class that represents the orientation of the wiimote.
* @author gduche
*
*/
public class Orientation {
private float roll;
private float pitch;
private float yaw;
/**
* Default constructor.
*/
public Orientation(){
roll = 0;
pitch = 0;
yaw = 0;
}
/**
* Contructor with raw, pitch , yaw.
* @param r raw
* @param p pitch
* @param y yaw
*/
public Orientation(float r, float p, float y){
roll = r;
pitch = p;
yaw = y;
}
/**
* @return the roll
*/
public float getRoll() {
return roll;
}
/**
* @param roll the roll to set
*/
public void setRoll(float roll) {
this.roll = roll;
}
/**
* @return the pitch
*/
public float getPitch() {
return pitch;
}
/**
* @param pitch the pitch to set
*/
public void setPitch(float pitch) {
this.pitch = pitch;
}
/**
* @return the yaw
*/
public float getYaw() {
return yaw;
}
/**
* @param yaw the yaw to set
*/
public void setYaw(float yaw) {
this.yaw = yaw;
}
@Override
public String toString() {
return "Orientation : (roll: "+roll+", pitch: "+pitch+", yaw: "+yaw+")";
}
}

View File

@@ -1,35 +0,0 @@
package wiiusej;
import java.awt.geom.Point2D;
public class Point2DInteger extends Point2D {
private int x;
private int y;
public Point2DInteger(int xx, int yy) {
super();
setLocation(xx,yy);
}
@Override
public double getX() {
return x;
}
@Override
public double getY() {
return y;
}
@Override
public void setLocation(double xx, double yy) {
this.x = (int)xx;
this.y = (int)yy;
}
@Override
public String toString() {
return "("+x+","+y+")";
}
}

View File

@@ -1,706 +0,0 @@
package wiiusej;
import java.util.ArrayList;
import java.util.Iterator;
/**
* Class that is a bean to be filled by the wiiuse API.
*
* @author gduche
*
*/
public class WiiMoteEvent {
/* Buttons MACRO */
private static short WIIMOTE_BUTTON_TWO = 0x0001;
private static short WIIMOTE_BUTTON_ONE = 0x0002;
private static short WIIMOTE_BUTTON_B = 0x0004;
private static short WIIMOTE_BUTTON_A = 0x0008;
private static short WIIMOTE_BUTTON_MINUS = 0x0010;
private static short WIIMOTE_BUTTON_ZACCEL_BIT6 = 0x0020;
private static short WIIMOTE_BUTTON_ZACCEL_BIT7 = 0x0040;
private static short WIIMOTE_BUTTON_HOME = 0x0080;
private static short WIIMOTE_BUTTON_LEFT = 0x0100;
private static short WIIMOTE_BUTTON_RIGHT = 0x0200;
private static short WIIMOTE_BUTTON_DOWN = 0x0400;
private static short WIIMOTE_BUTTON_UP = 0x0800;
private static short WIIMOTE_BUTTON_PLUS = 0x1000;
private static short WIIMOTE_BUTTON_ZACCEL_BIT4 = 0x2000;
private static short WIIMOTE_BUTTON_ZACCEL_BIT5 = 0x4000;
private static int WIIMOTE_BUTTON_UNKNOWN = 0x8000;
private static short WIIMOTE_BUTTON_ALL = 0x1F9F;
private static short WIIMOTE_LED_1 = 1;
private static short WIIMOTE_LED_2 = 2;
private static short WIIMOTE_LED_3 = 4;
private static short WIIMOTE_LED_4 = 8;
private static short NB_LEDS = 4;
/* ID */
private int wiimoteId = -1;
/* Status variables */
private boolean connected = false;
private float batteryLevel = -1;
private short leds = 0;
private boolean isSpeakerEnabled = false;
private boolean isThereAttachment = false;
private boolean isRumbleActive = false;
private float orientationThreshold = 0;
private boolean isContinuousActive = false;
private boolean isSmoothingActive = false;
/* Buttons */
private short buttonsJustPressed = 0;
private short buttonsJustReleased = 0;
private short buttonsHeld = 0;
/* IR Tracking */
private boolean isIrActive = false;
private Point2DInteger[] IRPoints;
/* Motion Sensing */
private boolean isMotionSensingActive = false;
private Orientation orientation;
private GForce gforce;
/**
* Default constructor
*/
public WiiMoteEvent() {
// init IRPoints array
IRPoints = new Point2DInteger[NB_LEDS];
}
/**
* Construct the Wiimote setting up the id.
*
* @param id
* the Wiimote id
*/
public WiiMoteEvent(int id) {
this();
wiimoteId = id;
}
/**
* Get Wiimote ID
*
* @return the wiimote id.
*/
public int getWiimoteId() {
return wiimoteId;
}
/**
* Set Wiimote ID
*
* @param wiimoteId
* id of the wiimote
*/
void setWiimoteId(int wiimoteId) {
this.wiimoteId = wiimoteId;
}
/**
* True if the wiimote is connected false otherwise.
*
* @return return the connected status.
*/
public boolean isConnected() {
return connected;
}
/**
* Set the connected value to true.
*/
void setConnected() {
this.connected = true;
}
/**
* Set the connected value to false.
*/
void setDisconnected() {
this.connected = false;
}
/**
* Get battery level.
*
* @return battery level. 1 = 100%
*/
public float getBatteryLevel() {
return batteryLevel;
}
/**
* Set level battery.
*
* @param batteryLevel
* must be between 0 and 1
*/
void setBatteryLevel(float batteryLevel) {
this.batteryLevel = batteryLevel;
}
/**
* Get status of the leds .
*
* @return a short representing LEDS turned on.
*/
public short getLeds() {
return leds;
}
/**
* Set Status of the leds.
*
* @param leds
*/
void setLeds(short leds) {
this.leds = leds;
}
/**
* Tell if the speaker is enable for this wiimote
*
* @return TRUE if it enabled false otherwise
*/
public boolean isSpeakerEnabled() {
return isSpeakerEnabled;
}
/**
* Set the flag for the speaker to "enabled"
*/
void setSpeakerEnabled() {
this.isSpeakerEnabled = true;
}
/**
* Set the flag for the speaker to "disabled"
*/
void setSpeakerDisabled() {
this.isSpeakerEnabled = false;
}
/**
* Tell if there is an attachment to the Wiimote
*
* @return TRUE if it there is one false otherwise
*/
public boolean isThereAttachment() {
return isThereAttachment;
}
/**
* Set the flag for the attachment to true
*/
void setThereIsAnAttachment() {
this.isThereAttachment = true;
}
/**
* Set the flag for the attachment to false
*/
void setThereIsNoAttachment() {
this.isThereAttachment = false;
}
/**
* Get the status of rumble.
*
* @return true if the rumble is active false otherwise
*/
public boolean isRumbleActive() {
return isRumbleActive;
}
/**
* Set Rumble flag to Active.
*/
void setRumbleActive() {
this.isRumbleActive = true;
}
/**
* Set Rumble flag to Inactive.
*/
void setRumbleInactive() {
this.isRumbleActive = false;
}
/**
* Get orientation threshold.
*
* @return the orientationThreshold
*/
public float getOrientationThreshold() {
return orientationThreshold;
}
/**
* Set the orientation threshold.
*
* @param orientationThreshold
* the orientationThreshold to set
*/
void setOrientationThreshold(float orientationThreshold) {
this.orientationThreshold = orientationThreshold;
}
/**
* Tell if the CONTINUOUS option is activated.
*
* @return the isContinuousActive
*/
public boolean isContinuousActive() {
return isContinuousActive;
}
/**
* Set the CONTINUOUS option active.
*/
void setContinuousActive() {
this.isContinuousActive = true;
}
/**
* Set the CONTINUOUS option inactive.
*/
void setContinuousInactive() {
this.isContinuousActive = false;
}
/**
* Tell if the option SMOOTHING is activated.
*
* @return the isSmoothingActive
*/
public boolean isSmoothingActive() {
return isSmoothingActive;
}
/**
* Set SMOOTHING option to active.
*/
void setSmoothingActive() {
this.isSmoothingActive = true;
}
/**
* Set SMOOTHING option to inactive.
*/
void setSmoothingInactive() {
this.isSmoothingActive = false;
}
/**
* Get the short storing the buttons just pressed
*
* @return the short storing the buttons just pressed
*/
public short getButtonsJustPressed() {
return buttonsJustPressed;
}
/**
* set the short storing the buttons just pressed
*
* @param buttonsJustPressed
*/
void setButtonsJustPressed(short buttonsJustPressed) {
this.buttonsJustPressed = buttonsJustPressed;
}
/**
* Get the short storing the buttons just released
*
* @return the short storing the buttons just released
*/
public short getButtonsJustReleased() {
return buttonsJustReleased;
}
/**
* set the short storing the buttons just released
*
* @param buttonsJustReleased
*/
void setButtonsJustReleased(short buttonsJustReleased) {
this.buttonsJustReleased = buttonsJustReleased;
}
/**
* get the short storing the buttons held
*
* @return the short storing the buttons held
*/
public short getButtonsHeld() {
return buttonsHeld;
}
/**
* set the short storing the buttons held
*
* @param buttonsHeld
*/
void setButtonsHeld(short buttonsHeld) {
this.buttonsHeld = buttonsHeld;
}
/**
* Tell if the IR Tracking is active.
*
* @return TRUE if it is active or false otherwise.
*/
public boolean isIrActive() {
return isIrActive;
}
/**
* Set the value isIrActive to true
*/
void setIrActive() {
this.isIrActive = true;
}
/**
* Set the value isIrActive to true
*/
void setIrInactive() {
this.isIrActive = false;
}
/**
* Get list of IR points.
*
* @return the list of 2D points
*/
public Point2DInteger[] getIRPoints() {
return IRPoints;
}
/**
* Add IR Point in the list (Max 4 points)
*
* @param x
* x value
* @param y
* y value
*/
void addIRpoint(int x, int y) {
for (int i = 0; i < IRPoints.length; i++) {
if (IRPoints[i] == null) {
IRPoints[i] = new Point2DInteger(x, y);
return;
}
}
return;
}
/**
* Clear IR points.
*/
void EmptyIRPoints() {
for (int i = 0; i < IRPoints.length; i++) {
IRPoints[i] = null;
}
}
/**
* Get the flag indicating if the motion sensing is active.
*
* @return true if the motion sensing is active false otherwise
*/
public boolean isMotionSensingActive() {
return isMotionSensingActive;
}
/**
* Set the motion sensing flag to active.
*/
void setMotionSensingActive() {
this.isMotionSensingActive = true;
}
/**
* Set the motion sensing flag to inactive.
*/
void setMotionSensingInactive() {
this.isMotionSensingActive = false;
}
/**
* @return the orientation
*/
public Orientation getOrientation() {
return orientation;
}
/**
* Set orientation of the wiimote.
*
* @param r
* roll
* @param p
* pitch
* @param y
* yaw
*/
void setOrientation(float r, float p, float y) {
this.orientation = new Orientation(r, p, y);
}
/**
* Get the gravity force.
*
* @return the gforce
*/
public GForce getGforce() {
return gforce;
}
/**
* Set the gravity force.
*
* @param x
* gravity force on x axis
* @param y
* gravity force on y axis
* @param z
* gravity force on z axis
*/
void setGforce(float x, float y, float z) {
this.gforce = new GForce(x, y, z);
}
/** **************** BUTTONS Methods ***************** */
/* generic button functions */
private boolean buttonTest(short buttonBitsDefinition, short buttons) {
return (buttons & buttonBitsDefinition) == buttonBitsDefinition;
}
private boolean isButtonJustPressed(short buttonBitsDefinition) {
return buttonTest(buttonBitsDefinition, buttonsJustPressed)
&& !isButtonHeld(buttonBitsDefinition);
}
private boolean isButtonJustReleased(short buttonBitsDefinition) {
return buttonTest(buttonBitsDefinition, buttonsJustReleased);
}
private boolean isButtonHeld(short buttonBitsDefinition) {
return buttonTest(buttonBitsDefinition, buttonsHeld);
}
/* Button ONE */
public boolean isButtonOneJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_ONE);
}
public boolean isButtonOneJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_ONE);
}
public boolean isButtonOneHeld() {
return isButtonHeld(WIIMOTE_BUTTON_ONE);
}
/* Button TWO */
public boolean isButtonTwoJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_TWO);
}
public boolean isButtonTwoJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_TWO);
}
public boolean isButtonTwoHeld() {
return isButtonHeld(WIIMOTE_BUTTON_TWO);
}
/* Button A */
public boolean isButtonAJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_A);
}
public boolean isButtonAJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_A);
}
public boolean isButtonAHeld() {
return isButtonHeld(WIIMOTE_BUTTON_A);
}
/* Button B */
public boolean isButtonBJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_B);
}
public boolean isButtonBJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_B);
}
public boolean isButtonBHeld() {
return isButtonHeld(WIIMOTE_BUTTON_B);
}
/* Button LEFT */
public boolean isButtonLeftJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_LEFT);
}
public boolean isButtonLeftJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_LEFT);
}
public boolean isButtonLeftHeld() {
return isButtonHeld(WIIMOTE_BUTTON_LEFT);
}
/* Button RIGHT */
public boolean isButtonRightJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_RIGHT);
}
public boolean isButtonRightJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_RIGHT);
}
public boolean isButtonRightHeld() {
return isButtonHeld(WIIMOTE_BUTTON_RIGHT);
}
/* Button UP */
public boolean isButtonUpJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_UP);
}
public boolean isButtonUpJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_UP);
}
public boolean isButtonUpHeld() {
return isButtonHeld(WIIMOTE_BUTTON_UP);
}
/* Button DOWN */
public boolean isButtonDownJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_DOWN);
}
public boolean isButtonDownJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_DOWN);
}
public boolean isButtonDownHeld() {
return isButtonHeld(WIIMOTE_BUTTON_DOWN);
}
/* Button - */
public boolean isButtonMinusJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_MINUS);
}
public boolean isButtonMinusJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_MINUS);
}
public boolean isButtonMinusHeld() {
return isButtonHeld(WIIMOTE_BUTTON_MINUS);
}
/* Button + */
public boolean isButtonPlusJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_PLUS);
}
public boolean isButtonPlusJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_PLUS);
}
public boolean isButtonPlusHeld() {
return isButtonHeld(WIIMOTE_BUTTON_PLUS);
}
/* Button HOME */
public boolean isButtonHomeJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_HOME);
}
public boolean isButtonHomeJustReleased() {
return isButtonJustReleased(WIIMOTE_BUTTON_HOME);
}
public boolean isButtonHomeHeld() {
return isButtonHeld(WIIMOTE_BUTTON_HOME);
}
@Override
public String toString() {
super.toString();
String out = "";
/* Status */
out += "/*********** WIIMOTE ID :" + wiimoteId + " ********/\n";
out += "--- connected : " + connected + "\n";
out += "--- Battery level : " + batteryLevel + "\n";
out += "= --- Leds : " + leds + "\n";
out += "--- Speaker enabled : " + isSpeakerEnabled + "\n";
out += "--- Attachment ? : " + isThereAttachment + "\n";
out += "--- Rumble ? : " + isRumbleActive + "\n";
out += "--- Orientation threshold value ? : " + orientationThreshold
+ "\n";
out += "--- Continuous ? : " + isContinuousActive + "\n";
out += "--- Smoothing ? : " + isSmoothingActive + "\n";
/* Display buttons */
out += "/******** Buttons ********/\n";
out += "--- Buttons just pressed : " + buttonsJustPressed + "\n";
out += "--- Buttons just released : " + buttonsJustReleased + "\n";
out += "--- Buttons held : " + buttonsHeld + "\n";
/* Display IR Tracking */
out += "/******** IR Tracking ********/\n";
out += "--- Active : " + isIrActive + "\n";
if (isIrActive) {
out += "--- Seen points\n";
for (int i = 0; i < IRPoints.length; i++) {
if (IRPoints[i] != null) {
out += IRPoints[i].toString();
}
}
}
/* Motion sensing */
out += "/******** Motion sensing ********/\n";
out += "--- Motion sensing : " + isMotionSensingActive + "\n";
if (isMotionSensingActive) {
out += "--- " + orientation + "\n";
out += "--- " + gforce + "\n";
}
return out;
}
}

View File

@@ -1,174 +0,0 @@
package wiiusej;
/**
* Singleton used to manipulate WiiUse Api.
* @author gduche
*
*/
public class WiiUseApi {
static {
System.loadLibrary("libWiiuseJ");
}
private static WiiUseApi instance = new WiiUseApi();
/**
* Get the only instance of WiiUseApi.
* @return
*/
static WiiUseApi getInstance(){
return instance;
}
/**
* Load the library.
*
* @return 0 if there is an error, 1 if everything is ok.
*/
native int loadLibrary();
/**
* Try to connect to 2 wiimotes. Make them rumble to show they are
* connected.
*
* @return 0 if there is an error otherwise it returns the number of
* wiimotes connected.
*/
native int doConnections();
/**
* Close connection to the wiimote with the given id.
*
*/
native void closeConnection(int id);
/**
* Shutdown Wiiuse API.
* @return 0 if there is an error, 1 if everything is ok.
*/
native void shutdownApi();
/**
* Activate rumble on the wiimote with the given id.
* @param id the id of the wiimote.
*/
native void activateRumble(int id);
/**
* Deactivate rumble on the wiimote with the given id.
*
* @param id the id of the wiimote.
*/
native void deactivateRumble(int id);
/**
* Activate IR Tracking on the wiimote with the given id.
* @param id the id of the wiimote.
*/
native void activateIRTracking(int id);
/**
* Deactivate IR Tracking on the wiimote with the given id.
* @param id the id of the wiimote.
*/
native void deactivateIRTracking(int id);
/**
* Activate motion sensing on the wiimote with the given id.
* @param id the id of the wiimote.
*/
native void activateMotionSensing(int id);
/**
* Deactivate motion sensing on the wiimote with the given id.
* @param id the id of the wiimote.
*/
native void deactivateMotionSensing(int id);
/**
* Set wiimote leds status.
* @param id the id of the wiimote concerned
* @param led1 status of led1: True=ON, False=OFF
* @param led2 status of led2: True=ON, False=OFF
* @param led3 status of led3: True=ON, False=OFF
* @param led4 status of led4: True=ON, False=OFF
*/
native void setLeds(int id, boolean led1, boolean led2, boolean led3, boolean led4);
/**
* Set how many degrees an angle must change to generate an event.
* @param id id of the wiimote concerned
* @param angle minimum angle detected by an event
*/
native void setOrientThreshold(int id, float angle);
/**
* Make the the accelerometers give smoother results.
* This is set by default.
* @param id the id of the wiimote concerned
*/
native void activateSmoothing(int id);
/**
* Make the the accelerometers give raw results.
* @param id the id of the wiimote concerned
*/
native void deactivateSmoothing(int id);
/**
* Make the wiimote generate an event each time we poll.
* Not set by default.
* @param id the id of the wiimote concerned
*/
native void activateContinuous(int id);
/**
* Make the wiimote generate an event only when there is one.
* @param id the id of the wiimote concerned
*/
native void deactivateContinuous(int id);
/**
* Get status and values from the wiimotes and send it through callbacks.
*
* @param id the id of the wiimote of which we want the status.
*/
native void getStatus(int id);
/**
* Get status and values from the wiimotes and send it through callbacks.
*
* @param mote The WiimoteEvent object to fill with the datas.
*/
native void specialPoll(WiiMoteEvent mote);
/* Tests */
public static void main(String[] args) {
/* Test JNI Side */
WiiUseApi manager = new WiiUseApi();
int value = manager.loadLibrary();
System.out.println("loadLibrary : " + value);
value = manager.doConnections();
System.out.println("doConnections : " + value);
WiiMoteEvent mote = new WiiMoteEvent();
manager.getStatus(1);
System.out.println("Status : \n" + mote);
System.out.println("");
System.out.println("!!!!!!!!!!!!!! Polling !!!!!!!!!");
while (true) {
manager.specialPoll(mote);
System.out.println(mote);
mote.EmptyIRPoints();
}
// manager.closeConnectionsAndShutDown();
}
}

View File

@@ -1,9 +0,0 @@
package wiiusej;
public interface WiiUseApiListener extends java.util.EventListener {
void wiimoteEvent(WiiMoteEvent e);
}

View File

@@ -1,374 +0,0 @@
package wiiusej;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.event.EventListenerList;
/**
* Class that manage the use of Wiiuse API.
*
* @author gduche
*
*/
public class WiiUseApiManager extends Thread {
private static WiiUseApiManager instance = new WiiUseApiManager();
private final EventListenerList listeners = new EventListenerList();
private WiiUseApi wiiuse = WiiUseApi.getInstance();
private boolean loaded = false;
private int connected = 0;
private AtomicBoolean running = new AtomicBoolean(false);
private ConcurrentLinkedQueue<WiiUseApiRequest> requests = new ConcurrentLinkedQueue<WiiUseApiRequest>();
public static WiiUseApiManager getInstance() {
return instance;
}
/**
* Load the wiimote library.
*
* @return false if the library is not loaded true otherwise.
*/
public boolean loadLibrary() {
if (!loaded) {// not yet loaded try to load it
int load = wiiuse.loadLibrary();
if (load > 0) {
loaded = true;
return true;
} else {
loaded = false;
System.out.println("Error loading the Wiimote library !!!");
return false;
}
}
// already loaded
return loaded;
}
/**
* Connect wiimote and get the nu ber of wiimotes connected. Supposed to be
* used once.
*
* @return 0 if nothing connected or the number of wiimotes connected.
*/
public int connectWiimotes() {
if (loaded) {
connected = wiiuse.doConnections();
System.out.println(connected + " wiimote(s) connected !!!");
return connected;
} else {// library not loaded, no wiimotes connected
return 0;
}
}
/**
* Ask the thread to close a connection.
*
* @param id
* id of the wiimote to disconnect.
*/
public void closeConnection(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_CLOSE_CONNECTION_REQUEST));
}
/**
* Get the number of wiimotes connected.
*
* @return the number of wiimotes connected.
*/
public int getNbConnectedWiimotes() {
return connected;
}
/**
* Stop thread and shutdown wiiuse Api.
*/
public void shutdown() {
running.set(false);
wiiuse.shutdownApi();
}
/**
* Activate the rumble for the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void activateRumble(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_ACTIVATE_RUMBLE_REQUEST));
}
/**
* Deactivate the rumble for the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void deactivateRumble(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_DEACTIVATE_RUMBLE_REQUEST));
}
/**
* Activate IR Tracking for the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void activateIRTRacking(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_ACTIVATE_IR_TRACKING_REQUEST));
}
/**
* Deactivate IR Tracking for the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void deactivateIRTRacking(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_DEACTIVATE_IR_TRACKING_REQUEST));
}
/**
* Activate IR Tracking of the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void activateMotionSensing(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_ACTIVATE_MOTION_SENSING_REQUEST));
}
/**
* Deactivate IR Tracking of the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void deactivateMotionSensing(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_DEACTIVATE_MOTION_SENSING_REQUEST));
}
/**
* Activate smoothing the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void activateSmoothing(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_ACTIVATE_SMOOTHING_REQUEST));
}
/**
* Deactivate smoothing the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void deactivateSmoothing(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_DEACTIVATE_SMOOTHING_REQUEST));
}
/**
* Activate continuous for the wiimotes with the given id.
*
* @param id
* id of the wiimote.
*/
public void activateContinuous(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_ACTIVATE_CONTINUOUS_REQUEST));
}
/**
* Deactivate continuous for the wiimotes with the given id.
*
* @param id
* id of the wiimote
*/
public void deactivateContinuous(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_DEACTIVATE_CONTINUOUS_REQUEST));
}
/**
* Set leds for the wiimotes with the given id.
*
* @param id
* id of the wiimote
* @param l1
* status of led1. True : ON, False : OFF
* @param l2
* status of led2. True : ON, False : OFF
* @param l3
* status of led3. True : ON, False : OFF
* @param l4
* status of led4. True : ON, False : OFF
*/
public void setLeds(int id, boolean l1, boolean l2, boolean l3, boolean l4) {
requests.add(new LedsRequest(id, WiiUseApiRequest.WIIUSE_LEDS_REQUEST,
l1, l2, l3, l4));
}
/**
* Set the orientation threshold for the given id.
*
* @param id
* id of the wiimote
* @param th
* threshold in degrees
*/
public void setOrientationThreshold(int id, float th) {
requests.add(new OrientThresholdRequest(id,
WiiUseApiRequest.WIIUSE_ORIENT_THRESHOLHD_REQUEST, th));
}
/**
* Get Status for the wiimote for the given id.
*
* @param id
* id of the wiimote
*/
public void getStatus(int id) {
requests.add(new WiiUseApiRequest(id,
WiiUseApiRequest.WIIUSE_STATUS_REQUEST));
}
@Override
public void run() {
if (loaded && (connected > 0)) {
running.set(true);
WiiMoteEvent evt = new WiiMoteEvent();
// Start polling and tell the observers when there Wiimote events
while (running.get()) {
WiiUseApiRequest req = requests.poll();
if (req != null) {// there is a request for the wiiuse api
int id = req.getId();
if (req.getRequestType() == WiiUseApiRequest.WIIUSE_CLOSE_CONNECTION_REQUEST) {
/* Close connections requests */
wiiuse.closeConnection(id);
connected--;
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_STATUS_REQUEST) {
/* Status requests */
wiiuse.getStatus(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_ACTIVATE_RUMBLE_REQUEST) {
/* Activate Rumble requests */
wiiuse.activateRumble(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_DEACTIVATE_RUMBLE_REQUEST) {
/* Deactivate Rumble requests */
wiiuse.deactivateRumble(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_ACTIVATE_IR_TRACKING_REQUEST) {
/* Activate IR Tracking requests */
wiiuse.activateIRTracking(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_DEACTIVATE_IR_TRACKING_REQUEST) {
/* Deactivate IR Tracking requests */
wiiuse.deactivateIRTracking(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_ACTIVATE_MOTION_SENSING_REQUEST) {
/* Activate Motion sensing requests */
wiiuse.activateMotionSensing(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_DEACTIVATE_MOTION_SENSING_REQUEST) {
/* Deactivate Motion sensing requests */
wiiuse.deactivateMotionSensing(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_LEDS_REQUEST) {
/* leds requests */
LedsRequest reqLed = (LedsRequest) req;
wiiuse.setLeds(id, reqLed.isLed1(), reqLed.isLed2(),
reqLed.isLed3(), reqLed.isLed4());
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_ACTIVATE_SMOOTHING_REQUEST) {
/* Activate smoothing requests */
wiiuse.activateSmoothing(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_DEACTIVATE_SMOOTHING_REQUEST) {
/* Deactivate smoothing requests */
wiiuse.deactivateSmoothing(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_ACTIVATE_CONTINUOUS_REQUEST) {
/* Activate continuous requests */
wiiuse.activateContinuous(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_DEACTIVATE_CONTINUOUS_REQUEST) {
/* Deactivate continuous requests */
wiiuse.deactivateContinuous(id);
} else if (req.getRequestType() == WiiUseApiRequest.WIIUSE_ORIENT_THRESHOLHD_REQUEST) {
/* set orientation request */
wiiuse.setOrientThreshold(req.getId(),
((OrientThresholdRequest) req).getThresholhd());
} else {
System.out.println("Bad request to Wiiuse API !!!!!");
}
}
/* Polling */
wiiuse.specialPoll(evt);
if (evt.getWiimoteId() != -1) {// there is an event notify
// observers
notifyWiiUseApiListener(evt);
}
if (evt.getWiimoteId() != -1) {// create a new event when the last event created was filled
if (!evt.isConnected()){//check if it was a disconnection
connected --;
if (connected == 0){
System.out.println("No more wiimotes connected !!!");
}
}
evt = new WiiMoteEvent();
}
}
} else {
System.out.println("No polling possible !!!");
}
}
/**
*
* @param listener
*/
public void addWiiUseApiListener(WiiUseApiListener listener) {
listeners.add(WiiUseApiListener.class, listener);
}
/**
*
* @param listener
*/
public void removeWiiUseApiListener(WiiUseApiListener listener) {
listeners.remove(WiiUseApiListener.class, listener);
}
/**
*
* @return
*/
public WiiUseApiListener[] getWiiUseApiListeners() {
return listeners.getListeners(WiiUseApiListener.class);
}
/**
*
* @param evt
*/
public void notifyWiiUseApiListener(WiiMoteEvent evt) {
for (WiiUseApiListener listener : getWiiUseApiListeners()) {
listener.wiimoteEvent(evt);
}
}
}

View File

@@ -1,82 +0,0 @@
package wiiusej;
/**
* Represents a request we could do to the WiiUse API.
* @author gduche
*
*/
public class WiiUseApiRequest {
public static int WIIUSE_STATUS_REQUEST=1;
public static int WIIUSE_ACTIVATE_SMOOTHING_REQUEST=2;
public static int WIIUSE_DEACTIVATE_SMOOTHING_REQUEST=-2;
public static int WIIUSE_ACTIVATE_IR_TRACKING_REQUEST=3;
public static int WIIUSE_DEACTIVATE_IR_TRACKING_REQUEST=-3;
public static int WIIUSE_ACTIVATE_MOTION_SENSING_REQUEST=4;
public static int WIIUSE_DEACTIVATE_MOTION_SENSING_REQUEST=-4;
public static int WIIUSE_CLOSE_CONNECTION_REQUEST=5;
public static int WIIUSE_ACTIVATE_CONTINUOUS_REQUEST=6;
public static int WIIUSE_DEACTIVATE_CONTINUOUS_REQUEST=-6;
public static int WIIUSE_ACTIVATE_RUMBLE_REQUEST=7;
public static int WIIUSE_DEACTIVATE_RUMBLE_REQUEST=-7;
public static int WIIUSE_LEDS_REQUEST=8;
public static int WIIUSE_ORIENT_THRESHOLHD_REQUEST=9;
private int wiimoteId=0;
private int requestType=0;
/**
* Constructor setting the id of the wiimote concerned.
* @param id the id of the wiimote concerned.
*/
public WiiUseApiRequest(int id){
wiimoteId = id;
}
/**
* Constructor setting the id of the wiimote concerned.
* @param id the id of the wiimote concerned.
*
*/
public WiiUseApiRequest(int id, int type){
wiimoteId = id;
requestType = type;
}
/**
* Get id of the wiimote concerned by this request.
* @return id of the wiimote concerned
*/
public int getId(){
return wiimoteId;
}
/**
* Set id of the wiimote concerned by this request.
* @param id id fh the wiimote concernet
*/
public void setId(int id){
wiimoteId = id;
}
/**
* Get the request type.
* @return the requestType
*/
public int getRequestType() {
return requestType;
}
/**
* Set the request type.
* @param requestType the requestType to set
*/
public void setRequestType(int requestType) {
this.requestType = requestType;
}
}

Binary file not shown.

View File

@@ -1,653 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.so.debug.1726608405">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.so.debug.1726608405" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/WiiuseJC"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="Debug"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="dll" artifactName="WiiuseJ" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.so.debug.1726608405" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.so.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.mingw.so.debug.1726608405." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.debug.259319070" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.debug.4224338" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.debug"/>
<builder buildPath="${workspace_loc:/WiiuseJC/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1178569381" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug.1678064648" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1791246863" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1767166985" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug.1117557454" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.debug">
<option id="gnu.cpp.compiler.mingw.so.debug.option.optimization.level.938803033" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.so.debug.option.debugging.level.148371574" name="Debug Level" superClass="gnu.cpp.compiler.mingw.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.2082407062" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.so.debug.option.optimization.level.935791254" name="Optimization Level" superClass="gnu.c.compiler.mingw.so.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.so.debug.option.debugging.level.1515562767" name="Debug Level" superClass="gnu.c.compiler.mingw.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1960652558" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;D:\WINDDK\3790.1830\inc\ddk\wdm\wxp&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Java\sdk\jdk\include\win32&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Java\sdk\jdk\include&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.480061400" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug.1733754998" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug">
<option defaultValue="true" id="gnu.c.link.mingw.so.debug.option.shared.1476137252" name="Shared (-shared)" superClass="gnu.c.link.mingw.so.debug.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.userobjs.971774060" name="Other objects" superClass="gnu.c.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="wiiusej_WiiUseApiThread.def"/>
</option>
<option id="gnu.c.link.option.other.957692157" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other"/>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1590513978" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug.1121301143" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.debug">
<option defaultValue="true" id="gnu.cpp.link.mingw.so.debug.option.shared.1541550964" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.debug.option.shared" valueType="boolean"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.debug.1726608405;cdt.managedbuild.config.gnu.mingw.so.debug.1726608405.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.2082407062;cdt.managedbuild.tool.gnu.c.compiler.input.480061400">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.release.1798125298;cdt.managedbuild.config.gnu.mingw.so.release.1798125298.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.550399340;cdt.managedbuild.tool.gnu.c.compiler.input.2082111651">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="wiiusej_WiiUseAp.c" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>wiiusej_WiiUseApi.c</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.so.release.1798125298">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.so.release.1798125298" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/WiiuseJC"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="Release"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="dll" artifactName="WiiuseJ" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.so.release.1798125298" name="Release" parent="cdt.managedbuild.config.gnu.mingw.so.release" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.mingw.so.release.1798125298." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.release.286779454" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.release.1683978700" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.release"/>
<builder buildPath="${workspace_loc:/WiiuseJC/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1405451749" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.so.release.2009203642" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2013045977" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1223963342" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release.23234878" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.so.release">
<option id="gnu.cpp.compiler.mingw.so.release.option.optimization.level.193802727" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.so.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.so.release.option.debugging.level.1050990711" name="Debug Level" superClass="gnu.cpp.compiler.mingw.so.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.550399340" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.so.release.option.optimization.level.1677309558" name="Optimization Level" superClass="gnu.c.compiler.mingw.so.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.so.release.option.debugging.level.193676618" name="Debug Level" superClass="gnu.c.compiler.mingw.so.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1875992791" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;D:\WINDDK\3790.1830\inc\ddk\wdm\wxp&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Java\sdk\jdk\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files\Java\sdk\jdk\include\win32&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2082111651" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release.2031297073" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release">
<option defaultValue="true" id="gnu.c.link.mingw.so.release.option.shared.682191683" name="Shared (-shared)" superClass="gnu.c.link.mingw.so.release.option.shared" valueType="boolean"/>
<option id="gnu.c.link.option.userobjs.1885544238" name="Other objects" superClass="gnu.c.link.option.userobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="wiiusej_WiiUseApi.def"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.484427405" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.1686122836" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release">
<option defaultValue="true" id="gnu.cpp.link.mingw.so.release.option.shared.1981973098" name="Shared (-shared)" superClass="gnu.cpp.link.mingw.so.release.option.shared" valueType="boolean"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.debug.1726608405;cdt.managedbuild.config.gnu.mingw.so.debug.1726608405.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.debug.2082407062;cdt.managedbuild.tool.gnu.c.compiler.input.480061400">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.so.release.1798125298;cdt.managedbuild.config.gnu.mingw.so.release.1798125298.;cdt.managedbuild.tool.gnu.c.compiler.mingw.so.release.550399340;cdt.managedbuild.tool.gnu.c.compiler.input.2082111651">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="wiiusej_WiiUseAp.c" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>wiiusej_WiiUseApi.c</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="WiiuseJC.cdt.managedbuild.target.gnu.mingw.so.1024311043" name="Shared Library" projectType="cdt.managedbuild.target.gnu.mingw.so"/>
</storageModule>
</cproject>

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WiiuseJC</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/WiiuseJC/Release}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>

View File

@@ -1,168 +0,0 @@
/*
* wiiuse
*
* Written By:
* Michael Laforest < para >
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
*
* Copyright 2006-2007
*
* This file is part of wiiuse.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Header$
*
*/
/**
* @file
* @brief API source file
*
* The file must be linked to any third party
* program that is utilizing wiiuse as an
* external library.
*/
#define WIIUSE_API_SRC
#include <stdio.h>
#include "wiiuse.h"
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <dlfcn.h>
#endif
typedef int (*entry_func_t)(struct wiiuse_api_t**);
struct wiiuse_api_t* wiiuse_api = NULL;
void* wiiuse_mod = NULL;
/**
* @brief Load the wiiuse library and initialize the function pointers.
*
* @param wiiuse_file The relative or absolute path to the wiiuse library file.
*
* @return The version of the wiiuse library loaded.
*
* @see wiiuse_shutdown()
*
* If the version of wiiuse being used has a different API
* version as expected, this function will fail and return 0.
*/
const char* wiiuse_startup(char* wiiuse_file) {
entry_func_t entry_func = NULL;
if (wiiuse_api)
/* already loaded */
return wiiuse_api->version;
if (!wiiuse_file)
return NULL;
/* load the module */
wiiuse_mod = dlopen(wiiuse_file, RTLD_NOW);
if (!wiiuse_mod)
/* can not load module */
return NULL;
/* get the entry point */
entry_func = (entry_func_t)dlsym(wiiuse_mod, "wiiuse_main");
if (!entry_func) {
wiiuse_shutdown();
return NULL;
}
/* call the entry function */
entry_func(&wiiuse_api);
/* make sure the API versions are the same */
if (wiiuse_api->api_version != WIIUSE_API_VERSION) {
wiiuse_shutdown();
return NULL;
}
/* set all the function pointers */
wiiuse_init = wiiuse_api->_wiiuse_init;
wiiuse_disconnected = wiiuse_api->_wiiuse_disconnected;
wiiuse_rumble = wiiuse_api->_wiiuse_rumble;
wiiuse_toggle_rumble = wiiuse_api->_wiiuse_toggle_rumble;
wiiuse_set_leds = wiiuse_api->_wiiuse_set_leds;
wiiuse_motion_sensing = wiiuse_api->_wiiuse_motion_sensing;
wiiuse_read_data = wiiuse_api->_wiiuse_read_data;
wiiuse_write_data = wiiuse_api->_wiiuse_write_data;
wiiuse_status = wiiuse_api->_wiiuse_status;
wiiuse_get_by_id = wiiuse_api->_wiiuse_get_by_id;
wiiuse_set_flags = wiiuse_api->_wiiuse_set_flags;
wiiuse_set_smooth_alpha = wiiuse_api->_wiiuse_set_smooth_alpha;
wiiuse_set_ir = wiiuse_api->_wiiuse_set_ir;
wiiuse_set_ir_vres = wiiuse_api->_wiiuse_set_ir_vres;
wiiuse_set_ir_position = wiiuse_api->_wiiuse_set_ir_position;
wiiuse_set_aspect_ratio = wiiuse_api->_wiiuse_set_aspect_ratio;
wiiuse_set_bluetooth_stack = wiiuse_api->_wiiuse_set_bluetooth_stack;
wiiuse_set_orient_threshold = wiiuse_api->_wiiuse_set_orient_threshold;
wiiuse_find = wiiuse_api->_wiiuse_find;
wiiuse_connect = wiiuse_api->_wiiuse_connect;
wiiuse_disconnect = wiiuse_api->_wiiuse_disconnect;
wiiuse_poll = wiiuse_api->_wiiuse_poll;
printf("wiiuse v%s loaded ( http://wiiuse.net http://wiiuse.sf.net/ ).\n", wiiuse_api->version);
return wiiuse_api->version;
}
/**
* @brief Unload the library.
*
* @see wiiuse_startup()
*/
void wiiuse_shutdown() {
if (!wiiuse_mod)
return;
/* unload the module */
dlclose(wiiuse_mod);
wiiuse_api = NULL;
wiiuse_init = NULL;
wiiuse_disconnected = NULL;
wiiuse_rumble = NULL;
wiiuse_toggle_rumble = NULL;
wiiuse_set_leds = NULL;
wiiuse_motion_sensing = NULL;
wiiuse_read_data = NULL;
wiiuse_write_data = NULL;
wiiuse_status = NULL;
wiiuse_get_by_id = NULL;
wiiuse_set_flags = NULL;
wiiuse_set_smooth_alpha = NULL;
wiiuse_set_ir = NULL;
wiiuse_set_ir_vres = NULL;
wiiuse_set_ir_position = NULL;
wiiuse_set_aspect_ratio = NULL;
wiiuse_set_bluetooth_stack = NULL;
wiiuse_set_orient_threshold = NULL;
wiiuse_find = NULL;
wiiuse_connect = NULL;
wiiuse_disconnect = NULL;
wiiuse_poll = NULL;
}

View File

@@ -1,687 +0,0 @@
/*
* wiiuse
*
* Written By:
* Michael Laforest < para >
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
*
* Copyright 2006-2007
*
* This file is part of wiiuse.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Header$
*
*/
/**
* @file
*
* @brief API header file.
*
* If this file is included from inside the wiiuse source
* and not from a third party program, then wiimote_internal.h
* is also included which extends this file.
*/
#ifndef WIIUSE_H_INCLUDED
#define WIIUSE_H_INCLUDED
/* ignore this, this is used internally for wiiuse */
#ifdef __WIIUSE__
#ifndef WIIUSE_INTERNAL_H_INCLUDED
#error wiiuse.h included directly. Must include wiiuse_internal.h instead.
#endif
#define WCONST
#else
#define WCONST const
#endif
#if defined(WIN32) || defined(__WIN32__)
/* windows */
#include <windows.h>
#include <hidsdi.h>
#include <setupapi.h>
#include <hidpi.h>
#define dlopen(file, x) (void*)LoadLibrary(file)
#define dlsym(dll, func) (void*)GetProcAddress((HMODULE)(dll), (func))
#define dlclose(dll) FreeLibrary((HMODULE)(dll))
#define Dl_info MEMORY_BASIC_INFORMATION
#define dladdr(func, inf) VirtualQuery(func, inf, sizeof(*inf))
#else
/* nix */
#include <bluetooth/bluetooth.h>
#endif
/* wiiuse version and API version */
#define WIIUSE_VERSION "0.9"
#define WIIUSE_API_VERSION 8
/* led bit masks */
#define WIIMOTE_LED_NONE 0x00
#define WIIMOTE_LED_1 0x10
#define WIIMOTE_LED_2 0x20
#define WIIMOTE_LED_3 0x40
#define WIIMOTE_LED_4 0x80
/* button codes */
#define WIIMOTE_BUTTON_TWO 0x0001
#define WIIMOTE_BUTTON_ONE 0x0002
#define WIIMOTE_BUTTON_B 0x0004
#define WIIMOTE_BUTTON_A 0x0008
#define WIIMOTE_BUTTON_MINUS 0x0010
#define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020
#define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040
#define WIIMOTE_BUTTON_HOME 0x0080
#define WIIMOTE_BUTTON_LEFT 0x0100
#define WIIMOTE_BUTTON_RIGHT 0x0200
#define WIIMOTE_BUTTON_DOWN 0x0400
#define WIIMOTE_BUTTON_UP 0x0800
#define WIIMOTE_BUTTON_PLUS 0x1000
#define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000
#define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000
#define WIIMOTE_BUTTON_UNKNOWN 0x8000
#define WIIMOTE_BUTTON_ALL 0x1F9F
/* nunchul button codes */
#define NUNCHUK_BUTTON_Z 0x01
#define NUNCHUK_BUTTON_C 0x02
/* classic controller button codes */
#define CLASSIC_CTRL_BUTTON_UP 0x0001
#define CLASSIC_CTRL_BUTTON_LEFT 0x0002
#define CLASSIC_CTRL_BUTTON_ZR 0x0004
#define CLASSIC_CTRL_BUTTON_X 0x0008
#define CLASSIC_CTRL_BUTTON_A 0x0010
#define CLASSIC_CTRL_BUTTON_Y 0x0020
#define CLASSIC_CTRL_BUTTON_B 0x0040
#define CLASSIC_CTRL_BUTTON_ZL 0x0080
#define CLASSIC_CTRL_BUTTON_FULL_R 0x0200
#define CLASSIC_CTRL_BUTTON_PLUS 0x0400
#define CLASSIC_CTRL_BUTTON_HOME 0x0800
#define CLASSIC_CTRL_BUTTON_MINUS 0x1000
#define CLASSIC_CTRL_BUTTON_FULL_L 0x2000
#define CLASSIC_CTRL_BUTTON_DOWN 0x4000
#define CLASSIC_CTRL_BUTTON_RIGHT 0x8000
/* wiimote option flags */
#define WIIUSE_SMOOTHING 0x01
#define WIIUSE_CONTINUOUS 0x02
#define WIIUSE_ORIENT_THRESH 0x04
#define WIIUSE_INIT_FLAGS (WIIUSE_SMOOTHING | WIIUSE_ORIENT_THRESH)
/* IR correction types */
typedef enum ir_position_t {
WIIUSE_IR_ABOVE,
WIIUSE_IR_BELOW
} ir_position_t;
/**
* @brief Check if a button is pressed.
* @param dev Pointer to a wiimote_t or expansion structure.
* @param button The button you are interested in.
* @return 1 if the button is pressed, 0 if not.
*/
#define IS_PRESSED(dev, button) ((dev->btns & button) == button)
/**
* @brief Check if a button is being held.
* @param dev Pointer to a wiimote_t or expansion structure.
* @param button The button you are interested in.
* @return 1 if the button is held, 0 if not.
*/
#define IS_HELD(dev, button) ((dev->btns_held & button) == button)
/**
* @brief Check if a button is released on this event. \n\n
* This does not mean the button is not pressed, it means \n
* this button was just now released.
* @param dev Pointer to a wiimote_t or expansion structure.
* @param button The button you are interested in.
* @return 1 if the button is released, 0 if not.
*
*/
#define IS_RELEASED(dev, button) ((dev->btns_released & button) == button)
/**
* @brief Check if a button has just been pressed this event.
* @param dev Pointer to a wiimote_t or expansion structure.
* @param button The button you are interested in.
* @return 1 if the button is pressed, 0 if not.
*/
#define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button))
#define WIIUSE_USING_ACC(wm) ((wm->state & 0x10) == 0x10)
#define WIIUSE_USING_EXP(wm) ((wm->state & 0x20) == 0x20)
#define WIIUSE_USING_IR(wm) ((wm->state & 0x40) == 0x40)
/*
* Largest known payload is 21 bytes.
* Add 2 for the prefix and round up to a power of 2.
*/
#define MAX_PAYLOAD 32
typedef unsigned char byte;
typedef char sbyte;
struct wiimote_t;
struct vec3b_t;
struct orient_t;
struct gforce_t;
/**
* @brief Event callback.
*
* @param wm Pointer to a wiimote_t structure.
* @param btns What buttons are currently pressed. They are OR'ed together.
* @param accel Acceleration of the device along each axis.
* This is the raw data reported by the wiimote.
* @param orient Orientation (roll, pitch, yaw) of the device.
* @param gforce Pull of gravity on each axis of the device (measured in gravity units).
*
* @see wiiuse_init()
*
* A registered function of this type is called automatically by the wiiuse
* library when an event occurs on the specified wiimote.
*/
typedef void (*wiiuse_event_cb)(struct wiimote_t* wm);
/**
* @brief Callback that handles a read event.
*
* @param wm Pointer to a wiimote_t structure.
* @param data Pointer to the filled data block.
* @param len Length in bytes of the data block.
*
* @see wiiuse_init()
*
* A registered function of this type is called automatically by the wiiuse
* library when the wiimote has returned the full data requested by a previous
* call to wiiuse_read_data().
*/
typedef void (*wiiuse_read_cb)(struct wiimote_t* wm, byte* data, unsigned short len);
/**
* @brief Callback that handles a controller status event.
*
* @param wm Pointer to a wiimote_t structure.
* @param attachment Is there an attachment? (1 for yes, 0 for no)
* @param speaker Is the speaker enabled? (1 for yes, 0 for no)
* @param ir Is the IR support enabled? (1 for yes, 0 for no)
* @param led What LEDs are lit.
* @param battery_level Battery level, between 0.0 (0%) and 1.0 (100%).
*
* @see wiiuse_init()
*
* A registered function of this type is called automatically by the wiiuse
* library when either the controller status changed or the controller
* status was requested explicitly by wiiuse_status().
*/
typedef void (*wiiuse_ctrl_status_cb)(struct wiimote_t* wm, int attachment, int speaker, int ir, int led[4], float battery_level);
/**
* @brief Callback that handles a disconnection event.
*
* @param wm Pointer to a wiimote_t structure.
*
* @see wiiuse_init()
*
* A registered function of this type is called automatically by the wiiuse
* library when a disconnection occurs. This can happen if the POWER button
* is pressed or if the connection is interrupted.
*/
typedef void (*wiiuse_dis_cb)(struct wiimote_t* wm);
/**
* @struct read_req_t
* @brief Data read request structure.
*/
struct read_req_t {
wiiuse_read_cb cb; /**< read data callback */
byte* buf; /**< buffer where read data is written */
unsigned int addr; /**< the offset that the read started at */
unsigned short size; /**< the length of the data read */
unsigned short wait; /**< num bytes still needed to finish read */
struct read_req_t* next; /**< next read request in the queue */
};
/**
* @struct vec2b_t
* @brief Unsigned x,y byte vector.
*/
typedef struct vec2b_t {
byte x, y;
} vec2b_t;
/**
* @struct vec3b_t
* @brief Unsigned x,y,z byte vector.
*/
typedef struct vec3b_t {
byte x, y, z;
} vec3b_t;
/**
* @struct vec3f_t
* @brief Signed x,y,z float struct.
*/
typedef struct vec3f_t {
float x, y, z;
} vec3f_t;
/**
* @struct orient_t
* @brief Orientation struct.
*
* Yaw, pitch, and roll range from -180 to 180 degrees.
*/
typedef struct orient_t {
float roll;
float pitch;
float yaw;
} orient_t;
/**
* @struct gforce_t
* @brief Gravity force struct.
*/
typedef struct gforce_t {
float x, y, z;
} gforce_t;
/**
* @struct accel_t
* @brief Accelerometer struct. For any device with an accelerometer.
*/
typedef struct accel_t {
struct vec3b_t cal_zero; /**< zero calibration */
struct vec3b_t cal_g; /**< gravity calibration */
float st_roll; /**< last smoothed roll value */
float st_pitch; /**< last smoothed roll pitch */
float st_alpha; /**< alpha value for smoothing [0-1] */
} accel_t;
/**
* @struct ir_dot_t
* @brief A single IR source.
*/
typedef struct ir_dot_t {
byte visible; /**< if the IR source is visible */
unsigned int x; /**< interpolated X coordinate */
unsigned int y; /**< interpolated Y coordinate */
short rx; /**< raw X coordinate (0-1023) */
short ry; /**< raw Y coordinate (0-767) */
byte order; /**< increasing order by x-axis value */
byte size; /**< size of the IR dot (0-15) */
} ir_dot_t;
/**
* @enum aspect_t
* @brief Screen aspect ratio.
*/
typedef enum aspect_t {
WIIUSE_ASPECT_4_3,
WIIUSE_ASPECT_16_9
} aspect_t;
/**
* @struct ir_t
* @brief IR struct. Hold all data related to the IR tracking.
*/
typedef struct ir_t {
struct ir_dot_t dot[4]; /**< IR dots */
byte num_dots; /**< number of dots at this time */
enum aspect_t aspect; /**< aspect ratio of the screen */
enum ir_position_t pos; /**< IR sensor bar position */
unsigned int vres[2]; /**< IR virtual screen resolution */
int offset[2]; /**< IR XY correction offset */
int state; /**< keeps track of the IR state */
int ax; /**< absolute X coordinate */
int ay; /**< absolute Y coordinate */
int x; /**< calculated X coordinate */
int y; /**< calculated Y coordinate */
float distance; /**< pixel distance between first 2 dots*/
float z; /**< calculated distance */
} ir_t;
/**
* @struct joystick_t
* @brief Joystick calibration structure.
*
* The angle \a ang is relative to the positive y-axis into quadrant I
* and ranges from 0 to 360 degrees. So if the joystick is held straight
* upwards then angle is 0 degrees. If it is held to the right it is 90,
* down is 180, and left is 270.
*
* The magnitude \a mag is the distance from the center to where the
* joystick is being held. The magnitude ranges from 0 to 1.
* If the joystick is only slightly tilted from the center the magnitude
* will be low, but if it is closer to the outter edge the value will
* be higher.
*/
typedef struct joystick_t {
struct vec2b_t max; /**< maximum joystick values */
struct vec2b_t min; /**< minimum joystick values */
struct vec2b_t center; /**< center joystick values */
float ang; /**< angle the joystick is being held */
float mag; /**< magnitude of the joystick (range 0-1) */
} joystick_t;
/**
* @struct nunchuk_t
* @brief Nunchuk expansion device.
*/
typedef struct nunchuk_t {
struct accel_t accel_calib; /**< nunchuk accelerometer calibration */
struct joystick_t js; /**< joystick calibration */
int* flags; /**< options flag (points to wiimote_t.flags) */
byte btns; /**< what buttons have just been pressed */
byte btns_held; /**< what buttons are being held down */
byte btns_released; /**< what buttons were just released this */
struct vec3b_t accel; /**< current raw acceleration data */
struct orient_t orient; /**< current orientation on each axis */
struct gforce_t gforce; /**< current gravity forces on each axis */
} nunchuk_t;
/**
* @struct classic_ctrl_t
* @brief Classic controller expansion device.
*/
typedef struct classic_ctrl_t {
short btns; /**< what buttons have just been pressed */
short btns_held; /**< what buttons are being held down */
short btns_released; /**< what buttons were just released this */
float r_shoulder; /**< right shoulder button (range 0-1) */
float l_shoulder; /**< left shoulder button (range 0-1) */
struct joystick_t ljs; /**< left joystick calibration */
struct joystick_t rjs; /**< right joystick calibration */
} classic_ctrl_t;
/**
* @struct expansion_t
* @brief Generic expansion device plugged into wiimote.
*/
typedef struct expansion_t {
enum {
EXP_NONE,
EXP_NUNCHUK,
EXP_CLASSIC
} type; /**< type of expansion attached */
union {
struct nunchuk_t nunchuk;
struct classic_ctrl_t classic;
};
} expansion_t;
/**
* @enum win32_bt_stack_t
* @brief Available bluetooth stacks for Windows.
*/
typedef enum win_bt_stack_t {
WIIUSE_STACK_UNKNOWN,
WIIUSE_STACK_MS,
WIIUSE_STACK_BLUESOLEIL
} win_bt_stack_t;
typedef struct wiimote_state_t {
/* expansion_t */
float exp_ljs_ang;
float exp_rjs_ang;
float exp_ljs_mag;
float exp_rjs_mag;
byte exp_btns;
struct orient_t exp_orient;
float exp_r_shoulder;
float exp_l_shoulder;
/* ir_t */
int ir_ax;
int ir_ay;
float ir_distance;
struct orient_t orient;
unsigned short btns;
} wiimote_state_t;
/**
* @struct wiimote_t
* @brief Wiimote structure.
*/
typedef struct wiimote_t {
WCONST int unid; /**< user specified id */
#ifndef WIN32
WCONST bdaddr_t bdaddr; /**< bt address */
WCONST char bdaddr_str[18]; /**< readable bt address */
WCONST int out_sock; /**< output socket */
WCONST int in_sock; /**< input socket */
#else
WCONST HANDLE dev_handle; /**< HID handle */
WCONST OVERLAPPED hid_overlap; /**< overlap handle */
WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */
#endif
WCONST int state; /**< various state flags */
WCONST int leds; /**< currently lit leds */
WCONST int flags; /**< options flag */
WCONST wiiuse_event_cb event_cb; /**< event callback */
WCONST wiiuse_dis_cb dis_cb; /**< disconnect callback */
WCONST wiiuse_ctrl_status_cb stat_cb; /**< controller status callback */
WCONST byte handshake_state; /**< the state of the connection handshake */
WCONST struct read_req_t* read_req; /**< list of data read requests */
WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */
WCONST struct expansion_t exp; /**< wiimote expansion device */
WCONST struct vec3b_t accel; /**< current raw acceleration data */
WCONST struct orient_t orient; /**< current orientation on each axis */
WCONST struct gforce_t gforce; /**< current gravity forces on each axis */
WCONST struct ir_t ir; /**< IR data */
WCONST unsigned short btns; /**< what buttons have just been pressed */
WCONST unsigned short btns_held; /**< what buttons are being held down */
WCONST unsigned short btns_released; /**< what buttons were just released this */
WCONST float orient_threshold; /**< threshold for orient to generate an event */
WCONST struct wiimote_state_t lstate; /**< last saved state */
WCONST byte event[MAX_PAYLOAD]; /**< event buffer */
} wiimote;
/*****************************************
*
* Include API specific stuff
*
*****************************************/
#ifdef __cplusplus
extern "C" {
#endif
/* wiiuse.c */
typedef struct wiimote_t** (*_wiiuse_init_fptr)(int wiimotes, int* unids, wiiuse_event_cb event_cb, wiiuse_ctrl_status_cb stat_cb, wiiuse_dis_cb dis_cb);
typedef void (*_wiiuse_disconnected_fptr)(struct wiimote_t* wm);
typedef void (*_wiiuse_rumble_fptr)(struct wiimote_t* wm, int status);
typedef void (*_wiiuse_toggle_rumble_fptr)(struct wiimote_t* wm);
typedef void (*_wiiuse_set_leds_fptr)(struct wiimote_t* wm, int leds);
typedef void (*_wiiuse_motion_sensing_fptr)(struct wiimote_t* wm, int status);
typedef int (*_wiiuse_read_data_fptr)(struct wiimote_t* wm, wiiuse_read_cb read_cb, byte* buffer, unsigned int offset, unsigned short len);
typedef int (*_wiiuse_write_data_fptr)(struct wiimote_t* wm, unsigned int addr, byte* data, byte len);
typedef void (*_wiiuse_status_fptr)(struct wiimote_t* wm);
typedef struct wiimote_t* (*_wiiuse_get_by_id_fptr)(struct wiimote_t** wm, int wiimotes, int unid);
typedef int (*_wiiuse_set_flags_fptr)(struct wiimote_t* wm, int enable, int disable);
typedef float (*_wiiuse_set_smooth_alpha_fptr)(struct wiimote_t* wm, float alpha);
typedef void (*_wiiuse_set_ir_fptr)(struct wiimote_t* wm, int status);
typedef void (*_wiiuse_set_ir_vres_fptr)(struct wiimote_t* wm, unsigned int x, unsigned int y);
typedef void (*_wiiuse_set_ir_position_fptr)(struct wiimote_t* wm, enum ir_position_t pos);
typedef void (*_wiiuse_set_aspect_ratio_fptr)(struct wiimote_t* wm, enum aspect_t aspect);
typedef void (*_wiiuse_set_bluetooth_stack_fptr)(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type);
typedef void (*_wiiuse_set_orient_threshold_fptr)(struct wiimote_t* wm, float threshold);
/* connect.c */
typedef int (*_wiiuse_find_fptr)(struct wiimote_t** wm, int max_wiimotes, int timeout);
typedef int (*_wiiuse_connect_fptr)(struct wiimote_t** wm, int wiimotes);
typedef void (*_wiiuse_disconnect_fptr)(struct wiimote_t* wm);
/* events.c */
typedef void (*_wiiuse_poll_fptr)(struct wiimote_t** wm, int wiimotes);
#ifdef __cplusplus
}
#endif
/**
* @struct wiiuse_api_t
* @brief API structure that is filled by the library
* when the entry point is invoked.
*
* Unless you are modifying wiiuse, you probably
* will not be interested in any members
* that begin with an underscore (_).
*/
struct wiiuse_api_t {
const char* version; /**< wiiuse version */
int api_version; /**< wiiuse API version */
_wiiuse_init_fptr _wiiuse_init;
_wiiuse_disconnected_fptr _wiiuse_disconnected;
_wiiuse_rumble_fptr _wiiuse_rumble;
_wiiuse_toggle_rumble_fptr _wiiuse_toggle_rumble;
_wiiuse_set_leds_fptr _wiiuse_set_leds;
_wiiuse_motion_sensing_fptr _wiiuse_motion_sensing;
_wiiuse_read_data_fptr _wiiuse_read_data;
_wiiuse_write_data_fptr _wiiuse_write_data;
_wiiuse_status_fptr _wiiuse_status;
_wiiuse_get_by_id_fptr _wiiuse_get_by_id;
_wiiuse_set_flags_fptr _wiiuse_set_flags;
_wiiuse_set_smooth_alpha_fptr _wiiuse_set_smooth_alpha;
_wiiuse_set_ir_fptr _wiiuse_set_ir;
_wiiuse_set_ir_vres_fptr _wiiuse_set_ir_vres;
_wiiuse_set_ir_position_fptr _wiiuse_set_ir_position;
_wiiuse_set_aspect_ratio_fptr _wiiuse_set_aspect_ratio;
_wiiuse_set_bluetooth_stack_fptr _wiiuse_set_bluetooth_stack;
_wiiuse_set_orient_threshold_fptr _wiiuse_set_orient_threshold;
_wiiuse_find_fptr _wiiuse_find;
_wiiuse_connect_fptr _wiiuse_connect;
_wiiuse_disconnect_fptr _wiiuse_disconnect;
_wiiuse_poll_fptr _wiiuse_poll;
};
#ifndef __WIIUSE__
/*
* Operating system dependent macros.
*/
#ifdef __WIN32__
#define dlopen(file, x) (void*)LoadLibrary(file)
#define dlsym(dll, func) (void*)GetProcAddress((HMODULE)(dll), (func))
#define dlclose(dll) FreeLibrary((HMODULE)(dll))
char* _dlerror();
#define dlerror() _dlerror()
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* api/wiiuse.c */
const char* wiiuse_startup(char* wiiuse_file);
void wiiuse_shutdown();
#ifdef WIIUSE_API_SRC
#define WEXTERN
#else
#define WEXTERN extern
#endif
WEXTERN _wiiuse_init_fptr wiiuse_init;
WEXTERN _wiiuse_disconnected_fptr wiiuse_disconnected;
WEXTERN _wiiuse_rumble_fptr wiiuse_rumble;
WEXTERN _wiiuse_toggle_rumble_fptr wiiuse_toggle_rumble;
WEXTERN _wiiuse_set_leds_fptr wiiuse_set_leds;
WEXTERN _wiiuse_motion_sensing_fptr wiiuse_motion_sensing;
WEXTERN _wiiuse_read_data_fptr wiiuse_read_data;
WEXTERN _wiiuse_write_data_fptr wiiuse_write_data;
WEXTERN _wiiuse_status_fptr wiiuse_status;
WEXTERN _wiiuse_get_by_id_fptr wiiuse_get_by_id;
WEXTERN _wiiuse_set_flags_fptr wiiuse_set_flags;
WEXTERN _wiiuse_set_smooth_alpha_fptr wiiuse_set_smooth_alpha;
WEXTERN _wiiuse_set_ir_fptr wiiuse_set_ir;
WEXTERN _wiiuse_set_ir_vres_fptr wiiuse_set_ir_vres;
WEXTERN _wiiuse_set_ir_position_fptr wiiuse_set_ir_position;
WEXTERN _wiiuse_set_aspect_ratio_fptr wiiuse_set_aspect_ratio;
WEXTERN _wiiuse_set_bluetooth_stack_fptr wiiuse_set_bluetooth_stack;
WEXTERN _wiiuse_set_orient_threshold_fptr wiiuse_set_orient_threshold;
WEXTERN _wiiuse_find_fptr wiiuse_find;
WEXTERN _wiiuse_connect_fptr wiiuse_connect;
WEXTERN _wiiuse_disconnect_fptr wiiuse_disconnect;
WEXTERN _wiiuse_poll_fptr wiiuse_poll;
#ifdef __cplusplus
}
#endif
#endif /* __WIIUSE__ */
#endif /* WIIUSE_H_INCLUDED */

View File

@@ -1,659 +0,0 @@
#ifndef WIN32
#include <unistd.h>
#define WIIUSE_PATH "./wiiuse.so"
#else
#define WIIUSE_PATH "wiiuse.dll"
#endif
#include "wiiusej_WiiUseApi.h"
#include "wiiuse.h"
/*
* These are some identifiers for wiimotes
*
* See below in main() for what they are used for.
*/
#define WIIMOTE_ID_1 1
#define WIIMOTE_ID_2 2
#define WIIMOTE_STATE_RUMBLE 0x08
#define WIIMOTE_IS_SET(wm, s) ((wm->state & (s)) == (s))
#define WIIMOTE_IS_FLAG_SET(wm, s) ((wm->flags & (s)) == (s))
/****************** CALLBACKS DECLARATIONS *************************/
static void handle_event(struct wiimote_t* wm);
static void handle_ctrl_status(struct wiimote_t* wm, int attachment,
int speaker, int ir, int led[4], float battery_level);
static void handle_disconnect(wiimote* wm);
static void copy_common_status(struct wiimote_t* wm);
/********************* VARIABLES DECLARATIONS *****************************/
/*
* Make a temp array of wiimote ids.
* Here I only anticipate connecting up to
* two wiimotes. Each wiimote connected
* will get one of these ids.
*/
static int ids[] = { WIIMOTE_ID_1, WIIMOTE_ID_2 };
static wiimote** wiimotes;
static JNIEnv *globalEnv;
static jobject globalObj;
static jobject globalWim;
/****************** GENERAL FUNCTIONS DEFINITIONS *************************/
/*
* Load the wiiuse library
*
* This needs to be done before anything else can happen
* wiiuse_startup() will return the version of the library loaded.
*
* @return 0 if there is an error, 1 if everything is ok.
*/
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_loadLibrary
(JNIEnv *env, jobject obj) {
const char* version;
version = wiiuse_startup(WIIUSE_PATH);
//printf("Wiiuse Version = %s\n", version);
if (!version) {
return 0;
}
/* no problems loading library */
return 1;
}
/**
* Try to connect to 2 wiimotes.
* Make them rumble to show they are connected.
*
* @return 0 if there is an error otherwise it returns
* the number of wiimotes connected..
*/
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
(JNIEnv *env, jobject obj) {
/* variables declarations */
int found, connected;
/*
* Initialize an array of wiimote objects.
*
* The first parameter is the number of wiimotes
* I want to create. I only have two wiimotes
* so I'm limiting the test to just 2.
*
* Then I get it the array of ids and a couple
* callback functions to invoke when something
* happens on one of the wiimotes.
*
* handle_event gets called when a generic event occurs (button press, motion sensing, etc)
* handle_ctrl_status gets called when a response to a status request arrives (battery power, etc)
* handle_disconnect gets called when the wiimote disconnect (holding power button)
*/
wiimotes = wiiuse_init(2, ids, handle_event, handle_ctrl_status,
handle_disconnect);
/*
* Find wiimote devices
* Now we need to find some wiimotes.
* Give the function the wiimote array we created, and tell it there
* are 2 wiimotes we are interested in.
* Set the timeout to be 5 seconds.
* This will return the number of actual wiimotes that are in discovery mode.
*/
found = wiiuse_find(wiimotes, 2, 5);
if (!found) return 0;
/*
* Connect to the wiimotes
* Now that we found some wiimotes, connect to them.
* Give the function the wiimote array and the number of wiimote devices we found.
* This will return the number of established connections to the found wiimotes.
*/
connected = wiiuse_connect(wiimotes, 2);
if (!connected) return 0;
//no problems during connection show that wiimotes are connected
/*
* Now set the LEDs and rumble for a second so it's easy
* to tell which wiimotes are connected (just like the wii does).
*/
wiiuse_set_leds(wiimotes[0], WIIMOTE_LED_1);
wiiuse_set_leds(wiimotes[1], WIIMOTE_LED_2);
wiiuse_rumble(wiimotes[0], 1);
wiiuse_rumble(wiimotes[1], 1);
#ifndef WIN32
usleep(200000);
#else
Sleep(200);
#endif
wiiuse_rumble(wiimotes[0], 0);
wiiuse_rumble(wiimotes[1], 0);
//no pb connecting leave
return connected;
}
/**
* Close connection to the wiimote with the given id.
*
* @param id the id of the wiimote to disconnect.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
(JNIEnv *env, jobject obj, jint id) {
wiiuse_disconnect(wiimotes[id-1]);
}
/**
* Shutdown api.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_shutdownApi
(JNIEnv *env, jobject obj) {
wiiuse_shutdown();
}
/**
* Activate rumble for the wiimote with the given id.
* @param id the id of the wiimote.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble
(JNIEnv *env, jobject obj, jint id) {
wiiuse_rumble(wiimotes[id-1], 1);
}
/**
* Deactivate rumble for the wiimote with the given id.
* @param id the id of the wiimote.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble
(JNIEnv *env, jobject obj, jint id) {
wiiuse_rumble(wiimotes[id-1], 0);
}
/**
* Activate IR TRacking for the wiimote with the given id.
* @param id the id of the wiimote.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking
(JNIEnv *env, jobject obj, jint id) {
wiiuse_set_ir(wiimotes[id-1], 1);
}
/**
* Deactivate IR TRacking for the wiimote with the given id.
* @param id the id of the wiimote.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking
(JNIEnv *env, jobject obj, jint id) {
wiiuse_set_ir(wiimotes[id-1], 0);
}
/**
* Activate Motion Sensing for the wiimote with the given id.
* @param id the id of the wiimote.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing
(JNIEnv *env, jobject obj, jint id) {
wiiuse_motion_sensing(wiimotes[id-1], 1);
}
/**
* Deactivate Motion Sensing for the wiimote with the given id.
* @param id the id of the wiimote.Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing
(JNIEnv *env, jobject obj, jint id) {
wiiuse_motion_sensing(wiimotes[id-1], 0);
}
/**
* Set wiimote leds status.
* @param id the id of the wiimote concerned
* @param led1 status of led1: True=ON, False=OFF
* @param led2 status of led2: True=ON, False=OFF
* @param led3 status of led3: True=ON, False=OFF
* @param led4 status of led4: True=ON, False=OFF
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds
(JNIEnv *env, jobject obj, jint id, jboolean led1, jboolean led2, jboolean led3, jboolean led4) {
int leds = 0;
if (led1) leds |= WIIMOTE_LED_1;
if (led2) leds |= WIIMOTE_LED_2;
if (led3) leds |= WIIMOTE_LED_3;
if (led4) leds |= WIIMOTE_LED_4;
wiiuse_set_leds(wiimotes[id-1], leds);
}
/**
* Set how many degrees an angle must change to generate an event.
* @param id id of the wiimote concerned
* @param angle minimum angle detected by an event
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold
(JNIEnv *env, jobject obj, jint id, jfloat thresh) {
wiiuse_set_orient_threshold(wiimotes[id-1], thresh);
}
/**
* Make the the accelerometers give smoother results.
* This is set by default.
* @param id the id of the wiimote concerned
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing
(JNIEnv *env, jobject obj, jint id) {
wiiuse_set_flags(wiimotes[id-1], WIIUSE_SMOOTHING, 0);
}
/**
* Make the the accelerometers give raw results.
* @param id the id of the wiimote concerned
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing
(JNIEnv *env, jobject obj, jint id) {
wiiuse_set_flags(wiimotes[id-1], 0, WIIUSE_SMOOTHING);
}
/**
* Make the wiimote generate an event each time we poll.
* Not set by default.
* @param id the id of the wiimote concerned
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous
(JNIEnv *env, jobject obj, jint id) {
wiiuse_set_flags(wiimotes[id-1], WIIUSE_CONTINUOUS, 0);
}
/**
* Make the wiimote generate an event only when there is one.
* (default behavior)
* @param id the id of the wiimote concerned
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous
(JNIEnv *env, jobject obj, jint id) {
wiiuse_set_flags(wiimotes[id-1], 0, WIIUSE_CONTINUOUS);
}
/**
* Get status from the wiimotes and send it through call backs.
*
* @param id the id of the wiimote. Must be 1 or 2.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
(JNIEnv *env, jobject obj, jint id) {
wiiuse_status(wiimotes[id-1]);
}
/**
* Get status and values from the wiimotes and send it through callbacks.
* @param wim the wiimote object to fill with the datas.
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
(JNIEnv *env, jobject obj, jobject wim) {
globalEnv = env;
globalObj = obj;
globalWim = wim;
wiiuse_poll(wiimotes, 2);
}
/****************** CALLBACKS DEFINITIONS *************************/
/**
* @brief Callback that handles an event.
*
* @param wm Pointer to a wiimote_t structure.
*
* This function is called automatically by the wiiuse library when an
* event occurs on the specified wiimote.
*/
static void handle_event(struct wiimote_t* wm) {
/* Variables Declarations */
jclass cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
jmethodID mid;
/* fill java class */
copy_common_status(wm);
/* Take care of buttons pressed */
if (wm->btns) {
/* if a button is just pressed, report it */
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setButtonsJustPressed", "(S)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid, wm->btns);
}
if (wm->btns_released) {
/* if a button is just released, report it */
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setButtonsJustReleased", "(S)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
wm->btns_released);
}
if (wm->btns_held) {
/* if a button is held, report it */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setButtonsHeld",
"(S)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
wm->btns_held);
}
/*
* If IR tracking is enabled then print the coordinates
* on the virtual screen that the wiimote is pointing to.
*
* Also make sure that we see at least 1 dot.
*/
if (WIIUSE_USING_IR(wm)) {
int i = 0;
/* go through each of the 4 possible IR sources */
for (; i < 4; ++i) {
/* check if the source is visible */
if (wm->ir.dot[i].visible) {
cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "addIRpoint",
"(II)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
wm->ir.dot[i].x, wm->ir.dot[i].y);
}
}
//printf("IR cursor: (%u, %u)\n", wm->ir.x, wm->ir.y);
//printf("IR z distance: %f\n", wm->ir.z);
}
/* Motion Sensing */
if (WIIUSE_USING_ACC(wm)) {
/* set orientation */
cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setOrientation",
"(FFF)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
wm->orient.roll, wm->orient.pitch, wm->orient.yaw);
/* set gravity force*/
cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setGforce", "(FFF)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
wm->gforce.x, wm->gforce.y, wm->gforce.z);
}
}
/**
* @brief Callback that handles a controller status event.
*
* @param wm Pointer to a wiimote_t structure.
* @param attachment Is there an attachment? (1 for yes, 0 for no)
* @param speaker Is the speaker enabled? (1 for yes, 0 for no)
* @param ir Is the IR support enabled? (1 for yes, 0 for no)
* @param led What LEDs are lit.
* @param battery_level Battery level, between 0.0 (0%) and 1.0 (100%).
*
* This occurs when either the controller status changed
* or the controller status was requested explicitly by
* wiiuse_status().
*
* One reason the status can change is if the nunchuk was
* inserted or removed from the expansion port.
*/
static void handle_ctrl_status(struct wiimote_t* wm, int attachment,
int speaker, int ir, int led[4], float battery_level) {
/* Variables Declarations */
jclass cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
jmethodID mid;
short leds = 0;
/* fill java class */
copy_common_status(wm);
/* LEDS */
cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setLeds", "(S)V");
if (mid == 0) {
return;
}
if (led[0])
leds += 1;
if (led[1])
leds += 2;
if (led[2])
leds += 4;
if (led[3])
leds += 8;
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid, leds);
/* Battery */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setBatteryLevel", "(F)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
battery_level);
/* Speaker */
if (speaker) {
/* set Speaker Enabled */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setSpeakerEnabled",
"()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {
/* set Speaker Disabled */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setSpeakerDisabled",
"()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
/* Attachment */
if (attachment) {
/* set there is an attachment */
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setThereIsAnAttachment", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {
/* set there is no attachment */
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setThereIsNoAttachment", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
}
/**
* @brief Callback that handles a disconnection event.
*
* @param wm Pointer to a wiimote_t structure.
*
* This can happen if the POWER button is pressed, or
* if the connection is interrupted.
*/
static void handle_disconnect(wiimote* wm) {
//printf("\n\n--- DISCONNECTED [wiimote id %i] ---\n", wm->unid);
/* Variables Declarations */
jclass cls;
jmethodID mid;
/* call java method handling disconnection */
/* Set wiimote id */
cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setWiimoteId", "(I)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid, wm->unid);
/* set the wiimote disconnected */
cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setDisconnected", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
/**
* Fills status variables.
* This function is used in handle_event and handle_ctrl_status.
*/
static void copy_common_status(struct wiimote_t* wm) {
/* Variables Declarations */
jmethodID mid;
jclass cls = (*globalEnv)->GetObjectClass(globalEnv, globalWim);
/* Set wiimote id */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setWiimoteId", "(I)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid, wm->unid);
/* set the wiimote connected */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setConnected", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
/* IR state */
if (WIIUSE_USING_IR(wm)) {
/* set IRActive */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setIrActive", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {
/* set IRInactive */
mid
= (*globalEnv)->GetMethodID(globalEnv, cls,
"setIrInactive", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
/* Rumble status */
if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_RUMBLE)) {
/* set rumble active */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setRumbleActive",
"()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {
/* set rumble inactive */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setRumbleInactive",
"()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
/* Motion sensing status */
if (WIIUSE_USING_ACC(wm)) {
/* Set motion sensing active*/
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setMotionSensingActive", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {/* motion sensing not activated */
/* Set motion sensing inactive*/
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setMotionSensingInactive", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
/* orientation threshold value */
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setOrientationThreshold",
"(F)V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid,
wm->orient_threshold);
/* continuous status */
if (WIIMOTE_IS_FLAG_SET(wm,WIIUSE_CONTINUOUS)) {
/* Set WIIUSE_CONTINUOUS active*/
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setContinuousActive",
"()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {
/* Set WIIUSE_CONTINUOUS inactive*/
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setContinuousInactive", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
/* smoothing status */
if (WIIMOTE_IS_FLAG_SET(wm,WIIUSE_SMOOTHING)) {
/* Set WIIUSE_SMOOTHING active*/
mid = (*globalEnv)->GetMethodID(globalEnv, cls, "setSmoothingActive",
"()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
} else {
/* Set WIIUSE_SMOOTHING inactive*/
mid = (*globalEnv)->GetMethodID(globalEnv, cls,
"setSmoothingInactive", "()V");
if (mid == 0) {
return;
}
(*globalEnv)->CallVoidMethod(globalEnv, globalWim, mid);
}
}

View File

@@ -1,19 +0,0 @@
EXPORTS
Java_wiiusej_WiiUseApi_loadLibrary
Java_wiiusej_WiiUseApi_doConnections
Java_wiiusej_WiiUseApi_closeConnection
Java_wiiusej_WiiUseApi_shutdownApi
Java_wiiusej_WiiUseApi_activateRumble
Java_wiiusej_WiiUseApi_deactivateRumble
Java_wiiusej_WiiUseApi_activateIRTracking
Java_wiiusej_WiiUseApi_deactivateIRTracking
Java_wiiusej_WiiUseApi_activateMotionSensing
Java_wiiusej_WiiUseApi_setOrientThreshold
Java_wiiusej_WiiUseApi_activateSmoothing
Java_wiiusej_WiiUseApi_setLeds
Java_wiiusej_WiiUseApi_deactivateSmoothing
Java_wiiusej_WiiUseApi_activateContinuous
Java_wiiusej_WiiUseApi_deactivateContinuous
Java_wiiusej_WiiUseApi_deactivateMotionSensing
Java_wiiusej_WiiUseApi_getStatus
Java_wiiusej_WiiUseApi_specialPoll

View File

@@ -1,157 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class wiiusej_WiiUseApi */
#ifndef _Included_wiiusej_WiiUseApi
#define _Included_wiiusej_WiiUseApi
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: wiiusej_WiiUseApi
* Method: loadLibrary
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_loadLibrary
(JNIEnv *, jobject);
/*
* Class: wiiusej_WiiUseApi
* Method: doConnections
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_doConnections
(JNIEnv *, jobject);
/*
* Class: wiiusej_WiiUseApi
* Method: closeConnection
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: shutdownApi
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_shutdownApi
(JNIEnv *, jobject);
/*
* Class: wiiusej_WiiUseApi
* Method: activateRumble
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateRumble
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: deactivateRumble
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateRumble
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: activateIRTracking
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateIRTracking
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: deactivateIRTracking
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateIRTracking
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: activateMotionSensing
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateMotionSensing
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: deactivateMotionSensing
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateMotionSensing
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: setLeds
* Signature: (IZZZZ)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setLeds
(JNIEnv *, jobject, jint, jboolean, jboolean, jboolean, jboolean);
/*
* Class: wiiusej_WiiUseApi
* Method: setOrientThreshold
* Signature: (IF)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setOrientThreshold
(JNIEnv *, jobject, jint, jfloat);
/*
* Class: wiiusej_WiiUseApi
* Method: activateSmoothing
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateSmoothing
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: deactivateSmoothing
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateSmoothing
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: activateContinuous
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_activateContinuous
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: deactivateContinuous
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_deactivateContinuous
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: getStatus
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
(JNIEnv *, jobject, jint);
/*
* Class: wiiusej_WiiUseApi
* Method: specialPoll
* Signature: (Lwiiusej/WiiMoteEvent;)V
*/
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif