summaryrefslogtreecommitdiff
path: root/src/net/tuschhcm/routercontrol/SwitcherApp.java
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2012-10-15 23:38:17 -0700
committerJesse Morgan <jesse@jesterpm.net>2012-10-15 23:38:17 -0700
commitca0b4614ae545e30b3f65b5414e7e7f535915c86 (patch)
tree3588b583a4689b97ed864a19af040f5a4fc1ae42 /src/net/tuschhcm/routercontrol/SwitcherApp.java
Initial commit
Diffstat (limited to 'src/net/tuschhcm/routercontrol/SwitcherApp.java')
-rw-r--r--src/net/tuschhcm/routercontrol/SwitcherApp.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/net/tuschhcm/routercontrol/SwitcherApp.java b/src/net/tuschhcm/routercontrol/SwitcherApp.java
new file mode 100644
index 0000000..648d0b5
--- /dev/null
+++ b/src/net/tuschhcm/routercontrol/SwitcherApp.java
@@ -0,0 +1,75 @@
+package net.tuschhcm.routercontrol;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import net.tuschhcm.routercontrol.router.Router;
+import net.tuschhcm.routercontrol.router.ShinyBow5544Router;
+import net.tuschhcm.routercontrol.ui.ConsoleUI;
+import net.tuschhcm.routercontrol.ui.UserInterface;
+import net.tuschhcm.routercontrol.ui.UserInterface.Action;
+
+public class SwitcherApp {
+ /**
+ * The router I control.
+ */
+ private final Router mRouter;
+
+ /**
+ * My user interface.
+ */
+ private final UserInterface mUI;
+
+ /**
+ * My list of presets.
+ */
+ private final Map<Integer, Preset> mPresets;
+
+ /**
+ * Create a switcher app.
+ * @param portName the port name for the router.
+ */
+ public SwitcherApp(final String portName) {
+ mUI = new ConsoleUI();
+ mRouter = new ShinyBow5544Router(portName);
+ mPresets = new HashMap<Integer, Preset>();
+
+ // TODO: Load the presets
+
+ // TODO: Setup UI hooks
+ mUI.setPresetSelectionAction(new Action() {
+ public void onAction() {
+ handlePresetSelected();
+ }
+ });
+
+ // TODO: Send the presets to the UI
+ }
+
+ /**
+ * Start the application.
+ */
+ public void run() {
+ mUI.run();
+ }
+
+ /**
+ * Handles a preset selection.
+ */
+ private void handlePresetSelected() {
+ int selectedPreset = mUI.getSelectedPreset();
+ // TODO: What to do when the preset is selected
+ }
+
+ /**
+ * Entry-point for the application.
+ * @param args Command line arguments
+ */
+ public static void main(String[] args) {
+ // TODO: Parse command line arguments
+ String comPort = "COM1";
+
+ SwitcherApp app = new SwitcherApp(comPort);
+ app.run();
+ }
+}