From cf60b5ffbb091624a957913e5cc8076672705c85 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Mon, 12 Jan 2026 13:14:26 +0800 Subject: [PATCH] Replace send_pdu() with write() --- bumble/avctp.py | 2 +- bumble/avdtp.py | 6 +++--- bumble/hid.py | 4 ++-- bumble/pandora/l2cap.py | 2 +- bumble/rfcomm.py | 2 +- bumble/sdp.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bumble/avctp.py b/bumble/avctp.py index 157e5c5..c602b60 100644 --- a/bumble/avctp.py +++ b/bumble/avctp.py @@ -235,7 +235,7 @@ class Protocol: ) + payload ) - self.l2cap_channel.send_pdu(pdu) + self.l2cap_channel.write(pdu) def send_command(self, transaction_label: int, pid: int, payload: bytes) -> None: logger.debug( diff --git a/bumble/avdtp.py b/bumble/avdtp.py index bcc9f7e..e968ec1 100644 --- a/bumble/avdtp.py +++ b/bumble/avdtp.py @@ -268,7 +268,7 @@ class MediaPacketPump: await self.clock.sleep(delay) # Emit - rtp_channel.send_pdu(bytes(packet)) + rtp_channel.write(bytes(packet)) logger.debug( f'{color(">>> sending RTP packet:", "green")} {packet}' ) @@ -1519,7 +1519,7 @@ class Protocol(utils.EventEmitter): header = bytes([first_header_byte]) # Send one packet - self.l2cap_channel.send_pdu(header + payload[:max_fragment_size]) + self.l2cap_channel.write(header + payload[:max_fragment_size]) # Prepare for the next packet payload = payload[max_fragment_size:] @@ -1829,7 +1829,7 @@ class Stream: def send_media_packet(self, packet: MediaPacket) -> None: assert self.rtp_channel - self.rtp_channel.send_pdu(bytes(packet)) + self.rtp_channel.write(bytes(packet)) async def configure(self) -> None: if self.state != State.IDLE: diff --git a/bumble/hid.py b/bumble/hid.py index 232640c..3a89e49 100644 --- a/bumble/hid.py +++ b/bumble/hid.py @@ -312,11 +312,11 @@ class HID(ABC, utils.EventEmitter): def send_pdu_on_ctrl(self, msg: bytes) -> None: assert self.l2cap_ctrl_channel - self.l2cap_ctrl_channel.send_pdu(msg) + self.l2cap_ctrl_channel.write(msg) def send_pdu_on_intr(self, msg: bytes) -> None: assert self.l2cap_intr_channel - self.l2cap_intr_channel.send_pdu(msg) + self.l2cap_intr_channel.write(msg) def send_data(self, data: bytes) -> None: if self.role == HID.Role.HOST: diff --git a/bumble/pandora/l2cap.py b/bumble/pandora/l2cap.py index 45559ea..85a6642 100644 --- a/bumble/pandora/l2cap.py +++ b/bumble/pandora/l2cap.py @@ -278,7 +278,7 @@ class L2CAPService(L2CAPServicer): if not l2cap_channel: return SendResponse(error=COMMAND_NOT_UNDERSTOOD) if isinstance(l2cap_channel, ClassicChannel): - l2cap_channel.send_pdu(request.data) + l2cap_channel.write(request.data) else: l2cap_channel.write(request.data) return SendResponse(success=empty_pb2.Empty()) diff --git a/bumble/rfcomm.py b/bumble/rfcomm.py index aa5236f..5512a15 100644 --- a/bumble/rfcomm.py +++ b/bumble/rfcomm.py @@ -800,7 +800,7 @@ class Multiplexer(utils.EventEmitter): def send_frame(self, frame: RFCOMM_Frame) -> None: logger.debug(f'>>> Multiplexer sending {frame}') - self.l2cap_channel.send_pdu(frame) + self.l2cap_channel.write(bytes(frame)) def on_pdu(self, pdu: bytes) -> None: frame = RFCOMM_Frame.from_bytes(pdu) diff --git a/bumble/sdp.py b/bumble/sdp.py index 912afeb..afabd9a 100644 --- a/bumble/sdp.py +++ b/bumble/sdp.py @@ -847,7 +847,7 @@ class Client: self.pending_request = request try: - self.channel.send_pdu(bytes(request)) + self.channel.write(bytes(request)) return await self.pending_response finally: self.pending_request = None @@ -1061,7 +1061,7 @@ class Server: def send_response(self, response): logger.debug(f'{color(">>> Sending SDP Response", "blue")}: {response}') - self.channel.send_pdu(response) + self.channel.write(response) def match_services(self, search_pattern: DataElement) -> dict[int, Service]: # Find the services for which the attributes in the pattern is a subset of the