[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - 13 commits - android/sdremote sd/source

Tor Lillqvist tml at iki.fi
Wed Feb 13 03:45:05 PST 2013


 android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java                 |    5 
 android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java   |    5 
 android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java                |    5 
 android/sdremote/src/org/libreoffice/impressremote/Globals.java                            |   17 ++
 android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java                    |    5 
 android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java               |    3 
 android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java               |    3 
 android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java                   |   68 +++-----
 android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java                   |    5 
 android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java          |    5 
 android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java                  |    3 
 android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java      |   22 ++
 android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java      |   20 +-
 android/sdremote/src/org/libreoffice/impressremote/communication/Client.java               |    5 
 android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java |   26 ++-
 android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java        |   11 -
 android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java             |    3 
 android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java |    5 
 android/sdremote/src/org/libreoffice/impressremote/communication/Server.java               |    8 -
 android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java         |   11 -
 android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java            |    3 
 android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java          |    5 
 sd/source/ui/remotecontrol/BluetoothServer.cxx                                             |   21 +-
 sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx                                      |   77 ++++++++++
 24 files changed, 239 insertions(+), 102 deletions(-)

New commits:
commit dcfd1ae2c8623c74b027390866d1ea62bc29d6ae
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 13 08:43:49 2013 +0200

    Don't bother with unnamed computers
    
    Change-Id: I4e912cab7ab252ef4c118fe63b02931eecd986aa
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
index b9c2cab..972a8a4 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
@@ -77,6 +77,8 @@ public class BluetoothFinder {
                 BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras()
                                 .get(BluetoothDevice.EXTRA_DEVICE);
                 Log.i(Globals.TAG, "BluetoothFinder.onReceive: found " + aDevice.getName() + " at " + aDevice.getAddress());
+                if (aDevice.getName() == null)
+                    return;
                 Server aServer = new Server(Protocol.BLUETOOTH,
                                 aDevice.getAddress(), aDevice.getName(),
                                 System.currentTimeMillis());
commit 4ed9aa98519dee8927cad5e792a06578263390a5
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 13 02:12:12 2013 +0200

    Don't return from the CommunicationService.run() method
    
    This fixes connecting to one computer after connecting to another failed.
    
    Change-Id: I5b13d186d32690a91e4290c81c8d2e12a0a1f2be
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 5f8f8c6..5b32661 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -76,6 +76,7 @@ public class CommunicationService extends Service implements Runnable {
 
     @Override
     public void run() {
+        Log.i(Globals.TAG, "CommunicationService.run()");
         synchronized (this) {
             while (true) {
                 // Condition
@@ -86,6 +87,7 @@ public class CommunicationService extends Service implements Runnable {
                     return;
                 }
                 // Work
+                Log.i(Globals.TAG, "CommunicationService.run: at \"Work\"");
                 synchronized (mConnectionVariableMutex) {
                     if ((mStateDesired == State.CONNECTED && mState == State.CONNECTED)
                                     || (mStateDesired == State.DISCONNECTED && mState == State.CONNECTED)) {
@@ -107,23 +109,21 @@ public class CommunicationService extends Service implements Runnable {
                                                 mBluetoothPreviouslyEnabled);
                                 break;
                             }
+                            mTransmitter = new Transmitter(mClient);
+                            mState = State.CONNECTED;
                         } catch (IOException e) {
-                            e.printStackTrace();
+                            Log.i(Globals.TAG, "CommunicationService.run: " + e);
                             mClient = null;
                             mState = State.DISCONNECTED;
                             Intent aIntent = new Intent(
                                             CommunicationService.STATUS_CONNECTION_FAILED);
                             LocalBroadcastManager.getInstance(this)
                                             .sendBroadcast(aIntent);
-                            return;
                         }
-                        mTransmitter = new Transmitter(mClient);
-                        mState = State.CONNECTED;
                     }
                 }
             }
         }
-
     }
 
     private boolean mBluetoothPreviouslyEnabled;
@@ -156,6 +156,7 @@ public class CommunicationService extends Service implements Runnable {
     }
 
     public void connectTo(Server aServer) {
+        Log.i(Globals.TAG, "CommunicationService.connectTo(" + aServer + ")");
         synchronized (mConnectionVariableMutex) {
             if (mState == State.SEARCHING) {
                 mNetworkFinder.stopFinding();
commit fa66259a2b3cf5454650ee388d7e93b67f5a69d5
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 13 02:10:34 2013 +0200

    Do display the computer name in the dialog when connection failed
    
    The latestInstance lifecycle and mName initialisation was borked.
    
    Change-Id: If7ef8a15fdc297e0fe6e401399a3b94dcd8d08c5
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
index 1c3dce8..ce5e3ad 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
@@ -47,6 +47,7 @@ public abstract class Client {
                     CommunicationService aCommunicationService,
                     Receiver aReceiver) {
         mServer = aServer;
+        mName = aServer.getName();
         mCommunicationService = aCommunicationService;
         mReceiver = aReceiver;
         latestInstance = this;
@@ -92,7 +93,6 @@ public abstract class Client {
             // TODO stream couldn't be opened.
             e1.printStackTrace();
         } finally {
-            latestInstance = null;
             onDisconnect();
         }
 
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index 778f9c3..2e88a17 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -37,7 +37,6 @@ public class NetworkClient extends Client {
                     Receiver aReceiver) throws UnknownHostException,
                     IOException {
         super(aServer, aCommunicationService, aReceiver);
-        mName = aServer.getName();
         mSocket = new Socket(aServer.getAddress(), PORT);
         mInputStream = mSocket.getInputStream();
         mReader = new BufferedReader(new InputStreamReader(mInputStream,
commit f08c9e322b8fe6cbdeff125a0c73b29188dcad31
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 13 02:07:27 2013 +0200

    Add comments, logging, empty lines
    
    Change-Id: Ife81ec74b36f71782997219e36ac926ea429c297
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index 207aef7..1b8c044 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -183,6 +183,8 @@ public class SelectorActivity extends SherlockActivity {
     }
 
     void doBindService() {
+        // This is what creates the first (only?) CommunicationService instance
+        // and calls its run() method (in another thread).
         Intent aIntent = new Intent(this, CommunicationService.class);
         startService(aIntent);
         bindService(aIntent, mConnection, Context.BIND_IMPORTANT);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
index 49be8a3..07a626f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
@@ -36,6 +36,9 @@ public class BluetoothClient extends Client {
                     Receiver aReceiver, boolean aBluetoothWasEnabled)
                     throws IOException {
         super(aServer, aCommunicationService, aReceiver);
+
+        Log.i(Globals.TAG, "BluetoothClient(" + aServer + ")");
+
         mAdapter = BluetoothAdapter.getDefaultAdapter();
         mBluetoothWasEnabled = aBluetoothWasEnabled;
         if (!mBluetoothWasEnabled) {
@@ -45,18 +48,21 @@ public class BluetoothClient extends Client {
         BluetoothDevice aDevice = mAdapter
                         .getRemoteDevice(aServer.getAddress());
         mAdapter.cancelDiscovery();
+
         // This is the "standard UUID for the Serial Port Profile".
         // I.e. the 16-bit SerialPort UUID 0x1101 inserted into the
         // Bluetooth BASE_UUID. See
         // https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
         mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
                         .fromString("00001101-0000-1000-8000-00805F9B34FB"));
+
         mSocket.connect();
         Log.i(Globals.TAG, "BluetoothClient: connected");
 
         mInputStream = mSocket.getInputStream();
         mReader = new BufferedReader(new InputStreamReader(mInputStream,
                         CHARSET));
+
         mOutputStream = mSocket.getOutputStream();
 
         String aTemp = mReader.readLine();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
index a09cc6a..82172be 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
@@ -53,6 +53,9 @@ public class Server {
         return mTimeDiscovered;
     }
 
+    public String toString() {
+        return getClass().getName() + '@' + Integer.toHexString(hashCode()) + ":{" + mAddress + "," + mName + "}";
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e7f0aa00bb63ddf3506e75afa8d9dc91a675ca63
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 13 00:34:49 2013 +0200

    Simplify and fix management of the server lists
    
    The existing code in refreshLists() was somewhat hard to understand, and it
    actually crashed (if uncommented-out). Now it simply empties the maps and view
    lists and then rebuilds them.
    
    The visible end result, at least for me, is that I no longer get duplicate
    servers in the list...
    
    Change-Id: I1543292e219e666e7dcbc68473f40a11e2eb3381
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index ac6012b..207aef7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -9,8 +9,8 @@
 package org.libreoffice.impressremote;
 
 import java.text.MessageFormat;
-import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map.Entry;
 
 import org.libreoffice.impressremote.communication.CommunicationService;
@@ -267,27 +267,18 @@ public class SelectorActivity extends SherlockActivity {
     private void refreshLists() {
         if (mCommunicationService != null) {
 
-            Server[] aServers = mCommunicationService.getServers();
+            List<Server> aServers = mCommunicationService.getServers();
+
+            Log.i(Globals.TAG, "SelectorActivity.refreshLists: got " + aServers.size() + " servers");
+
+            // Simply replace the lists... first clear the old lists,
+            // Then add those currently found.
+
+            mNetworkServers.clear();
+            mBluetoothServers.clear();
+            mNetworkList.removeAllViews();
+            mBluetoothList.removeAllViews();
 
-/* TODO: this crashes currently - some concurrent modification on mBluetoothServers
-            // Bluetooth -- Remove old
-            for (Entry<Server, View> aEntry : mBluetoothServers.entrySet()) {
-                if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
-                    mBluetoothServers.remove(aEntry.getKey());
-                    mBluetoothList.removeView((View) aEntry.getValue()
-                                    .getParent());
-                }
-            }
-*/
-            // Network -- Remove old
-            for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
-                if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
-                    mNetworkServers.remove(aEntry.getKey());
-                    mNetworkList.removeView((View) aEntry.getValue()
-                                    .getParent());
-                }
-            }
-            // Add all new
             for (Server aServer : aServers) {
                 boolean aIsBluetooth = (aServer.getProtocol() == Protocol.BLUETOOTH);
                 HashMap<Server, View> aMap = aIsBluetooth ? mBluetoothServers
@@ -295,22 +286,19 @@ public class SelectorActivity extends SherlockActivity {
                 LinearLayout aLayout = aIsBluetooth ? mBluetoothList
                                 : mNetworkList;
 
-                if (!aMap.containsKey(aServer)) {
-                    View aView = getLayoutInflater()
-                                    .inflate(R.layout.activity_selector_sublayout_server,
-                                                    null);
+                View aView = getLayoutInflater()
+                                .inflate(R.layout.activity_selector_sublayout_server,
+                                                null);
 
-                    TextView aText = (TextView) aView
-                                    .findViewById(R.id.selector_sub_label);
-                    aText.setOnClickListener(mClickListener);
-                    aText.setText(aServer.getName());
-                    aLayout.addView(aView);
-                    aMap.put(aServer, aText);
-
-                    //                    registerForContextMenu(aView);
-                    registerForContextMenu(aText);
-                }
+                TextView aText = (TextView) aView
+                                .findViewById(R.id.selector_sub_label);
+                aText.setOnClickListener(mClickListener);
+                aText.setText(aServer.getName());
+                aLayout.addView(aView);
+                aMap.put(aServer, aText);
 
+                //                    registerForContextMenu(aView);
+                registerForContextMenu(aText);
             }
         }
 
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
index 87535da..b9c2cab 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
@@ -34,10 +34,10 @@ public class BluetoothFinder {
     public BluetoothFinder(Context aContext) {
         mContext = aContext;
         mAdapter = BluetoothAdapter.getDefaultAdapter();
-
     }
 
     public void startFinding() {
+        Log.i(Globals.TAG, "BluetoothFinder.startFinding(): mAdapter=" + mAdapter);
         if (mAdapter == null) {
             return; // No bluetooth adapter found (emulator, special devices)
         }
@@ -49,6 +49,7 @@ public class BluetoothFinder {
     }
 
     public void stopFinding() {
+        Log.i(Globals.TAG, "BluetoothFinder.stopFinding(): mAdapter=" + mAdapter);
         if (mAdapter == null) {
             return; // No bluetooth adapter found (emulator, special devices)
         }
@@ -57,6 +58,7 @@ public class BluetoothFinder {
             mContext.unregisterReceiver(mReceiver);
         } catch (IllegalArgumentException e) {
             // The receiver wasn't registered
+            Log.i(Globals.TAG, "BluetoothFinder.stopFinding: " + e);
         }
     }
 
@@ -70,6 +72,7 @@ public class BluetoothFinder {
 
         @Override
         public void onReceive(Context context, Intent aIntent) {
+            Log.i(Globals.TAG, "BluetoothFinder: BroadcastReceiver.onReceive: aIntent=" + aIntent);
             if (aIntent.getAction().equals(BluetoothDevice.ACTION_FOUND)) {
                 BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras()
                                 .get(BluetoothDevice.EXTRA_DEVICE);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index b3af391..5f8f8c6 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -11,9 +11,11 @@ package org.libreoffice.impressremote.communication;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.libreoffice.impressremote.Globals;
 import org.libreoffice.impressremote.communication.Server.Protocol;
 
 import android.app.Service;
@@ -23,6 +25,7 @@ import android.content.SharedPreferences;
 import android.content.SharedPreferences.Editor;
 import android.os.Binder;
 import android.os.IBinder;
+import android.util.Log;
 import android.preference.PreferenceManager;
 import android.support.v4.content.LocalBroadcastManager;
 
@@ -126,6 +129,7 @@ public class CommunicationService extends Service implements Runnable {
     private boolean mBluetoothPreviouslyEnabled;
 
     public void startSearching() {
+        Log.i(Globals.TAG, "CommunicationService.startSearching()");
         SharedPreferences aPref = PreferenceManager.getDefaultSharedPreferences(this);
         boolean bEnableWifi = aPref.getBoolean("option_enablewifi", false);
         if (bEnableWifi)
@@ -140,12 +144,12 @@ public class CommunicationService extends Service implements Runnable {
     }
 
     public void stopSearching() {
+        Log.i(Globals.TAG, "CommunicationService.stopSearching()");
         mNetworkFinder.stopFinding();
         mBluetoothFinder.stopFinding();
         BluetoothAdapter aAdapter = BluetoothAdapter.getDefaultAdapter();
         if (aAdapter != null) {
             if (!mBluetoothPreviouslyEnabled) {
-
                 aAdapter.disable();
             }
         }
@@ -253,12 +257,12 @@ public class CommunicationService extends Service implements Runnable {
         return mTransmitter;
     }
 
-    public Server[] getServers() {
+    public List<Server> getServers() {
         ArrayList<Server> aServers = new ArrayList<Server>();
         aServers.addAll(mNetworkFinder.getServerList());
         aServers.addAll(mBluetoothFinder.getServerList());
         aServers.addAll(mManualServers.values());
-        return aServers.toArray(new Server[aServers.size()]);
+        return aServers;
     }
 
     public SlideShow getSlideShow() {
commit 0a1f28b417c5215382ab1be932f0583d8a3ae054
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Feb 12 23:21:38 2013 +0200

    Emacs and vim mode line tweaks
    
    These files are Java, not C++. Add empty line before the vim mode line.
    
    Change-Id: Ia94d18e9995ecfbbbfd1c9e6a4d2ce4e8ffb95f3
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java b/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
index 3f1cd3a..3fdc5a8 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -57,4 +57,5 @@ public class AboutDialogBuilder extends AlertDialog.Builder {
 
     }
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java b/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
index 2c70e17..92003bf 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -62,4 +62,5 @@ public class ActivityChangeBroadcastProcessor {
     }
 
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
index 1bb2aa4..be82eeb 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -85,4 +85,5 @@ public class BlankScreenFragment extends SherlockFragment {
         mCommunicationService.getTransmitter().resume();
     }
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
index 2ce2990..f9e6c92 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -64,4 +64,5 @@ public class PairingActivity extends SherlockActivity {
     };
 
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 8ca76e7..0de6b32 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -545,4 +545,5 @@ public class PresentationActivity extends SherlockFragmentActivity {
         }
     };
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 9ad3b79..bb24d40a7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -327,4 +327,5 @@ public class PresentationFragment extends SherlockFragment {
         }
     }
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index e8f4703..ac6012b 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -392,4 +392,5 @@ public class SelectorActivity extends SherlockActivity {
         return super.onContextItemSelected(item);
     }
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
index 95ed905..56d5bad 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -36,4 +36,5 @@ public class SettingsActivity extends SherlockPreferenceActivity {
         }
     }
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
index 0d89c84..44a3368 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -98,4 +98,5 @@ public class StartPresentationActivity extends SherlockActivity {
         }
     };
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
index dace201..d1f2487 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -236,4 +236,5 @@ public class ThumbnailFragment extends SherlockFragment {
         }
     }
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
index fe6ce6f..49be8a3 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -91,4 +91,5 @@ public class BluetoothClient extends Client {
     }
 
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
index dc0db45..87535da 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -105,4 +105,5 @@ public class BluetoothFinder {
 
     };
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
index 4f90eb2..1c3dce8 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -137,4 +137,5 @@ public abstract class Client {
     }
 
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index cc56398..b3af391 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -324,4 +324,5 @@ public class CommunicationService extends Service implements Runnable {
     }
 
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index 595d643..778f9c3 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -134,4 +134,5 @@ public class NetworkClient extends Client {
     }
 
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 0322b1f..5a6316e 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -118,4 +118,5 @@ public class Receiver {
 
     }
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
index d519188..8417cde 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -23,4 +23,5 @@ public class ReconnectionActivity extends SherlockActivity {
     }
 
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
index 42d028b..a09cc6a 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -54,4 +54,5 @@ public class Server {
     }
 
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
index bd15c43..703069c 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -187,4 +187,5 @@ public class ServerFinder {
         return mServerList.values();
     }
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
index 0b29237..2135dbf 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -183,4 +183,5 @@ public class SlideShow {
         }
     }
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
index 1c8ce9b..eebc2f3 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -66,4 +66,5 @@ public class Transmitter {
 		mClient.sendCommand("presentation_stop\n\n");
 	}
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0a77fd88fd5c4c5fb645fa01bd2d028be6cf9a01
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Feb 12 23:00:51 2013 +0200

    Use android.util.Log instead of printing to System.out
    
    Change-Id: I314066086827d283938c6f402733da3f801ad55b
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/Globals.java b/android/sdremote/src/org/libreoffice/impressremote/Globals.java
new file mode 100644
index 0000000..a767bb1
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/Globals.java
@@ -0,0 +1,17 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.libreoffice.impressremote;
+
+public class Globals {
+
+    public static final String TAG = "sdremote";
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index e9d0686..e8f4703 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -30,6 +30,7 @@ import android.content.ServiceConnection;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -252,10 +253,8 @@ public class SelectorActivity extends SherlockActivity {
     private HashMap<Server, View> mNetworkServers = new HashMap<Server, View>();
 
     private void deleteServer(View aView) {
+        Log.i(Globals.TAG, "SelectorActivity.deleteServer(" + aView + ")");
         for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
-            System.out.println(aEntry.getKey().getName());
-            System.out.println(aView);
-            System.out.println(aEntry.getValue());
             if (aEntry.getValue() == aView
                             .findViewById(R.id.selector_sub_label)
                             || aEntry.getValue().findViewById(
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
index b395169..fe6ce6f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
@@ -13,11 +13,14 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.UUID;
 
+import org.libreoffice.impressremote.Globals;
+
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothSocket;
 import android.content.Intent;
 import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
 
 /**
  * Standard Network client. Connects to a server using Sockets.
@@ -49,7 +52,7 @@ public class BluetoothClient extends Client {
         mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
                         .fromString("00001101-0000-1000-8000-00805F9B34FB"));
         mSocket.connect();
-        System.out.println("Connected");
+        Log.i(Globals.TAG, "BluetoothClient: connected");
 
         mInputStream = mSocket.getInputStream();
         mReader = new BufferedReader(new InputStreamReader(mInputStream,
@@ -57,7 +60,7 @@ public class BluetoothClient extends Client {
         mOutputStream = mSocket.getOutputStream();
 
         String aTemp = mReader.readLine();
-        System.out.println("SF:waited");
+        Log.i(Globals.TAG, "BluetoothClient: got line " + aTemp);
         if (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
             return;
         }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
index c3a54af..dc0db45 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
@@ -11,6 +11,7 @@ package org.libreoffice.impressremote.communication;
 import java.util.Collection;
 import java.util.HashMap;
 
+import org.libreoffice.impressremote.Globals;
 import org.libreoffice.impressremote.communication.Server.Protocol;
 
 import android.bluetooth.BluetoothAdapter;
@@ -21,6 +22,7 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Handler;
 import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
 
 public class BluetoothFinder {
 
@@ -69,9 +71,9 @@ public class BluetoothFinder {
         @Override
         public void onReceive(Context context, Intent aIntent) {
             if (aIntent.getAction().equals(BluetoothDevice.ACTION_FOUND)) {
-                System.out.println("Found");
                 BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras()
                                 .get(BluetoothDevice.EXTRA_DEVICE);
+                Log.i(Globals.TAG, "BluetoothFinder.onReceive: found " + aDevice.getName() + " at " + aDevice.getAddress());
                 Server aServer = new Server(Protocol.BLUETOOTH,
                                 aDevice.getAddress(), aDevice.getName(),
                                 System.currentTimeMillis());
@@ -92,8 +94,8 @@ public class BluetoothFinder {
                     aHandler.postDelayed(new Runnable() {
                         @Override
                         public void run() {
-                            System.out.println("Looping");
-
+                            // Looping, huh?
+                            Log.i(Globals.TAG, "BluetothFinder: looping");
                         }
                     }, 1000 * 15);
                 }
@@ -103,4 +105,4 @@ public class BluetoothFinder {
 
     };
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index 3da5154..595d643 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -15,10 +15,13 @@ import java.net.Socket;
 import java.net.UnknownHostException;
 import java.util.Random;
 
+import org.libreoffice.impressremote.Globals;
+
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.Editor;
 import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
 
 /**
  * Standard Network client. Connects to a server using Sockets.
@@ -84,9 +87,9 @@ public class NetworkClient extends Client {
 
         while (mReader.readLine().length() != 0) {
             // Get rid of extra lines
-            System.out.println("SF: empty line");
+            Log.i(Globals.TAG, "NetworkClient: extra line");
         }
-        System.out.println("SD: empty");
+        Log.i(Globals.TAG, "NetworkClient: calling startListening");
         startListening();
 
     }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
index 70bfa60..bd15c43 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
@@ -17,11 +17,13 @@ import java.net.SocketException;
 import java.util.Collection;
 import java.util.HashMap;
 
+import org.libreoffice.impressremote.Globals;
 import org.libreoffice.impressremote.communication.Server.Protocol;
 
 import android.content.Context;
 import android.content.Intent;
 import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
 
 public class ServerFinder {
 
@@ -78,7 +80,7 @@ public class ServerFinder {
                             .getAddress().getHostAddress(), aName,
                             System.currentTimeMillis());
             mServerList.put(aServer.getAddress(), aServer);
-            System.out.println("Contains:<<" + aName + ">>");
+            Log.i(Globals.TAG, "ServerFinder.listenForServer: contains " + aName);
 
             notifyActivity();
         } catch (java.net.SocketTimeoutException e) {
@@ -161,7 +163,7 @@ public class ServerFinder {
     private void checkAndAddEmulator() {
         try {
             if (InetAddress.getByName("10.0.2.2").isReachable(100)) {
-                System.out.println("NulledNot");
+                Log.i(Globals.TAG, "ServerFinder.checkAndAddEmulator: NulledNot, whatever that is supposed to mean");
                 Server aServer = new Server(Protocol.NETWORK, "10.0.2.2",
                                 "Android Emulator Host", 0);
                 aServer.mNoTimeout = true;
@@ -185,4 +187,4 @@ public class ServerFinder {
         return mServerList.values();
     }
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9dcb78991f92acb8fb01ca8d3f6c0b0817044f82
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Feb 12 17:17:37 2013 +0200

    Use the remote control same service name on Windows, too
    
    Change-Id: I45ecc4a745722cc6bf1f5017429a3e532200bf03
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 2e5e62d..9912614 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -389,7 +389,7 @@ void SAL_CALL BluetoothServer::run()
     WSAQUERYSET aRecord;
     memset( &aRecord, 0, sizeof(aRecord));
     aRecord.dwSize = sizeof(aRecord);
-    aRecord.lpszServiceInstanceName = "LibreOffice-SDRemote"; // Optional
+    aRecord.lpszServiceInstanceName = "LibreOffice Impress Remote Control";
     aRecord.lpszComment = "Remote control of presentations over bluetooth.";
     aRecord.lpServiceClassId = (LPGUID) &SerialPortServiceClass_UUID;
     aRecord.dwNameSpace = NS_BTH;
commit 00dffee5266cc99c62eded6a1e1d6507984214c2
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Feb 12 15:38:26 2013 +0200

    Use a more descriptive name for the Impress Remote Control Bluetooth service
    
    No point in using a generic "Serial Port" name, or describe it as a "COM Port"
    (eek). The remote control app doesn't check what the service name is
    anyway. (It probably should?)
    
    Change-Id: I6098110e8c4f62e20c38cf7e6b2071f00dd00515
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
index 4c39767..690d7fd 100644
--- a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
+++ b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
@@ -65,10 +65,10 @@ static const char *bluetooth_service_record =
       // Attribute identifiers are pointed to by the Language Base Attribute ID List
       //  id+0 = ServiceName, id+1 = ServiceDescription, id+2=ProviderName
       "<attribute id=\"0x0100\">"
-        "<text value=\"Serial Port\"/>"
+        "<text value=\"LibreOffice Impress Remote Control\"/>"
       "</attribute>"
-      "<attribute id=\"0x0101\">"
-        "<text value=\"COM Port\"/>"
+      "<attribute id=\"0x0102\">"
+        "<text value=\"The Document Foundation\"/>"
       "</attribute>"
     "</record>"
   ;
commit dadb2410340324bae73332e4be1b4266e559d0de
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Feb 12 11:56:51 2013 +0000

    sdremote - fully annotate bluetooth SDP record.
    
    Change-Id: I3ddfb3e3f93782556ec7fd7a16afbb294d17c013
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
index 5249d90..4c39767 100644
--- a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
+++ b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
@@ -18,18 +18,23 @@
 // This is an XML representation, an alternative would be a
 // binary SDP record.
 
+// for numbers see:
+// https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
+
 static const char *bluetooth_service_record =
   "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
     "<record>"
       "<attribute id=\"0x0001\">"       // Service class ID list
         "<sequence>"
-          "<uuid value=\"0x1101\"/>"
+          "<uuid value=\"0x1101\"/>"    // an assigned service class meaning: 'serial port'
+                                        // we could add our own 'LibreOffice remote' service
+                                        // class here too in future ...
         "</sequence>"
       "</attribute>"
       "<attribute id=\"0x0004\">"       // Protocol Descriptor list
         "<sequence>"
           "<sequence>"
-            "<uuid value=\"0x0100\"/>"
+            "<uuid value=\"0x0100\"/>"  // L2CAP Protocol descriptor
           "</sequence>"
           "<sequence>"
             "<uuid value=\"0x0003\"/>"  // enumeration value of RFCOMM protocol
@@ -39,24 +44,26 @@ static const char *bluetooth_service_record =
       "</attribute>"
       "<attribute id=\"0x0005\">"       // Browse Group List
         "<sequence>"
-          "<uuid value=\"0x1002\"/>"
+          "<uuid value=\"0x1002\"/>"    // public browse class
         "</sequence>"
       "</attribute>"
       "<attribute id=\"0x0006\">"       // Language Base Attribute ID List
         "<sequence>"
-          "<uint16 value=\"0x656e\"/>"
-          "<uint16 value=\"0x006a\"/>"
-          "<uint16 value=\"0x0100\"/>"
+          "<uint16 value=\"0x656e\"/>"  // code_ISO639
+          "<uint16 value=\"0x006a\"/>"  // encoding 0x6a
+          "<uint16 value=\"0x0100\"/>"  // base_offset ie. points to below =>
         "</sequence>"
       "</attribute>"
       "<attribute id=\"0x0009\">"       // Bluetooth Profile Descriptor List
         "<sequence>"
           "<sequence>"
-            "<uuid value=\"0x1101\"/>"
-            "<uint16 value=\"0x0100\"/>"
+            "<uuid value=\"0x1101\"/>"  // 'serial port' UUID as above
+            "<uint16 value=\"0x0100\"/>"// version number 1.0 ?
           "</sequence>"
         "</sequence>"
       "</attribute>"
+      // Attribute identifiers are pointed to by the Language Base Attribute ID List
+      //  id+0 = ServiceName, id+1 = ServiceDescription, id+2=ProviderName
       "<attribute id=\"0x0100\">"
         "<text value=\"Serial Port\"/>"
       "</attribute>"
commit 86474f20dd66d2bc2366cf103335ec7043bf8191
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Feb 12 13:36:04 2013 +0200

    Tell what 00001101-0000-1000-8000-00805F9B34FB is
    
    Fun that we have to reverse engineer and document magic numbers in our own
    code. Code written less than a year ago.
    
    Change-Id: I02b7697e7e02b85c8df78acda8f943c9b0628359
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
index a4fd1ef..b395169 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
@@ -42,6 +42,10 @@ public class BluetoothClient extends Client {
         BluetoothDevice aDevice = mAdapter
                         .getRemoteDevice(aServer.getAddress());
         mAdapter.cancelDiscovery();
+        // This is the "standard UUID for the Serial Port Profile".
+        // I.e. the 16-bit SerialPort UUID 0x1101 inserted into the
+        // Bluetooth BASE_UUID. See
+        // https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
         mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
                         .fromString("00001101-0000-1000-8000-00805F9B34FB"));
         mSocket.connect();
@@ -84,4 +88,4 @@ public class BluetoothClient extends Client {
     }
 
 }
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c46cb184038309106e1797e071d9d17ed80f3114
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Feb 12 11:02:47 2013 +0000

    sdremote - cleanup and annotate bluetooth SDP record.
    
    Conflicts:
    
    	sd/source/ui/remotecontrol/BluetoothServer.cxx
    
    Change-Id: Ie6c3d12387cececce4e169482659cbcbbcfd0975
    Signed-off-by: Tor Lillqvist <tml at iki.fi>

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index f676b5e..2e5e62d 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -6,7 +6,9 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
+
 #include "BluetoothServer.hxx"
+#include "BluetoothServiceRecord.hxx"
 #include <stdio.h>
 
 #include <sal/log.hxx>
@@ -35,11 +37,10 @@
   #include <ws2bth.h>
 #endif
 
-// FIXME: move this into an external file and look at sharing definitions
-// across OS's (i.e. UUID and port ).
-// Also look at determining which ports are available.
-// Alternatively use the binary sdp record
-#define BLUETOOTH_SERVICE_RECORD "<?xml version='1.0' encoding= 'UTF-8' ?><record><attribute id='0x0001'><sequence><uuid value='0x1101' /></sequence></attribute><attribute id='0x0004'><sequence><sequence><uuid value='0x0100' /></sequence><sequence><uuid value='0x0003' /><uint8 value='0x05' /></sequence></sequence></attribute><attribute id='0x0005'><sequence><uuid value='0x1002' /></sequence></attribute><attribute id='0x0006'><sequence><uint16 value='0x656e' /><uint16 value='0x006a' /><uint16 value='0x0100' /></sequence></attribute><attribute id='0x0009'><sequence><sequence><uuid value='0x1101' /><uint16 value='0x0100' /></sequence></sequence></attribute><attribute id='0x0100'><text value='Serial Port' /></attribute><attribute id='0x0101'><text value='COM Port' /></attribute></record>"
+#ifdef __MINGW32__
+// Value taken from http://msdn.microsoft.com/en-us/library/windows/desktop/ms738518%28v=vs.85%29.aspx
+#define NS_BTH 16
+#endif
 
 #include "Communicator.hxx"
 
@@ -273,7 +274,7 @@ void SAL_CALL BluetoothServer::run()
     // don't bother as the record is automatically released when LO exits.
     guint aHandle;
     gboolean aResult = dbus_g_proxy_call( aAdapter, "AddRecord", &aError,
-                                G_TYPE_STRING, BLUETOOTH_SERVICE_RECORD ,
+                                G_TYPE_STRING, bluetooth_service_record,
                                 G_TYPE_INVALID,
                                 G_TYPE_UINT, &aHandle,
                                 G_TYPE_INVALID);
@@ -432,7 +433,6 @@ void SAL_CALL BluetoothServer::run()
 #endif
 }
 
-
 BluetoothServer *sd::BluetoothServer::spServer = NULL;
 
 void BluetoothServer::setup( std::vector<Communicator*>* pCommunicators )
@@ -444,5 +444,4 @@ void BluetoothServer::setup( std::vector<Communicator*>* pCommunicators )
     spServer->create();
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
new file mode 100644
index 0000000..5249d90
--- /dev/null
+++ b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef BLUETOOTH_SERVICE_RECORD_HXX
+#define BLUETOOTH_SERVICE_RECORD_HXX
+
+// FIXME: look into sharing definitions across OS's (i.e. UUID and port ).
+// Look into dynamically determining which ports are available.
+
+// SDP is a Service Description Protocol cf.
+//   http://developer.bluetooth.org/TechnologyOverview/Pages/DI.aspx
+// This is an XML representation, an alternative would be a
+// binary SDP record.
+
+static const char *bluetooth_service_record =
+  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+    "<record>"
+      "<attribute id=\"0x0001\">"       // Service class ID list
+        "<sequence>"
+          "<uuid value=\"0x1101\"/>"
+        "</sequence>"
+      "</attribute>"
+      "<attribute id=\"0x0004\">"       // Protocol Descriptor list
+        "<sequence>"
+          "<sequence>"
+            "<uuid value=\"0x0100\"/>"
+          "</sequence>"
+          "<sequence>"
+            "<uuid value=\"0x0003\"/>"  // enumeration value of RFCOMM protocol
+            "<uint8 value=\"0x05\"/>"   // RFCOMM port number
+          "</sequence>"
+        "</sequence>"
+      "</attribute>"
+      "<attribute id=\"0x0005\">"       // Browse Group List
+        "<sequence>"
+          "<uuid value=\"0x1002\"/>"
+        "</sequence>"
+      "</attribute>"
+      "<attribute id=\"0x0006\">"       // Language Base Attribute ID List
+        "<sequence>"
+          "<uint16 value=\"0x656e\"/>"
+          "<uint16 value=\"0x006a\"/>"
+          "<uint16 value=\"0x0100\"/>"
+        "</sequence>"
+      "</attribute>"
+      "<attribute id=\"0x0009\">"       // Bluetooth Profile Descriptor List
+        "<sequence>"
+          "<sequence>"
+            "<uuid value=\"0x1101\"/>"
+            "<uint16 value=\"0x0100\"/>"
+          "</sequence>"
+        "</sequence>"
+      "</attribute>"
+      "<attribute id=\"0x0100\">"
+        "<text value=\"Serial Port\"/>"
+      "</attribute>"
+      "<attribute id=\"0x0101\">"
+        "<text value=\"COM Port\"/>"
+      "</attribute>"
+    "</record>"
+  ;
+
+#endif // BLUETOOTH_SERVICE_RECORD_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7d3a1616ee4d3f91394f5d807769d53289fd56e0
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Dec 21 11:17:38 2012 +0100

    ugly workaround for msvc+ccache problem with gbuild MSC define
    
    and squash remove no longer needed hack
    
    Conflicts:
    
    	sd/source/ui/remotecontrol/BluetoothServer.cxx
    
    Change-Id: I06ab10df77e2b3598f7268173206429596a50217
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 8c695b6..f676b5e 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -28,7 +28,9 @@
 #endif
 
 #ifdef WIN32
-  #undef MSC // Unset a legacy define, as otherwise ws2bth.h breaks
+  // LO vs WinAPI conflict
+  #undef WB_LEFT
+  #undef WB_RIGHT
   #include <winsock2.h>
   #include <ws2bth.h>
 #endif


More information about the Libreoffice-commits mailing list