Skip to content

Commit 599b319

Browse files
anhmolteivindj-nordic
authored andcommitted
lib: peer_manager: use SOFTDEVICE_PERIPHERAL Kconfig for periph code
Switch on Kconfig CONFIG_SOFTDEVICE_PERIPHERAL instead of SoftDevice define BLE_GAP_ROLE_PERIPH when adding peripheral specific code in security dispatcher module of the peer manager. Signed-off-by: Andreas Moltumyr <[email protected]>
1 parent c62a529 commit 599b319

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/bluetooth/peer_manager/modules/security_dispatcher.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ static void sec_request_process(const ble_gap_evt_t *gap_evt)
374374
}
375375
#endif /* CONFIG_SOFTDEVICE_CENTRAL */
376376

377-
#ifdef BLE_GAP_ROLE_PERIPH
377+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
378378
/** @brief Function for asking the central to secure the link. See @ref smd_link_secure for more
379379
* info.
380380
*/
@@ -457,7 +457,7 @@ static void sec_info_request_process(const ble_gap_evt_t *gap_evt)
457457
BLE_GAP_SEC_STATUS_SOURCE_LOCAL);
458458
}
459459
}
460-
#endif /* BLE_GAP_ROLE_PERIPH */
460+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
461461

462462
/**
463463
* @brief Function for sending a PM_EVT_CONN_SEC_CONFIG_REQ event.
@@ -526,14 +526,14 @@ static void send_params_req(uint16_t conn_handle, const ble_gap_sec_params_t *pe
526526
*/
527527
static void sec_params_request_process(const ble_gap_evt_t *gap_evt)
528528
{
529-
#ifdef BLE_GAP_ROLE_PERIPH
529+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
530530
if (ble_conn_state_role(gap_evt->conn_handle) == BLE_GAP_ROLE_PERIPH) {
531531
sec_proc_start(gap_evt->conn_handle, true,
532532
gap_evt->params.sec_params_request.peer_params.bond
533533
? PM_CONN_SEC_PROCEDURE_BONDING
534534
: PM_CONN_SEC_PROCEDURE_PAIRING);
535535
}
536-
#endif /* BLE_GAP_ROLE_PERIPH */
536+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
537537

538538
send_params_req(gap_evt->conn_handle, &gap_evt->params.sec_params_request.peer_params);
539539
}
@@ -837,14 +837,14 @@ uint32_t smd_params_reply(uint16_t conn_handle, ble_gap_sec_params_t *sec_params
837837
ble_gap_sec_keyset_t sec_keyset;
838838

839839
memset(&sec_keyset, 0, sizeof(ble_gap_sec_keyset_t));
840-
#ifdef BLE_GAP_ROLE_PERIPH
840+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
841841
if (role == BLE_GAP_ROLE_PERIPH) {
842842
/* Set the default value for allowing repairing at the start of the sec proc. (for
843843
* peripheral)
844844
*/
845845
ble_conn_state_user_flag_set(conn_handle, flag_allow_repairing, false);
846846
}
847-
#endif /* BLE_GAP_ROLE_PERIPH */
847+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
848848

849849
if (role == BLE_GAP_ROLE_INVALID) {
850850
return BLE_ERROR_INVALID_CONN_HANDLE;
@@ -860,7 +860,7 @@ uint32_t smd_params_reply(uint16_t conn_handle, ble_gap_sec_params_t *sec_params
860860
/* NULL params means reject pairing. */
861861
sec_status = BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP;
862862
} else {
863-
#ifdef BLE_GAP_ROLE_PERIPH
863+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
864864
if ((im_peer_id_get_by_conn_handle(conn_handle) != PM_PEER_ID_INVALID) &&
865865
(role == BLE_GAP_ROLE_PERIPH) && !allow_repairing(conn_handle)) {
866866
/* Bond already exists. Reject the pairing request if the user
@@ -872,7 +872,7 @@ uint32_t smd_params_reply(uint16_t conn_handle, ble_gap_sec_params_t *sec_params
872872
sec_status = BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP;
873873
}
874874
}
875-
#endif /* BLE_GAP_ROLE_PERIPH */
875+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
876876

877877
if (!sec_params->bond) {
878878
/* Pairing, no bonding. */
@@ -890,9 +890,9 @@ uint32_t smd_params_reply(uint16_t conn_handle, ble_gap_sec_params_t *sec_params
890890
* opportunity to change the parameters and retry the call.
891891
*/
892892
ble_gap_sec_params_t *aux_sec_params = NULL;
893-
#ifdef BLE_GAP_ROLE_PERIPH
893+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
894894
aux_sec_params = (role == BLE_GAP_ROLE_PERIPH) ? sec_params : NULL;
895-
#endif /* BLE_GAP_ROLE_PERIPH */
895+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
896896

897897
err_code = sd_ble_gap_sec_params_reply(conn_handle, sec_status, aux_sec_params,
898898
&sec_keyset);
@@ -914,10 +914,10 @@ uint32_t smd_link_secure(uint16_t conn_handle, ble_gap_sec_params_t *sec_params,
914914
return link_secure_central(conn_handle, sec_params, force_repairing);
915915
#endif /* CONFIG_SOFTDEVICE_CENTRAL */
916916

917-
#ifdef BLE_GAP_ROLE_PERIPH
917+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
918918
case BLE_GAP_ROLE_PERIPH:
919919
return link_secure_peripheral(conn_handle, sec_params);
920-
#endif /* BLE_GAP_ROLE_PERIPH */
920+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
921921

922922
default:
923923
return BLE_ERROR_INVALID_CONN_HANDLE;
@@ -935,11 +935,11 @@ void smd_ble_evt_handler(const ble_evt_t *ble_evt)
935935
sec_params_request_process(&(ble_evt->evt.gap_evt));
936936
break;
937937

938-
#ifdef BLE_GAP_ROLE_PERIPH
938+
#if defined(CONFIG_SOFTDEVICE_PERIPHERAL)
939939
case BLE_GAP_EVT_SEC_INFO_REQUEST:
940940
sec_info_request_process(&(ble_evt->evt.gap_evt));
941941
break;
942-
#endif /* BLE_GAP_ROLE_PERIPH */
942+
#endif /* CONFIG_SOFTDEVICE_PERIPHERAL */
943943

944944
#if defined(CONFIG_SOFTDEVICE_CENTRAL)
945945
case BLE_GAP_EVT_SEC_REQUEST:

0 commit comments

Comments
 (0)