esp-nimble-cpp icon indicating copy to clipboard operation
esp-nimble-cpp copied to clipboard

Implement a means of asynchronous pin injections for Numeric Comparison and PassKey Input

Open csmith-morningstar opened this issue 2 years ago • 3 comments

Fixes #114

Summary of changes:

  • Split onPassKeyRequest into two separate functions:
    • onPassKeyDisplay which requests the pin (similar to old functionality)
    • onPassKeyEntry which notifies the application to prompt the user for a pin number. No return value
  • Changed onConfirmPIN to lack return value, instead just notifies the app to display the pin number
  • Added two functions to the NimBLEServer class: injectPassKey and injectConfirmPIN, which should be called when the user enters the PIN or presses confirm/cancel respectively.

csmith-morningstar avatar May 08 '23 19:05 csmith-morningstar

Thanks for this, I will test it shortly 😄

h2zero avatar May 14 '23 18:05 h2zero

@csmith-morningstar Sorry for taking so long with this. I have thought about it and there are a few things I would like to change.

  • The callback signature I believe would be beneficial to have a NimBLEConnInfo instance rather than just the address.
  • An overload of the InjectXXX() functions using a connection handle input would be nice to have.
  • The functions could also be moved to NimBLEDevice scope so that they could be used by the client code as well and convienience wrappers added to NimBLEClient and NimBLEServer.

Thanks again for submitting this, it's been a long time coming to fix it 😄

h2zero avatar Nov 26 '23 17:11 h2zero

I believe this is required to properly implement Google Fast Pair Service - as I've noted in my component example here. The way I've implemented it with bluedroid is to not respond there, simply store the key, and then respond in the side channel as I've noted here.

finger563 avatar Mar 08 '24 02:03 finger563

Closing this as #165 has been merged. Thank you @csmith-morningstar

h2zero avatar Jun 07 '24 01:06 h2zero