Functions
Functions
BLE » Security Manager(SM)
Collaboration diagram for Functions:

## Functions
uint16_t | ble_sec_params_set (ble_sec_param_t *p_sec_param)
| Set security parameter. More...
uint16_t | ble_sec_enc_start (uint8_t conn_idx)
| Start security encryption, this interface is used by both slave and master. More...
uint16_t | ble_sec_send_pair_req (uint8_t conn_idx)
| Send pair request, this interface is used only by master. More...
uint16_t | ble_sec_enc_cfm (uint8_t conn_idx, const ble_sec_cfm_enc_t *p_cfm_enc)
| Send the encrypt confirm information. More...
uint16_t | ble_sec_keypress_notify_send (uint8_t conn_idx, uint8_t notify_type)
| Send key press notify. More...
bool | ble_sec_check_bonded_by_addr (ble_gap_bdaddr_t *p_peer_iden_addr)
| Check bonded state by peer address. More...

## Detailed Description

## Function Documentation

## ◆ ble_sec_check_bonded_by_addr()

bool ble_sec_check_bonded_by_addr | ( | ble_gap_bdaddr_t * | p_peer_iden_addr | ) |

Check bonded state by peer address.

Parameters

  [in] | p_peer_iden_addr | Pointer to the peer identity address.

Return values

  ::true | Peer address is bonded.
  ::false | Peer address is not bonded.

## ◆ ble_sec_enc_cfm()

uint16_t ble_sec_enc_cfm | ( | uint8_t | conn_idx,
|  | const ble_sec_cfm_enc_t * | p_cfm_enc
| ) |  |

Send the encrypt confirm information.

Parameters

  [in] | conn_idx | ACL connection index, the first ACL connection index is 0, and increased one by one.
  [in] | p_cfm_enc | Pointer to the confirm encryption structure, see ble_sec_cfm_enc_t.

Return values

  SDK_SUCCESS | The confirm encryption is successfully set to the BLE stack.
  SDK_ERR_POINTER_NULL | Invalid pointer supplied.
  SDK_ERR_INVALID_CONN_IDX | Invalid connection index supplied.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_sec_enc_start()

uint16_t ble_sec_enc_start | ( | uint8_t | conn_idx | ) |

Start security encryption, this interface is used by both slave and master.

Note
  If the local device role is master, it will check that if the peer device is bonded firstly. If the peer device is bonded, the stack will encrypt the link directly, otherwise the stack will send a pair request to the peer device.
  If the local device role is slave, the stack will send a security request to the peer device.

Parameters

  [in] | conn_idx | ACL connection index, the first ACL connection index is 0, and increased one by one.

Return values

  SDK_SUCCESS | The security encryption is successfully set to the BLE stack.
  SDK_ERR_INVALID_CONN_IDX | Invalid connection index supplied.

## ◆ ble_sec_keypress_notify_send()

uint16_t ble_sec_keypress_notify_send | ( | uint8_t | conn_idx,
|  | uint8_t | notify_type
| ) |  |

Send key press notify.

Parameters

  [in] | conn_idx | ACL connection index. The first ACL connection index is 0, and the index will be increased one by one.
  [in] | notify_type | Key press notify type, see ble_sec_keypress_notify_t.

Return values

  SDK_SUCCESS | The key press notify type is successfully set to the BLE stack.
  SDK_ERR_INVALID_CONN_IDX | Invalid connection index supplied.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_sec_params_set()

uint16_t ble_sec_params_set | ( | ble_sec_param_t * | p_sec_param | ) |

Set security parameter.

Parameters

  [in] | p_sec_param | Pointer to the security parameter structure, ble_sec_param_t.

Return values

  SDK_SUCCESS | The security parameter is successfully set to the BLE stack.
  SDK_ERR_POINTER_NULL | Invalid pointer supplied.
  SDK_ERR_INVALID_PARAM | Invalid parameter supplied.

## ◆ ble_sec_send_pair_req()

uint16_t ble_sec_send_pair_req | ( | uint8_t | conn_idx | ) |

Send pair request, this interface is used only by master.

Note
  Invoke this api, the master will send pair request whether the peer device is bonded or not.

Parameters

  [in] | conn_idx | ACL connection index, the first ACL connection index is 0, and increased one by one.

Return values

  SDK_SUCCESS | Send pair request is successfully set to the BLE stack.
  SDK_ERR_INVALID_CONN_IDX | Invalid connection index supplied.
  SDK_ERR_DISALLOWED | Operation is disallowed.