Can you confirm if you need a Fixed Passkey so that server can be connected with a predefined key. If yes, I am attaching a simple example for this.
Yes we want the password to be a fixed one and if possible should prevent the connection until a pairing is done. Once the pairing is initiated we would like the user to introduce the pass or maybe the device will have a NFC tag and the phone should take it from the NFC. Afterwards, we want that the user to be able to change this password if wanted in case it will unpair the device. I think this is all because after this pairing the phone can automatically connect if it finds the device near.
Update: I have used the example provided but still have some questions. If for example I hit connect the request was received and the CySmart ask to hit pair or not. If I hit not then the connection is still established so how can I achieve this?
1 of 1 people found this helpful
Under CYBLE_EVT_GAP_AUTH_FAILED in the StackEventHandler(), you can add this line:
This will cause the peripheral to disconnect if the authentication fails. If you select press 'No' when pairing is requested, the GAP_AUTH_FAILED event will be raised at the peripheral after timeout(30 seconds). So, after you make the above changes, you will see that the device will get disconnected after 30 seconds if you select 'no' during the pairing request.
Thanks for the clarifications! I observed that behavior but did not know why. In the future I will think to a better privacy.