Merge branch 'develop' of https://github.com/bluekitchen/btstack into develop

This commit is contained in:
Milanka Ringwald 2016-04-01 17:06:55 +02:00
commit 43716165be
4 changed files with 16 additions and 17 deletions

View File

@ -61,7 +61,7 @@ identifierstyle=\color{black},
stringstyle=\color{blue}, 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, 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, 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_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, 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} le_characteristic_event_t}

View File

@ -25,9 +25,8 @@ embedded system with a Bluetooth chipset connected via UART.
hci_dump_open(NULL, HCI_DUMP_STDOUT); hci_dump_open(NULL, HCI_DUMP_STDOUT);
// init HCI // init HCI
hci_transport_t * transport = hci_transport_h4_instance(); 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);
hci_init(transport, NULL, NULL, remote_db);
// setup example // setup example
btstack_main(argc, argv); btstack_main(argc, argv);

View File

@ -137,14 +137,18 @@ callback for CTS interrupts.
void hal_uart_dma_set_sleep(uint8_t sleep); 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 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 keys or remote device names, as every type of a device has its own
capabilities, particularities and limitations. The persistent storage capabilities, particularities and limitations. The persistent storage
API provides an interface to implement concrete drivers for a particular APIs provides an interface to implement concrete drivers for a particular
system. As an example and for testing purposes, BTstack provides the system.
memory-only implementation *remote_device_db_memory*. An
### 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). implementation has to conform to the interface in Listing [below](#lst:persistentDB).
~~~~ {#lst:persistentDB .c caption="{Persistent storage interface.}"} ~~~~ {#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); 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 (*put_link_key)(bd_addr_t bd_addr, link_key_t key);
void (*delete_link_key)(bd_addr_t bd_addr); void (*delete_link_key)(bd_addr_t bd_addr);
} btstack_link_key_db_t;
// 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;
~~~~ ~~~~

View File

@ -59,7 +59,8 @@
#include "btstack_memory.h" #include "btstack_memory.h"
#include "hci.h" #include "hci.h"
#include "l2cap.h" #include "l2cap.h"
#include "btstack_link_key_db_memory,h"
#define INQUIRY_INTERVAL 15 #define INQUIRY_INTERVAL 15
#define FONT_HEIGHT 12 // Each character has 13 lines #define FONT_HEIGHT 12 // Each character has 13 lines
@ -378,8 +379,8 @@ int main(void){
// init HCI // init HCI
const hci_transport_t * transport = hci_transport_h4_instance(); const hci_transport_t * transport = hci_transport_h4_instance();
remote_device_db_t * link_key_db = (remote_device_db_t *) &remote_device_db_memory; btstack_link_key_db_t * link_key_db = btstack_link_key_db_memory_instance();
hci_init(transport, &config, link_key_db); hci_init(transport, &config);
hci_set_link_key_db(link_key_db); hci_set_link_key_db(link_key_db);
hci_set_chipset(btstack_chipset_cc256x_instance()); hci_set_chipset(btstack_chipset_cc256x_instance());