Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LE Connection-Oriented Channels - Android support

Here is stated that Android 8.0 supports LE Connection-Oriented Channels. However I don't see any reference of it in the Android API. The BluetoothAdapter class only has only methods for listening RFCOMM sockets (which runs on BT Classic only); and the BluetoothSocket class says: "The most common type of Bluetooth socket is RFCOMM, which is the type supported by the Android APIs."

How is possible to use LE CoC? Can someone help to clarify this confusion? Moreover is seems they are supported by the BLE stack that runs below the Java API, see here for example.

like image 488
Šatov Avatar asked Jul 09 '26 22:07

Šatov


1 Answers

LE L2CAP Connection Oriented Channel Support is a new introduced feature at core spec 4.1.

After reviewed the android 8.0 code(I did not test CoC feature since it need remote device also support CoC), from the code perspective you should able to use this feature at Android 8.0.

Let's assume you want to connect socket act as a client at Phone side, you do not need call RFCOMM socket but call L2CAP, use following socket API; Note that two items need mentioned: 1) Use the TYPE_L2CAP when init the socket structure. 2) Apply the CoC mask(0x20000) when set the socket port.

Here is the JNI link: JNI

Here is the stack link: stack

Under Here you will find the socket link to L2CAP connections.

Line #912 on this page indicate the CoC format.

like image 88
Guo Xingmin Avatar answered Jul 11 '26 12:07

Guo Xingmin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!