EventMaps van LircDevice gedeeltelijk toegevoegd. In WiimoteDevice SHIFT mechanisme toegepast. iTunes uitgeprobeerd: mechanisme verzinnen om in thread bepaalde taak te draaien!

This commit is contained in:
2011-06-08 14:19:55 +00:00
parent 7589708783
commit 3bebd1897d
32 changed files with 305 additions and 238 deletions

View File

@@ -4,7 +4,6 @@ import java.awt.GridLayout;
import java.awt.TextArea; import java.awt.TextArea;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;

View File

@@ -7,7 +7,7 @@ import java.util.Map;
import javax.swing.JToggleButton; import javax.swing.JToggleButton;
import mimis.manager.Exitable; import mimis.manager.Exitable;
import mimis.manager.SelectButton; import mimis.manager.ManageButton;
import mimis.manager.Titled; import mimis.manager.Titled;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -19,7 +19,7 @@ public class Manager<T extends Worker & Titled & Exitable> extends Worker {
protected static final int INTERVAL = 500; protected static final int INTERVAL = 500;
protected T[] manageableArray; protected T[] manageableArray;
protected Map<T, SelectButton<T>> buttonMap; protected Map<T, ManageButton<T>> buttonMap;
public Manager(T[] manageableArray) { public Manager(T[] manageableArray) {
this.manageableArray = manageableArray; this.manageableArray = manageableArray;
@@ -34,9 +34,9 @@ public class Manager<T extends Worker & Titled & Exitable> extends Worker {
} }
protected void createButtons() { protected void createButtons() {
buttonMap = new HashMap<T, SelectButton<T>>(); buttonMap = new HashMap<T, ManageButton<T>>();
for (T manageable : manageableArray) { for (T manageable : manageableArray) {
SelectButton<T> button = new SelectButton<T>(manageable); ManageButton<T> button = new ManageButton<T>(manageable);
buttonMap.put(manageable, button); buttonMap.put(manageable, button);
} }
} }
@@ -49,7 +49,7 @@ public class Manager<T extends Worker & Titled & Exitable> extends Worker {
long before = Calendar.getInstance().getTimeInMillis(); long before = Calendar.getInstance().getTimeInMillis();
for (T manageable : manageableArray) { for (T manageable : manageableArray) {
boolean active = manageable.active(); boolean active = manageable.active();
SelectButton<T> button = buttonMap.get(manageable); ManageButton<T> button = buttonMap.get(manageable);
button.setPressed(active); button.setPressed(active);
} }
long after = Calendar.getInstance().getTimeInMillis(); long after = Calendar.getInstance().getTimeInMillis();

View File

@@ -13,12 +13,14 @@ import com.dt.iTunesController.iTunesEventsInterface;
public class iTunesApplication extends Application implements iTunesEventsInterface { public class iTunesApplication extends Application implements iTunesEventsInterface {
protected static final String TITLE = "iTunes"; protected static final String TITLE = "iTunes";
protected static final int POSTION_CHANGE_RATE = 1; protected static final boolean QUIT = false;
protected static final int VOLUME_CHANGE_RATE = 5; protected static final int VOLUME_CHANGE_RATE = 5;
protected static final int VOLUME_SLEEP = 500;
protected static final String PLAYLIST_LIKE = "Like"; protected static final String PLAYLIST_LIKE = "Like";
protected static final String PLAYLIST_DISLIKE = "Dislike"; protected static final String PLAYLIST_DISLIKE = "Dislike";
protected iTunes iTunes; protected iTunes iTunes;
protected boolean volume;
public iTunesApplication() { public iTunesApplication() {
super(TITLE); super(TITLE);
@@ -45,9 +47,11 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
public void deactivate() throws DeactivateException { public void deactivate() throws DeactivateException {
try { try {
if (QUIT) {
synchronized (iTunes) { synchronized (iTunes) {
iTunes.quit(); iTunes.quit();
} }
}
} catch (Exception e) { } catch (Exception e) {
throw new DeactivateException(); throw new DeactivateException();
} finally { } finally {
@@ -56,7 +60,7 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
} }
protected void begin(Action action) { protected void begin(Action action) {
log.trace("iTunesApplication: " + action); log.trace("iTunesApplication begin: " + action);
if (!active) return; if (!active) return;
switch (action) { switch (action) {
case FORWARD: case FORWARD:
@@ -65,11 +69,17 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
case REWIND: case REWIND:
iTunes.rewind(); iTunes.rewind();
break; break;
case VOLUME_UP:
volume(true);
break;
case VOLUME_DOWN:
volume(false);
break;
} }
} }
protected void end(Action action) { protected void end(Action action) {
log.trace("iTunesApplication: " + action); log.trace("iTunesApplication end: " + action);
if (!active) return; if (!active) return;
switch (action) { switch (action) {
case PLAY: case PLAY:
@@ -82,27 +92,23 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
iTunes.previousTrack(); iTunes.previousTrack();
break; break;
case FORWARD: case FORWARD:
iTunes.play(); iTunes.resume();
break; break;
case REWIND: case REWIND:
iTunes.play(); iTunes.resume();
break; break;
case MUTE: case MUTE:
iTunes.toggleMute(); iTunes.toggleMute();
break; break;
case VOLUME_UP: case VOLUME_UP:
iTunes.setSoundVolume(getVolume() + VOLUME_CHANGE_RATE);
break;
case VOLUME_DOWN: case VOLUME_DOWN:
iTunes.setSoundVolume(getVolume() - VOLUME_CHANGE_RATE); volume = false;
break; break;
case SHUFFLE: case SHUFFLE:
iTunes.toggleShuffle(); iTunes.toggleShuffle();
//iTunes.fastForward();
break; break;
case REPEAT: case REPEAT:
iTunes.cycleSongRepeat(); iTunes.cycleSongRepeat();
//iTunes.resume();
break; break;
case LIKE: case LIKE:
iTunes.playlistAddCurrentTrack(PLAYLIST_LIKE); iTunes.playlistAddCurrentTrack(PLAYLIST_LIKE);
@@ -113,6 +119,15 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
} }
} }
protected void volume(boolean up) {
volume = true;
while (volume) {
int change = (up ? 1 : -1) * VOLUME_CHANGE_RATE;
iTunes.setSoundVolume(getVolume() + change);
sleep(VOLUME_SLEEP);
}
}
protected int getVolume() { protected int getVolume() {
return iTunes.getSoundVolume(); return iTunes.getSoundVolume();
} }

View File

@@ -5,18 +5,18 @@ import mimis.exception.button.UnknownButtonException;
import de.hardcode.jxinput.event.JXInputButtonEvent; import de.hardcode.jxinput.event.JXInputButtonEvent;
public enum Extreme3DButton implements Button { public enum Extreme3DButton implements Button {
ONE ("SelectButton 0"), ONE ("ManageButton 0"),
TWO ("SelectButton 1"), TWO ("ManageButton 1"),
THREE ("SelectButton 2"), THREE ("ManageButton 2"),
FOUR ("SelectButton 3"), FOUR ("ManageButton 3"),
FIVE ("SelectButton 4"), FIVE ("ManageButton 4"),
SIX ("SelectButton 5"), SIX ("ManageButton 5"),
SEVEN ("SelectButton 6"), SEVEN ("ManageButton 6"),
EIGHT ("SelectButton 7"), EIGHT ("ManageButton 7"),
NINE ("SelectButton 8"), NINE ("ManageButton 8"),
TEN ("SelectButton 9"), TEN ("ManageButton 9"),
ELEVEN ("SelectButton 10"), ELEVEN ("ManageButton 10"),
TWELVE ("SelectButton 11"); TWELVE ("ManageButton 11");
protected String code; protected String code;

View File

@@ -3,7 +3,6 @@ package mimis.device.jintellitype;
import mimis.device.EventMapCycle; import mimis.device.EventMapCycle;
import mimis.event.Task; import mimis.event.Task;
import mimis.sequence.EventMap; import mimis.sequence.EventMap;
import mimis.sequence.state.Press;
import mimis.value.Action; import mimis.value.Action;
import mimis.value.Key; import mimis.value.Key;
import mimis.value.Target; import mimis.value.Target;
@@ -26,10 +25,10 @@ public class JIntellitypeEventMapCycle extends EventMapCycle {
/* Player */ /* Player */
player = new EventMap(); player = new EventMap();
player.add( player.add(
new Press(CommandButton.VOLUME_DOWN), CommandButton.VOLUME_DOWN,
new Task(Target.APPLICATIONS, Action.VOLUME_DOWN)); new Task(Target.APPLICATIONS, Action.VOLUME_DOWN));
player.add( player.add(
new Press(CommandButton.VOLUME_UP), CommandButton.VOLUME_UP,
new Task(Target.APPLICATIONS, Action.VOLUME_UP)); new Task(Target.APPLICATIONS, Action.VOLUME_UP));
player.add( player.add(
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'), new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),

View File

@@ -4,8 +4,8 @@ import java.util.HashMap;
import mimis.Button; import mimis.Button;
import mimis.Device; import mimis.Device;
import mimis.device.lirc.button.DenonRC176; import mimis.device.lirc.remote.DenonRC176Button;
import mimis.device.lirc.button.PhiliphsRCLE011Button; import mimis.device.lirc.remote.PhiliphsRCLE011Button;
import mimis.exception.worker.ActivateException; import mimis.exception.worker.ActivateException;
import mimis.exception.worker.DeactivateException; import mimis.exception.worker.DeactivateException;
import mimis.sequence.state.Press; import mimis.sequence.state.Press;
@@ -19,30 +19,37 @@ public class LircDevice extends Device implements LircButtonListener, SignalList
protected Multiplexer multiplexer; protected Multiplexer multiplexer;
protected LircService lircService; protected LircService lircService;
protected LircEventMapCycle eventMapCycle;
public LircDevice() { public LircDevice() {
super(TITLE); super(TITLE);
/* Initialise remotes */
HashMap<String, LircButton[]> buttonMap = new HashMap<String, LircButton[]>(); HashMap<String, LircButton[]> buttonMap = new HashMap<String, LircButton[]>();
buttonMap.put(PhiliphsRCLE011Button.NAME, PhiliphsRCLE011Button.values()); buttonMap.put(PhiliphsRCLE011Button.NAME, PhiliphsRCLE011Button.values());
buttonMap.put(DenonRC176.NAME, DenonRC176.values()); buttonMap.put(DenonRC176Button.NAME, DenonRC176Button.values());
buttonMap.put(DenonRC176Button.NAME, DenonRC176Button.values());
multiplexer = new Multiplexer(this); multiplexer = new Multiplexer(this);
lircService = new LircService(buttonMap); lircService = new LircService(buttonMap);
lircService.add(this); lircService.add(this);
eventMapCycle = new LircEventMapCycle();
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
super.activate();
multiplexer.start(); multiplexer.start();
lircService.activate(); lircService.activate();
super.activate(); add(eventMapCycle.denonRC176);
add(eventMapCycle.philiphsRCLE011);
add(eventMapCycle.samsungBN5901015A);
} }
public void deactivate() throws DeactivateException { public void deactivate() throws DeactivateException {
super.deactivate();
multiplexer.deactivate(); multiplexer.deactivate();
lircService.deactivate(); lircService.deactivate();
super.deactivate();
} }
public void add(LircButton lircButton) { public void add(LircButton lircButton) {

View File

@@ -0,0 +1,33 @@
package mimis.device.lirc;
import mimis.device.EventMapCycle;
import mimis.device.lirc.remote.DenonRC176EventMap;
import mimis.device.lirc.remote.PhiliphsRCLE011EventMap;
import mimis.device.lirc.remote.SamsungBN5901015AEventMap;
import mimis.sequence.EventMap;
public class LircEventMapCycle extends EventMapCycle {
protected static final long serialVersionUID = 1L;
public EventMap denonRC176, philiphsRCLE011, samsungBN5901015A;
public LircEventMapCycle() {
add(denonRC176 = new DenonRC176EventMap());
add(philiphsRCLE011 = new PhiliphsRCLE011EventMap());
add(samsungBN5901015A = new SamsungBN5901015AEventMap());
/*
player = new EventMap();
player.add(PanelButton.PREVIOUS, new Task(Target.APPLICATION, Action.PREVIOUS));
player.add(PanelButton.REWIND, new Task(Target.APPLICATION, Action.REWIND));
player.add(PanelButton.STOP, new Task(Target.APPLICATION, Action.STOP));
player.add(PanelButton.PAUSE, new Task(Target.APPLICATION, Action.PAUSE));
player.add(PanelButton.PLAY, new Task(Target.APPLICATION, Action.PLAY));
player.add(PanelButton.FORWARD, new Task(Target.APPLICATION, Action.FORWARD));
player.add(PanelButton.NEXT, new Task(Target.APPLICATION, Action.NEXT));
player.add(PanelButton.VOLUME_DOWN, new Task(Target.APPLICATION, Action.VOLUME_DOWN));
player.add(PanelButton.MUTE, new Task(Target.APPLICATION, Action.MUTE));
player.add(PanelButton.VOLUME_UP, new Task(Target.APPLICATION, Action.VOLUME_UP));
player.add(PanelButton.REPEAT, new Task(Target.APPLICATION, Action.REPEAT));
player.add(PanelButton.SHUFFLE, new Task(Target.APPLICATION, Action.SHUFFLE));
add(player);*/
}
}

View File

@@ -11,9 +11,10 @@ import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.InputMismatchException; import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.Scanner; import java.util.Scanner;
import mimis.Worker; import mimis.Worker;
import mimis.device.lirc.button.PhiliphsRCLE011Button;
import mimis.exception.button.UnknownButtonException; import mimis.exception.button.UnknownButtonException;
import mimis.exception.worker.ActivateException; import mimis.exception.worker.ActivateException;
import mimis.exception.worker.DeactivateException; import mimis.exception.worker.DeactivateException;
@@ -64,10 +65,10 @@ public class LircService extends Worker {
outputStream = socket.getOutputStream(); outputStream = socket.getOutputStream();
printWriter = new PrintWriter(outputStream); printWriter = new PrintWriter(outputStream);
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
log.info(e); log.error(e);
throw new ActivateException(); throw new ActivateException();
} catch (IOException e) { } catch (IOException e) {
log.info(e); log.error(e);
throw new ActivateException(); throw new ActivateException();
} }
super.activate(); super.activate();
@@ -87,20 +88,13 @@ public class LircService extends Worker {
} }
public void work() { public void work() {
log.debug("wrk");
try { try {
String string; String string = bufferedReader.readLine();
//synchronized (this) {
string = bufferedReader.readLine();
//}
try { try {
System.out.println(string);
LircButton lircButton = parseButton(new Scanner(string)); LircButton lircButton = parseButton(new Scanner(string));
log.trace("LircButton: " + lircButton);
for (LircButtonListener lircbuttonListener : lircButtonListenerList) { for (LircButtonListener lircbuttonListener : lircButtonListenerList) {
lircbuttonListener.add(lircButton); lircbuttonListener.add(lircButton);
} }
log.info(send(PhiliphsRCLE011Button.MUTE));
} catch (UnknownButtonException e) { } catch (UnknownButtonException e) {
log.error(e); log.error(e);
} }
@@ -126,6 +120,8 @@ public class LircService extends Worker {
} }
} catch (InputMismatchException e) { } catch (InputMismatchException e) {
log.error(e); log.error(e);
} catch (NoSuchElementException e) {
log.error(e);
} }
throw new UnknownButtonException(); throw new UnknownButtonException();
} }
@@ -142,7 +138,6 @@ public class LircService extends Worker {
log.debug(command); log.debug(command);
printWriter.append(command); printWriter.append(command);
printWriter.flush(); printWriter.flush();
//synchronized (this) {
try { try {
bufferedReader.readLine(); bufferedReader.readLine();
bufferedReader.readLine(); bufferedReader.readLine();
@@ -153,6 +148,5 @@ public class LircService extends Worker {
log.error(e); log.error(e);
} }
return false; return false;
//}
} }
} }

View File

@@ -1,8 +1,8 @@
package mimis.device.lirc.button; package mimis.device.lirc.remote;
import mimis.device.lirc.LircButton; import mimis.device.lirc.LircButton;
public enum DenonRC176 implements LircButton { public enum DenonRC176Button implements LircButton {
TAPE_AB ("TAPE_AB"), TAPE_AB ("TAPE_AB"),
TAPE_REC ("TAPE_REC"), TAPE_REC ("TAPE_REC"),
TAPE_PAUSE ("TAPE_PAUSE"), TAPE_PAUSE ("TAPE_PAUSE"),
@@ -36,7 +36,7 @@ public enum DenonRC176 implements LircButton {
protected String code; protected String code;
private DenonRC176(String code) { private DenonRC176Button(String code) {
this.code = code; this.code = code;
} }

View File

@@ -0,0 +1,14 @@
package mimis.device.lirc.remote;
import mimis.event.Task;
import mimis.sequence.EventMap;
import mimis.value.Action;
import mimis.value.Target;
public class DenonRC176EventMap extends EventMap {
protected static final long serialVersionUID = 1L;
public DenonRC176EventMap() {
add(DenonRC176Button.AMP_VOLUME_UP, new Task(Target.APPLICATION, Action.VOLUME_UP));
}
}

View File

@@ -1,4 +1,4 @@
package mimis.device.lirc.button; package mimis.device.lirc.remote;
import mimis.device.lirc.LircButton; import mimis.device.lirc.LircButton;
@@ -21,7 +21,7 @@ public enum PhiliphsRCLE011Button implements LircButton {
VOLUME_DOWN ("Volume-"), VOLUME_DOWN ("Volume-"),
MUTE ("Mute"), MUTE ("Mute"),
PROGRAM_UP ("Program+"), PROGRAM_UP ("Program+"),
PROGRUM_DOWN ("Program-"), PROGRAM_DOWN ("Program-"),
ONE ("1"), ONE ("1"),
TWO ("2"), TWO ("2"),
THREE ("3"), THREE ("3"),

View File

@@ -0,0 +1,30 @@
package mimis.device.lirc.remote;
import mimis.event.Task;
import mimis.sequence.EventMap;
import mimis.value.Action;
import mimis.value.Target;
public class PhiliphsRCLE011EventMap extends EventMap {
protected static final long serialVersionUID = 1L;
public PhiliphsRCLE011EventMap() {
/* Mimis */
add(PhiliphsRCLE011Button.UP, new Task(Target.MIMIS, Action.NEXT));
add(PhiliphsRCLE011Button.DOWN, new Task(Target.MIMIS, Action.PREVIOUS));
/* Application */
add(PhiliphsRCLE011Button.POWER, new Task(Target.APPLICATION, Action.ACTIVATE));
add(PhiliphsRCLE011Button.PROGRAM_UP, new Task(Target.APPLICATION, Action.NEXT));
add(PhiliphsRCLE011Button.PROGRAM_DOWN, new Task(Target.APPLICATION, Action.PREVIOUS));
add(PhiliphsRCLE011Button.LEFT, new Task(Target.APPLICATION, Action.REWIND));
add(PhiliphsRCLE011Button.TUNE, new Task(Target.APPLICATION, Action.PAUSE));
add(PhiliphsRCLE011Button.RIGHT, new Task(Target.APPLICATION, Action.FORWARD));
add(PhiliphsRCLE011Button.VOLUME_DOWN, new Task(Target.APPLICATION, Action.VOLUME_DOWN));
add(PhiliphsRCLE011Button.MUTE, new Task(Target.APPLICATION, Action.MUTE));
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.OUT, new Task(Target.APPLICATION, Action.SHUFFLE));
}
}

View File

@@ -1,4 +1,4 @@
package mimis.device.lirc.button; package mimis.device.lirc.remote;
import mimis.device.lirc.LircButton; import mimis.device.lirc.LircButton;

View File

@@ -0,0 +1,14 @@
package mimis.device.lirc.remote;
import mimis.event.Task;
import mimis.sequence.EventMap;
import mimis.value.Action;
import mimis.value.Target;
public class SamsungBN5901015AEventMap extends EventMap {
protected static final long serialVersionUID = 1L;
public SamsungBN5901015AEventMap() {
add(SamsungBN5901015AButton.VOLUME_UP, new Task(Target.APPLICATION, Action.VOLUME_UP));
}
}

View File

@@ -17,10 +17,6 @@ public class Panel extends JFrame implements HoldButtonListener {
protected PanelButtonListener panelButtonListener; protected PanelButtonListener panelButtonListener;
protected ClassLoader classLoader; protected ClassLoader classLoader;
//protected JTextArea feedbackArea;
//protected JScrollPane scrollPane;
protected HoldButton previousButton; protected HoldButton previousButton;
protected HoldButton rewindButton; protected HoldButton rewindButton;
protected HoldButton stopButton; protected HoldButton stopButton;
@@ -72,7 +68,7 @@ public class Panel extends JFrame implements HoldButtonListener {
protected void createControls() { protected void createControls() {
previousButton = getButton("icons/previous.png", "Go to previous track"); previousButton = getButton("icons/previous.png", "Go to previous track");
rewindButton = getButton("icons/rewind.png", "Skip backward"); rewindButton = getButton("icons/rewind.png", "Skip backward");
playPauseToggleButton = getToggleButton("icons/play.png", "icons/pause.png", "Play/pause");//getButton("icons/play.png", "Play/pause"); playPauseToggleButton = getToggleButton("icons/play.png", "icons/pause.png", "Play/pause");
forwardButton = getButton("icons/forward.png", "Skip forward"); forwardButton = getButton("icons/forward.png", "Skip forward");
nextButton = getButton("icons/next.png", "Go to next track"); nextButton = getButton("icons/next.png", "Go to next track");
volumeDownButton = getButton("icons/volumeDown.png", "Decrease volume"); volumeDownButton = getButton("icons/volumeDown.png", "Decrease volume");
@@ -160,15 +156,4 @@ public class Panel extends JFrame implements HoldButtonListener {
panelButtonListener.buttonReleased(PanelButton.SHUFFLE); panelButtonListener.buttonReleased(PanelButton.SHUFFLE);
} }
} }
/* Feedback */
/*public void addFeedback(String format, Object... args) {
feedbackArea.append(String.format(format, args));
JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
scrollBar.setValue(scrollBar.getMaximum());
}
public void clearFeedback() {
feedbackArea.setText("");
}*/
} }

View File

@@ -5,20 +5,18 @@ import java.awt.event.WindowEvent;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import mimis.Device; import mimis.Device;
import mimis.event.Task;
import mimis.exception.worker.ActivateException; import mimis.exception.worker.ActivateException;
import mimis.sequence.state.Press; import mimis.sequence.state.Press;
import mimis.sequence.state.Release; import mimis.sequence.state.Release;
import mimis.value.Action;
import mimis.value.Target;
public class PanelDevice extends Device implements PanelButtonListener { public class PanelDevice extends Device implements PanelButtonListener {
protected static final String TITLE = "Panel"; protected static final String TITLE = "Panel";
protected Panel panel; protected Panel panel;
protected PanelEventMapCycle eventMapCycle;
public PanelDevice() { public PanelDevice() {
super(TITLE); super(TITLE);
eventMapCycle = new PanelEventMapCycle();
} }
public void activate() throws ActivateException { public void activate() throws ActivateException {
@@ -33,20 +31,7 @@ public class PanelDevice extends Device implements PanelButtonListener {
} }
}; };
panel.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); panel.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
//panel.updateTime(12342398); add(eventMapCycle.player);
//panel.updatePosition(43);
add(new Press(PanelButton.PREVIOUS), new Task(Target.APPLICATION, Action.PREVIOUS));
add(new Press(PanelButton.REWIND), new Task(Target.APPLICATION, Action.REWIND));
add(new Press(PanelButton.STOP), new Task(Target.APPLICATION, Action.STOP));
add(new Press(PanelButton.PAUSE), new Task(Target.APPLICATION, Action.PAUSE));
add(new Press(PanelButton.PLAY), new Task(Target.APPLICATION, Action.PLAY));
add(new Press(PanelButton.FORWARD), new Task(Target.APPLICATION, Action.FORWARD));
add(new Press(PanelButton.NEXT), new Task(Target.APPLICATION, Action.NEXT));
add(new Press(PanelButton.VOLUME_DOWN), new Task(Target.APPLICATION, Action.VOLUME_DOWN));
add(new Press(PanelButton.MUTE), new Task(Target.APPLICATION, Action.MUTE));
add(new Press(PanelButton.VOLUME_UP), new Task(Target.APPLICATION, Action.VOLUME_UP));
add(new Press(PanelButton.REPEAT), new Task(Target.APPLICATION, Action.REPEAT));
add(new Press(PanelButton.SHUFFLE), new Task(Target.APPLICATION, Action.SHUFFLE));
} }
public boolean active() { public boolean active() {
@@ -65,7 +50,6 @@ public class PanelDevice extends Device implements PanelButtonListener {
} }
public void buttonPressed(PanelButton panelButton) { public void buttonPressed(PanelButton panelButton) {
//Vang hier toggles af om bijvoorbeeld de play/pause en mute knop en veranderen
add(new Press(panelButton)); add(new Press(panelButton));
} }

View File

@@ -0,0 +1,31 @@
package mimis.device.panel;
import mimis.device.EventMapCycle;
import mimis.event.Task;
import mimis.sequence.EventMap;
import mimis.sequence.state.Press;
import mimis.value.Action;
import mimis.value.Target;
public class PanelEventMapCycle extends EventMapCycle {
protected static final long serialVersionUID = 1L;
public EventMap player;
public PanelEventMapCycle() {
/* Player */
player = new EventMap();
player.add(new Press(PanelButton.PREVIOUS), new Task(Target.APPLICATION, Action.PREVIOUS));
player.add(new Press(PanelButton.REWIND), new Task(Target.APPLICATION, Action.REWIND));
player.add(new Press(PanelButton.STOP), new Task(Target.APPLICATION, Action.STOP));
player.add(new Press(PanelButton.PAUSE), new Task(Target.APPLICATION, Action.PAUSE));
player.add(new Press(PanelButton.PLAY), new Task(Target.APPLICATION, Action.PLAY));
player.add(new Press(PanelButton.FORWARD), new Task(Target.APPLICATION, Action.FORWARD));
player.add(new Press(PanelButton.NEXT), new Task(Target.APPLICATION, Action.NEXT));
player.add(new Press(PanelButton.VOLUME_DOWN), new Task(Target.APPLICATION, Action.VOLUME_DOWN));
player.add(new Press(PanelButton.MUTE), new Task(Target.APPLICATION, Action.MUTE));
player.add(new Press(PanelButton.VOLUME_UP), new Task(Target.APPLICATION, Action.VOLUME_UP));
player.add(new Press(PanelButton.REPEAT), new Task(Target.APPLICATION, Action.REPEAT));
player.add(new Press(PanelButton.SHUFFLE), new Task(Target.APPLICATION, Action.SHUFFLE));
add(player);
}
}

View File

@@ -21,7 +21,7 @@ import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
public class WiimoteDevice extends Device implements GestureListener { public class WiimoteDevice extends Device implements GestureListener {
protected static final String TITLE = "Wiimote"; protected static final String TITLE = "Wiimote";
protected static final int RUMBLE = 150; protected static final int RUMBLE = 50;
protected static final int TIMEOUT = 200; protected static final int TIMEOUT = 200;
protected static WiimoteService wiimoteService; protected static WiimoteService wiimoteService;
@@ -50,9 +50,7 @@ public class WiimoteDevice extends Device implements GestureListener {
public void activate() throws ActivateException { public void activate() throws ActivateException {
super.activate(); super.activate();
connect(); connect();
add(eventMapCycle.mimis);
add(eventMapCycle.player); add(eventMapCycle.player);
add(eventMapCycle.like);
} }
public boolean active() { public boolean active() {
@@ -90,6 +88,17 @@ public class WiimoteDevice extends Device implements GestureListener {
/* Events */ /* Events */
public void begin(Action action) { public void begin(Action action) {
switch (action) { switch (action) {
case SHIFT:
log.debug("Shift");
reset();
add(eventMapCycle.mimis);
add(eventMapCycle.like);
break;
case UNSHIFT:
log.debug("Unshift");
reset();
add(eventMapCycle.player);
break;
case TRAIN: case TRAIN:
log.debug("Gesture train"); log.debug("Gesture train");
gestureDevice.train(); gestureDevice.train();
@@ -141,7 +150,6 @@ public class WiimoteDevice extends Device implements GestureListener {
public void connected() { public void connected() {
try { try {
wiimote = wiimoteService.getDevice(this); wiimote = wiimoteService.getDevice(this);
//wiimote.activateMotionSensing();
try { try {
wiimoteDiscovery.deactivate(); wiimoteDiscovery.deactivate();
} catch (DeactivateException e) { } catch (DeactivateException e) {

View File

@@ -1,96 +1,50 @@
package mimis.device.wiimote; package mimis.device.wiimote;
import mimis.Macro;
import mimis.device.EventMapCycle; import mimis.device.EventMapCycle;
import mimis.event.Task; import mimis.event.Task;
import mimis.exception.macro.StateOrderException;
import mimis.sequence.EventMap; import mimis.sequence.EventMap;
import mimis.sequence.state.Hold;
import mimis.sequence.state.Press;
import mimis.sequence.state.Release;
import mimis.value.Action; import mimis.value.Action;
import mimis.value.Target; import mimis.value.Target;
import mimis.sequence.state.Release;
public class WiimoteEventMapCycle extends EventMapCycle { public class WiimoteEventMapCycle extends EventMapCycle {
protected static final long serialVersionUID = 1L; protected static final long serialVersionUID = 1L;
public EventMap mimis, player, gesture, like; public EventMap mimis, player, gesture, like, shift;
public WiimoteEventMapCycle() { public WiimoteEventMapCycle() {
/* Mimis */ /* Mimis */
mimis = new EventMap(); mimis = new EventMap();
mimis.add( mimis.add(WiimoteButton.HOME, new Task(Target.MIMIS, Action.NEXT));
new Press(WiimoteButton.HOME), mimis.add(new Release(WiimoteButton.B), new Task(Target.SELF, Action.UNSHIFT));
new Task(Target.MIMIS, Action.NEXT));
/* Gesture */ /* Gesture */
gesture = new EventMap(); gesture = new EventMap();
gesture.add( gesture.add(WiimoteButton.A, new Task(Action.TRAIN));
new Press(WiimoteButton.A), gesture.add(WiimoteButton.B, new Task(Action.SAVE));
new Task(Action.TRAIN)); gesture.add(WiimoteButton.DOWN, new Task(Action.LOAD));
gesture.add( gesture.add(WiimoteButton.HOME, new Task(Action.RECOGNIZE));
new Press(WiimoteButton.B),
new Task(Action.SAVE));
gesture.add(
new Press(WiimoteButton.DOWN),
new Task(Action.LOAD));
gesture.add(
new Press(WiimoteButton.HOME),
new Task(Action.RECOGNIZE));
add(gesture); add(gesture);
/* Player */ /* Player */
player = new EventMap(); player = new EventMap();
player.add( player.add(WiimoteButton.A, new Task(Target.APPLICATION, Action.PLAY));
new Press(WiimoteButton.A), player.add(WiimoteButton.B, new Task(Target.SELF, Action.SHIFT));
new Task(Target.APPLICATION, Action.PLAY)); player.add(WiimoteButton.HOME, new Task(Target.APPLICATION, Action.MUTE));
player.add( player.add(WiimoteButton.ONE, new Task(Target.APPLICATION, Action.SHUFFLE));
new Press(WiimoteButton.B), player.add(WiimoteButton.TWO, new Task(Target.APPLICATION, Action.REPEAT));
new Task(Target.APPLICATION, Action.MUTE)); player.add(WiimoteButton.UP, new Task(Target.APPLICATION, Action.NEXT));
player.add( player.add(WiimoteButton.DOWN, new Task(Target.APPLICATION, Action.PREVIOUS));
new Press(WiimoteButton.ONE), player.add(WiimoteButton.RIGHT, new Task(Target.APPLICATION, Action.FORWARD));
new Task(Target.APPLICATION, Action.SHUFFLE)); player.add(WiimoteButton.LEFT, new Task(Target.APPLICATION, Action.REWIND));
player.add( player.add(WiimoteButton.MINUS, new Task(Target.APPLICATION, Action.VOLUME_DOWN));
new Press(WiimoteButton.TWO), player.add(WiimoteButton.PLUS, new Task(Target.APPLICATION, Action.VOLUME_UP));
new Task(Target.APPLICATION, Action.REPEAT));
player.add(
new Press(WiimoteButton.UP),
new Task(Target.APPLICATION, Action.NEXT));
player.add(
new Press(WiimoteButton.DOWN),
new Task(Target.APPLICATION, Action.PREVIOUS));
player.add(
new Press(WiimoteButton.RIGHT),
new Task(Target.APPLICATION, Action.FORWARD));
player.add(
new Press(WiimoteButton.LEFT),
new Task(Target.APPLICATION, Action.REWIND));
player.add(
new Press(WiimoteButton.MINUS),
new Task(Target.APPLICATION, Action.VOLUME_DOWN));
player.add(
new Press(WiimoteButton.PLUS),
new Task(Target.APPLICATION, Action.VOLUME_UP));
add(player); add(player);
/* Like */ /* Like */
try {
like = new EventMap(); like = new EventMap();
like.add( like.add(WiimoteButton.PLUS, new Task(Target.APPLICATION, Action.LIKE));
new Macro( like.add(WiimoteButton.MINUS, new Task(Target.APPLICATION, Action.DISLIKE));
new Hold(WiimoteButton.TWO),
new Press(WiimoteButton.PLUS),
new Release(WiimoteButton.TWO)),
new Task(Target.APPLICATION, Action.LIKE));
like.add(
new Macro(
new Hold(WiimoteButton.TWO),
new Press(WiimoteButton.MINUS),
new Release(WiimoteButton.TWO)),
new Task(Target.APPLICATION, Action.DISLIKE));
add(like); add(like);
} catch (StateOrderException e) {
log.error(e);
}
} }
} }

View File

@@ -17,8 +17,7 @@ public class LocalRouter extends EventRouter {
} }
if (event instanceof Task) { if (event instanceof Task) {
Task task = (Task) event; Task task = (Task) event;
add(new TextFeedback("Action: " + task.getAction())); add(new TextFeedback(String.format("Action (%s): %s", task.getSignal(), task.getAction())));
} }
break; break;
default: default:

View File

@@ -13,32 +13,32 @@ import mimis.exception.worker.DeactivateException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
public class SelectButton<T extends Worker & Titled> extends JToggleButton implements MouseListener { public class ManageButton<T extends Worker & Titled> extends JToggleButton implements MouseListener {
protected Log log = LogFactory.getLog(getClass()); protected Log log = LogFactory.getLog(getClass());
protected static final long serialVersionUID = 1L; protected static final long serialVersionUID = 1L;
protected T activatable; protected T manageable;
protected Action action; protected Action action;
public SelectButton(T activatable) { public ManageButton(T manageable) {
this.activatable = activatable; this.manageable = manageable;
setText(activatable.title()); setText(manageable.title());
setFocusable(false); setFocusable(false);
addMouseListener(this); addMouseListener(this);
} }
public void mouseClicked(MouseEvent event) { public void mouseClicked(MouseEvent event) {
if (activatable.active()) { if (manageable.active()) {
try { try {
log.trace("Uit"); log.trace("Uit");
activatable.deactivate(); manageable.deactivate();
} catch (DeactivateException e) { } catch (DeactivateException e) {
log.error(e); log.error(e);
} }
} else { } else {
try { try {
log.trace("Aan"); log.trace("Aan");
activatable.activate(); manageable.activate();
} catch (ActivateException e) { } catch (ActivateException e) {
log.error(e); log.error(e);
} }

View File

@@ -27,7 +27,7 @@ public class EventMap extends HashMap<Sequence, Event> {
} }
} }
protected void add(State state, Task task) { public void add(State state, Task task) {
add(new Sequence(state), task); add(new Sequence(state), task);
} }

View File

@@ -77,9 +77,10 @@ public class SequenceParser {
} }
} }
protected void add(Event event, Signal signal) { protected synchronized void add(Event event, Signal signal) {
if (event instanceof Task) { if (event instanceof Task) {
event = ((Task) event).setSignal(signal); event = ((Task) event).setSignal(signal);
} }
if (event.getTarget().equals(Target.SELF)) { if (event.getTarget().equals(Target.SELF)) {
self.add(event); self.add(event);

View File

@@ -16,5 +16,5 @@ public enum Action {
VOLUME_DOWN, VOLUME_DOWN,
VOLUME_UP, VOLUME_UP,
FULLSCREEN, FULLSCREEN,
TRAIN, STOP, SAVE, RECOGNIZE, LOAD, SHUFFLE, FADEOUT, QUIT, VISUALISER, LIKE, DISLIKE, ACTIVATE; TRAIN, STOP, SAVE, RECOGNIZE, LOAD, SHUFFLE, FADEOUT, QUIT, VISUALISER, LIKE, DISLIKE, ACTIVATE, SHIFT, UNSHIFT;
} }

View File

@@ -160,7 +160,7 @@ public class WiimoteWiigee extends Wiigee {
/** /**
* Sets the Trainbutton for all wiimotes; * Sets the Trainbutton for all wiimotes;
* *
* @param b SelectButton encoding, see static Wiimote values * @param b ManageButton encoding, see static Wiimote values
*/ */
public void setTrainButton(int b) { public void setTrainButton(int b) {
for (int i = 0; i < this.devices.size(); i++) { for (int i = 0; i < this.devices.size(); i++) {
@@ -171,7 +171,7 @@ public class WiimoteWiigee extends Wiigee {
/** /**
* Sets the Recognitionbutton for all wiimotes; * Sets the Recognitionbutton for all wiimotes;
* *
* @param b SelectButton encoding, see static Wiimote values * @param b ManageButton encoding, see static Wiimote values
*/ */
public void setRecognitionButton(int b) { public void setRecognitionButton(int b) {
for (int i = 0; i < this.devices.size(); i++) { for (int i = 0; i < this.devices.size(); i++) {
@@ -182,7 +182,7 @@ public class WiimoteWiigee extends Wiigee {
/** /**
* Sets the CloseGesturebutton for all wiimotes; * Sets the CloseGesturebutton for all wiimotes;
* *
* @param b SelectButton encoding, see static Wiimote values * @param b ManageButton encoding, see static Wiimote values
*/ */
public void setCloseGestureButton(int b) { public void setCloseGestureButton(int b) {
for (int i = 0; i < this.devices.size(); i++) { for (int i = 0; i < this.devices.size(); i++) {

View File

@@ -101,7 +101,7 @@ public class Device {
} }
/** /**
* Adds a ButtonListener to the Device. Everytime a SelectButton has been * Adds a ButtonListener to the Device. Everytime a ManageButton has been
* pressed or released, the Listener would be notified about this via * pressed or released, the Listener would be notified about this via
* the corresponding Events. * the corresponding Events.
* *

View File

@@ -81,7 +81,7 @@ public class WiimoteStreamer extends Thread {
if((b[1] & 0xFF) == 0x31) { if((b[1] & 0xFF) == 0x31) {
this.handleButtonData(new byte[] { b[2], b[3] }); this.handleButtonData(new byte[] { b[2], b[3] });
this.handleAccelerationData(new byte[] { b[4], b[5], b[6] }); this.handleAccelerationData(new byte[] { b[4], b[5], b[6] });
//Log.write("0x31: SelectButton + Acc"); //Log.write("0x31: ManageButton + Acc");
} }
else if ((b[1] & 0xFF) == 0x33) { else if ((b[1] & 0xFF) == 0x33) {
this.handleButtonData(new byte[] { b[2], b[3] }); this.handleButtonData(new byte[] { b[2], b[3] });
@@ -90,7 +90,7 @@ public class WiimoteStreamer extends Thread {
b[10], b[11], b[12], b[10], b[11], b[12],
b[13], b[14], b[15], b[13], b[14], b[15],
b[16], b[17], b[18]}); b[16], b[17], b[18]});
//Log.write("0x33: SelectButton + Acc + Irda"); //Log.write("0x33: ManageButton + Acc + Irda");
} }
else if ((b[1] & 0xFF) == 0x37) { else if ((b[1] & 0xFF) == 0x37) {
this.handleButtonData(new byte[] { b[2], b[3] }); this.handleButtonData(new byte[] { b[2], b[3] });
@@ -100,7 +100,7 @@ public class WiimoteStreamer extends Thread {
b[13], b[14], b[15], b[16]}); b[13], b[14], b[15], b[16]});
this.handleWiiMotionPlusData( this.handleWiiMotionPlusData(
new byte[]{b[17], b[18], b[19], b[20], b[21], b[22]}); new byte[]{b[17], b[18], b[19], b[20], b[21], b[22]});
//Log.write("0x37: SelectButton + Acc + Ext"); //Log.write("0x37: ManageButton + Acc + Ext");
} }
else if ((b[1] & 0xFF) == 0x21) { else if ((b[1] & 0xFF) == 0x21) {
this.handleButtonData(new byte[] { b[2], b[3] }); this.handleButtonData(new byte[] { b[2], b[3] });

View File

@@ -55,7 +55,7 @@ public class ButtonPressedEvent extends ActionStartEvent {
/** /**
* Create a WiimoteButtonPressedEvent with the Wiimote source whose * Create a WiimoteButtonPressedEvent with the Wiimote source whose
* SelectButton has been pressed and the integer representation of the button. * ManageButton has been pressed and the integer representation of the button.
* *
* @param source * @param source
* @param button * @param button

View File

@@ -56,7 +56,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
} }
/* SelectButton LEFT */ /* ManageButton LEFT */
public boolean isButtonLeftJustPressed() { public boolean isButtonLeftJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_LEFT); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_LEFT);
@@ -74,7 +74,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_LEFT); return isButtonPressed(CLASSIC_CTRL_BUTTON_LEFT);
} }
/* SelectButton RIGHT */ /* ManageButton RIGHT */
public boolean isButtonRightJustPressed() { public boolean isButtonRightJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_RIGHT); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_RIGHT);
@@ -92,7 +92,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_RIGHT); return isButtonPressed(CLASSIC_CTRL_BUTTON_RIGHT);
} }
/* SelectButton UP */ /* ManageButton UP */
public boolean isButtonUpJustPressed() { public boolean isButtonUpJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_UP); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_UP);
@@ -110,7 +110,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_UP); return isButtonPressed(CLASSIC_CTRL_BUTTON_UP);
} }
/* SelectButton DOWN */ /* ManageButton DOWN */
public boolean isButtonDownJustPressed() { public boolean isButtonDownJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_DOWN); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_DOWN);
@@ -128,7 +128,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_DOWN); return isButtonPressed(CLASSIC_CTRL_BUTTON_DOWN);
} }
/* SelectButton A */ /* ManageButton A */
public boolean isButtonAJustPressed() { public boolean isButtonAJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_A); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_A);
@@ -146,7 +146,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_A); return isButtonPressed(CLASSIC_CTRL_BUTTON_A);
} }
/* SelectButton B */ /* ManageButton B */
public boolean isButtonBJustPressed() { public boolean isButtonBJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_B); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_B);
@@ -164,7 +164,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_B); return isButtonPressed(CLASSIC_CTRL_BUTTON_B);
} }
/* SelectButton X */ /* ManageButton X */
public boolean isButtonXJustPressed() { public boolean isButtonXJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_X); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_X);
@@ -182,7 +182,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_X); return isButtonPressed(CLASSIC_CTRL_BUTTON_X);
} }
/* SelectButton Y */ /* ManageButton Y */
public boolean isButtonYJustPressed() { public boolean isButtonYJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_Y); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_Y);
@@ -200,7 +200,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_Y); return isButtonPressed(CLASSIC_CTRL_BUTTON_Y);
} }
/* SelectButton FullLeft */ /* ManageButton FullLeft */
public boolean isButtonFullLeftJustPressed() { public boolean isButtonFullLeftJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_L); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_L);
@@ -218,7 +218,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_L); return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_L);
} }
/* SelectButton FullRight */ /* ManageButton FullRight */
public boolean isButtonFullRightJustPressed() { public boolean isButtonFullRightJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_R); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_FULL_R);
@@ -236,7 +236,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_R); return isButtonPressed(CLASSIC_CTRL_BUTTON_FULL_R);
} }
/* SelectButton Home */ /* ManageButton Home */
public boolean isButtonHomeJustPressed() { public boolean isButtonHomeJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_HOME); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_HOME);
@@ -254,7 +254,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_HOME); return isButtonPressed(CLASSIC_CTRL_BUTTON_HOME);
} }
/* SelectButton Minus */ /* ManageButton Minus */
public boolean isButtonMinusJustPressed() { public boolean isButtonMinusJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_MINUS); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_MINUS);
@@ -272,7 +272,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_MINUS); return isButtonPressed(CLASSIC_CTRL_BUTTON_MINUS);
} }
/* SelectButton Plus */ /* ManageButton Plus */
public boolean isButtonPlusJustPressed() { public boolean isButtonPlusJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_PLUS); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_PLUS);
@@ -290,7 +290,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_PLUS); return isButtonPressed(CLASSIC_CTRL_BUTTON_PLUS);
} }
/* SelectButton ZL */ /* ManageButton ZL */
public boolean isButtonZLJustPressed() { public boolean isButtonZLJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZL); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZL);
@@ -308,7 +308,7 @@ public class ClassicControllerButtonsEvent extends ButtonsEvent{
return isButtonPressed(CLASSIC_CTRL_BUTTON_ZL); return isButtonPressed(CLASSIC_CTRL_BUTTON_ZL);
} }
/* SelectButton ZR */ /* ManageButton ZR */
public boolean isButtonZRJustPressed() { public boolean isButtonZRJustPressed() {
return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZR); return isButtonJustPressed(CLASSIC_CTRL_BUTTON_ZR);

View File

@@ -50,7 +50,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
} }
/* SelectButton Strum Up */ /* ManageButton Strum Up */
public boolean isButtonStrumUpJustPressed() { public boolean isButtonStrumUpJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_UP); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_UP);
@@ -68,7 +68,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_UP); return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_UP);
} }
/* SelectButton Strum Down */ /* ManageButton Strum Down */
public boolean isButtonStrumDownJustPressed() { public boolean isButtonStrumDownJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN);
@@ -86,7 +86,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN); return isButtonPressed(GUITAR_HERO_3_BUTTON_STRUM_DOWN);
} }
/* SelectButton blue */ /* ManageButton blue */
public boolean isButtonBlueJustPressed() { public boolean isButtonBlueJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_BLUE); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_BLUE);
@@ -104,7 +104,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_BLUE); return isButtonPressed(GUITAR_HERO_3_BUTTON_BLUE);
} }
/* SelectButton Green */ /* ManageButton Green */
public boolean isButtonGreenJustPressed() { public boolean isButtonGreenJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_GREEN); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_GREEN);
@@ -122,7 +122,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_GREEN); return isButtonPressed(GUITAR_HERO_3_BUTTON_GREEN);
} }
/* SelectButton Minus */ /* ManageButton Minus */
public boolean isButtonMinusJustPressed() { public boolean isButtonMinusJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_MINUS); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_MINUS);
@@ -140,7 +140,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_MINUS); return isButtonPressed(GUITAR_HERO_3_BUTTON_MINUS);
} }
/* SelectButton Orange */ /* ManageButton Orange */
public boolean isButtonOrangeJustPressed() { public boolean isButtonOrangeJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_ORANGE); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_ORANGE);
@@ -158,7 +158,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_ORANGE); return isButtonPressed(GUITAR_HERO_3_BUTTON_ORANGE);
} }
/* SelectButton Plus */ /* ManageButton Plus */
public boolean isButtonPlusJustPressed() { public boolean isButtonPlusJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_PLUS); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_PLUS);
@@ -176,7 +176,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_PLUS); return isButtonPressed(GUITAR_HERO_3_BUTTON_PLUS);
} }
/* SelectButton Red */ /* ManageButton Red */
public boolean isButtonRedJustPressed() { public boolean isButtonRedJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_RED); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_RED);
@@ -194,7 +194,7 @@ public class GuitarHeroButtonsEvent extends ButtonsEvent {
return isButtonPressed(GUITAR_HERO_3_BUTTON_RED); return isButtonPressed(GUITAR_HERO_3_BUTTON_RED);
} }
/* SelectButton Yellow */ /* ManageButton Yellow */
public boolean isButtonYellowJustPressed() { public boolean isButtonYellowJustPressed() {
return isButtonJustPressed(GUITAR_HERO_3_BUTTON_YELLOW); return isButtonJustPressed(GUITAR_HERO_3_BUTTON_YELLOW);

View File

@@ -44,7 +44,7 @@ public class NunchukButtonsEvent extends ButtonsEvent {
super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
} }
/* SelectButton Z */ /* ManageButton Z */
public boolean isButtonZJustPressed() { public boolean isButtonZJustPressed() {
return isButtonJustPressed(NUNCHUK_BUTTON_Z); return isButtonJustPressed(NUNCHUK_BUTTON_Z);
@@ -62,7 +62,7 @@ public class NunchukButtonsEvent extends ButtonsEvent {
return isButtonPressed(NUNCHUK_BUTTON_Z); return isButtonPressed(NUNCHUK_BUTTON_Z);
} }
/* SelectButton Z */ /* ManageButton Z */
public boolean isButtonCJustPressed() { public boolean isButtonCJustPressed() {
return isButtonJustPressed(NUNCHUK_BUTTON_C); return isButtonJustPressed(NUNCHUK_BUTTON_C);

View File

@@ -60,7 +60,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld); super(id, buttonsJustPressed, buttonsJustReleased, buttonsHeld);
} }
/* SelectButton ONE */ /* ManageButton ONE */
public boolean isButtonOneJustPressed() { public boolean isButtonOneJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_ONE); return isButtonJustPressed(WIIMOTE_BUTTON_ONE);
@@ -78,7 +78,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_ONE); return isButtonPressed(WIIMOTE_BUTTON_ONE);
} }
/* SelectButton TWO */ /* ManageButton TWO */
public boolean isButtonTwoJustPressed() { public boolean isButtonTwoJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_TWO); return isButtonJustPressed(WIIMOTE_BUTTON_TWO);
@@ -96,7 +96,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_TWO); return isButtonPressed(WIIMOTE_BUTTON_TWO);
} }
/* SelectButton A */ /* ManageButton A */
public boolean isButtonAJustPressed() { public boolean isButtonAJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_A); return isButtonJustPressed(WIIMOTE_BUTTON_A);
@@ -114,7 +114,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_A); return isButtonPressed(WIIMOTE_BUTTON_A);
} }
/* SelectButton B */ /* ManageButton B */
public boolean isButtonBJustPressed() { public boolean isButtonBJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_B); return isButtonJustPressed(WIIMOTE_BUTTON_B);
@@ -132,7 +132,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_B); return isButtonPressed(WIIMOTE_BUTTON_B);
} }
/* SelectButton LEFT */ /* ManageButton LEFT */
public boolean isButtonLeftJustPressed() { public boolean isButtonLeftJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_LEFT); return isButtonJustPressed(WIIMOTE_BUTTON_LEFT);
@@ -150,7 +150,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_LEFT); return isButtonPressed(WIIMOTE_BUTTON_LEFT);
} }
/* SelectButton RIGHT */ /* ManageButton RIGHT */
public boolean isButtonRightJustPressed() { public boolean isButtonRightJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_RIGHT); return isButtonJustPressed(WIIMOTE_BUTTON_RIGHT);
@@ -168,7 +168,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_RIGHT); return isButtonPressed(WIIMOTE_BUTTON_RIGHT);
} }
/* SelectButton UP */ /* ManageButton UP */
public boolean isButtonUpJustPressed() { public boolean isButtonUpJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_UP); return isButtonJustPressed(WIIMOTE_BUTTON_UP);
@@ -186,7 +186,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_UP); return isButtonPressed(WIIMOTE_BUTTON_UP);
} }
/* SelectButton DOWN */ /* ManageButton DOWN */
public boolean isButtonDownJustPressed() { public boolean isButtonDownJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_DOWN); return isButtonJustPressed(WIIMOTE_BUTTON_DOWN);
@@ -204,7 +204,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_DOWN); return isButtonPressed(WIIMOTE_BUTTON_DOWN);
} }
/* SelectButton - */ /* ManageButton - */
public boolean isButtonMinusJustPressed() { public boolean isButtonMinusJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_MINUS); return isButtonJustPressed(WIIMOTE_BUTTON_MINUS);
@@ -222,7 +222,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_MINUS); return isButtonPressed(WIIMOTE_BUTTON_MINUS);
} }
/* SelectButton + */ /* ManageButton + */
public boolean isButtonPlusJustPressed() { public boolean isButtonPlusJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_PLUS); return isButtonJustPressed(WIIMOTE_BUTTON_PLUS);
@@ -240,7 +240,7 @@ public class WiimoteButtonsEvent extends ButtonsEvent {
return isButtonPressed(WIIMOTE_BUTTON_PLUS); return isButtonPressed(WIIMOTE_BUTTON_PLUS);
} }
/* SelectButton HOME */ /* ManageButton HOME */
public boolean isButtonHomeJustPressed() { public boolean isButtonHomeJustPressed() {
return isButtonJustPressed(WIIMOTE_BUTTON_HOME); return isButtonJustPressed(WIIMOTE_BUTTON_HOME);