Search code examples
linuxbluetoothdbusbluez

Difference between Connecting and Pairing in BlueZ


I was looking through the Device API in BlueZ 5.44 and am a bit confused about the difference between Connecting and Pairing to a device. I see that connecting is profile based while pairing seems to profile independent. Pairing seemingly has more to do with SDP and authentication.

However, after reading that documentation I am still a bit confused about where one begins and the other ends. For example, must a device be paired before it can be connected? If anyone has any Bluetooth docs or BlueZ docs that detail this they would be much appreciated.


Solution

  • This is answered assuming that the OP intended to ask about classic bluetooth. classic pairing requires a lower layer bluetooth classic connection. whether a device need to be paired with another device is determined by the security level (defined in Generic Access Profile) of the devices involved. most Mobile Phones uses SecurityMode 4 ,Level 4 which enforces pairing for most profiles except SDP. This means that Service discovery can be done without pairing but the profiles which require a service level connection needs pairing. please see the details of the Security Modes in GAP profile section 5.2 in core_v5.0 bluetooth specification (https://www.bluetooth.com/specifications/bluetooth-core-specification) .confusion in the document mentioned by you can be avoided if you see service-level/profile-level connection and lower-layer connection separately.