ESP32-ANCS-Notifications icon indicating copy to clipboard operation
ESP32-ANCS-Notifications copied to clipboard

Cannot connect to iPhone

Open vladkorotnev opened this issue 3 years ago • 2 comments

I'm running the sample code with PlatformIO (Arduino framework on nodemcu-32s with espressif32, on a ESP-WROOM-32 devkit), using an iPhone 7 with iOS 13.0.

Trying to debug I have modified the ANCSBLEClient::setup method as follows:

void ANCSBLEClient::setup(const BLEAddress * address) {
	ESP_LOGI(LOG_TAG, "!! Setup Begin !!");
    BLEClient*  pClient  = BLEDevice::createClient();
    BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);
    BLEDevice::setSecurityCallbacks(new NotificationSecurityCallbacks()); // @todo memory leak?

    BLESecurity *pSecurity = new BLESecurity();
    pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_BOND);
    pSecurity->setCapability(ESP_IO_CAP_IO);
    pSecurity->setRespEncryptionKey(ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK);
    ESP_LOGI(LOG_TAG, "!! Setup Connect !!");
    // Connect to the remove BLE Server.
    pClient->connect(*address);

	ESP_LOGI(LOG_TAG, "!! Setup Service !!");

However, looking at the logs, the Connect part of the code never returns: log.log

Eventually, usually when leaving Bluetooth settings, the firmware will then crash due to #21.

Does anybody have experience with such a problem? Thanks

vladkorotnev avatar May 02 '22 11:05 vladkorotnev

Found a temp fix that works:

If using PlatformIO, change your platform line to platform = [email protected]. (anything newer than 3.5.0 will fail)

If using Arduino IDE, downgrade the ESP32 board to 1.0.6.

Exact reason is unclear but it works for me.

vladkorotnev avatar May 03 '22 06:05 vladkorotnev

Found a temp fix that works:

If using PlatformIO, change your platform line to platform = [email protected]. (anything newer than 3.5.0 will fail)

If using Arduino IDE, downgrade the ESP32 board to 1.0.6.

Exact reason is unclear but it works for me.

I want to hug you! Thank you so much for sharing, I just spent hours troubleshooting various issues, roadblock after roadblock. This last one was the board version though, and now my notifications are working. Thanks!

ThreepE0 avatar Dec 02 '22 18:12 ThreepE0