@@ -1931,10 +1931,10 @@ ble_ll_adv_set_adv_params(const uint8_t *cmdbuf, uint8_t len)
19311931}
19321932
19331933#if MYNEWT_VAL (BLE_LL_CFG_FEAT_LL_EXT_ADV )
1934- static void
1935- ble_ll_adv_update_did (struct ble_ll_adv_sm * advsm )
1934+ static uint16_t
1935+ ble_ll_adv_update_did (uint16_t old_adi )
19361936{
1937- uint16_t old_adi = advsm -> adi ;
1937+ uint16_t new_adi ;
19381938
19391939 /*
19401940 * The Advertising DID for a given advertising set shall be initialized
@@ -1945,8 +1945,10 @@ ble_ll_adv_update_did(struct ble_ll_adv_sm *advsm)
19451945 * the previously used value.
19461946 */
19471947 do {
1948- advsm -> adi = (advsm -> adi & 0xf000 ) | (ble_ll_rand () & 0x0fff );
1949- } while (old_adi == advsm -> adi );
1948+ new_adi = (old_adi & 0xf000 ) | (ble_ll_rand () & 0x0fff );
1949+ } while (old_adi == new_adi );
1950+
1951+ return new_adi ;
19501952}
19511953#endif
19521954
@@ -1980,7 +1982,7 @@ ble_ll_adv_update_adv_scan_rsp_data(struct ble_ll_adv_sm *advsm)
19801982
19811983#if MYNEWT_VAL (BLE_LL_CFG_FEAT_LL_EXT_ADV )
19821984 /* DID shall be updated when host provides new advertising data */
1983- ble_ll_adv_update_did (advsm );
1985+ advsm -> adi = ble_ll_adv_update_did (advsm -> adi );
19841986#endif
19851987}
19861988
@@ -2675,7 +2677,7 @@ ble_ll_adv_sm_start_periodic(struct ble_ll_adv_sm *advsm)
26752677 * advertisers should update the Advertising DID when a periodic advertising
26762678 * train is enabled.
26772679 */
2678- ble_ll_adv_update_did (advsm );
2680+ advsm -> adi = ble_ll_adv_update_did (advsm -> adi );
26792681
26802682 advsm -> periodic_adv_active = 1 ;
26812683
@@ -2718,7 +2720,7 @@ ble_ll_adv_sm_stop_periodic(struct ble_ll_adv_sm *advsm)
27182720 * advertisers should update the Advertising DID when a periodic advertising
27192721 * train is disabled.
27202722 */
2721- ble_ll_adv_update_did (advsm );
2723+ advsm -> adi = ble_ll_adv_update_did (advsm -> adi );
27222724
27232725 /* Remove any scheduled advertising items */
27242726 advsm -> periodic_adv_active = 0 ;
@@ -3140,7 +3142,7 @@ ble_ll_adv_set_scan_rsp_data(const uint8_t *data, uint8_t datalen,
31403142 }
31413143
31423144 /* DID shall be updated when host provides new scan response data */
3143- ble_ll_adv_update_did (advsm );
3145+ advsm -> adi = ble_ll_adv_update_did (advsm -> adi );
31443146#endif
31453147 }
31463148
@@ -3215,7 +3217,7 @@ ble_ll_adv_set_adv_data(const uint8_t *data, uint8_t datalen, uint8_t instance,
32153217 }
32163218
32173219 /* update DID only */
3218- ble_ll_adv_update_did (advsm );
3220+ advsm -> adi = ble_ll_adv_update_did (advsm -> adi );
32193221 return BLE_ERR_SUCCESS ;
32203222 case BLE_HCI_LE_SET_DATA_OPER_LAST :
32213223 ble_ll_adv_flags_clear (advsm , BLE_LL_ADV_SM_FLAG_ADV_DATA_INCOMPLETE );
@@ -3303,7 +3305,7 @@ ble_ll_adv_set_adv_data(const uint8_t *data, uint8_t datalen, uint8_t instance,
33033305 }
33043306
33053307 /* DID shall be updated when host provides new advertising data */
3306- ble_ll_adv_update_did (advsm );
3308+ advsm -> adi = ble_ll_adv_update_did (advsm -> adi );
33073309#endif
33083310 }
33093311
0 commit comments