From 9541cb6db09c51dee20c69bfb4e1a71603bb4890 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Mon, 6 Mar 2023 17:30:31 -0800 Subject: [PATCH] Add ASHA audio status point --- bumble/profiles/asha_service.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bumble/profiles/asha_service.py b/bumble/profiles/asha_service.py index fabaa281..eece39b6 100644 --- a/bumble/profiles/asha_service.py +++ b/bumble/profiles/asha_service.py @@ -20,6 +20,7 @@ import struct import logging from typing import List from ..core import AdvertisingData +from ..device import Device from ..gatt import ( GATT_ASHA_SERVICE, GATT_ASHA_READ_ONLY_PROPERTIES_CHARACTERISTIC, @@ -31,7 +32,7 @@ from ..gatt import ( Characteristic, CharacteristicValue, ) -from ..device import Device +from ..utils import AsyncRunner # ----------------------------------------------------------------------------- # Logging @@ -81,9 +82,13 @@ class AshaService(TemplateService): elif opcode == AshaService.OPCODE_STATUS: logger.info(f'### STATUS: connected={value[1]}') - # TODO Respond with a status - # asyncio.create_task(device.notify_subscribers(audio_status_characteristic, - # force=True)) + # OPCODE_STATUS does not need audio status point update + if opcode != AshaService.OPCODE_STATUS: + AsyncRunner.spawn( + device.notify_subscribers( + self.audio_status_characteristic, force=True + ) + ) self.read_only_properties_characteristic = Characteristic( GATT_ASHA_READ_ONLY_PROPERTIES_CHARACTERISTIC,