It took a long time before I figured out how things work.
Here is some information - for a start without code.
I looked at the
ESP-IDF BT-SPP-ACCEPTOR demo
https://github.com/espressif/esp-idf/tr ... p_acceptor
ESP-IDF BT-SPP-INITATOR demo
https://github.com/espressif/esp-idf/tr ... _initiator
and first I could not figure out which I should use to connect my mobile phone (Android) to an ESP32
After some time I figured out that I can connect from my phone to the Acceptor demo.
I have to pair my phone with the ESP_SPP_ACCEPTOR
After that is done I can open a terminal application on the mobile phone (i.e. Serial Bluetooth) and I can send data from my phone to the ESP32.
If the Acceptor is opened with a monitor program I can see that what I send on the phone is received by the ESP32. It is shown in HEX format.
That works with the Acceptor demo without any changes. It's only necessary to set the following to see the received data.
Code: Select all
#define SPP_SHOW_MODE SPP_SHOW_DATA
To be able to do that I analyzed how the communication is established and the code for sending and receiving data in the Acceptor and Initiator.
Then I copied the sending code from the Initiator to the Acceptor and the receiving code from the Acceptor to the Initiator.
Now finally that works. I can send and receive data in the Initiator and the Acceptor.
Currently the code which I worked on has lots of additional comment - which I added for my own understanding.
If anybody is interested I can publish that code here.
But maybe it would be better if I do that at GitHub. I have to admit I don't have much experience with them.
Now that this works in principle with the modified Initiator and Acceptor code my next step will be that I will work on the communication between my mobile phone and a modified version of the Acceptor.
Please let me know if you are interested in further info and which info.