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

Commit 00940402 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Jakub Pawlowski
Browse files

gatt: Allow to set eatt_support

With this patch it is possible to enable eatt_support
as a GATT Client or GATT Server.

Sponsor: jpawlowski@
Tag: #feature
Test: manually verified against device supporting EATT
Bug: 159786353
Change-Id: Ibb62bd190cbc7dd208e61f6fb5c51c482de86824
parent 687256f0
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1136,11 +1136,11 @@ static int gattClientGetDeviceTypeNative(JNIEnv* env, jobject object,
}

static void gattClientRegisterAppNative(JNIEnv* env, jobject object,
                                        jlong app_uuid_lsb,
                                        jlong app_uuid_msb) {
                                        jlong app_uuid_lsb, jlong app_uuid_msb,
                                        jboolean eatt_support) {
  if (!sGattIf) return;
  Uuid uuid = from_java_uuid(app_uuid_msb, app_uuid_lsb);
  sGattIf->client->register_client(uuid);
  sGattIf->client->register_client(uuid, eatt_support);
}

static void gattClientUnregisterAppNative(JNIEnv* env, jobject object,
@@ -1657,11 +1657,11 @@ static void gattClientReadScanReportsNative(JNIEnv* env, jobject object,
 * Native server functions
 */
static void gattServerRegisterAppNative(JNIEnv* env, jobject object,
                                        jlong app_uuid_lsb,
                                        jlong app_uuid_msb) {
                                        jlong app_uuid_lsb, jlong app_uuid_msb,
                                        jboolean eatt_support) {
  if (!sGattIf) return;
  Uuid uuid = from_java_uuid(app_uuid_msb, app_uuid_lsb);
  sGattIf->server->register_server(uuid);
  sGattIf->server->register_server(uuid, eatt_support);
}

static void gattServerUnregisterAppNative(JNIEnv* env, jobject object,
@@ -2334,7 +2334,7 @@ static JNINativeMethod sMethods[] = {
    {"cleanupNative", "()V", (void*)cleanupNative},
    {"gattClientGetDeviceTypeNative", "(Ljava/lang/String;)I",
     (void*)gattClientGetDeviceTypeNative},
    {"gattClientRegisterAppNative", "(JJ)V",
    {"gattClientRegisterAppNative", "(JJZ)V",
     (void*)gattClientRegisterAppNative},
    {"gattClientUnregisterAppNative", "(I)V",
     (void*)gattClientUnregisterAppNative},
@@ -2373,7 +2373,7 @@ static JNINativeMethod sMethods[] = {
     (void*)gattClientConfigureMTUNative},
    {"gattConnectionParameterUpdateNative", "(ILjava/lang/String;IIIIII)V",
     (void*)gattConnectionParameterUpdateNative},
    {"gattServerRegisterAppNative", "(JJ)V",
    {"gattServerRegisterAppNative", "(JJZ)V",
     (void*)gattServerRegisterAppNative},
    {"gattServerUnregisterAppNative", "(I)V",
     (void*)gattServerUnregisterAppNative},
+11 −10
Original line number Diff line number Diff line
@@ -442,12 +442,12 @@ public class GattService extends ProfileService {
        }

        @Override
        public void registerClient(ParcelUuid uuid, IBluetoothGattCallback callback) {
        public void registerClient(ParcelUuid uuid, IBluetoothGattCallback callback, boolean eatt_support) {
            GattService service = getService();
            if (service == null) {
                return;
            }
            service.registerClient(uuid.getUuid(), callback);
            service.registerClient(uuid.getUuid(), callback, eatt_support);
        }

        @Override
@@ -715,12 +715,13 @@ public class GattService extends ProfileService {
        }

        @Override
        public void registerServer(ParcelUuid uuid, IBluetoothGattServerCallback callback) {
        public void registerServer(ParcelUuid uuid, IBluetoothGattServerCallback callback,
                                   boolean eatt_support) {
            GattService service = getService();
            if (service == null) {
                return;
            }
            service.registerServer(uuid.getUuid(), callback);
            service.registerServer(uuid.getUuid(), callback, eatt_support);
        }

        @Override
@@ -2319,14 +2320,14 @@ public class GattService extends ProfileService {
     * GATT Service functions - CLIENT
     *************************************************************************/

    void registerClient(UUID uuid, IBluetoothGattCallback callback) {
    void registerClient(UUID uuid, IBluetoothGattCallback callback, boolean eatt_support) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");

        if (DBG) {
            Log.d(TAG, "registerClient() - UUID=" + uuid);
        }
        mClientMap.add(uuid, null, callback, null, this);
        gattClientRegisterAppNative(uuid.getLeastSignificantBits(), uuid.getMostSignificantBits());
        gattClientRegisterAppNative(uuid.getLeastSignificantBits(), uuid.getMostSignificantBits(), eatt_support);
    }

    void unregisterClient(int clientIf) {
@@ -2984,14 +2985,14 @@ public class GattService extends ProfileService {
     * GATT Service functions - SERVER
     *************************************************************************/

    void registerServer(UUID uuid, IBluetoothGattServerCallback callback) {
    void registerServer(UUID uuid, IBluetoothGattServerCallback callback, boolean eatt_support) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");

        if (DBG) {
            Log.d(TAG, "registerServer() - UUID=" + uuid);
        }
        mServerMap.add(uuid, null, callback, null, this);
        gattServerRegisterAppNative(uuid.getLeastSignificantBits(), uuid.getMostSignificantBits());
        gattServerRegisterAppNative(uuid.getLeastSignificantBits(), uuid.getMostSignificantBits(), eatt_support);
    }

    void unregisterServer(int serverIf) {
@@ -3403,7 +3404,7 @@ public class GattService extends ProfileService {

    private native int gattClientGetDeviceTypeNative(String address);

    private native void gattClientRegisterAppNative(long appUuidLsb, long appUuidMsb);
    private native void gattClientRegisterAppNative(long appUuidLsb, long appUuidMsb, boolean eatt_support);

    private native void gattClientUnregisterAppNative(int clientIf);

@@ -3453,7 +3454,7 @@ public class GattService extends ProfileService {
            int minInterval, int maxInterval, int latency, int timeout, int minConnectionEventLen,
            int maxConnectionEventLen);

    private native void gattServerRegisterAppNative(long appUuidLsb, long appUuidMsb);
    private native void gattServerRegisterAppNative(long appUuidLsb, long appUuidMsb, boolean eatt_support);

    private native void gattServerUnregisterAppNative(int serverIf);