Wiimote en Lirc extra getest en bijgewerkt. Geexporteerd naar jar: werkt, maar dll's en native dingen zijn nogal kieskeurig over hun locatie. Nog controleren of daar iets aan te doen is.

This commit is contained in:
2011-06-13 13:43:11 +00:00
parent 23b32d685e
commit 33ed917611
19 changed files with 60 additions and 24 deletions

View File

@@ -7,7 +7,6 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="native"/> <classpathentry kind="lib" path="native"/>
<classpathentry kind="lib" path="cfg"/>
<classpathentry kind="lib" path="resource"/> <classpathentry kind="lib" path="resource"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/> <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/> <classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/>
@@ -15,5 +14,6 @@
<classpathentry kind="lib" path="lib/nativecall-0.4.1.jar"/> <classpathentry kind="lib" path="lib/nativecall-0.4.1.jar"/>
<classpathentry kind="lib" path="lib/nativeloader-200505172341.jar"/> <classpathentry kind="lib" path="lib/nativeloader-200505172341.jar"/>
<classpathentry kind="lib" path="lib/jxinput.jar"/> <classpathentry kind="lib" path="lib/jxinput.jar"/>
<classpathentry kind="lib" path="cfg"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

BIN
java/jar/WiiUseJ.dll Normal file

Binary file not shown.

BIN
java/jar/client.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
java/jar/jintellitype.dll Normal file

Binary file not shown.

BIN
java/jar/jxinput.dll Normal file

Binary file not shown.

BIN
java/jar/main.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
java/jar/native/list.exe Normal file

Binary file not shown.

BIN
java/jar/native/wiiscan.exe Normal file

Binary file not shown.

BIN
java/jar/native/wpcom.dll Normal file

Binary file not shown.

BIN
java/jar/wiiuse.dll Normal file

Binary file not shown.

View File

@@ -1,4 +1,4 @@
@echo off @echo off
set path=%path%;native set path="C:\Program Files (x86)\Java\jdk1.6.0_24\bin";%path%;native
java -cp bin;cfg;resource;lib/commons-logging-1.1.1.jar;lib/jacob-1.15-M3.jar;lib/TableLayout.jar;lib/nativecall-0.4.1.jar;lib/nativeloader-200505172341.jar mimis.Main java -cp bin;cfg;resource;lib/commons-logging-1.1.1.jar;lib/jacob-1.15-M3.jar;lib/TableLayout.jar;lib/nativecall-0.4.1.jar;lib/nativeloader-200505172341.jar mimis.Main
pause pause

View File

@@ -44,7 +44,6 @@ public class Client {
} catch (ActivateException e) { } catch (ActivateException e) {
log.fatal(e); log.fatal(e);
} }
mimis.stop();
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -74,9 +74,7 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
public void deactivate() throws DeactivateException { public void deactivate() throws DeactivateException {
log.debug("Deactivate LircDevice"); log.debug("Deactivate LircDevice");
super.deactivate(); super.deactivate();
log.debug("nu lircserv");
lircService.deactivate(); lircService.deactivate();
log.debug("nu erna");
} }
public void add(LircButton lircButton) { public void add(LircButton lircButton) {

View File

@@ -79,7 +79,6 @@ public class LircService extends Worker {
if (active && !socket.isConnected()) { if (active && !socket.isConnected()) {
active = false; active = false;
} }
log.trace(active);
return active; return active;
} }

View File

@@ -2,6 +2,7 @@ package mimis.device.wiimote;
import mimis.Button; import mimis.Button;
import mimis.Device; import mimis.Device;
import mimis.Worker;
import mimis.device.wiimote.gesture.GestureDevice; import mimis.device.wiimote.gesture.GestureDevice;
import mimis.event.Feedback; import mimis.event.Feedback;
import mimis.exception.button.UnknownButtonException; import mimis.exception.button.UnknownButtonException;
@@ -10,6 +11,7 @@ import mimis.exception.worker.ActivateException;
import mimis.exception.worker.DeactivateException; import mimis.exception.worker.DeactivateException;
import mimis.sequence.state.Press; import mimis.sequence.state.Press;
import mimis.sequence.state.Release; import mimis.sequence.state.Release;
import mimis.util.ArrayCycle;
import mimis.value.Action; import mimis.value.Action;
import org.wiigee.event.GestureEvent; import org.wiigee.event.GestureEvent;
@@ -32,6 +34,7 @@ public class WiimoteDevice extends Device implements GestureListener {
protected boolean connected; protected boolean connected;
protected GestureDevice gestureDevice; protected GestureDevice gestureDevice;
protected int gestureId; protected int gestureId;
protected LedWorker ledWorker;
static { static {
WiimoteDevice.wiimoteService = new WiimoteService(); WiimoteDevice.wiimoteService = new WiimoteService();
@@ -45,6 +48,7 @@ public class WiimoteDevice extends Device implements GestureListener {
gestureDevice = new GestureDevice(); gestureDevice = new GestureDevice();
gestureDevice.add(this); gestureDevice.add(this);
gestureId = 0; gestureId = 0;
ledWorker = new LedWorker();
} }
/* Worker */ /* Worker */
@@ -56,6 +60,13 @@ public class WiimoteDevice extends Device implements GestureListener {
public boolean active() { public boolean active() {
if (wiimote != null) { if (wiimote != null) {
if (!ledWorker.active()) {
try {
ledWorker.activate();
} catch (ActivateException e) {
log.error(e);
}
}
connected = false; connected = false;
wiimote.getStatus(); wiimote.getStatus();
synchronized (this) { synchronized (this) {
@@ -66,24 +77,25 @@ public class WiimoteDevice extends Device implements GestureListener {
} }
} }
if (!connected) { if (!connected) {
disconnect();
active = false; active = false;
try {
ledWorker.deactivate();
} catch (DeactivateException e) {
log.error(e);
}
} }
} }
return active; return active;
} }
public void deactivate() throws DeactivateException {
super.deactivate();
if (wiimote != null) {
wiimote.deactivateMotionSensing();
}
wiimoteDiscovery.disconnect();
}
public void stop() { public void stop() {
super.stop(); super.stop();
ledWorker.stop();
if (wiimote != null) {
disconnect();
}
wiimoteService.exit(); wiimoteService.exit();
wiimoteDiscovery.stop();
} }
/* Events */ /* Events */
@@ -145,6 +157,7 @@ public class WiimoteDevice extends Device implements GestureListener {
wiimote = null; wiimote = null;
try { try {
wiimote = wiimoteService.getDevice(this); wiimote = wiimoteService.getDevice(this);
ledWorker.activate();
} catch (DeviceNotFoundException e) { } catch (DeviceNotFoundException e) {
wiimoteDiscovery.activate(); wiimoteDiscovery.activate();
} }
@@ -166,7 +179,6 @@ public class WiimoteDevice extends Device implements GestureListener {
public void disconnect() { public void disconnect() {
wiimote.disconnect(); wiimote.disconnect();
wiimote = null; wiimote = null;
wiimoteDiscovery.disconnect();
} }
public void disconnected() { public void disconnected() {
@@ -203,4 +215,37 @@ public class WiimoteDevice extends Device implements GestureListener {
System.out.printf("id #%d, prob %.0f%%, valid %b\n", event.getId(), 100 * event.getProbability(), event.isValid()); System.out.printf("id #%d, prob %.0f%%, valid %b\n", event.getId(), 100 * event.getProbability(), event.isValid());
} }
} }
class LedWorker extends Worker {
protected ArrayCycle<Integer> ledCycle;
public LedWorker() {
ledCycle = new ArrayCycle<Integer>();
ledCycle.add(3);
ledCycle.add(6);
ledCycle.add(12);
ledCycle.add(8);
ledCycle.add(12);
ledCycle.add(6);
ledCycle.add(3);
}
public void deactivate() throws DeactivateException {
super.deactivate();
setLeds(1);
}
protected void work() {
setLeds(ledCycle.next());
}
protected void setLeds(int leds) {
wiimote.setLeds(
(leds & 1) > 0,
(leds & 2) > 0,
(leds & 4) > 0,
(leds & 8) > 0);
sleep(leds == 8 ? 200 : 100);
}
}
} }

View File

@@ -47,8 +47,8 @@ public class WiimoteDiscovery extends Worker {
wiimoteDevice.connected(); wiimoteDevice.connected();
} else if (disconnect) { } else if (disconnect) {
disconnect(); disconnect();
disconnect = false;
} }
disconnect = false;
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
@@ -62,9 +62,4 @@ public class WiimoteDiscovery extends Worker {
process.destroy(); process.destroy();
} }
} }
public void stop() {
super.stop();
disconnect();
}
} }