Add RFCOMM and SDP helpers

This commit is contained in:
Josh Wu
2024-02-02 13:55:54 +08:00
parent c6cfd101df
commit 10e53553d7
5 changed files with 183 additions and 75 deletions

View File

@@ -19,6 +19,7 @@ from __future__ import annotations
import logging
import struct
from typing import Dict, List, Type, Optional, Tuple, Union, NewType, TYPE_CHECKING
from typing_extensions import Self
from . import core, l2cap
from .colors import color
@@ -920,6 +921,13 @@ class Client:
return ServiceAttribute.list_from_data_elements(attribute_list_sequence.value)
async def __aenter__(self) -> Self:
await self.connect()
return self
async def __aexit__(self, *args) -> None:
await self.disconnect()
# -----------------------------------------------------------------------------
class Server: