bumble 0.0.213__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 +14 -38
- bumble/apps/bench.py +10 -15
- bumble/apps/ble_rpa_tool.py +1 -0
- bumble/apps/console.py +22 -25
- bumble/apps/controller_info.py +20 -25
- bumble/apps/controller_loopback.py +6 -10
- bumble/apps/controllers.py +2 -3
- bumble/apps/device_info.py +4 -5
- bumble/apps/gatt_dump.py +3 -3
- bumble/apps/gg_bridge.py +7 -8
- bumble/apps/hci_bridge.py +4 -3
- bumble/apps/l2cap_bridge.py +5 -5
- bumble/apps/lea_unicast/app.py +16 -26
- bumble/apps/pair.py +30 -43
- bumble/apps/pandora_server.py +5 -4
- bumble/apps/player/player.py +20 -24
- bumble/apps/rfcomm_bridge.py +4 -10
- bumble/apps/scan.py +17 -8
- bumble/apps/show.py +4 -5
- bumble/apps/speaker/speaker.py +23 -27
- bumble/apps/unbond.py +3 -3
- bumble/apps/usb_probe.py +2 -4
- 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 +1097 -589
- bumble/codecs.py +2 -0
- bumble/controller.py +142 -35
- 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 +319 -267
- 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 +114 -18
- bumble/helpers.py +19 -26
- bumble/hfp.py +10 -21
- bumble/hid.py +22 -16
- bumble/host.py +191 -103
- bumble/keys.py +5 -3
- bumble/l2cap.py +138 -104
- bumble/link.py +18 -19
- bumble/logging.py +65 -0
- bumble/pairing.py +7 -6
- bumble/pandora/__init__.py +9 -8
- 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 +403 -0
- bumble/profiles/ancs.py +6 -7
- bumble/profiles/ascs.py +14 -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 +151 -159
- 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 +5 -4
- bumble/tools/rtk_fw_download.py +6 -3
- bumble/tools/rtk_util.py +26 -8
- 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.213.dist-info → bumble-0.0.215.dist-info}/METADATA +4 -2
- bumble-0.0.215.dist-info/RECORD +183 -0
- bumble-0.0.213.dist-info/RECORD +0 -180
- {bumble-0.0.213.dist-info → bumble-0.0.215.dist-info}/WHEEL +0 -0
- {bumble-0.0.213.dist-info → bumble-0.0.215.dist-info}/entry_points.txt +0 -0
- {bumble-0.0.213.dist-info → bumble-0.0.215.dist-info}/licenses/LICENSE +0 -0
- {bumble-0.0.213.dist-info → bumble-0.0.215.dist-info}/top_level.txt +0 -0
bumble/apps/lea_unicast/app.py
CHANGED
|
@@ -20,31 +20,30 @@ from __future__ import annotations
|
|
|
20
20
|
import asyncio
|
|
21
21
|
import datetime
|
|
22
22
|
import functools
|
|
23
|
-
from importlib import resources
|
|
24
23
|
import json
|
|
25
|
-
import os
|
|
26
24
|
import logging
|
|
27
25
|
import pathlib
|
|
28
|
-
import weakref
|
|
29
26
|
import wave
|
|
27
|
+
import weakref
|
|
28
|
+
from importlib import resources
|
|
30
29
|
|
|
31
30
|
try:
|
|
32
31
|
import lc3 # type: ignore # pylint: disable=E0401
|
|
33
32
|
except ImportError as e:
|
|
34
33
|
raise ImportError("Try `python -m pip install \".[lc3]\"`.") from e
|
|
35
34
|
|
|
36
|
-
import click
|
|
37
35
|
import aiohttp.web
|
|
36
|
+
import click
|
|
38
37
|
|
|
39
38
|
import bumble
|
|
40
|
-
|
|
41
|
-
from bumble
|
|
39
|
+
import bumble.logging
|
|
40
|
+
from bumble import data_types, utils
|
|
42
41
|
from bumble.colors import color
|
|
43
|
-
from bumble.
|
|
44
|
-
from bumble.
|
|
45
|
-
from bumble.profiles import ascs, bap, pacs
|
|
42
|
+
from bumble.core import AdvertisingData
|
|
43
|
+
from bumble.device import AdvertisingParameters, CisLink, Device, DeviceConfiguration
|
|
46
44
|
from bumble.hci import Address, CodecID, CodingFormat, HCI_IsoDataPacket
|
|
47
|
-
|
|
45
|
+
from bumble.profiles import ascs, bap, pacs
|
|
46
|
+
from bumble.transport import open_transport
|
|
48
47
|
|
|
49
48
|
# -----------------------------------------------------------------------------
|
|
50
49
|
# Logging
|
|
@@ -331,22 +330,13 @@ class Speaker:
|
|
|
331
330
|
advertising_data = bytes(
|
|
332
331
|
AdvertisingData(
|
|
333
332
|
[
|
|
334
|
-
(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
(
|
|
339
|
-
AdvertisingData.FLAGS,
|
|
340
|
-
bytes(
|
|
341
|
-
[
|
|
342
|
-
AdvertisingData.LE_GENERAL_DISCOVERABLE_MODE_FLAG
|
|
343
|
-
| AdvertisingData.BR_EDR_NOT_SUPPORTED_FLAG
|
|
344
|
-
]
|
|
345
|
-
),
|
|
333
|
+
data_types.CompleteLocalName(device_config.name),
|
|
334
|
+
data_types.Flags(
|
|
335
|
+
AdvertisingData.Flags.LE_GENERAL_DISCOVERABLE_MODE
|
|
336
|
+
| AdvertisingData.Flags.BR_EDR_NOT_SUPPORTED
|
|
346
337
|
),
|
|
347
|
-
(
|
|
348
|
-
|
|
349
|
-
bytes(pacs.PublishedAudioCapabilitiesService.UUID),
|
|
338
|
+
data_types.IncompleteListOf16BitServiceUUIDs(
|
|
339
|
+
[pacs.PublishedAudioCapabilitiesService.UUID]
|
|
350
340
|
),
|
|
351
341
|
]
|
|
352
342
|
)
|
|
@@ -454,7 +444,7 @@ def speaker(ui_port: int, device_config: str, transport: str, lc3_file: str) ->
|
|
|
454
444
|
|
|
455
445
|
# -----------------------------------------------------------------------------
|
|
456
446
|
def main():
|
|
457
|
-
logging.
|
|
447
|
+
bumble.logging.setup_basic_logging()
|
|
458
448
|
speaker()
|
|
459
449
|
|
|
460
450
|
|
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
|
-
|
|
38
|
+
DataType,
|
|
38
39
|
PhysicalTransport,
|
|
39
|
-
|
|
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
|
-
|
|
47
|
+
GATT_HEART_RATE_SERVICE,
|
|
47
48
|
Characteristic,
|
|
49
|
+
Service,
|
|
48
50
|
)
|
|
49
51
|
from bumble.hci import OwnAddressType
|
|
50
|
-
from bumble.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
510
|
-
(
|
|
511
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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=(
|
bumble/apps/pandora_server.py
CHANGED
|
@@ -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
|
|
bumble/apps/player/player.py
CHANGED
|
@@ -16,55 +16,51 @@
|
|
|
16
16
|
# Imports
|
|
17
17
|
# -----------------------------------------------------------------------------
|
|
18
18
|
from __future__ import annotations
|
|
19
|
+
|
|
19
20
|
import asyncio
|
|
20
|
-
import asyncio.subprocess
|
|
21
|
-
import os
|
|
22
21
|
import logging
|
|
23
22
|
from typing import Optional, Union
|
|
24
23
|
|
|
25
24
|
import click
|
|
26
25
|
|
|
26
|
+
import bumble.logging
|
|
27
27
|
from bumble.a2dp import (
|
|
28
|
-
make_audio_source_service_sdp_records,
|
|
29
|
-
A2DP_SBC_CODEC_TYPE,
|
|
30
28
|
A2DP_MPEG_2_4_AAC_CODEC_TYPE,
|
|
31
29
|
A2DP_NON_A2DP_CODEC_TYPE,
|
|
30
|
+
A2DP_SBC_CODEC_TYPE,
|
|
32
31
|
AacFrame,
|
|
33
|
-
AacParser,
|
|
34
|
-
AacPacketSource,
|
|
35
32
|
AacMediaCodecInformation,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
SbcMediaCodecInformation,
|
|
33
|
+
AacPacketSource,
|
|
34
|
+
AacParser,
|
|
35
|
+
OpusMediaCodecInformation,
|
|
40
36
|
OpusPacket,
|
|
41
|
-
OpusParser,
|
|
42
37
|
OpusPacketSource,
|
|
43
|
-
|
|
38
|
+
OpusParser,
|
|
39
|
+
SbcFrame,
|
|
40
|
+
SbcMediaCodecInformation,
|
|
41
|
+
SbcPacketSource,
|
|
42
|
+
SbcParser,
|
|
43
|
+
make_audio_source_service_sdp_records,
|
|
44
44
|
)
|
|
45
|
-
from bumble.avrcp import Protocol as AvrcpProtocol
|
|
46
45
|
from bumble.avdtp import (
|
|
47
|
-
find_avdtp_service_with_connection,
|
|
48
46
|
AVDTP_AUDIO_MEDIA_TYPE,
|
|
49
47
|
AVDTP_DELAY_REPORTING_SERVICE_CATEGORY,
|
|
50
48
|
MediaCodecCapabilities,
|
|
51
49
|
MediaPacketPump,
|
|
52
|
-
Protocol as AvdtpProtocol,
|
|
53
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
|
|
54
54
|
from bumble.colors import color
|
|
55
|
-
from bumble.core import
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
DeviceClass,
|
|
59
|
-
PhysicalTransport,
|
|
60
|
-
)
|
|
55
|
+
from bumble.core import AdvertisingData
|
|
56
|
+
from bumble.core import ConnectionError as BumbleConnectionError
|
|
57
|
+
from bumble.core import DeviceClass, PhysicalTransport
|
|
61
58
|
from bumble.device import Connection, Device, DeviceConfiguration
|
|
62
|
-
from bumble.hci import
|
|
59
|
+
from bumble.hci import HCI_CONNECTION_ALREADY_EXISTS_ERROR, Address, HCI_Constant
|
|
63
60
|
from bumble.pairing import PairingConfig
|
|
64
61
|
from bumble.transport import open_transport
|
|
65
62
|
from bumble.utils import AsyncRunner
|
|
66
63
|
|
|
67
|
-
|
|
68
64
|
# -----------------------------------------------------------------------------
|
|
69
65
|
# Logging
|
|
70
66
|
# -----------------------------------------------------------------------------
|
|
@@ -599,7 +595,7 @@ def play(context, address, audio_format, audio_file):
|
|
|
599
595
|
|
|
600
596
|
# -----------------------------------------------------------------------------
|
|
601
597
|
def main():
|
|
602
|
-
logging.
|
|
598
|
+
bumble.logging.setup_basic_logging("WARNING")
|
|
603
599
|
player_cli()
|
|
604
600
|
|
|
605
601
|
|
bumble/apps/rfcomm_bridge.py
CHANGED
|
@@ -16,21 +16,15 @@
|
|
|
16
16
|
# Imports
|
|
17
17
|
# -----------------------------------------------------------------------------
|
|
18
18
|
import asyncio
|
|
19
|
-
import logging
|
|
20
|
-
import os
|
|
21
19
|
import time
|
|
22
20
|
from typing import Optional
|
|
23
21
|
|
|
24
22
|
import click
|
|
25
23
|
|
|
24
|
+
import bumble.logging
|
|
25
|
+
from bumble import core, hci, rfcomm, transport, utils
|
|
26
26
|
from bumble.colors import color
|
|
27
|
-
from bumble.device import Device, DeviceConfiguration
|
|
28
|
-
from bumble import core
|
|
29
|
-
from bumble import hci
|
|
30
|
-
from bumble import rfcomm
|
|
31
|
-
from bumble import transport
|
|
32
|
-
from bumble import utils
|
|
33
|
-
|
|
27
|
+
from bumble.device import Connection, Device, DeviceConfiguration
|
|
34
28
|
|
|
35
29
|
# -----------------------------------------------------------------------------
|
|
36
30
|
# Constants
|
|
@@ -515,6 +509,6 @@ def client(context, bluetooth_address, tcp_host, tcp_port, authenticate, encrypt
|
|
|
515
509
|
|
|
516
510
|
|
|
517
511
|
# -----------------------------------------------------------------------------
|
|
518
|
-
logging.basicConfig(level=os.environ.get("BUMBLE_LOGLEVEL", "WARNING").upper())
|
|
519
512
|
if __name__ == "__main__":
|
|
513
|
+
bumble.logging.setup_basic_logging("WARNING")
|
|
520
514
|
cli(obj={}) # pylint: disable=no-value-for-parameter
|
bumble/apps/scan.py
CHANGED
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
# Imports
|
|
17
17
|
# -----------------------------------------------------------------------------
|
|
18
18
|
import asyncio
|
|
19
|
-
|
|
20
|
-
import logging
|
|
19
|
+
|
|
21
20
|
import click
|
|
22
21
|
|
|
22
|
+
import bumble.logging
|
|
23
|
+
from bumble import data_types
|
|
23
24
|
from bumble.colors import color
|
|
24
|
-
from bumble.device import Device
|
|
25
|
-
from bumble.
|
|
25
|
+
from bumble.device import Advertisement, Device
|
|
26
|
+
from bumble.hci import HCI_LE_1M_PHY, HCI_LE_CODED_PHY, Address, HCI_Constant
|
|
26
27
|
from bumble.keys import JsonKeyStore
|
|
27
28
|
from bumble.smp import AddressResolver
|
|
28
|
-
from bumble.
|
|
29
|
-
from bumble.hci import Address, HCI_Constant, HCI_LE_1M_PHY, HCI_LE_CODED_PHY
|
|
29
|
+
from bumble.transport import open_transport
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
# -----------------------------------------------------------------------------
|
|
@@ -95,13 +95,22 @@ class AdvertisementPrinter:
|
|
|
95
95
|
else:
|
|
96
96
|
phy_info = ''
|
|
97
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
|
+
|
|
98
107
|
print(
|
|
99
108
|
f'>>> {color(address, address_color)} '
|
|
100
109
|
f'[{color(address_type_string, type_color)}]{address_qualifier}'
|
|
101
110
|
f'{resolution_qualifier}:{separator}'
|
|
102
111
|
f'{phy_info}'
|
|
103
112
|
f'RSSI:{advertisement.rssi:4} {rssi_bar}{separator}'
|
|
104
|
-
f'{
|
|
113
|
+
f'{details}\n'
|
|
105
114
|
)
|
|
106
115
|
|
|
107
116
|
def on_advertisement(self, advertisement):
|
|
@@ -237,7 +246,7 @@ def main(
|
|
|
237
246
|
device_config,
|
|
238
247
|
transport,
|
|
239
248
|
):
|
|
240
|
-
logging.
|
|
249
|
+
bumble.logging.setup_basic_logging('WARNING')
|
|
241
250
|
asyncio.run(
|
|
242
251
|
scan(
|
|
243
252
|
min_rssi,
|
bumble/apps/show.py
CHANGED
|
@@ -18,16 +18,15 @@
|
|
|
18
18
|
import datetime
|
|
19
19
|
import importlib
|
|
20
20
|
import logging
|
|
21
|
-
import os
|
|
22
21
|
import struct
|
|
23
22
|
|
|
24
23
|
import click
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
import bumble.logging
|
|
27
26
|
from bumble import hci
|
|
28
|
-
from bumble.
|
|
27
|
+
from bumble.colors import color
|
|
29
28
|
from bumble.helpers import PacketTracer
|
|
30
|
-
|
|
29
|
+
from bumble.transport.common import PacketReader
|
|
31
30
|
|
|
32
31
|
# -----------------------------------------------------------------------------
|
|
33
32
|
# Logging
|
|
@@ -188,5 +187,5 @@ def main(format, vendor, filename):
|
|
|
188
187
|
|
|
189
188
|
# -----------------------------------------------------------------------------
|
|
190
189
|
if __name__ == '__main__':
|
|
191
|
-
logging.
|
|
190
|
+
bumble.logging.setup_basic_logging('WARNING')
|
|
192
191
|
main() # pylint: disable=no-value-for-parameter
|
bumble/apps/speaker/speaker.py
CHANGED
|
@@ -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
|
-
import os
|
|
25
24
|
import logging
|
|
26
25
|
import pathlib
|
|
27
26
|
import subprocess
|
|
28
|
-
from typing import Optional
|
|
29
27
|
import weakref
|
|
28
|
+
from importlib import resources
|
|
29
|
+
from typing import Optional
|
|
30
30
|
|
|
31
|
-
import click
|
|
32
31
|
import aiohttp
|
|
32
|
+
import click
|
|
33
33
|
from aiohttp import web
|
|
34
34
|
|
|
35
35
|
import bumble
|
|
36
|
-
|
|
37
|
-
from bumble.core import PhysicalTransport, CommandTimeoutError
|
|
38
|
-
from bumble.device import Connection, Device, DeviceConfiguration
|
|
39
|
-
from bumble.hci import HCI_StatusError
|
|
40
|
-
from bumble.pairing import PairingConfig
|
|
41
|
-
from bumble.sdp import ServiceAttribute
|
|
42
|
-
from bumble.transport import open_transport
|
|
43
|
-
from bumble.avdtp import (
|
|
44
|
-
AVDTP_AUDIO_MEDIA_TYPE,
|
|
45
|
-
Listener,
|
|
46
|
-
MediaCodecCapabilities,
|
|
47
|
-
Protocol,
|
|
48
|
-
)
|
|
36
|
+
import bumble.logging
|
|
49
37
|
from bumble.a2dp import (
|
|
50
|
-
make_audio_sink_service_sdp_records,
|
|
51
|
-
A2DP_SBC_CODEC_TYPE,
|
|
52
38
|
A2DP_MPEG_2_4_AAC_CODEC_TYPE,
|
|
53
39
|
A2DP_NON_A2DP_CODEC_TYPE,
|
|
54
|
-
|
|
40
|
+
A2DP_SBC_CODEC_TYPE,
|
|
55
41
|
AacMediaCodecInformation,
|
|
56
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,
|
|
57
51
|
)
|
|
58
|
-
from bumble.utils import AsyncRunner
|
|
59
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
|
|
60
58
|
from bumble.rtp import MediaPacket
|
|
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
|
|
@@ -833,11 +833,7 @@ def speaker(
|
|
|
833
833
|
|
|
834
834
|
# -----------------------------------------------------------------------------
|
|
835
835
|
def main():
|
|
836
|
-
logging.
|
|
837
|
-
level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper(),
|
|
838
|
-
format="[%(asctime)s.%(msecs)03d] %(levelname)s:%(name)s:%(message)s",
|
|
839
|
-
datefmt="%H:%M:%S",
|
|
840
|
-
)
|
|
836
|
+
bumble.logging.setup_basic_logging('WARNING')
|
|
841
837
|
speaker()
|
|
842
838
|
|
|
843
839
|
|
bumble/apps/unbond.py
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
# Imports
|
|
17
17
|
# -----------------------------------------------------------------------------
|
|
18
18
|
import asyncio
|
|
19
|
-
|
|
20
|
-
import logging
|
|
19
|
+
|
|
21
20
|
import click
|
|
22
21
|
|
|
22
|
+
import bumble.logging
|
|
23
23
|
from bumble.device import Device
|
|
24
24
|
from bumble.keys import JsonKeyStore
|
|
25
25
|
from bumble.transport import open_transport
|
|
@@ -68,7 +68,7 @@ def main(keystore_file, hci_transport, device_config, address):
|
|
|
68
68
|
instantiated.
|
|
69
69
|
If no address is passed, the existing pairing keys for all addresses are printed.
|
|
70
70
|
"""
|
|
71
|
-
logging.
|
|
71
|
+
bumble.logging.setup_basic_logging()
|
|
72
72
|
|
|
73
73
|
if not keystore_file and not hci_transport:
|
|
74
74
|
print('either --keystore-file or --hci-transport must be specified.')
|
bumble/apps/usb_probe.py
CHANGED
|
@@ -26,15 +26,13 @@
|
|
|
26
26
|
# -----------------------------------------------------------------------------
|
|
27
27
|
# Imports
|
|
28
28
|
# -----------------------------------------------------------------------------
|
|
29
|
-
import os
|
|
30
|
-
import logging
|
|
31
29
|
import click
|
|
32
30
|
import usb1
|
|
33
31
|
|
|
32
|
+
import bumble.logging
|
|
34
33
|
from bumble.colors import color
|
|
35
34
|
from bumble.transport.usb import load_libusb
|
|
36
35
|
|
|
37
|
-
|
|
38
36
|
# -----------------------------------------------------------------------------
|
|
39
37
|
# Constants
|
|
40
38
|
# -----------------------------------------------------------------------------
|
|
@@ -169,7 +167,7 @@ def is_bluetooth_hci(device):
|
|
|
169
167
|
@click.command()
|
|
170
168
|
@click.option('--verbose', is_flag=True, default=False, help='Print more details')
|
|
171
169
|
def main(verbose):
|
|
172
|
-
logging.
|
|
170
|
+
bumble.logging.setup_basic_logging('WARNING')
|
|
173
171
|
|
|
174
172
|
load_libusb()
|
|
175
173
|
with usb1.USBContext() as context:
|