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

Commit 1965d1fb authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Matthew Xie
Browse files

LE (3/3): Add application ID to connection callback

Bug: 8589393
Change-Id: Iff14aa568bac4d62920bc35ec1545384e200b53a
parent e0e31393
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ void btgatts_register_app_cb(int status, int server_if, bt_uuid_t *uuid)
    checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__);
}

void btgatts_connection_cb(int conn_id, int connected, bt_bdaddr_t *bda)
void btgatts_connection_cb(int conn_id, int server_if, int connected, bt_bdaddr_t *bda)
{
    CHECK_CALLBACK_ENV

@@ -465,7 +465,7 @@ void btgatts_connection_cb(int conn_id, int connected, bt_bdaddr_t *bda)

    jstring address = sCallbackEnv->NewStringUTF(c_address);
    sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onClientConnected,
                                 address, connected, conn_id);
                                 address, connected, conn_id, server_if);
    sCallbackEnv->DeleteLocalRef(address);
    checkAndClearExceptionFromCallback(sCallbackEnv, __FUNCTION__);
}
@@ -657,7 +657,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
     // Server callbacks

    method_onServerRegistered = env->GetMethodID(clazz, "onServerRegistered", "(IIJJ)V");
    method_onClientConnected = env->GetMethodID(clazz, "onClientConnected", "(Ljava/lang/String;ZI)V");
    method_onClientConnected = env->GetMethodID(clazz, "onClientConnected", "(Ljava/lang/String;ZII)V");
    method_onServiceAdded = env->GetMethodID(clazz, "onServiceAdded", "(IIIIJJI)V");
    method_onIncludedServiceAdded = env->GetMethodID(clazz, "onIncludedServiceAdded", "(IIII)V");
    method_onCharacteristicAdded  = env->GetMethodID(clazz, "onCharacteristicAdded", "(IIJJII)V");
+10 −10
Original line number Diff line number Diff line
@@ -1141,22 +1141,22 @@ public class GattService extends ProfileService {
        mHandleMap.deleteService(serverIf, srvcHandle);
    }

    void onClientConnected(String address, boolean connected, int connId)
    void onClientConnected(String address, boolean connected, int connId, int serverIf)
            throws RemoteException {

        if (DBG) Log.d(TAG, "onConnected() connId=" + connId
            + ", address=" + address + ", connected=" + connected);

        Iterator<ServerMap.App> i = mServerMap.mApps.iterator();
        while(i.hasNext()) {
            ServerMap.App entry = i.next();
        ServerMap.App app = mServerMap.getById(serverIf);
        if (app == null) return;

        if (connected) {
                mServerMap.addConnection(entry.id, connId, address);
            mServerMap.addConnection(serverIf, connId, address);
        } else {
                mServerMap.removeConnection(entry.id, connId);
            }
            entry.callback.onServerConnectionState((byte)0, entry.id, connected, address);
            mServerMap.removeConnection(serverIf, connId);
        }

        app.callback.onServerConnectionState((byte)0, serverIf, connected, address);
    }

    void onAttributeRead(String address, int connId, int transId,