cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

dusj_3409981
New Contributor

How do you search for a specific BLE Friendly Name when scanning for another BLE device. At the moment, I can only find a BLE device based on Mac Address when scanning results are completed. Is there a way to find a device to connect with based on its BLE friendly name using PSOC creators library? I have looked through the 100 days project and was unable to find an example of this.

0 Likes
1 Solution
GyanC_36
Employee

Struct CYBLE_GAPC_ADV_REPORT_T  has advertising or scan response data field which can be extracted while scanning for the  peripheral device name based on the index value ( for the device name ) in advertising packet in CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT event.

Pseudo code --

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

case CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT:

          

            advReport = (CYBLE_GAPC_ADV_REPORT_T *) eventParam;

          

            /* check if report has device name corresponding to the intended matching peer */

            if((advReport->data[1] == 0xff) && (advReport->data[2] == 0x31)  \

                    && (advReport->data[3] == 0x01) && (advReport->data[4] == 0x3b) \

                    && (advReport->data[5] == 0x04))

            {}

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Note: The device name value will be in hex format.

-Gyan

View solution in original post

0 Likes
2 Replies
GyanC_36
Employee

Struct CYBLE_GAPC_ADV_REPORT_T  has advertising or scan response data field which can be extracted while scanning for the  peripheral device name based on the index value ( for the device name ) in advertising packet in CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT event.

Pseudo code --

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

case CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT:

          

            advReport = (CYBLE_GAPC_ADV_REPORT_T *) eventParam;

          

            /* check if report has device name corresponding to the intended matching peer */

            if((advReport->data[1] == 0xff) && (advReport->data[2] == 0x31)  \

                    && (advReport->data[3] == 0x01) && (advReport->data[4] == 0x3b) \

                    && (advReport->data[5] == 0x04))

            {}

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Note: The device name value will be in hex format.

-Gyan

View solution in original post

0 Likes
dusj_3409981
New Contributor

Thanks Gyan! This is exactly what I was looking for!

0 Likes