Reading a peripheral device name on a central device

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

cross mob
Anonymous
Not applicable

I would like to read a peripheral device name (embedded in the advertisement package) in my client stack handler. Can anyone help? This must be something that is done all the time...

0 Likes
1 Solution
Anonymous
Not applicable

On receiving a advertisement packet/scan response packet event in the client stack handler, you can access the passed eventParam to get the data associated with the actual advertisement packet. Thus, if you include the name in the advertisement packet, then you will be able to read it quite easily.

Please note that you will (obviously) need to be scanning to receive the advertisement packets as well.

case CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT:{

            CYBLE_GAPC_ADV_REPORT_T * report = eventParam;

//Other code to use it here

}

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

On receiving a advertisement packet/scan response packet event in the client stack handler, you can access the passed eventParam to get the data associated with the actual advertisement packet. Thus, if you include the name in the advertisement packet, then you will be able to read it quite easily.

Please note that you will (obviously) need to be scanning to receive the advertisement packets as well.

case CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT:{

            CYBLE_GAPC_ADV_REPORT_T * report = eventParam;

//Other code to use it here

}

0 Likes
Anonymous
Not applicable

Thanks for your help. Anjana - it looks to me like the <<Local Name>> data in the advertisement packet has a value of 9 so I've used this information as an initial check to make sure I'm looking in the correct place.

AnjanaM_61
Moderator
Moderator
Moderator
10 questions asked 5 comments on KBA First comment on KBA

Hi Peter,

EPratt is correct. If your CyBLE is a Central, and you want to get the device name embedded in adv packet, then you can read it using the method Epratt mentioned. But the problem is you have to know which all adv packet index contains the device name. Otherwise it will be difficult to find the adv packet start index of device name data.

Thanks,

Anjana

0 Likes
Anonymous
Not applicable

how do i exactly extract the device name from there?

0 Likes