summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com/orbekk/same/SameService.java
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-25 22:32:09 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-25 22:32:09 +0100
commitdfbb6b1a8b7d33a2e2097187ddc07d379163bce7 (patch)
tree9aadd85716174f378a4920de5c27b5fa8f787dd5 /same-android/src/main/java/com/orbekk/same/SameService.java
parent28ccfd5c38df380fc87461238c9b717ad7fd7dce (diff)
Add StateReceivers in SameService.
Diffstat (limited to 'same-android/src/main/java/com/orbekk/same/SameService.java')
-rw-r--r--same-android/src/main/java/com/orbekk/same/SameService.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/same-android/src/main/java/com/orbekk/same/SameService.java b/same-android/src/main/java/com/orbekk/same/SameService.java
index a58b0ec..78bc62a 100644
--- a/same-android/src/main/java/com/orbekk/same/SameService.java
+++ b/same-android/src/main/java/com/orbekk/same/SameService.java
@@ -24,6 +24,8 @@ public class SameService extends Service {
public final static int SEARCH_NETWORKS = 2;
public final static int CREATE_NETWORK = 3;
public final static int JOIN_NETWORK = 4;
+ public final static int UPDATED_STATE_MESSAGE = 5;
+ public final static int ADD_STATE_RECEIVER = 6;
public final static String AVAILABLE_NETWORKS_UPDATE =
"com.orbekk.same.SameService.action.AVAILABLE_NETWORKS_UPDATE";
@@ -38,6 +40,7 @@ public class SameService extends Service {
private Logger logger = LoggerFactory.getLogger(getClass());
private SameController sameController = null;
private Configuration configuration = null;
+ private ArrayList<Messenger> stateReceivers = new ArrayList<Messenger>();
private ArrayList<String> networkNames = new ArrayList<String>();
private ArrayList<String> networkUrls = new ArrayList<String>();
@@ -88,6 +91,14 @@ public class SameService extends Service {
logger.info("JOIN_NETWORK");
String masterUrl = (String)message.obj;
sameController.getClient().joinNetwork(masterUrl);
+ case ADD_STATE_RECEIVER:
+ logger.info("ADD_STATE_RECEIVER: {}", message);
+ Messenger messenger = message.replyTo;
+ if (messenger != null) {
+ stateReceivers.add(messenger);
+ } else {
+ logger.error("ADD_STATE_RECEIVER: Missing Messenger.");
+ }
default:
super.handleMessage(message);
}