Wederom verder gewerkt aan de items in de TODO lijst.
This commit is contained in:
@@ -8,16 +8,6 @@ import pm.task.TaskListener;
|
||||
public abstract class Application extends TaskListener {
|
||||
public Application() {
|
||||
super();
|
||||
TaskManager.add(this);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
initialise();
|
||||
super.run();
|
||||
} catch (ApplicationInitialiseException e) {
|
||||
e.printStackTrace(); // Todo: dit "over" de thread heengooien / loggen?
|
||||
}
|
||||
}
|
||||
|
||||
public void initialise() throws ApplicationInitialiseException {}
|
||||
|
||||
@@ -19,7 +19,6 @@ public abstract class Device extends TaskListener {
|
||||
public Device() {
|
||||
super();
|
||||
sequenceListener = new SequenceListener();
|
||||
TaskManager.add(this);
|
||||
}
|
||||
|
||||
/* Register macro's */
|
||||
|
||||
@@ -16,6 +16,7 @@ import pm.device.text.TextDevice;
|
||||
import pm.device.text.lan.LanTextDevice;
|
||||
import pm.device.wiimote.WiimoteDevice;
|
||||
import pm.exception.application.ApplicationExitException;
|
||||
import pm.exception.application.ApplicationInitialiseException;
|
||||
import pm.exception.device.DeviceExitException;
|
||||
import pm.exception.device.DeviceInitialiseException;
|
||||
import pm.task.TaskManager;
|
||||
@@ -51,7 +52,9 @@ public class Main extends TaskListener {
|
||||
for (Device device : deviceList) {
|
||||
try {
|
||||
device.initialise();
|
||||
device.start();
|
||||
} catch (DeviceInitialiseException e) {
|
||||
remove(device);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -62,7 +65,13 @@ public class Main extends TaskListener {
|
||||
//add(new WinampApplication());
|
||||
add(new iTunesApplication());
|
||||
for (Application application : applicationCycle) {
|
||||
application.start();
|
||||
try {
|
||||
application.initialise();
|
||||
application.start();
|
||||
} catch (ApplicationInitialiseException e) {
|
||||
remove(application);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,19 +135,23 @@ public class Main extends TaskListener {
|
||||
|
||||
/* Add / remove methods */
|
||||
protected void add(Application application) {
|
||||
TaskManager.add(application);
|
||||
applicationCycle.add(application);
|
||||
}
|
||||
|
||||
protected boolean remove(Application application) {
|
||||
return applicationCycle.remove(application);
|
||||
protected void remove(Application application) {
|
||||
TaskManager.remove(application);
|
||||
applicationCycle.remove(application);
|
||||
}
|
||||
|
||||
protected void add(Device device) {
|
||||
TaskManager.add(device);
|
||||
deviceList.add(device);
|
||||
}
|
||||
|
||||
protected boolean remove(Device device) {
|
||||
return deviceList.remove(device);
|
||||
protected void remove(Device device) {
|
||||
TaskManager.remove(device);
|
||||
deviceList.remove(device);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package pm.device.text;
|
||||
|
||||
import pm.Device;
|
||||
|
||||
public class TextDevice extends Device implements Runnable {
|
||||
public class TextDevice extends Device {
|
||||
InputListener inputListener;
|
||||
|
||||
public TextDevice() {
|
||||
|
||||
@@ -8,13 +8,13 @@ import pm.exception.device.DeviceInitialiseException;
|
||||
public class LanTextDevice extends Device {
|
||||
static final int PORT = 1234;
|
||||
|
||||
protected ServerSocket socket;
|
||||
protected ServerSocket server;
|
||||
protected SocketListener socketListener;
|
||||
|
||||
public void initialise() throws DeviceInitialiseException {
|
||||
try {
|
||||
socket = new ServerSocket(PORT);
|
||||
socketListener = new SocketListener(socket);
|
||||
server = new ServerSocket(PORT);
|
||||
socketListener = new SocketListener(server);
|
||||
socketListener.start();
|
||||
} catch (IOException e) {
|
||||
throw new DeviceInitialiseException();
|
||||
|
||||
@@ -55,4 +55,8 @@ public class TaskManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void remove(TaskListener taskListener) {
|
||||
taskListenerList.remove(taskListener);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
TODO
|
||||
------------
|
||||
|
||||
log bijhouden
|
||||
|
||||
mappings lezen vanuit config bestand
|
||||
@@ -21,7 +20,6 @@ mogelijkheid tot webstart onderzoeken
|
||||
|
||||
alle listeners in gezamelijk pakket plaatsen?
|
||||
|
||||
algemene listener parent class / interface maken? die zou standaard thread functies implementeren / vereisen: start, run, stop
|
||||
|
||||
IN PROGRESS
|
||||
-------------
|
||||
@@ -38,6 +36,9 @@ logo ontwerpen
|
||||
feedback systeem implementeren, rumble voor zowel wiimote als rumblepad
|
||||
+feedback voor rumblepad komt er niet, te veel werk en gebruikte api lijkt niet eenvoudig aanpasbaar
|
||||
|
||||
algemene listener parent class / interface maken? die zou standaard thread functies implementeren / vereisen: start, run, stop
|
||||
+hier zijn al enkele aanpassingen aan gemaakt, de main stuurt nu direct de TaskManager aan in plaats van dat het vannuit een Device of Application gebeurd
|
||||
|
||||
DONE
|
||||
-------------
|
||||
lantextdevice generiek maken met normale textdevice
|
||||
Reference in New Issue
Block a user