diff options
author | Andre Eisenbach <eisenbach@google.com> | 2014-11-26 12:57:58 -0800 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2014-11-26 12:57:58 -0800 |
commit | e632e4bb8c873f102cac7d6f39585ea06f34c082 (patch) | |
tree | 16e23949b2d284a116a2c04ad8ff1d9595ce6f5f /jni | |
parent | 317f4e8911fee285fb313db47529a898e60f4da0 (diff) | |
download | android_packages_apps_Bluetooth-e632e4bb8c873f102cac7d6f39585ea06f34c082.tar.gz android_packages_apps_Bluetooth-e632e4bb8c873f102cac7d6f39585ea06f34c082.tar.bz2 android_packages_apps_Bluetooth-e632e4bb8c873f102cac7d6f39585ea06f34c082.zip |
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
Diffstat (limited to 'jni')
-rw-r--r-- | jni/com_android_bluetooth_gatt.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/jni/com_android_bluetooth_gatt.cpp b/jni/com_android_bluetooth_gatt.cpp index b85b9e911..02a0669bf 100644 --- a/jni/com_android_bluetooth_gatt.cpp +++ b/jni/com_android_bluetooth_gatt.cpp @@ -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 @@ -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, @@ -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 }; /** @@ -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!"); } |