Loading framework/java/android/bluetooth/BluetoothGatt.java +32 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Application interface registered - app is ready to go * @hide */ @Override public void onClientRegistered(int status, int clientIf) { if (DBG) Log.d(TAG, "onClientRegistered() - status=" + status + " clientIf=" + clientIf); Loading Loading @@ -210,6 +211,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Client connection state changed * @hide */ @Override public void onClientConnectionState(int status, int clientIf, boolean connected, String address) { if (DBG) Log.d(TAG, "onClientConnectionState() - status=" + status Loading Loading @@ -245,6 +247,7 @@ public final class BluetoothGatt implements BluetoothProfile { * we are done at this point. * @hide */ @Override public void onSearchComplete(String address, List<BluetoothGattService> services, int status) { if (DBG) Log.d(TAG, "onSearchComplete() = Device=" + address + " Status=" + status); Loading Loading @@ -288,6 +291,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Updates the internal value. * @hide */ @Override public void onCharacteristicRead(String address, int status, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onCharacteristicRead() - Device=" + address + " handle=" + handle + " Status=" + status); Loading Loading @@ -336,6 +340,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Let the app know how we did... * @hide */ @Override public void onCharacteristicWrite(String address, int status, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicWrite() - Device=" + address + " handle=" + handle + " Status=" + status); Loading Loading @@ -380,6 +385,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Updates the internal value. * @hide */ @Override public void onNotify(String address, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onNotify() - Device=" + address + " handle=" + handle); Loading @@ -403,6 +409,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Descriptor has been read. * @hide */ @Override public void onDescriptorRead(String address, int status, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onDescriptorRead() - Device=" + address + " handle=" + handle); Loading Loading @@ -446,6 +453,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Descriptor write operation complete. * @hide */ @Override public void onDescriptorWrite(String address, int status, int handle) { if (VDBG) Log.d(TAG, "onDescriptorWrite() - Device=" + address + " handle=" + handle); Loading Loading @@ -488,6 +496,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Prepared write transaction completed (or aborted) * @hide */ @Override public void onExecuteWrite(String address, int status) { if (VDBG) Log.d(TAG, "onExecuteWrite() - Device=" + address + " status=" + status); Loading @@ -510,6 +519,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Remote device RSSI has been read * @hide */ @Override public void onReadRemoteRssi(String address, int rssi, int status) { if (VDBG) Log.d(TAG, "onReadRemoteRssi() - Device=" + address + " rssi=" + rssi + " status=" + status); Loading @@ -527,6 +537,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Callback invoked when the MTU for a given connection changes * @hide */ @Override public void onConfigureMTU(String address, int mtu, int status) { if (DBG) Log.d(TAG, "onConfigureMTU() - Device=" + address + " mtu=" + mtu + " status=" + status); Loading @@ -539,6 +550,27 @@ public final class BluetoothGatt implements BluetoothProfile { Log.w(TAG, "Unhandled exception in callback", ex); } } /** * Callback invoked when the given connection is updated * @hide */ @Override public void onConnectionUpdated(String address, int interval, int latency, int timeout, int status) { if (DBG) Log.d(TAG, "onConnectionUpdated() - Device=" + address + " interval=" + interval + " latency=" + latency + " timeout=" + timeout + " status=" + status); if (!address.equals(mDevice.getAddress())) { return; } try { mCallback.onConnectionUpdated(BluetoothGatt.this, interval, latency, timeout, status); } catch (Exception ex) { Log.w(TAG, "Unhandled exception in callback", ex); } } }; /*package*/ BluetoothGatt(IBluetoothGatt iGatt, BluetoothDevice device, Loading framework/java/android/bluetooth/BluetoothGattCallback.java +18 −0 Original line number Diff line number Diff line Loading @@ -179,4 +179,22 @@ public abstract class BluetoothGattCallback{ */ public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { } /** * Callback indicating the connection parameters were updated. * * @param gatt GATT client involved * @param interval Connection interval used on this connection, 1.25ms unit. Valid * range is from 6 (7.5ms) to 3200 (4000ms). * @param latency Slave latency for the connection in number of connection events. Valid * range is from 0 to 499 * @param timeout Supervision timeout for this connection, in 10ms unit. Valid range is * from 10 (0.1s) to 3200 (32s) * @param status {@link BluetoothGatt#GATT_SUCCESS} if the connection has been updated * successfully * @hide */ public void onConnectionUpdated(BluetoothGatt gatt, int interval, int latency, int timeout, int status) { } } framework/java/android/bluetooth/BluetoothGattServer.java +34 −9 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Application interface registered - app is ready to go * @hide */ @Override public void onServerRegistered(int status, int serverIf) { if (DBG) Log.d(TAG, "onServerRegistered() - status=" + status + " serverIf=" + serverIf); Loading @@ -79,19 +80,11 @@ public final class BluetoothGattServer implements BluetoothProfile { } } /** * Callback reporting an LE scan result. * @hide */ public void onScanResult(String address, int rssi, byte[] advData) { if (VDBG) Log.d(TAG, "onScanResult() - Device=" + address + " RSSI=" +rssi); // no op } /** * Server connection state changed * @hide */ @Override public void onServerConnectionState(int status, int serverIf, boolean connected, String address) { if (DBG) Log.d(TAG, "onServerConnectionState() - status=" + status Loading @@ -109,6 +102,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Service has been added * @hide */ @Override public void onServiceAdded(int status, BluetoothGattService service) { if (DBG) Log.d(TAG, "onServiceAdded() - handle=" + service.getInstanceId() + " uuid=" + service.getUuid() + " status=" + status); Loading Loading @@ -149,6 +143,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client characteristic read request. * @hide */ @Override public void onCharacteristicReadRequest(String address, int transId, int offset, boolean isLong, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicReadRequest() - handle=" + handle); Loading @@ -171,6 +166,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client descriptor read request. * @hide */ @Override public void onDescriptorReadRequest(String address, int transId, int offset, boolean isLong, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicReadRequest() - handle=" + handle); Loading @@ -193,6 +189,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client characteristic write request. * @hide */ @Override public void onCharacteristicWriteRequest(String address, int transId, int offset, int length, boolean isPrep, boolean needRsp, int handle, byte[] value) { Loading @@ -218,6 +215,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client descriptor write request. * @hide */ @Override public void onDescriptorWriteRequest(String address, int transId, int offset, int length, boolean isPrep, boolean needRsp, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onDescriptorWriteRequest() - handle=" + handle); Loading @@ -241,6 +239,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Execute pending writes. * @hide */ @Override public void onExecuteWrite(String address, int transId, boolean execWrite) { if (DBG) Log.d(TAG, "onExecuteWrite() - " Loading @@ -261,6 +260,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * A notification/indication has been sent. * @hide */ @Override public void onNotificationSent(String address, int status) { if (VDBG) Log.d(TAG, "onNotificationSent() - " + "device=" + address + ", status=" + status); Loading @@ -279,6 +279,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * The MTU for a connection has changed * @hide */ @Override public void onMtuChanged(String address, int mtu) { if (DBG) Log.d(TAG, "onMtuChanged() - " + "device=" + address + ", mtu=" + mtu); Loading @@ -297,6 +298,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * The PHY for a connection was updated * @hide */ @Override public void onPhyUpdate(String address, int txPhy, int rxPhy, int status) { if (DBG) Log.d(TAG, "onPhyUpdate() - " + "device=" + address + ", txPHy=" + txPhy + ", rxPHy=" + rxPhy); Loading @@ -315,6 +317,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * The PHY for a connection was read * @hide */ @Override public void onPhyRead(String address, int txPhy, int rxPhy, int status) { if (DBG) Log.d(TAG, "onPhyUpdate() - " + "device=" + address + ", txPHy=" + txPhy + ", rxPHy=" + rxPhy); Loading @@ -328,6 +331,28 @@ public final class BluetoothGattServer implements BluetoothProfile { Log.w(TAG, "Unhandled exception: " + ex); } } /** * Callback invoked when the given connection is updated * @hide */ @Override public void onConnectionUpdated(String address, int interval, int latency, int timeout, int status) { if (DBG) Log.d(TAG, "onConnectionUpdated() - Device=" + address + " interval=" + interval + " latency=" + latency + " timeout=" + timeout + " status=" + status); BluetoothDevice device = mAdapter.getRemoteDevice(address); if (device == null) return; try { mCallback.onConnectionUpdated(device, interval, latency, timeout, status); } catch (Exception ex) { Log.w(TAG, "Unhandled exception: " + ex); } } }; /** Loading framework/java/android/bluetooth/BluetoothGattServerCallback.java +19 −0 Original line number Diff line number Diff line Loading @@ -184,4 +184,23 @@ public abstract class BluetoothGattServerCallback { */ public void onPhyRead(BluetoothDevice device, int txPhy, int rxPhy, int status) { } /** * Callback indicating the connection parameters were updated. * * @param device The remote device involved * @param interval Connection interval used on this connection, 1.25ms unit. Valid * range is from 6 (7.5ms) to 3200 (4000ms). * @param latency Slave latency for the connection in number of connection events. Valid * range is from 0 to 499 * @param timeout Supervision timeout for this connection, in 10ms unit. Valid range is * from 10 (0.1s) to 3200 (32s) * @param status {@link BluetoothGatt#GATT_SUCCESS} if the connection has been updated * successfully * @hide */ public void onConnectionUpdated(BluetoothDevice gatt, int interval, int latency, int timeout, int status) { } } framework/java/android/bluetooth/IBluetoothGattCallbackExt.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,6 @@ oneway interface IBluetoothGattCallbackExt { void onNotify(in String address, in int handle, in byte[] value); void onReadRemoteRssi(in String address, in int rssi, in int status); void onConfigureMTU(in String address, in int mtu, in int status); void onConnectionUpdated(in String address, in int interval, in int latency, in int timeout, in int status); } Loading
framework/java/android/bluetooth/BluetoothGatt.java +32 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Application interface registered - app is ready to go * @hide */ @Override public void onClientRegistered(int status, int clientIf) { if (DBG) Log.d(TAG, "onClientRegistered() - status=" + status + " clientIf=" + clientIf); Loading Loading @@ -210,6 +211,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Client connection state changed * @hide */ @Override public void onClientConnectionState(int status, int clientIf, boolean connected, String address) { if (DBG) Log.d(TAG, "onClientConnectionState() - status=" + status Loading Loading @@ -245,6 +247,7 @@ public final class BluetoothGatt implements BluetoothProfile { * we are done at this point. * @hide */ @Override public void onSearchComplete(String address, List<BluetoothGattService> services, int status) { if (DBG) Log.d(TAG, "onSearchComplete() = Device=" + address + " Status=" + status); Loading Loading @@ -288,6 +291,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Updates the internal value. * @hide */ @Override public void onCharacteristicRead(String address, int status, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onCharacteristicRead() - Device=" + address + " handle=" + handle + " Status=" + status); Loading Loading @@ -336,6 +340,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Let the app know how we did... * @hide */ @Override public void onCharacteristicWrite(String address, int status, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicWrite() - Device=" + address + " handle=" + handle + " Status=" + status); Loading Loading @@ -380,6 +385,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Updates the internal value. * @hide */ @Override public void onNotify(String address, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onNotify() - Device=" + address + " handle=" + handle); Loading @@ -403,6 +409,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Descriptor has been read. * @hide */ @Override public void onDescriptorRead(String address, int status, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onDescriptorRead() - Device=" + address + " handle=" + handle); Loading Loading @@ -446,6 +453,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Descriptor write operation complete. * @hide */ @Override public void onDescriptorWrite(String address, int status, int handle) { if (VDBG) Log.d(TAG, "onDescriptorWrite() - Device=" + address + " handle=" + handle); Loading Loading @@ -488,6 +496,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Prepared write transaction completed (or aborted) * @hide */ @Override public void onExecuteWrite(String address, int status) { if (VDBG) Log.d(TAG, "onExecuteWrite() - Device=" + address + " status=" + status); Loading @@ -510,6 +519,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Remote device RSSI has been read * @hide */ @Override public void onReadRemoteRssi(String address, int rssi, int status) { if (VDBG) Log.d(TAG, "onReadRemoteRssi() - Device=" + address + " rssi=" + rssi + " status=" + status); Loading @@ -527,6 +537,7 @@ public final class BluetoothGatt implements BluetoothProfile { * Callback invoked when the MTU for a given connection changes * @hide */ @Override public void onConfigureMTU(String address, int mtu, int status) { if (DBG) Log.d(TAG, "onConfigureMTU() - Device=" + address + " mtu=" + mtu + " status=" + status); Loading @@ -539,6 +550,27 @@ public final class BluetoothGatt implements BluetoothProfile { Log.w(TAG, "Unhandled exception in callback", ex); } } /** * Callback invoked when the given connection is updated * @hide */ @Override public void onConnectionUpdated(String address, int interval, int latency, int timeout, int status) { if (DBG) Log.d(TAG, "onConnectionUpdated() - Device=" + address + " interval=" + interval + " latency=" + latency + " timeout=" + timeout + " status=" + status); if (!address.equals(mDevice.getAddress())) { return; } try { mCallback.onConnectionUpdated(BluetoothGatt.this, interval, latency, timeout, status); } catch (Exception ex) { Log.w(TAG, "Unhandled exception in callback", ex); } } }; /*package*/ BluetoothGatt(IBluetoothGatt iGatt, BluetoothDevice device, Loading
framework/java/android/bluetooth/BluetoothGattCallback.java +18 −0 Original line number Diff line number Diff line Loading @@ -179,4 +179,22 @@ public abstract class BluetoothGattCallback{ */ public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) { } /** * Callback indicating the connection parameters were updated. * * @param gatt GATT client involved * @param interval Connection interval used on this connection, 1.25ms unit. Valid * range is from 6 (7.5ms) to 3200 (4000ms). * @param latency Slave latency for the connection in number of connection events. Valid * range is from 0 to 499 * @param timeout Supervision timeout for this connection, in 10ms unit. Valid range is * from 10 (0.1s) to 3200 (32s) * @param status {@link BluetoothGatt#GATT_SUCCESS} if the connection has been updated * successfully * @hide */ public void onConnectionUpdated(BluetoothGatt gatt, int interval, int latency, int timeout, int status) { } }
framework/java/android/bluetooth/BluetoothGattServer.java +34 −9 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Application interface registered - app is ready to go * @hide */ @Override public void onServerRegistered(int status, int serverIf) { if (DBG) Log.d(TAG, "onServerRegistered() - status=" + status + " serverIf=" + serverIf); Loading @@ -79,19 +80,11 @@ public final class BluetoothGattServer implements BluetoothProfile { } } /** * Callback reporting an LE scan result. * @hide */ public void onScanResult(String address, int rssi, byte[] advData) { if (VDBG) Log.d(TAG, "onScanResult() - Device=" + address + " RSSI=" +rssi); // no op } /** * Server connection state changed * @hide */ @Override public void onServerConnectionState(int status, int serverIf, boolean connected, String address) { if (DBG) Log.d(TAG, "onServerConnectionState() - status=" + status Loading @@ -109,6 +102,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Service has been added * @hide */ @Override public void onServiceAdded(int status, BluetoothGattService service) { if (DBG) Log.d(TAG, "onServiceAdded() - handle=" + service.getInstanceId() + " uuid=" + service.getUuid() + " status=" + status); Loading Loading @@ -149,6 +143,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client characteristic read request. * @hide */ @Override public void onCharacteristicReadRequest(String address, int transId, int offset, boolean isLong, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicReadRequest() - handle=" + handle); Loading @@ -171,6 +166,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client descriptor read request. * @hide */ @Override public void onDescriptorReadRequest(String address, int transId, int offset, boolean isLong, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicReadRequest() - handle=" + handle); Loading @@ -193,6 +189,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client characteristic write request. * @hide */ @Override public void onCharacteristicWriteRequest(String address, int transId, int offset, int length, boolean isPrep, boolean needRsp, int handle, byte[] value) { Loading @@ -218,6 +215,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Remote client descriptor write request. * @hide */ @Override public void onDescriptorWriteRequest(String address, int transId, int offset, int length, boolean isPrep, boolean needRsp, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onDescriptorWriteRequest() - handle=" + handle); Loading @@ -241,6 +239,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * Execute pending writes. * @hide */ @Override public void onExecuteWrite(String address, int transId, boolean execWrite) { if (DBG) Log.d(TAG, "onExecuteWrite() - " Loading @@ -261,6 +260,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * A notification/indication has been sent. * @hide */ @Override public void onNotificationSent(String address, int status) { if (VDBG) Log.d(TAG, "onNotificationSent() - " + "device=" + address + ", status=" + status); Loading @@ -279,6 +279,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * The MTU for a connection has changed * @hide */ @Override public void onMtuChanged(String address, int mtu) { if (DBG) Log.d(TAG, "onMtuChanged() - " + "device=" + address + ", mtu=" + mtu); Loading @@ -297,6 +298,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * The PHY for a connection was updated * @hide */ @Override public void onPhyUpdate(String address, int txPhy, int rxPhy, int status) { if (DBG) Log.d(TAG, "onPhyUpdate() - " + "device=" + address + ", txPHy=" + txPhy + ", rxPHy=" + rxPhy); Loading @@ -315,6 +317,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * The PHY for a connection was read * @hide */ @Override public void onPhyRead(String address, int txPhy, int rxPhy, int status) { if (DBG) Log.d(TAG, "onPhyUpdate() - " + "device=" + address + ", txPHy=" + txPhy + ", rxPHy=" + rxPhy); Loading @@ -328,6 +331,28 @@ public final class BluetoothGattServer implements BluetoothProfile { Log.w(TAG, "Unhandled exception: " + ex); } } /** * Callback invoked when the given connection is updated * @hide */ @Override public void onConnectionUpdated(String address, int interval, int latency, int timeout, int status) { if (DBG) Log.d(TAG, "onConnectionUpdated() - Device=" + address + " interval=" + interval + " latency=" + latency + " timeout=" + timeout + " status=" + status); BluetoothDevice device = mAdapter.getRemoteDevice(address); if (device == null) return; try { mCallback.onConnectionUpdated(device, interval, latency, timeout, status); } catch (Exception ex) { Log.w(TAG, "Unhandled exception: " + ex); } } }; /** Loading
framework/java/android/bluetooth/BluetoothGattServerCallback.java +19 −0 Original line number Diff line number Diff line Loading @@ -184,4 +184,23 @@ public abstract class BluetoothGattServerCallback { */ public void onPhyRead(BluetoothDevice device, int txPhy, int rxPhy, int status) { } /** * Callback indicating the connection parameters were updated. * * @param device The remote device involved * @param interval Connection interval used on this connection, 1.25ms unit. Valid * range is from 6 (7.5ms) to 3200 (4000ms). * @param latency Slave latency for the connection in number of connection events. Valid * range is from 0 to 499 * @param timeout Supervision timeout for this connection, in 10ms unit. Valid range is * from 10 (0.1s) to 3200 (32s) * @param status {@link BluetoothGatt#GATT_SUCCESS} if the connection has been updated * successfully * @hide */ public void onConnectionUpdated(BluetoothDevice gatt, int interval, int latency, int timeout, int status) { } }
framework/java/android/bluetooth/IBluetoothGattCallbackExt.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,6 @@ oneway interface IBluetoothGattCallbackExt { void onNotify(in String address, in int handle, in byte[] value); void onReadRemoteRssi(in String address, in int rssi, in int status); void onConfigureMTU(in String address, in int mtu, in int status); void onConnectionUpdated(in String address, in int interval, in int latency, in int timeout, in int status); }