API unique to BAS designs configured as a GATT Server role.
A letter 's' is appended to the API name: Cy_BLE_BASS_
|
cy_en_ble_api_result_t | Cy_BLE_BASS_SetCharacteristicValue (uint8_t serviceIndex, cy_en_ble_bas_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue) |
| Sets a characteristic value of the service, which is a value identified by charIndex, to the local database. More...
|
|
cy_en_ble_api_result_t | Cy_BLE_BASS_GetCharacteristicValue (uint8_t serviceIndex, cy_en_ble_bas_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue) |
| Gets a characteristic value of the Battery service, identified by charIndex. More...
|
|
cy_en_ble_api_result_t | Cy_BLE_BASS_GetCharacteristicDescriptor (cy_stc_ble_conn_handle_t connHandle, uint8_t serviceIndex, cy_en_ble_bas_char_index_t charIndex, cy_en_ble_bas_descr_index_t descrIndex, uint8_t attrSize, uint8_t *attrValue) |
| Gets a characteristic descriptor of a specified characteristic of the Battery service from the local GATT database. More...
|
|
cy_en_ble_api_result_t | Cy_BLE_BASS_SendNotification (cy_stc_ble_conn_handle_t connHandle, uint8_t serviceIndex, cy_en_ble_bas_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue) |
| This function updates the value of the Battery Level characteristic in the GATT database. More...
|
|
◆ Cy_BLE_BASS_SetCharacteristicValue()
Sets a characteristic value of the service, which is a value identified by charIndex, to the local database.
- Parameters
-
serviceIndex | The index of the service instance. |
charIndex | The index of the service characteristic of type cy_en_ble_bas_char_index_t. |
attrSize | The size of the characteristic value attribute. A battery level characteristic has a 1-byte length. |
attrValue | The pointer to the characteristic value data that should be stored to the GATT database. |
- Returns
- A return value of type cy_en_ble_api_result_t.
Error Codes | Description |
CY_BLE_SUCCESS | The request was handled successfully. |
CY_BLE_ERROR_INVALID_PARAMETER | Validation of the input parameter failed. |
◆ Cy_BLE_BASS_GetCharacteristicValue()
Gets a characteristic value of the Battery service, identified by charIndex.
- Parameters
-
serviceIndex | The index of the service instance; e.g. if two Battery services are supported in your design, then the first service will be identified by serviceIndex of 0 and the second service by serviceIndex of 1. |
charIndex | The index of a service characteristic of type cy_en_ble_bas_char_index_t. |
attrSize | The size of the characteristic value attribute. A battery-level characteristic has a 1-byte length. |
attrValue | The pointer to the location where characteristic value data should be stored. |
- Returns
- A return value of type cy_en_ble_api_result_t.
Error Codes | Description |
CY_BLE_SUCCESS | The characteristic value was read successfully. |
CY_BLE_ERROR_INVALID_PARAMETER | Validation of the input parameter failed. |
◆ Cy_BLE_BASS_GetCharacteristicDescriptor()
Gets a characteristic descriptor of a specified characteristic of the Battery service from the local GATT database.
- Parameters
-
connHandle | The BLE peer device connection handle. |
serviceIndex | The index of the service instance; e.g. if two Battery services are supported in your design, then the first service will be identified by serviceIndex of 0 and the second service by serviceIndex of 1. |
charIndex | The index of a service characteristic of type cy_en_ble_bas_char_index_t. |
descrIndex | The index of a service characteristic descriptor of type cy_en_ble_bas_descr_index_t. |
attrSize | The size of the characteristic descriptor attribute. |
attrValue | The pointer to the location where the characteristic descriptor value data should be stored. |
- Returns
- A return value of type cy_en_ble_api_result_t.
Error Codes | Description |
CY_BLE_SUCCESS | The characteristic descriptor value was read successfully. |
CY_BLE_ERROR_INVALID_PARAMETER | Validation of the input parameter failed. |
◆ Cy_BLE_BASS_SendNotification()
This function updates the value of the Battery Level characteristic in the GATT database.
If the client has configured a notification on the Battery Level characteristic, the function additionally sends this value using a GATT Notification message.
On enabling notification successfully for a service characteristic, this function sends out a Handle Value notification that results in a CY_BLE_EVT_BASC_NOTIFICATION event at the GATT client's end.
- Parameters
-
connHandle | The BLE peer device connection handle |
serviceIndex | The index of the service instance; e.g. if two Battery services are supported in your design, then the first service will be identified by serviceIndex of 0 and the second service by serviceIndex of 1. |
charIndex | The index of a service characteristic of type cy_en_ble_bas_char_index_t. |
attrSize | The size of the characteristic value attribute. A Battery Level characteristic has a 1-byte length. |
attrValue | The pointer to the characteristic value data that should be sent to the client device. |
- Returns
- A return value of type cy_en_ble_api_result_t.
Error Codes | Description |
CY_BLE_SUCCESS | The request was handled successfully. |
CY_BLE_ERROR_INVALID_PARAMETER | Validation of the input parameter failed. |
CY_BLE_ERROR_INVALID_OPERATION | Operation is invalid for this characteristic. |
CY_BLE_ERROR_INVALID_STATE | Connection with the client is not established. |
CY_BLE_ERROR_MEMORY_ALLOCATION_FAILED | Memory allocation failed. |
CY_BLE_ERROR_NTF_DISABLED | Notification is not enabled by the client. |