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

PSoC™ 4

Anonymous
Not applicable

Hello,

I have my custom client central project which connect and with peripheral and then disconnects. Meanwhile it read the characteristics values from peripheral and displays on UART terminal. In this project I can connect with any number of peripheral sequential and read the characteristics and then disconnect. And it takes about 80 ms in total for one peripheral connect+Data Read+Disconnect and then go to scanning mode and then so on......

I want to have now that my central can have upto 8 devices in whitelist (or store the device address) and then during sequential read,  remove the scanning part after disconnect and connect directly to the device whose address has been stored in central.

As I understood the only approach is to have with whitelist implementation.

Is there any other way to do this? If yes then can someone explain me how to go about?

I looked at the example project but could not able to implement properly. Past week I tried but no success. Can anyone help to correct or point out me to write direction.

I am attaching my central client project.

Thank you

0 Likes
1 Solution
Anonymous
Not applicable

Looking at your code, you are already comparing the addresses of your saved addresses with the scan results for the devices you already have.

If you want the device addresses stored in flash, then you will need to save the device addresses to the flash using a flash write sequence (which I don't see in your project btw).

(peedDeviceInfo[] is currently being stored in RAM).

Your approach and code all looks good. I would recommend debugging or checking the values for:

  • WptsScanProcessEventHandler(advReport)
  • newDevice
  • advDevices < CYBLE_MAX_ADV_DEVICES

I would also change this:

for(newDevice = 1u, i = 0u; i < advDevices; i++)

                    {

                        /* Compare device address with already logged one */

                        if((memcmp(peedDeviceInfo.peerAddr.bdAddr, advReport->peerBdAddr, CYBLE_GAP_BD_ADDR_SIZE) == 0))

                        {

                            DBG_PRINTF("%x: ",i);

                            newDevice = 0u;

                            break;

                        }

                    }

to this (for clarity of code):

newDevice = 1u;

for(i = 0u; i < advDevices; i++)

                    {

                        /* Compare device address with already logged one */

                        if((memcmp(peedDeviceInfo.peerAddr.bdAddr, advReport->peerBdAddr, CYBLE_GAP_BD_ADDR_SIZE) == 0))

                        {

                            DBG_PRINTF("%x: ",i);

                            newDevice = 0u;

                            break;

                        }

                    }

Otherwise, the code looks good. Are there specific things that are breaking/not working? Giving some points on what exactly is breaking would help

View solution in original post

5 Replies