Bluetooth is an industry-standard protocol that enables wireless connectivity for computers, handheld devices, mobile phones, and other devices.
RFCOMM emulates RS-232 (ITU-T V.24) serial ports. The emulation includes transfer of the state of the non-data circuits. RFCOMM has a built-in scheme for null modem emulation.
Service Definition Model
This blog will introduce how to use Windows Sockets functions to host a Bluetooth RFCOMM service, and use the Windows Runtime API to consume this service.
#1 ask for Windows Sockets API (WSA) 2.2
The socket initialization only be required once for one process, so I put the initialization code in a static function.
#2 create a Windows socket
#3 create a Bluetooth address and bind to Windows socket
#4 register a Bluetooth service (SDP)
#5 listen to the Windows socket
# CODE #
RFCOMM Server (C++):
Code on Github: https://github.com/dream-365/winapp/tree/master/BluetoothPlay