diff options
author | lado <herrlado@gmail.com> | 2011-11-11 14:51:53 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-11-11 14:51:53 +0100 |
commit | 0de65c0d45a3b559216032959b2f8a0f85651caa (patch) | |
tree | 2d540f08032bb2d4ed5c2330c0fa43d61c377771 /vdrmanager | |
parent | 625648e7e4a8552498df6257955a95e50d67aee3 (diff) | |
download | vdr-manager-0de65c0d45a3b559216032959b2f8a0f85651caa.tar.gz vdr-manager-0de65c0d45a3b559216032959b2f8a0f85651caa.tar.bz2 |
add support for Toggle operation + modify has now 2 params
Diffstat (limited to 'vdrmanager')
3 files changed, 33 insertions, 15 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ModifyTimerTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ModifyTimerTask.java index 57fba6e..14e7b1a 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ModifyTimerTask.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ModifyTimerTask.java @@ -8,8 +8,8 @@ import de.bjusystems.vdrmanager.utils.svdrp.SetTimerClient.TimerOperation; public abstract class ModifyTimerTask extends AsyncProgressTask<Timer> { - public ModifyTimerTask(final Activity activity, final Timer timer) { - super(activity, new SetTimerClient(timer, TimerOperation.MODIFY) { + public ModifyTimerTask(final Activity activity, final Timer newTimer, final Timer oldTimer) { + super(activity, new SetTimerClient(newTimer, oldTimer, TimerOperation.MODIFY) { @Override public int getProgressTextId() { return R.string.progress_timer_modify; diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ToggleTimerTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ToggleTimerTask.java index a3b5d6a..0f96926 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ToggleTimerTask.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ToggleTimerTask.java @@ -9,7 +9,7 @@ import de.bjusystems.vdrmanager.utils.svdrp.SetTimerClient.TimerOperation; public abstract class ToggleTimerTask extends AsyncProgressTask<Timer> { public ToggleTimerTask(final Activity activity, final Timer timer) { - super(activity, new SetTimerClient(timer, TimerOperation.MODIFY) { + super(activity, new SetTimerClient(timer, TimerOperation.TOGGLE) { boolean enabled = timer.isEnabled(); @Override diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java index c1e0f73..765e780 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java @@ -13,7 +13,9 @@ public class SetTimerClient extends SvdrpClient<Timer> { public enum TimerOperation { CREATE("C"),// DELETE("D"),// - MODIFY("M");// + MODIFY("M"),// + TOGGLE("T"),// + ; private String command; private TimerOperation(String command){ this.command = command; @@ -25,22 +27,33 @@ public class SetTimerClient extends SvdrpClient<Timer> { } /** channel names for timer */ - Timer timer; + Timer newTimer; + + Timer oldTimer; + /** timer should be deleted */ private TimerOperation timerOperation; /** - * Constructor - * @param host host - * @param port port - * @param ssl use ssl + * @param newTimer Das was modifiziert angelegt wird + */ + public SetTimerClient(final Timer newTimer, TimerOperation op) { + this(newTimer, null, op); + } + + /** + * @param newTimer + * @param oldTimer this is original Timer, if any (modify) + * @param op */ - public SetTimerClient(final Timer timer, TimerOperation op) { + public SetTimerClient(final Timer newTimer, final Timer oldTimer, TimerOperation op) { super(); - this.timer = timer; + this.newTimer = newTimer; + this.oldTimer = oldTimer; this.timerOperation = op; } + /** * Starts the request */ @@ -51,11 +64,16 @@ public class SetTimerClient extends SvdrpClient<Timer> { command.append("timer "); command.append(timerOperation.getCommand()); - - command.append(timer.getNumber()); + //command.append(oldTimer.getNumber()); command.append(" "); - command.append(timer.toCommandLine(timerOperation)); - + command.append(newTimer.toCommandLine()); + if(timerOperation == TimerOperation.MODIFY){ + command.append("#|#|#").append(oldTimer.toCommandLine()); + } + //timer D 1:1:2011-11-11:1513:1710:50:99:Mirrors 2 + //timer C 1:1:2011-11-11:2223:2250:50:99:Zapping + //timer T 0:1:2011-11-11:2013:2230:50:99:So spielt das Leben + //timer M runCommand(command.toString()); } |