This commit is contained in:
2011-06-12 10:33:33 +00:00
parent 36e067d5f6
commit ddd71a1daf
9 changed files with 28 additions and 24 deletions

View File

@@ -53,7 +53,7 @@ public class GUI extends JFrame {
JPanel applicationPanel = createManagerPanel(applicationManager, APPLICATION_TITLE);
controlPanel.add(applicationPanel);
}
if (applicationManager.count() > 0) {
if (deviceManager.count() > 0) {
JPanel devicePanel = createManagerPanel(deviceManager, DEVICE_TITLE);
controlPanel.add(devicePanel);
}
@@ -80,7 +80,6 @@ public class GUI extends JFrame {
protected void processWindowEvent(WindowEvent event) {
if (event.getID() == WindowEvent.WINDOW_CLOSING) {
log.debug("Window closing");
stop();
try {
mimis.stop();
} catch (DeactivateException e) {

View File

@@ -12,11 +12,11 @@ public abstract class Worker implements Runnable {
protected static final boolean THREAD = true;
protected static final int SLEEP = 100;
protected boolean running = false;
protected boolean run = false;
protected boolean active = false;
public void start(boolean thread) {
running = true;
run = true;
if (thread) {
log.debug("Start thread");
new Thread(this, getClass().getName()).start();
@@ -32,9 +32,11 @@ public abstract class Worker implements Runnable {
public void stop() throws DeactivateException {
if (active()) {
log.debug("stop deact");
deactivate();
log.debug("stop na deact");
}
running = false;
run = false;
synchronized (this) {
notifyAll();
}
@@ -64,7 +66,7 @@ public abstract class Worker implements Runnable {
public void activate(boolean thread) {
active = true;
if (!running) {
if (!run) {
start(thread);
}
synchronized (this) {
@@ -80,7 +82,7 @@ public abstract class Worker implements Runnable {
}
public final void run() {
while (running) {
while (run) {
if (active()) {
work();
} else {

View File

@@ -10,7 +10,7 @@ import mimis.util.VBScript;
public abstract class CMDApplication extends Application {
protected final static String REGISTRY = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths";
protected final static String REGISTRY = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths";
protected String program;
protected String title;

View File

@@ -16,7 +16,7 @@ import mimis.value.Action;
import mimis.value.Amount;
public class VLCApplication extends CMDApplication {
protected final static String REGISTRY = "HKEY_CLASSES_ROOT\\Applications\\vlc.exe\\shell\\Open\\command";
protected final static String REGISTRY = "HKCR\\Applications\\vlc.exe\\shell\\Open\\command";
protected final static String PROGRAM = "vlc.exe";
protected final static String TITLE = "VLC media player";

View File

@@ -41,7 +41,6 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
}
public void activate() throws ActivateException {
multiplexer.start();
lircService.activate();
add(eventMapCycle.denonRC176);
add(eventMapCycle.philiphsRCLE011);
@@ -52,7 +51,11 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
public boolean active() {
log.trace("LircDevice active?");
if (active && !lircService.active()) {
active = false;
try {
deactivate();
} catch (DeactivateException e) {
log.error(e);
}
} else if (!active) {
try {
if (VBScript.isRunning(PROGRAM)) {
@@ -72,8 +75,9 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
public void deactivate() throws DeactivateException {
log.debug("Deactivate LircDevice");
super.deactivate();
multiplexer.stop();
log.debug("nu lircserv");
lircService.deactivate();
log.debug("nu erna");
}
public void add(LircButton lircButton) {
@@ -92,8 +96,9 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
}
public void stop() throws DeactivateException {
multiplexer.stop();
lircService.stop();
log.debug("Stop LircDevice");
super.stop();
lircService.stop();
multiplexer.stop();
}
}

View File

@@ -37,7 +37,7 @@ public class LircService extends Worker {
public LircService(HashMap<String, LircButton[]> buttonMap) {
this(buttonMap, IP, PORT);
send = Native.getValue("HKEY_CURRENT_USER\\Software\\LIRC", "password");
send = Native.getValue("HKCU\\Software\\LIRC", "password");
}
public LircService(HashMap<String, LircButton[]> buttonMap, String ip, int port) {
@@ -56,6 +56,7 @@ public class LircService extends Worker {
}
public void activate() throws ActivateException {
log.debug("Activate LircService");
try {
socket = new Socket(ip, port);
@@ -75,16 +76,18 @@ public class LircService extends Worker {
}
public boolean active() {
log.trace("LircService active?");
if (active && !socket.isConnected()) {
active = false;
}
log.trace(active);
return active;
}
public void deactivate() throws DeactivateException {
log.debug("Deactivate LircService");
super.deactivate();
try {
bufferedReader.close();
inputStream.close();
outputStream.close();
socket.close();

View File

@@ -29,7 +29,7 @@ public abstract class EventListener extends Worker {
try {
work.wait();
} catch (InterruptedException e) {}
if (!running) {
if (!run) {
return;
}
}

View File

@@ -6,10 +6,4 @@ feedback?
mogelijkheid tot webstart onderzoeken
IN PROGRESS
-------------
exporteren naar uitvoerbare jar file
favicon maken?
exporteren naar uitvoerbare jar file

View File

@@ -47,6 +47,7 @@ public class Multiplexer extends Worker {
}
protected void work() {
log.debug("Multiplexer work");
try {
synchronized (this) {
wait(TIMEOUT);