first draft with new version working on wiiuse 0.10.
New system to get events. git-svn-id: http://wiiusej.googlecode.com/svn/trunk@52 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
54
WiiUseJ/src/wiiusej/wiiuseapirequest/FloatValueRequest.java
Normal file
54
WiiUseJ/src/wiiusej/wiiuseapirequest/FloatValueRequest.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package wiiusej.wiiuseapirequest;
|
||||
|
||||
/**
|
||||
* 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 FloatValueRequest extends WiiUseApiRequest {
|
||||
|
||||
private float floatValue;
|
||||
|
||||
/**
|
||||
* Constructor setting the id of the wiimote concerned.
|
||||
*
|
||||
* @param id
|
||||
* the id of the wiimote concerned.
|
||||
*/
|
||||
public FloatValueRequest(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 FloatValueRequest(int id, int type, float th) {
|
||||
super(id, type);
|
||||
floatValue = th;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the float value
|
||||
*/
|
||||
public float getFloatValue() {
|
||||
return floatValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param val the thresholhd to set
|
||||
*/
|
||||
public void setFloatValue(float val) {
|
||||
this.floatValue = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
109
WiiUseJ/src/wiiusej/wiiuseapirequest/LedsRequest.java
Normal file
109
WiiUseJ/src/wiiusej/wiiuseapirequest/LedsRequest.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package wiiusej.wiiuseapirequest;
|
||||
|
||||
/**
|
||||
* Represents a request to set leds of the wiimote with WiiUse API.
|
||||
* @author gduche
|
||||
*
|
||||
*/
|
||||
public class LedsRequest extends wiiusej.wiiuseapirequest.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;
|
||||
}
|
||||
|
||||
}
|
||||
83
WiiUseJ/src/wiiusej/wiiuseapirequest/WiiUseApiRequest.java
Normal file
83
WiiUseJ/src/wiiusej/wiiuseapirequest/WiiUseApiRequest.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package wiiusej.wiiuseapirequest;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
public static int WIIUSE_ACCEL_THRESHOLHD_REQUEST=10;
|
||||
public static int WIIUSE_ALPHA_SMOOTHING_REQUEST=11;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user