Skip to content

Commit

Permalink
Merge pull request #359 from zxzxwu/ascs
Browse files Browse the repository at this point in the history
Audio Stream Control Service
  • Loading branch information
zxzxwu authored Dec 11, 2023
2 parents 698d947 + f911163 commit b74503d
Show file tree
Hide file tree
Showing 7 changed files with 1,085 additions and 3 deletions.
12 changes: 12 additions & 0 deletions bumble/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,3 +1263,15 @@ def on_hci_le_read_transmit_power_command(self, _command):
See Bluetooth spec Vol 4, Part E - 7.8.74 LE Read Transmit Power Command
'''
return struct.pack('<BBB', HCI_SUCCESS, 0, 0)

def on_hci_le_setup_iso_data_path_command(self, command):
'''
See Bluetooth spec Vol 4, Part E - 7.8.109 LE Setup ISO Data Path Command
'''
return struct.pack('<BH', HCI_SUCCESS, command.connection_handle)

def on_hci_le_remove_iso_data_path_command(self, command):
'''
See Bluetooth spec Vol 4, Part E - 7.8.110 LE Remove ISO Data Path Command
'''
return struct.pack('<BH', HCI_SUCCESS, command.connection_handle)
2 changes: 1 addition & 1 deletion bumble/gatt_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ def on_att_write_command(self, connection, request):
try:
attribute.write_value(connection, request.attribute_value)
except Exception as error:
logger.warning(f'!!! ignoring exception: {error}')
logger.exception(f'!!! ignoring exception: {error}')

def on_att_handle_value_confirmation(self, connection, _confirmation):
'''
Expand Down
17 changes: 17 additions & 0 deletions bumble/hci.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,19 @@ def phy_list_to_bits(phys):
HCI_LE_CODED_PHY: HCI_LE_CODED_PHY_BIT
}


class Phy(enum.IntEnum):
LE_1M = 0x01
LE_2M = 0x02
LE_CODED = 0x03


class PhyBit(enum.IntFlag):
LE_1M = 0b00000001
LE_2M = 0b00000010
LE_CODED = 0b00000100


# Connection Parameters
HCI_CONNECTION_INTERVAL_MS_PER_UNIT = 1.25
HCI_CONNECTION_LATENCY_MS_PER_UNIT = 1.25
Expand Down Expand Up @@ -4541,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
Expand Down
Loading

0 comments on commit b74503d

Please sign in to comment.