1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/******************************************************************************
*
* Copyright (C) 2014 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
******************************************************************************/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "device_features.h"
#include "hci_layer.h"
#include "hci_packet_factory.h"
#include "hci_packet_parser.h"
#include "osi/include/log.h"
#include "utils/include/bt_utils.h"
#include <btcommon_interface_defs.h>
static const char CONTROLLER_MODULE[] = "controller_module";
typedef struct controller_t {
bool (*get_is_ready)(void);
const RawAddress* (*get_address)(void);
const bt_version_t* (*get_bt_version)(void);
const bt_device_features_t* (*get_features_classic)(int index);
uint8_t (*get_last_features_classic_index)(void);
const bt_device_features_t* (*get_features_ble)(void);
const bt_antenna_info_t* (*get_antenna_info_ble)(void);
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);
bool (*supports_rssi_with_inquiry_results)(void);
bool (*supports_extended_inquiry_response)(void);
bool (*supports_master_slave_role_switch)(void);
bool (*supports_enhanced_setup_synchronous_connection)(void);
bool (*supports_enhanced_accept_synchronous_connection)(void);
bool (*supports_set_min_encryption_key_size)(void);
bool (*supports_ble)(void);
bool (*supports_ble_packet_extension)(void);
bool (*supports_ble_connection_parameters_request)(void);
bool (*supports_ble_privacy)(void);
bool (*supports_ble_set_privacy_mode)(void);
bool (*supports_ble_2m_phy)(void);
bool (*supports_ble_coded_phy)(void);
bool (*supports_ble_extended_advertising)(void);
bool (*supports_ble_periodic_advertising)(void);
bool (*supports_ble_periodic_sync_transfer)(void);
bool (*supports_ble_iso_broadcaster)(void);
bool (*supports_ble_periodic_advertising_adi)(void);
bool (*supports_ble_aoa)(void);
// Get the cached acl data sizes for the controller.
uint16_t (*get_acl_data_size_classic)(void);
uint16_t (*get_acl_data_size_ble)(void);
// Get the cached acl packet sizes for the controller.
// This is a convenience function for the respective
// acl data size + size of the acl header.
uint16_t (*get_acl_packet_size_classic)(void);
uint16_t (*get_acl_packet_size_ble)(void);
uint16_t (*get_ble_default_data_packet_length)(void);
uint16_t (*get_ble_maxium_advertising_data_length)(void);
uint8_t (*get_ble_number_of_supported_advertising_sets)(void);
// 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_white_list_size)(void);
uint8_t (*get_ble_resolving_list_max_size)(void);
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
uint8_t* (*get_local_supported_codecs)(uint8_t* number_of_codecs);
bool (*supports_ble_offload_features)(void);
uint8_t (*get_le_all_initiating_phys)(void);
uint8_t* (*get_scrambling_supported_freqs)(uint8_t* number_of_freqs);
const bt_device_soc_add_on_features_t* (*get_soc_add_on_features)(uint8_t *add_on_features_len);
uint16_t (*get_product_id)(void);
uint16_t (*get_response_version)(void);
const bt_device_host_add_on_features_t*
(*get_host_add_on_features)(uint8_t *add_on_features_len);
bool (*supports_read_simple_pairing_options)(void);
bool (*performs_remote_public_key_validation)(void);
bt_soc_type_t (*get_soc_type)();
const char* (*get_a2dp_offload_cap)();
bool (*supports_spilt_a2dp)();
bool (*supports_aac_frame_ctl)();
bool (*supports_wipower)();
bool (*is_multicast_enabled)();
bool (*supports_twsp_remote_state)();
uint32_t* (*get_vs_supported_codecs)(uint8_t* number_of_codecs);
uint16_t (*get_ble_iso_data_packet_len)(void);
uint8_t (*get_ble_iso_num_data_packets)(void);
uint8_t (*get_std_supported_codec_transport)(uint8_t std_codec_id);
uint8_t (*get_vs_supported_codec_transport)(uint32_t vs_codec_id);
bool (*is_host_iso_channel_supported)(void);
bool (*is_cis_master_role_supported)(void);
bool (*is_cis_slave_role_supported)(void);
bool (*is_pow_ctr_req_supported)(void);
bool (*is_pathloss_monitoring_supported)(void);
bool (*get_max_power_values)(uint8_t *);
bool (*is_adv_audio_supported)(void);
bool (*is_qbce_QLE_HCI_supported)(void);
bool (*is_qbce_QCM_HCI_supported)(void);
const bt_device_qll_local_supported_features_t* (*get_qll_features)(void);
bool (*is_conn_subrating_supported)(void);
bool (*is_conn_subrating_host_supported)(void);
} controller_t;
const controller_t* controller_get_interface();
const controller_t* controller_get_test_interface(
const hci_t* hci_interface,
const hci_packet_factory_t* packet_factory_interface,
const hci_packet_parser_t* packet_parser_interface);
bool is_soc_lpa_enh_pwr_enabled();
|