esp32: store LE bonding information using le_device_db_tlv

This commit is contained in:
Matthias Ringwald 2017-08-14 14:35:55 +02:00
parent 01f4f2a907
commit 1ce327b5b6
2 changed files with 12 additions and 3 deletions

View File

@ -16,13 +16,13 @@
#define ENABLE_LE_PERIPHERAL #define ENABLE_LE_PERIPHERAL
#define ENABLE_LE_CENTRAL #define ENABLE_LE_CENTRAL
#define ENABLE_LE_DATA_LENGTH_EXTENSION #define ENABLE_LE_DATA_LENGTH_EXTENSION
#define ENABLE_LE_SECURE_CONNECTIONS
#define ENABLE_LOG_ERROR #define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO #define ENABLE_LOG_INFO
// #define ENABLE_LOG_DEBUG // #define ENABLE_LOG_DEBUG
// BTstack configuration. buffers, sizes, ... // BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4) #define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define MAX_NR_LE_DEVICE_DB_ENTRIES 4
// HCI Controller to Host Flow Control // HCI Controller to Host Flow Control
// //
@ -38,3 +38,6 @@
#define HCI_HOST_SCO_PACKET_LEN 60 #define HCI_HOST_SCO_PACKET_LEN 60
#endif #endif
// Link Key DB and LE Device DB using TLV on top of Flash Sector interface
#define NVM_NUM_LINK_KEYS 16
#define NVM_NUM_DEVICE_DB_ENTRIES 16

View File

@ -50,6 +50,7 @@
#include "btstack_ring_buffer.h" #include "btstack_ring_buffer.h"
#include "btstack_tlv.h" #include "btstack_tlv.h"
#include "btstack_tlv_esp32.h" #include "btstack_tlv_esp32.h"
#include "ble/le_device_db_tlv.h"
#include "classic/btstack_link_key_db.h" #include "classic/btstack_link_key_db.h"
#include "classic/btstack_link_key_db_tlv.h" #include "classic/btstack_link_key_db_tlv.h"
#include "hci.h" #include "hci.h"
@ -310,7 +311,7 @@ int app_main(void){
printf("BTstack: setup\n"); printf("BTstack: setup\n");
// enable packet logger // enable packet logger
// hci_dump_open(NULL, HCI_DUMP_STDOUT); hci_dump_open(NULL, HCI_DUMP_STDOUT);
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
@ -319,11 +320,16 @@ int app_main(void){
// init HCI // init HCI
hci_init(transport_get_instance(), NULL); hci_init(transport_get_instance(), NULL);
// setup link key deb using esp32 btstack_tlv instance // setup TLV ESP32 implementation
const btstack_tlv_t * btstack_tlv_impl = btstack_tlv_esp32_get_instance(); const btstack_tlv_t * btstack_tlv_impl = btstack_tlv_esp32_get_instance();
// setup Link Key DB using TLV
const btstack_link_key_db_t * btstack_link_key_db = btstack_link_key_db_tlv_get_instance(btstack_tlv_impl, NULL); const btstack_link_key_db_t * btstack_link_key_db = btstack_link_key_db_tlv_get_instance(btstack_tlv_impl, NULL);
hci_set_link_key_db(btstack_link_key_db); hci_set_link_key_db(btstack_link_key_db);
// setup LE Device DB using TLV
le_device_db_tlv_configure(btstack_tlv_impl, NULL);
// inform about BTstack state // inform about BTstack state
hci_event_callback_registration.callback = &packet_handler; hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration); hci_add_event_handler(&hci_event_callback_registration);