How to know if the connection is paired.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I would like to know if is there any function to ask if a connection is paired (encrypted) or not ?

Thanks,

Asier.

0 Likes
1 Solution
Anonymous
Not applicable

There are more events that occur involving encryption:

When you run the CyBle_GapAuthReq() function (as a client) then you will get either a success or failure event:

CYBLE_EVT_GAP_AUTH_FAILED

CYBLE_EVT_GAP_AUTH_COMPLETE

and you will get the CYBLE_EVT_GAP_AUTH_REQ event if the remote side of the connection requests authentication/encryption.

The event: CYBLE_EVT_GAP_SMP_NEGOTIATED_AUTH_INFO might have the "encryption enabled/disabled" flag you are looking for, but from what I can see, you will probably need to track the state of the encryption based upon the events that occur.

By default the device will not be encrypted when it connects, so if you have a state variable with default false when you connect to a device, and then change it based on the CYBLE_EVT_GAP_ENCRYPT_CHANGE event arguments, then you can accurately follow the encryption of the connection to ensure no "plain data" communication occurs.

View solution in original post

0 Likes
3 Replies
Anonymous
Not applicable

Hello,

If you attempt to read/write an attribute that requires encryption/authentication, then it will throw an error for insufficient encryption/authentication if it is not encrypted/authenticated.

See here: http://origin-www.cypress.com/forum/psoc-4-ble/ble-pairing-issue

Otherwise, you should be able to do the CyBle_GapAuthReq() function call in CYBLE_EVT_GAP_DEVICE_CONNECTED callback event to immediately encrypt upon device connection.

Anonymous
Not applicable

Hello,

Yes, is wich I do, read/write an attribute that requires encryption, but I wonder myself if there ir a function that returns connection state (true/false encrytion).

I also know that exist CYBLE_EVT_GAP_ENCRYPT_CHANGE event. But I suppous that it is produced when encryption state changes, is not it ?

Regards,

Asier.

0 Likes
Anonymous
Not applicable

There are more events that occur involving encryption:

When you run the CyBle_GapAuthReq() function (as a client) then you will get either a success or failure event:

CYBLE_EVT_GAP_AUTH_FAILED

CYBLE_EVT_GAP_AUTH_COMPLETE

and you will get the CYBLE_EVT_GAP_AUTH_REQ event if the remote side of the connection requests authentication/encryption.

The event: CYBLE_EVT_GAP_SMP_NEGOTIATED_AUTH_INFO might have the "encryption enabled/disabled" flag you are looking for, but from what I can see, you will probably need to track the state of the encryption based upon the events that occur.

By default the device will not be encrypted when it connects, so if you have a state variable with default false when you connect to a device, and then change it based on the CYBLE_EVT_GAP_ENCRYPT_CHANGE event arguments, then you can accurately follow the encryption of the connection to ensure no "plain data" communication occurs.

0 Likes