bumble 0.0.201__py3-none-any.whl → 0.0.203__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/apps/auracast.py +22 -13
- bumble/apps/bench.py +138 -93
- bumble/apps/hci_bridge.py +1 -1
- bumble/apps/lea_unicast/app.py +24 -6
- bumble/apps/rfcomm_bridge.py +10 -1
- bumble/att.py +1 -4
- bumble/avc.py +2 -0
- bumble/controller.py +58 -2
- bumble/device.py +454 -494
- bumble/gatt.py +1 -1
- bumble/gatt_client.py +9 -3
- bumble/gatt_server.py +2 -2
- bumble/hci.py +93 -33
- bumble/hfp.py +20 -17
- bumble/host.py +1 -1
- bumble/l2cap.py +3 -8
- bumble/link.py +2 -0
- bumble/pandora/host.py +1 -1
- bumble/profiles/aics.py +3 -3
- bumble/profiles/bap.py +116 -41
- bumble/sdp.py +3 -7
- bumble/smp.py +3 -6
- bumble/transport/common.py +4 -2
- {bumble-0.0.201.dist-info → bumble-0.0.203.dist-info}/METADATA +18 -17
- {bumble-0.0.201.dist-info → bumble-0.0.203.dist-info}/RECORD +30 -30
- {bumble-0.0.201.dist-info → bumble-0.0.203.dist-info}/WHEEL +1 -1
- {bumble-0.0.201.dist-info → bumble-0.0.203.dist-info}/LICENSE +0 -0
- {bumble-0.0.201.dist-info → bumble-0.0.203.dist-info}/entry_points.txt +0 -0
- {bumble-0.0.201.dist-info → bumble-0.0.203.dist-info}/top_level.txt +0 -0
bumble/apps/rfcomm_bridge.py
CHANGED
|
@@ -237,6 +237,7 @@ class ClientBridge:
|
|
|
237
237
|
address: str,
|
|
238
238
|
tcp_host: str,
|
|
239
239
|
tcp_port: int,
|
|
240
|
+
authenticate: bool,
|
|
240
241
|
encrypt: bool,
|
|
241
242
|
):
|
|
242
243
|
self.channel = channel
|
|
@@ -245,6 +246,7 @@ class ClientBridge:
|
|
|
245
246
|
self.address = address
|
|
246
247
|
self.tcp_host = tcp_host
|
|
247
248
|
self.tcp_port = tcp_port
|
|
249
|
+
self.authenticate = authenticate
|
|
248
250
|
self.encrypt = encrypt
|
|
249
251
|
self.device: Optional[Device] = None
|
|
250
252
|
self.connection: Optional[Connection] = None
|
|
@@ -274,6 +276,11 @@ class ClientBridge:
|
|
|
274
276
|
print(color(f"@@@ Bluetooth connection: {self.connection}", "blue"))
|
|
275
277
|
self.connection.on("disconnection", self.on_disconnection)
|
|
276
278
|
|
|
279
|
+
if self.authenticate:
|
|
280
|
+
print(color("@@@ Authenticating Bluetooth connection", "blue"))
|
|
281
|
+
await self.connection.authenticate()
|
|
282
|
+
print(color("@@@ Bluetooth connection authenticated", "blue"))
|
|
283
|
+
|
|
277
284
|
if self.encrypt:
|
|
278
285
|
print(color("@@@ Encrypting Bluetooth connection", "blue"))
|
|
279
286
|
await self.connection.encrypt()
|
|
@@ -491,8 +498,9 @@ def server(context, tcp_host, tcp_port):
|
|
|
491
498
|
@click.argument("bluetooth-address")
|
|
492
499
|
@click.option("--tcp-host", help="TCP host", default="_")
|
|
493
500
|
@click.option("--tcp-port", help="TCP port", default=DEFAULT_CLIENT_TCP_PORT)
|
|
501
|
+
@click.option("--authenticate", is_flag=True, help="Authenticate the connection")
|
|
494
502
|
@click.option("--encrypt", is_flag=True, help="Encrypt the connection")
|
|
495
|
-
def client(context, bluetooth_address, tcp_host, tcp_port, encrypt):
|
|
503
|
+
def client(context, bluetooth_address, tcp_host, tcp_port, authenticate, encrypt):
|
|
496
504
|
bridge = ClientBridge(
|
|
497
505
|
context.obj["channel"],
|
|
498
506
|
context.obj["uuid"],
|
|
@@ -500,6 +508,7 @@ def client(context, bluetooth_address, tcp_host, tcp_port, encrypt):
|
|
|
500
508
|
bluetooth_address,
|
|
501
509
|
tcp_host,
|
|
502
510
|
tcp_port,
|
|
511
|
+
authenticate,
|
|
503
512
|
encrypt,
|
|
504
513
|
)
|
|
505
514
|
asyncio.run(run(context.obj["device_config"], context.obj["hci_transport"], bridge))
|
bumble/att.py
CHANGED
|
@@ -291,9 +291,6 @@ class ATT_PDU:
|
|
|
291
291
|
def init_from_bytes(self, pdu, offset):
|
|
292
292
|
return HCI_Object.init_from_bytes(self, pdu, offset, self.fields)
|
|
293
293
|
|
|
294
|
-
def to_bytes(self):
|
|
295
|
-
return self.pdu
|
|
296
|
-
|
|
297
294
|
@property
|
|
298
295
|
def is_command(self):
|
|
299
296
|
return ((self.op_code >> 6) & 1) == 1
|
|
@@ -303,7 +300,7 @@ class ATT_PDU:
|
|
|
303
300
|
return ((self.op_code >> 7) & 1) == 1
|
|
304
301
|
|
|
305
302
|
def __bytes__(self):
|
|
306
|
-
return self.
|
|
303
|
+
return self.pdu
|
|
307
304
|
|
|
308
305
|
def __str__(self):
|
|
309
306
|
result = color(self.name, 'yellow')
|
bumble/avc.py
CHANGED
|
@@ -134,6 +134,8 @@ class Frame:
|
|
|
134
134
|
opcode_offset = 3
|
|
135
135
|
elif subunit_id == 6:
|
|
136
136
|
raise core.InvalidPacketError("reserved subunit ID")
|
|
137
|
+
else:
|
|
138
|
+
raise core.InvalidPacketError("invalid subunit ID")
|
|
137
139
|
|
|
138
140
|
opcode = Frame.OperationCode(data[opcode_offset])
|
|
139
141
|
operands = data[opcode_offset + 1 :]
|
bumble/controller.py
CHANGED
|
@@ -314,7 +314,7 @@ class Controller:
|
|
|
314
314
|
f'{color("CONTROLLER -> HOST", "green")}: {packet}'
|
|
315
315
|
)
|
|
316
316
|
if self.host:
|
|
317
|
-
self.host.on_packet(packet
|
|
317
|
+
self.host.on_packet(bytes(packet))
|
|
318
318
|
|
|
319
319
|
# This method allows the controller to emulate the same API as a transport source
|
|
320
320
|
async def wait_for_termination(self):
|
|
@@ -1192,7 +1192,7 @@ class Controller:
|
|
|
1192
1192
|
See Bluetooth spec Vol 4, Part E - 7.4.6 Read BD_ADDR Command
|
|
1193
1193
|
'''
|
|
1194
1194
|
bd_addr = (
|
|
1195
|
-
self._public_address
|
|
1195
|
+
bytes(self._public_address)
|
|
1196
1196
|
if self._public_address is not None
|
|
1197
1197
|
else bytes(6)
|
|
1198
1198
|
)
|
|
@@ -1543,6 +1543,41 @@ class Controller:
|
|
|
1543
1543
|
}
|
|
1544
1544
|
return bytes([HCI_SUCCESS])
|
|
1545
1545
|
|
|
1546
|
+
def on_hci_le_set_advertising_set_random_address_command(self, _command):
|
|
1547
|
+
'''
|
|
1548
|
+
See Bluetooth spec Vol 4, Part E - 7.8.52 LE Set Advertising Set Random Address
|
|
1549
|
+
Command
|
|
1550
|
+
'''
|
|
1551
|
+
return bytes([HCI_SUCCESS])
|
|
1552
|
+
|
|
1553
|
+
def on_hci_le_set_extended_advertising_parameters_command(self, _command):
|
|
1554
|
+
'''
|
|
1555
|
+
See Bluetooth spec Vol 4, Part E - 7.8.53 LE Set Extended Advertising Parameters
|
|
1556
|
+
Command
|
|
1557
|
+
'''
|
|
1558
|
+
return bytes([HCI_SUCCESS, 0])
|
|
1559
|
+
|
|
1560
|
+
def on_hci_le_set_extended_advertising_data_command(self, _command):
|
|
1561
|
+
'''
|
|
1562
|
+
See Bluetooth spec Vol 4, Part E - 7.8.54 LE Set Extended Advertising Data
|
|
1563
|
+
Command
|
|
1564
|
+
'''
|
|
1565
|
+
return bytes([HCI_SUCCESS])
|
|
1566
|
+
|
|
1567
|
+
def on_hci_le_set_extended_scan_response_data_command(self, _command):
|
|
1568
|
+
'''
|
|
1569
|
+
See Bluetooth spec Vol 4, Part E - 7.8.55 LE Set Extended Scan Response Data
|
|
1570
|
+
Command
|
|
1571
|
+
'''
|
|
1572
|
+
return bytes([HCI_SUCCESS])
|
|
1573
|
+
|
|
1574
|
+
def on_hci_le_set_extended_advertising_enable_command(self, _command):
|
|
1575
|
+
'''
|
|
1576
|
+
See Bluetooth spec Vol 4, Part E - 7.8.56 LE Set Extended Advertising Enable
|
|
1577
|
+
Command
|
|
1578
|
+
'''
|
|
1579
|
+
return bytes([HCI_SUCCESS])
|
|
1580
|
+
|
|
1546
1581
|
def on_hci_le_read_maximum_advertising_data_length_command(self, _command):
|
|
1547
1582
|
'''
|
|
1548
1583
|
See Bluetooth spec Vol 4, Part E - 7.8.57 LE Read Maximum Advertising Data
|
|
@@ -1557,6 +1592,27 @@ class Controller:
|
|
|
1557
1592
|
'''
|
|
1558
1593
|
return struct.pack('<BB', HCI_SUCCESS, 0xF0)
|
|
1559
1594
|
|
|
1595
|
+
def on_hci_le_set_periodic_advertising_parameters_command(self, _command):
|
|
1596
|
+
'''
|
|
1597
|
+
See Bluetooth spec Vol 4, Part E - 7.8.61 LE Set Periodic Advertising Parameters
|
|
1598
|
+
Command
|
|
1599
|
+
'''
|
|
1600
|
+
return bytes([HCI_SUCCESS])
|
|
1601
|
+
|
|
1602
|
+
def on_hci_le_set_periodic_advertising_data_command(self, _command):
|
|
1603
|
+
'''
|
|
1604
|
+
See Bluetooth spec Vol 4, Part E - 7.8.62 LE Set Periodic Advertising Data
|
|
1605
|
+
Command
|
|
1606
|
+
'''
|
|
1607
|
+
return bytes([HCI_SUCCESS])
|
|
1608
|
+
|
|
1609
|
+
def on_hci_le_set_periodic_advertising_enable_command(self, _command):
|
|
1610
|
+
'''
|
|
1611
|
+
See Bluetooth spec Vol 4, Part E - 7.8.63 LE Set Periodic Advertising Enable
|
|
1612
|
+
Command
|
|
1613
|
+
'''
|
|
1614
|
+
return bytes([HCI_SUCCESS])
|
|
1615
|
+
|
|
1560
1616
|
def on_hci_le_read_transmit_power_command(self, _command):
|
|
1561
1617
|
'''
|
|
1562
1618
|
See Bluetooth spec Vol 4, Part E - 7.8.74 LE Read Transmit Power Command
|