Skip to content

Commit 75c1ef3

Browse files
committed
apps: remove use of deprecated BLE_PUBLIC_DEV_ADDR
ble_hs_id_copy_addr() is used whenever deprecated value was used for getting public address.
1 parent c33c87b commit 75c1ef3

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

apps/blecsc/syscfg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ syscfg.vals:
3232
CONFIG_FCB: 1
3333

3434
# Set public device address.
35-
BLE_PUBLIC_DEV_ADDR: ((uint8_t[6]){0xcc, 0xbb, 0xaa, 0x33, 0x22, 0x11})
35+
BLE_LL_PUBLIC_DEV_ADDR: 0x1122aabb33cc
3636

3737
# Set device appearance to Cycling Speed and Cadence Sensor
3838
BLE_SVC_GAP_APPEARANCE: BLE_SVC_GAP_APPEARANCE_CYC_SPEED_AND_CADENCE_SENSOR

apps/blehr/syscfg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ syscfg.vals:
3232
CONFIG_FCB: 1
3333

3434
# Set public device address.
35-
BLE_PUBLIC_DEV_ADDR: ((uint8_t[6]){0xcc, 0xbb, 0xaa, 0x33, 0x22, 0x11})
35+
BLE_LL_PUBLIC_DEV_ADDR: 0x1122aabb33cc
3636

3737
# Whether to save data to sys/config, or just keep it in RAM.
3838
BLE_STORE_CONFIG_PERSIST: 0

apps/blestress/src/rx_stress.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ rx_stress_simple_adv(struct rx_stress_adv_set *adv_set)
155155
assert (rc == 0);
156156

157157
if (own_addr_type == 0) {
158-
memcpy(addr.val, MYNEWT_VAL(BLE_PUBLIC_DEV_ADDR), 6);
158+
rc = ble_hs_id_copy_addr(BLE_ADDR_PUBLIC, addr.val, NULL);
159+
assert (rc == 0);
159160
} else {
160161
rc = ble_hs_id_gen_rnd(1, &addr);
161162
assert (rc == 0);

apps/bttester/src/gap.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,6 @@ static void controller_index_list(uint8_t *data, uint16_t len)
166166
BTP_INDEX_NONE, (uint8_t *) rp, sizeof(buf));
167167
}
168168

169-
static int check_pub_addr_unassigned(void)
170-
{
171-
#ifdef ARCH_sim
172-
return 0;
173-
#else
174-
uint8_t zero_addr[BLE_DEV_ADDR_LEN] = { 0 };
175-
176-
return memcmp(MYNEWT_VAL(BLE_PUBLIC_DEV_ADDR),
177-
zero_addr, BLE_DEV_ADDR_LEN) == 0;
178-
#endif
179-
}
180-
181169
static void controller_info(uint8_t *data, uint16_t len)
182170
{
183171
struct gap_read_controller_info_rp rp;
@@ -212,15 +200,14 @@ static void controller_info(uint8_t *data, uint16_t len)
212200
supported_settings |= BIT(GAP_SETTINGS_PRIVACY);
213201
memcpy(rp.address, addr.val, sizeof(rp.address));
214202
} else {
215-
if (check_pub_addr_unassigned()) {
203+
rc = ble_hs_id_copy_addr(BLE_ADDR_PUBLIC, rp.address, NULL);
204+
if (rc) {
216205
own_addr_type = BLE_OWN_ADDR_RANDOM;
217206
memcpy(rp.address, addr.val, sizeof(rp.address));
218207
supported_settings |= BIT(GAP_SETTINGS_STATIC_ADDRESS);
219208
current_settings |= BIT(GAP_SETTINGS_STATIC_ADDRESS);
220209
} else {
221210
own_addr_type = BLE_OWN_ADDR_PUBLIC;
222-
memcpy(rp.address, MYNEWT_VAL(BLE_PUBLIC_DEV_ADDR),
223-
sizeof(rp.address));
224211
}
225212
}
226213

nimble/host/mesh/src/shell.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,10 +707,9 @@ static int check_pub_addr_unassigned(void)
707707
#ifdef ARCH_sim
708708
return 0;
709709
#else
710-
uint8_t zero_addr[BLE_DEV_ADDR_LEN] = { 0 };
710+
uint8_t addr[BLE_DEV_ADDR_LEN];
711711

712-
return memcmp(MYNEWT_VAL(BLE_PUBLIC_DEV_ADDR),
713-
zero_addr, BLE_DEV_ADDR_LEN) == 0;
712+
return ble_hs_id_copy_addr(BLE_ADDR_PUBLIC, addr, NULL) != 0;
714713
#endif
715714
}
716715

targets/dialog_cmac/syscfg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ syscfg.vals:
3232
BLE_LL_SCHED_AUX_CHAIN_MAFS_DELAY: 150
3333

3434
# NOTE: set public address in target settings
35-
# BLE_PUBLIC_DEV_ADDR: "(uint8_t[6]){0xff, 0xff, 0xff, 0xff, 0xff, 0xff}"
35+
# BLE_LL_PUBLIC_DEV_ADDR: 0xffffffffffff

0 commit comments

Comments
 (0)