Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Jakub Pawlowski | 5b790fe | 2017-09-18 09:00:20 -0700 | [diff] [blame] | 3 | * Copyright 2014 Google, Inc. |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | ******************************************************************************/ |
| 18 | |
| 19 | #pragma once |
| 20 | |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 21 | #include <stdbool.h> |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 22 | #include <stdint.h> |
| 23 | |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 24 | #include "device_features.h" |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 25 | #include "hci_layer.h" |
| 26 | #include "hci_packet_factory.h" |
| 27 | #include "hci_packet_parser.h" |
| 28 | |
Sharvil Nanavati | 06ef205 | 2014-11-06 18:34:06 -0800 | [diff] [blame] | 29 | static const char CONTROLLER_MODULE[] = "controller_module"; |
| 30 | |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 31 | typedef struct controller_t { |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 32 | bool (*get_is_ready)(void); |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 33 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 34 | const RawAddress* (*get_address)(void); |
Myles Watson | 4451b3b | 2016-11-09 10:20:44 -0800 | [diff] [blame] | 35 | const bt_version_t* (*get_bt_version)(void); |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 36 | |
Myles Watson | 4451b3b | 2016-11-09 10:20:44 -0800 | [diff] [blame] | 37 | const bt_device_features_t* (*get_features_classic)(int index); |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 38 | uint8_t (*get_last_features_classic_index)(void); |
| 39 | |
Myles Watson | 4451b3b | 2016-11-09 10:20:44 -0800 | [diff] [blame] | 40 | const bt_device_features_t* (*get_features_ble)(void); |
| 41 | const uint8_t* (*get_ble_supported_states)(void); |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 42 | |
| 43 | bool (*supports_simple_pairing)(void); |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 44 | bool (*supports_secure_connections)(void); |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 45 | bool (*supports_simultaneous_le_bredr)(void); |
| 46 | bool (*supports_reading_remote_extended_features)(void); |
| 47 | bool (*supports_interlaced_inquiry_scan)(void); |
| 48 | bool (*supports_rssi_with_inquiry_results)(void); |
| 49 | bool (*supports_extended_inquiry_response)(void); |
| 50 | bool (*supports_master_slave_role_switch)(void); |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 51 | bool (*supports_enhanced_setup_synchronous_connection)(void); |
| 52 | bool (*supports_enhanced_accept_synchronous_connection)(void); |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 53 | |
| 54 | bool (*supports_ble)(void); |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 55 | bool (*supports_ble_packet_extension)(void); |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 56 | bool (*supports_ble_connection_parameters_request)(void); |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 57 | bool (*supports_ble_privacy)(void); |
Jakub Pawlowski | ba78601 | 2017-06-26 11:26:46 -0700 | [diff] [blame] | 58 | bool (*supports_ble_set_privacy_mode)(void); |
Jakub Pawlowski | 4b1feb6 | 2017-03-09 18:11:43 -0800 | [diff] [blame] | 59 | bool (*supports_ble_2m_phy)(void); |
| 60 | bool (*supports_ble_coded_phy)(void); |
Jakub Pawlowski | 1f4cc6d | 2016-11-28 11:16:04 -0800 | [diff] [blame] | 61 | bool (*supports_ble_extended_advertising)(void); |
| 62 | bool (*supports_ble_periodic_advertising)(void); |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 63 | |
| 64 | // Get the cached acl data sizes for the controller. |
| 65 | uint16_t (*get_acl_data_size_classic)(void); |
| 66 | uint16_t (*get_acl_data_size_ble)(void); |
| 67 | |
| 68 | // Get the cached acl packet sizes for the controller. |
| 69 | // This is a convenience function for the respective |
| 70 | // acl data size + size of the acl header. |
| 71 | uint16_t (*get_acl_packet_size_classic)(void); |
| 72 | uint16_t (*get_acl_packet_size_ble)(void); |
| 73 | |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 74 | uint16_t (*get_ble_default_data_packet_length)(void); |
Jakub Pawlowski | 4f0c5b5 | 2018-02-02 22:05:11 -0800 | [diff] [blame] | 75 | uint16_t (*get_ble_maximum_tx_data_length)(void); |
Jakub Pawlowski | 1f4cc6d | 2016-11-28 11:16:04 -0800 | [diff] [blame] | 76 | uint16_t (*get_ble_maxium_advertising_data_length)(void); |
| 77 | uint8_t (*get_ble_number_of_supported_advertising_sets)(void); |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 78 | |
Zach Johnson | 30e5806 | 2014-09-26 21:14:34 -0700 | [diff] [blame] | 79 | // Get the number of acl packets the controller can buffer. |
| 80 | uint16_t (*get_acl_buffer_count_classic)(void); |
| 81 | uint8_t (*get_acl_buffer_count_ble)(void); |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 82 | |
Priti Aghera | b8b3e80 | 2015-04-17 18:11:24 -0700 | [diff] [blame] | 83 | uint8_t (*get_ble_white_list_size)(void); |
| 84 | |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 85 | uint8_t (*get_ble_resolving_list_max_size)(void); |
| 86 | void (*set_ble_resolving_list_max_size)(int resolving_list_max_size); |
Myles Watson | 4451b3b | 2016-11-09 10:20:44 -0800 | [diff] [blame] | 87 | uint8_t* (*get_local_supported_codecs)(uint8_t* number_of_codecs); |
Srinu Jella | 6e7a335 | 2015-08-24 21:00:28 +0530 | [diff] [blame] | 88 | bool (*supports_ble_offload_features)(void); |
Jakub Pawlowski | 96fb273 | 2017-03-24 17:52:02 -0700 | [diff] [blame] | 89 | uint8_t (*get_le_all_initiating_phys)(void); |
| 90 | |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 91 | } controller_t; |
| 92 | |
Myles Watson | 4451b3b | 2016-11-09 10:20:44 -0800 | [diff] [blame] | 93 | const controller_t* controller_get_interface(); |
Zach Johnson | bf8193b | 2014-09-08 09:56:35 -0700 | [diff] [blame] | 94 | |
Myles Watson | 4451b3b | 2016-11-09 10:20:44 -0800 | [diff] [blame] | 95 | const controller_t* controller_get_test_interface( |
| 96 | const hci_t* hci_interface, |
| 97 | const hci_packet_factory_t* packet_factory_interface, |
| 98 | const hci_packet_parser_t* packet_parser_interface); |