Version: **
Translation - Japanese: BLE GATTサーバのGATT DBでの属性値更新– KBA219298 - Community Translated (JA)
Question:
How do i update an attribute’s value in the GATT DB of a BLE GATT server?
Answer:
In a BLE GATT server, the profile-related data are structured in a database called the GATT database. The GATT database consists of the services, characteristics, characteristic descriptors, and declarations present on the server
In PSoC® Creator™, these attributes (characteristics, descriptors) can be initialized in the BLE Component configuration window, under the Profiles tab. If the characteristic value must be updated in runtime, the application can do so by using APIs and macros as follows:
In either of these cases, the length of the value source should be less than or equal to the length of the characteristic as configured in the BLE Component configuration.
In either of these cases, the length of the value source should be less than or equal to the length of the characteristic as configured in the BLE Component configuration.
CyBle_GattsWriteAttributeValue()
API and setting the last parameter to CYBLE_GATT_DB_LOCALLY_INITIATED
CYBLE_GATT_DB_ATTR_SET_GEN_VALUE
(handle,src,length) macroCyBle_GattsWriteAttributeValue()
API with the last parameter set to CYBLE_GATT_DB_PEER_INITIATED
. When the last parameter of the CyBle_GattsWriteAttributeValue()
API is set to CYBLE_GATT_DB_LOCALLY_INITIATED
, the API does not check for attribute permissions and will update the attribute value blindly. On the contrary, when the flag is set to CYBLE_GATT_DB_PEER_INITIATED
, the API checks for attribute permissions before executing the write operation. If the client does not match the permissions required, the CyBle_GattsWriteAttributeValue()
API will return a GATT Error code accordingly. Based on the return value, either a Write Response or an Error Response can be sent back to the client.