bumble 0.0.214__py3-none-any.whl → 0.0.216__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 (122) hide show
  1. bumble/_version.py +16 -3
  2. bumble/a2dp.py +15 -16
  3. bumble/apps/auracast.py +13 -38
  4. bumble/apps/bench.py +9 -10
  5. bumble/apps/ble_rpa_tool.py +1 -0
  6. bumble/apps/console.py +22 -25
  7. bumble/apps/controller_info.py +19 -19
  8. bumble/apps/controller_loopback.py +2 -2
  9. bumble/apps/controllers.py +1 -1
  10. bumble/apps/device_info.py +3 -3
  11. bumble/apps/gatt_dump.py +1 -1
  12. bumble/apps/gg_bridge.py +5 -6
  13. bumble/apps/hci_bridge.py +3 -3
  14. bumble/apps/l2cap_bridge.py +3 -3
  15. bumble/apps/lea_unicast/app.py +15 -25
  16. bumble/apps/pair.py +30 -43
  17. bumble/apps/pandora_server.py +5 -4
  18. bumble/apps/player/player.py +19 -22
  19. bumble/apps/rfcomm_bridge.py +3 -8
  20. bumble/apps/scan.py +16 -6
  21. bumble/apps/show.py +3 -4
  22. bumble/apps/speaker/speaker.py +22 -22
  23. bumble/apps/unbond.py +2 -1
  24. bumble/apps/usb_probe.py +1 -2
  25. bumble/att.py +241 -246
  26. bumble/audio/io.py +5 -9
  27. bumble/avc.py +2 -2
  28. bumble/avctp.py +6 -7
  29. bumble/avdtp.py +19 -22
  30. bumble/avrcp.py +1096 -588
  31. bumble/codecs.py +2 -0
  32. bumble/controller.py +52 -13
  33. bumble/core.py +567 -248
  34. bumble/crypto/__init__.py +2 -2
  35. bumble/crypto/builtin.py +1 -1
  36. bumble/crypto/cryptography.py +2 -4
  37. bumble/data_types.py +1025 -0
  38. bumble/device.py +318 -279
  39. bumble/drivers/__init__.py +3 -2
  40. bumble/drivers/intel.py +3 -4
  41. bumble/drivers/rtk.py +26 -9
  42. bumble/gap.py +4 -4
  43. bumble/gatt.py +3 -2
  44. bumble/gatt_adapters.py +3 -11
  45. bumble/gatt_client.py +69 -81
  46. bumble/gatt_server.py +124 -124
  47. bumble/hci.py +67 -18
  48. bumble/helpers.py +19 -26
  49. bumble/hfp.py +10 -21
  50. bumble/hid.py +22 -16
  51. bumble/host.py +181 -103
  52. bumble/keys.py +5 -3
  53. bumble/l2cap.py +121 -74
  54. bumble/link.py +8 -9
  55. bumble/pairing.py +7 -6
  56. bumble/pandora/__init__.py +8 -7
  57. bumble/pandora/config.py +3 -1
  58. bumble/pandora/device.py +3 -2
  59. bumble/pandora/host.py +38 -36
  60. bumble/pandora/l2cap.py +22 -21
  61. bumble/pandora/security.py +15 -15
  62. bumble/pandora/utils.py +5 -3
  63. bumble/profiles/aics.py +11 -11
  64. bumble/profiles/ams.py +7 -8
  65. bumble/profiles/ancs.py +6 -7
  66. bumble/profiles/ascs.py +4 -9
  67. bumble/profiles/asha.py +8 -12
  68. bumble/profiles/bap.py +11 -23
  69. bumble/profiles/bass.py +2 -7
  70. bumble/profiles/battery_service.py +3 -4
  71. bumble/profiles/cap.py +1 -2
  72. bumble/profiles/csip.py +2 -6
  73. bumble/profiles/device_information_service.py +2 -2
  74. bumble/profiles/gap.py +4 -4
  75. bumble/profiles/gatt_service.py +1 -4
  76. bumble/profiles/gmap.py +5 -5
  77. bumble/profiles/hap.py +62 -59
  78. bumble/profiles/heart_rate_service.py +5 -4
  79. bumble/profiles/le_audio.py +3 -1
  80. bumble/profiles/mcp.py +3 -7
  81. bumble/profiles/pacs.py +3 -6
  82. bumble/profiles/pbp.py +2 -0
  83. bumble/profiles/tmap.py +2 -3
  84. bumble/profiles/vcs.py +2 -8
  85. bumble/profiles/vocs.py +8 -8
  86. bumble/rfcomm.py +11 -14
  87. bumble/rtp.py +1 -0
  88. bumble/sdp.py +10 -8
  89. bumble/smp.py +142 -153
  90. bumble/snoop.py +5 -5
  91. bumble/tools/generate_company_id_list.py +1 -0
  92. bumble/tools/intel_fw_download.py +3 -3
  93. bumble/tools/intel_util.py +4 -4
  94. bumble/tools/rtk_fw_download.py +6 -3
  95. bumble/tools/rtk_util.py +24 -7
  96. bumble/transport/__init__.py +19 -15
  97. bumble/transport/android_emulator.py +8 -13
  98. bumble/transport/android_netsim.py +19 -18
  99. bumble/transport/common.py +12 -15
  100. bumble/transport/file.py +1 -1
  101. bumble/transport/hci_socket.py +4 -6
  102. bumble/transport/pty.py +5 -6
  103. bumble/transport/pyusb.py +7 -10
  104. bumble/transport/serial.py +2 -1
  105. bumble/transport/tcp_client.py +2 -2
  106. bumble/transport/tcp_server.py +11 -14
  107. bumble/transport/udp.py +3 -3
  108. bumble/transport/unix.py +67 -1
  109. bumble/transport/usb.py +6 -6
  110. bumble/transport/vhci.py +0 -1
  111. bumble/transport/ws_client.py +2 -1
  112. bumble/transport/ws_server.py +3 -2
  113. bumble/utils.py +20 -5
  114. bumble/vendor/android/hci.py +1 -2
  115. bumble/vendor/zephyr/hci.py +0 -1
  116. {bumble-0.0.214.dist-info → bumble-0.0.216.dist-info}/METADATA +2 -1
  117. bumble-0.0.216.dist-info/RECORD +183 -0
  118. bumble-0.0.214.dist-info/RECORD +0 -182
  119. {bumble-0.0.214.dist-info → bumble-0.0.216.dist-info}/WHEEL +0 -0
  120. {bumble-0.0.214.dist-info → bumble-0.0.216.dist-info}/entry_points.txt +0 -0
  121. {bumble-0.0.214.dist-info → bumble-0.0.216.dist-info}/licenses/LICENSE +0 -0
  122. {bumble-0.0.214.dist-info → bumble-0.0.216.dist-info}/top_level.txt +0 -0
bumble/apps/pair.py CHANGED
@@ -16,42 +16,44 @@
16
16
  # Imports
17
17
  # -----------------------------------------------------------------------------
18
18
  import asyncio
19
- import os
20
19
  import logging
20
+ import os
21
21
  import struct
22
22
 
23
23
  import click
24
24
  from prompt_toolkit.shortcuts import PromptSession
25
25
 
26
+ from bumble import data_types
26
27
  from bumble.a2dp import make_audio_sink_service_sdp_records
28
+ from bumble.att import (
29
+ ATT_INSUFFICIENT_AUTHENTICATION_ERROR,
30
+ ATT_INSUFFICIENT_ENCRYPTION_ERROR,
31
+ ATT_Error,
32
+ )
27
33
  from bumble.colors import color
28
- from bumble.device import Device, Peer
29
- from bumble.transport import open_transport
30
- from bumble.pairing import OobData, PairingDelegate, PairingConfig
31
- from bumble.smp import OobContext, OobLegacyContext
32
- from bumble.smp import error_name as smp_error_name
33
- from bumble.keys import JsonKeyStore
34
34
  from bumble.core import (
35
+ UUID,
35
36
  AdvertisingData,
36
37
  Appearance,
37
- ProtocolError,
38
+ DataType,
38
39
  PhysicalTransport,
39
- UUID,
40
+ ProtocolError,
40
41
  )
42
+ from bumble.device import Device, Peer
41
43
  from bumble.gatt import (
42
44
  GATT_DEVICE_NAME_CHARACTERISTIC,
43
45
  GATT_GENERIC_ACCESS_SERVICE,
44
- GATT_HEART_RATE_SERVICE,
45
46
  GATT_HEART_RATE_MEASUREMENT_CHARACTERISTIC,
46
- Service,
47
+ GATT_HEART_RATE_SERVICE,
47
48
  Characteristic,
49
+ Service,
48
50
  )
49
51
  from bumble.hci import OwnAddressType
50
- from bumble.att import (
51
- ATT_Error,
52
- ATT_INSUFFICIENT_AUTHENTICATION_ERROR,
53
- ATT_INSUFFICIENT_ENCRYPTION_ERROR,
54
- )
52
+ from bumble.keys import JsonKeyStore
53
+ from bumble.pairing import OobData, PairingConfig, PairingDelegate
54
+ from bumble.smp import OobContext, OobLegacyContext
55
+ from bumble.smp import error_name as smp_error_name
56
+ from bumble.transport import open_transport
55
57
  from bumble.utils import AsyncRunner
56
58
 
57
59
  # -----------------------------------------------------------------------------
@@ -506,33 +508,21 @@ async def pair(
506
508
  if mode == 'dual':
507
509
  flags |= AdvertisingData.Flags.SIMULTANEOUS_LE_BR_EDR_CAPABLE
508
510
 
509
- ad_structs = [
510
- (
511
- AdvertisingData.FLAGS,
512
- bytes([flags]),
513
- ),
514
- (AdvertisingData.COMPLETE_LOCAL_NAME, 'Bumble'.encode()),
511
+ advertising_data_types: list[DataType] = [
512
+ data_types.Flags(flags),
513
+ data_types.CompleteLocalName('Bumble'),
515
514
  ]
516
515
  if service_uuids_16:
517
- ad_structs.append(
518
- (
519
- AdvertisingData.INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS,
520
- b"".join(bytes(uuid) for uuid in service_uuids_16),
521
- )
516
+ advertising_data_types.append(
517
+ data_types.IncompleteListOf16BitServiceUUIDs(service_uuids_16)
522
518
  )
523
519
  if service_uuids_32:
524
- ad_structs.append(
525
- (
526
- AdvertisingData.INCOMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS,
527
- b"".join(bytes(uuid) for uuid in service_uuids_32),
528
- )
520
+ advertising_data_types.append(
521
+ data_types.IncompleteListOf32BitServiceUUIDs(service_uuids_32)
529
522
  )
530
523
  if service_uuids_128:
531
- ad_structs.append(
532
- (
533
- AdvertisingData.INCOMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS,
534
- b"".join(bytes(uuid) for uuid in service_uuids_128),
535
- )
524
+ advertising_data_types.append(
525
+ data_types.IncompleteListOf128BitServiceUUIDs(service_uuids_128)
536
526
  )
537
527
 
538
528
  if advertise_appearance:
@@ -559,13 +549,10 @@ async def pair(
559
549
  advertise_appearance_int = int(
560
550
  Appearance(category_enum, subcategory_enum)
561
551
  )
562
- ad_structs.append(
563
- (
564
- AdvertisingData.APPEARANCE,
565
- struct.pack('<H', advertise_appearance_int),
566
- )
552
+ advertising_data_types.append(
553
+ data_types.Appearance(category_enum, subcategory_enum)
567
554
  )
568
- device.advertising_data = bytes(AdvertisingData(ad_structs))
555
+ device.advertising_data = bytes(AdvertisingData(advertising_data_types))
569
556
  await device.start_advertising(
570
557
  auto_restart=True,
571
558
  own_address_type=(
@@ -1,11 +1,12 @@
1
1
  import asyncio
2
- import click
3
- import logging
4
2
  import json
5
-
6
- from bumble.pandora import PandoraDevice, Config, serve
3
+ import logging
7
4
  from typing import Any
8
5
 
6
+ import click
7
+
8
+ from bumble.pandora import Config, PandoraDevice, serve
9
+
9
10
  BUMBLE_SERVER_GRPC_PORT = 7999
10
11
  ROOTCANAL_PORT_CUTTLEFISH = 7300
11
12
 
@@ -16,53 +16,50 @@
16
16
  # Imports
17
17
  # -----------------------------------------------------------------------------
18
18
  from __future__ import annotations
19
+
19
20
  import asyncio
20
21
  import logging
21
22
  from typing import Optional, Union
22
23
 
23
24
  import click
24
25
 
26
+ import bumble.logging
25
27
  from bumble.a2dp import (
26
- make_audio_source_service_sdp_records,
27
- A2DP_SBC_CODEC_TYPE,
28
28
  A2DP_MPEG_2_4_AAC_CODEC_TYPE,
29
29
  A2DP_NON_A2DP_CODEC_TYPE,
30
+ A2DP_SBC_CODEC_TYPE,
30
31
  AacFrame,
31
- AacParser,
32
- AacPacketSource,
33
32
  AacMediaCodecInformation,
34
- SbcFrame,
35
- SbcParser,
36
- SbcPacketSource,
37
- SbcMediaCodecInformation,
33
+ AacPacketSource,
34
+ AacParser,
35
+ OpusMediaCodecInformation,
38
36
  OpusPacket,
39
- OpusParser,
40
37
  OpusPacketSource,
41
- OpusMediaCodecInformation,
38
+ OpusParser,
39
+ SbcFrame,
40
+ SbcMediaCodecInformation,
41
+ SbcPacketSource,
42
+ SbcParser,
43
+ make_audio_source_service_sdp_records,
42
44
  )
43
- from bumble.avrcp import Protocol as AvrcpProtocol
44
45
  from bumble.avdtp import (
45
- find_avdtp_service_with_connection,
46
46
  AVDTP_AUDIO_MEDIA_TYPE,
47
47
  AVDTP_DELAY_REPORTING_SERVICE_CATEGORY,
48
48
  MediaCodecCapabilities,
49
49
  MediaPacketPump,
50
- Protocol as AvdtpProtocol,
51
50
  )
51
+ from bumble.avdtp import Protocol as AvdtpProtocol
52
+ from bumble.avdtp import find_avdtp_service_with_connection
53
+ from bumble.avrcp import Protocol as AvrcpProtocol
52
54
  from bumble.colors import color
53
- from bumble.core import (
54
- AdvertisingData,
55
- ConnectionError as BumbleConnectionError,
56
- DeviceClass,
57
- PhysicalTransport,
58
- )
55
+ from bumble.core import AdvertisingData
56
+ from bumble.core import ConnectionError as BumbleConnectionError
57
+ from bumble.core import DeviceClass, PhysicalTransport
59
58
  from bumble.device import Connection, Device, DeviceConfiguration
60
- from bumble.hci import Address, HCI_CONNECTION_ALREADY_EXISTS_ERROR, HCI_Constant
59
+ from bumble.hci import HCI_CONNECTION_ALREADY_EXISTS_ERROR, Address, HCI_Constant
61
60
  from bumble.pairing import PairingConfig
62
61
  from bumble.transport import open_transport
63
62
  from bumble.utils import AsyncRunner
64
- import bumble.logging
65
-
66
63
 
67
64
  # -----------------------------------------------------------------------------
68
65
  # Logging
@@ -21,15 +21,10 @@ from typing import Optional
21
21
 
22
22
  import click
23
23
 
24
- from bumble.colors import color
25
- from bumble.device import Device, DeviceConfiguration, Connection
26
- from bumble import core
27
- from bumble import hci
28
- from bumble import rfcomm
29
- from bumble import transport
30
- from bumble import utils
31
24
  import bumble.logging
32
-
25
+ from bumble import core, hci, rfcomm, transport, utils
26
+ from bumble.colors import color
27
+ from bumble.device import Connection, Device, DeviceConfiguration
33
28
 
34
29
  # -----------------------------------------------------------------------------
35
30
  # Constants
bumble/apps/scan.py CHANGED
@@ -16,16 +16,17 @@
16
16
  # Imports
17
17
  # -----------------------------------------------------------------------------
18
18
  import asyncio
19
+
19
20
  import click
20
21
 
22
+ import bumble.logging
23
+ from bumble import data_types
21
24
  from bumble.colors import color
22
- from bumble.device import Device
23
- from bumble.transport import open_transport
25
+ from bumble.device import Advertisement, Device
26
+ from bumble.hci import HCI_LE_1M_PHY, HCI_LE_CODED_PHY, Address, HCI_Constant
24
27
  from bumble.keys import JsonKeyStore
25
28
  from bumble.smp import AddressResolver
26
- from bumble.device import Advertisement
27
- from bumble.hci import Address, HCI_Constant, HCI_LE_1M_PHY, HCI_LE_CODED_PHY
28
- import bumble.logging
29
+ from bumble.transport import open_transport
29
30
 
30
31
 
31
32
  # -----------------------------------------------------------------------------
@@ -94,13 +95,22 @@ class AdvertisementPrinter:
94
95
  else:
95
96
  phy_info = ''
96
97
 
98
+ details = separator.join(
99
+ [
100
+ data_type.to_string(use_label=True)
101
+ for data_type in data_types.data_types_from_advertising_data(
102
+ advertisement.data
103
+ )
104
+ ]
105
+ )
106
+
97
107
  print(
98
108
  f'>>> {color(address, address_color)} '
99
109
  f'[{color(address_type_string, type_color)}]{address_qualifier}'
100
110
  f'{resolution_qualifier}:{separator}'
101
111
  f'{phy_info}'
102
112
  f'RSSI:{advertisement.rssi:4} {rssi_bar}{separator}'
103
- f'{advertisement.data.to_string(separator)}\n'
113
+ f'{details}\n'
104
114
  )
105
115
 
106
116
  def on_advertisement(self, advertisement):
bumble/apps/show.py CHANGED
@@ -22,12 +22,11 @@ import struct
22
22
 
23
23
  import click
24
24
 
25
- from bumble.colors import color
25
+ import bumble.logging
26
26
  from bumble import hci
27
- from bumble.transport.common import PacketReader
27
+ from bumble.colors import color
28
28
  from bumble.helpers import PacketTracer
29
- import bumble.logging
30
-
29
+ from bumble.transport.common import PacketReader
31
30
 
32
31
  # -----------------------------------------------------------------------------
33
32
  # Logging
@@ -16,49 +16,49 @@
16
16
  # Imports
17
17
  # -----------------------------------------------------------------------------
18
18
  from __future__ import annotations
19
+
19
20
  import asyncio
20
21
  import asyncio.subprocess
21
- from importlib import resources
22
22
  import enum
23
23
  import json
24
24
  import logging
25
25
  import pathlib
26
26
  import subprocess
27
- from typing import Optional
28
27
  import weakref
28
+ from importlib import resources
29
+ from typing import Optional
29
30
 
30
- import click
31
31
  import aiohttp
32
+ import click
32
33
  from aiohttp import web
33
34
 
34
35
  import bumble
35
- from bumble.colors import color
36
- from bumble.core import PhysicalTransport, CommandTimeoutError
37
- from bumble.device import Connection, Device, DeviceConfiguration
38
- from bumble.hci import HCI_StatusError
39
- from bumble.pairing import PairingConfig
40
- from bumble.sdp import ServiceAttribute
41
- from bumble.transport import open_transport
42
- from bumble.avdtp import (
43
- AVDTP_AUDIO_MEDIA_TYPE,
44
- Listener,
45
- MediaCodecCapabilities,
46
- Protocol,
47
- )
36
+ import bumble.logging
48
37
  from bumble.a2dp import (
49
- make_audio_sink_service_sdp_records,
50
- A2DP_SBC_CODEC_TYPE,
51
38
  A2DP_MPEG_2_4_AAC_CODEC_TYPE,
52
39
  A2DP_NON_A2DP_CODEC_TYPE,
53
- SbcMediaCodecInformation,
40
+ A2DP_SBC_CODEC_TYPE,
54
41
  AacMediaCodecInformation,
55
42
  OpusMediaCodecInformation,
43
+ SbcMediaCodecInformation,
44
+ make_audio_sink_service_sdp_records,
45
+ )
46
+ from bumble.avdtp import (
47
+ AVDTP_AUDIO_MEDIA_TYPE,
48
+ Listener,
49
+ MediaCodecCapabilities,
50
+ Protocol,
56
51
  )
57
- from bumble.utils import AsyncRunner
58
52
  from bumble.codecs import AacAudioRtpPacket
53
+ from bumble.colors import color
54
+ from bumble.core import CommandTimeoutError, PhysicalTransport
55
+ from bumble.device import Connection, Device, DeviceConfiguration
56
+ from bumble.hci import HCI_StatusError
57
+ from bumble.pairing import PairingConfig
59
58
  from bumble.rtp import MediaPacket
60
- import bumble.logging
61
-
59
+ from bumble.sdp import ServiceAttribute
60
+ from bumble.transport import open_transport
61
+ from bumble.utils import AsyncRunner
62
62
 
63
63
  # -----------------------------------------------------------------------------
64
64
  # Logging
bumble/apps/unbond.py CHANGED
@@ -16,12 +16,13 @@
16
16
  # Imports
17
17
  # -----------------------------------------------------------------------------
18
18
  import asyncio
19
+
19
20
  import click
20
21
 
22
+ import bumble.logging
21
23
  from bumble.device import Device
22
24
  from bumble.keys import JsonKeyStore
23
25
  from bumble.transport import open_transport
24
- import bumble.logging
25
26
 
26
27
 
27
28
  # -----------------------------------------------------------------------------
bumble/apps/usb_probe.py CHANGED
@@ -29,10 +29,9 @@
29
29
  import click
30
30
  import usb1
31
31
 
32
+ import bumble.logging
32
33
  from bumble.colors import color
33
34
  from bumble.transport.usb import load_libusb
34
- import bumble.logging
35
-
36
35
 
37
36
  # -----------------------------------------------------------------------------
38
37
  # Constants