espressif / esp-now

A connectionless Wi-Fi communication protocol
Apache License 2.0
477 stars 90 forks source link

Does espnow_sec_responder_start() returns confirms that secures connection successfully established? (AEGHB-161) #73

Closed horsemann07 closed 1 year ago

horsemann07 commented 1 year ago

Hi, As per my understanding, espnow_sec_responder_start() function is used to start the security process. It is used to initiate the security handshake between two devices, and it returns an error code if it fails. And I think it does not return a confirmation that the secure connection has been established. We know after successful connection app key will be set, but at application side we don't know when it is done. We don't get any acknowledgement.

As per my way we can add some global variables when app key will set can set the global variables to success and using API we can read it or in espnow_sec_responder_start() function we can pass the function pointer and after successful connection we callback.

So, I want to know is this component already implemented some way to get acknowledgement, which I missed?

lhespress commented 1 year ago

@horsemann07 Yes, your understand is correct. espnow_sec_responder_start() just only mean that the responder start a session for handshake, it doesn't confirmation the handshake's result.

Please add the patch as the attachment and check again.

security.zip

Of course, it'll exchange the app key by espnow_set_key when the handshake success. you also can call espnow_get_key to confirmation the handshake's result.