Expand description
Bluetooth RFCOMM (Serial Port Emulation Protocol)
Implements the RFCOMM multiplexer protocol over L2CAP (PSM 0x0003), providing RS-232 serial port emulation. Supports credit-based flow control, FCS computation, modem status commands, and DLCI-based multiplexing for multiple simultaneous serial connections.
Reference: Bluetooth Core Specification v5.4, RFCOMM with TS 07.10
Structs§
- Credit
Flow Control - Credit-based flow control state for an RFCOMM channel
- Modem
Signals - Modem signal bits for MSC (Modem Status Command)
- Rfcomm
Channel - An RFCOMM data channel (one per DLCI)
- Rfcomm
Frame - An RFCOMM frame
- Rfcomm
Multiplexer - RFCOMM multiplexer: manages all channels over a single L2CAP connection
Enums§
- Channel
State - RFCOMM channel state
- MuxCommand
Type - RFCOMM multiplexer control command types
Constants§
- DEFAULT_
INITIAL_ CREDITS - Default initial credits for credit-based flow control
- DLCI_
CONTROL - DLCI 0 is the multiplexer control channel
- FRAME_
DISC - DISC (Disconnect) - disconnect request
- FRAME_
DM - DM (Disconnected Mode) - rejection / channel not available
- FRAME_
SABM - SABM (Set Asynchronous Balanced Mode) - connection establishment
- FRAME_
UA - UA (Unnumbered Acknowledgement) - acknowledgement
- FRAME_
UIH - UIH (Unnumbered Information with Header check) - data transfer
- MAX_
DLCI - Maximum DLCI value (5 bits, 0-30 usable; 31 reserved)
- RFCOMM_
DEFAULT_ MTU - Default RFCOMM MTU (maximum frame size, N1)
- RFCOMM_
MAX_ FRAME_ DATA - Maximum RFCOMM frame data size for fixed-size buffers
- RFCOMM_
MAX_ MTU - Maximum RFCOMM MTU
- RFCOMM_
PSM - L2CAP PSM for RFCOMM
Functions§
- calculate_
fcs - Calculate FCS over a byte slice
- decode_
cr - Decode the C/R bit from an RFCOMM address byte
- decode_
dlci - Decode the DLCI from an RFCOMM address byte
- encode_
address - Encode the RFCOMM address byte from DLCI, C/R bit, and EA bit
- verify_
fcs - Verify FCS: compute over data + fcs byte, result should be 0xCF