forked from auracaster/bumble_mirror
add psm parameter for testing support
This commit is contained in:
@@ -51,12 +51,13 @@ class AshaService(TemplateService):
|
|||||||
SUPPORTED_CODEC_ID = [0x02, 0x01] # Codec IDs [G.722 at 16 kHz]
|
SUPPORTED_CODEC_ID = [0x02, 0x01] # Codec IDs [G.722 at 16 kHz]
|
||||||
RENDER_DELAY = [00, 00]
|
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.hisyncid = hisyncid
|
||||||
self.capability = capability # Device Capabilities [Left, Monaural]
|
self.capability = capability # Device Capabilities [Left, Monaural]
|
||||||
self.device = device
|
self.device = device
|
||||||
self.emitted_data_name = 'ASHA_data_' + str(self.capability)
|
self.emitted_data_name = 'ASHA_data_' + str(self.capability)
|
||||||
self.audio_out_data = b''
|
self.audio_out_data = b''
|
||||||
|
self.psm = psm # a non-zero psm is mainly for testing purpose
|
||||||
|
|
||||||
# Handler for volume control
|
# Handler for volume control
|
||||||
def on_volume_write(_connection, value):
|
def on_volume_write(_connection, value):
|
||||||
@@ -131,7 +132,7 @@ class AshaService(TemplateService):
|
|||||||
channel.sink = on_data
|
channel.sink = on_data
|
||||||
|
|
||||||
# let the server find a free PSM
|
# 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(
|
self.le_psm_out_characteristic = Characteristic(
|
||||||
GATT_ASHA_LE_PSM_OUT_CHARACTERISTIC,
|
GATT_ASHA_LE_PSM_OUT_CHARACTERISTIC,
|
||||||
Characteristic.READ,
|
Characteristic.READ,
|
||||||
|
|||||||
Reference in New Issue
Block a user