aboutsummaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothProfile.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-12-12 22:41:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-12-12 22:41:13 +0000
commit255cd57fb0bbbb55033906e6d34606f2bdfc4b6e (patch)
treeb0c854850ed97a7c6c5ca66f59d1d1394f8e8962 /framework/java/android/bluetooth/BluetoothProfile.java
parent5fa637947c01b0646c929196134d9f72844d5584 (diff)
parent93df94095ff3cb657ad281290b227d84b6d2224a (diff)
Merge "Bluetooth: Add convenience method to convert connection state to string"
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothProfile.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothProfile.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothProfile.java b/framework/java/android/bluetooth/BluetoothProfile.java
index 46a230b506..ebbc710922 100644
--- a/framework/java/android/bluetooth/BluetoothProfile.java
+++ b/framework/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";
+ }
+ }
}