2 Replies Latest reply on Jan 2, 2020 9:52 PM by wali_3126996

    I want pair process only in "device pair mode"




      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.




        • 1. Re: I want pair process only in "device pair mode"



          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 .




          • 2. Re: I want pair process only in "device pair mode"

            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