bumble 0.0.214__py3-none-any.whl → 0.0.215__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.
- bumble/_version.py +16 -3
- bumble/a2dp.py +15 -16
- bumble/apps/auracast.py +13 -38
- bumble/apps/bench.py +9 -10
- bumble/apps/ble_rpa_tool.py +1 -0
- bumble/apps/console.py +22 -25
- bumble/apps/controller_info.py +19 -19
- bumble/apps/controller_loopback.py +2 -2
- bumble/apps/controllers.py +1 -1
- bumble/apps/device_info.py +3 -3
- bumble/apps/gatt_dump.py +1 -1
- bumble/apps/gg_bridge.py +5 -6
- bumble/apps/hci_bridge.py +3 -3
- bumble/apps/l2cap_bridge.py +3 -3
- bumble/apps/lea_unicast/app.py +15 -25
- bumble/apps/pair.py +30 -43
- bumble/apps/pandora_server.py +5 -4
- bumble/apps/player/player.py +19 -22
- bumble/apps/rfcomm_bridge.py +3 -8
- bumble/apps/scan.py +16 -6
- bumble/apps/show.py +3 -4
- bumble/apps/speaker/speaker.py +22 -22
- bumble/apps/unbond.py +2 -1
- bumble/apps/usb_probe.py +1 -2
- bumble/att.py +241 -246
- bumble/audio/io.py +5 -9
- bumble/avc.py +2 -2
- bumble/avctp.py +6 -7
- bumble/avdtp.py +19 -22
- bumble/avrcp.py +1096 -588
- bumble/codecs.py +2 -0
- bumble/controller.py +52 -13
- bumble/core.py +567 -248
- bumble/crypto/__init__.py +2 -2
- bumble/crypto/builtin.py +1 -1
- bumble/crypto/cryptography.py +2 -4
- bumble/data_types.py +1025 -0
- bumble/device.py +280 -278
- bumble/drivers/__init__.py +3 -2
- bumble/drivers/intel.py +3 -4
- bumble/drivers/rtk.py +26 -9
- bumble/gap.py +4 -4
- bumble/gatt.py +3 -2
- bumble/gatt_adapters.py +3 -11
- bumble/gatt_client.py +69 -81
- bumble/gatt_server.py +124 -124
- bumble/hci.py +67 -18
- bumble/helpers.py +19 -26
- bumble/hfp.py +10 -21
- bumble/hid.py +22 -16
- bumble/host.py +181 -103
- bumble/keys.py +5 -3
- bumble/l2cap.py +121 -74
- bumble/link.py +8 -9
- bumble/pairing.py +7 -6
- bumble/pandora/__init__.py +8 -7
- bumble/pandora/config.py +3 -1
- bumble/pandora/device.py +3 -2
- bumble/pandora/host.py +38 -36
- bumble/pandora/l2cap.py +22 -21
- bumble/pandora/security.py +15 -15
- bumble/pandora/utils.py +5 -3
- bumble/profiles/aics.py +11 -11
- bumble/profiles/ams.py +7 -8
- bumble/profiles/ancs.py +6 -7
- bumble/profiles/ascs.py +4 -9
- bumble/profiles/asha.py +8 -12
- bumble/profiles/bap.py +11 -23
- bumble/profiles/bass.py +2 -7
- bumble/profiles/battery_service.py +3 -4
- bumble/profiles/cap.py +1 -2
- bumble/profiles/csip.py +2 -6
- bumble/profiles/device_information_service.py +2 -2
- bumble/profiles/gap.py +4 -4
- bumble/profiles/gatt_service.py +1 -4
- bumble/profiles/gmap.py +5 -5
- bumble/profiles/hap.py +62 -59
- bumble/profiles/heart_rate_service.py +5 -4
- bumble/profiles/le_audio.py +3 -1
- bumble/profiles/mcp.py +3 -7
- bumble/profiles/pacs.py +3 -6
- bumble/profiles/pbp.py +2 -0
- bumble/profiles/tmap.py +2 -3
- bumble/profiles/vcs.py +2 -8
- bumble/profiles/vocs.py +8 -8
- bumble/rfcomm.py +11 -14
- bumble/rtp.py +1 -0
- bumble/sdp.py +10 -8
- bumble/smp.py +142 -153
- bumble/snoop.py +5 -5
- bumble/tools/generate_company_id_list.py +1 -0
- bumble/tools/intel_fw_download.py +3 -3
- bumble/tools/intel_util.py +4 -4
- bumble/tools/rtk_fw_download.py +6 -3
- bumble/tools/rtk_util.py +24 -7
- bumble/transport/__init__.py +19 -15
- bumble/transport/android_emulator.py +8 -13
- bumble/transport/android_netsim.py +19 -18
- bumble/transport/common.py +12 -15
- bumble/transport/file.py +1 -1
- bumble/transport/hci_socket.py +4 -6
- bumble/transport/pty.py +5 -6
- bumble/transport/pyusb.py +7 -10
- bumble/transport/serial.py +2 -1
- bumble/transport/tcp_client.py +2 -2
- bumble/transport/tcp_server.py +11 -14
- bumble/transport/udp.py +3 -3
- bumble/transport/unix.py +67 -1
- bumble/transport/usb.py +6 -6
- bumble/transport/vhci.py +0 -1
- bumble/transport/ws_client.py +2 -1
- bumble/transport/ws_server.py +3 -2
- bumble/utils.py +20 -5
- bumble/vendor/android/hci.py +1 -2
- bumble/vendor/zephyr/hci.py +0 -1
- {bumble-0.0.214.dist-info → bumble-0.0.215.dist-info}/METADATA +2 -1
- bumble-0.0.215.dist-info/RECORD +183 -0
- bumble-0.0.214.dist-info/RECORD +0 -182
- {bumble-0.0.214.dist-info → bumble-0.0.215.dist-info}/WHEEL +0 -0
- {bumble-0.0.214.dist-info → bumble-0.0.215.dist-info}/entry_points.txt +0 -0
- {bumble-0.0.214.dist-info → bumble-0.0.215.dist-info}/licenses/LICENSE +0 -0
- {bumble-0.0.214.dist-info → bumble-0.0.215.dist-info}/top_level.txt +0 -0
bumble/codecs.py
CHANGED
bumble/controller.py
CHANGED
|
@@ -17,34 +17,32 @@
|
|
|
17
17
|
# -----------------------------------------------------------------------------
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
-
import logging
|
|
21
20
|
import asyncio
|
|
22
21
|
import dataclasses
|
|
23
22
|
import itertools
|
|
23
|
+
import logging
|
|
24
24
|
import random
|
|
25
25
|
import struct
|
|
26
|
-
from
|
|
27
|
-
|
|
28
|
-
PhysicalTransport,
|
|
29
|
-
)
|
|
26
|
+
from typing import TYPE_CHECKING, Any, Optional, Union
|
|
27
|
+
|
|
30
28
|
from bumble import hci
|
|
29
|
+
from bumble.colors import color
|
|
30
|
+
from bumble.core import PhysicalTransport
|
|
31
31
|
from bumble.hci import (
|
|
32
32
|
HCI_ACL_DATA_PACKET,
|
|
33
33
|
HCI_COMMAND_DISALLOWED_ERROR,
|
|
34
34
|
HCI_COMMAND_PACKET,
|
|
35
35
|
HCI_COMMAND_STATUS_PENDING,
|
|
36
|
-
HCI_CONNECTION_TIMEOUT_ERROR,
|
|
37
36
|
HCI_CONTROLLER_BUSY_ERROR,
|
|
38
37
|
HCI_EVENT_PACKET,
|
|
39
38
|
HCI_INVALID_HCI_COMMAND_PARAMETERS_ERROR,
|
|
40
39
|
HCI_LE_1M_PHY,
|
|
40
|
+
HCI_REMOTE_USER_TERMINATED_CONNECTION_ERROR,
|
|
41
41
|
HCI_SUCCESS,
|
|
42
|
-
HCI_UNKNOWN_HCI_COMMAND_ERROR,
|
|
43
42
|
HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERROR,
|
|
44
|
-
|
|
43
|
+
HCI_UNKNOWN_HCI_COMMAND_ERROR,
|
|
45
44
|
HCI_VERSION_BLUETOOTH_CORE_5_0,
|
|
46
45
|
Address,
|
|
47
|
-
Role,
|
|
48
46
|
HCI_AclDataPacket,
|
|
49
47
|
HCI_AclDataPacketAssembler,
|
|
50
48
|
HCI_Command_Complete_Event,
|
|
@@ -53,7 +51,6 @@ from bumble.hci import (
|
|
|
53
51
|
HCI_Connection_Request_Event,
|
|
54
52
|
HCI_Disconnection_Complete_Event,
|
|
55
53
|
HCI_Encryption_Change_Event,
|
|
56
|
-
HCI_Synchronous_Connection_Complete_Event,
|
|
57
54
|
HCI_LE_Advertising_Report_Event,
|
|
58
55
|
HCI_LE_CIS_Established_Event,
|
|
59
56
|
HCI_LE_CIS_Request_Event,
|
|
@@ -62,8 +59,9 @@ from bumble.hci import (
|
|
|
62
59
|
HCI_Number_Of_Completed_Packets_Event,
|
|
63
60
|
HCI_Packet,
|
|
64
61
|
HCI_Role_Change_Event,
|
|
62
|
+
HCI_Synchronous_Connection_Complete_Event,
|
|
63
|
+
Role,
|
|
65
64
|
)
|
|
66
|
-
from typing import Optional, Union, Any, TYPE_CHECKING
|
|
67
65
|
|
|
68
66
|
if TYPE_CHECKING:
|
|
69
67
|
from bumble.link import LocalLink
|
|
@@ -89,6 +87,7 @@ class CisLink:
|
|
|
89
87
|
cis_id: int
|
|
90
88
|
cig_id: int
|
|
91
89
|
acl_connection: Optional[Connection] = None
|
|
90
|
+
data_paths: set[int] = dataclasses.field(default_factory=set)
|
|
92
91
|
|
|
93
92
|
|
|
94
93
|
# -----------------------------------------------------------------------------
|
|
@@ -382,6 +381,11 @@ class Controller:
|
|
|
382
381
|
return connection
|
|
383
382
|
return None
|
|
384
383
|
|
|
384
|
+
def find_iso_link_by_handle(self, handle: int) -> Optional[CisLink]:
|
|
385
|
+
return self.central_cis_links.get(handle) or self.peripheral_cis_links.get(
|
|
386
|
+
handle
|
|
387
|
+
)
|
|
388
|
+
|
|
385
389
|
def on_link_central_connected(self, central_address):
|
|
386
390
|
'''
|
|
387
391
|
Called when an incoming connection occurs from a central on the link
|
|
@@ -1854,16 +1858,51 @@ class Controller:
|
|
|
1854
1858
|
)
|
|
1855
1859
|
)
|
|
1856
1860
|
|
|
1857
|
-
def on_hci_le_setup_iso_data_path_command(
|
|
1861
|
+
def on_hci_le_setup_iso_data_path_command(
|
|
1862
|
+
self, command: hci.HCI_LE_Setup_ISO_Data_Path_Command
|
|
1863
|
+
) -> bytes:
|
|
1858
1864
|
'''
|
|
1859
1865
|
See Bluetooth spec Vol 4, Part E - 7.8.109 LE Setup ISO Data Path Command
|
|
1860
1866
|
'''
|
|
1867
|
+
if not (iso_link := self.find_iso_link_by_handle(command.connection_handle)):
|
|
1868
|
+
return struct.pack(
|
|
1869
|
+
'<BH',
|
|
1870
|
+
HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERROR,
|
|
1871
|
+
command.connection_handle,
|
|
1872
|
+
)
|
|
1873
|
+
if command.data_path_direction in iso_link.data_paths:
|
|
1874
|
+
return struct.pack(
|
|
1875
|
+
'<BH',
|
|
1876
|
+
HCI_COMMAND_DISALLOWED_ERROR,
|
|
1877
|
+
command.connection_handle,
|
|
1878
|
+
)
|
|
1879
|
+
iso_link.data_paths.add(command.data_path_direction)
|
|
1861
1880
|
return struct.pack('<BH', HCI_SUCCESS, command.connection_handle)
|
|
1862
1881
|
|
|
1863
|
-
def on_hci_le_remove_iso_data_path_command(
|
|
1882
|
+
def on_hci_le_remove_iso_data_path_command(
|
|
1883
|
+
self, command: hci.HCI_LE_Remove_ISO_Data_Path_Command
|
|
1884
|
+
) -> bytes:
|
|
1864
1885
|
'''
|
|
1865
1886
|
See Bluetooth spec Vol 4, Part E - 7.8.110 LE Remove ISO Data Path Command
|
|
1866
1887
|
'''
|
|
1888
|
+
if not (iso_link := self.find_iso_link_by_handle(command.connection_handle)):
|
|
1889
|
+
return struct.pack(
|
|
1890
|
+
'<BH',
|
|
1891
|
+
HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERROR,
|
|
1892
|
+
command.connection_handle,
|
|
1893
|
+
)
|
|
1894
|
+
data_paths: set[int] = set(
|
|
1895
|
+
direction
|
|
1896
|
+
for direction in hci.HCI_LE_Setup_ISO_Data_Path_Command.Direction
|
|
1897
|
+
if (1 << direction) & command.data_path_direction
|
|
1898
|
+
)
|
|
1899
|
+
if not data_paths.issubset(iso_link.data_paths):
|
|
1900
|
+
return struct.pack(
|
|
1901
|
+
'<BH',
|
|
1902
|
+
HCI_COMMAND_DISALLOWED_ERROR,
|
|
1903
|
+
command.connection_handle,
|
|
1904
|
+
)
|
|
1905
|
+
iso_link.data_paths.difference_update(data_paths)
|
|
1867
1906
|
return struct.pack('<BH', HCI_SUCCESS, command.connection_handle)
|
|
1868
1907
|
|
|
1869
1908
|
def on_hci_le_set_host_feature_command(
|