2

One of the features of Bluetooth v4.1 is the ability to exchange BLE data at the L2CAP layer. The L2CAP layer is lower than the GATT layer which will result in higher throughput of data exchange. I was wondering is there any Stack/OS that has exposed this feature (especially BlueZ/Android/iOS)?

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72

2 Answers2

2

With Bluez, you can open a L2CAP socket with the channel identifier 4 (for LE). The kernel will accept the incoming connection (and also do pairing, if you set the security level to medium or high), and pass it on to any AF_BLUETOOTH socket that is listening on that channel (4).

Now you have a BLE L2CAP socket, where you can all the GATT/ATT communication yourself.

Lasse Meyer
  • 1,429
  • 18
  • 38
2

iOS does support L2CAP CO with iOS 10.2+ - see https://developer.apple.com/documentation/corebluetooth/cbl2capchannel

Android doesn't support this as far as i could test. I'm still waiting for that feature....

UPDATE: Removed wrong link

javaBeCool
  • 276
  • 3
  • 13
  • ... and will be improved with iOS11. – Christopher Aug 03 '17 at 10:28
  • i've to correct it. The class is called `CBL2CAPChannel` – javaBeCool Aug 03 '17 at 14:41
  • Is the BluetoothSocket with TYPE_L2CAP the parallel in Android world? https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html – Amruta Oct 04 '17 at 10:01
  • currently i couldn't connect to an BLE peripheral via the TYPE_L2CAP. In the source of android it is defined as an alternative of rfcomm. Due tue the issue that L2CAP is available on Classic BT and BLE. It's just for Classic BT. (https://www.bluetooth.com/specifications/assigned-numbers/logical-link-control). If you want to use a channel oriented communication (coc) over BLE you need Android O (8) see: https://source.android.com/devices/bluetooth/services it's an open point at android – javaBeCool Oct 04 '17 at 15:01
  • it's an open point at android. But currently no support by any manufacturer – javaBeCool Oct 04 '17 at 15:06
  • @javaBeCool this link says explicitly that supported SDK is *macOS 10.2+* ... so why/how iOS would support it? – raistlin Oct 31 '17 at 09:59
  • @raistlin please see my comment --> CBL2CAPChannel. At that time it was released there was no official public API. Now you can find the iOS option under https://developer.apple.com/documentation/corebluetooth/cbl2capchannel – javaBeCool Nov 23 '17 at 17:40