mirror of
https://github.com/google/bumble.git
synced 2026-04-17 00:35:31 +00:00
Fix typos
This commit is contained in:
@@ -56,7 +56,7 @@ body, h1, h2, h3, h4, h5, h6 {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
margin: 6px;
|
margin: 6px;
|
||||||
margin-left: 0px;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
th, td {
|
th, td {
|
||||||
@@ -65,7 +65,7 @@ th, td {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.properties td:nth-child(even) {
|
.properties td:nth-child(even) {
|
||||||
background-color: #D6EEEE;
|
background-color: #d6eeee;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Bumble Speaker</title>
|
<title>Bumble Speaker</title>
|
||||||
<script type="text/javascript" src="speaker.js"></script>
|
<script src="speaker.js"></script>
|
||||||
<link rel="stylesheet" href="speaker.css">
|
<link rel="stylesheet" href="speaker.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -78,7 +78,13 @@ def get_dict_key_by_value(dictionary, value):
|
|||||||
class BaseError(Exception):
|
class BaseError(Exception):
|
||||||
"""Base class for errors with an error code, error name and namespace"""
|
"""Base class for errors with an error code, error name and namespace"""
|
||||||
|
|
||||||
def __init__(self, error_code, error_namespace='', error_name='', details=''):
|
def __init__(
|
||||||
|
self,
|
||||||
|
error_code: int | None,
|
||||||
|
error_namespace: str = '',
|
||||||
|
error_name: str = '',
|
||||||
|
details: str = '',
|
||||||
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.error_code = error_code
|
self.error_code = error_code
|
||||||
self.error_namespace = error_namespace
|
self.error_namespace = error_namespace
|
||||||
@@ -90,12 +96,14 @@ class BaseError(Exception):
|
|||||||
namespace = f'{self.error_namespace}/'
|
namespace = f'{self.error_namespace}/'
|
||||||
else:
|
else:
|
||||||
namespace = ''
|
namespace = ''
|
||||||
if self.error_name:
|
error_text = {
|
||||||
name = f'{self.error_name} [0x{self.error_code:X}]'
|
(True, True): f'{self.error_name} [0x{self.error_code:X}]',
|
||||||
else:
|
(True, False): self.error_name,
|
||||||
name = f'0x{self.error_code:X}'
|
(False, True): f'0x{self.error_code:X}',
|
||||||
|
(False, False): '',
|
||||||
|
}[(self.error_name != '', self.error_code is not None)]
|
||||||
|
|
||||||
return f'{type(self).__name__}({namespace}{name})'
|
return f'{type(self).__name__}({namespace}{error_text})'
|
||||||
|
|
||||||
|
|
||||||
class ProtocolError(BaseError):
|
class ProtocolError(BaseError):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import dataclasses
|
|||||||
import enum
|
import enum
|
||||||
import traceback
|
import traceback
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Dict, List, Union, Set
|
from typing import Dict, List, Union, Set, TYPE_CHECKING
|
||||||
|
|
||||||
from . import at
|
from . import at
|
||||||
from . import rfcomm
|
from . import rfcomm
|
||||||
@@ -51,6 +51,15 @@ from bumble.sdp import (
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Error
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
class HfpProtocolError(ProtocolError):
|
||||||
|
def __init__(self, error_name: str = '', details: str = ''):
|
||||||
|
super().__init__(None, 'hfp', error_name, details)
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Protocol Support
|
# Protocol Support
|
||||||
@@ -361,8 +370,12 @@ class HfProtocol:
|
|||||||
|
|
||||||
dlc: rfcomm.DLC
|
dlc: rfcomm.DLC
|
||||||
command_lock: asyncio.Lock
|
command_lock: asyncio.Lock
|
||||||
response_queue: asyncio.Queue
|
if TYPE_CHECKING:
|
||||||
unsolicited_queue: asyncio.Queue
|
response_queue: asyncio.Queue[AtResponse]
|
||||||
|
unsolicited_queue: asyncio.Queue[AtResponse]
|
||||||
|
else:
|
||||||
|
response_queue: asyncio.Queue
|
||||||
|
unsolicited_queue: asyncio.Queue
|
||||||
read_buffer: bytearray
|
read_buffer: bytearray
|
||||||
|
|
||||||
def __init__(self, dlc: rfcomm.DLC, configuration: Configuration):
|
def __init__(self, dlc: rfcomm.DLC, configuration: Configuration):
|
||||||
@@ -427,7 +440,7 @@ class HfProtocol:
|
|||||||
else:
|
else:
|
||||||
logger.warning(f"dropping unexpected response with code '{response.code}'")
|
logger.warning(f"dropping unexpected response with code '{response.code}'")
|
||||||
|
|
||||||
# Send an AT command and wait for the peer resposne.
|
# Send an AT command and wait for the peer response.
|
||||||
# Wait for the AT responses sent by the peer, to the status code.
|
# Wait for the AT responses sent by the peer, to the status code.
|
||||||
# Raises asyncio.TimeoutError if the status is not received
|
# Raises asyncio.TimeoutError if the status is not received
|
||||||
# after a timeout (default 1 second).
|
# after a timeout (default 1 second).
|
||||||
@@ -449,7 +462,7 @@ class HfProtocol:
|
|||||||
)
|
)
|
||||||
if result.code == 'OK':
|
if result.code == 'OK':
|
||||||
if response_type == AtResponseType.SINGLE and len(responses) != 1:
|
if response_type == AtResponseType.SINGLE and len(responses) != 1:
|
||||||
raise ProtocolError("NO ANSWER")
|
raise HfpProtocolError("NO ANSWER")
|
||||||
|
|
||||||
if response_type == AtResponseType.MULTIPLE:
|
if response_type == AtResponseType.MULTIPLE:
|
||||||
return responses
|
return responses
|
||||||
@@ -457,7 +470,7 @@ class HfProtocol:
|
|||||||
return responses[0]
|
return responses[0]
|
||||||
return None
|
return None
|
||||||
if result.code in STATUS_CODES:
|
if result.code in STATUS_CODES:
|
||||||
raise ProtocolError(result.code)
|
raise HfpProtocolError(result.code)
|
||||||
responses.append(result)
|
responses.append(result)
|
||||||
|
|
||||||
# 4.2.1 Service Level Connection Initialization.
|
# 4.2.1 Service Level Connection Initialization.
|
||||||
|
|||||||
Reference in New Issue
Block a user