resolve merge conflicts

This commit is contained in:
Gilles Boccon-Gibod
2025-07-26 21:20:52 -07:00
parent cce2e4d4e3
commit d611d25802
66 changed files with 180 additions and 232 deletions

View File

@@ -102,5 +102,7 @@
"." "."
], ],
"python.testing.unittestEnabled": false, "python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true "python.testing.pytestEnabled": true,
"python-envs.defaultEnvManager": "ms-python.python:system",
"python-envs.pythonProjects": []
} }

View File

@@ -23,7 +23,6 @@ import contextlib
import dataclasses import dataclasses
import functools import functools
import logging import logging
import os
import struct import struct
from typing import ( from typing import (
Any, Any,
@@ -54,6 +53,8 @@ from bumble.profiles import bass
import bumble.device import bumble.device
import bumble.transport import bumble.transport
import bumble.utils import bumble.utils
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Logging # Logging
@@ -1235,7 +1236,7 @@ def transmit(
def main(): def main():
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
auracast() auracast()

View File

@@ -19,7 +19,6 @@ import asyncio
import dataclasses import dataclasses
import enum import enum
import logging import logging
import os
import statistics import statistics
import struct import struct
import time import time
@@ -70,6 +69,7 @@ import bumble.rfcomm
import bumble.core import bumble.core
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
from bumble.pairing import PairingConfig from bumble.pairing import PairingConfig
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -2321,11 +2321,7 @@ def peripheral(ctx, transport):
def main(): def main():
logging.basicConfig( bumble.logging.setup_basic_logging('INFO')
level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper(),
format="[%(asctime)s.%(msecs)03d] %(levelname)s:%(name)s:%(message)s",
datefmt="%H:%M:%S",
)
bench() bench()

View File

@@ -16,8 +16,6 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import logging
import time import time
import click import click
@@ -59,6 +57,7 @@ from bumble.hci import (
) )
from bumble.host import Host from bumble.host import Host
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -342,11 +341,7 @@ async def async_main(
) )
@click.argument('transport') @click.argument('transport')
def main(latency_probes, latency_probe_interval, latency_probe_command, transport): def main(latency_probes, latency_probe_interval, latency_probe_command, transport):
logging.basicConfig( bumble.logging.setup_basic_logging()
level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper(),
format="[%(asctime)s.%(msecs)03d] %(levelname)s:%(name)s:%(message)s",
datefmt="%H:%M:%S",
)
asyncio.run( asyncio.run(
async_main( async_main(
latency_probes, latency_probe_interval, latency_probe_command, transport latency_probes, latency_probe_interval, latency_probe_command, transport

View File

@@ -16,10 +16,11 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import os
import time import time
from typing import Optional from typing import Optional
import click
from bumble.colors import color from bumble.colors import color
from bumble.hci import ( from bumble.hci import (
HCI_READ_LOOPBACK_MODE_COMMAND, HCI_READ_LOOPBACK_MODE_COMMAND,
@@ -30,7 +31,7 @@ from bumble.hci import (
) )
from bumble.host import Host from bumble.host import Host
from bumble.transport import open_transport from bumble.transport import open_transport
import click import bumble.logging
class Loopback: class Loopback:
@@ -194,12 +195,7 @@ class Loopback:
) )
@click.argument('transport') @click.argument('transport')
def main(packet_size, packet_count, transport): def main(packet_size, packet_count, transport):
logging.basicConfig( bumble.logging.setup_basic_logging()
level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper(),
format="[%(asctime)s.%(msecs)03d] %(levelname)s:%(name)s:%(message)s",
datefmt="%H:%M:%S",
)
loopback = Loopback(packet_size, packet_count, transport) loopback = Loopback(packet_size, packet_count, transport)
asyncio.run(loopback.run()) asyncio.run(loopback.run())

View File

@@ -15,14 +15,13 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging
import asyncio import asyncio
import sys import sys
import os
from bumble.controller import Controller from bumble.controller import Controller
from bumble.link import LocalLink from bumble.link import LocalLink
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -62,7 +61,7 @@ async def async_main():
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def main(): def main():
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
asyncio.run(async_main()) asyncio.run(async_main())

View File

@@ -16,8 +16,6 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import logging
from typing import Callable, Iterable, Optional from typing import Callable, Iterable, Optional
import click import click
@@ -33,6 +31,7 @@ from bumble.profiles.pacs import PublishedAudioCapabilitiesServiceProxy
from bumble.profiles.tmap import TelephonyAndMediaAudioServiceProxy from bumble.profiles.tmap import TelephonyAndMediaAudioServiceProxy
from bumble.profiles.vcs import VolumeControlServiceProxy from bumble.profiles.vcs import VolumeControlServiceProxy
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -267,7 +266,7 @@ def main(device_config, encrypt, transport, address_or_name):
Dump the GATT database on a remote device. If ADDRESS_OR_NAME is not specified, Dump the GATT database on a remote device. If ADDRESS_OR_NAME is not specified,
wait for an incoming connection. wait for an incoming connection.
""" """
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
asyncio.run(async_main(device_config, encrypt, transport, address_or_name)) asyncio.run(async_main(device_config, encrypt, transport, address_or_name))

View File

@@ -16,8 +16,7 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import logging
import click import click
import bumble.core import bumble.core
@@ -25,6 +24,7 @@ from bumble.colors import color
from bumble.device import Device, Peer from bumble.device import Device, Peer
from bumble.gatt import show_services from bumble.gatt import show_services
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -112,7 +112,7 @@ def main(device_config, encrypt, transport, address_or_name):
Dump the GATT database on a remote device. If ADDRESS_OR_NAME is not specified, Dump the GATT database on a remote device. If ADDRESS_OR_NAME is not specified,
wait for an incoming connection. wait for an incoming connection.
""" """
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
asyncio.run(async_main(device_config, encrypt, transport, address_or_name)) asyncio.run(async_main(device_config, encrypt, transport, address_or_name))

View File

@@ -16,9 +16,8 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import struct import struct
import logging
import click import click
from bumble import l2cap from bumble import l2cap
@@ -29,6 +28,7 @@ from bumble.gatt import Service, Characteristic, CharacteristicValue
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.hci import HCI_Constant from bumble.hci import HCI_Constant
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -383,6 +383,7 @@ def main(
receive_host, receive_host,
receive_port, receive_port,
): ):
bumble.logging.setup_basic_logging('WARNING')
asyncio.run( asyncio.run(
run( run(
hci_transport, hci_transport,
@@ -397,6 +398,5 @@ def main(
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper())
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@@ -17,11 +17,12 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging import logging
import asyncio import asyncio
import os
import sys import sys
from bumble import hci, transport from bumble import hci, transport
from bumble.bridge import HCI_Bridge from bumble.bridge import HCI_Bridge
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Logging # Logging
@@ -100,7 +101,7 @@ async def async_main():
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def main(): def main():
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
asyncio.run(async_main()) asyncio.run(async_main())

View File

@@ -16,8 +16,7 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import os
import click import click
from bumble import l2cap from bumble import l2cap
@@ -26,6 +25,7 @@ from bumble.transport import open_transport
from bumble.device import Device from bumble.device import Device
from bumble.utils import FlowControlAsyncPipe from bumble.utils import FlowControlAsyncPipe
from bumble.hci import HCI_Constant from bumble.hci import HCI_Constant
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -356,6 +356,6 @@ def client(context, bluetooth_address, tcp_host, tcp_port):
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper())
if __name__ == '__main__': if __name__ == '__main__':
bumble.logging.setup_basic_logging('WARNING')
cli(obj={}) # pylint: disable=no-value-for-parameter cli(obj={}) # pylint: disable=no-value-for-parameter

View File

@@ -22,7 +22,6 @@ import datetime
import functools import functools
from importlib import resources from importlib import resources
import json import json
import os
import logging import logging
import pathlib import pathlib
import weakref import weakref
@@ -44,6 +43,7 @@ from bumble.device import Device, DeviceConfiguration, AdvertisingParameters, Ci
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles import ascs, bap, pacs from bumble.profiles import ascs, bap, pacs
from bumble.hci import Address, CodecID, CodingFormat, HCI_IsoDataPacket from bumble.hci import Address, CodecID, CodingFormat, HCI_IsoDataPacket
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -454,7 +454,7 @@ def speaker(ui_port: int, device_config: str, transport: str, lc3_file: str) ->
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def main(): def main():
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
speaker() speaker()

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
import asyncio.subprocess
import os
import logging import logging
from typing import Optional, Union from typing import Optional, Union
@@ -63,6 +61,7 @@ from bumble.hci import Address, HCI_CONNECTION_ALREADY_EXISTS_ERROR, HCI_Constan
from bumble.pairing import PairingConfig from bumble.pairing import PairingConfig
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -599,7 +598,7 @@ def play(context, address, audio_format, audio_file):
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def main(): def main():
logging.basicConfig(level=os.environ.get("BUMBLE_LOGLEVEL", "WARNING").upper()) bumble.logging.setup_basic_logging("WARNING")
player_cli() player_cli()

View File

@@ -16,8 +16,6 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import os
import time import time
from typing import Optional from typing import Optional
@@ -30,6 +28,7 @@ from bumble import hci
from bumble import rfcomm from bumble import rfcomm
from bumble import transport from bumble import transport
from bumble import utils from bumble import utils
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -515,6 +514,6 @@ def client(context, bluetooth_address, tcp_host, tcp_port, authenticate, encrypt
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get("BUMBLE_LOGLEVEL", "WARNING").upper())
if __name__ == "__main__": if __name__ == "__main__":
bumble.logging.setup_basic_logging("WARNING")
cli(obj={}) # pylint: disable=no-value-for-parameter cli(obj={}) # pylint: disable=no-value-for-parameter

View File

@@ -16,8 +16,6 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import logging
import click import click
from bumble.colors import color from bumble.colors import color
@@ -27,6 +25,7 @@ from bumble.keys import JsonKeyStore
from bumble.smp import AddressResolver from bumble.smp import AddressResolver
from bumble.device import Advertisement from bumble.device import Advertisement
from bumble.hci import Address, HCI_Constant, HCI_LE_1M_PHY, HCI_LE_CODED_PHY from bumble.hci import Address, HCI_Constant, HCI_LE_1M_PHY, HCI_LE_CODED_PHY
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -237,7 +236,7 @@ def main(
device_config, device_config,
transport, transport,
): ):
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper()) bumble.logging.setup_basic_logging('WARNING')
asyncio.run( asyncio.run(
scan( scan(
min_rssi, min_rssi,

View File

@@ -18,7 +18,6 @@
import datetime import datetime
import importlib import importlib
import logging import logging
import os
import struct import struct
import click import click
@@ -27,6 +26,7 @@ from bumble.colors import color
from bumble import hci from bumble import hci
from bumble.transport.common import PacketReader from bumble.transport.common import PacketReader
from bumble.helpers import PacketTracer from bumble.helpers import PacketTracer
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -188,5 +188,5 @@ def main(format, vendor, filename):
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper()) bumble.logging.setup_basic_logging('WARNING')
main() # pylint: disable=no-value-for-parameter main() # pylint: disable=no-value-for-parameter

View File

@@ -21,7 +21,6 @@ import asyncio.subprocess
from importlib import resources from importlib import resources
import enum import enum
import json import json
import os
import logging import logging
import pathlib import pathlib
import subprocess import subprocess
@@ -58,6 +57,7 @@ from bumble.a2dp import (
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
from bumble.codecs import AacAudioRtpPacket from bumble.codecs import AacAudioRtpPacket
from bumble.rtp import MediaPacket from bumble.rtp import MediaPacket
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -833,11 +833,7 @@ def speaker(
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def main(): def main():
logging.basicConfig( bumble.logging.setup_basic_logging('WARNING')
level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper(),
format="[%(asctime)s.%(msecs)03d] %(levelname)s:%(name)s:%(message)s",
datefmt="%H:%M:%S",
)
speaker() speaker()

View File

@@ -16,13 +16,12 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import logging
import click import click
from bumble.device import Device from bumble.device import Device
from bumble.keys import JsonKeyStore from bumble.keys import JsonKeyStore
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -68,7 +67,7 @@ def main(keystore_file, hci_transport, device_config, address):
instantiated. instantiated.
If no address is passed, the existing pairing keys for all addresses are printed. If no address is passed, the existing pairing keys for all addresses are printed.
""" """
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
if not keystore_file and not hci_transport: if not keystore_file and not hci_transport:
print('either --keystore-file or --hci-transport must be specified.') print('either --keystore-file or --hci-transport must be specified.')

View File

@@ -26,13 +26,12 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import os
import logging
import click import click
import usb1 import usb1
from bumble.colors import color from bumble.colors import color
from bumble.transport.usb import load_libusb from bumble.transport.usb import load_libusb
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -169,7 +168,7 @@ def is_bluetooth_hci(device):
@click.command() @click.command()
@click.option('--verbose', is_flag=True, default=False, help='Print more details') @click.option('--verbose', is_flag=True, default=False, help='Print more details')
def main(verbose): def main(verbose):
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper()) bumble.logging.setup_basic_logging('WARNING')
load_libusb() load_libusb()
with usb1.USBContext() as context: with usb1.USBContext() as context:

View File

@@ -15,11 +15,10 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging
import asyncio import asyncio
import os
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
my_work_queue1 = AsyncRunner.WorkQueue() my_work_queue1 = AsyncRunner.WorkQueue()
@@ -83,5 +82,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,13 +17,12 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.device import Device from bumble.device import Device
from bumble.hci import Address from bumble.hci import Address
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles.battery_service import BatteryServiceProxy from bumble.profiles.battery_service import BatteryServiceProxy
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -72,5 +71,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
import random import random
import struct import struct
@@ -26,6 +24,7 @@ from bumble.core import AdvertisingData
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles.battery_service import BatteryService from bumble.profiles.battery_service import BatteryService
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -74,5 +73,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,13 +17,13 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.device import Device, Peer from bumble.device import Device, Peer
from bumble.hci import Address from bumble.hci import Address
from bumble.profiles.device_information_service import DeviceInformationServiceProxy from bumble.profiles.device_information_service import DeviceInformationServiceProxy
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -116,5 +116,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,14 +17,13 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
import struct import struct
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles.device_information_service import DeviceInformationService from bumble.profiles.device_information_service import DeviceInformationService
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -70,5 +69,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,13 +17,13 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.device import Device from bumble.device import Device
from bumble.hci import Address from bumble.hci import Address
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles.heart_rate_service import HeartRateServiceProxy from bumble.profiles.heart_rate_service import HeartRateServiceProxy
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -76,5 +76,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -20,9 +20,7 @@ import time
import math import math
import random import random
import struct import struct
import logging
import asyncio import asyncio
import os
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import Device from bumble.device import Device
@@ -30,6 +28,7 @@ from bumble.transport import open_transport
from bumble.profiles.device_information_service import DeviceInformationService from bumble.profiles.device_information_service import DeviceInformationService
from bumble.profiles.heart_rate_service import HeartRateService from bumble.profiles.heart_rate_service import HeartRateService
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -128,5 +127,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,13 +17,12 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
import struct import struct
import json import json
import websockets
from bumble.colors import color
import websockets
from bumble.colors import color
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import Device, Connection, Peer from bumble.device import Device, Connection, Peer
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
@@ -45,6 +44,8 @@ from bumble.gatt import (
GATT_HID_CONTROL_POINT_CHARACTERISTIC, GATT_HID_CONTROL_POINT_CHARACTERISTIC,
GATT_REPORT_REFERENCE_DESCRIPTOR, GATT_REPORT_REFERENCE_DESCRIPTOR,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -450,5 +451,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.device import Device from bumble.device import Device
@@ -39,6 +37,7 @@ from bumble.sdp import (
SDP_BLUETOOTH_PROFILE_DESCRIPTOR_LIST_ATTRIBUTE_ID, SDP_BLUETOOTH_PROFILE_DESCRIPTOR_LIST_ATTRIBUTE_ID,
SDP_SERVICE_CLASS_ID_LIST_ATTRIBUTE_ID, SDP_SERVICE_CLASS_ID_LIST_ATTRIBUTE_ID,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -198,5 +197,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from typing import Any from typing import Any
from bumble.device import Device from bumble.device import Device
@@ -35,6 +33,8 @@ from bumble.a2dp import (
A2DP_SBC_CODEC_TYPE, A2DP_SBC_CODEC_TYPE,
SbcMediaCodecInformation, SbcMediaCodecInformation,
) )
import bumble.logging
Context: dict[Any, Any] = {'output': None} Context: dict[Any, Any] = {'output': None}
@@ -166,5 +166,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.device import Device from bumble.device import Device
@@ -38,6 +36,7 @@ from bumble.a2dp import (
SbcMediaCodecInformation, SbcMediaCodecInformation,
SbcPacketSource, SbcPacketSource,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -186,5 +185,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,15 +16,14 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
import struct import struct
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import AdvertisingType, Device from bumble.device import AdvertisingType, Device
from bumble.hci import Address from bumble.hci import Address
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -72,5 +71,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,10 +17,8 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color
from bumble.colors import color
from bumble.device import Device, Peer from bumble.device import Device, Peer
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles.ancs import ( from bumble.profiles.ancs import (
@@ -31,6 +29,7 @@ from bumble.profiles.ancs import (
Notification, Notification,
NotificationAttributeId, NotificationAttributeId,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -210,5 +209,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,18 +17,19 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging import logging
import websockets
from typing import Optional from typing import Optional
import websockets
from bumble import decoder from bumble import decoder
from bumble import gatt from bumble import gatt
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import Device, AdvertisingParameters from bumble.device import Device, AdvertisingParameters
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.profiles import asha from bumble.profiles import asha
import bumble.logging
ws_connection: Optional[websockets.WebSocketServerProtocol] = None ws_connection: Optional[websockets.WebSocketServerProtocol] = None
g722_decoder = decoder.G722Decoder() g722_decoder = decoder.G722Decoder()
@@ -111,9 +112,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig( bumble.logging.setup_basic_logging('DEBUG')
level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper(),
format='%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
asyncio.run(main()) asyncio.run(main())

View File

@@ -19,8 +19,8 @@ from __future__ import annotations
import asyncio import asyncio
import json import json
import sys import sys
import os
import logging import logging
import websockets import websockets
from bumble.device import Device from bumble.device import Device
@@ -31,6 +31,7 @@ from bumble import avrcp
from bumble import avdtp from bumble import avdtp
from bumble import a2dp from bumble import a2dp
from bumble import utils from bumble import utils
import bumble.logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -409,5 +410,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -18,15 +18,15 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
import logging
import sys import sys
import os
import functools import functools
from bumble import core from bumble import core
from bumble import hci from bumble import hci
from bumble.device import Connection, Device, ChannelSoundingCapabilities from bumble.device import Connection, Device, ChannelSoundingCapabilities
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# From https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/gd/hci/distance_measurement_manager.cc. # From https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/gd/hci/distance_measurement_manager.cc.
CS_TONE_ANTENNA_CONFIG_MAPPING_TABLE = [ CS_TONE_ANTENNA_CONFIG_MAPPING_TABLE = [
@@ -150,5 +150,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,16 +16,14 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
from bumble import utils
from bumble.device import Device, CigParameters, CisLink, Connection from bumble.device import Device, CigParameters, CisLink, Connection
from bumble.hci import ( from bumble.hci import (
OwnAddressType, OwnAddressType,
) )
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -104,5 +102,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,10 +17,8 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color
from bumble.colors import color
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.core import PhysicalTransport, BT_L2CAP_PROTOCOL_ID, CommandTimeoutError from bumble.core import PhysicalTransport, BT_L2CAP_PROTOCOL_ID, CommandTimeoutError
@@ -29,6 +27,7 @@ from bumble.sdp import (
SDP_PUBLIC_BROWSE_ROOT, SDP_PUBLIC_BROWSE_ROOT,
SDP_ALL_ATTRIBUTES_RANGE, SDP_ALL_ATTRIBUTES_RANGE,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -117,5 +116,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
@@ -38,6 +36,8 @@ from bumble.core import (
BT_AVDTP_PROTOCOL_ID, BT_AVDTP_PROTOCOL_ID,
BT_ADVANCED_AUDIO_DISTRIBUTION_SERVICE, BT_ADVANCED_AUDIO_DISTRIBUTION_SERVICE,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
SDP_SERVICE_RECORDS = { SDP_SERVICE_RECORDS = {
@@ -117,5 +117,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,13 +17,13 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.device import Device from bumble.device import Device
from bumble.hci import Address from bumble.hci import Address
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.core import DeviceClass from bumble.core import DeviceClass
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -77,5 +77,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,11 +17,10 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -62,5 +61,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -15,10 +15,8 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging
import asyncio import asyncio
import sys import sys
import os
from bumble.gatt import ( from bumble.gatt import (
GATT_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTOR, GATT_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTOR,
@@ -33,6 +31,7 @@ from bumble.host import Host
from bumble.controller import Controller from bumble.controller import Controller
from bumble.link import LocalLink from bumble.link import LocalLink
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -105,5 +104,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -15,16 +15,16 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging
import asyncio import asyncio
import sys import sys
import os
from bumble.colors import color from bumble.colors import color
from bumble.device import Device from bumble.device import Device
from bumble.controller import Controller from bumble.controller import Controller
from bumble.hci import Address from bumble.hci import Address
from bumble.link import LocalLink from bumble.link import LocalLink
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -82,5 +82,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,9 +16,7 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
import secrets import secrets
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
@@ -28,8 +26,8 @@ from bumble.hci import (
) )
from bumble.profiles.cap import CommonAudioServiceService from bumble.profiles.cap import CommonAudioServiceService
from bumble.profiles.csip import CoordinatedSetIdentificationService, SirkType from bumble.profiles.csip import CoordinatedSetIdentificationService, SirkType
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -101,5 +99,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,12 +17,12 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.hci import Address from bumble.hci import Address
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.snoop import BtSnooper from bumble.snoop import BtSnooper
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -52,5 +52,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,15 +16,14 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
from bumble.core import PhysicalTransport from bumble.core import PhysicalTransport
from bumble.device import Device, ScoLink from bumble.device import Device, ScoLink
from bumble.hci import HCI_Enhanced_Setup_Synchronous_Connection_Command from bumble.hci import HCI_Enhanced_Setup_Synchronous_Connection_Command
from bumble.hfp import DefaultCodecParameters, ESCO_PARAMETERS from bumble.hfp import DefaultCodecParameters, ESCO_PARAMETERS
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -83,5 +82,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,9 +16,8 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
from bumble.device import ( from bumble.device import (
AdvertisingParameters, AdvertisingParameters,
AdvertisingEventProperties, AdvertisingEventProperties,
@@ -26,8 +25,8 @@ from bumble.device import (
Device, Device,
) )
from bumble.hci import Address from bumble.hci import Address
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -69,5 +68,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,13 +16,13 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
from bumble.device import AdvertisingParameters, AdvertisingEventProperties, Device from bumble.device import AdvertisingParameters, AdvertisingEventProperties, Device
from bumble.hci import Address from bumble.hci import Address
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -96,5 +96,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.core import ProtocolError from bumble.core import ProtocolError
@@ -26,6 +24,7 @@ from bumble.device import Device, Peer
from bumble.gatt import show_services from bumble.gatt import show_services
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -101,5 +100,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,8 +16,7 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.core import ProtocolError from bumble.core import ProtocolError
from bumble.controller import Controller from bumble.controller import Controller
@@ -34,6 +33,7 @@ from bumble.gatt import (
GATT_DEVICE_INFORMATION_SERVICE, GATT_DEVICE_INFORMATION_SERVICE,
) )
from bumble.gatt_client import show_services from bumble.gatt_client import show_services
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -119,5 +119,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.device import Device, Connection from bumble.device import Device, Connection
from bumble.transport import open_transport from bumble.transport import open_transport
@@ -32,6 +30,7 @@ from bumble.gatt import (
GATT_MANUFACTURER_NAME_STRING_CHARACTERISTIC, GATT_MANUFACTURER_NAME_STRING_CHARACTERISTIC,
GATT_DEVICE_INFORMATION_SERVICE, GATT_DEVICE_INFORMATION_SERVICE,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -152,5 +151,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
@@ -27,6 +25,7 @@ from bumble.gatt import (
Characteristic, Characteristic,
) )
from bumble.pairing import PairingConfig, PairingDelegate from bumble.pairing import PairingConfig, PairingDelegate
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -107,5 +106,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -20,8 +20,6 @@ import asyncio
import dataclasses import dataclasses
import functools import functools
import enum import enum
import logging
import os
import random import random
import struct import struct
import sys import sys
@@ -34,6 +32,7 @@ from bumble import gatt_adapters
from bumble import gatt_client from bumble import gatt_client
from bumble import hci from bumble import hci
from bumble import core from bumble import core
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -432,5 +431,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,9 +16,7 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import Device from bumble.device import Device
@@ -32,8 +30,9 @@ from bumble.profiles.hap import (
WritablePresetsSupport, WritablePresetsSupport,
PresetRecord, PresetRecord,
) )
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
server_features = HearingAidFeatures( server_features = HearingAidFeatures(
HearingAidType.MONAURAL_HEARING_AID, HearingAidType.MONAURAL_HEARING_AID,
@@ -102,5 +101,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -18,7 +18,6 @@
import asyncio import asyncio
import json import json
import sys import sys
import os
import io import io
import logging import logging
from typing import Iterable, Optional from typing import Iterable, Optional
@@ -30,6 +29,7 @@ from bumble.device import Device, ScoLink
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.core import PhysicalTransport from bumble.core import PhysicalTransport
from bumble import hci, rfcomm, hfp from bumble import hci, rfcomm, hfp
import bumble.logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -286,5 +286,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -18,20 +18,20 @@
import asyncio import asyncio
import contextlib import contextlib
import sys import sys
import os
import logging
import json import json
import websockets
import functools import functools
from typing import Optional from typing import Optional
from bumble import utils import websockets
from bumble import rfcomm from bumble import rfcomm
from bumble import hci from bumble import hci
from bumble.device import Device, Connection from bumble.device import Device, Connection
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble import hfp from bumble import hfp
from bumble.hfp import HfProtocol from bumble.hfp import HfProtocol
import bumble.logging
ws: Optional[websockets.WebSocketServerProtocol] = None ws: Optional[websockets.WebSocketServerProtocol] = None
hf_protocol: Optional[HfProtocol] = None hf_protocol: Optional[HfProtocol] = None
@@ -175,5 +175,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,12 +17,11 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
import json import json
import websockets
import struct import struct
import websockets
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.core import ( from bumble.core import (
@@ -49,6 +48,8 @@ from bumble.sdp import (
SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID, SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID,
SDP_BROWSE_GROUP_LIST_ATTRIBUTE_ID, SDP_BROWSE_GROUP_LIST_ATTRIBUTE_ID,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# SDP attributes for Bluetooth HID devices # SDP attributes for Bluetooth HID devices
@@ -744,5 +745,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
@@ -41,6 +39,7 @@ from bumble.sdp import (
SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID, SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID,
SDP_BROWSE_GROUP_LIST_ATTRIBUTE_ID, SDP_BROWSE_GROUP_LIST_ATTRIBUTE_ID,
) )
import bumble.logging
from hid_report_parser import ReportParser from hid_report_parser import ReportParser
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -565,6 +564,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
bumble.logging.setup_basic_logging('DEBUG')
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper())
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,13 +16,12 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
import websockets
import json import json
from typing import Optional
import websockets
from bumble import utils
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import ( from bumble.device import (
Device, Device,
@@ -53,8 +52,7 @@ from bumble.profiles.mcp import (
) )
from bumble.profiles.pacs import PacRecord, PublishedAudioCapabilitiesService from bumble.profiles.pacs import PacRecord, PublishedAudioCapabilitiesService
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
from typing import Optional
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -191,5 +189,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,13 +17,12 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import random import random
import logging
from bumble.device import Device, Connection from bumble.device import Device, Connection
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble.gatt import Service, Characteristic from bumble.gatt import Service, Characteristic
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -128,5 +127,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
@@ -39,6 +37,7 @@ from bumble.sdp import (
SDP_SERVICE_CLASS_ID_LIST_ATTRIBUTE_ID, SDP_SERVICE_CLASS_ID_LIST_ATTRIBUTE_ID,
SDP_BLUETOOTH_PROFILE_DESCRIPTOR_LIST_ATTRIBUTE_ID, SDP_BLUETOOTH_PROFILE_DESCRIPTOR_LIST_ATTRIBUTE_ID,
) )
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -237,5 +236,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,8 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.core import UUID from bumble.core import UUID
from bumble.device import Device from bumble.device import Device
@@ -26,6 +24,7 @@ from bumble.transport import open_transport
from bumble.rfcomm import Server from bumble.rfcomm import Server
from bumble.utils import AsyncRunner from bumble.utils import AsyncRunner
from bumble.rfcomm import make_service_sdp_records from bumble.rfcomm import make_service_sdp_records
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -159,5 +158,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,12 +17,11 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import sys import sys
import os
import logging
from bumble.colors import color from bumble.colors import color
from bumble.hci import Address from bumble.hci import Address
from bumble.device import Device from bumble.device import Device
from bumble.transport import open_transport from bumble.transport import open_transport
from bumble import logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -79,5 +78,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -18,9 +18,7 @@
import asyncio import asyncio
import datetime import datetime
import functools import functools
import logging
import sys import sys
import os
import io import io
import struct import struct
import secrets import secrets
@@ -46,6 +44,7 @@ from bumble.profiles.cap import CommonAudioServiceService
from bumble.profiles.csip import CoordinatedSetIdentificationService, SirkType from bumble.profiles.csip import CoordinatedSetIdentificationService, SirkType
from bumble.profiles.pacs import PacRecord, PublishedAudioCapabilitiesService from bumble.profiles.pacs import PacRecord, PublishedAudioCapabilitiesService
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
def _sink_pac_record() -> PacRecord: def _sink_pac_record() -> PacRecord:
@@ -200,5 +199,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -16,12 +16,12 @@
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import asyncio import asyncio
import logging
import sys import sys
import os
import secrets import secrets
import websockets
import json import json
from typing import Optional
import websockets
from bumble.core import AdvertisingData from bumble.core import AdvertisingData
from bumble.device import Device, AdvertisingParameters, AdvertisingEventProperties from bumble.device import Device, AdvertisingParameters, AdvertisingEventProperties
@@ -43,10 +43,8 @@ from bumble.profiles.pacs import PacRecord, PublishedAudioCapabilitiesService
from bumble.profiles.cap import CommonAudioServiceService from bumble.profiles.cap import CommonAudioServiceService
from bumble.profiles.csip import CoordinatedSetIdentificationService, SirkType from bumble.profiles.csip import CoordinatedSetIdentificationService, SirkType
from bumble.profiles.vcs import VolumeControlService from bumble.profiles.vcs import VolumeControlService
from bumble.transport import open_transport from bumble.transport import open_transport
import bumble.logging
from typing import Optional
def dumps_volume_state(volume_setting: int, muted: int, change_counter: int) -> str: def dumps_volume_state(volume_setting: int, muted: int, change_counter: int) -> str:
@@ -186,5 +184,5 @@ async def main() -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'DEBUG').upper()) bumble.logging.setup_basic_logging('DEBUG')
asyncio.run(main()) asyncio.run(main())

View File

@@ -17,7 +17,6 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging import logging
import asyncio import asyncio
import os
from typing import Any, Optional from typing import Any, Optional
import click import click
@@ -26,6 +25,8 @@ from bumble.colors import color
from bumble import transport from bumble import transport
from bumble.drivers import intel from bumble.drivers import intel
from bumble.host import Host from bumble.host import Host
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Logging # Logging
@@ -107,7 +108,7 @@ async def do_bootloader(usb_transport: str, force: bool) -> None:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@click.group() @click.group()
def main(): def main():
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
@main.command @main.command

View File

@@ -15,15 +15,16 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Imports # Imports
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging
import asyncio import asyncio
import os import logging
import click import click
from bumble import transport from bumble import transport
from bumble.host import Host from bumble.host import Host
from bumble.drivers import rtk from bumble.drivers import rtk
import bumble.logging
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Logging # Logging
@@ -112,7 +113,7 @@ async def do_info(usb_transport, force):
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@click.group() @click.group()
def main(): def main():
logging.basicConfig(level=os.environ.get('BUMBLE_LOGLEVEL', 'INFO').upper()) bumble.logging.setup_basic_logging()
@main.command @main.command