my andoird bluetooth mac adress is hard coded in esp32 file.
I paired my andoird with esp32 bluetooth first time. (the esp32 device name is saved in the "paired devices" in my android tablet. Then next time, it will be automatically successfully paired.
Then I delete the bluetooth device on my android tablet under "paired devices" list. booted, it paried again, it seems to be ok and the device is still saved in the "paired devices" in my android tablet. Then I reboot my esp32, everytime, it will not automatically paired. In stead it showed me error on esp32 console.
<error>
RFCOMM channel open failed, status 106.
</error>
How to solve this problem?
Make RFCOMM channel open sucessfullly. Notice: My bluetooth mac adress is hard coded in esp32.
Thanks.
esp32 code
Code: Select all
bd_addr_t remote = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
dp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, BLUETOOTH_ATTRIBUTE_PUBLIC_BROWSE_ROOT);
Code: Select all
case RFCOMM_EVENT_CHANNEL_OPENED:
if (rfcomm_event_channel_opened_get_status(packet)) {
printf("RFCOMM channel open failed, status %u\n", rfcomm_event_channel_opened_get_status(packet));
} else {
rfcomm_channel_id = rfcomm_event_channel_opened_get_rfcomm_cid(packet);
mtu = rfcomm_event_channel_opened_get_max_frame_size(packet);
mtu_global = mtu;
printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_channel_id, mtu);
}