Loading android/app/jni/com_android_bluetooth_gatt.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -191,6 +191,7 @@ static jmethodID method_onAttributeWrite; static jmethodID method_onExecuteWrite; static jmethodID method_onNotificationSent; static jmethodID method_onServerCongestion; static jmethodID method_onServerMtuChanged; /** * Static variables Loading Loading @@ -774,6 +775,13 @@ void btgatts_congestion_cb(int conn_id, bool congested) checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); } void btgatts_mtu_changed_cb(int conn_id, int mtu) { CHECK_CALLBACK_ENV sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onServerMtuChanged, conn_id, mtu); checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); } static const btgatt_server_callbacks_t sGattServerCallbacks = { btgatts_register_app_cb, btgatts_connection_cb, Loading @@ -789,7 +797,8 @@ static const btgatt_server_callbacks_t sGattServerCallbacks = { btgatts_request_exec_write_cb, btgatts_response_confirmation_cb, btgatts_indication_sent_cb, btgatts_congestion_cb btgatts_congestion_cb, btgatts_mtu_changed_cb }; /** Loading Loading @@ -859,6 +868,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_onExecuteWrite= env->GetMethodID(clazz, "onExecuteWrite", "(Ljava/lang/String;III)V"); method_onNotificationSent = env->GetMethodID(clazz, "onNotificationSent", "(II)V"); method_onServerCongestion = env->GetMethodID(clazz, "onServerCongestion", "(IZ)V"); method_onServerMtuChanged = env->GetMethodID(clazz, "onMtuChanged", "(II)V"); info("classInitNative: Success!"); } Loading android/app/src/com/android/bluetooth/gatt/GattService.java +13 −7 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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; Loading Loading @@ -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 *************************************************************************/ Loading Loading
android/app/jni/com_android_bluetooth_gatt.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -191,6 +191,7 @@ static jmethodID method_onAttributeWrite; static jmethodID method_onExecuteWrite; static jmethodID method_onNotificationSent; static jmethodID method_onServerCongestion; static jmethodID method_onServerMtuChanged; /** * Static variables Loading Loading @@ -774,6 +775,13 @@ void btgatts_congestion_cb(int conn_id, bool congested) checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); } void btgatts_mtu_changed_cb(int conn_id, int mtu) { CHECK_CALLBACK_ENV sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onServerMtuChanged, conn_id, mtu); checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__); } static const btgatt_server_callbacks_t sGattServerCallbacks = { btgatts_register_app_cb, btgatts_connection_cb, Loading @@ -789,7 +797,8 @@ static const btgatt_server_callbacks_t sGattServerCallbacks = { btgatts_request_exec_write_cb, btgatts_response_confirmation_cb, btgatts_indication_sent_cb, btgatts_congestion_cb btgatts_congestion_cb, btgatts_mtu_changed_cb }; /** Loading Loading @@ -859,6 +868,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_onExecuteWrite= env->GetMethodID(clazz, "onExecuteWrite", "(Ljava/lang/String;III)V"); method_onNotificationSent = env->GetMethodID(clazz, "onNotificationSent", "(II)V"); method_onServerCongestion = env->GetMethodID(clazz, "onServerCongestion", "(IZ)V"); method_onServerMtuChanged = env->GetMethodID(clazz, "onMtuChanged", "(II)V"); info("classInitNative: Success!"); } Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +13 −7 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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; Loading Loading @@ -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 *************************************************************************/ Loading