mirror of
https://github.com/google/bumble.git
synced 2026-04-18 00:45:32 +00:00
Replace send_pdu() with write()
This commit is contained in:
@@ -235,7 +235,7 @@ class Protocol:
|
|||||||
)
|
)
|
||||||
+ payload
|
+ payload
|
||||||
)
|
)
|
||||||
self.l2cap_channel.send_pdu(pdu)
|
self.l2cap_channel.write(pdu)
|
||||||
|
|
||||||
def send_command(self, transaction_label: int, pid: int, payload: bytes) -> None:
|
def send_command(self, transaction_label: int, pid: int, payload: bytes) -> None:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class MediaPacketPump:
|
|||||||
await self.clock.sleep(delay)
|
await self.clock.sleep(delay)
|
||||||
|
|
||||||
# Emit
|
# Emit
|
||||||
rtp_channel.send_pdu(bytes(packet))
|
rtp_channel.write(bytes(packet))
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f'{color(">>> sending RTP packet:", "green")} {packet}'
|
f'{color(">>> sending RTP packet:", "green")} {packet}'
|
||||||
)
|
)
|
||||||
@@ -1519,7 +1519,7 @@ class Protocol(utils.EventEmitter):
|
|||||||
header = bytes([first_header_byte])
|
header = bytes([first_header_byte])
|
||||||
|
|
||||||
# Send one packet
|
# 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
|
# Prepare for the next packet
|
||||||
payload = payload[max_fragment_size:]
|
payload = payload[max_fragment_size:]
|
||||||
@@ -1829,7 +1829,7 @@ class Stream:
|
|||||||
|
|
||||||
def send_media_packet(self, packet: MediaPacket) -> None:
|
def send_media_packet(self, packet: MediaPacket) -> None:
|
||||||
assert self.rtp_channel
|
assert self.rtp_channel
|
||||||
self.rtp_channel.send_pdu(bytes(packet))
|
self.rtp_channel.write(bytes(packet))
|
||||||
|
|
||||||
async def configure(self) -> None:
|
async def configure(self) -> None:
|
||||||
if self.state != State.IDLE:
|
if self.state != State.IDLE:
|
||||||
|
|||||||
@@ -312,11 +312,11 @@ class HID(ABC, utils.EventEmitter):
|
|||||||
|
|
||||||
def send_pdu_on_ctrl(self, msg: bytes) -> None:
|
def send_pdu_on_ctrl(self, msg: bytes) -> None:
|
||||||
assert self.l2cap_ctrl_channel
|
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:
|
def send_pdu_on_intr(self, msg: bytes) -> None:
|
||||||
assert self.l2cap_intr_channel
|
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:
|
def send_data(self, data: bytes) -> None:
|
||||||
if self.role == HID.Role.HOST:
|
if self.role == HID.Role.HOST:
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ class L2CAPService(L2CAPServicer):
|
|||||||
if not l2cap_channel:
|
if not l2cap_channel:
|
||||||
return SendResponse(error=COMMAND_NOT_UNDERSTOOD)
|
return SendResponse(error=COMMAND_NOT_UNDERSTOOD)
|
||||||
if isinstance(l2cap_channel, ClassicChannel):
|
if isinstance(l2cap_channel, ClassicChannel):
|
||||||
l2cap_channel.send_pdu(request.data)
|
l2cap_channel.write(request.data)
|
||||||
else:
|
else:
|
||||||
l2cap_channel.write(request.data)
|
l2cap_channel.write(request.data)
|
||||||
return SendResponse(success=empty_pb2.Empty())
|
return SendResponse(success=empty_pb2.Empty())
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ class Multiplexer(utils.EventEmitter):
|
|||||||
|
|
||||||
def send_frame(self, frame: RFCOMM_Frame) -> None:
|
def send_frame(self, frame: RFCOMM_Frame) -> None:
|
||||||
logger.debug(f'>>> Multiplexer sending {frame}')
|
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:
|
def on_pdu(self, pdu: bytes) -> None:
|
||||||
frame = RFCOMM_Frame.from_bytes(pdu)
|
frame = RFCOMM_Frame.from_bytes(pdu)
|
||||||
|
|||||||
@@ -847,7 +847,7 @@ class Client:
|
|||||||
self.pending_request = request
|
self.pending_request = request
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.channel.send_pdu(bytes(request))
|
self.channel.write(bytes(request))
|
||||||
return await self.pending_response
|
return await self.pending_response
|
||||||
finally:
|
finally:
|
||||||
self.pending_request = None
|
self.pending_request = None
|
||||||
@@ -1061,7 +1061,7 @@ class Server:
|
|||||||
|
|
||||||
def send_response(self, response):
|
def send_response(self, response):
|
||||||
logger.debug(f'{color(">>> Sending SDP Response", "blue")}: {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]:
|
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
|
# Find the services for which the attributes in the pattern is a subset of the
|
||||||
|
|||||||
Reference in New Issue
Block a user