bumble 0.0.212__py3-none-any.whl → 0.0.213__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 +2 -2
- bumble/a2dp.py +6 -0
- bumble/apps/README.md +0 -3
- bumble/apps/auracast.py +11 -9
- bumble/apps/bench.py +480 -31
- bumble/apps/console.py +3 -3
- bumble/apps/controller_info.py +47 -10
- bumble/apps/controller_loopback.py +7 -3
- bumble/apps/controllers.py +2 -2
- bumble/apps/device_info.py +2 -2
- bumble/apps/gatt_dump.py +2 -2
- bumble/apps/gg_bridge.py +2 -2
- bumble/apps/hci_bridge.py +2 -2
- bumble/apps/l2cap_bridge.py +2 -2
- bumble/apps/lea_unicast/app.py +6 -1
- bumble/apps/pair.py +19 -11
- bumble/apps/pandora_server.py +2 -2
- bumble/apps/rfcomm_bridge.py +1 -1
- bumble/apps/scan.py +2 -2
- bumble/apps/show.py +4 -2
- bumble/apps/speaker/speaker.html +1 -0
- bumble/apps/speaker/speaker.js +113 -62
- bumble/apps/speaker/speaker.py +126 -18
- bumble/at.py +4 -4
- bumble/att.py +2 -6
- bumble/avc.py +7 -7
- bumble/avctp.py +3 -3
- bumble/avdtp.py +16 -20
- bumble/avrcp.py +41 -53
- bumble/colors.py +2 -2
- bumble/controller.py +84 -23
- bumble/device.py +348 -182
- bumble/drivers/__init__.py +2 -2
- bumble/drivers/common.py +0 -2
- bumble/drivers/intel.py +37 -40
- bumble/drivers/rtk.py +28 -35
- bumble/gatt.py +4 -4
- bumble/gatt_adapters.py +4 -5
- bumble/gatt_client.py +26 -31
- bumble/gatt_server.py +7 -11
- bumble/hci.py +2601 -2909
- bumble/helpers.py +4 -5
- bumble/hfp.py +32 -37
- bumble/host.py +94 -35
- bumble/keys.py +5 -5
- bumble/l2cap.py +310 -394
- bumble/link.py +6 -270
- bumble/pairing.py +23 -20
- bumble/pandora/__init__.py +1 -1
- bumble/pandora/config.py +2 -2
- bumble/pandora/device.py +6 -6
- bumble/pandora/host.py +27 -28
- bumble/pandora/l2cap.py +2 -2
- bumble/pandora/security.py +6 -6
- bumble/pandora/utils.py +3 -3
- bumble/profiles/ascs.py +132 -131
- bumble/profiles/asha.py +2 -2
- bumble/profiles/bap.py +3 -4
- bumble/profiles/csip.py +2 -2
- bumble/profiles/device_information_service.py +2 -2
- bumble/profiles/gap.py +2 -2
- bumble/profiles/hap.py +34 -33
- bumble/profiles/le_audio.py +4 -4
- bumble/profiles/mcp.py +4 -4
- bumble/profiles/vcs.py +3 -5
- bumble/rfcomm.py +10 -10
- bumble/rtp.py +1 -2
- bumble/sdp.py +2 -2
- bumble/smp.py +57 -61
- bumble/tools/rtk_util.py +2 -2
- bumble/transport/__init__.py +2 -16
- bumble/transport/android_netsim.py +5 -5
- bumble/transport/common.py +4 -4
- bumble/transport/pyusb.py +2 -2
- bumble/utils.py +2 -5
- bumble/vendor/android/hci.py +118 -200
- bumble/vendor/zephyr/hci.py +32 -27
- {bumble-0.0.212.dist-info → bumble-0.0.213.dist-info}/METADATA +2 -2
- {bumble-0.0.212.dist-info → bumble-0.0.213.dist-info}/RECORD +83 -86
- {bumble-0.0.212.dist-info → bumble-0.0.213.dist-info}/WHEEL +1 -1
- {bumble-0.0.212.dist-info → bumble-0.0.213.dist-info}/entry_points.txt +0 -1
- bumble/apps/link_relay/__init__.py +0 -0
- bumble/apps/link_relay/link_relay.py +0 -289
- bumble/apps/link_relay/logging.yml +0 -21
- {bumble-0.0.212.dist-info → bumble-0.0.213.dist-info}/licenses/LICENSE +0 -0
- {bumble-0.0.212.dist-info → bumble-0.0.213.dist-info}/top_level.txt +0 -0
bumble/controller.py
CHANGED
|
@@ -27,7 +27,7 @@ from bumble.colors import color
|
|
|
27
27
|
from bumble.core import (
|
|
28
28
|
PhysicalTransport,
|
|
29
29
|
)
|
|
30
|
-
|
|
30
|
+
from bumble import hci
|
|
31
31
|
from bumble.hci import (
|
|
32
32
|
HCI_ACL_DATA_PACKET,
|
|
33
33
|
HCI_COMMAND_DISALLOWED_ERROR,
|
|
@@ -63,7 +63,7 @@ from bumble.hci import (
|
|
|
63
63
|
HCI_Packet,
|
|
64
64
|
HCI_Role_Change_Event,
|
|
65
65
|
)
|
|
66
|
-
from typing import Optional, Union,
|
|
66
|
+
from typing import Optional, Union, Any, TYPE_CHECKING
|
|
67
67
|
|
|
68
68
|
if TYPE_CHECKING:
|
|
69
69
|
from bumble.link import LocalLink
|
|
@@ -108,7 +108,9 @@ class Connection:
|
|
|
108
108
|
def on_hci_acl_data_packet(self, packet):
|
|
109
109
|
self.assembler.feed_packet(packet)
|
|
110
110
|
self.controller.send_hci_packet(
|
|
111
|
-
HCI_Number_Of_Completed_Packets_Event(
|
|
111
|
+
HCI_Number_Of_Completed_Packets_Event(
|
|
112
|
+
connection_handles=[self.handle], num_completed_packets=[1]
|
|
113
|
+
)
|
|
112
114
|
)
|
|
113
115
|
|
|
114
116
|
def on_acl_pdu(self, data):
|
|
@@ -132,17 +134,17 @@ class Controller:
|
|
|
132
134
|
self.hci_sink = None
|
|
133
135
|
self.link = link
|
|
134
136
|
|
|
135
|
-
self.central_connections:
|
|
137
|
+
self.central_connections: dict[Address, Connection] = (
|
|
136
138
|
{}
|
|
137
139
|
) # Connections where this controller is the central
|
|
138
|
-
self.peripheral_connections:
|
|
140
|
+
self.peripheral_connections: dict[Address, Connection] = (
|
|
139
141
|
{}
|
|
140
142
|
) # Connections where this controller is the peripheral
|
|
141
|
-
self.classic_connections:
|
|
143
|
+
self.classic_connections: dict[Address, Connection] = (
|
|
142
144
|
{}
|
|
143
145
|
) # Connections in BR/EDR
|
|
144
|
-
self.central_cis_links:
|
|
145
|
-
self.peripheral_cis_links:
|
|
146
|
+
self.central_cis_links: dict[int, CisLink] = {} # CIS links by handle
|
|
147
|
+
self.peripheral_cis_links: dict[int, CisLink] = {} # CIS links by handle
|
|
146
148
|
|
|
147
149
|
self.hci_version = HCI_VERSION_BLUETOOTH_CORE_5_0
|
|
148
150
|
self.hci_revision = 0
|
|
@@ -392,7 +394,7 @@ class Controller:
|
|
|
392
394
|
peer_address=peer_address,
|
|
393
395
|
link=self.link,
|
|
394
396
|
transport=PhysicalTransport.LE,
|
|
395
|
-
link_type=HCI_Connection_Complete_Event.
|
|
397
|
+
link_type=HCI_Connection_Complete_Event.LinkType.ACL,
|
|
396
398
|
)
|
|
397
399
|
self.peripheral_connections[peer_address] = connection
|
|
398
400
|
logger.debug(f'New PERIPHERAL connection handle: 0x{connection_handle:04X}')
|
|
@@ -452,7 +454,7 @@ class Controller:
|
|
|
452
454
|
peer_address=peer_address,
|
|
453
455
|
link=self.link,
|
|
454
456
|
transport=PhysicalTransport.LE,
|
|
455
|
-
link_type=HCI_Connection_Complete_Event.
|
|
457
|
+
link_type=HCI_Connection_Complete_Event.LinkType.ACL,
|
|
456
458
|
)
|
|
457
459
|
self.central_connections[peer_address] = connection
|
|
458
460
|
logger.debug(
|
|
@@ -542,15 +544,14 @@ class Controller:
|
|
|
542
544
|
acl_packet = HCI_AclDataPacket(connection.handle, 2, 0, len(data), data)
|
|
543
545
|
self.send_hci_packet(acl_packet)
|
|
544
546
|
|
|
545
|
-
def on_link_advertising_data(self, sender_address, data):
|
|
547
|
+
def on_link_advertising_data(self, sender_address: Address, data: bytes):
|
|
546
548
|
# Ignore if we're not scanning
|
|
547
549
|
if self.le_scan_enable == 0:
|
|
548
550
|
return
|
|
549
551
|
|
|
550
552
|
# Send a scan report
|
|
551
553
|
report = HCI_LE_Advertising_Report_Event.Report(
|
|
552
|
-
HCI_LE_Advertising_Report_Event.
|
|
553
|
-
event_type=HCI_LE_Advertising_Report_Event.ADV_IND,
|
|
554
|
+
event_type=HCI_LE_Advertising_Report_Event.EventType.ADV_IND,
|
|
554
555
|
address_type=sender_address.address_type,
|
|
555
556
|
address=sender_address,
|
|
556
557
|
data=data,
|
|
@@ -560,8 +561,7 @@ class Controller:
|
|
|
560
561
|
|
|
561
562
|
# Simulate a scan response
|
|
562
563
|
report = HCI_LE_Advertising_Report_Event.Report(
|
|
563
|
-
HCI_LE_Advertising_Report_Event.
|
|
564
|
-
event_type=HCI_LE_Advertising_Report_Event.SCAN_RSP,
|
|
564
|
+
event_type=HCI_LE_Advertising_Report_Event.EventType.SCAN_RSP,
|
|
565
565
|
address_type=sender_address.address_type,
|
|
566
566
|
address=sender_address,
|
|
567
567
|
data=data,
|
|
@@ -618,8 +618,8 @@ class Controller:
|
|
|
618
618
|
cis_sync_delay=0,
|
|
619
619
|
transport_latency_c_to_p=0,
|
|
620
620
|
transport_latency_p_to_c=0,
|
|
621
|
-
phy_c_to_p=
|
|
622
|
-
phy_p_to_c=
|
|
621
|
+
phy_c_to_p=1,
|
|
622
|
+
phy_p_to_c=1,
|
|
623
623
|
nse=0,
|
|
624
624
|
bn_c_to_p=0,
|
|
625
625
|
bn_p_to_c=0,
|
|
@@ -695,7 +695,7 @@ class Controller:
|
|
|
695
695
|
peer_address=peer_address,
|
|
696
696
|
link=self.link,
|
|
697
697
|
transport=PhysicalTransport.BR_EDR,
|
|
698
|
-
link_type=HCI_Connection_Complete_Event.
|
|
698
|
+
link_type=HCI_Connection_Complete_Event.LinkType.ACL,
|
|
699
699
|
)
|
|
700
700
|
self.classic_connections[peer_address] = connection
|
|
701
701
|
logger.debug(
|
|
@@ -709,7 +709,7 @@ class Controller:
|
|
|
709
709
|
connection_handle=connection_handle,
|
|
710
710
|
bd_addr=peer_address,
|
|
711
711
|
encryption_enabled=False,
|
|
712
|
-
link_type=HCI_Connection_Complete_Event.
|
|
712
|
+
link_type=HCI_Connection_Complete_Event.LinkType.ACL,
|
|
713
713
|
)
|
|
714
714
|
)
|
|
715
715
|
else:
|
|
@@ -720,7 +720,7 @@ class Controller:
|
|
|
720
720
|
connection_handle=0,
|
|
721
721
|
bd_addr=peer_address,
|
|
722
722
|
encryption_enabled=False,
|
|
723
|
-
link_type=HCI_Connection_Complete_Event.
|
|
723
|
+
link_type=HCI_Connection_Complete_Event.LinkType.ACL,
|
|
724
724
|
)
|
|
725
725
|
)
|
|
726
726
|
|
|
@@ -945,7 +945,7 @@ class Controller:
|
|
|
945
945
|
)
|
|
946
946
|
)
|
|
947
947
|
self.link.classic_sco_connect(
|
|
948
|
-
self, connection.peer_address, HCI_Connection_Complete_Event.
|
|
948
|
+
self, connection.peer_address, HCI_Connection_Complete_Event.LinkType.ESCO
|
|
949
949
|
)
|
|
950
950
|
|
|
951
951
|
def on_hci_enhanced_accept_synchronous_connection_request_command(self, command):
|
|
@@ -974,10 +974,71 @@ class Controller:
|
|
|
974
974
|
)
|
|
975
975
|
)
|
|
976
976
|
self.link.classic_accept_sco_connection(
|
|
977
|
-
self, connection.peer_address, HCI_Connection_Complete_Event.
|
|
977
|
+
self, connection.peer_address, HCI_Connection_Complete_Event.LinkType.ESCO
|
|
978
|
+
)
|
|
979
|
+
|
|
980
|
+
def on_hci_sniff_mode_command(self, command: hci.HCI_Sniff_Mode_Command):
|
|
981
|
+
'''
|
|
982
|
+
See Bluetooth spec Vol 4, Part E - 7.2.2 Sniff Mode command
|
|
983
|
+
'''
|
|
984
|
+
if self.link is None:
|
|
985
|
+
self.send_hci_packet(
|
|
986
|
+
hci.HCI_Command_Status_Event(
|
|
987
|
+
status=hci.HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERROR,
|
|
988
|
+
num_hci_command_packets=1,
|
|
989
|
+
command_opcode=command.op_code,
|
|
990
|
+
)
|
|
991
|
+
)
|
|
992
|
+
return
|
|
993
|
+
|
|
994
|
+
self.send_hci_packet(
|
|
995
|
+
hci.HCI_Command_Status_Event(
|
|
996
|
+
status=HCI_SUCCESS,
|
|
997
|
+
num_hci_command_packets=1,
|
|
998
|
+
command_opcode=command.op_code,
|
|
999
|
+
)
|
|
1000
|
+
)
|
|
1001
|
+
self.send_hci_packet(
|
|
1002
|
+
hci.HCI_Mode_Change_Event(
|
|
1003
|
+
status=HCI_SUCCESS,
|
|
1004
|
+
connection_handle=command.connection_handle,
|
|
1005
|
+
current_mode=hci.HCI_Mode_Change_Event.Mode.SNIFF,
|
|
1006
|
+
interval=2,
|
|
1007
|
+
)
|
|
1008
|
+
)
|
|
1009
|
+
|
|
1010
|
+
def on_hci_exit_sniff_mode_command(self, command: hci.HCI_Exit_Sniff_Mode_Command):
|
|
1011
|
+
'''
|
|
1012
|
+
See Bluetooth spec Vol 4, Part E - 7.2.3 Exit Sniff Mode command
|
|
1013
|
+
'''
|
|
1014
|
+
|
|
1015
|
+
if self.link is None:
|
|
1016
|
+
self.send_hci_packet(
|
|
1017
|
+
hci.HCI_Command_Status_Event(
|
|
1018
|
+
status=hci.HCI_UNKNOWN_CONNECTION_IDENTIFIER_ERROR,
|
|
1019
|
+
num_hci_command_packets=1,
|
|
1020
|
+
command_opcode=command.op_code,
|
|
1021
|
+
)
|
|
1022
|
+
)
|
|
1023
|
+
return
|
|
1024
|
+
|
|
1025
|
+
self.send_hci_packet(
|
|
1026
|
+
hci.HCI_Command_Status_Event(
|
|
1027
|
+
status=HCI_SUCCESS,
|
|
1028
|
+
num_hci_command_packets=1,
|
|
1029
|
+
command_opcode=command.op_code,
|
|
1030
|
+
)
|
|
1031
|
+
)
|
|
1032
|
+
self.send_hci_packet(
|
|
1033
|
+
hci.HCI_Mode_Change_Event(
|
|
1034
|
+
status=HCI_SUCCESS,
|
|
1035
|
+
connection_handle=command.connection_handle,
|
|
1036
|
+
current_mode=hci.HCI_Mode_Change_Event.Mode.ACTIVE,
|
|
1037
|
+
interval=2,
|
|
1038
|
+
)
|
|
978
1039
|
)
|
|
979
1040
|
|
|
980
|
-
def on_hci_switch_role_command(self, command):
|
|
1041
|
+
def on_hci_switch_role_command(self, command: hci.HCI_Switch_Role_Command):
|
|
981
1042
|
'''
|
|
982
1043
|
See Bluetooth spec Vol 4, Part E - 7.2.8 Switch Role command
|
|
983
1044
|
'''
|