Loading Android.mk +2 −2 Original line number Diff line number Diff line Loading @@ -140,8 +140,8 @@ LOCAL_SRC_FILES += \ core/java/android/bluetooth/IBluetoothInputHost.aidl \ core/java/android/bluetooth/IBluetoothHidDeviceCallback.aidl \ core/java/android/bluetooth/IBluetoothGatt.aidl \ core/java/android/bluetooth/IBluetoothGattCallback.aidl \ core/java/android/bluetooth/IBluetoothGattServerCallback.aidl \ core/java/android/bluetooth/IBluetoothGattCallbackExt.aidl \ core/java/android/bluetooth/IBluetoothGattServerCallbackExt.aidl \ core/java/android/bluetooth/le/IAdvertiserCallback.aidl \ core/java/android/bluetooth/le/IPeriodicAdvertisingCallback.aidl \ core/java/android/bluetooth/le/IScannerCallback.aidl \ Loading api/current.txt +28 −2 Original line number Diff line number Diff line Loading @@ -7495,6 +7495,9 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int, int); method public boolean createBond(); method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; Loading Loading @@ -7538,6 +7541,13 @@ package android.bluetooth { field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int TRANSPORT_AUTO = 0; // 0x0 field public static final int TRANSPORT_BREDR = 1; // 0x1 field public static final int TRANSPORT_LE = 2; // 0x2 Loading @@ -7560,10 +7570,12 @@ package android.bluetooth { method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor); method public void readPhy(); method public boolean readRemoteRssi(); method public boolean requestConnectionPriority(int); method public boolean requestMtu(int); method public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean); method public void setPreferredPhy(int, int, int); method public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor); field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0 Loading @@ -7581,8 +7593,12 @@ package android.bluetooth { field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3 } public abstract class BluetoothGattCallback { public abstract deprecated class BluetoothGattCallback extends android.bluetooth.BluetoothGattCallbackExt { ctor public BluetoothGattCallback(); } public abstract class BluetoothGattCallbackExt { ctor public BluetoothGattCallbackExt(); method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); Loading @@ -7590,6 +7606,8 @@ package android.bluetooth { method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int); method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int); method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int); method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int); method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int); Loading Loading @@ -7683,12 +7701,18 @@ package android.bluetooth { method public android.bluetooth.BluetoothGattService getService(java.util.UUID); method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean); method public void readPhy(android.bluetooth.BluetoothDevice); method public boolean removeService(android.bluetooth.BluetoothGattService); method public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]); method public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int); } public abstract class BluetoothGattServerCallback { public abstract deprecated class BluetoothGattServerCallback extends android.bluetooth.BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallback(); } public abstract class BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallbackExt(); method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]); method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int); Loading @@ -7697,6 +7721,8 @@ package android.bluetooth { method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean); method public void onMtuChanged(android.bluetooth.BluetoothDevice, int); method public void onNotificationSent(android.bluetooth.BluetoothDevice, int); method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int); method public void onServiceAdded(int, android.bluetooth.BluetoothGattService); } api/system-current.txt +28 −2 Original line number Diff line number Diff line Loading @@ -7971,6 +7971,9 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int, int); method public boolean createBond(); method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; Loading Loading @@ -8016,6 +8019,13 @@ package android.bluetooth { field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int TRANSPORT_AUTO = 0; // 0x0 field public static final int TRANSPORT_BREDR = 1; // 0x1 field public static final int TRANSPORT_LE = 2; // 0x2 Loading @@ -8038,10 +8048,12 @@ package android.bluetooth { method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor); method public void readPhy(); method public boolean readRemoteRssi(); method public boolean requestConnectionPriority(int); method public boolean requestMtu(int); method public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean); method public void setPreferredPhy(int, int, int); method public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor); field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0 Loading @@ -8059,8 +8071,12 @@ package android.bluetooth { field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3 } public abstract class BluetoothGattCallback { public abstract deprecated class BluetoothGattCallback extends android.bluetooth.BluetoothGattCallbackExt { ctor public BluetoothGattCallback(); } public abstract class BluetoothGattCallbackExt { ctor public BluetoothGattCallbackExt(); method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); Loading @@ -8068,6 +8084,8 @@ package android.bluetooth { method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int); method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int); method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int); method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int); method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int); Loading Loading @@ -8161,12 +8179,18 @@ package android.bluetooth { method public android.bluetooth.BluetoothGattService getService(java.util.UUID); method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean); method public void readPhy(android.bluetooth.BluetoothDevice); method public boolean removeService(android.bluetooth.BluetoothGattService); method public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]); method public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int); } public abstract class BluetoothGattServerCallback { public abstract deprecated class BluetoothGattServerCallback extends android.bluetooth.BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallback(); } public abstract class BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallbackExt(); method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]); method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int); Loading @@ -8175,6 +8199,8 @@ package android.bluetooth { method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean); method public void onMtuChanged(android.bluetooth.BluetoothDevice, int); method public void onNotificationSent(android.bluetooth.BluetoothDevice, int); method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int); method public void onServiceAdded(int, android.bluetooth.BluetoothGattService); } api/test-current.txt +28 −2 Original line number Diff line number Diff line Loading @@ -7522,6 +7522,9 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int, int); method public boolean createBond(); method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; Loading Loading @@ -7565,6 +7568,13 @@ package android.bluetooth { field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int TRANSPORT_AUTO = 0; // 0x0 field public static final int TRANSPORT_BREDR = 1; // 0x1 field public static final int TRANSPORT_LE = 2; // 0x2 Loading @@ -7587,10 +7597,12 @@ package android.bluetooth { method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor); method public void readPhy(); method public boolean readRemoteRssi(); method public boolean requestConnectionPriority(int); method public boolean requestMtu(int); method public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean); method public void setPreferredPhy(int, int, int); method public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor); field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0 Loading @@ -7608,8 +7620,12 @@ package android.bluetooth { field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3 } public abstract class BluetoothGattCallback { public abstract deprecated class BluetoothGattCallback extends android.bluetooth.BluetoothGattCallbackExt { ctor public BluetoothGattCallback(); } public abstract class BluetoothGattCallbackExt { ctor public BluetoothGattCallbackExt(); method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); Loading @@ -7617,6 +7633,8 @@ package android.bluetooth { method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int); method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int); method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int); method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int); method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int); Loading Loading @@ -7710,12 +7728,18 @@ package android.bluetooth { method public android.bluetooth.BluetoothGattService getService(java.util.UUID); method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean); method public void readPhy(android.bluetooth.BluetoothDevice); method public boolean removeService(android.bluetooth.BluetoothGattService); method public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]); method public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int); } public abstract class BluetoothGattServerCallback { public abstract deprecated class BluetoothGattServerCallback extends android.bluetooth.BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallback(); } public abstract class BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallbackExt(); method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]); method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int); Loading @@ -7724,6 +7748,8 @@ package android.bluetooth { method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean); method public void onMtuChanged(android.bluetooth.BluetoothDevice, int); method public void onNotificationSent(android.bluetooth.BluetoothDevice, int); method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int); method public void onServiceAdded(int, android.bluetooth.BluetoothGattService); } core/java/android/bluetooth/BluetoothDevice.java +98 −1 Original line number Diff line number Diff line Loading @@ -592,6 +592,42 @@ public final class BluetoothDevice implements Parcelable { */ public static final int TRANSPORT_LE = 2; /** * 1M initiating PHY. */ public static final int PHY_LE_1M = 1; /** * 2M initiating PHY. */ public static final int PHY_LE_2M = 2; /** * LE Coded initiating PHY. */ public static final int PHY_LE_CODED = 4; /** * Any LE PHY. */ public static final int PHY_LE_ANY = PHY_LE_1M | PHY_LE_2M | PHY_LE_CODED; /** * No preferred coding when transmitting on the LE Coded PHY. */ public static final int PHY_OPTION_NO_PREFERRED = 0; /** * Prefer the S=2 coding to be used when transmitting on the LE Coded PHY. */ public static final int PHY_OPTION_S2 = 1; /** * Prefer the S=8 coding to be used when transmitting on the LE Coded PHY. */ public static final int PHY_OPTION_S8 = 2; /** @hide */ public static final String EXTRA_MAS_INSTANCE = "android.bluetooth.device.extra.MAS_INSTANCE"; Loading Loading @@ -1615,6 +1651,67 @@ public final class BluetoothDevice implements Parcelable { */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback, int transport) { return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO, PHY_LE_1M)); } /** * Connect to GATT Server hosted by this device. Caller acts as GATT client. * The callback is used to deliver results to Caller, such as connection status as well * as any further GATT client operations. * The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct * GATT client operations. * @param callback GATT callback handler that will receive asynchronous callbacks. * @param autoConnect Whether to directly connect to the remote device (false) * or to automatically connect as soon as the remote * device becomes available (true). * @throws IllegalArgumentException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallbackExt callback) { return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO)); } /** * Connect to GATT Server hosted by this device. Caller acts as GATT client. * The callback is used to deliver results to Caller, such as connection status as well * as any further GATT client operations. * The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct * GATT client operations. * @param callback GATT callback handler that will receive asynchronous callbacks. * @param autoConnect Whether to directly connect to the remote device (false) * or to automatically connect as soon as the remote * device becomes available (true). * @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} * @throws IllegalArgumentException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallbackExt callback, int transport) { return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO, PHY_LE_1M)); } /** * Connect to GATT Server hosted by this device. Caller acts as GATT client. * The callback is used to deliver results to Caller, such as connection status as well * as any further GATT client operations. * The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct * GATT client operations. * @param callback GATT callback handler that will receive asynchronous callbacks. * @param autoConnect Whether to directly connect to the remote device (false) * or to automatically connect as soon as the remote * device becomes available (true). * @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} * @param phy preferred PHY for connections to remote LE device. Bitwise OR of any of * {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, * and {@link BluetoothDevice#PHY_LE_CODED}. This option does not take effect if * {@code autoConnect} is set to true. * @throws IllegalArgumentException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallbackExt callback, int transport, int phy) { // TODO(Bluetooth) check whether platform support BLE // Do the check here or in GattServer? BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); Loading @@ -1625,7 +1722,7 @@ public final class BluetoothDevice implements Parcelable { // BLE is not supported return null; } BluetoothGatt gatt = new BluetoothGatt(iGatt, this, transport); BluetoothGatt gatt = new BluetoothGatt(iGatt, this, transport, phy); gatt.connect(autoConnect, callback); return gatt; } catch (RemoteException e) {Log.e(TAG, "", e);} Loading Loading
Android.mk +2 −2 Original line number Diff line number Diff line Loading @@ -140,8 +140,8 @@ LOCAL_SRC_FILES += \ core/java/android/bluetooth/IBluetoothInputHost.aidl \ core/java/android/bluetooth/IBluetoothHidDeviceCallback.aidl \ core/java/android/bluetooth/IBluetoothGatt.aidl \ core/java/android/bluetooth/IBluetoothGattCallback.aidl \ core/java/android/bluetooth/IBluetoothGattServerCallback.aidl \ core/java/android/bluetooth/IBluetoothGattCallbackExt.aidl \ core/java/android/bluetooth/IBluetoothGattServerCallbackExt.aidl \ core/java/android/bluetooth/le/IAdvertiserCallback.aidl \ core/java/android/bluetooth/le/IPeriodicAdvertisingCallback.aidl \ core/java/android/bluetooth/le/IScannerCallback.aidl \ Loading
api/current.txt +28 −2 Original line number Diff line number Diff line Loading @@ -7495,6 +7495,9 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int, int); method public boolean createBond(); method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; Loading Loading @@ -7538,6 +7541,13 @@ package android.bluetooth { field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int TRANSPORT_AUTO = 0; // 0x0 field public static final int TRANSPORT_BREDR = 1; // 0x1 field public static final int TRANSPORT_LE = 2; // 0x2 Loading @@ -7560,10 +7570,12 @@ package android.bluetooth { method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor); method public void readPhy(); method public boolean readRemoteRssi(); method public boolean requestConnectionPriority(int); method public boolean requestMtu(int); method public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean); method public void setPreferredPhy(int, int, int); method public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor); field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0 Loading @@ -7581,8 +7593,12 @@ package android.bluetooth { field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3 } public abstract class BluetoothGattCallback { public abstract deprecated class BluetoothGattCallback extends android.bluetooth.BluetoothGattCallbackExt { ctor public BluetoothGattCallback(); } public abstract class BluetoothGattCallbackExt { ctor public BluetoothGattCallbackExt(); method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); Loading @@ -7590,6 +7606,8 @@ package android.bluetooth { method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int); method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int); method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int); method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int); method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int); Loading Loading @@ -7683,12 +7701,18 @@ package android.bluetooth { method public android.bluetooth.BluetoothGattService getService(java.util.UUID); method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean); method public void readPhy(android.bluetooth.BluetoothDevice); method public boolean removeService(android.bluetooth.BluetoothGattService); method public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]); method public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int); } public abstract class BluetoothGattServerCallback { public abstract deprecated class BluetoothGattServerCallback extends android.bluetooth.BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallback(); } public abstract class BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallbackExt(); method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]); method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int); Loading @@ -7697,6 +7721,8 @@ package android.bluetooth { method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean); method public void onMtuChanged(android.bluetooth.BluetoothDevice, int); method public void onNotificationSent(android.bluetooth.BluetoothDevice, int); method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int); method public void onServiceAdded(int, android.bluetooth.BluetoothGattService); }
api/system-current.txt +28 −2 Original line number Diff line number Diff line Loading @@ -7971,6 +7971,9 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int, int); method public boolean createBond(); method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; Loading Loading @@ -8016,6 +8019,13 @@ package android.bluetooth { field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int TRANSPORT_AUTO = 0; // 0x0 field public static final int TRANSPORT_BREDR = 1; // 0x1 field public static final int TRANSPORT_LE = 2; // 0x2 Loading @@ -8038,10 +8048,12 @@ package android.bluetooth { method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor); method public void readPhy(); method public boolean readRemoteRssi(); method public boolean requestConnectionPriority(int); method public boolean requestMtu(int); method public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean); method public void setPreferredPhy(int, int, int); method public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor); field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0 Loading @@ -8059,8 +8071,12 @@ package android.bluetooth { field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3 } public abstract class BluetoothGattCallback { public abstract deprecated class BluetoothGattCallback extends android.bluetooth.BluetoothGattCallbackExt { ctor public BluetoothGattCallback(); } public abstract class BluetoothGattCallbackExt { ctor public BluetoothGattCallbackExt(); method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); Loading @@ -8068,6 +8084,8 @@ package android.bluetooth { method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int); method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int); method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int); method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int); method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int); Loading Loading @@ -8161,12 +8179,18 @@ package android.bluetooth { method public android.bluetooth.BluetoothGattService getService(java.util.UUID); method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean); method public void readPhy(android.bluetooth.BluetoothDevice); method public boolean removeService(android.bluetooth.BluetoothGattService); method public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]); method public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int); } public abstract class BluetoothGattServerCallback { public abstract deprecated class BluetoothGattServerCallback extends android.bluetooth.BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallback(); } public abstract class BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallbackExt(); method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]); method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int); Loading @@ -8175,6 +8199,8 @@ package android.bluetooth { method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean); method public void onMtuChanged(android.bluetooth.BluetoothDevice, int); method public void onNotificationSent(android.bluetooth.BluetoothDevice, int); method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int); method public void onServiceAdded(int, android.bluetooth.BluetoothGattService); }
api/test-current.txt +28 −2 Original line number Diff line number Diff line Loading @@ -7522,6 +7522,9 @@ package android.bluetooth { public final class BluetoothDevice implements android.os.Parcelable { method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int); method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallbackExt, int, int); method public boolean createBond(); method public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; method public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException; Loading Loading @@ -7565,6 +7568,13 @@ package android.bluetooth { field public static final java.lang.String EXTRA_UUID = "android.bluetooth.device.extra.UUID"; field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int TRANSPORT_AUTO = 0; // 0x0 field public static final int TRANSPORT_BREDR = 1; // 0x1 field public static final int TRANSPORT_LE = 2; // 0x2 Loading @@ -7587,10 +7597,12 @@ package android.bluetooth { method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor); method public void readPhy(); method public boolean readRemoteRssi(); method public boolean requestConnectionPriority(int); method public boolean requestMtu(int); method public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean); method public void setPreferredPhy(int, int, int); method public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic); method public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor); field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0 Loading @@ -7608,8 +7620,12 @@ package android.bluetooth { field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3 } public abstract class BluetoothGattCallback { public abstract deprecated class BluetoothGattCallback extends android.bluetooth.BluetoothGattCallbackExt { ctor public BluetoothGattCallback(); } public abstract class BluetoothGattCallbackExt { ctor public BluetoothGattCallbackExt(); method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int); Loading @@ -7617,6 +7633,8 @@ package android.bluetooth { method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int); method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int); method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int); method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int); method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int); method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int); Loading Loading @@ -7710,12 +7728,18 @@ package android.bluetooth { method public android.bluetooth.BluetoothGattService getService(java.util.UUID); method public java.util.List<android.bluetooth.BluetoothGattService> getServices(); method public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean); method public void readPhy(android.bluetooth.BluetoothDevice); method public boolean removeService(android.bluetooth.BluetoothGattService); method public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]); method public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int); } public abstract class BluetoothGattServerCallback { public abstract deprecated class BluetoothGattServerCallback extends android.bluetooth.BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallback(); } public abstract class BluetoothGattServerCallbackExt { ctor public BluetoothGattServerCallbackExt(); method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic); method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]); method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int); Loading @@ -7724,6 +7748,8 @@ package android.bluetooth { method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean); method public void onMtuChanged(android.bluetooth.BluetoothDevice, int); method public void onNotificationSent(android.bluetooth.BluetoothDevice, int); method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int); method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int); method public void onServiceAdded(int, android.bluetooth.BluetoothGattService); }
core/java/android/bluetooth/BluetoothDevice.java +98 −1 Original line number Diff line number Diff line Loading @@ -592,6 +592,42 @@ public final class BluetoothDevice implements Parcelable { */ public static final int TRANSPORT_LE = 2; /** * 1M initiating PHY. */ public static final int PHY_LE_1M = 1; /** * 2M initiating PHY. */ public static final int PHY_LE_2M = 2; /** * LE Coded initiating PHY. */ public static final int PHY_LE_CODED = 4; /** * Any LE PHY. */ public static final int PHY_LE_ANY = PHY_LE_1M | PHY_LE_2M | PHY_LE_CODED; /** * No preferred coding when transmitting on the LE Coded PHY. */ public static final int PHY_OPTION_NO_PREFERRED = 0; /** * Prefer the S=2 coding to be used when transmitting on the LE Coded PHY. */ public static final int PHY_OPTION_S2 = 1; /** * Prefer the S=8 coding to be used when transmitting on the LE Coded PHY. */ public static final int PHY_OPTION_S8 = 2; /** @hide */ public static final String EXTRA_MAS_INSTANCE = "android.bluetooth.device.extra.MAS_INSTANCE"; Loading Loading @@ -1615,6 +1651,67 @@ public final class BluetoothDevice implements Parcelable { */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback, int transport) { return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO, PHY_LE_1M)); } /** * Connect to GATT Server hosted by this device. Caller acts as GATT client. * The callback is used to deliver results to Caller, such as connection status as well * as any further GATT client operations. * The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct * GATT client operations. * @param callback GATT callback handler that will receive asynchronous callbacks. * @param autoConnect Whether to directly connect to the remote device (false) * or to automatically connect as soon as the remote * device becomes available (true). * @throws IllegalArgumentException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallbackExt callback) { return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO)); } /** * Connect to GATT Server hosted by this device. Caller acts as GATT client. * The callback is used to deliver results to Caller, such as connection status as well * as any further GATT client operations. * The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct * GATT client operations. * @param callback GATT callback handler that will receive asynchronous callbacks. * @param autoConnect Whether to directly connect to the remote device (false) * or to automatically connect as soon as the remote * device becomes available (true). * @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} * @throws IllegalArgumentException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallbackExt callback, int transport) { return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO, PHY_LE_1M)); } /** * Connect to GATT Server hosted by this device. Caller acts as GATT client. * The callback is used to deliver results to Caller, such as connection status as well * as any further GATT client operations. * The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct * GATT client operations. * @param callback GATT callback handler that will receive asynchronous callbacks. * @param autoConnect Whether to directly connect to the remote device (false) * or to automatically connect as soon as the remote * device becomes available (true). * @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} * @param phy preferred PHY for connections to remote LE device. Bitwise OR of any of * {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, * and {@link BluetoothDevice#PHY_LE_CODED}. This option does not take effect if * {@code autoConnect} is set to true. * @throws IllegalArgumentException if callback is null */ public BluetoothGatt connectGatt(Context context, boolean autoConnect, BluetoothGattCallbackExt callback, int transport, int phy) { // TODO(Bluetooth) check whether platform support BLE // Do the check here or in GattServer? BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); Loading @@ -1625,7 +1722,7 @@ public final class BluetoothDevice implements Parcelable { // BLE is not supported return null; } BluetoothGatt gatt = new BluetoothGatt(iGatt, this, transport); BluetoothGatt gatt = new BluetoothGatt(iGatt, this, transport, phy); gatt.connect(autoConnect, callback); return gatt; } catch (RemoteException e) {Log.e(TAG, "", e);} Loading