diff --git a/bumble/controller.py b/bumble/controller.py index cd7de3d..688fcd7 100644 --- a/bumble/controller.py +++ b/bumble/controller.py @@ -654,7 +654,7 @@ class Controller: def on_hci_create_connection_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.1.5 Create Connection command + See Bluetooth spec Vol 4, Part E - 7.1.5 Create Connection command ''' if self.link is None: @@ -685,7 +685,7 @@ class Controller: def on_hci_disconnect_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.1.6 Disconnect Command + See Bluetooth spec Vol 4, Part E - 7.1.6 Disconnect Command ''' # First, say that the disconnection is pending self.send_hci_packet( @@ -719,7 +719,7 @@ class Controller: def on_hci_accept_connection_request_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.1.8 Accept Connection Request command + See Bluetooth spec Vol 4, Part E - 7.1.8 Accept Connection Request command ''' if self.link is None: @@ -735,7 +735,7 @@ class Controller: def on_hci_switch_role_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.2.8 Switch Role command + See Bluetooth spec Vol 4, Part E - 7.2.8 Switch Role command ''' if self.link is None: @@ -751,21 +751,21 @@ class Controller: def on_hci_set_event_mask_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.1 Set Event Mask Command + See Bluetooth spec Vol 4, Part E - 7.3.1 Set Event Mask Command ''' self.event_mask = command.event_mask return bytes([HCI_SUCCESS]) def on_hci_reset_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.2 Reset Command + See Bluetooth spec Vol 4, Part E - 7.3.2 Reset Command ''' # TODO: cleanup what needs to be reset return bytes([HCI_SUCCESS]) def on_hci_write_local_name_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.11 Write Local Name Command + See Bluetooth spec Vol 4, Part E - 7.3.11 Write Local Name Command ''' local_name = command.local_name if len(local_name): @@ -780,7 +780,7 @@ class Controller: def on_hci_read_local_name_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.12 Read Local Name Command + See Bluetooth spec Vol 4, Part E - 7.3.12 Read Local Name Command ''' local_name = bytes(self.local_name, 'utf-8')[:248] if len(local_name) < 248: @@ -790,19 +790,19 @@ class Controller: def on_hci_read_class_of_device_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.25 Read Class of Device Command + See Bluetooth spec Vol 4, Part E - 7.3.25 Read Class of Device Command ''' return bytes([HCI_SUCCESS, 0, 0, 0]) def on_hci_write_class_of_device_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.26 Write Class of Device Command + See Bluetooth spec Vol 4, Part E - 7.3.26 Write Class of Device Command ''' return bytes([HCI_SUCCESS]) def on_hci_read_synchronous_flow_control_enable_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.36 Read Synchronous Flow Control Enable + See Bluetooth spec Vol 4, Part E - 7.3.36 Read Synchronous Flow Control Enable Command ''' if self.sync_flow_control: @@ -813,7 +813,7 @@ class Controller: def on_hci_write_synchronous_flow_control_enable_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.37 Write Synchronous Flow Control Enable + See Bluetooth spec Vol 4, Part E - 7.3.37 Write Synchronous Flow Control Enable Command ''' ret = HCI_SUCCESS @@ -825,41 +825,59 @@ class Controller: ret = HCI_INVALID_HCI_COMMAND_PARAMETERS_ERROR return bytes([ret]) + def on_hci_set_controller_to_host_flow_control_command(self, _command): + ''' + See Bluetooth spec Vol 4, Part E - 7.3.38 Set Controller To Host Flow Control + Command + ''' + # For now we just accept the command but ignore the values. + # TODO: respect the passed in values. + return bytes([HCI_SUCCESS]) + + def on_hci_host_buffer_size_command(self, _command): + ''' + See Bluetooth spec Vol 4, Part E - 7.3.39 Host Buffer Size Command + ''' + # For now we just accept the command but ignore the values. + # TODO: respect the passed in values. + return bytes([HCI_SUCCESS]) + def on_hci_write_extended_inquiry_response_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.59 Write Simple Pairing Mode Command + See Bluetooth spec Vol 4, Part E - 7.3.56 Write Extended Inquiry Response + Command ''' return bytes([HCI_SUCCESS]) def on_hci_write_simple_pairing_mode_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.59 Write Simple Pairing Mode Command + See Bluetooth spec Vol 4, Part E - 7.3.59 Write Simple Pairing Mode Command ''' return bytes([HCI_SUCCESS]) def on_hci_set_event_mask_page_2_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.69 Set Event Mask Page 2 Command + See Bluetooth spec Vol 4, Part E - 7.3.69 Set Event Mask Page 2 Command ''' self.event_mask_page_2 = command.event_mask_page_2 return bytes([HCI_SUCCESS]) def on_hci_read_le_host_support_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.78 Write LE Host Support Command + See Bluetooth spec Vol 4, Part E - 7.3.78 Write LE Host Support Command ''' return bytes([HCI_SUCCESS, 1, 0]) def on_hci_write_le_host_support_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.79 Write LE Host Support Command + See Bluetooth spec Vol 4, Part E - 7.3.79 Write LE Host Support Command ''' # TODO / Just ignore for now return bytes([HCI_SUCCESS]) def on_hci_write_authenticated_payload_timeout_command(self, command): ''' - See Bluetooth spec Vol 2, Part E - 7.3.94 Write Authenticated Payload Timeout + See Bluetooth spec Vol 4, Part E - 7.3.94 Write Authenticated Payload Timeout Command ''' # TODO @@ -867,7 +885,7 @@ class Controller: def on_hci_read_local_version_information_command(self, _command): ''' - See Bluetooth spec Vol 2, Part E - 7.4.1 Read Local Version Information Command + See Bluetooth spec Vol 4, Part E - 7.4.1 Read Local Version Information Command ''' return struct.pack( '