Skip to content

Commit

Permalink
SCO: A loopback example
Browse files Browse the repository at this point in the history
  • Loading branch information
zxzxwu committed Sep 27, 2023
1 parent 9f0bcc1 commit 45edcaf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/run_hfp_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
BT_BR_EDR_TRANSPORT,
)
from bumble import rfcomm, hfp
from bumble.hci import HCI_SynchronousDataPacket
from bumble.sdp import (
Client as SDP_Client,
DataElement,
Expand Down Expand Up @@ -197,6 +198,13 @@ async def main():
print('@@@ Disconnected from RFCOMM server')
return

def on_sco(connection_handle: int, packet: HCI_SynchronousDataPacket):
# Reset packet and loopback
packet.packet_status = 0
device.host.send_hci_packet(packet)

device.host.on('sco_packet', on_sco)

# Protocol loop (just for testing at this point)
protocol = hfp.HfpProtocol(session)
while True:
Expand Down

0 comments on commit 45edcaf

Please sign in to comment.