Loading jni/com_android_bluetooth_gatt.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -1069,6 +1069,17 @@ static void gattClientSearchServiceNative(JNIEnv* env, jobject object, sGattIf->client->search_service(conn_id, search_all ? 0 : &uuid); sGattIf->client->search_service(conn_id, search_all ? 0 : &uuid); } } static void gattClientDiscoverServiceByUuidNative(JNIEnv* env, jobject object, jint conn_id, jlong service_uuid_lsb, jlong service_uuid_msb) { if (!sGattIf) return; bt_uuid_t uuid; set_uuid(uuid.uu, service_uuid_msb, service_uuid_lsb); sGattIf->client->btif_gattc_discover_service_by_uuid(conn_id, &uuid); } static void gattClientGetGattDbNative(JNIEnv* env, jobject object, static void gattClientGetGattDbNative(JNIEnv* env, jobject object, jint conn_id) { jint conn_id) { if (!sGattIf) return; if (!sGattIf) return; Loading Loading @@ -2172,6 +2183,8 @@ static JNINativeMethod sMethods[] = { (void*)gattClientRefreshNative}, (void*)gattClientRefreshNative}, {"gattClientSearchServiceNative", "(IZJJ)V", {"gattClientSearchServiceNative", "(IZJJ)V", (void*)gattClientSearchServiceNative}, (void*)gattClientSearchServiceNative}, {"gattClientDiscoverServiceByUuidNative", "(IJJ)V", (void*)gattClientDiscoverServiceByUuidNative}, {"gattClientGetGattDbNative", "(I)V", (void*)gattClientGetGattDbNative}, {"gattClientGetGattDbNative", "(I)V", (void*)gattClientGetGattDbNative}, {"gattClientReadCharacteristicNative", "(III)V", {"gattClientReadCharacteristicNative", "(III)V", (void*)gattClientReadCharacteristicNative}, (void*)gattClientReadCharacteristicNative}, Loading src/com/android/bluetooth/gatt/GattService.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -458,6 +458,12 @@ public class GattService extends ProfileService { service.discoverServices(clientIf, address); service.discoverServices(clientIf, address); } } public void discoverServiceByUuid(int clientIf, String address, ParcelUuid uuid) { GattService service = getService(); if (service == null) return; service.discoverServiceByUuid(clientIf, address, uuid.getUuid()); } public void readCharacteristic(int clientIf, String address, int handle, int authReq) { public void readCharacteristic(int clientIf, String address, int handle, int authReq) { GattService service = getService(); GattService service = getService(); if (service == null) return; if (service == null) return; Loading Loading @@ -1869,6 +1875,17 @@ public class GattService extends ProfileService { Log.e(TAG, "discoverServices() - No connection for " + address + "..."); Log.e(TAG, "discoverServices() - No connection for " + address + "..."); } } void discoverServiceByUuid(int clientIf, String address, UUID uuid) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); Integer connId = mClientMap.connIdByAddress(clientIf, address); if (connId != null) gattClientDiscoverServiceByUuidNative( connId, uuid.getLeastSignificantBits(), uuid.getMostSignificantBits()); else Log.e(TAG, "discoverServiceByUuid() - No connection for " + address + "..."); } void readCharacteristic(int clientIf, String address, int handle, int authReq) { void readCharacteristic(int clientIf, String address, int handle, int authReq) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); Loading Loading @@ -2680,6 +2697,9 @@ public class GattService extends ProfileService { private native void gattClientSearchServiceNative(int conn_id, private native void gattClientSearchServiceNative(int conn_id, boolean search_all, long service_uuid_lsb, long service_uuid_msb); boolean search_all, long service_uuid_lsb, long service_uuid_msb); private native void gattClientDiscoverServiceByUuidNative( int conn_id, long service_uuid_lsb, long service_uuid_msb); private native void gattClientGetGattDbNative(int conn_id); private native void gattClientGetGattDbNative(int conn_id); private native void gattClientReadCharacteristicNative(int conn_id, int handle, int authReq); private native void gattClientReadCharacteristicNative(int conn_id, int handle, int authReq); Loading Loading
jni/com_android_bluetooth_gatt.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -1069,6 +1069,17 @@ static void gattClientSearchServiceNative(JNIEnv* env, jobject object, sGattIf->client->search_service(conn_id, search_all ? 0 : &uuid); sGattIf->client->search_service(conn_id, search_all ? 0 : &uuid); } } static void gattClientDiscoverServiceByUuidNative(JNIEnv* env, jobject object, jint conn_id, jlong service_uuid_lsb, jlong service_uuid_msb) { if (!sGattIf) return; bt_uuid_t uuid; set_uuid(uuid.uu, service_uuid_msb, service_uuid_lsb); sGattIf->client->btif_gattc_discover_service_by_uuid(conn_id, &uuid); } static void gattClientGetGattDbNative(JNIEnv* env, jobject object, static void gattClientGetGattDbNative(JNIEnv* env, jobject object, jint conn_id) { jint conn_id) { if (!sGattIf) return; if (!sGattIf) return; Loading Loading @@ -2172,6 +2183,8 @@ static JNINativeMethod sMethods[] = { (void*)gattClientRefreshNative}, (void*)gattClientRefreshNative}, {"gattClientSearchServiceNative", "(IZJJ)V", {"gattClientSearchServiceNative", "(IZJJ)V", (void*)gattClientSearchServiceNative}, (void*)gattClientSearchServiceNative}, {"gattClientDiscoverServiceByUuidNative", "(IJJ)V", (void*)gattClientDiscoverServiceByUuidNative}, {"gattClientGetGattDbNative", "(I)V", (void*)gattClientGetGattDbNative}, {"gattClientGetGattDbNative", "(I)V", (void*)gattClientGetGattDbNative}, {"gattClientReadCharacteristicNative", "(III)V", {"gattClientReadCharacteristicNative", "(III)V", (void*)gattClientReadCharacteristicNative}, (void*)gattClientReadCharacteristicNative}, Loading
src/com/android/bluetooth/gatt/GattService.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -458,6 +458,12 @@ public class GattService extends ProfileService { service.discoverServices(clientIf, address); service.discoverServices(clientIf, address); } } public void discoverServiceByUuid(int clientIf, String address, ParcelUuid uuid) { GattService service = getService(); if (service == null) return; service.discoverServiceByUuid(clientIf, address, uuid.getUuid()); } public void readCharacteristic(int clientIf, String address, int handle, int authReq) { public void readCharacteristic(int clientIf, String address, int handle, int authReq) { GattService service = getService(); GattService service = getService(); if (service == null) return; if (service == null) return; Loading Loading @@ -1869,6 +1875,17 @@ public class GattService extends ProfileService { Log.e(TAG, "discoverServices() - No connection for " + address + "..."); Log.e(TAG, "discoverServices() - No connection for " + address + "..."); } } void discoverServiceByUuid(int clientIf, String address, UUID uuid) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); Integer connId = mClientMap.connIdByAddress(clientIf, address); if (connId != null) gattClientDiscoverServiceByUuidNative( connId, uuid.getLeastSignificantBits(), uuid.getMostSignificantBits()); else Log.e(TAG, "discoverServiceByUuid() - No connection for " + address + "..."); } void readCharacteristic(int clientIf, String address, int handle, int authReq) { void readCharacteristic(int clientIf, String address, int handle, int authReq) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); Loading Loading @@ -2680,6 +2697,9 @@ public class GattService extends ProfileService { private native void gattClientSearchServiceNative(int conn_id, private native void gattClientSearchServiceNative(int conn_id, boolean search_all, long service_uuid_lsb, long service_uuid_msb); boolean search_all, long service_uuid_lsb, long service_uuid_msb); private native void gattClientDiscoverServiceByUuidNative( int conn_id, long service_uuid_lsb, long service_uuid_msb); private native void gattClientGetGattDbNative(int conn_id); private native void gattClientGetGattDbNative(int conn_id); private native void gattClientReadCharacteristicNative(int conn_id, int handle, int authReq); private native void gattClientReadCharacteristicNative(int conn_id, int handle, int authReq); Loading