Lines Matching refs:hci

57   hci::InquiryScanType inquiry_scan_type;
58 hci::InquiryMode inquiry_mode;
69 .inquiry_scan_type = hci::InquiryScanType::STANDARD,
70 .inquiry_mode = hci::InquiryMode::STANDARD,
77 hci::PacketView<hci::kLittleEndian> GetPacketView(std::unique_ptr<packet::BasePacketBuilder> packet… in GetPacketView()
79 hci::BitInserter i(*bytes); in GetPacketView()
85 class TestHciLayer : public hci::HciLayer {
88 std::unique_ptr<hci::CommandPacketBuilder> command, in EnqueueCommand()
89 common::ContextualOnceCallback<void(hci::CommandCompleteView)> on_complete) override { in EnqueueCommand()
95 std::unique_ptr<hci::CommandPacketBuilder> command, in EnqueueCommand()
96 common::ContextualOnceCallback<void(hci::CommandStatusView)> on_status) override { in EnqueueCommand()
102 std::unique_ptr<hci::CommandPacketBuilder> command_builder, in HandleCommand()
103 common::ContextualOnceCallback<void(hci::CommandCompleteView)> on_complete) { in HandleCommand()
104hci::CommandPacketView command = hci::CommandPacketView::Create(GetPacketView(std::move(command_bu… in HandleCommand()
109 case hci::OpCode::INQUIRY_CANCEL: in HandleCommand()
111hci::InquiryCancelCompleteBuilder::Create(kNumberPacketsReadyToReceive, hci::ErrorCode::SUCCESS); in HandleCommand()
115 case hci::OpCode::PERIODIC_INQUIRY_MODE: { in HandleCommand()
116 … auto inquiry = hci::PeriodicInquiryModeView::Create(hci::DiscoveryCommandView::Create(command)); in HandleCommand()
119hci::PeriodicInquiryModeCompleteBuilder::Create(kNumberPacketsReadyToReceive, hci::ErrorCode::SUCC… in HandleCommand()
127 case hci::OpCode::EXIT_PERIODIC_INQUIRY_MODE: in HandleCommand()
129hci::ExitPeriodicInquiryModeCompleteBuilder::Create(kNumberPacketsReadyToReceive, hci::ErrorCode::… in HandleCommand()
133 case hci::OpCode::WRITE_INQUIRY_MODE: in HandleCommand()
135hci::WriteInquiryModeCompleteBuilder::Create(kNumberPacketsReadyToReceive, hci::ErrorCode::SUCCESS… in HandleCommand()
137 auto view = hci::WriteInquiryModeView::Create(hci::DiscoveryCommandView::Create(command)); in HandleCommand()
143 case hci::OpCode::READ_INQUIRY_MODE: in HandleCommand()
144 event_builder = hci::ReadInquiryModeCompleteBuilder::Create( in HandleCommand()
145 kNumberPacketsReadyToReceive, hci::ErrorCode::SUCCESS, hci_register_.inquiry_mode); in HandleCommand()
148 case hci::OpCode::WRITE_INQUIRY_SCAN_ACTIVITY: in HandleCommand()
150hci::WriteInquiryScanActivityCompleteBuilder::Create(kNumberPacketsReadyToReceive, hci::ErrorCode:… in HandleCommand()
152 … auto view = hci::WriteInquiryScanActivityView::Create(hci::DiscoveryCommandView::Create(command)); in HandleCommand()
159 case hci::OpCode::READ_INQUIRY_SCAN_ACTIVITY: in HandleCommand()
160 event_builder = hci::ReadInquiryScanActivityCompleteBuilder::Create( in HandleCommand()
162 hci::ErrorCode::SUCCESS, in HandleCommand()
167 case hci::OpCode::WRITE_INQUIRY_SCAN_TYPE: in HandleCommand()
169hci::WriteInquiryScanTypeCompleteBuilder::Create(kNumberPacketsReadyToReceive, hci::ErrorCode::SUC… in HandleCommand()
171 … auto view = hci::WriteInquiryScanTypeView::Create(hci::DiscoveryCommandView::Create(command)); in HandleCommand()
177 case hci::OpCode::READ_INQUIRY_SCAN_TYPE: in HandleCommand()
178 event_builder = hci::ReadInquiryScanTypeCompleteBuilder::Create( in HandleCommand()
179 kNumberPacketsReadyToReceive, hci::ErrorCode::SUCCESS, hci_register_.inquiry_scan_type); in HandleCommand()
182 case hci::OpCode::READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL: in HandleCommand()
183 event_builder = hci::ReadInquiryResponseTransmitPowerLevelCompleteBuilder::Create( in HandleCommand()
184 …kNumberPacketsReadyToReceive, hci::ErrorCode::SUCCESS, hci_register_.inquiry_response_transmit_pow… in HandleCommand()
188 LOG_INFO("Dropping unhandled command:%s", hci::OpCodeText(command.GetOpCode()).c_str()); in HandleCommand()
191hci::EventPacketView event = hci::EventPacketView::Create(GetPacketView(std::move(event_builder))); in HandleCommand()
193 hci::CommandCompleteView command_complete = hci::CommandCompleteView::Create(event); in HandleCommand()
203 std::unique_ptr<hci::CommandPacketBuilder> command_builder, in HandleStatus()
204 common::ContextualOnceCallback<void(hci::CommandStatusView)> on_status) { in HandleStatus()
205hci::CommandPacketView command = hci::CommandPacketView::Create(GetPacketView(std::move(command_bu… in HandleStatus()
210 case hci::OpCode::INQUIRY: { in HandleStatus()
211 auto inquiry = hci::InquiryView::Create(hci::DiscoveryCommandView::Create(command)); in HandleStatus()
213 …event_builder = hci::InquiryStatusBuilder::Create(hci::ErrorCode::SUCCESS, kNumberPacketsReadyToRe… in HandleStatus()
219 …LOG_INFO("Dropping unhandled status expecting command:%s", hci::OpCodeText(command.GetOpCode()).c_… in HandleStatus()
222hci::EventPacketView event = hci::EventPacketView::Create(GetPacketView(std::move(event_builder))); in HandleStatus()
224 hci::CommandStatusView command_status = hci::CommandStatusView::Create(event); in HandleStatus()
234hci::EventCode event_code, common::ContextualCallback<void(hci::EventPacketView)> event_handler) o… in RegisterEventHandler()
236 case hci::EventCode::INQUIRY_RESULT: in RegisterEventHandler()
239 case hci::EventCode::INQUIRY_RESULT_WITH_RSSI: in RegisterEventHandler()
242 case hci::EventCode::EXTENDED_INQUIRY_RESULT: in RegisterEventHandler()
245 case hci::EventCode::INQUIRY_COMPLETE: in RegisterEventHandler()
254 void UnregisterEventHandler(hci::EventCode event_code) override { in UnregisterEventHandler()
261 case hci::EventCode::INQUIRY_RESULT: in UnregisterEventHandler()
264 case hci::EventCode::INQUIRY_RESULT_WITH_RSSI: in UnregisterEventHandler()
267 case hci::EventCode::EXTENDED_INQUIRY_RESULT: in UnregisterEventHandler()
270 case hci::EventCode::INQUIRY_COMPLETE: in UnregisterEventHandler()
279 void Synchronize(std::function<void()> func, hci::OpCode op_code) { in Synchronize()
281 promise_sync_complete_ = new std::promise<hci::OpCode>(); in Synchronize()
291 void InjectInquiryResult(std::unique_ptr<hci::InquiryResultBuilder> result) { in InjectInquiryResult()
292 hci::EventPacketView view = hci::EventPacketView::Create(GetPacketView(std::move(result))); in InjectInquiryResult()
302 std::promise<hci::OpCode>* promise_sync_complete_{nullptr};
304 common::ContextualCallback<void(hci::EventPacketView)> inquiry_result_callback_;
305 common::ContextualCallback<void(hci::EventPacketView)> inquiry_result_with_rssi_callback_;
306 common::ContextualCallback<void(hci::EventPacketView)> extended_inquiry_result_callback_;
307 common::ContextualCallback<void(hci::EventPacketView)> inquiry_complete_callback_;
312 void Result(hci::InquiryResultView view) { in Result()
327 void ResultWithRssi(hci::InquiryResultWithRssiView view) { in ResultWithRssi()
331 void ExtendedResult(hci::ExtendedInquiryResultView view) { in ExtendedResult()
335 void Complete(hci::ErrorCode status) {} in Complete()
340 fake_registry_.InjectTestModule(&hci::HciLayer::Factory, test_hci_layer_); in SetUp()
341 client_handler_ = fake_registry_.GetTestModuleHandler(&hci::HciLayer::Factory); in SetUp()
372 [this] { inquiry_module_->SetInquiryWithRssiResultMode(); }, hci::OpCode::WRITE_INQUIRY_MODE); in TEST_F()
373 ASSERT_EQ(hci_register_.inquiry_mode, hci::InquiryMode::RSSI); in TEST_F()
376 [this] { inquiry_module_->SetExtendedInquiryResultMode(); }, hci::OpCode::WRITE_INQUIRY_MODE); in TEST_F()
377 ASSERT_EQ(hci_register_.inquiry_mode, hci::InquiryMode::RSSI_OR_EXTENDED); in TEST_F()
380 [this] { inquiry_module_->SetStandardInquiryResultMode(); }, hci::OpCode::WRITE_INQUIRY_MODE); in TEST_F()
381 ASSERT_EQ(hci_register_.inquiry_mode, hci::InquiryMode::STANDARD); in TEST_F()
385 …test_hci_layer_->Synchronize([this] { inquiry_module_->SetInterlacedScan(); }, hci::OpCode::WRITE_… in TEST_F()
386 ASSERT_EQ(hci_register_.inquiry_scan_type, hci::InquiryScanType::INTERLACED); in TEST_F()
388 …test_hci_layer_->Synchronize([this] { inquiry_module_->SetStandardScan(); }, hci::OpCode::WRITE_IN… in TEST_F()
389 ASSERT_EQ(hci_register_.inquiry_scan_type, hci::InquiryScanType::STANDARD); in TEST_F()
399 …[this, params] { inquiry_module_->SetScanActivity(params); }, hci::OpCode::WRITE_INQUIRY_SCAN_ACTI… in TEST_F()
409 hci::OpCode::INQUIRY); in TEST_F()
413 …test_hci_layer_->Synchronize([this] { inquiry_module_->StopInquiry(); }, hci::OpCode::INQUIRY_CANC… in TEST_F()
417 …test_hci_layer_->Synchronize([this] { inquiry_module_->StartLimitedInquiry(128, 100); }, hci::OpCo… in TEST_F()
419 …test_hci_layer_->Synchronize([this] { inquiry_module_->StopInquiry(); }, hci::OpCode::INQUIRY_CANC… in TEST_F()
431 hci::OpCode::PERIODIC_INQUIRY_MODE); in TEST_F()
438 [this] { inquiry_module_->StopPeriodicInquiry(); }, hci::OpCode::EXIT_PERIODIC_INQUIRY_MODE); in TEST_F()
444 hci::OpCode::PERIODIC_INQUIRY_MODE); in TEST_F()
447 [this] { inquiry_module_->StopPeriodicInquiry(); }, hci::OpCode::EXIT_PERIODIC_INQUIRY_MODE); in TEST_F()
451 …test_hci_layer_->Synchronize([this] { inquiry_module_->StartGeneralInquiry(128, 100); }, hci::OpCo… in TEST_F()
454 const std::vector<hci::InquiryResult> inquiry_results; in TEST_F()
455 auto packet = hci::InquiryResultBuilder::Create(inquiry_results); in TEST_F()
458 …test_hci_layer_->Synchronize([this] { inquiry_module_->StopInquiry(); }, hci::OpCode::INQUIRY_CANC… in TEST_F()