Talloze wijzigingen!
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
@echo off
|
||||||
set path=%path%;native
|
set path=%path%;native
|
||||||
java -cp bin;cfg;resource;lib/jacob-1.15-M3.jar;lib/TableLayout.jar;lib/nativecall-0.4.1.jar;lib/nativeloader-200505172341.jar pm.Client
|
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.Client
|
||||||
pause
|
pause
|
||||||
BIN
java/resource/kop.png
Normal file
BIN
java/resource/kop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 MiB |
@@ -2,6 +2,7 @@ package mimis;
|
|||||||
|
|
||||||
import mimis.event.EventHandler;
|
import mimis.event.EventHandler;
|
||||||
import mimis.event.Task;
|
import mimis.event.Task;
|
||||||
|
import mimis.event.feedback.TextFeedback;
|
||||||
import mimis.exception.WorkerException;
|
import mimis.exception.WorkerException;
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
import mimis.manager.Exitable;
|
import mimis.manager.Exitable;
|
||||||
@@ -29,10 +30,11 @@ public abstract class Application extends EventHandler implements Titled, Exitab
|
|||||||
case ACTIVATE:
|
case ACTIVATE:
|
||||||
if (task.getSignal().equals(Signal.BEGIN)) {
|
if (task.getSignal().equals(Signal.BEGIN)) {
|
||||||
try {
|
try {
|
||||||
log.debug(active());
|
|
||||||
if (active()) {
|
if (active()) {
|
||||||
|
eventRouter.add(new TextFeedback("Deactivate application"));
|
||||||
deactivate();
|
deactivate();
|
||||||
} else {
|
} else {
|
||||||
|
eventRouter.add(new TextFeedback("Activate application"));
|
||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
} catch (WorkerException e) {
|
} catch (WorkerException e) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package mimis;
|
package mimis;
|
||||||
|
|
||||||
import mimis.event.EventHandler;
|
import mimis.event.EventHandler;
|
||||||
import mimis.exception.worker.ActivateException;
|
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
import mimis.manager.Exitable;
|
import mimis.manager.Exitable;
|
||||||
import mimis.manager.Titled;
|
import mimis.manager.Titled;
|
||||||
@@ -15,6 +14,7 @@ public abstract class Device extends EventHandler implements Titled, Exitable {
|
|||||||
|
|
||||||
public Device(String title) {
|
public Device(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
sequenceParser = new SequenceParser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String title() {
|
public String title() {
|
||||||
@@ -22,11 +22,6 @@ public abstract class Device extends EventHandler implements Titled, Exitable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Worker */
|
/* Worker */
|
||||||
public void activate() throws ActivateException {
|
|
||||||
super.activate();
|
|
||||||
sequenceParser = new SequenceParser(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
sequenceParser.reset();
|
sequenceParser.reset();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import javax.swing.SwingConstants;
|
|||||||
import javax.swing.WindowConstants;
|
import javax.swing.WindowConstants;
|
||||||
|
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
|
import mimis.util.Swing;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -30,6 +31,7 @@ public class GUI extends JFrame {
|
|||||||
public GUI(Mimis mimis, Manager<Application> applicationManager, Manager<Device> deviceManager) {
|
public GUI(Mimis mimis, Manager<Application> applicationManager, Manager<Device> deviceManager) {
|
||||||
super(TITLE);
|
super(TITLE);
|
||||||
this.mimis = mimis;
|
this.mimis = mimis;
|
||||||
|
setIconImage(Swing.getImage("kop.png"));
|
||||||
createFrame(applicationManager, deviceManager);
|
createFrame(applicationManager, deviceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import mimis.event.EventRouter;
|
|||||||
import mimis.event.Feedback;
|
import mimis.event.Feedback;
|
||||||
import mimis.exception.worker.ActivateException;
|
import mimis.exception.worker.ActivateException;
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
import mimis.feedback.TextFeedback;
|
import mimis.event.feedback.TextFeedback;
|
||||||
import mimis.sequence.SequenceParser;
|
import mimis.sequence.SequenceParser;
|
||||||
import mimis.util.ArrayCycle;
|
import mimis.util.ArrayCycle;
|
||||||
import mimis.value.Action;
|
import mimis.value.Action;
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ public abstract class CMDApplication extends Application {
|
|||||||
super.activate();
|
super.activate();
|
||||||
String key = String.format("%s\\%s", REGISTRY, program);
|
String key = String.format("%s\\%s", REGISTRY, program);
|
||||||
String path = Native.getValue(key);
|
String path = Native.getValue(key);
|
||||||
|
if (path == null) {
|
||||||
|
throw new ActivateException();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
String command = path.startsWith("\"") ? path : String.format("\"%s\"", path);
|
String command = path.startsWith("\"") ? path : String.format("\"%s\"", path);
|
||||||
command = Native.replaceVariables(command);
|
command = Native.replaceVariables(command);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public abstract class WindowsApplication extends CMDApplication {
|
|||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
super.activate();
|
super.activate();
|
||||||
handle = Windows.findWindow(name, null);
|
handle = Windows.findWindow(name, null);
|
||||||
log.info(handle);
|
|
||||||
if (handle < 1) {
|
if (handle < 1) {
|
||||||
sleep(START_SLEEP);
|
sleep(START_SLEEP);
|
||||||
handle = Windows.findWindow(name, null);
|
handle = Windows.findWindow(name, null);
|
||||||
@@ -66,13 +65,13 @@ public abstract class WindowsApplication extends CMDApplication {
|
|||||||
//return Windows.sendMessage(handle, Windows.WM_USER + wParam, 0, 0);
|
//return Windows.sendMessage(handle, Windows.WM_USER + wParam, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void key(Type key, int code) {
|
protected void key(Type type, int code) {
|
||||||
int scanCode = Windows.mapVirtualKey(code, Windows.MAPVK_VK_TO_VSC);
|
int scanCode = Windows.mapVirtualKey(code, Windows.MAPVK_VK_TO_VSC);
|
||||||
Windows.postMessage(handle, key.getCode(), code, 1 | (scanCode << 16));
|
Windows.postMessage(handle, type.getCode(), code, 1 | (scanCode << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void key(Type key, char character) {
|
protected void key(Type type, char character) {
|
||||||
key(key, (int) Character.toUpperCase(character));
|
key(type, (int) Character.toUpperCase(character));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void key(Type key, Key virtualKey) {
|
protected void key(Type key, Key virtualKey) {
|
||||||
|
|||||||
@@ -1,38 +1,127 @@
|
|||||||
package mimis.application.cmd.windows.gomplayer;
|
package mimis.application.cmd.windows.gomplayer;
|
||||||
|
|
||||||
|
import mimis.Worker;
|
||||||
import mimis.application.cmd.windows.WindowsApplication;
|
import mimis.application.cmd.windows.WindowsApplication;
|
||||||
|
import mimis.exception.worker.ActivateException;
|
||||||
|
import mimis.exception.worker.DeactivateException;
|
||||||
import mimis.value.Action;
|
import mimis.value.Action;
|
||||||
|
import mimis.value.Amount;
|
||||||
|
|
||||||
public class GomPlayerApplication extends WindowsApplication {
|
public class GomPlayerApplication extends WindowsApplication {
|
||||||
protected final static String PROGRAM = "GOM.exe";
|
protected final static String PROGRAM = "GOM.exe";
|
||||||
protected final static String TITLE = "GOM Player";
|
protected final static String TITLE = "GOM Player";
|
||||||
protected final static String NAME = "GomPlayer1.x";
|
protected final static String NAME = "GomPlayer1.x";
|
||||||
|
|
||||||
|
protected static final int VOLUME_SLEEP = 100;
|
||||||
|
protected static final int SEEK_SLEEP = 100;
|
||||||
|
|
||||||
|
protected VolumeWorker volumeWorker;
|
||||||
|
protected SeekWorker seekWorker;
|
||||||
|
|
||||||
public GomPlayerApplication() {
|
public GomPlayerApplication() {
|
||||||
super(PROGRAM, TITLE, NAME);
|
super(PROGRAM, TITLE, NAME);
|
||||||
|
volumeWorker = new VolumeWorker();
|
||||||
|
seekWorker = new SeekWorker();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("GomPlayerApplication begin: " + action);
|
log.trace("GomPlayerApplication begin: " + action);
|
||||||
|
try {
|
||||||
|
switch (action) {
|
||||||
|
case VOLUME_UP:
|
||||||
|
volumeWorker.activate(1);
|
||||||
|
break;
|
||||||
|
case VOLUME_DOWN:
|
||||||
|
volumeWorker.activate(-1);
|
||||||
|
break;
|
||||||
|
case FORWARD:
|
||||||
|
seekWorker.activate(Amount.SMALL, 1);
|
||||||
|
break;
|
||||||
|
case REWIND:
|
||||||
|
seekWorker.activate(Amount.SMALL, -1);
|
||||||
|
break;
|
||||||
|
case NEXT:
|
||||||
|
seekWorker.activate(Amount.MEDIUM, 1);
|
||||||
|
break;
|
||||||
|
case PREVIOUS:
|
||||||
|
seekWorker.activate(Amount.MEDIUM, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (ActivateException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void end(Action action) {
|
||||||
|
log.trace("GomPlayerApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command(0x800C);
|
command(0x800C);
|
||||||
break;
|
break;
|
||||||
case FORWARD:
|
|
||||||
command(0x8009);
|
|
||||||
break;
|
|
||||||
case REWIND:
|
|
||||||
command(0x8008);
|
|
||||||
break;
|
|
||||||
case MUTE:
|
case MUTE:
|
||||||
command(0x8016);
|
command(0x8016);
|
||||||
break;
|
break;
|
||||||
case VOLUME_UP:
|
case FORWARD:
|
||||||
command(0x8014);
|
case REWIND:
|
||||||
|
case NEXT:
|
||||||
|
case PREVIOUS:
|
||||||
|
try {
|
||||||
|
seekWorker.deactivate();
|
||||||
|
} catch (DeactivateException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
case VOLUME_UP:
|
||||||
case VOLUME_DOWN:
|
case VOLUME_DOWN:
|
||||||
command(0x8013);
|
try {
|
||||||
|
volumeWorker.deactivate();
|
||||||
|
} catch (DeactivateException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FULLSCREEN:
|
||||||
|
command(0x8154);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected class VolumeWorker extends Worker {
|
||||||
|
protected int volumeChangeSign;
|
||||||
|
|
||||||
|
public void activate(int volumeChangeSign) throws ActivateException {
|
||||||
|
super.activate();
|
||||||
|
this.volumeChangeSign = volumeChangeSign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void work() {
|
||||||
|
command(volumeChangeSign > 0 ? 0x8014 : 0x8013);
|
||||||
|
sleep(VOLUME_SLEEP);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
protected class SeekWorker extends Worker {
|
||||||
|
protected Amount amount;
|
||||||
|
protected int seekDirection;
|
||||||
|
|
||||||
|
public void activate(Amount amount, int seekDirection) throws ActivateException {
|
||||||
|
super.activate();
|
||||||
|
this.amount = amount;
|
||||||
|
this.seekDirection = seekDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void work() {
|
||||||
|
switch (amount) {
|
||||||
|
case SMALL:
|
||||||
|
command(seekDirection > 0 ? 0x8009 : 0x8008);
|
||||||
|
break;
|
||||||
|
case MEDIUM:
|
||||||
|
command(seekDirection > 0 ? 0x800B : 0x800A);
|
||||||
|
break;
|
||||||
|
case LARGE:
|
||||||
|
command(seekDirection > 0 ? 0x8012 : 0x8011);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sleep(SEEK_SLEEP);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ public class WinampApplication extends WindowsApplication {
|
|||||||
protected SeekWorker seekWorker;
|
protected SeekWorker seekWorker;
|
||||||
protected double volume;
|
protected double volume;
|
||||||
protected boolean muted;
|
protected boolean muted;
|
||||||
protected boolean forward;
|
|
||||||
protected boolean rewind;
|
|
||||||
|
|
||||||
public WinampApplication() {
|
public WinampApplication() {
|
||||||
super(PROGRAM, TITLE, NAME);
|
super(PROGRAM, TITLE, NAME);
|
||||||
@@ -59,35 +57,23 @@ public class WinampApplication extends WindowsApplication {
|
|||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("WinampApplication begin: " + action);
|
log.trace("WinampApplication begin: " + action);
|
||||||
switch (action) {
|
try {
|
||||||
case VOLUME_UP:
|
switch (action) {
|
||||||
try {
|
case VOLUME_UP:
|
||||||
volumeWorker.activate(1);
|
volumeWorker.activate(1);
|
||||||
} catch (ActivateException e) {
|
break;
|
||||||
log.error(e);
|
case VOLUME_DOWN:
|
||||||
}
|
|
||||||
break;
|
|
||||||
case VOLUME_DOWN:
|
|
||||||
try {
|
|
||||||
volumeWorker.activate(-1);
|
volumeWorker.activate(-1);
|
||||||
} catch (ActivateException e) {
|
break;
|
||||||
log.error(e);
|
case FORWARD:
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FORWARD:
|
|
||||||
try {
|
|
||||||
seekWorker.activate(1);
|
seekWorker.activate(1);
|
||||||
} catch (ActivateException e) {
|
break;
|
||||||
log.error(e);
|
case REWIND:
|
||||||
}
|
|
||||||
break;
|
|
||||||
case REWIND:
|
|
||||||
try {
|
|
||||||
seekWorker.activate(-1);
|
seekWorker.activate(-1);
|
||||||
} catch (ActivateException e) {
|
break;
|
||||||
log.error(e);
|
}
|
||||||
}
|
} catch (ActivateException e) {
|
||||||
break;
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +179,7 @@ public class WinampApplication extends WindowsApplication {
|
|||||||
|
|
||||||
public void work() {
|
public void work() {
|
||||||
command(seekDirection > 0 ? WINAMP_FFWD5S : WINAMP_REW5S);
|
command(seekDirection > 0 ? WINAMP_FFWD5S : WINAMP_REW5S);
|
||||||
sleep(VOLUME_SLEEP);
|
sleep(SEEK_SLEEP);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,19 +26,23 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
|
|||||||
|
|
||||||
protected iTunes iTunes;
|
protected iTunes iTunes;
|
||||||
protected VolumeWorker volumeWorker;
|
protected VolumeWorker volumeWorker;
|
||||||
|
protected boolean handle;
|
||||||
protected boolean quiting;
|
protected boolean quiting;
|
||||||
|
|
||||||
public iTunesApplication() {
|
public iTunesApplication() {
|
||||||
super(TITLE);
|
super(TITLE);
|
||||||
iTunes = new iTunes();
|
iTunes = new iTunes();
|
||||||
volumeWorker = new VolumeWorker();
|
volumeWorker = new VolumeWorker();
|
||||||
quiting = false;
|
handle = quiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
synchronized (iTunes) {
|
synchronized (iTunes) {
|
||||||
iTunes.connect();
|
iTunes.connect();
|
||||||
iTunes.addEventHandler(this);
|
if (!handle) {
|
||||||
|
iTunes.addEventHandler(this);
|
||||||
|
handle = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.activate();
|
super.activate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class VLCApplication extends CMDApplication {
|
|||||||
protected static final int VOLUME_CHANGE_RATE = 20;
|
protected static final int VOLUME_CHANGE_RATE = 20;
|
||||||
|
|
||||||
protected static final String HOST = "127.0.0.1"; // localhost
|
protected static final String HOST = "127.0.0.1"; // localhost
|
||||||
protected static final int PORT = 8080;
|
protected static final int PORT = 1234;
|
||||||
|
|
||||||
protected int volume = 255;
|
protected int volume = 255;
|
||||||
protected boolean muted = false;
|
protected boolean muted = false;
|
||||||
@@ -42,8 +42,8 @@ public class VLCApplication extends CMDApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void action(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("VLCApplication: " + action);
|
log.trace("VLCApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command("pl_pause");
|
command("pl_pause");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package mimis.device.lirc;
|
package mimis.device.lirc;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import mimis.Button;
|
import mimis.Button;
|
||||||
@@ -12,10 +13,12 @@ import mimis.sequence.state.Press;
|
|||||||
import mimis.sequence.state.Release;
|
import mimis.sequence.state.Release;
|
||||||
import mimis.util.Multiplexer;
|
import mimis.util.Multiplexer;
|
||||||
import mimis.util.multiplexer.SignalListener;
|
import mimis.util.multiplexer.SignalListener;
|
||||||
|
import mimis.util.VBScript;
|
||||||
import mimis.value.Signal;
|
import mimis.value.Signal;
|
||||||
|
|
||||||
public class LircDevice extends Device implements LircButtonListener, SignalListener {
|
public class LircDevice extends Device implements LircButtonListener, SignalListener {
|
||||||
protected static final String TITLE = "Lirc";
|
protected static final String TITLE = "Lirc";
|
||||||
|
protected final static String PROGRAM = "winlirc.exe";
|
||||||
|
|
||||||
protected Multiplexer multiplexer;
|
protected Multiplexer multiplexer;
|
||||||
protected LircService lircService;
|
protected LircService lircService;
|
||||||
@@ -38,12 +41,31 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
super.activate();
|
|
||||||
multiplexer.start();
|
multiplexer.start();
|
||||||
lircService.activate();
|
lircService.activate();
|
||||||
add(eventMapCycle.denonRC176);
|
add(eventMapCycle.denonRC176);
|
||||||
add(eventMapCycle.philiphsRCLE011);
|
add(eventMapCycle.philiphsRCLE011);
|
||||||
add(eventMapCycle.samsungBN5901015A);
|
add(eventMapCycle.samsungBN5901015A);
|
||||||
|
super.activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean active() {
|
||||||
|
if (active && !lircService.active()) {
|
||||||
|
active = false;
|
||||||
|
} else if (!active) {
|
||||||
|
try {
|
||||||
|
if (VBScript.isRunning(PROGRAM)) {
|
||||||
|
try {
|
||||||
|
activate();
|
||||||
|
} catch (ActivateException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ public class LircService extends Worker {
|
|||||||
super.activate();
|
super.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean active() {
|
||||||
|
if (active && !socket.isConnected()) {
|
||||||
|
active = false;
|
||||||
|
}
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
try {
|
try {
|
||||||
bufferedReader.close();
|
bufferedReader.close();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class PhiliphsRCLE011EventMap extends EventMap {
|
|||||||
add(PhiliphsRCLE011Button.VOLUME_UP, new Task(Target.APPLICATION, Action.VOLUME_UP));
|
add(PhiliphsRCLE011Button.VOLUME_UP, new Task(Target.APPLICATION, Action.VOLUME_UP));
|
||||||
add(PhiliphsRCLE011Button.CLOCK, new Task(Target.APPLICATION, Action.REPEAT));
|
add(PhiliphsRCLE011Button.CLOCK, new Task(Target.APPLICATION, Action.REPEAT));
|
||||||
add(PhiliphsRCLE011Button.OUT, new Task(Target.APPLICATION, Action.SHUFFLE));
|
add(PhiliphsRCLE011Button.OUT, new Task(Target.APPLICATION, Action.SHUFFLE));
|
||||||
|
add(PhiliphsRCLE011Button.SQUARE, new Task(Target.APPLICATION, Action.FULLSCREEN));
|
||||||
add(PhiliphsRCLE011Button.RED, new Task(Target.APPLICATION, Action.DISLIKE));
|
add(PhiliphsRCLE011Button.RED, new Task(Target.APPLICATION, Action.DISLIKE));
|
||||||
add(PhiliphsRCLE011Button.GREEN, new Task(Target.APPLICATION, Action.LIKE));
|
add(PhiliphsRCLE011Button.GREEN, new Task(Target.APPLICATION, Action.LIKE));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,21 @@ package mimis.device.panel;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.WindowConstants;
|
import javax.swing.WindowConstants;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
|
import mimis.util.Swing;
|
||||||
import mimis.util.swing.HoldButton;
|
import mimis.util.swing.HoldButton;
|
||||||
import mimis.util.swing.HoldButtonListener;
|
import mimis.util.swing.HoldButtonListener;
|
||||||
import mimis.util.swing.ToggleButton;
|
import mimis.util.swing.ToggleButton;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
public class Panel extends JFrame implements HoldButtonListener {
|
public class Panel extends JFrame implements HoldButtonListener {
|
||||||
protected static final long serialVersionUID = 1L;
|
protected static final long serialVersionUID = 1L;
|
||||||
protected Log log = LogFactory.getLog(getClass());
|
protected Log log = LogFactory.getLog(getClass());
|
||||||
@@ -24,7 +24,7 @@ public class Panel extends JFrame implements HoldButtonListener {
|
|||||||
protected final static String TITLE = "MIMIS Panel Device";
|
protected final static String TITLE = "MIMIS Panel Device";
|
||||||
|
|
||||||
protected PanelDevice panelDevice;
|
protected PanelDevice panelDevice;
|
||||||
protected ClassLoader classLoader;
|
|
||||||
protected HoldButton upButton;
|
protected HoldButton upButton;
|
||||||
protected HoldButton previousButton;
|
protected HoldButton previousButton;
|
||||||
protected HoldButton rewindButton;
|
protected HoldButton rewindButton;
|
||||||
@@ -42,7 +42,7 @@ public class Panel extends JFrame implements HoldButtonListener {
|
|||||||
Panel(PanelDevice panelDevice) {
|
Panel(PanelDevice panelDevice) {
|
||||||
super(TITLE);
|
super(TITLE);
|
||||||
this.panelDevice = panelDevice;
|
this.panelDevice = panelDevice;
|
||||||
classLoader = getClass().getClassLoader();
|
setIconImage(Swing.getImage("kop.png"));
|
||||||
createControls();
|
createControls();
|
||||||
layoutControls();
|
layoutControls();
|
||||||
pack();
|
pack();
|
||||||
@@ -51,25 +51,17 @@ public class Panel extends JFrame implements HoldButtonListener {
|
|||||||
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected URL getResource(String name) {
|
|
||||||
return classLoader.getResource(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ImageIcon getImageIcon(String name) {
|
|
||||||
return new ImageIcon(getResource(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected HoldButton getButton(String name, String text) {
|
protected HoldButton getButton(String name, String text) {
|
||||||
HoldButton button = new HoldButton(this);
|
HoldButton button = new HoldButton(this);
|
||||||
button.setIcon(getImageIcon(name));
|
button.setIcon(Swing.getImageIcon(name));
|
||||||
button.setToolTipText(text);
|
button.setToolTipText(text);
|
||||||
button.setFocusPainted(false);
|
button.setFocusPainted(false);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ToggleButton getToggleButton(String firstName, String secondName, String text) {
|
protected ToggleButton getToggleButton(String firstName, String secondName, String text) {
|
||||||
ImageIcon firstImageIcon = getImageIcon(firstName);
|
ImageIcon firstImageIcon = Swing.getImageIcon(firstName);
|
||||||
ImageIcon secondImageIcon = getImageIcon(secondName);
|
ImageIcon secondImageIcon = Swing.getImageIcon(secondName);
|
||||||
ToggleButton button = new ToggleButton(this, firstImageIcon, secondImageIcon);
|
ToggleButton button = new ToggleButton(this, firstImageIcon, secondImageIcon);
|
||||||
button.setToolTipText(text);
|
button.setToolTipText(text);
|
||||||
button.setFocusPainted(false);
|
button.setFocusPainted(false);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package mimis.feedback;
|
package mimis.event.feedback;
|
||||||
|
|
||||||
import mimis.event.Feedback;
|
import mimis.event.Feedback;
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ import mimis.Event;
|
|||||||
import mimis.event.Task;
|
import mimis.event.Task;
|
||||||
import mimis.event.EventListener;
|
import mimis.event.EventListener;
|
||||||
import mimis.event.EventRouter;
|
import mimis.event.EventRouter;
|
||||||
import mimis.feedback.TextFeedback;
|
import mimis.event.feedback.TextFeedback;
|
||||||
import mimis.value.Target;
|
import mimis.value.Target;
|
||||||
|
|
||||||
public class LocalRouter extends EventRouter {
|
public class LocalRouter extends EventRouter {
|
||||||
|
|||||||
@@ -1,40 +1,46 @@
|
|||||||
package mimis.util;
|
package mimis.util;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.InputMismatchException;
|
import java.util.InputMismatchException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Native {
|
public class Native {
|
||||||
public static int getHandle(String name) throws IOException {
|
public static int getHandle(String title) throws IOException {
|
||||||
File file = new File("native/list.exe");
|
String command = String.format("native/list.exe w");
|
||||||
Process process = Runtime.getRuntime().exec(file.getPath());
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
Scanner scanner = new Scanner(process.getInputStream());
|
Scanner scanner = new Scanner(process.getInputStream());
|
||||||
ArrayList<Integer> handleList = new ArrayList<Integer>();
|
scanner.nextLine();
|
||||||
ArrayList<String> titleList = new ArrayList<String>();
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
|
Scanner line = new Scanner(scanner.nextLine());
|
||||||
|
line.useDelimiter("\t");
|
||||||
try {
|
try {
|
||||||
int handle = new Integer(scanner.nextLine());
|
int handle = line.nextInt();
|
||||||
String title = scanner.nextLine();
|
line.nextInt();
|
||||||
if (title.contains(name)) {
|
if (line.hasNext() && line.next().equals(title)) {
|
||||||
handleList.add(handle);
|
return handle;
|
||||||
titleList.add(title);
|
|
||||||
}
|
}
|
||||||
} catch (InputMismatchException e) {}
|
} catch (InputMismatchException e) {}
|
||||||
}
|
}
|
||||||
int count = handleList.size();
|
return -1;
|
||||||
if (count == 1) {
|
}
|
||||||
return handleList.get(0);
|
|
||||||
|
public static String getProgram(int processId) throws IOException {
|
||||||
|
String command = String.format("native/list.exe p");
|
||||||
|
Process process = Runtime.getRuntime().exec(command);
|
||||||
|
Scanner scanner = new Scanner(process.getInputStream());
|
||||||
|
scanner.nextLine();
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
Scanner line = new Scanner(scanner.nextLine());
|
||||||
|
line.useDelimiter("\t");
|
||||||
|
try {
|
||||||
|
if (line.nextInt() == processId) {
|
||||||
|
return line.next();
|
||||||
|
}
|
||||||
|
} catch (InputMismatchException e) {}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < count; ++i) {
|
return null;
|
||||||
if (titleList.get(i).endsWith(name)) {
|
|
||||||
return handleList.get(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count > 0 ? handleList.get(0) : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getValue(String key, String name) {
|
public static String getValue(String key, String name) {
|
||||||
@@ -60,7 +66,7 @@ public class Native {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getValue(String key) {
|
public static String getValue(String key) {
|
||||||
return getValue(key, "(Default");
|
return getValue(key, "(Default)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String replaceVariables(String string) {
|
public static String replaceVariables(String string) {
|
||||||
|
|||||||
29
java/src/mimis/util/Swing.java
Normal file
29
java/src/mimis/util/Swing.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package mimis.util;
|
||||||
|
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
public class Swing {
|
||||||
|
protected static ClassLoader classLoader;
|
||||||
|
protected static Toolkit toolkit;
|
||||||
|
|
||||||
|
static {
|
||||||
|
classLoader = Swing.class.getClassLoader();
|
||||||
|
toolkit = Toolkit.getDefaultToolkit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static URL getResource(String name) {
|
||||||
|
return classLoader.getResource(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Image getImage(String name) {
|
||||||
|
return toolkit.getImage((getResource(name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageIcon getImageIcon(String name) {
|
||||||
|
return new ImageIcon(getResource(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
5
java/src/mimis/value/Amount.java
Normal file
5
java/src/mimis/value/Amount.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package mimis.value;
|
||||||
|
|
||||||
|
public enum Amount {
|
||||||
|
SMALL, MEDIUM, LARGE
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user