Functions | |
uint16_t | ble_gatts_srvc_db_create (ble_gatts_create_db_t *p_param) |
Register a service's attribute list. More... | |
uint16_t | ble_gatts_value_set (uint16_t handle, uint16_t length, uint16_t offset, const uint8_t *p_value) |
Update attribute value only if the attribute value is saved in the BLE Stack space. More... | |
uint16_t | ble_gatts_value_get (uint16_t handle, uint16_t *p_length, uint8_t *p_value) |
Retrieve attribute value only if the attribute value is saved in the BLE Stack space. More... | |
uint16_t | ble_gatts_attr_permission_set (uint16_t handle, uint16_t perm, uint16_t ext_perm) |
Update attribute permission. More... | |
uint16_t | ble_gatts_attr_permission_get (uint16_t handle, uint16_t *p_perm, uint16_t *p_ext_perm) |
Retrieve attribute permission. More... | |
uint16_t | ble_gatts_read_cfm (uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param) |
Respond to an attribute read request. More... | |
uint16_t | ble_gatts_write_cfm (uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param) |
Respond to an attribute write request. More... | |
uint16_t | ble_gatts_prepare_write_cfm (uint8_t conn_idx, const ble_gatts_prep_write_cfm_t *p_param) |
Respond to an attribute prepare write request. More... | |
uint16_t | ble_gatts_noti_ind (uint8_t conn_idx, const ble_gatts_noti_ind_t *p_param) |
Send out a notification or an indication. More... | |
void | ble_gatts_service_changed (void) |
When service on local device finishes upgrade, call this API to send service upgrade to stack. More... | |
uint16_t ble_gatts_attr_permission_get | ( | uint16_t | handle, |
uint16_t * | p_perm, | ||
uint16_t * | p_ext_perm | ||
) |
Retrieve attribute permission.
[in] | handle | Attribute handle. |
[out] | p_perm | Attribute permission value to be returned. |
[out] | p_ext_perm | Attribute extended permission value to be returned. |
SDK_SUCCESS | Retrieve attribute permission successfully. |
SDK_ERR_POINTER_NULL | Perm or ext_perm is NULL. |
SDK_ERR_INVALID_HANDLE | Handle not exist in the database. |
uint16_t ble_gatts_attr_permission_set | ( | uint16_t | handle, |
uint16_t | perm, | ||
uint16_t | ext_perm | ||
) |
Update attribute permission.
[in] | handle | Attribute handle. |
[in] | perm | New attribute permission. |
[in] | ext_perm | New attribute extended permission. |
SDK_SUCCESS | Update attribute permission successfully. |
SDK_ERR_INVALID_HANDLE | Handle not exist in the database. |
SDK_ERR_REQ_NOT_SUPPORTED | Attribute permission can't be modified. |
uint16_t ble_gatts_noti_ind | ( | uint8_t | conn_idx, |
const ble_gatts_noti_ind_t * | p_param | ||
) |
Send out a notification or an indication.
[in] | conn_idx | Current connection index. |
[in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_noti_ind_t. |
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. |
uint16_t ble_gatts_prepare_write_cfm | ( | uint8_t | conn_idx, |
const ble_gatts_prep_write_cfm_t * | p_param | ||
) |
Respond to an attribute prepare write request.
[in] | conn_idx | Current connection index. |
[in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_prep_write_cfm_t. |
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. |
uint16_t ble_gatts_read_cfm | ( | uint8_t | conn_idx, |
const ble_gatts_read_cfm_t * | p_param | ||
) |
Respond to an attribute read request.
[in] | conn_idx | Current connection index. |
[in] | p_param | Pointer to the parameters filled by profile. See ble_gatts_read_cfm_t. |
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. |
void ble_gatts_service_changed | ( | void | ) |
When service on local device finishes upgrade, call this API to send service upgrade to stack.
If the bonded device connects again, the stack will send service change to the bonded device until the bonded device has sent back indication confirmation.
uint16_t ble_gatts_srvc_db_create | ( | ble_gatts_create_db_t * | p_param | ) |
Register a service's attribute list.
[in] | p_param | Pointer to the parameter used in creating databases. see ble_gatts_create_db_t. |
SDK_SUCCESS | Database has been registered successfully. |
SDK_ERR_POINTER_NULL | Param is NULL or param's members are NULL. |
SDK_ERR_INVALID_PARAM | The member of param is invalid. |
SDK_ERR_INVALID_HANDLE | The service handles can not be allocated. |
SDK_ERR_NO_RESOURCES | There is not enough memory to allocate service buffer. |
SDK_ERR_INVALID_PERM | Permissions of Client Characteristic Configuration or Server Characteristic Configuration are not set correctly. |
uint16_t ble_gatts_value_get | ( | uint16_t | handle, |
uint16_t * | p_length, | ||
uint8_t * | p_value | ||
) |
Retrieve attribute value only if the attribute value is saved in the BLE Stack space.
[in] | handle | Attribute handle. |
[in,out] | p_length | Input as buffer size and output as attribute value length. |
[out] | p_value | Buffer to store attribute value when buffer size is enough. |
SDK_SUCCESS | Attribute value retrieved successfully. |
SDK_ERR_POINTER_NULL | The pointer to input buffer size or input buffer is NULL. |
SDK_ERR_INVALID_HANDLE | Handle not exist in the database. |
SDK_ERR_REQ_NOT_SUPPORTED | Attribute data is not present in database. |
SDK_ERR_INVALID_ATT_VAL_LEN | Attribute data value size is bigger than buffer size. |
SDK_ERR_APP_ERROR | Database is not correctly initialized by application. |
uint16_t ble_gatts_value_set | ( | uint16_t | handle, |
uint16_t | length, | ||
uint16_t | offset, | ||
const uint8_t * | p_value | ||
) |
Update attribute value only if the attribute value is saved in the BLE Stack space.
[in] | handle | Attribute handle. |
[in] | length | Size of the value to set. |
[in] | offset | Data offset of the value in attribute value. |
[in] | p_value | The value to set. If offset = 0, the value is the new attribute value; otherwise, the value is part of the new attribute value. |
SDK_SUCCESS | Successfully update the attribute value. |
SDK_ERR_POINTER_NULL | Value is NULL. |
SDK_ERR_INVALID_HANDLE | Handle not exist in database. |
SDK_ERR_REQ_NOT_SUPPORTED | Attribute data is not present in database or cannot be modified. |
SDK_ERR_INVALID_ATT_VAL_LEN | New value length exceeds maximum attribute value length. |
SDK_ERR_INVALID_OFFSET | Offset exceeds current attribute value length. |
uint16_t ble_gatts_write_cfm | ( | uint8_t | conn_idx, |
const ble_gatts_write_cfm_t * | p_param | ||
) |
Respond to an attribute write request.
[in] | conn_idx | Current connection index. |
[in] | p_param | Pointer to the parameters filled by profile. see ble_gatts_write_cfm_t. |
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. |