Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c642dde authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Discover primary service by UUID for PTS tests (3/4)" am: 77bb5f09 am: 543193e1

am: f816a4d8

Change-Id: Ia543419909e3fac09df6c08bcdb9f28acf79678d
parents 1a5175a8 f816a4d8
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1069,6 +1069,17 @@ static void gattClientSearchServiceNative(JNIEnv* env, jobject object,
  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,
                                      jint conn_id) {
  if (!sGattIf) return;
@@ -2172,6 +2183,8 @@ static JNINativeMethod sMethods[] = {
     (void*)gattClientRefreshNative},
    {"gattClientSearchServiceNative", "(IZJJ)V",
     (void*)gattClientSearchServiceNative},
    {"gattClientDiscoverServiceByUuidNative", "(IJJ)V",
     (void*)gattClientDiscoverServiceByUuidNative},
    {"gattClientGetGattDbNative", "(I)V", (void*)gattClientGetGattDbNative},
    {"gattClientReadCharacteristicNative", "(III)V",
     (void*)gattClientReadCharacteristicNative},
+20 −0
Original line number Diff line number Diff line
@@ -458,6 +458,12 @@ public class GattService extends ProfileService {
            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) {
            GattService service = getService();
            if (service == null) return;
@@ -1869,6 +1875,17 @@ public class GattService extends ProfileService {
            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) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");

@@ -2680,6 +2697,9 @@ public class GattService extends ProfileService {
    private native void gattClientSearchServiceNative(int conn_id,
            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 gattClientReadCharacteristicNative(int conn_id, int handle, int authReq);