mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-17 23:39:58 +00:00
fix(nimble): Make CCCD flags configurable
This commit is contained in:
@@ -222,6 +222,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);
|
||||
|
||||
#if MYNEWT_VAL(BLE_GATT_CACHING)
|
||||
struct ble_gatts_aware_state {
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include "host/ble_store.h"
|
||||
#include "ble_hs_priv.h"
|
||||
#include "esp_nimble_mem.h"
|
||||
|
||||
static uint8_t perm_flags = BLE_ATT_F_READ | BLE_ATT_F_WRITE ;
|
||||
|
||||
#if MYNEWT_VAL(BLE_DYNAMIC_SERVICE)
|
||||
#include "services/gatt/ble_svc_gatt.h"
|
||||
#endif
|
||||
@@ -175,6 +178,11 @@ ble_gatts_clt_cfg_free(struct ble_gatts_clt_cfg *cfg)
|
||||
}
|
||||
#endif
|
||||
|
||||
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,
|
||||
@@ -1000,8 +1008,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;
|
||||
|
||||
Reference in New Issue
Block a user