bumble 0.0.195__py3-none-any.whl → 0.0.198__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bumble/_version.py +2 -2
- bumble/apps/auracast.py +351 -66
- bumble/apps/console.py +5 -20
- bumble/apps/device_info.py +230 -0
- bumble/apps/gatt_dump.py +4 -0
- bumble/apps/lea_unicast/app.py +16 -17
- bumble/at.py +12 -6
- bumble/avc.py +8 -5
- bumble/avctp.py +3 -2
- bumble/avdtp.py +5 -1
- bumble/avrcp.py +2 -1
- bumble/codecs.py +17 -13
- bumble/colors.py +6 -2
- bumble/core.py +37 -7
- bumble/device.py +382 -111
- bumble/drivers/rtk.py +13 -8
- bumble/gatt.py +6 -1
- bumble/gatt_client.py +10 -4
- bumble/hci.py +50 -25
- bumble/hid.py +24 -28
- bumble/host.py +4 -0
- bumble/l2cap.py +24 -17
- bumble/link.py +8 -3
- bumble/profiles/ascs.py +739 -0
- bumble/profiles/bap.py +1 -874
- bumble/profiles/bass.py +440 -0
- bumble/profiles/csip.py +4 -4
- bumble/profiles/gap.py +110 -0
- bumble/profiles/heart_rate_service.py +4 -3
- bumble/profiles/le_audio.py +43 -9
- bumble/profiles/mcp.py +448 -0
- bumble/profiles/pacs.py +210 -0
- bumble/profiles/tmap.py +89 -0
- bumble/rfcomm.py +4 -2
- bumble/sdp.py +13 -11
- bumble/smp.py +20 -8
- bumble/snoop.py +5 -4
- bumble/transport/__init__.py +8 -2
- bumble/transport/android_emulator.py +9 -3
- bumble/transport/android_netsim.py +9 -7
- bumble/transport/common.py +46 -18
- bumble/transport/pyusb.py +2 -2
- bumble/transport/unix.py +56 -0
- bumble/transport/usb.py +57 -46
- {bumble-0.0.195.dist-info → bumble-0.0.198.dist-info}/METADATA +41 -41
- {bumble-0.0.195.dist-info → bumble-0.0.198.dist-info}/RECORD +50 -42
- {bumble-0.0.195.dist-info → bumble-0.0.198.dist-info}/WHEEL +1 -1
- {bumble-0.0.195.dist-info → bumble-0.0.198.dist-info}/LICENSE +0 -0
- {bumble-0.0.195.dist-info → bumble-0.0.198.dist-info}/entry_points.txt +0 -0
- {bumble-0.0.195.dist-info → bumble-0.0.198.dist-info}/top_level.txt +0 -0
bumble/colors.py
CHANGED
|
@@ -16,6 +16,10 @@ from functools import partial
|
|
|
16
16
|
from typing import List, Optional, Union
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
class ColorError(ValueError):
|
|
20
|
+
"""Error raised when a color spec is invalid."""
|
|
21
|
+
|
|
22
|
+
|
|
19
23
|
# ANSI color names. There is also a "default"
|
|
20
24
|
COLORS = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
|
|
21
25
|
|
|
@@ -52,7 +56,7 @@ def _color_code(spec: ColorSpec, base: int) -> str:
|
|
|
52
56
|
elif isinstance(spec, int) and 0 <= spec <= 255:
|
|
53
57
|
return _join(base + 8, 5, spec)
|
|
54
58
|
else:
|
|
55
|
-
raise
|
|
59
|
+
raise ColorError('Invalid color spec "%s"' % spec)
|
|
56
60
|
|
|
57
61
|
|
|
58
62
|
def color(
|
|
@@ -72,7 +76,7 @@ def color(
|
|
|
72
76
|
if style_part in STYLES:
|
|
73
77
|
codes.append(STYLES.index(style_part))
|
|
74
78
|
else:
|
|
75
|
-
raise
|
|
79
|
+
raise ColorError('Invalid style "%s"' % style_part)
|
|
76
80
|
|
|
77
81
|
if codes:
|
|
78
82
|
return '\x1b[{0}m{1}\x1b[0m'.format(_join(*codes), s)
|
bumble/core.py
CHANGED
|
@@ -79,7 +79,13 @@ def get_dict_key_by_value(dictionary, value):
|
|
|
79
79
|
# -----------------------------------------------------------------------------
|
|
80
80
|
# Exceptions
|
|
81
81
|
# -----------------------------------------------------------------------------
|
|
82
|
-
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class BaseBumbleError(Exception):
|
|
85
|
+
"""Base Error raised by Bumble."""
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class BaseError(BaseBumbleError):
|
|
83
89
|
"""Base class for errors with an error code, error name and namespace"""
|
|
84
90
|
|
|
85
91
|
def __init__(
|
|
@@ -118,18 +124,42 @@ class ProtocolError(BaseError):
|
|
|
118
124
|
"""Protocol Error"""
|
|
119
125
|
|
|
120
126
|
|
|
121
|
-
class TimeoutError(
|
|
127
|
+
class TimeoutError(BaseBumbleError): # pylint: disable=redefined-builtin
|
|
122
128
|
"""Timeout Error"""
|
|
123
129
|
|
|
124
130
|
|
|
125
|
-
class CommandTimeoutError(
|
|
131
|
+
class CommandTimeoutError(BaseBumbleError):
|
|
126
132
|
"""Command Timeout Error"""
|
|
127
133
|
|
|
128
134
|
|
|
129
|
-
class InvalidStateError(
|
|
135
|
+
class InvalidStateError(BaseBumbleError):
|
|
130
136
|
"""Invalid State Error"""
|
|
131
137
|
|
|
132
138
|
|
|
139
|
+
class InvalidArgumentError(BaseBumbleError, ValueError):
|
|
140
|
+
"""Invalid Argument Error"""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class InvalidPacketError(BaseBumbleError, ValueError):
|
|
144
|
+
"""Invalid Packet Error"""
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class InvalidOperationError(BaseBumbleError, RuntimeError):
|
|
148
|
+
"""Invalid Operation Error"""
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class NotSupportedError(BaseBumbleError, RuntimeError):
|
|
152
|
+
"""Not Supported"""
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class OutOfResourcesError(BaseBumbleError, RuntimeError):
|
|
156
|
+
"""Out of Resources Error"""
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class UnreachableError(BaseBumbleError):
|
|
160
|
+
"""The code path raising this error should be unreachable."""
|
|
161
|
+
|
|
162
|
+
|
|
133
163
|
class ConnectionError(BaseError): # pylint: disable=redefined-builtin
|
|
134
164
|
"""Connection Error"""
|
|
135
165
|
|
|
@@ -188,12 +218,12 @@ class UUID:
|
|
|
188
218
|
or uuid_str_or_int[18] != '-'
|
|
189
219
|
or uuid_str_or_int[23] != '-'
|
|
190
220
|
):
|
|
191
|
-
raise
|
|
221
|
+
raise InvalidArgumentError('invalid UUID format')
|
|
192
222
|
uuid_str = uuid_str_or_int.replace('-', '')
|
|
193
223
|
else:
|
|
194
224
|
uuid_str = uuid_str_or_int
|
|
195
225
|
if len(uuid_str) != 32 and len(uuid_str) != 8 and len(uuid_str) != 4:
|
|
196
|
-
raise
|
|
226
|
+
raise InvalidArgumentError(f"invalid UUID format: {uuid_str}")
|
|
197
227
|
self.uuid_bytes = bytes(reversed(bytes.fromhex(uuid_str)))
|
|
198
228
|
self.name = name
|
|
199
229
|
|
|
@@ -218,7 +248,7 @@ class UUID:
|
|
|
218
248
|
|
|
219
249
|
return self.register()
|
|
220
250
|
|
|
221
|
-
raise
|
|
251
|
+
raise InvalidArgumentError('only 2, 4 and 16 bytes are allowed')
|
|
222
252
|
|
|
223
253
|
@classmethod
|
|
224
254
|
def from_16_bits(cls, uuid_16: int, name: Optional[str] = None) -> UUID:
|