5 Replies Latest reply on Nov 10, 2016 6:26 AM by user_1654946

    PSOC 4 BLE Pairing scenario

    user_1654946

      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!

        • 1. Re: PSOC 4 BLE Pairing scenario
          himam_31

          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

          • 2. Re: PSOC 4 BLE Pairing scenario
            user_1654946

            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. 

            • 3. Re: PSOC 4 BLE Pairing scenario
              user_1654946

              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?

              • 4. Re: PSOC 4 BLE Pairing scenario

                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.

                1 of 1 people found this helpful
                • 5. Re: PSOC 4 BLE Pairing scenario
                  user_1654946

                  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.