bumble 0.0.222__py3-none-any.whl → 0.0.224__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. bumble/_version.py +2 -2
  2. bumble/apps/controller_info.py +90 -114
  3. bumble/apps/controller_loopback.py +11 -9
  4. bumble/apps/gg_bridge.py +1 -1
  5. bumble/apps/hci_bridge.py +3 -1
  6. bumble/apps/l2cap_bridge.py +1 -1
  7. bumble/apps/rfcomm_bridge.py +1 -1
  8. bumble/apps/scan.py +10 -4
  9. bumble/apps/speaker/speaker.py +1 -1
  10. bumble/apps/usb_probe.py +15 -2
  11. bumble/att.py +97 -32
  12. bumble/avctp.py +1 -1
  13. bumble/avdtp.py +3 -3
  14. bumble/avrcp.py +366 -190
  15. bumble/bridge.py +10 -2
  16. bumble/controller.py +14 -1
  17. bumble/core.py +1 -1
  18. bumble/device.py +999 -577
  19. bumble/drivers/intel.py +45 -39
  20. bumble/drivers/rtk.py +102 -43
  21. bumble/gatt.py +2 -2
  22. bumble/gatt_client.py +5 -4
  23. bumble/gatt_server.py +100 -1
  24. bumble/hci.py +1367 -844
  25. bumble/hid.py +2 -2
  26. bumble/host.py +339 -157
  27. bumble/l2cap.py +13 -6
  28. bumble/pandora/l2cap.py +1 -1
  29. bumble/profiles/battery_service.py +25 -34
  30. bumble/profiles/heart_rate_service.py +130 -121
  31. bumble/rfcomm.py +1 -1
  32. bumble/sdp.py +2 -2
  33. bumble/smp.py +8 -3
  34. bumble/snoop.py +111 -1
  35. bumble/transport/android_netsim.py +1 -1
  36. bumble/vendor/android/hci.py +108 -86
  37. bumble/vendor/zephyr/hci.py +24 -18
  38. {bumble-0.0.222.dist-info → bumble-0.0.224.dist-info}/METADATA +4 -3
  39. {bumble-0.0.222.dist-info → bumble-0.0.224.dist-info}/RECORD +43 -43
  40. {bumble-0.0.222.dist-info → bumble-0.0.224.dist-info}/WHEEL +1 -1
  41. {bumble-0.0.222.dist-info → bumble-0.0.224.dist-info}/entry_points.txt +0 -0
  42. {bumble-0.0.222.dist-info → bumble-0.0.224.dist-info}/licenses/LICENSE +0 -0
  43. {bumble-0.0.222.dist-info → bumble-0.0.224.dist-info}/top_level.txt +0 -0
bumble/bridge.py CHANGED
@@ -37,7 +37,12 @@ class HCI_Bridge:
37
37
 
38
38
  def on_packet(self, packet):
39
39
  # Convert the packet bytes to an object
40
- hci_packet = HCI_Packet.from_bytes(packet)
40
+ try:
41
+ hci_packet = HCI_Packet.from_bytes(packet)
42
+ except Exception:
43
+ logger.warning('forwarding unparsed packet as-is')
44
+ self.hci_sink.on_packet(packet)
45
+ return
41
46
 
42
47
  # Filter the packet
43
48
  if self.packet_filter is not None:
@@ -50,7 +55,10 @@ class HCI_Bridge:
50
55
  return
51
56
 
52
57
  # Analyze the packet
53
- self.trace(hci_packet)
58
+ try:
59
+ self.trace(hci_packet)
60
+ except Exception:
61
+ logger.exception('Exception while tracing packet')
54
62
 
55
63
  # Bridge the packet
56
64
  self.hci_sink.on_packet(packet)
bumble/controller.py CHANGED
@@ -421,7 +421,7 @@ class Controller:
421
421
  hci.HCI_Command_Complete_Event(
422
422
  num_hci_command_packets=1,
423
423
  command_opcode=command.op_code,
424
- return_parameters=result,
424
+ return_parameters=hci.HCI_GenericReturnParameters(data=result),
425
425
  )
426
426
  )
427
427
 
@@ -1898,6 +1898,19 @@ class Controller:
1898
1898
  '''
1899
1899
  return bytes([hci.HCI_SUCCESS]) + self.le_features.value.to_bytes(8, 'little')
1900
1900
 
1901
+ def on_hci_le_read_all_local_supported_features_command(
1902
+ self, _command: hci.HCI_LE_Read_All_Local_Supported_Features_Command
1903
+ ) -> bytes | None:
1904
+ '''
1905
+ See Bluetooth spec Vol 4, Part E - 7.8.128 LE Read All Local Supported Features
1906
+ Command
1907
+ '''
1908
+ return (
1909
+ bytes([hci.HCI_SUCCESS])
1910
+ + bytes([0])
1911
+ + self.le_features.value.to_bytes(248, 'little')
1912
+ )
1913
+
1901
1914
  def on_hci_le_set_random_address_command(
1902
1915
  self, command: hci.HCI_LE_Set_Random_Address_Command
1903
1916
  ) -> bytes | None:
bumble/core.py CHANGED
@@ -923,7 +923,7 @@ class DeviceClass:
923
923
  # pylint: enable=line-too-long
924
924
 
925
925
  @staticmethod
926
- def split_class_of_device(class_of_device):
926
+ def split_class_of_device(class_of_device: int) -> tuple[int, int, int]:
927
927
  # Split the bit fields of the composite class of device value into:
928
928
  # (service_classes, major_device_class, minor_device_class)
929
929
  return (