diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java | 4 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index 432946042b96..a278e9d9c6e6 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -36,13 +36,15 @@ public class CommunicationService extends Service { public static final int MSG_SLIDE_PREVIEW = 3; public static final int MSG_SLIDE_NOTES = 4; + public static final String MSG_SERVERLIST_CHANGED = "SERVERLIST_CHANGED"; + private Transmitter mTransmitter; private Client mClient; private Receiver mReceiver = new Receiver(); - private ServerFinder mFinder = new ServerFinder(); + private ServerFinder mFinder = new ServerFinder(this); public void setActivityMessenger(Messenger aActivityMessenger) { mReceiver.setActivityMessenger(aActivityMessenger); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java index 768eba599adb..b8ba315c4f76 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java @@ -10,8 +10,14 @@ import java.util.Vector; import org.libreoffice.impressremote.communication.CommunicationService.Server; +import android.content.Context; +import android.content.Intent; +import android.support.v4.content.LocalBroadcastManager; + public class ServerFinder { + private Context mContext; + private static final int PORT = 1598; private static final String CHARSET = "UTF-8"; @@ -23,8 +29,8 @@ public class ServerFinder { private Vector<Server> mServerList = new Vector<Server>(); - public ServerFinder() { - + public ServerFinder(Context aContext) { + mContext = aContext; } private void listenForServer() { @@ -52,6 +58,10 @@ public class ServerFinder { System.currentTimeMillis()); mServerList.add(aServer); + Intent aIntent = new Intent( + CommunicationService.MSG_SERVERLIST_CHANGED); + LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent); + } catch (java.net.SocketTimeoutException e) { // Ignore -- we want to timeout to enable checking whether we // should stop listening periodically |