h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
670 stars 138 forks source link

Read / Write BLERemoteCharacteristic like stream or serial #626

Open softwarecrash opened 6 months ago

softwarecrash commented 6 months ago

Hello, i hope anyone can help me with my little problem.

i have a Bluetooth device that act like a serial interface, it wait for data like A503000.... and answer with similar over wire it works perfect, so it exist a Bluetooth dongle for this device that "replace" the wire and give me the serviceUUID: 0xfff0

so i have a library/function that build and send this data, and receive it and split it in readable pieces, badly the library need a stream class where it can send and receive.

any chance to build a function that create a stream class like a serial with read, write, flush, available... from the BLERemoteCharacteristic?

the BluetoothSerial library doesn't work, it cant discover or connect this Bluetooth device.

h2zero commented 3 weeks ago

This would require skipping the GATT layer and going to l2cap. This is possible but probably not something many would be familiar with. When the PR at esp-nimble-cpp is ready I will look to add it here.