[Libreoffice-commits] .: android/sdremote
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Aug 21 02:17:27 PDT 2012
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java | 21 +++++++---
android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java | 2
2 files changed, 17 insertions(+), 6 deletions(-)
New commits:
commit e392440a2af0586638795570f17c57223177054f
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Tue Aug 21 11:13:04 2012 +0200
Device name now based on bluetooth name, or hardware name.
Change-Id: I0be93ff79d3dbd56bf847a081b310985c77e43f5
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index efa6514..b3fc690 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -11,6 +11,7 @@ package org.libreoffice.impressremote.communication;
import java.util.ArrayList;
import android.app.Service;
+import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
@@ -22,6 +23,21 @@ public class CommunicationService extends Service implements Runnable {
};
/**
+ * Get the publicly visible device name -- generally the bluetooth name,
+ * however for bluetoothless devices the device model name is used.
+ *
+ * @return The device name.
+ */
+ public static String getDeviceName() {
+ BluetoothAdapter aAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (aAdapter != null) {
+ return aAdapter.getName();
+ } else {
+ return android.os.Build.MODEL;
+ }
+ }
+
+ /**
* Used to protect all writes to mState, mStateDesired, and mServerDesired.
*/
private Object mConnectionVariableMutex = new Object();
@@ -36,11 +52,6 @@ public class CommunicationService extends Service implements Runnable {
return Client.getPin();
}
- public String getDeviceName() {
- return "Bob";
- // FIXME: get the device name somehow.
- }
-
private State mStateDesired = State.DISCONNECTED;
private Server mServerDesired = null;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index 1e04747..47e0e37 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -50,7 +50,7 @@ public class NetworkClient extends Client {
mPin = aPin;
LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent);
// Send out
- String aName = "Bob"; // TODO: get the proper name
+ String aName = CommunicationService.getDeviceName(); // TODO: get the proper name
sendCommand("LO_SERVER_CLIENT_PAIR\n" + aName + "\n" + aPin
+ "\n\n");
More information about the Libreoffice-commits
mailing list