summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorSudhir Sharma <sudhshar@codeaurora.org>2015-03-10 01:21:10 -0700
committerSudhir Sharma <sudhshar@codeaurora.org>2015-03-10 15:27:58 -0700
commit9d81dc62517d86b1fccc65bcf87193819ce7c66d (patch)
tree6f7aa485047446c6cd41ea9d7f2617a4270cab1e /jni
parentbb5835ad23b6357bb98848a481c971cc169739a9 (diff)
parent2ab3133a5c3a70fe1184ba8ff63ac3365f648a4e (diff)
downloadandroid_packages_apps_Bluetooth-9d81dc62517d86b1fccc65bcf87193819ce7c66d.tar.gz
android_packages_apps_Bluetooth-9d81dc62517d86b1fccc65bcf87193819ce7c66d.tar.bz2
android_packages_apps_Bluetooth-9d81dc62517d86b1fccc65bcf87193819ce7c66d.zip
Merge tag 'android-5.1.0_r1' into HEAD
Android 5.1.0 release 1 Conflicts: src/com/android/bluetooth/btservice/AdapterService.java src/com/android/bluetooth/gatt/AdvertiseManager.java src/com/android/bluetooth/gatt/ScanManager.java src/com/android/bluetooth/hfp/HeadsetPhoneState.java src/com/android/bluetooth/hfp/HeadsetStateMachine.java src/com/android/bluetooth/map/BluetoothMapContent.java src/com/android/bluetooth/map/BluetoothMapContentObserver.java src/com/android/bluetooth/map/BluetoothMapEmailSettingsLoader.java src/com/android/bluetooth/map/BluetoothMapObexServer.java src/com/android/bluetooth/map/BluetoothMapService.java src/com/android/bluetooth/opp/BluetoothOppIncomingFileConfirmActivity.java src/com/android/bluetooth/opp/BluetoothOppService.java src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java Change-Id: Ic7a754ea29d6124d7e53b6f13eed181d3f7e64e5
Diffstat (limited to 'jni')
-rw-r--r--jni/com_android_bluetooth_btservice_AdapterService.cpp6
-rw-r--r--jni/com_android_bluetooth_gatt.cpp16
2 files changed, 16 insertions, 6 deletions
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp
index b75ad1b7f..cb917976e 100644
--- a/jni/com_android_bluetooth_btservice_AdapterService.cpp
+++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp
@@ -973,7 +973,7 @@ static jboolean cancelBondNative(JNIEnv* env, jobject obj, jbyteArray address) {
return result;
}
-static jboolean isConnectedNative(JNIEnv* env, jobject obj, jbyteArray address) {
+static int getConnectionStateNative(JNIEnv* env, jobject obj, jbyteArray address) {
ALOGV("%s:",__FUNCTION__);
if (!sBluetoothInterface) return JNI_FALSE;
@@ -986,7 +986,7 @@ static jboolean isConnectedNative(JNIEnv* env, jobject obj, jbyteArray address)
int ret = sBluetoothInterface->get_connection_state((bt_bdaddr_t *)addr);
env->ReleaseByteArrayElements(address, addr, 0);
- return (ret != 0 ? JNI_TRUE : JNI_FALSE);
+ return ret;
}
static jboolean pinReplyNative(JNIEnv *env, jobject obj, jbyteArray address, jboolean accept,
@@ -1366,7 +1366,7 @@ static JNINativeMethod sMethods[] = {
{"createBondNative", "([BI)Z", (void*) createBondNative},
{"removeBondNative", "([B)Z", (void*) removeBondNative},
{"cancelBondNative", "([B)Z", (void*) cancelBondNative},
- {"isConnectedNative", "([B)Z", (void*) isConnectedNative},
+ {"getConnectionStateNative", "([B)I", (void*) getConnectionStateNative},
{"pinReplyNative", "([BZI[B)Z", (void*) pinReplyNative},
{"sspReplyNative", "([BIZI)Z", (void*) sspReplyNative},
{"getRemoteServicesNative", "([B)Z", (void*) getRemoteServicesNative},
diff --git a/jni/com_android_bluetooth_gatt.cpp b/jni/com_android_bluetooth_gatt.cpp
index 921ad83b3..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!");
}
@@ -1715,6 +1725,8 @@ static JNINativeMethod sAdvertiseMethods[] = {
{"gattClientUpdateAdvNative", "(IIIIIII)V", (void *) gattClientUpdateAdvNative},
{"gattClientSetAdvDataNative", "(IZZZI[B[B[B)V", (void *) gattClientSetAdvDataNative},
{"gattClientDisableAdvNative", "(I)V", (void *) gattClientDisableAdvNative},
+ {"gattSetAdvDataNative", "(IZZZIII[B[B[B)V", (void *) gattSetAdvDataNative},
+ {"gattAdvertiseNative", "(IZ)V", (void *) gattAdvertiseNative},
};
// JNI functions defined in ScanManager class.
@@ -1758,7 +1770,6 @@ static JNINativeMethod sMethods[] = {
{"gattClientExecuteWriteNative", "(IZ)V", (void *) gattClientExecuteWriteNative},
{"gattClientRegisterForNotificationsNative", "(ILjava/lang/String;IIJJIJJZ)V", (void *) gattClientRegisterForNotificationsNative},
{"gattClientReadRemoteRssiNative", "(ILjava/lang/String;)V", (void *) gattClientReadRemoteRssiNative},
- {"gattAdvertiseNative", "(IZ)V", (void *) gattAdvertiseNative},
{"gattClientConfigureMTUNative", "(II)V", (void *) gattClientConfigureMTUNative},
{"gattConnectionParameterUpdateNative", "(ILjava/lang/String;IIII)V", (void *) gattConnectionParameterUpdateNative},
{"gattServerRegisterAppNative", "(JJ)V", (void *) gattServerRegisterAppNative},
@@ -1776,7 +1787,6 @@ static JNINativeMethod sMethods[] = {
{"gattServerSendNotificationNative", "(III[B)V", (void *) gattServerSendNotificationNative},
{"gattServerSendResponseNative", "(IIIIII[BI)V", (void *) gattServerSendResponseNative},
- {"gattSetAdvDataNative", "(IZZZIII[B[B[B)V", (void *) gattSetAdvDataNative},
{"gattTestNative", "(IJJLjava/lang/String;IIIII)V", (void *) gattTestNative},
};