Adding BT MAC to advertisement

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
roland
Offline
Last seen:3 months 3 weeks ago
加入:2014-01-21 14:45
Adding BT MAC to advertisement

I have two devices running the serial port software. I would like to see which one I'm selecting on an Iphone, so I would like to add the last four chars of the BT MAC address to the advertisement name. Is there a recommended way in doing so, is there sample code where this is implemented?

Regards,
R

Device:
MT_dialog
Offline
Last seen:1 month 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi roland,

Hi roland,

你不该有to place the MAC address on the advertising string in order to be aware on which device you are connecting to, normaly a Central device should indicate the bd address of the device that receives the advertising string from, anyway i suppose that the iPhone presents a number that is irrelevant with the actual bd address of the device and thats why you would want that. Anyway, no there is no reference design that implements that, but depending on the source that the db address is populated (NVDS or OTP) or via reading directly the dev_dbaddr variable (that variable that stores the actual bd address) you can update the advertising string. You can have a look at the barebone example in order to check how to update the advertising string, and in the .default_operation_adv invoke the app_easy_gap_undirected_advertise_get_active() in order to create the message, read the db address from dev_dbaddr variable and attach it the the advertising string using the extra length value and the 0xFF advertising string tag for manufacturer data. In case you dont want to do this dynamically but you are changing the bd address in each image you download to the devices you have, you can attach at the end of the USER_ADVERTISE_DATA the bd address of the device again using the length of the portion of bytes that you have added and the 0xFF tag for the manufacturer data. For example lets say that your last bytes of the bd address end in 0x01 0x02 0x03, so your advertising data will be like below.

#define USER_ADVERTISE_DATA "\x11\x07\xb7\x5c\x49\xd2\x04\xa3\x40\x71\xa0\xb5\x35\x85\x3e\xb0\x83\x07\x04\xFF\x01\x02\x03"

Thanks MT_dialog