Please find the attached Central and peripheral project pair. If you have two Cypress development kits program your projects on those two kits. Please follow the instructions that will be displayed on the UART terminals. All types of authentication modes are implemented in the project. The Central and Peripheral pair select the appropriate authentication mode based on the corresponding setting of central/peripheral project.
For theory, you can go through the following application note.
AN99209- PSoC 4 BLE and PRoC BLE: Bluetooth LE 4.2 Features
Thank you very much for your reply.
That is exactly the kind of example I was looking for, with both peripheral and central covering various types of pairing.
I have some questions, though:
1) In your application peripheral's side, in the event CYBLE_EVT_GAP_AUTH_REQ, there is a call to the function CyBle_GappAuthReqReply. However the API returned CYBLE_ERROR_INVALID_OPERATION. I've found in another thread that the function doesn't need to be called because it is already called in the auto generated source files. Why is it being called in the CYBLE_EVT_GAP_AUTH_REQ event anyway?
2) Also in the peripheral source code, in the CYBLE_EVT_GAP_DEVICE_CONNECTED the connection parameters are checked, and if they don't match the function CyBle_L2capLeConnectionParamUpdateRequest() is called. When would be this necessary? I guess that's when the central and peripheral are generic devices so they need to work using the same parameters. Is that right? What problems can be cause if I don't check the connection parameters?
1. I've found in another thread that the function doesn't need to be called because it is already called in the auto generated source files. Why is it being called in the CYBLE_EVT_GAP_AUTH_REQ event anyway?
--> Yes. There is no need to call the AuthReqReply() again. You can remove that. It is just added following best practices.
2. The CyBle_L2capLeConnectionParamUpdateRequest() API call in the CONNECTED event is not required for every project.
In this particular project it is added for a different purpose (for creating a separate L2CAP channel).