Setup data path after CIS established

This commit is contained in:
Josh Wu
2023-12-02 19:00:45 +08:00
parent af57762227
commit 985c365e6d
2 changed files with 22 additions and 6 deletions

View File

@@ -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 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 connection_handle: int
data_path_direction: int data_path_direction: int
data_path_id: int data_path_id: int

View File

@@ -443,9 +443,9 @@ class AseReasonCode(enum.IntEnum):
INVALID_ASE_CIS_MAPPING = 0x0A INVALID_ASE_CIS_MAPPING = 0x0A
class AudioRole(enum.Enum): class AudioRole(enum.IntEnum):
SINK = enum.auto() SINK = hci.HCI_LE_Setup_ISO_Data_Path_Command.Direction.CONTROLLER_TO_HOST
SOURCE = enum.auto() 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: def on_cis_establishment(self, cis_link: device.CisLink) -> None:
if cis_link.cis_id == self.cis_id and self.state == self.State.ENABLING: if cis_link.cis_id == self.cis_id and self.state == self.State.ENABLING:
self.state = self.State.STREAMING 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( def on_config_codec(
self, self,