You are here

PSOC 4 BLE Pairing scenario | Cypress Semiconductor

PSOC 4 BLE Pairing scenario

Summary: 5 Replies, Latest post by Marian-Emanuel Ionascu on 10 Nov 2016 06:26 AM PST
Verified Answers: 2
Last post
Log in to post new comments.
ionascu.marianemanuel_1654946's picture
User
36 posts

Hello,

 

Can some one explain to me how exactly can I create the following behavior?

I want that any client that wants to connect to a peripheral, server device to be asked a password provided in advance and only when the correct password is given to connect, see the profile,etc.  Next I want that the client to be able to make a pair action to the device  and every time the device is near to connect automatically to it. I know that some parts of this behavior should be accomplish by the client like the automatically connection to the device but I am aware that something should also be done in peripheral which is a PSOC 4.

I already go through the examples like privicy(017), oob pairing(032) and bonding (015) but somehow I cannot fully understand them to implement my scenario. Also it would be great if you can also explain the state(event) in which a particular action should take place. For example I used  CyBle_GapFixAuthPassKey (1, 123456); in CYBLE_EVT_STACK_ON and I was able to pair in CYSmart with this code but I am not sure this is all. My Ble is set as Mode 1 security Authenticated pairing with encryption and I/O capabilities KeyBoard and Display(even if my device doesn't have such, I personally am not sure why are those used) and Bonding.

Thank you!

HIMA's picture
Cypress Employee
205 posts

Hello,

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.

Thanks,

Hima

ionascu.marianemanuel_1654946's picture
User
36 posts

Hello Hima,

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. 

ionascu.marianemanuel_1654946's picture
User
36 posts

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?

yssu's picture
Cypress Employee
20 posts

Under CYBLE_EVT_GAP_AUTH_FAILED in the StackEventHandler(), you can add this line:

CyBle_GapDisconnect(cyBle_connHandle.bdHandle);

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.

ionascu.marianemanuel_1654946's picture
User
36 posts

Hello yssu,

Thanks for the clarifications! I observed that behavior but did not know why. In the future I will think to a better privacy.

Log in to post new comments.