bumble 0.0.192__py3-none-any.whl → 0.0.194__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/bench.py +69 -12
- bumble/apps/lea_unicast/app.py +577 -0
- bumble/apps/lea_unicast/index.html +68 -0
- bumble/apps/lea_unicast/liblc3.wasm +0 -0
- bumble/apps/rfcomm_bridge.py +511 -0
- bumble/device.py +157 -118
- bumble/hci.py +14 -25
- bumble/hfp.py +279 -31
- bumble/host.py +9 -5
- bumble/keys.py +7 -4
- bumble/l2cap.py +5 -2
- bumble/profiles/bap.py +52 -11
- bumble/rfcomm.py +173 -60
- bumble/sdp.py +1 -1
- bumble/transport/common.py +4 -0
- {bumble-0.0.192.dist-info → bumble-0.0.194.dist-info}/METADATA +5 -4
- {bumble-0.0.192.dist-info → bumble-0.0.194.dist-info}/RECORD +22 -18
- {bumble-0.0.192.dist-info → bumble-0.0.194.dist-info}/entry_points.txt +1 -0
- {bumble-0.0.192.dist-info → bumble-0.0.194.dist-info}/LICENSE +0 -0
- {bumble-0.0.192.dist-info → bumble-0.0.194.dist-info}/WHEEL +0 -0
- {bumble-0.0.192.dist-info → bumble-0.0.194.dist-info}/top_level.txt +0 -0
bumble/_version.py
CHANGED
bumble/apps/bench.py
CHANGED
|
@@ -899,14 +899,26 @@ class L2capServer(StreamedPacketIO):
|
|
|
899
899
|
# RfcommClient
|
|
900
900
|
# -----------------------------------------------------------------------------
|
|
901
901
|
class RfcommClient(StreamedPacketIO):
|
|
902
|
-
def __init__(
|
|
902
|
+
def __init__(
|
|
903
|
+
self,
|
|
904
|
+
device,
|
|
905
|
+
channel,
|
|
906
|
+
uuid,
|
|
907
|
+
l2cap_mtu,
|
|
908
|
+
max_frame_size,
|
|
909
|
+
initial_credits,
|
|
910
|
+
max_credits,
|
|
911
|
+
credits_threshold,
|
|
912
|
+
):
|
|
903
913
|
super().__init__()
|
|
904
914
|
self.device = device
|
|
905
915
|
self.channel = channel
|
|
906
916
|
self.uuid = uuid
|
|
907
917
|
self.l2cap_mtu = l2cap_mtu
|
|
908
918
|
self.max_frame_size = max_frame_size
|
|
909
|
-
self.
|
|
919
|
+
self.initial_credits = initial_credits
|
|
920
|
+
self.max_credits = max_credits
|
|
921
|
+
self.credits_threshold = credits_threshold
|
|
910
922
|
self.rfcomm_session = None
|
|
911
923
|
self.ready = asyncio.Event()
|
|
912
924
|
|
|
@@ -940,12 +952,17 @@ class RfcommClient(StreamedPacketIO):
|
|
|
940
952
|
logging.info(color(f'### Opening session for channel {channel}...', 'yellow'))
|
|
941
953
|
try:
|
|
942
954
|
dlc_options = {}
|
|
943
|
-
if self.max_frame_size:
|
|
955
|
+
if self.max_frame_size is not None:
|
|
944
956
|
dlc_options['max_frame_size'] = self.max_frame_size
|
|
945
|
-
if self.
|
|
946
|
-
dlc_options['
|
|
957
|
+
if self.initial_credits is not None:
|
|
958
|
+
dlc_options['initial_credits'] = self.initial_credits
|
|
947
959
|
rfcomm_session = await rfcomm_mux.open_dlc(channel, **dlc_options)
|
|
948
960
|
logging.info(color(f'### Session open: {rfcomm_session}', 'yellow'))
|
|
961
|
+
if self.max_credits is not None:
|
|
962
|
+
rfcomm_session.rx_max_credits = self.max_credits
|
|
963
|
+
if self.credits_threshold is not None:
|
|
964
|
+
rfcomm_session.rx_credits_threshold = self.credits_threshold
|
|
965
|
+
|
|
949
966
|
except bumble.core.ConnectionError as error:
|
|
950
967
|
logging.info(color(f'!!! Session open failed: {error}', 'red'))
|
|
951
968
|
await rfcomm_mux.disconnect()
|
|
@@ -969,8 +986,19 @@ class RfcommClient(StreamedPacketIO):
|
|
|
969
986
|
# RfcommServer
|
|
970
987
|
# -----------------------------------------------------------------------------
|
|
971
988
|
class RfcommServer(StreamedPacketIO):
|
|
972
|
-
def __init__(
|
|
989
|
+
def __init__(
|
|
990
|
+
self,
|
|
991
|
+
device,
|
|
992
|
+
channel,
|
|
993
|
+
l2cap_mtu,
|
|
994
|
+
max_frame_size,
|
|
995
|
+
initial_credits,
|
|
996
|
+
max_credits,
|
|
997
|
+
credits_threshold,
|
|
998
|
+
):
|
|
973
999
|
super().__init__()
|
|
1000
|
+
self.max_credits = max_credits
|
|
1001
|
+
self.credits_threshold = credits_threshold
|
|
974
1002
|
self.dlc = None
|
|
975
1003
|
self.ready = asyncio.Event()
|
|
976
1004
|
|
|
@@ -981,7 +1009,12 @@ class RfcommServer(StreamedPacketIO):
|
|
|
981
1009
|
rfcomm_server = bumble.rfcomm.Server(device, **server_options)
|
|
982
1010
|
|
|
983
1011
|
# Listen for incoming DLC connections
|
|
984
|
-
|
|
1012
|
+
dlc_options = {}
|
|
1013
|
+
if max_frame_size is not None:
|
|
1014
|
+
dlc_options['max_frame_size'] = max_frame_size
|
|
1015
|
+
if initial_credits is not None:
|
|
1016
|
+
dlc_options['initial_credits'] = initial_credits
|
|
1017
|
+
channel_number = rfcomm_server.listen(self.on_dlc, channel, **dlc_options)
|
|
985
1018
|
|
|
986
1019
|
# Setup the SDP to advertise this channel
|
|
987
1020
|
device.sdp_service_records = make_sdp_records(channel_number)
|
|
@@ -1004,6 +1037,10 @@ class RfcommServer(StreamedPacketIO):
|
|
|
1004
1037
|
dlc.sink = self.on_packet
|
|
1005
1038
|
self.io_sink = dlc.write
|
|
1006
1039
|
self.dlc = dlc
|
|
1040
|
+
if self.max_credits is not None:
|
|
1041
|
+
dlc.rx_max_credits = self.max_credits
|
|
1042
|
+
if self.credits_threshold is not None:
|
|
1043
|
+
dlc.rx_credits_threshold = self.credits_threshold
|
|
1007
1044
|
|
|
1008
1045
|
async def drain(self):
|
|
1009
1046
|
assert self.dlc
|
|
@@ -1321,7 +1358,9 @@ def create_mode_factory(ctx, default_mode):
|
|
|
1321
1358
|
uuid=ctx.obj['rfcomm_uuid'],
|
|
1322
1359
|
l2cap_mtu=ctx.obj['rfcomm_l2cap_mtu'],
|
|
1323
1360
|
max_frame_size=ctx.obj['rfcomm_max_frame_size'],
|
|
1324
|
-
|
|
1361
|
+
initial_credits=ctx.obj['rfcomm_initial_credits'],
|
|
1362
|
+
max_credits=ctx.obj['rfcomm_max_credits'],
|
|
1363
|
+
credits_threshold=ctx.obj['rfcomm_credits_threshold'],
|
|
1325
1364
|
)
|
|
1326
1365
|
|
|
1327
1366
|
if mode == 'rfcomm-server':
|
|
@@ -1329,6 +1368,10 @@ def create_mode_factory(ctx, default_mode):
|
|
|
1329
1368
|
device,
|
|
1330
1369
|
channel=ctx.obj['rfcomm_channel'],
|
|
1331
1370
|
l2cap_mtu=ctx.obj['rfcomm_l2cap_mtu'],
|
|
1371
|
+
max_frame_size=ctx.obj['rfcomm_max_frame_size'],
|
|
1372
|
+
initial_credits=ctx.obj['rfcomm_initial_credits'],
|
|
1373
|
+
max_credits=ctx.obj['rfcomm_max_credits'],
|
|
1374
|
+
credits_threshold=ctx.obj['rfcomm_credits_threshold'],
|
|
1332
1375
|
)
|
|
1333
1376
|
|
|
1334
1377
|
raise ValueError('invalid mode')
|
|
@@ -1427,9 +1470,19 @@ def create_role_factory(ctx, default_role):
|
|
|
1427
1470
|
help='RFComm maximum frame size',
|
|
1428
1471
|
)
|
|
1429
1472
|
@click.option(
|
|
1430
|
-
'--rfcomm-
|
|
1473
|
+
'--rfcomm-initial-credits',
|
|
1474
|
+
type=int,
|
|
1475
|
+
help='RFComm initial credits',
|
|
1476
|
+
)
|
|
1477
|
+
@click.option(
|
|
1478
|
+
'--rfcomm-max-credits',
|
|
1479
|
+
type=int,
|
|
1480
|
+
help='RFComm max credits',
|
|
1481
|
+
)
|
|
1482
|
+
@click.option(
|
|
1483
|
+
'--rfcomm-credits-threshold',
|
|
1431
1484
|
type=int,
|
|
1432
|
-
help='RFComm
|
|
1485
|
+
help='RFComm credits threshold',
|
|
1433
1486
|
)
|
|
1434
1487
|
@click.option(
|
|
1435
1488
|
'--l2cap-psm',
|
|
@@ -1530,7 +1583,9 @@ def bench(
|
|
|
1530
1583
|
rfcomm_uuid,
|
|
1531
1584
|
rfcomm_l2cap_mtu,
|
|
1532
1585
|
rfcomm_max_frame_size,
|
|
1533
|
-
|
|
1586
|
+
rfcomm_initial_credits,
|
|
1587
|
+
rfcomm_max_credits,
|
|
1588
|
+
rfcomm_credits_threshold,
|
|
1534
1589
|
l2cap_psm,
|
|
1535
1590
|
l2cap_mtu,
|
|
1536
1591
|
l2cap_mps,
|
|
@@ -1545,7 +1600,9 @@ def bench(
|
|
|
1545
1600
|
ctx.obj['rfcomm_uuid'] = rfcomm_uuid
|
|
1546
1601
|
ctx.obj['rfcomm_l2cap_mtu'] = rfcomm_l2cap_mtu
|
|
1547
1602
|
ctx.obj['rfcomm_max_frame_size'] = rfcomm_max_frame_size
|
|
1548
|
-
ctx.obj['
|
|
1603
|
+
ctx.obj['rfcomm_initial_credits'] = rfcomm_initial_credits
|
|
1604
|
+
ctx.obj['rfcomm_max_credits'] = rfcomm_max_credits
|
|
1605
|
+
ctx.obj['rfcomm_credits_threshold'] = rfcomm_credits_threshold
|
|
1549
1606
|
ctx.obj['l2cap_psm'] = l2cap_psm
|
|
1550
1607
|
ctx.obj['l2cap_mtu'] = l2cap_mtu
|
|
1551
1608
|
ctx.obj['l2cap_mps'] = l2cap_mps
|