Merge branch 'feature/gatt_caching_support' into 'master'

feat(nimble): Gatt caching support

See merge request espressif/esp-idf!27074
pull/13090/head
Roshan Bangar 2024-01-16 19:27:22 +08:00
commit ed0ba2e29d
5 zmienionych plików z 84 dodań i 1 usunięć

Wyświetl plik

@ -693,11 +693,14 @@ if(CONFIG_BT_ENABLED)
"host/nimble/nimble/nimble/host/store/ram/src/ble_store_ram.c"
"host/nimble/nimble/nimble/host/store/config/src/ble_store_config.c"
"host/nimble/nimble/nimble/host/store/config/src/ble_store_nvs.c"
"host/nimble/nimble/nimble/host/src/ble_gattc_cache.c"
"host/nimble/nimble/nimble/host/src/ble_gattc_cache_conn.c"
)
list(APPEND srcs
"host/nimble/nimble/porting/nimble/src/nimble_port.c"
"host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c"
"host/nimble/port/src/nvs_port.c"
)
list(APPEND include_dirs
porting/include

Wyświetl plik

@ -620,6 +620,36 @@ config BT_NIMBLE_PERIODIC_ADV_ENH
help
Enable the periodic advertising enhancements
menuconfig BT_NIMBLE_GATT_CACHING
bool "Enable GATT caching"
depends on BT_NIMBLE_ENABLED && BT_NIMBLE_50_FEATURE_SUPPORT
help
Enable GATT caching
config BT_NIMBLE_GATT_CACHING_MAX_CONNS
int "Maximum connections to be cached"
depends on BT_NIMBLE_GATT_CACHING
default 1
help
Set this option to set the upper limit on number of connections to be cached.
config BT_NIMBLE_GATT_CACHING_MAX_SVCS
int "Maximum number of services per connection"
depends on BT_NIMBLE_GATT_CACHING
default 64
help
Set this option to set the upper limit on number of services per connection to be cached.
config BT_NIMBLE_GATT_CACHING_MAX_CHRS
int "Maximum number of characteristics per connection"
depends on BT_NIMBLE_GATT_CACHING
default 64
help
Set this option to set the upper limit on number of characteristics per connection to be cached.
config BT_NIMBLE_GATT_CACHING_MAX_DSCS
int "Maximum number of descriptors per connection"
depends on BT_NIMBLE_GATT_CACHING
default 64
help
Set this option to set the upper limit on number of discriptors per connection to be cached.
config BT_NIMBLE_WHITELIST_SIZE
int "BLE white list size"
depends on BT_NIMBLE_ENABLED

@ -1 +1 @@
Subproject commit 4c281ee888f100373420bc7b4fbd0c4da4fb929c
Subproject commit 29cc5fbf2e3d4e0ee38570552109192ffa4e4fc3

Wyświetl plik

@ -129,6 +129,16 @@
#define MYNEWT_VAL_BLE_MAX_PERIODIC_ADVERTISER_LIST (CONFIG_BT_NIMBLE_MAX_PERIODIC_ADVERTISER_LIST)
#endif
#ifndef CONFIG_BT_NIMBLE_GATT_CACHING
#define MYNEWT_VAL_BLE_GATT_CACHING (0)
#else
#define MYNEWT_VAL_BLE_GATT_CACHING (CONFIG_BT_NIMBLE_GATT_CACHING)
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CONNS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CONNS)
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_SVCS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_SVCS)
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_CHRS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_CHRS)
#define MYNEWT_VAL_BLE_GATT_CACHING_MAX_DSCS (CONFIG_BT_NIMBLE_GATT_CACHING_MAX_DSCS)
#endif
#ifndef CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES
#define MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES (1)
#else

Wyświetl plik

@ -0,0 +1,40 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _NVS_H
#define _NVS_H
#include <stdio.h>
#include "nvs.h"
#include "nimble/storage_port.h"
static int
nvs_open_custom(const char* namespace_name, open_mode_t open_mode, cache_handle_t *out_handle)
{
switch (open_mode) {
case READONLY:
return nvs_open(namespace_name, NVS_READONLY, out_handle);
case READWRITE:
return nvs_open(namespace_name, NVS_READWRITE, out_handle);
default:
return -1;
}
}
struct cache_fn_mapping
link_storage_fn(void *storage_cb)
{
struct cache_fn_mapping cache_fn;
cache_fn.open = nvs_open_custom;
cache_fn.close = nvs_close;
cache_fn.erase_all = nvs_erase_all;
cache_fn.write = nvs_set_blob;
cache_fn.read = nvs_get_blob;
return cache_fn;
}
#endif