1 /****************************************************************************** 2 * 3 * Copyright (C) 2014 Google, Inc. 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 #ifndef _CONTROLLER_H_ 20 #define _CONTROLLER_H_ 21 22 #include <stdbool.h> 23 #include <stdint.h> 24 25 #include "common/bt_target.h" 26 #include "device/bdaddr.h" 27 #include "device/device_features.h" 28 #include "hci/hci_layer.h" 29 #include "hci/hci_packet_factory.h" 30 #include "hci/hci_packet_parser.h" 31 32 typedef struct controller_t { 33 void (*start_up)(void); 34 void (*shut_down)(void); 35 bool (*get_is_ready)(void); 36 37 const bt_bdaddr_t *(*get_address)(void); 38 const bt_version_t *(*get_bt_version)(void); 39 40 const bt_device_features_t *(*get_features_classic)(int index); 41 42 uint8_t (*get_last_features_classic_index)(void); 43 44 const bt_device_features_t *(*get_features_ble)(void); 45 const uint8_t *(*get_ble_supported_states)(void); 46 47 bool (*supports_simple_pairing)(void); 48 bool (*supports_secure_connections)(void); 49 bool (*supports_simultaneous_le_bredr)(void); 50 bool (*supports_reading_remote_extended_features)(void); 51 bool (*supports_interlaced_inquiry_scan)(void); 52 bool (*supports_rssi_with_inquiry_results)(void); 53 bool (*supports_extended_inquiry_response)(void); 54 bool (*supports_master_slave_role_switch)(void); 55 56 bool (*supports_ble)(void); 57 bool (*supports_ble_packet_extension)(void); 58 bool (*supports_ble_connection_parameters_request)(void); 59 bool (*supports_ble_privacy)(void); 60 61 // Get the cached acl data sizes for the controller. 62 uint16_t (*get_acl_data_size_classic)(void); 63 uint16_t (*get_acl_data_size_ble)(void); 64 65 // Get the cached acl packet sizes for the controller. 66 // This is a convenience function for the respective 67 // acl data size + size of the acl header. 68 uint16_t (*get_acl_packet_size_classic)(void); 69 uint16_t (*get_acl_packet_size_ble)(void); 70 71 uint16_t (*get_ble_default_data_packet_length)(void); 72 uint16_t (*get_ble_default_data_packet_txtime)(void); 73 74 // Get the number of acl packets the controller can buffer. 75 uint16_t (*get_acl_buffer_count_classic)(void); 76 uint8_t (*get_acl_buffer_count_ble)(void); 77 78 uint8_t (*get_ble_white_list_size)(void); 79 80 uint8_t (*get_ble_resolving_list_max_size)(void); 81 void (*set_ble_resolving_list_max_size)(int resolving_list_max_size); 82 83 #if (BLE_50_FEATURE_SUPPORT == 1) 84 uint16_t (*ble_get_ext_adv_data_max_len)(void); 85 #endif // BLE_50_FEATURE_SUPPORT 86 87 #if (BTM_SCO_HCI_INCLUDED == 1) 88 // Get the number of sco packets the controller can buffer 89 uint8_t (*get_sco_data_size)(void); 90 uint8_t (*get_sco_buffer_count)(void); 91 #endif /* #if (BTM_SCO_HCI_INCLUDED == 1) */ 92 } controller_t; 93 94 const controller_t *controller_get_interface(void); 95 96 #endif /*_CONTROLLER_H_*/ 97