diff --git a/bumble/hci.py b/bumble/hci.py index 8d5f9cd9..36c049c9 100644 --- a/bumble/hci.py +++ b/bumble/hci.py @@ -4554,6 +4554,10 @@ class HCI_LE_Setup_ISO_Data_Path_Command(HCI_Command): See Bluetooth spec @ 7.8.109 LE Setup ISO Data Path command ''' + class Direction(enum.IntEnum): + HOST_TO_CONTROLLER = 0x00 + CONTROLLER_TO_HOST = 0x01 + connection_handle: int data_path_direction: int data_path_id: int diff --git a/bumble/profiles/bap.py b/bumble/profiles/bap.py index ef94d547..aad299d8 100644 --- a/bumble/profiles/bap.py +++ b/bumble/profiles/bap.py @@ -443,9 +443,9 @@ class AseReasonCode(enum.IntEnum): INVALID_ASE_CIS_MAPPING = 0x0A -class AudioRole(enum.Enum): - SINK = enum.auto() - SOURCE = enum.auto() +class AudioRole(enum.IntEnum): + SINK = hci.HCI_LE_Setup_ISO_Data_Path_Command.Direction.CONTROLLER_TO_HOST + SOURCE = hci.HCI_LE_Setup_ISO_Data_Path_Command.Direction.HOST_TO_CONTROLLER # ----------------------------------------------------------------------------- @@ -834,9 +834,21 @@ class AseStateMachine(gatt.Characteristic): def on_cis_establishment(self, cis_link: device.CisLink) -> None: if cis_link.cis_id == self.cis_id and self.state == self.State.ENABLING: self.state = self.State.STREAMING - cis_link.acl_connection.abort_on( - 'flush', self.service.device.notify_subscribers(self, self.value) - ) + + async def post_cis_established(): + await self.service.device.send_command( + hci.HCI_LE_Setup_ISO_Data_Path_Command( + connection_handle=cis_link.handle, + data_path_direction=self.role, + data_path_id=0x00, # Fixed HCI + codec_id=hci.CodingFormat(hci.CodecID.TRANSPARENT), + controller_delay=0, + codec_configuration=b'', + ) + ) + await self.service.device.notify_subscribers(self, self.value) + + cis_link.acl_connection.abort_on('flush', post_cis_established()) def on_config_codec( self,