summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorSatya Calloji <satyac@broadcom.com>2015-03-06 10:38:22 -0800
committerAndre Eisenbach <eisenbach@google.com>2015-04-13 00:09:06 -0700
commit444a8da807abaf5f9e813ce70c56a79160495fb3 (patch)
tree20a35a257203d1a87f34d887ffba13672af4288a /device
parent8372aa5fa535ee4f09c09981b6125b54ace31fe2 (diff)
downloadandroid_system_bt-444a8da807abaf5f9e813ce70c56a79160495fb3.tar.gz
android_system_bt-444a8da807abaf5f9e813ce70c56a79160495fb3.tar.bz2
android_system_bt-444a8da807abaf5f9e813ce70c56a79160495fb3.zip
LE Privacy 1.2 and LE secure connections
Bug: 19816438 Original author: Chaojing Sun <cjsun@broadcom.com> Change-Id: I5951f4d4e038f8348a62aa6d19b2111bae0b3ecc
Diffstat (limited to 'device')
-rw-r--r--device/include/controller.h5
-rw-r--r--device/src/controller.c45
2 files changed, 49 insertions, 1 deletions
diff --git a/device/include/controller.h b/device/include/controller.h
index 2ef2332f6..af93e4742 100644
--- a/device/include/controller.h
+++ b/device/include/controller.h
@@ -42,6 +42,7 @@ typedef struct controller_t {
const uint8_t *(*get_ble_supported_states)(void);
bool (*supports_simple_pairing)(void);
+ bool (*supports_secure_connections)(void);
bool (*supports_simultaneous_le_bredr)(void);
bool (*supports_reading_remote_extended_features)(void);
bool (*supports_interlaced_inquiry_scan)(void);
@@ -51,6 +52,7 @@ typedef struct controller_t {
bool (*supports_ble)(void);
bool (*supports_ble_connection_parameters_request)(void);
+ bool (*supports_ble_privacy)(void);
// Get the cached acl data sizes for the controller.
uint16_t (*get_acl_data_size_classic)(void);
@@ -65,6 +67,9 @@ typedef struct controller_t {
// Get the number of acl packets the controller can buffer.
uint16_t (*get_acl_buffer_count_classic)(void);
uint8_t (*get_acl_buffer_count_ble)(void);
+
+ uint8_t (*get_ble_resolving_list_max_size)(void);
+ void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
} controller_t;
const controller_t *controller_get_interface();
diff --git a/device/src/controller.c b/device/src/controller.c
index c1eadc08e..6537cf1f9 100644
--- a/device/src/controller.c
+++ b/device/src/controller.c
@@ -66,12 +66,14 @@ static uint16_t acl_buffer_count_classic;
static uint8_t acl_buffer_count_ble;
static uint8_t ble_white_list_size;
+static uint8_t ble_resolving_list_max_size;
static uint8_t ble_supported_states[BLE_SUPPORTED_STATES_SIZE];
static bt_device_features_t features_ble;
static bool readable;
static bool ble_supported;
static bool simple_pairing_supported;
+static bool secure_connections_supported;
#define AWAIT_COMMAND(command) future_await(hci->transmit_command_futured(command))
@@ -143,6 +145,12 @@ static future_t *start_up(void) {
packet_parser->parse_generic_command_complete(response);
}
+ secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(features_classic[2].as_array);
+ if (secure_connections_supported) {
+ response = AWAIT_COMMAND(packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED));
+ packet_parser->parse_generic_command_complete(response);
+ }
+
#if (BLE_INCLUDED == TRUE)
if (HCI_LE_SPT_SUPPORTED(features_classic[0].as_array)) {
uint8_t simultaneous_le_host = HCI_SIMUL_LE_BREDR_SUPPORTED(features_classic[0].as_array) ? BTM_BLE_SIMULTANEOUS_HOST : 0;
@@ -204,6 +212,13 @@ static future_t *start_up(void) {
&features_ble
);
+ if (HCI_LE_ENHANCED_PRIVACY_SUPPORTED(features_ble.as_array)) {
+ response = AWAIT_COMMAND(packet_factory->make_ble_read_resolving_list_size());
+ packet_parser->parse_ble_read_resolving_list_size_response(
+ response,
+ &ble_resolving_list_max_size);
+ }
+
// Set the ble event mask next
response = AWAIT_COMMAND(packet_factory->make_ble_set_event_mask(&BLE_EVENT_MASK));
packet_parser->parse_generic_command_complete(response);
@@ -281,6 +296,11 @@ static bool supports_simple_pairing(void) {
return simple_pairing_supported;
}
+static bool supports_secure_connections(void) {
+ assert(readable);
+ return secure_connections_supported;
+}
+
static bool supports_simultaneous_le_bredr(void) {
assert(readable);
return HCI_SIMUL_LE_BREDR_SUPPORTED(features_classic[0].as_array);
@@ -316,6 +336,12 @@ static bool supports_ble(void) {
return ble_supported;
}
+static bool supports_ble_privacy(void) {
+ assert(readable);
+ assert(ble_supported);
+ return HCI_LE_ENHANCED_PRIVACY_SUPPORTED(features_ble.as_array);
+}
+
static bool supports_ble_connection_parameters_request(void) {
assert(readable);
assert(ble_supported);
@@ -354,6 +380,18 @@ static uint8_t get_acl_buffer_count_ble(void) {
return acl_buffer_count_ble;
}
+static uint8_t get_ble_resolving_list_max_size(void) {
+ assert(readable);
+ assert(ble_supported);
+ return ble_resolving_list_max_size;
+}
+
+static void set_ble_resolving_list_max_size(int resolving_list_max_size) {
+ assert(readable);
+ assert(ble_supported);
+ ble_resolving_list_max_size = resolving_list_max_size;
+}
+
static const controller_t interface = {
get_is_ready,
@@ -367,6 +405,7 @@ static const controller_t interface = {
get_ble_supported_states,
supports_simple_pairing,
+ supports_secure_connections,
supports_simultaneous_le_bredr,
supports_reading_remote_extended_features,
supports_interlaced_inquiry_scan,
@@ -376,6 +415,7 @@ static const controller_t interface = {
supports_ble,
supports_ble_connection_parameters_request,
+ supports_ble_privacy,
get_acl_data_size_classic,
get_acl_data_size_ble,
@@ -384,7 +424,10 @@ static const controller_t interface = {
get_acl_packet_size_ble,
get_acl_buffer_count_classic,
- get_acl_buffer_count_ble
+ get_acl_buffer_count_ble,
+
+ get_ble_resolving_list_max_size,
+ set_ble_resolving_list_max_size
};
const controller_t *controller_get_interface() {