]> Pileus Git - ~andy/iBeaconNav/blobdiff - src/edu/ucla/iBeaconNav/Main.java
Switch to a single service design
[~andy/iBeaconNav] / src / edu / ucla / iBeaconNav / Main.java
index d6cc092df02781d8dd77d2b6aeccde9f80fed1a9..9082279c9640887711cf34454391eb5ce17b396c 100644 (file)
@@ -40,7 +40,6 @@ public class Main extends Activity
        private Handler      handler;
        private Messenger    messenger;
        private Task         task;
-       private Sensors      sensors;
        private Toast        toast;
 
        /* Widgets */
@@ -69,12 +68,6 @@ public class Main extends Activity
                this.task    = task;
        }
        
-       private void onRegister(Sensors sensors)
-       {
-               Util.debug("Main: onRegister_sensors");
-               this.sensors = sensors;
-       }
-
        private void onPosition()
        {
                Util.debug("Main: onPosition");
@@ -174,9 +167,6 @@ public class Main extends Activity
                startService(new Intent(this, Task.class)
                                .putExtra("Command",   CMD.Command.REGISTER)
                                .putExtra("Messenger", this.messenger));
-               startService(new Intent(this, Sensors.class)
-                               .putExtra("Command",   CMD.Command.REGISTER)
-                               .putExtra("Messenger", this.messenger));
        }
 
        private void connect()
@@ -184,8 +174,6 @@ public class Main extends Activity
                Util.debug("Main: connect");
                startService(new Intent(this, Task.class)
                                .putExtra("Command", CMD.Command.CONNECT));
-               startService(new Intent(this, Sensors.class)
-                               .putExtra("Command", CMD.Command.CONNECT));
        }
 
        private void disconnect()
@@ -193,8 +181,6 @@ public class Main extends Activity
                Util.debug("Main: disconnect");
                startService(new Intent(this, Task.class)
                                .putExtra("Command", CMD.Command.DISCONNECT));
-               startService(new Intent(this, Sensors.class)
-                               .putExtra("Command", CMD.Command.DISCONNECT));
        }
 
        private void quit()
@@ -240,7 +226,7 @@ public class Main extends Activity
                                @Override
                                public void onClick(View v) {
                                        // TODO Auto-generated method stub
-                                       startService(new Intent(Main.this, Sensors.class)
+                                       startService(new Intent(Main.this, Task.class)
                                        .putExtra("Command",   CMD.Command.RSTHEAD));
                                }
                        });
@@ -249,7 +235,7 @@ public class Main extends Activity
                                @Override
                                public void onClick(View v) {
                                        // TODO Auto-generated method stub
-                                       startService(new Intent(Main.this, Sensors.class)
+                                       startService(new Intent(Main.this, Task.class)
                                        .putExtra("Command",   CMD.Command.RSTDST));
                                }
                        });
@@ -382,12 +368,9 @@ public class Main extends Activity
                {
                        CMD.Response resp = CMD.Response.values()[msg.what];
                        switch (resp) {
-                               case REGISTER_TASK:
+                               case REGISTER:
                                        Main.this.onRegister((Task)msg.obj);
                                        break;
-                               case REGISTER_SENSORS:
-                                       Main.this.onRegister((Sensors)msg.obj);
-                                       break;
                                case NOTIFY:
                                        Main.this.onNotify((String)msg.obj);
                                        break;