-
Notifications
You must be signed in to change notification settings - Fork 715
ESP32 BLE does not connect to Bluetooth LE Lamp (Magic Blue) #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry for confusion about So it looks like your esp32 is disconnecting even before connection is established. You can try to add this code to setup():
and those 2 functions:
I am using this code to debug every BLE code i write now. In arduino you can change ESP_LOGx with Serial.println(). |
Thanks for your quick response @chegewara. I added your recommended handlers. The new output is:
Still not sure how to proceed or fix this issue. Can you please help? |
Its hard to say, without part of code or device and cant help too much. |
After investigating more time, I've found the problem. The signature of BLEClient->connect is the following: So by default it uses the Working code
Can you quickly explain, what the difference is? |
@don41382 Public address is own address that is individual for each device and its static. Random address is used mostly to avoid device tracking but the main difference is that its changing usually every time device is powered up or start new advertising. You can see that most if not all smartphones, tablets and laptops are using random addressing. Thats why i introduced this in current version of library. There should be also BLEClient->connect() function where you can just pass advertised device instead of address and device address type and all is done by library. |
Thanks for the clarification. The advertising device was actually the critical hint. My BLE light bulb worked inside of the I think it would have helped me, if the connect would have been more explicit. IMO the address type |
Its for backward compatibility. Also in earlier version of library it was hardcoded, thats why i am very surprised there is some issue with it. |
i also getting a same error but i can't know how to fix this issue. @don41382 Can you help me to fix that issue. |
@anandharaj-dotworld sorry, it's been a while and I don't have the setup anymore. But did you read my last message? If this doesn't help - I've no clue. Good luck. |
@don41382 [D][BLEClient.cpp:180] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 0] ... Unknown |
Maybe its stupid question, but where do you see error in this message? |
@chegewara Yes, I received this in debug[D]. |
@chegewara . my code perfectly receiving characteristics value in 3 times. But 4th time I can't receive. How to solve this. And I using android application for ble notifier. |
There is nothing wrong with that message. |
@chegewara But why I received esp_GATT_if: 0. I receiving 1st time in esp_GATT_if: 4 and second time esp_GATT_if: 5 and third time esp_GATT_if: 6 and fourth time is esp_GATT_if: 0. |
@chegewara 4th time take long time to connect server. |
I dont know why you have this problem, just like i dont know you are not related logs and expecting someone help you with issue we have no idea about. |
@chegewara Can I share my code. |
` static BLEUUID serviceUUID("fd05a570-274a-4b1f-a5a3-eb52e5e02b8b"); static boolean doConnect = false; BLEScan* pBLEScan; void onDisconnect(BLEClient* pClient) { bool connectToServer() {
}
} void setup() { BLEScan* pBLEScan = BLEDevice::getScan(); }
} There is any mistake? |
Hey guys,
Thanks for the great support with the BLE connection. It works perfectly when I connect to my iBeacon. But I recently encountered the issue, that I am unable to connect to my BLE Light Bulb (Magic Blue).
It looks like the lamp requires a new GATT Client event:
Unknown GATT Client event type: 41
Unknown GATT Client event type: 2
Can somebody help me with this issue? I would be really grateful!
ESP32 ESP-WROOM-32
Arduino Code
Serial Output
The text was updated successfully, but these errors were encountered: