fix(nimble): Make CCCD flags configurable

This commit is contained in:
shreeyash
2024-09-04 11:52:38 +05:30
committed by shreeyash
parent 40a79bfa27
commit e2522d60d9
2 changed files with 9 additions and 2 deletions
+1
View File
@@ -186,6 +186,7 @@ int ble_gatts_register_svcs(const struct ble_gatt_svc_def *svcs,
int ble_gatts_clt_cfg_access(uint16_t conn_handle, uint16_t attr_handle,
uint8_t op, uint16_t offset, struct os_mbuf **om,
void *arg);
void ble_gatts_set_clt_cfg_perm_flags(uint8_t flags);
/*** @misc. */
int ble_gatts_conn_can_alloc(void);
+8 -2
View File
@@ -26,6 +26,8 @@
#include "ble_hs_priv.h"
#include "esp_nimble_mem.h"
static uint8_t perm_flags = BLE_ATT_F_READ | BLE_ATT_F_WRITE ;
#define BLE_GATTS_INCLUDE_SZ 6
#define BLE_GATTS_CHR_MAX_SZ 19
@@ -79,6 +81,11 @@ STATS_NAME_START(ble_gatts_stats)
STATS_NAME(ble_gatts_stats, dsc_writes)
STATS_NAME_END(ble_gatts_stats)
void ble_gatts_set_clt_cfg_perm_flags(uint8_t flags)
{
perm_flags = flags ;
}
static int
ble_gatts_svc_access(uint16_t conn_handle, uint16_t attr_handle,
uint8_t op, uint16_t offset, struct os_mbuf **om,
@@ -791,8 +798,7 @@ static int
ble_gatts_register_clt_cfg_dsc(uint16_t *att_handle)
{
int rc;
rc = ble_att_svr_register(uuid_ccc, BLE_ATT_F_READ | BLE_ATT_F_WRITE, 0,
rc = ble_att_svr_register(uuid_ccc, perm_flags, 0,
att_handle, ble_gatts_clt_cfg_access, NULL);
if (rc != 0) {
return rc;