mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
Merge branch 'develop' of https://github.com/bluekitchen/btstack into develop
This commit is contained in:
commit
43716165be
@ -61,7 +61,7 @@ identifierstyle=\color{black},
|
||||
stringstyle=\color{blue},
|
||||
morekeywords={*, btstack_timer_source_t, btstack_data_source_t, uint32_t, uint16_t, uint8_t, btstack_run_loop_TYPE, le_command_status_t, gatt_client_t,
|
||||
gatt_client_characteristic_t, gatt_client_service_t, gatt_client_characteristic_descriptor_t, service_record_item_t, bd_addr_t, btstack_packet_handler_t,
|
||||
hci_cmd_t, btstack_control_t, remote_device_db_t, link_key_t, device_name_t, hci_transport_t, hci_uart_config_t, sdp_query_event_t,
|
||||
hci_cmd_t, btstack_control_t, btstack_link_key_db_t, link_key_t, device_name_t, hci_transport_t, hci_uart_config_t, sdp_query_event_t,
|
||||
sdp_query_complete_event_t, sdp_client_query_rfcomm_service_event_t, sdp_parser_event_t, sdp_parser_event_type_t,
|
||||
sdp_parser_attribute_value_event_t, sdp_parser_complete_event_t, advertising_report_t, gc_state_t, le_service_event_t,
|
||||
le_characteristic_event_t}
|
||||
|
@ -25,9 +25,8 @@ embedded system with a Bluetooth chipset connected via UART.
|
||||
hci_dump_open(NULL, HCI_DUMP_STDOUT);
|
||||
|
||||
// init HCI
|
||||
hci_transport_t * transport = hci_transport_h4_instance();
|
||||
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
|
||||
hci_init(transport, NULL, NULL, remote_db);
|
||||
hci_transport_t * transport = hci_transport_h4_instance();
|
||||
hci_init(transport, NULL);
|
||||
|
||||
// setup example
|
||||
btstack_main(argc, argv);
|
||||
|
@ -137,14 +137,18 @@ callback for CTS interrupts.
|
||||
void hal_uart_dma_set_sleep(uint8_t sleep);
|
||||
|
||||
|
||||
## Persistent Storage API {#sec:persistentStoragePorting}
|
||||
## Persistent Storage APIs {#sec:persistentStoragePorting}
|
||||
|
||||
On embedded systems there is no generic way to persist data like link
|
||||
keys or remote device names, as every type of a device has its own
|
||||
capabilities, particularities and limitations. The persistent storage
|
||||
API provides an interface to implement concrete drivers for a particular
|
||||
system. As an example and for testing purposes, BTstack provides the
|
||||
memory-only implementation *remote_device_db_memory*. An
|
||||
APIs provides an interface to implement concrete drivers for a particular
|
||||
system.
|
||||
|
||||
### Link Key DB
|
||||
|
||||
As an example and for testing purposes, BTstack provides the
|
||||
memory-only implementation *btstack_link_key_db_memory*. An
|
||||
implementation has to conform to the interface in Listing [below](#lst:persistentDB).
|
||||
|
||||
~~~~ {#lst:persistentDB .c caption="{Persistent storage interface.}"}
|
||||
@ -158,10 +162,5 @@ implementation has to conform to the interface in Listing [below](#lst:persisten
|
||||
int (*get_link_key)(bd_addr_t bd_addr, link_key_t link_key);
|
||||
void (*put_link_key)(bd_addr_t bd_addr, link_key_t key);
|
||||
void (*delete_link_key)(bd_addr_t bd_addr);
|
||||
|
||||
// remote name
|
||||
int (*get_name)(bd_addr_t bd_addr, device_name_t *device_name);
|
||||
void(*put_name)(bd_addr_t bd_addr, device_name_t *device_name);
|
||||
void(*delete_name)(bd_addr_t bd_addr);
|
||||
} remote_device_db_t;
|
||||
} btstack_link_key_db_t;
|
||||
~~~~
|
||||
|
@ -59,7 +59,8 @@
|
||||
#include "btstack_memory.h"
|
||||
#include "hci.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
#include "btstack_link_key_db_memory,h"
|
||||
|
||||
#define INQUIRY_INTERVAL 15
|
||||
|
||||
#define FONT_HEIGHT 12 // Each character has 13 lines
|
||||
@ -378,8 +379,8 @@ int main(void){
|
||||
|
||||
// init HCI
|
||||
const hci_transport_t * transport = hci_transport_h4_instance();
|
||||
remote_device_db_t * link_key_db = (remote_device_db_t *) &remote_device_db_memory;
|
||||
hci_init(transport, &config, link_key_db);
|
||||
btstack_link_key_db_t * link_key_db = btstack_link_key_db_memory_instance();
|
||||
hci_init(transport, &config);
|
||||
hci_set_link_key_db(link_key_db);
|
||||
hci_set_chipset(btstack_chipset_cc256x_instance());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user