This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to include mac address in advertisement packet name?

Hello, I am using sdk 12.2.2 and pca10040. I want to include the mac address in adv packet name. I am not aware of the api used to get mac address. I used sd_ble_gap_address_get(&m_devAddress); but it didn't work. Can I get help related to this challenge? Thanks, Shailav

Parents
  • By default the advertisement address (MAC ID) is part of the payload. Same as in WiFi or even 802.3 wired ethernet, it has to be there in order for the receiver to identify the source. If you use any BLE scanner you will see that it knows the MAC ID's of the transmitters.

    There is insufficient room to also include it in a standard advertisement. A BLE advert has up to 31 bytes available and the UUID takes a big chunk of it. If you use a non-standard advertisement structure then you could include it, but you wouldn't be able to take advantage of the API's built into most operating systems to screen standard BLE advert structures (eg, eddystone, ibeacon, etc.) Through the Nordic API's you can choose different advertisement types such as random, random private resoveable, etc. These styles are discussed at length in the bluetooth spec.

    To get the mac id you do the following. Once you have it in the struct you can place it where you wish:

    	ble_gap_addr_t ble_addr;
        err_code = sd_ble_gap_address_get(&ble_addr);
    APP_ERROR_CHECK(err_code);
    
  • Hi, I tried your suggestions but unfortunately I am getting error as "._build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol sd_ble_gap_address_get (referred from main.o)." Am I missing some files here? I am attaching my main.c file in question above. Thanks for you help.

Reply
  • Hi, I tried your suggestions but unfortunately I am getting error as "._build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol sd_ble_gap_address_get (referred from main.o)." Am I missing some files here? I am attaching my main.c file in question above. Thanks for you help.

Children
No Data
Related