Cypress PSoC 6 Bluetooth Low Energy Middleware Library 3.60

General Description

API unique to ESS designs configured as a GATT Server role.

A letter 's' is appended to the API name: Cy_BLE_ESSS_

Functions

cy_en_ble_api_result_t Cy_BLE_ESSS_SetChangeIndex (uint16_t essIndex, uint8_t advertisingParamIndex)
 Performs write operation of two-byte pseudo-random change index to the advertisement packet. More...
 
cy_en_ble_api_result_t Cy_BLE_ESSS_SetCharacteristicValue (cy_en_ble_ess_char_index_t charIndex, uint8_t charInstance, uint8_t attrSize, uint8_t *attrValue)
 Sets the characteristic value of the Environmental Sensing service in the local database. More...
 
cy_en_ble_api_result_t Cy_BLE_ESSS_GetCharacteristicValue (cy_en_ble_ess_char_index_t charIndex, uint8_t charInstance, uint8_t attrSize, uint8_t *attrValue)
 Gets a characteristic value of Environmental Sensing service. More...
 
cy_en_ble_api_result_t Cy_BLE_ESSS_SetCharacteristicDescriptor (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_ess_char_index_t charIndex, uint8_t charInstance, cy_en_ble_ess_descr_index_t descrIndex, uint16_t attrSize, uint8_t *attrValue)
 Sets the characteristic descriptor of the specified characteristic. More...
 
cy_en_ble_api_result_t Cy_BLE_ESSS_GetCharacteristicDescriptor (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_ess_char_index_t charIndex, uint8_t charInstance, cy_en_ble_ess_descr_index_t descrIndex, uint16_t attrSize, uint8_t *attrValue)
 Gets the characteristic descriptor of the specified characteristic. More...
 
cy_en_ble_api_result_t Cy_BLE_ESSS_SendNotification (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_ess_char_index_t charIndex, uint8_t charInstance, uint8_t attrSize, uint8_t *attrValue)
 Sends a notification with a characteristic value of the Environmental Sensing service, which is a value specified by charIndex, to the client's device. More...
 
cy_en_ble_api_result_t Cy_BLE_ESSS_SendIndication (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_ess_char_index_t charIndex, uint8_t charInstance, uint8_t attrSize, uint8_t *attrValue)
 Sends an indication with a characteristic value of the Environmental Sensing service, which is a value specified by charIndex, to the client's device. More...
 

Function Documentation

◆ Cy_BLE_ESSS_SetChangeIndex()

cy_en_ble_api_result_t Cy_BLE_ESSS_SetChangeIndex ( uint16_t  essIndex,
uint8_t  advertisingParamIndex 
)

Performs write operation of two-byte pseudo-random change index to the advertisement packet.

The "Service Data" field should be selected in the BLE Component customizer GUI and contain a two-byte initial change index value and in opposite case the function will always return CY_BLE_ERROR_INVALID_OPERATION.

This function must be called when Cy_BLE_StackGetBleSsState() returns CY_BLE_BLESS_STATE_EVENT_CLOSE state.

Parameters
essIndexA two-byte pseudo-random change index to be written to the advertisement data.
advertisingParamIndexThe index of the peripheral and broadcast configuration in customizer. For example:
  • CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX 0x00
  • CY_BLE_BROADCASTER_CONFIGURATION_0_INDEX 0x01
Returns
cy_en_ble_api_result_t : Return value indicates whether the function succeeded or failed. The following are possible error codes:
Error Codes Description
CY_BLE_SUCCESS The function completed successfully.
CY_BLE_ERROR_INVALID_OPERATION This operation is not permitted
CY_BLE_ERROR_INVALID_PARAMETER On NULL pointer, Data length in input parameter exceeds 31 bytes.

◆ Cy_BLE_ESSS_SetCharacteristicValue()

cy_en_ble_api_result_t Cy_BLE_ESSS_SetCharacteristicValue ( cy_en_ble_ess_char_index_t  charIndex,
uint8_t  charInstance,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sets the characteristic value of the Environmental Sensing service in the local database.

Parameters
charIndexThe index of the service characteristic of type cy_en_ble_ess_char_index_t.
charInstanceThe instance number of the characteristic specified by "charIndex".
attrSizeThe size (in Bytes) of the characteristic value attribute.
attrValueThe pointer to the characteristic value data that should be stored in 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_ERROR_GATT_DB_INVALID_ATTR_HANDLEAn optional characteristic is absent.

◆ Cy_BLE_ESSS_GetCharacteristicValue()

cy_en_ble_api_result_t Cy_BLE_ESSS_GetCharacteristicValue ( cy_en_ble_ess_char_index_t  charIndex,
uint8_t  charInstance,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Gets a characteristic value of Environmental Sensing service.

The value is identified by charIndex.

Parameters
charIndexThe index of the service characteristic of type cy_en_ble_ess_char_index_t.
charInstanceThe instance number of the characteristic specified by "charIndex".
attrSizeThe size of the characteristic value attribute.
attrValueThe 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_ERROR_GATT_DB_INVALID_ATTR_HANDLE An optional characteristic is absent.

◆ Cy_BLE_ESSS_SetCharacteristicDescriptor()

cy_en_ble_api_result_t Cy_BLE_ESSS_SetCharacteristicDescriptor ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_ess_char_index_t  charIndex,
uint8_t  charInstance,
cy_en_ble_ess_descr_index_t  descrIndex,
uint16_t  attrSize,
uint8_t *  attrValue 
)

Sets the characteristic descriptor of the specified characteristic.

Parameters
connHandleThe connection handle.
charIndexThe index of the service characteristic of type cy_en_ble_ess_char_index_t.
charInstanceThe instance number of the characteristic specified by "charIndex".
descrIndexThe index of the service characteristic descriptor of type cy_en_ble_ess_descr_index_t.
attrSizeThe size of the characteristic descriptor attribute.
attrValueThe pointer to the descriptor value data to be stored in the GATT database.
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_ERROR_GATT_DB_INVALID_ATTR_HANDLE An optional characteristic is absent.

◆ Cy_BLE_ESSS_GetCharacteristicDescriptor()

cy_en_ble_api_result_t Cy_BLE_ESSS_GetCharacteristicDescriptor ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_ess_char_index_t  charIndex,
uint8_t  charInstance,
cy_en_ble_ess_descr_index_t  descrIndex,
uint16_t  attrSize,
uint8_t *  attrValue 
)

Gets the characteristic descriptor of the specified characteristic.

Parameters
connHandleThe connection handle
charIndexThe index of the service characteristic of type cy_en_ble_ess_char_index_t.
charInstanceThe instance number of the characteristic specified by "charIndex".
descrIndexThe index of the service characteristic descriptor of type cy_en_ble_ess_descr_index_t.
attrSizeThe size of the characteristic descriptor attribute.
attrValueThe pointer to the location where 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 request was handled successfully.
CY_BLE_ERROR_INVALID_PARAMETER Validation of the input parameter failed.
CY_BLE_ERROR_GATT_DB_INVALID_ATTR_HANDLE An optional characteristic is absent.

◆ Cy_BLE_ESSS_SendNotification()

cy_en_ble_api_result_t Cy_BLE_ESSS_SendNotification ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_ess_char_index_t  charIndex,
uint8_t  charInstance,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sends a notification with a characteristic value of the Environmental Sensing service, which is a value specified by charIndex, to the client's device.

On enabling notification successfully for a service characteristic it sends out a 'Handle Value Notification' which results in CY_BLE_EVT_ESSC_NOTIFICATION event at the GATT Client's end.

Parameters
connHandleThe connection handle.
charIndexThe index of the service characteristic of type cy_en_ble_ess_char_index_t.
charInstanceThe instance number of the characteristic specified by "charIndex".
attrSizeThe size of the characteristic value attribute.
attrValueThe pointer to the characteristic value data that should be sent to the client's 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_GATT_DB_INVALID_ATTR_HANDLE An optional characteristic is absent.
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.

◆ Cy_BLE_ESSS_SendIndication()

cy_en_ble_api_result_t Cy_BLE_ESSS_SendIndication ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_ess_char_index_t  charIndex,
uint8_t  charInstance,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sends an indication with a characteristic value of the Environmental Sensing service, which is a value specified by charIndex, to the client's device.

On enabling indication successfully it sends out a 'Handle Value Indication' which results in CY_BLE_EVT_ESSC_INDICATION or CY_BLE_EVT_GATTC_HANDLE_VALUE_IND (if service-specific callback function is not registered) event at the GATT Client's end.

Parameters
connHandleThe connection handle.
charIndexThe index of the service characteristic of type cy_en_ble_ess_char_index_t.
charInstanceThe instance number of the characteristic specified by "charIndex".
attrSizeThe size of the characteristic value attribute.
attrValueThe pointer to the characteristic value data that should be sent to the client's 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_GATT_DB_INVALID_ATTR_HANDLE An optional characteristic is absent.
CY_BLE_ERROR_INVALID_STATE Connection with the client is not established.
CY_BLE_ERROR_MEMORY_ALLOCATION_FAILED Memory allocation failed.
CY_BLE_ERROR_IND_DISABLED Indication is not enabled by the client.
Events
In case of successful execution (return value = CY_BLE_SUCCESS) the following events can appear:
If the ESS service-specific callback is registered with Cy_BLE_ESS_RegisterAttrCallback(): Otherwise (if the ESS service-specific callback is not registered):