Hello Cypress World:
Evidently, the Cypress API macro below, that resides in the Cypress API file BLE_gatt.h, is erroneous:
/* Macro to get start handle of attribute
Start handle is only meaningful for characteristic and
service declaration */
The cyBle_gattDB variable is a CYBLE_GATTS_DB_T data type as for example: const CYBLE_GATTS_DB_T cyBle_gattDB[0x34u] in BLE_gatt.c.
The CYBLE_GATTS_DB_T does not have a connHandle element but does have an attHandle element as shown below:
/* GATT database structure used in the GAP Server */
/* Start Handle: Act as an index for querying BLE GATT database */
/* UUID: 16 bit UUID type for an attribute entry, for 32 bit and
128 bit UUIDs the last 16 bits should be stored in this entry
GATT DB access layer shall retrieve complete 128 bit UUID from
CYBLE_GATTS_ATT_GENERIC_VAL_T structure. */
/* The permission bits are clubbed in to a 32-bit field. These
32-bits can be grouped in to 4 bytes. The lowest significant byte
is byte 0 (B0) and the most significant byte is byte 3 (B3). The
bytes where the permissions have been grouped is as given below.
* Attribute permissions (B0)
* Characteristic permissions (B1)
* Implementation specific permission (B3, B2)
/* Attribute end handle, indicating logical boundary of given attribute. */
/* Attribute value format, it can be one of following:
* uint16 16bit - UUID for 16bit service & characteristic declaration
* CYBLE_GATTS_ATT_GENERIC_VAL_T attFormatValue - Buffer containing 32 bit
or 128 bit UUID values for service & charactertistic declaration
* CYBLE_GATTS_ATT_GENERIC_VAL_T attFormatValue - Buffer contraining generic
char definition value, or generic descriptor values
Is it true that the line of code below in the Cypress API file BLE_gatt.h needs to be changed
Best procedure would be to create a support case. That will ensure that a Cypress engineer will have a look at and when there is an error to have it corrected. Remember that this is a developer forum, we cannot change the sources.
For those who access the BLE GATT Database, a Cypress Support Case was created for the error described above and the response follows:
Our software team have also confirmed this bug. It should be cyBle_gattDB[(handle)-1u].attHandle. We will be fixing this in the next version of PSoC Creator. We really appreciate your efforts in reporting this bug.
The Workaround is to use direct access to cyBle_gattDB to get attribute handle: cyBle_gattDB[(handle)-1u].attHandle
Thanks and Regards