extract device name from peripheral to central

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

cross mob
Anonymous
Not applicable

how do i get the device name to my central after:

case CYBLE_EVT_GATT_CONNECT_IND:

     connHandle = *(CYBLE_CONN_HANDLE_T *)eventparam

0 Likes
1 Solution
Anonymous
Not applicable

Yes, when you receive the GAPC_SCAN_PROGRESS_RESULT, you can parse the resulting data to get the data associated with the advertisement data. You will need to make sure that the advertising device is including it's name (which you have done in the image above).

The data format is: <Length of "advertisement component"><0x09 to signify local name><"Your Local Name">, so you can either only check data[5] through data[10] for checking if the exact same advertisement data bytes match in the exact same spot, or you can iterate through the whole data[] array checking for where the length of the advertisement service/component is length 0x07, the service/component type is 0x09 (local name), and the local name itself has the matching bytes to the name "Emitto"

But your approach overall is spot on for the way I would implement it.

(sorry for the slow reply )

View solution in original post

7 Replies
Anonymous
Not applicable

If you mean the BD Address, then see this thread: MAC address

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

not the BD address

for example I named my Peripheral to Emitto

I want to get that "Emitto" string in my Central.

How do I print it. (UART, printf)

Thanks

On Sat, Jan 13, 2018 at 12:05 AM, e.pratt_1639216 <

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

how shall I extract the characters from the data:

should i use this?

CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT:

scan_report = (CYBLE_GAPC_ADV_REPORT_T) eventParam;

scan_report->data[3] up to scan_report->data[10] ?

based from here:

On Sat, Jan 13, 2018 at 11:47 AM, Cyrus Nikko Pante <cnpante@gmail.com>

0 Likes
Anonymous
Not applicable

Yes, when you receive the GAPC_SCAN_PROGRESS_RESULT, you can parse the resulting data to get the data associated with the advertisement data. You will need to make sure that the advertising device is including it's name (which you have done in the image above).

The data format is: <Length of "advertisement component"><0x09 to signify local name><"Your Local Name">, so you can either only check data[5] through data[10] for checking if the exact same advertisement data bytes match in the exact same spot, or you can iterate through the whole data[] array checking for where the length of the advertisement service/component is length 0x07, the service/component type is 0x09 (local name), and the local name itself has the matching bytes to the name "Emitto"

But your approach overall is spot on for the way I would implement it.

(sorry for the slow reply )

Anonymous
Not applicable

Thanks a lot.

Do you have a different approach? Would that be complex?

0 Likes
Anonymous
Not applicable

No, the approach you are using is what I would use. Unless you have need to support future versions where the location of the name may change in the advertisement, or other BLE devices may have the same name in the same location, then there is no other thought you need to put into this

Anonymous
Not applicable

Ohhh yes, thanks. That's currently my problem though changing a Service Data dynamically.

Changing an advertisement data.

Thanks again!

0 Likes