From 64b75be29bd4ed3df0a59add14cdebef069abd58 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Tue, 3 Jan 2023 16:39:45 -0800 Subject: [PATCH] add psm parameter for testing support --- bumble/profiles/asha_service.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bumble/profiles/asha_service.py b/bumble/profiles/asha_service.py index eb7723fc..fabaa281 100644 --- a/bumble/profiles/asha_service.py +++ b/bumble/profiles/asha_service.py @@ -51,12 +51,13 @@ class AshaService(TemplateService): SUPPORTED_CODEC_ID = [0x02, 0x01] # Codec IDs [G.722 at 16 kHz] RENDER_DELAY = [00, 00] - def __init__(self, capability: int, hisyncid: List[int], device: Device): + def __init__(self, capability: int, hisyncid: List[int], device: Device, psm=0): 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'' + self.psm = psm # a non-zero psm is mainly for testing purpose # Handler for volume control def on_volume_write(_connection, value): @@ -131,7 +132,7 @@ class AshaService(TemplateService): channel.sink = on_data # let the server find a free PSM - self.psm = self.device.register_l2cap_channel_server(0, on_coc, 8) + self.psm = self.device.register_l2cap_channel_server(self.psm, on_coc, 8) self.le_psm_out_characteristic = Characteristic( GATT_ASHA_LE_PSM_OUT_CHARACTERISTIC, Characteristic.READ,