Loading system/gd/hal/cert/simple_hal_test.py +3 −3 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ class SimpleHalTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_cert_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading Loading @@ -210,7 +210,7 @@ class SimpleHalTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_The_DUT!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_The_DUT')) self.send_dut_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading Loading @@ -306,7 +306,7 @@ class SimpleHalTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_cert_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading system/gd/hci/cert/direct_hci_test.py +2 −2 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ class DirectHciTest(GdBaseTestClass): hci_packets.LeSetExtendedAdvertisingRandomAddressBuilder(advertising_handle, '0C:05:04:03:02:01')) gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_hal_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading Loading @@ -288,7 +288,7 @@ class DirectHciTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_hal_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading system/gd/hci/cert/le_advertising_manager_test.py +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class LeAdvertisingManagerTest(GdBaseTestClass): # DUT Advertises gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_The_DUT!')) gap_name.data = list(bytes(b'Im_The_DUT')) gap_data = le_advertising_facade.GapDataMsg(data=bytes(gap_name.Serialize())) config = le_advertising_facade.AdvertisingConfig( advertisement=[gap_data], Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +3 −2 Original line number Diff line number Diff line Loading @@ -1445,8 +1445,9 @@ void DualModeController::LeSetAdvertisingData(CommandPacketView command) { auto command_view = gd_hci::LeSetAdvertisingDataView::Create( gd_hci::LeAdvertisingCommandView::Create(command)); auto payload = command.GetPayload(); std::vector<uint8_t> payload_bytes{payload.begin() + 1, payload.begin() + *payload.begin()}; auto data_size = *payload.begin(); auto first_data = payload.begin() + 1; std::vector<uint8_t> payload_bytes{first_data, first_data + data_size}; ASSERT_LOG(command_view.IsValid(), "%s command.size() = %zu", gd_hci::OpCodeText(command.GetOpCode()).c_str(), command.size()); ASSERT(command_view.GetPayload().size() == 32); Loading system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc +9 −13 Original line number Diff line number Diff line Loading @@ -776,7 +776,8 @@ void LinkLayerController::IncomingLeAdvertisementPacket( raw_builder_ptr->AddOctets1(static_cast<uint8_t>( bluetooth::hci::SubeventCode::EXTENDED_ADVERTISING_REPORT)); raw_builder_ptr->AddOctets1(0x01); // num reports raw_builder_ptr->AddOctets1(static_cast<uint8_t>(adv_type)); raw_builder_ptr->AddOctets1(0x01); // Connectable raw_builder_ptr->AddOctets1(0x00); // Reserved raw_builder_ptr->AddOctets1(static_cast<uint8_t>(address_type)); raw_builder_ptr->AddAddress(address); raw_builder_ptr->AddOctets1(1); // Primary_PHY Loading @@ -784,14 +785,13 @@ void LinkLayerController::IncomingLeAdvertisementPacket( raw_builder_ptr->AddOctets1(0xFF); // Advertising_SID - not provided raw_builder_ptr->AddOctets1(0x7F); // Tx_Power - Not available raw_builder_ptr->AddOctets1(GetRssi()); raw_builder_ptr->AddOctets1(0); // Periodic_Advertising_Interval - None raw_builder_ptr->AddOctets2(0); // Periodic_Advertising_Interval - None raw_builder_ptr->AddOctets1(0); // Direct_Address_Type - PUBLIC raw_builder_ptr->AddAddress(Address::kEmpty); // Direct_Address raw_builder_ptr->AddOctets1(ad.size()); raw_builder_ptr->AddOctets(ad); auto packet = bluetooth::hci::EventPacketBuilder::Create( bluetooth::hci::EventCode::LE_META_EVENT, std::move(raw_builder_ptr)); send_event_(std::move(packet)); send_event_(bluetooth::hci::EventPacketBuilder::Create( bluetooth::hci::EventCode::LE_META_EVENT, std::move(raw_builder_ptr))); } // Active scanning Loading Loading @@ -1084,19 +1084,18 @@ void LinkLayerController::IncomingPageResponsePacket( void LinkLayerController::TimerTick() { if (inquiry_timer_task_id_ != kInvalidTaskId) Inquiry(); LeAdvertising(); Connections(); } void LinkLayerController::LeAdvertising() { if (!le_advertising_enable_) { return; } steady_clock::time_point now = steady_clock::now(); if (duration_cast<milliseconds>(now - last_le_advertisement_) < steady_clock::time_point right_now = steady_clock::now(); if (duration_cast<milliseconds>(right_now - last_le_advertisement_) < milliseconds(200)) { return; } last_le_advertisement_ = now; last_le_advertisement_ = right_now; auto own_address_type = static_cast<model::packets::AddressType>( properties_.GetLeAdvertisingOwnAddressType()); Loading @@ -1111,13 +1110,10 @@ void LinkLayerController::LeAdvertising() { advertising_address, Address::kEmpty, own_address_type, static_cast<model::packets::AdvertisementType>(own_address_type), properties_.GetLeAdvertisement()); LOG_INFO("%zu length", properties_.GetLeAdvertisement().size()); SendLeLinkLayerPacket(std::move(to_send)); } void LinkLayerController::Connections() { // TODO: Keep connections alive? } void LinkLayerController::RegisterEventChannel( const std::function< void(std::shared_ptr<bluetooth::hci::EventPacketBuilder>)>& callback) { Loading Loading
system/gd/hal/cert/simple_hal_test.py +3 −3 Original line number Diff line number Diff line Loading @@ -140,7 +140,7 @@ class SimpleHalTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_cert_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading Loading @@ -210,7 +210,7 @@ class SimpleHalTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_The_DUT!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_The_DUT')) self.send_dut_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading Loading @@ -306,7 +306,7 @@ class SimpleHalTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_cert_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading
system/gd/hci/cert/direct_hci_test.py +2 −2 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ class DirectHciTest(GdBaseTestClass): hci_packets.LeSetExtendedAdvertisingRandomAddressBuilder(advertising_handle, '0C:05:04:03:02:01')) gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_hal_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading Loading @@ -288,7 +288,7 @@ class DirectHciTest(GdBaseTestClass): gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_A_Cert!')) # TODO: Fix and remove ! gap_name.data = list(bytes(b'Im_A_Cert')) self.send_hal_hci_command( hci_packets.LeSetExtendedAdvertisingDataBuilder( Loading
system/gd/hci/cert/le_advertising_manager_test.py +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ class LeAdvertisingManagerTest(GdBaseTestClass): # DUT Advertises gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(b'Im_The_DUT!')) gap_name.data = list(bytes(b'Im_The_DUT')) gap_data = le_advertising_facade.GapDataMsg(data=bytes(gap_name.Serialize())) config = le_advertising_facade.AdvertisingConfig( advertisement=[gap_data], Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +3 −2 Original line number Diff line number Diff line Loading @@ -1445,8 +1445,9 @@ void DualModeController::LeSetAdvertisingData(CommandPacketView command) { auto command_view = gd_hci::LeSetAdvertisingDataView::Create( gd_hci::LeAdvertisingCommandView::Create(command)); auto payload = command.GetPayload(); std::vector<uint8_t> payload_bytes{payload.begin() + 1, payload.begin() + *payload.begin()}; auto data_size = *payload.begin(); auto first_data = payload.begin() + 1; std::vector<uint8_t> payload_bytes{first_data, first_data + data_size}; ASSERT_LOG(command_view.IsValid(), "%s command.size() = %zu", gd_hci::OpCodeText(command.GetOpCode()).c_str(), command.size()); ASSERT(command_view.GetPayload().size() == 32); Loading
system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc +9 −13 Original line number Diff line number Diff line Loading @@ -776,7 +776,8 @@ void LinkLayerController::IncomingLeAdvertisementPacket( raw_builder_ptr->AddOctets1(static_cast<uint8_t>( bluetooth::hci::SubeventCode::EXTENDED_ADVERTISING_REPORT)); raw_builder_ptr->AddOctets1(0x01); // num reports raw_builder_ptr->AddOctets1(static_cast<uint8_t>(adv_type)); raw_builder_ptr->AddOctets1(0x01); // Connectable raw_builder_ptr->AddOctets1(0x00); // Reserved raw_builder_ptr->AddOctets1(static_cast<uint8_t>(address_type)); raw_builder_ptr->AddAddress(address); raw_builder_ptr->AddOctets1(1); // Primary_PHY Loading @@ -784,14 +785,13 @@ void LinkLayerController::IncomingLeAdvertisementPacket( raw_builder_ptr->AddOctets1(0xFF); // Advertising_SID - not provided raw_builder_ptr->AddOctets1(0x7F); // Tx_Power - Not available raw_builder_ptr->AddOctets1(GetRssi()); raw_builder_ptr->AddOctets1(0); // Periodic_Advertising_Interval - None raw_builder_ptr->AddOctets2(0); // Periodic_Advertising_Interval - None raw_builder_ptr->AddOctets1(0); // Direct_Address_Type - PUBLIC raw_builder_ptr->AddAddress(Address::kEmpty); // Direct_Address raw_builder_ptr->AddOctets1(ad.size()); raw_builder_ptr->AddOctets(ad); auto packet = bluetooth::hci::EventPacketBuilder::Create( bluetooth::hci::EventCode::LE_META_EVENT, std::move(raw_builder_ptr)); send_event_(std::move(packet)); send_event_(bluetooth::hci::EventPacketBuilder::Create( bluetooth::hci::EventCode::LE_META_EVENT, std::move(raw_builder_ptr))); } // Active scanning Loading Loading @@ -1084,19 +1084,18 @@ void LinkLayerController::IncomingPageResponsePacket( void LinkLayerController::TimerTick() { if (inquiry_timer_task_id_ != kInvalidTaskId) Inquiry(); LeAdvertising(); Connections(); } void LinkLayerController::LeAdvertising() { if (!le_advertising_enable_) { return; } steady_clock::time_point now = steady_clock::now(); if (duration_cast<milliseconds>(now - last_le_advertisement_) < steady_clock::time_point right_now = steady_clock::now(); if (duration_cast<milliseconds>(right_now - last_le_advertisement_) < milliseconds(200)) { return; } last_le_advertisement_ = now; last_le_advertisement_ = right_now; auto own_address_type = static_cast<model::packets::AddressType>( properties_.GetLeAdvertisingOwnAddressType()); Loading @@ -1111,13 +1110,10 @@ void LinkLayerController::LeAdvertising() { advertising_address, Address::kEmpty, own_address_type, static_cast<model::packets::AdvertisementType>(own_address_type), properties_.GetLeAdvertisement()); LOG_INFO("%zu length", properties_.GetLeAdvertisement().size()); SendLeLinkLayerPacket(std::move(to_send)); } void LinkLayerController::Connections() { // TODO: Keep connections alive? } void LinkLayerController::RegisterEventChannel( const std::function< void(std::shared_ptr<bluetooth::hci::EventPacketBuilder>)>& callback) { Loading