diff options
author | Ganesh Ganapathi Batta <ganeshg@broadcom.com> | 2014-04-18 10:00:40 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2014-05-06 19:20:46 -0700 |
commit | ec661918b6b6ac36905fceb26043633f3e8a6a21 (patch) | |
tree | c6f46437b25dae3d1c19a32e96a984baf2342679 /framework/java/android/bluetooth/BluetoothManager.java | |
parent | d4c0158b93a98c883245f6abdefb1bf2b828f179 (diff) |
Add transport param to Connect APIs
Support for passing preferred transport for GATT connections as part of
Connect APIs
Change-Id: I93938dce519b8fa12de41d7e8690dc9355ce2dc5
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothManager.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothManager.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/framework/java/android/bluetooth/BluetoothManager.java b/framework/java/android/bluetooth/BluetoothManager.java index 172f3bcdef..b1618cf328 100644 --- a/framework/java/android/bluetooth/BluetoothManager.java +++ b/framework/java/android/bluetooth/BluetoothManager.java @@ -194,6 +194,26 @@ public final class BluetoothManager { */ public BluetoothGattServer openGattServer(Context context, BluetoothGattServerCallback callback) { + + return (openGattServer (context, callback, BluetoothDevice.TRANSPORT_AUTO)); + } + + /** + * Open a GATT Server + * The callback is used to deliver results to Caller, such as connection status as well + * as the results of any other GATT server operations. + * The method returns a BluetoothGattServer instance. You can use BluetoothGattServer + * to conduct GATT server operations. + * @param context App context + * @param callback GATT server callback handler that will receive asynchronous callbacks. + * @param transport preferred transport for GATT connections to remote dual-mode devices + * {@link BluetoothDevice#TRANSPORT_AUTO} or + * {@link BluetoothDevice#TRANSPORT_BREDR} or {@link BluetoothDevice#TRANSPORT_LE} + * @return BluetoothGattServer instance + * @hide + */ + public BluetoothGattServer openGattServer(Context context, + BluetoothGattServerCallback callback,int transport) { if (context == null || callback == null) { throw new IllegalArgumentException("null parameter: " + context + " " + callback); } @@ -208,7 +228,7 @@ public final class BluetoothManager { Log.e(TAG, "Fail to get GATT Server connection"); return null; } - BluetoothGattServer mGattServer = new BluetoothGattServer(context, iGatt); + BluetoothGattServer mGattServer = new BluetoothGattServer(context, iGatt,transport); Boolean regStatus = mGattServer.registerCallback(callback); return regStatus? mGattServer : null; } catch (RemoteException e) { |