Functions
Functions
BLE » Profile » Profile Server
Collaboration diagram for Functions:

## Functions
uint16_t | ble_gatts_enh_prf_add (ble_gatts_create_db_t *p_gatts_db, ble_evt_handler_t evt_handler)
| Add a server profile by providing its detailed information, including manager callback functions and GATT server callback functions. More...
uint16_t | ble_gatts_enh_read_cfm (uint8_t conn_idx, uint16_t cid, const ble_gatts_read_cfm_t *p_param)
| Respond to an attribute read request. More...
uint16_t | ble_gatts_enh_write_cfm (uint8_t conn_idx, uint16_t cid, const ble_gatts_write_cfm_t *p_param)
| Respond to an attribute write request. More...
uint16_t | ble_gatts_enh_prepare_write_cfm (uint8_t conn_idx, uint16_t cid, const ble_gatts_prep_write_cfm_t *p_param)
| Respond to an attribute prepare write request. More...
uint16_t | ble_gatts_enh_noti_ind (uint8_t conn_idx, uint16_t cid, const ble_gatts_noti_ind_t *p_param)
| Send out a notification or an indication. More...
uint16_t | ble_gatts_enh_mult_noti (uint8_t conn_idx, uint16_t cid, const ble_gatts_noti_multiple_t *p_param)
| Send out Multiple Variable Length Notifications. More...
uint16_t | ble_gatts_prf_add (ble_gatts_create_db_t *p_gatts_db, ble_evt_handler_t evt_handler)
| Add a server profile by providing its detailed information. More...
uint16_t | ble_gattc_prf_add (ble_uuid_t *p_uuid, ble_evt_handler_t evt_handler)
| Add a client profile by providing its detail information. More...

## Detailed Description

## Function Documentation

## ◆ ble_gattc_prf_add()

uint16_t ble_gattc_prf_add | ( | ble_uuid_t * | p_uuid,
|  | ble_evt_handler_t | evt_handler
| ) |  |

Add a client profile by providing its detail information.

Parameters

  [in] | p_uuid | Pointer to the target service uuid. See ble_uuid_t.
  [out] | evt_handler | Pointer to ble events handler..

Return values

  SDK_SUCCESS | The profile info is recorded successfully, and the profile ENV will be initialized in profile initialization callback function.
  SDK_ERR_POINTER_NULL | The parameter p_uuid or evt_handler is NULL, or input parameters that prf_info points to are invalid.
  SDK_ERR_NO_RESOURCES | The profile number is up to the maximum number the system can support.

## ◆ ble_gatts_enh_mult_noti()

uint16_t ble_gatts_enh_mult_noti | ( | uint8_t | conn_idx,
|  | uint16_t | cid,
|  | const ble_gatts_noti_multiple_t * | p_param
| ) |  |

Send out Multiple Variable Length Notifications.

The execution status of sending notification or indication will be retrieved in the event BLE_GATTS_EVT_ENH_MULT_NTF

Note
  Check whether the relevant Client Characteristic Configuration Descriptor is enabled before using this API.

Parameters

  [in] | conn_idx | Current connection index.
  [in] | cid | The local channel ID.
  [in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_noti_multiple_t.

Return values

  SDK_SUCCESS | Send Notification or Indication event to stack successfully.
  SDK_ERR_POINTER_NULL | Param is NULL.
  SDK_ERR_INVALID_CONN_IDX | Conidx is invalid.
  SDK_ERR_INVALID_PARAM | Type is invalid.
  SDK_ERR_INVALID_HANDLE | Handle not exist in the database.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_gatts_enh_noti_ind()

uint16_t ble_gatts_enh_noti_ind | ( | uint8_t | conn_idx,
|  | uint16_t | cid,
|  | const ble_gatts_noti_ind_t * | p_param
| ) |  |

Send out a notification or an indication.

The execution status of sending notification or indication will be retrieved in the event BLE_GATTS_EVT_ENH_NTF_IND.

Note
  Check whether the relevant Client Characteristic Configuration Descriptor is enabled before using this API.

Parameters

  [in] | conn_idx | Current connection index.
  [in] | cid | The local channel ID.
  [in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_noti_ind_t.

Return values

  SDK_SUCCESS | Send Notification or Indication event to stack successfully.
  SDK_ERR_POINTER_NULL | Param is NULL.
  SDK_ERR_INVALID_CONN_IDX | Conidx is invalid.
  SDK_ERR_INVALID_PARAM | Type is invalid.
  SDK_ERR_INVALID_HANDLE | Handle not exist in the database.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_gatts_enh_prepare_write_cfm()

uint16_t ble_gatts_enh_prepare_write_cfm | ( | uint8_t | conn_idx,
|  | uint16_t | cid,
|  | const ble_gatts_prep_write_cfm_t * | p_param
| ) |  |

Respond to an attribute prepare write request.

It is used in gatts event handler function BLE_GATTS_EVT_ENH_PREP_WRITE_REQUEST to send prepare write operation status to stack.

Note
  The status member ble_gatts_prep_write_cfm_t::status should be set to BLE_ATT_ERR_INSUFF_AUTHOR to control the authorization of particular client's write operation.

Parameters

  [in] | conn_idx | Current connection index.
  [in] | cid | The local channel ID.
  [in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_prep_write_cfm_t.

Return values

  SDK_SUCCESS | Send prepare write confirm status to stack successfully.
  SDK_ERR_POINTER_NULL | Param is NULL.
  SDK_ERR_INVALID_CONN_IDX | Conidx is invalid.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_gatts_enh_prf_add()

uint16_t ble_gatts_enh_prf_add | ( | ble_gatts_create_db_t * | p_gatts_db,
|  | ble_evt_handler_t | evt_handler
| ) |  |

Add a server profile by providing its detailed information, including manager callback functions and GATT server callback functions.

This API should be called in application initialization function.

Parameters

  [in] | p_gatts_db | Pointer to the database info. See ble_gatts_create_db_t.
  [in] | evt_handler | Event handler. See ble_evt_handler_t.

Note
  If there are several profiles which need to be added, this function should be called corresponding times.

Return values

  SDK_SUCCESS | The profile info is recorded successfully, and the database will be created in profile initialization callback function.
  SDK_ERR_POINTER_NULL | The parameter prf_info is NULL, or input parameters that prf_info points to are invalid.
  SDK_ERR_NO_RESOURCES | The profile number is up to the maximum number the system can support.

## ◆ ble_gatts_enh_read_cfm()

uint16_t ble_gatts_enh_read_cfm | ( | uint8_t | conn_idx,
|  | uint16_t | cid,
|  | const ble_gatts_read_cfm_t * | p_param
| ) |  |

Respond to an attribute read request.

It is used in gatts event handle function BLE_GATTS_EVT_ENH_READ_REQUEST to send attribute value to stack which is saved in user space.

Note
  The status member ble_gatts_read_cfm_t::status should be set to BLE_ATT_ERR_INSUFF_AUTHOR to control the authorization of particular read operations of a client.

Parameters

  [in] | conn_idx | Current connection index.
  [in] | cid | The local channel ID.
  [in] | p_param | Pointer to the parameters filled by profile. See ble_gatts_read_cfm_t.

Return values

  SDK_SUCCESS | Send read confirm value to stack successfully.
  SDK_ERR_POINTER_NULL | Param is NULL.
  SDK_ERR_INVALID_CONN_IDX | Conidx is invalid.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_gatts_enh_write_cfm()

uint16_t ble_gatts_enh_write_cfm | ( | uint8_t | conn_idx,
|  | uint16_t | cid,
|  | const ble_gatts_write_cfm_t * | p_param
| ) |  |

Respond to an attribute write request.

It is used in gatts event handler function BLE_GATTS_EVT_ENH_WRITE_REQUEST to send write operation status to stack.

Note
  The status member ble_gatts_write_cfm_t::status should be set to BLE_ATT_ERR_INSUFF_AUTHOR to control the authorization of particular client's write operation.

Parameters

  [in] | conn_idx | Current connection index.
  [in] | cid | The local channel ID.
  [in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_write_cfm_t.

Return values

  SDK_SUCCESS | Send write confirm status to stack successfully.
  SDK_ERR_POINTER_NULL | Param is NULL.
  SDK_ERR_INVALID_CONN_IDX | Conidx is invalid.
  SDK_ERR_NO_RESOURCES | Not enough resources.

## ◆ ble_gatts_prf_add()

uint16_t ble_gatts_prf_add | ( | ble_gatts_create_db_t * | p_gatts_db,
|  | ble_evt_handler_t | evt_handler
| ) |  |

Add a server profile by providing its detailed information.

Parameters

  [in] | p_gatts_db | Pointer to the prf_info. See ble_gatts_create_db_t.
  [in] | evt_handler | Pointer to ble events handler.

Return values

  SDK_SUCCESS | The profile info is recorded successfully, and the database will be created in profile initialization callback function.
  SDK_ERR_POINTER_NULL | The parameter p_gatts_db or evt_handler is NULL.
  SDK_ERR_NO_RESOURCES | The profile number is up to the maximum number the system can support.