• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "hci/address.h"
20 #include "hci/hci_packets.h"
21 #include "include/inquiry.h"
22 #include "include/phy.h"
23 #include "model/controller/acl_connection_handler.h"
24 #include "model/controller/le_advertiser.h"
25 #include "model/devices/device_properties.h"
26 #include "model/setup/async_manager.h"
27 #include "packets/link_layer_packets.h"
28 #include "security_manager.h"
29 
30 namespace test_vendor_lib {
31 
32 using ::bluetooth::hci::Address;
33 using ::bluetooth::hci::ErrorCode;
34 using ::bluetooth::hci::OpCode;
35 
36 class LinkLayerController {
37  public:
38   static constexpr size_t kIrk_size = 16;
39 
LinkLayerController(const DeviceProperties & properties)40   LinkLayerController(const DeviceProperties& properties) : properties_(properties) {}
41   ErrorCode SendCommandToRemoteByAddress(
42       OpCode opcode, bluetooth::packet::PacketView<true> args,
43       const Address& remote);
44   ErrorCode SendLeCommandToRemoteByAddress(
45       OpCode opcode, bluetooth::packet::PacketView<true> args,
46       const Address& remote, const Address& local);
47   ErrorCode SendCommandToRemoteByHandle(
48       OpCode opcode, bluetooth::packet::PacketView<true> args, uint16_t handle);
49   ErrorCode SendScoToRemote(bluetooth::hci::ScoView sco_packet);
50   ErrorCode SendAclToRemote(bluetooth::hci::AclView acl_packet);
51 
52   void StartSimplePairing(const Address& address);
53   void AuthenticateRemoteStage1(const Address& address, PairingType pairing_type);
54   void AuthenticateRemoteStage2(const Address& address);
55   void SaveKeyAndAuthenticate(uint8_t key_type, const Address& peer);
56   ErrorCode LinkKeyRequestReply(const Address& address,
57                                 const std::array<uint8_t, 16>& key);
58   ErrorCode LinkKeyRequestNegativeReply(const Address& address);
59   ErrorCode IoCapabilityRequestReply(const Address& peer, uint8_t io_capability,
60                                      uint8_t oob_data_present_flag,
61                                      uint8_t authentication_requirements);
62   ErrorCode IoCapabilityRequestNegativeReply(const Address& peer,
63                                              ErrorCode reason);
64   ErrorCode PinCodeRequestReply(const Address& peer, std::vector<uint8_t> pin);
65   ErrorCode PinCodeRequestNegativeReply(const Address& peer);
66   ErrorCode UserConfirmationRequestReply(const Address& peer);
67   ErrorCode UserConfirmationRequestNegativeReply(const Address& peer);
68   ErrorCode UserPasskeyRequestReply(const Address& peer,
69                                     uint32_t numeric_value);
70   ErrorCode UserPasskeyRequestNegativeReply(const Address& peer);
71   ErrorCode RemoteOobDataRequestReply(const Address& peer,
72                                       const std::array<uint8_t, 16>& c,
73                                       const std::array<uint8_t, 16>& r);
74   ErrorCode RemoteOobDataRequestNegativeReply(const Address& peer);
75   ErrorCode RemoteOobExtendedDataRequestReply(
76       const Address& peer, const std::array<uint8_t, 16>& c_192,
77       const std::array<uint8_t, 16>& r_192,
78       const std::array<uint8_t, 16>& c_256,
79       const std::array<uint8_t, 16>& r_256);
80   ErrorCode SendKeypressNotification(
81       const Address& peer,
82       bluetooth::hci::KeypressNotificationType notification_type);
83   void HandleSetConnectionEncryption(const Address& address, uint16_t handle, uint8_t encryption_enable);
84   ErrorCode SetConnectionEncryption(uint16_t handle, uint8_t encryption_enable);
85   void HandleAuthenticationRequest(const Address& address, uint16_t handle);
86   ErrorCode AuthenticationRequested(uint16_t handle);
87 
88   ErrorCode AcceptConnectionRequest(const Address& addr, bool try_role_switch);
89   void MakePeripheralConnection(const Address& addr, bool try_role_switch);
90   ErrorCode RejectConnectionRequest(const Address& addr, uint8_t reason);
91   void RejectPeripheralConnection(const Address& addr, uint8_t reason);
92   ErrorCode CreateConnection(const Address& addr, uint16_t packet_type,
93                              uint8_t page_scan_mode, uint16_t clock_offset,
94                              uint8_t allow_role_switch);
95   ErrorCode CreateConnectionCancel(const Address& addr);
96   ErrorCode Disconnect(uint16_t handle, uint8_t reason);
97 
98  private:
99   void DisconnectCleanup(uint16_t handle, uint8_t reason);
100 
101  public:
102   void IncomingPacket(model::packets::LinkLayerPacketView incoming);
103 
104   void TimerTick();
105 
106   AsyncTaskId ScheduleTask(std::chrono::milliseconds delay_ms, const TaskCallback& task);
107 
108   void CancelScheduledTask(AsyncTaskId task);
109 
110   // Set the callbacks for sending packets to the HCI.
111   void RegisterEventChannel(
112       const std::function<void(std::shared_ptr<bluetooth::hci::EventBuilder>)>&
113           send_event);
114 
115   void RegisterAclChannel(
116       const std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)>&
117           send_acl);
118 
119   void RegisterScoChannel(
120       const std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)>&
121           send_sco);
122 
123   void RegisterIsoChannel(
124       const std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)>&
125           send_iso);
126 
127   void RegisterRemoteChannel(
128       const std::function<void(
129           std::shared_ptr<model::packets::LinkLayerPacketBuilder>, Phy::Type)>&
130           send_to_remote);
131 
132   // Set the callbacks for scheduling tasks.
133   void RegisterTaskScheduler(
134       std::function<AsyncTaskId(std::chrono::milliseconds, const TaskCallback&)> event_scheduler);
135 
136   void RegisterPeriodicTaskScheduler(
137       std::function<AsyncTaskId(std::chrono::milliseconds, std::chrono::milliseconds, const TaskCallback&)>
138           periodic_event_scheduler);
139 
140   void RegisterTaskCancel(std::function<void(AsyncTaskId)> cancel);
141   void Reset();
142 
143   void LeAdvertising();
144 
145   ErrorCode SetLeExtendedAddress(uint8_t handle, Address address);
146 
147   ErrorCode SetLeExtendedAdvertisingData(uint8_t handle,
148                                          const std::vector<uint8_t>& data);
149 
150   ErrorCode SetLeExtendedAdvertisingParameters(
151       uint8_t set, uint16_t interval_min, uint16_t interval_max,
152       bluetooth::hci::LegacyAdvertisingProperties type,
153       bluetooth::hci::OwnAddressType own_address_type,
154       bluetooth::hci::PeerAddressType peer_address_type, Address peer,
155       bluetooth::hci::AdvertisingFilterPolicy filter_policy);
156   ErrorCode LeRemoveAdvertisingSet(uint8_t set);
157   ErrorCode LeClearAdvertisingSets();
158   void LeConnectionUpdateComplete(
159       bluetooth::hci::LeConnectionUpdateView connection_update_view);
160   ErrorCode LeConnectionUpdate(
161       bluetooth::hci::LeConnectionUpdateView connection_update_view);
162 
163   void HandleLeConnection(AddressWithType addr, AddressWithType own_addr,
164                           uint8_t role, uint16_t connection_interval,
165                           uint16_t connection_latency,
166                           uint16_t supervision_timeout);
167 
168   bool ConnectListBusy();
169   ErrorCode LeConnectListClear();
170   ErrorCode LeConnectListAddDevice(Address addr, uint8_t addr_type);
171   ErrorCode LeConnectListRemoveDevice(Address addr, uint8_t addr_type);
172   bool LeConnectListContainsDevice(Address addr, uint8_t addr_type);
173   bool LeConnectListFull();
174   bool ResolvingListBusy();
175   ErrorCode LeResolvingListClear();
176   ErrorCode LeResolvingListAddDevice(Address addr, uint8_t addr_type,
177                                      std::array<uint8_t, kIrk_size> peerIrk,
178                                      std::array<uint8_t, kIrk_size> localIrk);
179   ErrorCode LeResolvingListRemoveDevice(Address addr, uint8_t addr_type);
180   bool LeResolvingListContainsDevice(Address addr, uint8_t addr_type);
181   bool LeResolvingListFull();
182   void LeSetPrivacyMode(uint8_t address_type, Address addr, uint8_t mode);
183 
184   void LeReadIsoTxSync(uint16_t handle);
185   void LeSetCigParameters(
186       uint8_t cig_id, uint32_t sdu_interval_m_to_s,
187       uint32_t sdu_interval_s_to_m,
188       bluetooth::hci::ClockAccuracy clock_accuracy,
189       bluetooth::hci::Packing packing, bluetooth::hci::Enable framing,
190       uint16_t max_transport_latency_m_to_s,
191       uint16_t max_transport_latency_s_to_m,
192       std::vector<bluetooth::hci::CisParametersConfig> cis_config);
193   bluetooth::hci::ErrorCode LeCreateCis(
194       std::vector<bluetooth::hci::CreateCisConfig> cis_config);
195   bluetooth::hci::ErrorCode LeRemoveCig(uint8_t cig_id);
196   bluetooth::hci::ErrorCode LeAcceptCisRequest(uint16_t handle);
197   bluetooth::hci::ErrorCode LeRejectCisRequest(
198       uint16_t handle, bluetooth::hci::ErrorCode reason);
199   bluetooth::hci::ErrorCode LeCreateBig(
200       uint8_t big_handle, uint8_t advertising_handle, uint8_t num_bis,
201       uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_transport_latency,
202       uint8_t rtn, bluetooth::hci::SecondaryPhyType phy,
203       bluetooth::hci::Packing packing, bluetooth::hci::Enable framing,
204       bluetooth::hci::Enable encryption, std::vector<uint16_t> broadcast_code);
205   bluetooth::hci::ErrorCode LeTerminateBig(uint8_t big_handle,
206                                            bluetooth::hci::ErrorCode reason);
207   bluetooth::hci::ErrorCode LeBigCreateSync(
208       uint8_t big_handle, uint16_t sync_handle,
209       bluetooth::hci::Enable encryption, std::vector<uint16_t> broadcast_code,
210       uint8_t mse, uint16_t big_syunc_timeout, std::vector<uint8_t> bis);
211   void LeBigTerminateSync(uint8_t big_handle);
212   bluetooth::hci::ErrorCode LeRequestPeerSca(uint16_t request_handle);
213   void LeSetupIsoDataPath(uint16_t connection_handle,
214                           bluetooth::hci::DataPathDirection data_path_direction,
215                           uint8_t data_path_id, uint64_t codec_id,
216                           uint32_t controller_Delay,
217                           std::vector<uint8_t> codec_configuration);
218   void LeRemoveIsoDataPath(
219       uint16_t connection_handle,
220       bluetooth::hci::DataPathDirection data_path_direction);
221 
222   void HandleLeEnableEncryption(uint16_t handle, std::array<uint8_t, 8> rand,
223                                 uint16_t ediv, std::array<uint8_t, 16> ltk);
224 
225   ErrorCode LeEnableEncryption(uint16_t handle, std::array<uint8_t, 8> rand,
226                                uint16_t ediv, std::array<uint8_t, 16> ltk);
227 
228   ErrorCode LeLongTermKeyRequestReply(uint16_t handle,
229                                       std::array<uint8_t, 16> ltk);
230 
231   ErrorCode LeLongTermKeyRequestNegativeReply(uint16_t handle);
232 
233   ErrorCode SetLeAdvertisingEnable(uint8_t le_advertising_enable);
234 
235   void LeDisableAdvertisingSets();
236 
237   uint8_t LeReadNumberOfSupportedAdvertisingSets();
238 
239   ErrorCode SetLeExtendedAdvertisingEnable(
240       bluetooth::hci::Enable enable,
241       const std::vector<bluetooth::hci::EnabledSet>& enabled_sets);
242 
GetLeScanEnable()243   bluetooth::hci::OpCode GetLeScanEnable() { return le_scan_enable_; }
244 
SetLeScanEnable(bluetooth::hci::OpCode enabling_opcode)245   void SetLeScanEnable(bluetooth::hci::OpCode enabling_opcode) {
246     le_scan_enable_ = enabling_opcode;
247   }
SetLeScanType(uint8_t le_scan_type)248   void SetLeScanType(uint8_t le_scan_type) {
249     le_scan_type_ = le_scan_type;
250   }
SetLeScanInterval(uint16_t le_scan_interval)251   void SetLeScanInterval(uint16_t le_scan_interval) {
252     le_scan_interval_ = le_scan_interval;
253   }
SetLeScanWindow(uint16_t le_scan_window)254   void SetLeScanWindow(uint16_t le_scan_window) {
255     le_scan_window_ = le_scan_window;
256   }
SetLeScanFilterPolicy(uint8_t le_scan_filter_policy)257   void SetLeScanFilterPolicy(uint8_t le_scan_filter_policy) {
258     le_scan_filter_policy_ = le_scan_filter_policy;
259   }
SetLeFilterDuplicates(uint8_t le_scan_filter_duplicates)260   void SetLeFilterDuplicates(uint8_t le_scan_filter_duplicates) {
261     le_scan_filter_duplicates_ = le_scan_filter_duplicates;
262   }
SetLeAddressType(bluetooth::hci::OwnAddressType le_address_type)263   void SetLeAddressType(bluetooth::hci::OwnAddressType le_address_type) {
264     le_address_type_ = le_address_type;
265   }
SetLeConnect(bool le_connect)266   ErrorCode SetLeConnect(bool le_connect) {
267     if (le_connect_ == le_connect) {
268       return ErrorCode::COMMAND_DISALLOWED;
269     }
270     le_connect_ = le_connect;
271     return ErrorCode::SUCCESS;
272   }
SetLeConnectionIntervalMin(uint16_t min)273   void SetLeConnectionIntervalMin(uint16_t min) {
274     le_connection_interval_min_ = min;
275   }
SetLeConnectionIntervalMax(uint16_t max)276   void SetLeConnectionIntervalMax(uint16_t max) {
277     le_connection_interval_max_ = max;
278   }
SetLeConnectionLatency(uint16_t latency)279   void SetLeConnectionLatency(uint16_t latency) {
280     le_connection_latency_ = latency;
281   }
SetLeSupervisionTimeout(uint16_t timeout)282   void SetLeSupervisionTimeout(uint16_t timeout) {
283     le_connection_supervision_timeout_ = timeout;
284   }
SetLeMinimumCeLength(uint16_t min)285   void SetLeMinimumCeLength(uint16_t min) {
286     le_connection_minimum_ce_length_ = min;
287   }
SetLeMaximumCeLength(uint16_t max)288   void SetLeMaximumCeLength(uint16_t max) {
289     le_connection_maximum_ce_length_ = max;
290   }
SetLeInitiatorFilterPolicy(uint8_t le_initiator_filter_policy)291   void SetLeInitiatorFilterPolicy(uint8_t le_initiator_filter_policy) {
292     le_initiator_filter_policy_ = le_initiator_filter_policy;
293   }
SetLePeerAddressType(uint8_t peer_address_type)294   void SetLePeerAddressType(uint8_t peer_address_type) {
295     le_peer_address_type_ = peer_address_type;
296   }
SetLePeerAddress(const Address & peer_address)297   void SetLePeerAddress(const Address& peer_address) {
298     le_peer_address_ = peer_address;
299   }
300 
301   // Classic
302   void StartInquiry(std::chrono::milliseconds timeout);
303   void InquiryCancel();
304   void InquiryTimeout();
305   void SetInquiryMode(uint8_t mode);
306   void SetInquiryLAP(uint64_t lap);
307   void SetInquiryMaxResponses(uint8_t max);
308   void Inquiry();
309 
310   void SetInquiryScanEnable(bool enable);
311   void SetPageScanEnable(bool enable);
312 
313   ErrorCode ChangeConnectionPacketType(uint16_t handle, uint16_t types);
314   ErrorCode ChangeConnectionLinkKey(uint16_t handle);
315   ErrorCode CentralLinkKey(uint8_t key_flag);
316   ErrorCode HoldMode(uint16_t handle, uint16_t hold_mode_max_interval,
317                      uint16_t hold_mode_min_interval);
318   ErrorCode SniffMode(uint16_t handle, uint16_t sniff_max_interval,
319                       uint16_t sniff_min_interval, uint16_t sniff_attempt,
320                       uint16_t sniff_timeout);
321   ErrorCode ExitSniffMode(uint16_t handle);
322   ErrorCode QosSetup(uint16_t handle, uint8_t service_type, uint32_t token_rate,
323                      uint32_t peak_bandwidth, uint32_t latency,
324                      uint32_t delay_variation);
325   ErrorCode SwitchRole(Address bd_addr, uint8_t role);
326   ErrorCode WriteLinkPolicySettings(uint16_t handle, uint16_t settings);
327   ErrorCode FlowSpecification(uint16_t handle, uint8_t flow_direction,
328                               uint8_t service_type, uint32_t token_rate,
329                               uint32_t token_bucket_size,
330                               uint32_t peak_bandwidth, uint32_t access_latency);
331   ErrorCode WriteLinkSupervisionTimeout(uint16_t handle, uint16_t timeout);
332   ErrorCode WriteDefaultLinkPolicySettings(uint16_t settings);
333   uint16_t ReadDefaultLinkPolicySettings();
334 
335   void ReadLocalOobData();
336   void ReadLocalOobExtendedData();
337 
338   void HandleIso(bluetooth::hci::IsoView iso);
339 
340  protected:
341   void SendLeLinkLayerPacket(
342       std::unique_ptr<model::packets::LinkLayerPacketBuilder> packet);
343   void SendLinkLayerPacket(
344       std::unique_ptr<model::packets::LinkLayerPacketBuilder> packet);
345   void IncomingAclPacket(model::packets::LinkLayerPacketView packet);
346   void IncomingDisconnectPacket(model::packets::LinkLayerPacketView packet);
347   void IncomingEncryptConnection(model::packets::LinkLayerPacketView packet);
348   void IncomingEncryptConnectionResponse(
349       model::packets::LinkLayerPacketView packet);
350   void IncomingInquiryPacket(model::packets::LinkLayerPacketView packet);
351   void IncomingInquiryResponsePacket(
352       model::packets::LinkLayerPacketView packet);
353   void IncomingIoCapabilityRequestPacket(
354       model::packets::LinkLayerPacketView packet);
355   void IncomingIoCapabilityResponsePacket(
356       model::packets::LinkLayerPacketView packet);
357   void IncomingIoCapabilityNegativeResponsePacket(
358       model::packets::LinkLayerPacketView packet);
359   void IncomingIsoPacket(model::packets::LinkLayerPacketView packet);
360   void IncomingIsoConnectionRequestPacket(
361       model::packets::LinkLayerPacketView packet);
362   void IncomingIsoConnectionResponsePacket(
363       model::packets::LinkLayerPacketView packet);
364   void IncomingKeypressNotificationPacket(
365       model::packets::LinkLayerPacketView packet);
366   void IncomingLeAdvertisementPacket(
367       model::packets::LinkLayerPacketView packet);
368   void IncomingLeConnectPacket(model::packets::LinkLayerPacketView packet);
369   void IncomingLeConnectCompletePacket(
370       model::packets::LinkLayerPacketView packet);
371   void IncomingLeEncryptConnection(model::packets::LinkLayerPacketView packet);
372   void IncomingLeEncryptConnectionResponse(
373       model::packets::LinkLayerPacketView packet);
374   void IncomingLeReadRemoteFeatures(model::packets::LinkLayerPacketView packet);
375   void IncomingLeReadRemoteFeaturesResponse(
376       model::packets::LinkLayerPacketView packet);
377   void IncomingLeScanPacket(model::packets::LinkLayerPacketView packet);
378   void IncomingLeScanResponsePacket(model::packets::LinkLayerPacketView packet);
379   void IncomingPagePacket(model::packets::LinkLayerPacketView packet);
380   void IncomingPageRejectPacket(model::packets::LinkLayerPacketView packet);
381   void IncomingPageResponsePacket(model::packets::LinkLayerPacketView packet);
382   void IncomingPasskeyPacket(model::packets::LinkLayerPacketView packet);
383   void IncomingPasskeyFailedPacket(model::packets::LinkLayerPacketView packet);
384   void IncomingPinRequestPacket(model::packets::LinkLayerPacketView packet);
385   void IncomingPinResponsePacket(model::packets::LinkLayerPacketView packet);
386   void IncomingReadRemoteLmpFeatures(
387       model::packets::LinkLayerPacketView packet);
388   void IncomingReadRemoteLmpFeaturesResponse(
389       model::packets::LinkLayerPacketView packet);
390   void IncomingReadRemoteSupportedFeatures(
391       model::packets::LinkLayerPacketView packet);
392   void IncomingReadRemoteSupportedFeaturesResponse(
393       model::packets::LinkLayerPacketView packet);
394   void IncomingReadRemoteExtendedFeatures(
395       model::packets::LinkLayerPacketView packet);
396   void IncomingReadRemoteExtendedFeaturesResponse(
397       model::packets::LinkLayerPacketView packet);
398   void IncomingReadRemoteVersion(model::packets::LinkLayerPacketView packet);
399   void IncomingReadRemoteVersionResponse(
400       model::packets::LinkLayerPacketView packet);
401   void IncomingReadClockOffset(model::packets::LinkLayerPacketView packet);
402   void IncomingReadClockOffsetResponse(
403       model::packets::LinkLayerPacketView packet);
404   void IncomingRemoteNameRequest(model::packets::LinkLayerPacketView packet);
405   void IncomingRemoteNameRequestResponse(
406       model::packets::LinkLayerPacketView packet);
407 
408  private:
409   const DeviceProperties& properties_;
410   AclConnectionHandler connections_;
411   // Add timestamps?
412   std::vector<std::shared_ptr<model::packets::LinkLayerPacketBuilder>>
413       commands_awaiting_responses_;
414 
415   // Timing related state
416   std::vector<AsyncTaskId> controller_events_;
417   AsyncTaskId timer_tick_task_{};
418   std::chrono::milliseconds timer_period_ = std::chrono::milliseconds(100);
419 
420   // Callbacks to schedule tasks.
421   std::function<AsyncTaskId(std::chrono::milliseconds, const TaskCallback&)> schedule_task_;
422   std::function<AsyncTaskId(std::chrono::milliseconds, std::chrono::milliseconds, const TaskCallback&)>
423       schedule_periodic_task_;
424   std::function<void(AsyncTaskId)> cancel_task_;
425 
426   // Callbacks to send packets back to the HCI.
427   std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)> send_acl_;
428   std::function<void(std::shared_ptr<bluetooth::hci::EventBuilder>)>
429       send_event_;
430   std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)> send_sco_;
431   std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)> send_iso_;
432 
433   // Callback to send packets to remote devices.
434   std::function<void(std::shared_ptr<model::packets::LinkLayerPacketBuilder>,
435                      Phy::Type phy_type)>
436       send_to_remote_;
437 
438   uint32_t oob_id_ = 1;
439   uint32_t key_id_ = 1;
440 
441   // LE state
442   std::vector<uint8_t> le_event_mask_;
443 
444   std::vector<std::tuple<Address, uint8_t>> le_connect_list_;
445   std::vector<std::tuple<Address, uint8_t, std::array<uint8_t, kIrk_size>,
446                          std::array<uint8_t, kIrk_size>>>
447       le_resolving_list_;
448 
449   std::array<LeAdvertiser, 3> advertisers_;
450 
451   bluetooth::hci::OpCode le_scan_enable_{bluetooth::hci::OpCode::NONE};
452   uint8_t le_scan_type_{};
453   uint16_t le_scan_interval_{};
454   uint16_t le_scan_window_{};
455   uint8_t le_scan_filter_policy_{};
456   uint8_t le_scan_filter_duplicates_{};
457   bluetooth::hci::OwnAddressType le_address_type_{};
458 
459   bool le_connect_{false};
460   uint16_t le_connection_interval_min_{};
461   uint16_t le_connection_interval_max_{};
462   uint16_t le_connection_latency_{};
463   uint16_t le_connection_supervision_timeout_{};
464   uint16_t le_connection_minimum_ce_length_{};
465   uint16_t le_connection_maximum_ce_length_{};
466   uint8_t le_initiator_filter_policy_{};
467 
468   Address le_peer_address_{};
469   uint8_t le_peer_address_type_{};
470 
471   // Classic state
472 
473   SecurityManager security_manager_{10};
474   std::chrono::steady_clock::time_point last_inquiry_;
475   model::packets::InquiryType inquiry_mode_{
476       model::packets::InquiryType::STANDARD};
477   AsyncTaskId inquiry_timer_task_id_ = kInvalidTaskId;
478   uint64_t inquiry_lap_{};
479   uint8_t inquiry_max_responses_{};
480   uint16_t default_link_policy_settings_ = 0;
481 
482   bool page_scans_enabled_{false};
483   bool inquiry_scans_enabled_{false};
484 };
485 
486 }  // namespace test_vendor_lib
487