Abstracts Variable Length Values for GATT.
Apart from data and length, actual length is needed so that the GATT can indicate to the application the actual length of data processed for a PDU.
This is used in multiple commands - see CY_BLE_GATT_READ_RSP, CY_BLE_GATT_FIND_BY_TYPE_VALUE_REQ, CY_BLE_GATT_READ_BLOB_RSP, etc.
In GATT Read Response for example, if the attribute length is 30 octets and the GATT MTU is 23 octets, then only first 22 octets can be sent by the GATT. Therefore the actual length will be 22 (GATT MTU-1). However, if the GATT MTU is configured to be 54 for example, all 30 octets can be transmitted and the actual length will be 30.
Actual length should be derived as : actualLen = minimum(length, (GATT MTU-1))
In case multiple values are being packed, the actual length processed will depend on the available GATT MTU.
Data Fields | |
uint8_t * | val |
Pointer to the value to be packed. | |
uint16_t | len |
Length of the Value to be packed in bytes. | |
uint16_t | actualLen |
Output parameter indicating actual length packed and sent over the air. More... | |
uint16_t cy_stc_ble_gatt_value_t::actualLen |
Output parameter indicating actual length packed and sent over the air.
Actual length can be less than or equal to the 'len' parameter values. Each GATT procedure defines different lengths of data that can be transmitted over the air. If the application sends more than that, not all of the data will be transmitted.