Cypress PSoC 6 Bluetooth Low Energy Middleware Library 3.60

General Description

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

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

Functions

cy_en_ble_api_result_t Cy_BLE_CPSS_SetCharacteristicValue (cy_en_ble_cps_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue)
 Sets a characteristic value of Cycling Power service, which is a value identified by charIndex, to the local database. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_GetCharacteristicValue (cy_en_ble_cps_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue)
 Gets a characteristic value of Cycling Power service. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_SetCharacteristicDescriptor (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_cps_char_index_t charIndex, cy_en_ble_cps_descr_index_t descrIndex, uint8_t attrSize, uint8_t *attrValue)
 Sets a characteristic descriptor of the specified characteristic of Cycling Power service. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_GetCharacteristicDescriptor (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_cps_char_index_t charIndex, cy_en_ble_cps_descr_index_t descrIndex, uint8_t attrSize, uint8_t *attrValue)
 Gets a characteristic descriptor of the specified characteristic of Cycling Power service. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_SendNotification (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_cps_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue)
 Sends notification with a characteristic value of the CPS, which is a value specified by charIndex, to the client device. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_SendIndication (cy_stc_ble_conn_handle_t connHandle, cy_en_ble_cps_char_index_t charIndex, uint8_t attrSize, uint8_t *attrValue)
 Sends indication with a characteristic value of the CPS, which is a value specified by charIndex, to the client device. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_StartBroadcast (uint16_t advInterval, uint8_t attrSize, const uint8_t *attrValue)
 This function is used to start broadcasting of the Cycling Power Measurement characteristic or update broadcasting data when it was started before. More...
 
cy_en_ble_api_result_t Cy_BLE_CPSS_StopBroadcast (void)
 This function is used to stop broadcasting of the Cycling Power Measurement characteristic. More...
 

Function Documentation

◆ Cy_BLE_CPSS_SetCharacteristicValue()

cy_en_ble_api_result_t Cy_BLE_CPSS_SetCharacteristicValue ( cy_en_ble_cps_char_index_t  charIndex,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sets a characteristic value of Cycling Power service, which is a value identified by charIndex, to the local database.

Parameters
charIndexThe index of the service characteristic of type cy_en_ble_cps_char_index_t. The valid values are,
attrSizeThe size of the characteristic value attribute.
attrValueThe 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_ERROR_GATT_DB_INVALID_ATTR_HANDLEAn optional characteristic is absent.

◆ Cy_BLE_CPSS_GetCharacteristicValue()

cy_en_ble_api_result_t Cy_BLE_CPSS_GetCharacteristicValue ( cy_en_ble_cps_char_index_t  charIndex,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Gets a characteristic value of Cycling Power service.

The value is identified by charIndex.

Parameters
charIndexThe index of the service characteristic of type cy_en_ble_cps_char_index_t. The valid values are,
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_CPSS_SetCharacteristicDescriptor()

cy_en_ble_api_result_t Cy_BLE_CPSS_SetCharacteristicDescriptor ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_cps_char_index_t  charIndex,
cy_en_ble_cps_descr_index_t  descrIndex,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sets a characteristic descriptor of the specified characteristic of Cycling Power service.

Parameters
connHandleThe connection handle.
charIndexThe index of the service characteristic of type cy_en_ble_cps_char_index_t. The valid values are,
descrIndexThe index of the service characteristic descriptor of type cy_en_ble_cps_descr_index_t. The valid values are,
attrSizeThe size of the characteristic descriptor attribute.
attrValueThe pointer to the descriptor 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 characteristic descriptor value was read successfully.
CY_BLE_ERROR_INVALID_PARAMETER Validation of the input parameter failed.

◆ Cy_BLE_CPSS_GetCharacteristicDescriptor()

cy_en_ble_api_result_t Cy_BLE_CPSS_GetCharacteristicDescriptor ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_cps_char_index_t  charIndex,
cy_en_ble_cps_descr_index_t  descrIndex,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Gets a characteristic descriptor of the specified characteristic of Cycling Power service.

Parameters
connHandleThe connection handle.
charIndexThe index of the service characteristic of type cy_en_ble_cps_char_index_t. The valid values are,
descrIndexThe index of the service characteristic descriptor of type cy_en_ble_cps_descr_index_t. The valid values are,
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 characteristic descriptor value was read successfully.
CY_BLE_ERROR_INVALID_PARAMETER Validation of the input parameter failed.

◆ Cy_BLE_CPSS_SendNotification()

cy_en_ble_api_result_t Cy_BLE_CPSS_SendNotification ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_cps_char_index_t  charIndex,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sends notification with a characteristic value of the CPS, which is a value specified by charIndex, to the client device.

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

Parameters
connHandleThe connection handle
charIndexThe index of the service characteristic of type cy_en_ble_cps_char_index_t. The valid values are,
attrSizeThe size of the characteristic value attribute.
attrValueThe 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_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_CPSS_SendIndication()

cy_en_ble_api_result_t Cy_BLE_CPSS_SendIndication ( cy_stc_ble_conn_handle_t  connHandle,
cy_en_ble_cps_char_index_t  charIndex,
uint8_t  attrSize,
uint8_t *  attrValue 
)

Sends indication with a characteristic value of the CPS, which is a value specified by charIndex, to the client device.

On enabling indication successfully it sends out a 'Handle Value Indication' which results in CY_BLE_EVT_CPSC_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_cps_char_index_t. The valid values are,
attrSizeThe size of the characteristic value attribute.
attrValueThe 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_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.
Events
In case of successful execution (return value = CY_BLE_SUCCESS) the following events can appear:
If the CPS service-specific callback is registered with Cy_BLE_CPS_RegisterAttrCallback(): Otherwise, if the CPS service-specific callback is not registered:

◆ Cy_BLE_CPSS_StartBroadcast()

cy_en_ble_api_result_t Cy_BLE_CPSS_StartBroadcast ( uint16_t  advInterval,
uint8_t  attrSize,
const uint8_t *  attrValue 
)

This function is used to start broadcasting of the Cycling Power Measurement characteristic or update broadcasting data when it was started before.

It is available only in Broadcaster role.

Parameters
advIntervalAdvertising interval in 625 us units. The valid range is from CY_BLE_GAP_ADV_ADVERT_INTERVAL_NONCON_MIN to CY_BLE_GAP_ADV_ADVERT_INTERVAL_MAX. This parameter is ignored when when broadcasting is already started.
attrSizeThe size of the characteristic value attribute. This size is limited by maximum advertising packet length and advertising header size.
attrValueThe pointer to the Cycling Power Measurement characteristic that include the mandatory fields (e.g. the Flags field and the Instantaneous Power field and depending on the Flags field, some optional fields in a non connectable undirected advertising event.
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 On successful operation.
CY_BLE_ERROR_INVALID_PARAMETER On passing an invalid parameter.
CY_BLE_ERROR_INVALID_OPERATION Operation is not permitted.

◆ Cy_BLE_CPSS_StopBroadcast()

cy_en_ble_api_result_t Cy_BLE_CPSS_StopBroadcast ( void  )

This function is used to stop broadcasting of the Cycling Power Measurement characteristic.

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 On successful operation.
CY_BLE_ERROR_MEMORY_ALLOCATION_FAILED Memory allocation failed.
CY_BLE_ERROR_INVALID_STATE On calling this function not in CPS broadcasting mode.
CY_BLE_ERROR_INSUFFICIENT_RESOURCES Stack resources are unavailable.