Differences between Nimble and Bluedroid, and a question.

voidful
Posts: 2
Joined: Thu Aug 31, 2023 1:32 am

Differences between Nimble and Bluedroid, and a question.

Postby voidful » Thu Sep 28, 2023 3:36 am

Hi all.
I am developing a BLE Host using esp32 and connecting a Ble 5.0 keyboard.
At first, I implemented it using Nimble's "blucent" example and everything worked fine, but found a strange bug.
If I type very fast on the keyboard... the Nimble stack couldn't handle the keystrokes and would block.

I then switched to Bluedroid's "esp_hid_host" and this never happened again.
(I guess this is a bug in Nimble.)

The bluetooth keyboard I use disconnects after 10 minutes of last typing.
(I can see this by looking at the logs on ESP32).

This is where I see the difference between Nimble and Bluedroid,
When the first key press occurs after disconnecting and CLOSED. (i.e. after 10 minutes without any typing),
Nimble: Receives a BLE_HCI_ADV_RPT_EVTYPE_DIR_IND packet.
Bluedroid: I don't receive any message (I don't see any logs, even with the verbose log option).

After disconnecting from the ESP32 bluedroid host, I need to do a pairing from scratch to reconnect before I can use it.
The reason I need to know the Message or Packet of first key press after 10 minutes is so that I can avoid this re-pairing and receive normal keyboard input.

If I connect the same keyboard to a laptop or PC, after 10 minutes, I can start typing again without the pairing step, although there is a slight delay at first.
I would like to use my ESP32 in the same way as the laptop, without having to re-pair each time.

My questions are as follows
1. In Nimble stack: When receiving BLE_HCI_ADV_RPT_EVTYPE_DIR_IND, how can I enable keyboard input again without re-pairing?
2. In Bluedroid stack: How do I know when a packet similar to Nimble's BLE_HCI_ADV_RPT_EVTYPE_DIR_IND is received?

gdsports
Posts: 15
Joined: Wed Aug 02, 2017 12:17 am

Re: Differences between Nimble and Bluedroid, and a question.

Postby gdsports » Tue Oct 03, 2023 6:14 am

Take a look at blemouse2xac which reconnects bonded BLE mice without pairing.
It is an Arduino program but the logic should applicable.

https://github.com/touchgadget/blemouse2xac

Who is online

Users browsing this forum: No registered users and 410 guests