Selectors aanzienlijk algemener gemaakt en alle bijbehorende aanpassingen gemaakt. Devices en applications zijn Activatable's. Ze worden eenmalig geïnitialiseerd. Hierbij worden alleen broodnodige dingen gedaan, maar applicaties worden nog niet gestart en er wordt nog niet naar devices gezocht. Dat gebeurd pas als er wordt geactiveerd. Als er wordt gedeactiveerd moet het object beschikbaar blijven, alleen moet de verbinding met de applicatie of het device tijdelijk worden onderbroken, om vervolgens weer opnieuw geactiveerd te kunnen worden. Pas als de exit methode wordt aangeroepen, dan moet er definitief worden verbroken. Deze methodiek moet overal nog worden ingevoerd! Er moet nog worden gewerkt aan een systeem zodat de selector ziet of een applicatie of device actief is. Het liefst met zo'n wait notify achtige truck.
This commit is contained in:
@@ -2,7 +2,6 @@ package pm.application.itunes;
|
||||
|
||||
import pm.Application;
|
||||
import pm.event.Feedback;
|
||||
import pm.exception.application.ApplicationExitException;
|
||||
import pm.value.Action;
|
||||
|
||||
import com.dt.iTunesController.ITCOMDisabledReason;
|
||||
@@ -11,7 +10,7 @@ import com.dt.iTunesController.iTunes;
|
||||
import com.dt.iTunesController.iTunesEventsInterface;
|
||||
|
||||
public class iTunesApplication extends Application implements iTunesEventsInterface {
|
||||
protected static final String NAME = "iTunes";
|
||||
protected static final String TITLE = "iTunes";
|
||||
|
||||
protected static final int POSTION_CHANGE_RATE = 1;
|
||||
protected static final int VOLUME_CHANGE_RATE = 5;
|
||||
@@ -21,22 +20,22 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
|
||||
protected iTunes iTunes;
|
||||
|
||||
public iTunesApplication() {
|
||||
super();
|
||||
super(TITLE);
|
||||
iTunes = new iTunes();
|
||||
}
|
||||
|
||||
public void initialise() {
|
||||
public void activate() {
|
||||
iTunes.connect();
|
||||
iTunes.addEventHandler(this);
|
||||
}
|
||||
|
||||
public void exit() throws ApplicationExitException {
|
||||
public void exit() {
|
||||
System.out.println("Exit iTunesApplication");
|
||||
super.exit();
|
||||
try {
|
||||
iTunes.quit(); // Todo: wachten totdat ook daadwerkelijk gestart? Anders wordt iTunes niet afgesloten.
|
||||
} catch (Exception e) {
|
||||
throw new ApplicationExitException();
|
||||
//throw new ApplicationExitException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,12 +90,16 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
|
||||
/* iTunesEventInterface => naar eigen class? */
|
||||
public void onDatabaseChangedEvent(int[][] deletedObjectIDs, int[][] changedObjectIDs) {}
|
||||
public void onPlayerPlayEvent(ITTrack iTrack) {
|
||||
System.out.println("iTunes play");
|
||||
eventSpreader.add(new Feedback());
|
||||
if (active) {
|
||||
System.out.println("iTunes play");
|
||||
eventSpreader.add(new Feedback());
|
||||
}
|
||||
}
|
||||
public void onPlayerStopEvent(ITTrack iTrack) {
|
||||
System.out.println("iTunes stop");
|
||||
eventSpreader.add(new Feedback());
|
||||
if (active) {
|
||||
System.out.println("iTunes stop");
|
||||
eventSpreader.add(new Feedback());
|
||||
}
|
||||
}
|
||||
public void onPlayerPlayingTrackChangedEvent(ITTrack iTrack) {}
|
||||
public void onCOMCallsDisabledEvent(ITCOMDisabledReason reason) {}
|
||||
@@ -104,8 +107,4 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
|
||||
public void onQuittingEvent() {}
|
||||
public void onAboutToPromptUserToQuitEvent() {}
|
||||
public void onSoundVolumeChangedEvent(int newVolume) {}
|
||||
|
||||
public String title() {
|
||||
return NAME;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user