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

Commit a2a4b28e authored by JohnLai's avatar JohnLai
Browse files

floss: pandora: Allows multiple advertisement in host.Advertise

In the current implementation, we incorrectly allow only
one advertisement on the Pandora server.

Bug: 326336280
Tag: #floss
Test: m Bluetooth
Test: pts-bot GATT/SR/GAC/BV-01-C
Flag: EXEMPT floss only changes
Change-Id: I9fb7ac2466f59baa65a86a3edd7ce4e8e2f8fbf3
parent bc75e6fa
Loading
Loading
Loading
Loading
+10 −15
Original line number Diff line number Diff line
@@ -401,14 +401,9 @@ class HostService(host_grpc_aio.HostServicer):
                self.bluetooth.adapter_client.register_callback_observer(name, observer)
                observers.append((name, observer))

            while True:
                if not self.bluetooth.advertising_client.active_advs:
            reg_id = self.bluetooth.start_advertising_set(parameters, advertise_data, None, None, None, 0, 0)

                    advertising_request = {
                        'start_advertising': asyncio.get_running_loop().create_future(),
                        'reg_id': reg_id
                    }
            advertising_request = {'start_advertising': asyncio.get_running_loop().create_future(), 'reg_id': reg_id}
            observer = AdvertisingObserver(advertising_request)
            name = utils.create_observer_name(observer)
            self.bluetooth.advertising_client.register_callback_observer(name, observer)
@@ -417,6 +412,7 @@ class HostService(host_grpc_aio.HostServicer):
            advertiser_id = await asyncio.wait_for(advertising_request['start_advertising'], timeout=5)
            started_ids.append(advertiser_id)

            while True:
                if not request.connectable:
                    await asyncio.sleep(1)
                    continue
@@ -428,7 +424,6 @@ class HostService(host_grpc_aio.HostServicer):
                yield host_pb2.AdvertiseResponse(
                    connection=utils.connection_to(utils.Connection(address, floss_enums.BtTransport.LE)))

                # Wait a small delay before restarting the advertisement.
                await asyncio.sleep(1)
        finally:
            for name, observer in observers: