Skip to content

Commit 1633f98

Browse files
kedMertenskartben
authored andcommitted
bluetooth: tester: btp: refactors LE secure pairing selection
Takes in use IS_ENABLED as preferred way of guarding Kconfig option for enabling legacy LE secure pairing, CONFIG_BT_SMP_SC_PAIR_ONLY. It enables compiling guarded code get warning/errors and not link it if not used. Signed-off-by: Evgenii Kosenko <[email protected]>
1 parent 0b2fbf9 commit 1633f98

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/bluetooth/tester/src/btp_gap.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ static const char *oob_config_str(int oob_config)
336336
if (!IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY)) {
337337
return "no";
338338
}
339+
339340
switch (oob_config) {
340341
case BT_CONN_OOB_LOCAL_ONLY:
341342
return "Local";
@@ -366,10 +367,11 @@ static void oob_data_request(struct bt_conn *conn,
366367
switch (oob_info->type) {
367368
case BT_CONN_OOB_LE_SC:
368369
{
369-
if (!IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY)) {
370+
if (!IS_ENABLED(CONFIG_BT_SMP_SC_PAIR_ONLY)) {
370371
LOG_ERR("OOB LE SC not supported");
371372
break;
372373
}
374+
373375
LOG_DBG("Set %s OOB SC data for %s, ",
374376
oob_config_str(oob_info->lesc.oob_config),
375377
addr);
@@ -408,8 +410,12 @@ static void oob_data_request(struct bt_conn *conn,
408410
break;
409411
}
410412

411-
#if !defined(CONFIG_BT_SMP_SC_PAIR_ONLY)
412413
case BT_CONN_OOB_LE_LEGACY:
414+
if (!IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY)) {
415+
LOG_ERR("OOB LE Legacy not supported");
416+
break;
417+
}
418+
413419
LOG_DBG("Legacy OOB TK requested from remote %s", addr);
414420

415421
err = bt_le_oob_set_legacy_tk(conn, oob_legacy_tk);
@@ -418,7 +424,6 @@ static void oob_data_request(struct bt_conn *conn,
418424
}
419425

420426
break;
421-
#endif /* !defined(CONFIG_BT_SMP_SC_PAIR_ONLY) */
422427
default:
423428
LOG_ERR("Unhandled OOB type %d", oob_info->type);
424429
break;

0 commit comments

Comments
 (0)