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

Commit 77bb5f09 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Discover primary service by UUID for PTS tests (3/4)"

parents fa3d29eb 84685c0e
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
@@ -425,6 +425,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;
@@ -1684,6 +1690,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");

@@ -2495,6 +2512,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);