This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDKV12 sd_ble_gap_address_get removed in S132 3.0

Hello. I have the need to get a device's unique address that remains stable across device firmware upgrades, etc.

Before SDKV12 I've been using sd_ble_gap_address_get().

In SDKV12 S132 this function has vanished. In poking around the SDK comoponent source code, I see the following in several places, such as the snipped below from ble_advdata.c.

I am still plodding through conversion to SDKV12 so I haven't yet tested it, but it looks as though the new _addr_get function is a direct replacement for the old. Is this correct, or are there some subtle semantic differences that we should be aware of?

Thanks.

// Get BLE address.  

#if (NRF_SD_BLE_API_VERSION == 3)

    err_code = sd_ble_gap_addr_get(&device_addr);

#else

    err_code = sd_ble_gap_address_get(&device_addr);

#endif
Parents
  • Well, I have two answers. First, it was my mistake (not Nordic's) that I failed to notice this in the migration document. So, no action there.

    However, respectfully, as a matter of engineering practice, I believe in the following practices:

    1. all SDK or product parameters should be centralized in a single definitions file that can be diff'ed from version to version. This would suggest that the "current" declaration of NDR_SD_BlE_API_VERSION, in my opinion, should be in sdk_config.h. I said more about this here: devzone.nordicsemi.com/.../

    2. When writing code (within the SDK or in my own third party code), I believe the best practice is that the code pertaining to the "current version" should be outside of the scope of any conditional compilation. Only the source code pertaining to "old" versions should be conditionalized. From a maintenance perspective this practice simply means that you don't need to go and revisit each and every conditional when you next bump the version number in some future version.

    Please accept this feedback constructively and with respect. I know that these are just practices, and that no practice is inherently "right" or "wrong".

Reply
  • Well, I have two answers. First, it was my mistake (not Nordic's) that I failed to notice this in the migration document. So, no action there.

    However, respectfully, as a matter of engineering practice, I believe in the following practices:

    1. all SDK or product parameters should be centralized in a single definitions file that can be diff'ed from version to version. This would suggest that the "current" declaration of NDR_SD_BlE_API_VERSION, in my opinion, should be in sdk_config.h. I said more about this here: devzone.nordicsemi.com/.../

    2. When writing code (within the SDK or in my own third party code), I believe the best practice is that the code pertaining to the "current version" should be outside of the scope of any conditional compilation. Only the source code pertaining to "old" versions should be conditionalized. From a maintenance perspective this practice simply means that you don't need to go and revisit each and every conditional when you next bump the version number in some future version.

    Please accept this feedback constructively and with respect. I know that these are just practices, and that no practice is inherently "right" or "wrong".

Children
No Data
Related