mirror of
https://github.com/google/bumble.git
synced 2026-05-08 03:58:01 +00:00
Cleanup HID module
* Remove unused imports * Replace typing exceptions by better assertions
This commit is contained in:
@@ -18,15 +18,14 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import logging
|
import logging
|
||||||
import asyncio
|
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
from pyee import EventEmitter
|
from pyee import EventEmitter
|
||||||
from typing import Optional, Tuple, Callable, Dict, Union, TYPE_CHECKING
|
from typing import Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from . import core, l2cap # type: ignore
|
from bumble import l2cap
|
||||||
from .colors import color # type: ignore
|
from bumble.colors import color
|
||||||
from .core import BT_BR_EDR_TRANSPORT, InvalidStateError, ProtocolError # type: ignore
|
from bumble.core import InvalidStateError, ProtocolError
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from bumble.device import Device, Connection
|
from bumble.device import Device, Connection
|
||||||
@@ -302,10 +301,12 @@ class Host(EventEmitter):
|
|||||||
self.send_pdu_on_ctrl(hid_message)
|
self.send_pdu_on_ctrl(hid_message)
|
||||||
|
|
||||||
def send_pdu_on_ctrl(self, msg: bytes) -> None:
|
def send_pdu_on_ctrl(self, msg: bytes) -> None:
|
||||||
self.l2cap_ctrl_channel.send_pdu(msg) # type: ignore
|
assert self.l2cap_ctrl_channel
|
||||||
|
self.l2cap_ctrl_channel.send_pdu(msg)
|
||||||
|
|
||||||
def send_pdu_on_intr(self, msg: bytes) -> None:
|
def send_pdu_on_intr(self, msg: bytes) -> None:
|
||||||
self.l2cap_intr_channel.send_pdu(msg) # type: ignore
|
assert self.l2cap_intr_channel
|
||||||
|
self.l2cap_intr_channel.send_pdu(msg)
|
||||||
|
|
||||||
def send_data(self, data):
|
def send_data(self, data):
|
||||||
msg = SendData(data)
|
msg = SendData(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user