Open rado99 opened 5 years ago
Hi,
just add empty function bool onConfirmPIN(uint32_t){return false;}
to MySecurity callback.
Hello, now it is compiling, but I face with another problem: After trying to pair with my phone device (Galaxy J6, Android 8.0) and nRF connect I cannot pair with PIN 123456, how it is defined in the code.
It is hardcoded as an example. You have to connect keyboard and/or display to use pairing with PIN. Here it is passed: https://github.com/chegewara/esp32-snippets/blob/wip/cpp_utils/BLEDevice.cpp#L210 There is implemented in esp-idf option to use fixed PIN on esp32 and should works with this library too.
Hello, this is a Snippet from the code I am using:
class MySecurity : public BLESecurityCallbacks {
uint32_t onPassKeyRequest(){
ESP_LOGI(LOG_TAG, "PassKeyRequest");
return 123456;
}
bool onConfirmPIN(uint32_t){
return false;
}
void onPassKeyNotify(uint32_t pass_key){
ESP_LOGI(LOG_TAG, "On passkey Notify number:%d", pass_key);
}
bool onSecurityRequest(){
ESP_LOGI(LOG_TAG, "On Security Request");
return true;
}
void onAuthenticationComplete(esp_ble_auth_cmpl_t cmpl){
ESP_LOGI(LOG_TAG, "Starting BLE work!");
if(cmpl.success){
uint16_t length;
esp_ble_gap_get_whitelist_size(&length);
ESP_LOGD(LOG_TAG, "size: %d", length);
}
}
};
But, when I enable the debug console, I am receiving the PIN in in:
[I][ble.ino:47] onPassKeyNotify(): On passkey Notify number:868118
Which is different from 123456.
Yes, this is esp32 PIN that you need to enter in your phone to pair with esp32:
onPassKeyNotify(): On passkey Notify number:868118
It is random generated, so you need display it on esp32 somehow.
Then, why I need this callback function?
uint32_t onPassKeyRequest(){
ESP_LOGI(LOG_TAG, "PassKeyRequest");
return 123456;
}
Because its virtual and i have to change code to fix. This function is if esp32 would have keyboard and smartpone would display PIN to enter.
Oh, now I understand. My Development board is Wrover kit and I can simply display the PIN code, but I plan to have a board with native ESP32, and for now it looks like I have to think some method to implement a keyboard :(
Hello, when I am trying to compile code I receive this error. C:\Users\rado_\AppData\Local\Temp\arduino_build_999569\sketch\bsec_iot_example.ino.cpp.o:(.rodata._ZTV10MySecurity[vtable for MySecurity]+0x20): undefined reference to `BLESecurityCallbacks::onConfirmPIN(unsigned int)'. Can you help me?