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 abstract class Application extends TaskListener {
|
||||||
public Application() {
|
public Application() {
|
||||||
super();
|
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 {}
|
public void initialise() throws ApplicationInitialiseException {}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public abstract class Device extends TaskListener {
|
|||||||
public Device() {
|
public Device() {
|
||||||
super();
|
super();
|
||||||
sequenceListener = new SequenceListener();
|
sequenceListener = new SequenceListener();
|
||||||
TaskManager.add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register macro's */
|
/* Register macro's */
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import pm.device.text.TextDevice;
|
|||||||
import pm.device.text.lan.LanTextDevice;
|
import pm.device.text.lan.LanTextDevice;
|
||||||
import pm.device.wiimote.WiimoteDevice;
|
import pm.device.wiimote.WiimoteDevice;
|
||||||
import pm.exception.application.ApplicationExitException;
|
import pm.exception.application.ApplicationExitException;
|
||||||
|
import pm.exception.application.ApplicationInitialiseException;
|
||||||
import pm.exception.device.DeviceExitException;
|
import pm.exception.device.DeviceExitException;
|
||||||
import pm.exception.device.DeviceInitialiseException;
|
import pm.exception.device.DeviceInitialiseException;
|
||||||
import pm.task.TaskManager;
|
import pm.task.TaskManager;
|
||||||
@@ -51,7 +52,9 @@ public class Main extends TaskListener {
|
|||||||
for (Device device : deviceList) {
|
for (Device device : deviceList) {
|
||||||
try {
|
try {
|
||||||
device.initialise();
|
device.initialise();
|
||||||
|
device.start();
|
||||||
} catch (DeviceInitialiseException e) {
|
} catch (DeviceInitialiseException e) {
|
||||||
|
remove(device);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +65,13 @@ public class Main extends TaskListener {
|
|||||||
//add(new WinampApplication());
|
//add(new WinampApplication());
|
||||||
add(new iTunesApplication());
|
add(new iTunesApplication());
|
||||||
for (Application application : applicationCycle) {
|
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 */
|
/* Add / remove methods */
|
||||||
protected void add(Application application) {
|
protected void add(Application application) {
|
||||||
|
TaskManager.add(application);
|
||||||
applicationCycle.add(application);
|
applicationCycle.add(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean remove(Application application) {
|
protected void remove(Application application) {
|
||||||
return applicationCycle.remove(application);
|
TaskManager.remove(application);
|
||||||
|
applicationCycle.remove(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void add(Device device) {
|
protected void add(Device device) {
|
||||||
|
TaskManager.add(device);
|
||||||
deviceList.add(device);
|
deviceList.add(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean remove(Device device) {
|
protected void remove(Device device) {
|
||||||
return deviceList.remove(device);
|
TaskManager.remove(device);
|
||||||
|
deviceList.remove(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package pm.device.text;
|
|||||||
|
|
||||||
import pm.Device;
|
import pm.Device;
|
||||||
|
|
||||||
public class TextDevice extends Device implements Runnable {
|
public class TextDevice extends Device {
|
||||||
InputListener inputListener;
|
InputListener inputListener;
|
||||||
|
|
||||||
public TextDevice() {
|
public TextDevice() {
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import pm.exception.device.DeviceInitialiseException;
|
|||||||
public class LanTextDevice extends Device {
|
public class LanTextDevice extends Device {
|
||||||
static final int PORT = 1234;
|
static final int PORT = 1234;
|
||||||
|
|
||||||
protected ServerSocket socket;
|
protected ServerSocket server;
|
||||||
protected SocketListener socketListener;
|
protected SocketListener socketListener;
|
||||||
|
|
||||||
public void initialise() throws DeviceInitialiseException {
|
public void initialise() throws DeviceInitialiseException {
|
||||||
try {
|
try {
|
||||||
socket = new ServerSocket(PORT);
|
server = new ServerSocket(PORT);
|
||||||
socketListener = new SocketListener(socket);
|
socketListener = new SocketListener(server);
|
||||||
socketListener.start();
|
socketListener.start();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new DeviceInitialiseException();
|
throw new DeviceInitialiseException();
|
||||||
|
|||||||
@@ -55,4 +55,8 @@ public class TaskManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void remove(TaskListener taskListener) {
|
||||||
|
taskListenerList.remove(taskListener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
TODO
|
TODO
|
||||||
------------
|
------------
|
||||||
|
|
||||||
log bijhouden
|
log bijhouden
|
||||||
|
|
||||||
mappings lezen vanuit config bestand
|
mappings lezen vanuit config bestand
|
||||||
@@ -21,7 +20,6 @@ mogelijkheid tot webstart onderzoeken
|
|||||||
|
|
||||||
alle listeners in gezamelijk pakket plaatsen?
|
alle listeners in gezamelijk pakket plaatsen?
|
||||||
|
|
||||||
algemene listener parent class / interface maken? die zou standaard thread functies implementeren / vereisen: start, run, stop
|
|
||||||
|
|
||||||
IN PROGRESS
|
IN PROGRESS
|
||||||
-------------
|
-------------
|
||||||
@@ -38,6 +36,9 @@ logo ontwerpen
|
|||||||
feedback systeem implementeren, rumble voor zowel wiimote als rumblepad
|
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
|
+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
|
DONE
|
||||||
-------------
|
-------------
|
||||||
lantextdevice generiek maken met normale textdevice
|
lantextdevice generiek maken met normale textdevice
|
||||||
Reference in New Issue
Block a user