bumble 0.0.218__py3-none-any.whl → 0.0.219__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/a2dp.py +57 -18
- bumble/avctp.py +8 -12
- bumble/avdtp.py +584 -533
- bumble/avrcp.py +20 -20
- bumble/controller.py +429 -229
- bumble/drivers/rtk.py +3 -1
- bumble/hci.py +38 -0
- bumble/hid.py +1 -1
- bumble/rfcomm.py +7 -3
- bumble/transport/common.py +6 -3
- bumble/transport/ws_client.py +2 -2
- bumble/transport/ws_server.py +16 -8
- {bumble-0.0.218.dist-info → bumble-0.0.219.dist-info}/METADATA +2 -2
- {bumble-0.0.218.dist-info → bumble-0.0.219.dist-info}/RECORD +19 -19
- {bumble-0.0.218.dist-info → bumble-0.0.219.dist-info}/WHEEL +0 -0
- {bumble-0.0.218.dist-info → bumble-0.0.219.dist-info}/entry_points.txt +0 -0
- {bumble-0.0.218.dist-info → bumble-0.0.219.dist-info}/licenses/LICENSE +0 -0
- {bumble-0.0.218.dist-info → bumble-0.0.219.dist-info}/top_level.txt +0 -0
bumble/avrcp.py
CHANGED
|
@@ -22,21 +22,9 @@ import enum
|
|
|
22
22
|
import functools
|
|
23
23
|
import logging
|
|
24
24
|
import struct
|
|
25
|
+
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence
|
|
25
26
|
from dataclasses import dataclass, field
|
|
26
|
-
from typing import
|
|
27
|
-
AsyncIterator,
|
|
28
|
-
Awaitable,
|
|
29
|
-
Callable,
|
|
30
|
-
ClassVar,
|
|
31
|
-
Iterable,
|
|
32
|
-
List,
|
|
33
|
-
Optional,
|
|
34
|
-
Sequence,
|
|
35
|
-
SupportsBytes,
|
|
36
|
-
TypeVar,
|
|
37
|
-
Union,
|
|
38
|
-
cast,
|
|
39
|
-
)
|
|
27
|
+
from typing import ClassVar, Optional, SupportsBytes, TypeVar, Union
|
|
40
28
|
|
|
41
29
|
from bumble import avc, avctp, core, hci, l2cap, utils
|
|
42
30
|
from bumble.colors import color
|
|
@@ -1762,7 +1750,11 @@ class Protocol(utils.EventEmitter):
|
|
|
1762
1750
|
),
|
|
1763
1751
|
)
|
|
1764
1752
|
response = self._check_response(response_context, GetCapabilitiesResponse)
|
|
1765
|
-
return
|
|
1753
|
+
return list(
|
|
1754
|
+
capability
|
|
1755
|
+
for capability in response.capabilities
|
|
1756
|
+
if isinstance(capability, EventId)
|
|
1757
|
+
)
|
|
1766
1758
|
|
|
1767
1759
|
async def get_play_status(self) -> SongAndPlayStatus:
|
|
1768
1760
|
"""Get the play status of the connected peer."""
|
|
@@ -2012,9 +2004,12 @@ class Protocol(utils.EventEmitter):
|
|
|
2012
2004
|
|
|
2013
2005
|
self.emit(self.EVENT_STOP)
|
|
2014
2006
|
|
|
2015
|
-
def _on_avctp_command(
|
|
2016
|
-
|
|
2017
|
-
|
|
2007
|
+
def _on_avctp_command(self, transaction_label: int, payload: bytes) -> None:
|
|
2008
|
+
command = avc.CommandFrame.from_bytes(payload)
|
|
2009
|
+
if not isinstance(command, avc.CommandFrame):
|
|
2010
|
+
raise core.InvalidPacketError(
|
|
2011
|
+
f"{command} is not a valid AV/C Command Frame"
|
|
2012
|
+
)
|
|
2018
2013
|
logger.debug(
|
|
2019
2014
|
f"<<< AVCTP Command, transaction_label={transaction_label}: " f"{command}"
|
|
2020
2015
|
)
|
|
@@ -2073,8 +2068,13 @@ class Protocol(utils.EventEmitter):
|
|
|
2073
2068
|
self.send_not_implemented_response(transaction_label, command)
|
|
2074
2069
|
|
|
2075
2070
|
def _on_avctp_response(
|
|
2076
|
-
self, transaction_label: int,
|
|
2071
|
+
self, transaction_label: int, payload: Optional[bytes]
|
|
2077
2072
|
) -> None:
|
|
2073
|
+
response = avc.ResponseFrame.from_bytes(payload) if payload else None
|
|
2074
|
+
if not isinstance(response, avc.ResponseFrame):
|
|
2075
|
+
raise core.InvalidPacketError(
|
|
2076
|
+
f"{response} is not a valid AV/C Response Frame"
|
|
2077
|
+
)
|
|
2078
2078
|
logger.debug(
|
|
2079
2079
|
f"<<< AVCTP Response, transaction_label={transaction_label}: {response}"
|
|
2080
2080
|
)
|
|
@@ -2391,7 +2391,7 @@ class Protocol(utils.EventEmitter):
|
|
|
2391
2391
|
effective_volume = await self.delegate.get_absolute_volume()
|
|
2392
2392
|
self.send_avrcp_response(
|
|
2393
2393
|
transaction_label,
|
|
2394
|
-
avc.ResponseFrame.ResponseCode.
|
|
2394
|
+
avc.ResponseFrame.ResponseCode.ACCEPTED,
|
|
2395
2395
|
SetAbsoluteVolumeResponse(effective_volume),
|
|
2396
2396
|
)
|
|
2397
2397
|
|