summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jack He <siyuanh@google.com> 2017-12-13 00:02:25 +0000
committer android-build-merger <android-build-merger@google.com> 2017-12-13 00:02:25 +0000
commitc57c5a9ba41d8c4d2d0464d32b80518944bc6f7f (patch)
treecda58dd066a41a75778aa3e6639245c981ac76db
parent64d81fbf33171ebb2c6cac4dc963d092747f4e91 (diff)
parentf7a69aeeabecf52c0e78458fa764af9481c11928 (diff)
Merge "Bluetooth: Add convenience method to convert connection state to string"
am: f7a69aeeab Change-Id: I6be2177bcc81cd16824fc20b2dbf7a8a6c9464b8
-rw-r--r--core/java/android/bluetooth/BluetoothProfile.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index 46a230b50605..ebbc710922c2 100644
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
@@ -254,4 +254,28 @@ public interface BluetoothProfile {
*/
public void onServiceDisconnected(int profile);
}
+
+ /**
+ * Convert an integer value of connection state into human readable string
+ *
+ * @param connectionState - One of {@link #STATE_DISCONNECTED}, {@link #STATE_CONNECTING},
+ * {@link #STATE_CONNECTED}, or {@link #STATE_DISCONNECTED}
+ * @return a string representation of the connection state, STATE_UNKNOWN if the state
+ * is not defined
+ * @hide
+ */
+ static String getConnectionStateName(int connectionState) {
+ switch (connectionState) {
+ case STATE_DISCONNECTED:
+ return "STATE_DISCONNECTED";
+ case STATE_CONNECTING:
+ return "STATE_CONNECTING";
+ case STATE_CONNECTED:
+ return "STATE_CONNECTED";
+ case STATE_DISCONNECTING:
+ return "STATE_DISCONNECTING";
+ default:
+ return "STATE_UNKNOWN";
+ }
+ }
}