I want pair process only in "device pair mode"

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

cross mob
wali_3126996
Level 1
Level 1
First like given

CY8CKIT-042-BLE-A

Gap role: peripheral, security: unauthenticated pairing with encryption.

when I startBle,   use cysmart(iOS app unpair)  connect to my pioneer kit, it alyways enter "pair process".

I want periperal( pioneer kit) can only "pair" at "device pair mode (something like led flashing) I control"  and it can't pair  at normal mode , at normal mode , peripheral can only  connection complete by bounding device(my iphone).

I try to invoke 'CyBle_GapDisconnect() 'function when unpair device trigger"CYBLE_EVT_GAP_AUTH_REQ" event at normal mode, but this function is nonblock, and  pair process looks like  continues, Then pioneer kit disconnected.This caused iphone show pair alert on screen, Then quickly disappeared。

What  is the best way to implement this feature?

1.peripheral have two mode "pair disable"mode  and "pair enable" mode

2.unpair device connect to peripheral immediately disconnect by peripheral on "pair disable" mode.

0 Likes
1 Solution

thank you for your reply. I have solved this problem and by looking at the source code I found that in 'BLE_eventHandler.c',

cypress has called 'CyBle_GappAuthReqReply' in  'CYBLE_EVT_GAP_AUTH_REQ'.

I disabled pairing by setting 'cyBle_authInfo.authErr = CYBLE_GAP_AUTH_ERROR_PAIRING_NOT_SUPPORTED;' when the pairing failed, I actively disconnected the Bluetooth connection.

Only when I allow pairing, set 'cyBle_authInfo.authErr = CYBLE_GAP_AUTH_ERROR_NONE', the pairing process can be performed normally

View solution in original post

0 Likes
2 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

If you are using CySmart for Android, the application has an option to disable the checkbox "initiate pairing after the connection". Thus your peripheral has full control to request for Authentication.

If you want to change this, you have to change the source code of the ios application.

Whenever the Authentication request comes from the central, the peripheral device responds back with AuthReqReply() by default. It is all under the application layer. You can look this in the file BLE_eventhandler.c .

Thanks

Ganesh

0 Likes

thank you for your reply. I have solved this problem and by looking at the source code I found that in 'BLE_eventHandler.c',

cypress has called 'CyBle_GappAuthReqReply' in  'CYBLE_EVT_GAP_AUTH_REQ'.

I disabled pairing by setting 'cyBle_authInfo.authErr = CYBLE_GAP_AUTH_ERROR_PAIRING_NOT_SUPPORTED;' when the pairing failed, I actively disconnected the Bluetooth connection.

Only when I allow pairing, set 'cyBle_authInfo.authErr = CYBLE_GAP_AUTH_ERROR_NONE', the pairing process can be performed normally

0 Likes