From e632e4bb8c873f102cac7d6f39585ea06f34c082 Mon Sep 17 00:00:00 2001 From: Andre Eisenbach Date: Wed, 26 Nov 2014 12:57:58 -0800 Subject: Add server-side callback for change in MTU (3/4) When a client requests to update the LE transport MTU, the server currently does not get notified and can therefor not properly size notifications appropriate to the current MTU. Bug: 18388114 Change-Id: Ie075871cbc643bd3840e9ab472706f1565b74467 --- src/com/android/bluetooth/gatt/GattService.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/com/android/bluetooth') diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java index f67daf8a6..915d81ce7 100644 --- a/src/com/android/bluetooth/gatt/GattService.java +++ b/src/com/android/bluetooth/gatt/GattService.java @@ -1688,9 +1688,6 @@ public class GattService extends ProfileService { HandleMap.Entry entry = mHandleMap.getByHandle(attrHandle); if (entry == null) return; - if (DBG) Log.d(TAG, "onAttributeRead() UUID=" + entry.uuid - + ", serverIf=" + entry.serverIf + ", type=" + entry.type); - mHandleMap.addRequest(transId, attrHandle); ServerMap.App app = mServerMap.getById(entry.serverIf); @@ -1738,9 +1735,6 @@ public class GattService extends ProfileService { HandleMap.Entry entry = mHandleMap.getByHandle(attrHandle); if (entry == null) return; - if (DBG) Log.d(TAG, "onAttributeWrite() UUID=" + entry.uuid - + ", serverIf=" + entry.serverIf + ", type=" + entry.type); - mHandleMap.addRequest(transId, attrHandle); ServerMap.App app = mServerMap.getById(entry.serverIf); @@ -1793,7 +1787,7 @@ public class GattService extends ProfileService { } void onNotificationSent(int connId, int status) throws RemoteException { - if (DBG) Log.d(TAG, "onNotificationSent() connId=" + connId + ", status=" + status); + if (VDBG) Log.d(TAG, "onNotificationSent() connId=" + connId + ", status=" + status); String address = mServerMap.addressByConnId(connId); if (address == null) return; @@ -1825,6 +1819,18 @@ public class GattService extends ProfileService { } } + void onMtuChanged(int connId, int mtu) throws RemoteException { + if (DBG) Log.d(TAG, "onMtuChanged() - connId=" + connId + ", mtu=" + mtu); + + String address = mServerMap.addressByConnId(connId); + if (address == null) return; + + ServerMap.App app = mServerMap.getByConnId(connId); + if (app == null) return; + + app.callback.onMtuChanged(address, mtu); + } + /************************************************************************** * GATT Service functions - SERVER *************************************************************************/ -- cgit v1.2.3