Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Dynamically enable/disable GATT service or characteristic - KBA233960

Dynamically enable/disable GATT service or characteristic - KBA233960

Chelladurai
Community Manager
Community Manager
Community Manager
100 sign-ins 50 questions asked 50 sign-ins

Version: **

Related products: PSoC™ 6 MCU with AIROC™ Bluetooth® LE

You can use the Cy_BLE_GATTS_EnableAttribute() and Cy_BLE_GATTS_DisableAttribute() API functions to dynamically enable or disable a GATT service or characteristic as shown in the following:

Enabling an attribute

Use the following code snippet to enable the attribute entry for a service or characteristic logical group in the GATT database registered in the Bluetooth® LE stack:

cy_stc_ble_gatts_db_attr_enable_info_t handle;
cy_en_ble_gatt_err_code_t gattError;

handle.attrHandle = CY_BLE_BLE_THROUGHPUT_SERVICE_HANDLE;
GattErrCode = Cy_BLE_GATTS_EnableAttribute(&handle);

Disabling an attribute

Use the following code snippet to disable an attribute entry for a service or characteristic logical group in the GATT database registered in the Bluetooth® LE stack:

cy_stc_ble_gatts_db_attr_disable_info_t handle;
cy_en_ble_gatt_err_code_t gattError;   

   handle.attrHandle = CY_BLE_BLE_THROUGHPUT_SERVICE_HANDLE;
   GattErrCode = Cy_BLE_GATTS_DisableAttribute(&handle);

See this API in the BLE middleware PDL documentation. In PSoC™ Creator, right-click the BLE Component, and select Open PDL Documentation or go to C:/Program Files(x86)/Cypress/PDL/3.1.0/doc/ble_api_reference_manual/html/index.html

0 Likes
602 Views