From 06018211fe065ee6161765b6aa5ebcf2edc792f3 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Tue, 20 Dec 2022 13:33:18 -0800 Subject: [PATCH] emit event for ASHA l2cap packet --- bumble/profiles/asha_service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bumble/profiles/asha_service.py b/bumble/profiles/asha_service.py index 03b9ba3e..eb7723fc 100644 --- a/bumble/profiles/asha_service.py +++ b/bumble/profiles/asha_service.py @@ -55,6 +55,8 @@ class AshaService(TemplateService): self.hisyncid = hisyncid self.capability = capability # Device Capabilities [Left, Monaural] self.device = device + self.emitted_data_name = 'ASHA_data_' + str(self.capability) + self.audio_out_data = b'' # Handler for volume control def on_volume_write(_connection, value): @@ -121,9 +123,10 @@ class AshaService(TemplateService): # Register an L2CAP CoC server def on_coc(channel): def on_data(data): - logging.debug(f'<<< Voice data received:{data.hex()}') - # TODO think about where data should be dumped - # audio_out.write(data) + logging.debug(f'<<< data received:{data}') + + self.emit(self.emitted_data_name, data) + self.audio_out_data += data channel.sink = on_data