diff --git a/fastpair/handshake/fast_pair_data_encryptor_impl.cc b/fastpair/handshake/fast_pair_data_encryptor_impl.cc index 75e18817..3bdf001b 100644 --- a/fastpair/handshake/fast_pair_data_encryptor_impl.cc +++ b/fastpair/handshake/fast_pair_data_encryptor_impl.cc @@ -85,6 +85,7 @@ void FastPairDataEncryptorImpl::Factory::CreateAsyncWithKeyExchange( on_get_instance_callback) { // We first have to get the metadata in order to get the public key to use // to generate the new secret key pair. + NEARBY_LOGS(INFO) << __func__ << ": Attempting to get device metadata."; FastPairRepository::Get()->GetDeviceMetadata( device.model_id, [&device, &on_get_instance_callback](DeviceMetadata& metadata) { @@ -98,6 +99,7 @@ void FastPairDataEncryptorImpl::Factory::DeviceMetadataRetrieved( absl::AnyInvocable)> on_get_instance_callback, DeviceMetadata& device_metadata) { + DCHECK(&device_metadata); std::optional key_pair = FastPairEncryption::GenerateKeysWithEcdhKeyAgreement( device_metadata.GetDetails().anti_spoofing_key_pair().public_key()); diff --git a/fastpair/scanning/fastpair/fast_pair_discoverable_scanner_impl.cc b/fastpair/scanning/fastpair/fast_pair_discoverable_scanner_impl.cc index 97532f72..1aed2d22 100644 --- a/fastpair/scanning/fastpair/fast_pair_discoverable_scanner_impl.cc +++ b/fastpair/scanning/fastpair/fast_pair_discoverable_scanner_impl.cc @@ -109,7 +109,7 @@ void FastPairDiscoverableScannerImpl::OnDeviceFound( } model_id_parse_attempts_[peripheral.GetName()] = 1; - NEARBY_LOGS(WARNING) << __func__ << ": Attempting to get model ID"; + NEARBY_LOGS(INFO) << __func__ << ": Attempting to get model ID"; std::vector service_data; std::string model_id_bytes = fast_pair_service_data.data(); std::move(std::begin(model_id_bytes), std::end(model_id_bytes), @@ -152,6 +152,7 @@ void FastPairDiscoverableScannerImpl::OnModelIdRetrieved( return; } + NEARBY_LOGS(INFO) << __func__ << ": Attempting to get device metadata."; FastPairRepository::Get()->GetDeviceMetadata( model_id.value(), absl::bind_front( @@ -162,6 +163,7 @@ void FastPairDiscoverableScannerImpl::OnModelIdRetrieved( void FastPairDiscoverableScannerImpl::OnDeviceMetadataRetrieved( const std::string& address, const std::string model_id, DeviceMetadata& device_metadata) { + DCHECK(&device_metadata); // Ignore advertisements that aren't for Fast Pair but leverage the service // UUID. if (!IsValidDeviceType(device_metadata.GetDetails())) { diff --git a/fastpair/server_access/fast_pair_metadata_downloader.cc b/fastpair/server_access/fast_pair_metadata_downloader.cc index 4b007875..02d8fb39 100644 --- a/fastpair/server_access/fast_pair_metadata_downloader.cc +++ b/fastpair/server_access/fast_pair_metadata_downloader.cc @@ -43,7 +43,8 @@ void FastPairMetadataDownloader::Run() { void FastPairMetadataDownloader::Succeed(DeviceMetadata& device_metadata) { DCHECK(was_run_); DCHECK(success_callback_); - + NEARBY_LOGS(INFO) << __func__ << ": Fast Pair download of " + << device_metadata.GetDetails().name() << " succeeded."; std::move(success_callback_)(device_metadata); } diff --git a/fastpair/server_access/fast_pair_metadata_downloader_impl.cc b/fastpair/server_access/fast_pair_metadata_downloader_impl.cc index 4a9dd5e0..1c0f392b 100644 --- a/fastpair/server_access/fast_pair_metadata_downloader_impl.cc +++ b/fastpair/server_access/fast_pair_metadata_downloader_impl.cc @@ -90,13 +90,12 @@ void FastPairMetadataDownloaderImpl::CallAccessServer( repository_->GetObservedDevice( request, [&](const proto::GetObservedDeviceResponse& response) { - NEARBY_LOGS(INFO) << "Maggie: " << __func__ - << "Name: " << response.device().name(); - NEARBY_LOGS(INFO) << "Maggie: " << __func__ + NEARBY_LOGS(INFO) << __func__ << "Name: " << response.device().name(); + NEARBY_LOGS(INFO) << __func__ << "Image URL: " << response.device().image_url(); NEARBY_LOGS(INFO) - << "Maggie: " << __func__ << "StringNotification: " + << __func__ << "StringNotification: " << response.strings().initial_notification_description(); OnAccessServerSuccess(response); }, diff --git a/fastpair/server_access/fast_pair_repository_impl.cc b/fastpair/server_access/fast_pair_repository_impl.cc index fd441eea..a24c985e 100644 --- a/fastpair/server_access/fast_pair_repository_impl.cc +++ b/fastpair/server_access/fast_pair_repository_impl.cc @@ -44,17 +44,8 @@ FastPairRepositoryImpl::FastPairRepositoryImpl( void FastPairRepositoryImpl::GetDeviceMetadata( absl::string_view hex_model_id, DeviceMetadataCallback callback) { - callback_ = std::move(callback); downloader_ = FastPairMetadataDownloaderImpl::Factory::Create( - hex_model_id, repository_factory_.get(), - [&](DeviceMetadata& device_metadata) { - NEARBY_LOGS(INFO) << __func__ << ": Fast Pair download of " - << device_metadata.GetDetails().name() - << " succeeded."; - DCHECK(callback_); - std::move(callback_)(device_metadata); - }, - [&]() { + hex_model_id, repository_factory_.get(), std::move(callback), []() { NEARBY_LOGS(INFO) << __func__ << ": Fast Pair Metadata download failed."; }); diff --git a/fastpair/server_access/fast_pair_repository_impl.h b/fastpair/server_access/fast_pair_repository_impl.h index 94672a12..06c05a35 100644 --- a/fastpair/server_access/fast_pair_repository_impl.h +++ b/fastpair/server_access/fast_pair_repository_impl.h @@ -44,7 +44,6 @@ class FastPairRepositoryImpl : public FastPairRepository { std::unique_ptr downloader_; std::unique_ptr http_factory_; std::unique_ptr repository_factory_; - DeviceMetadataCallback callback_; }; } // namespace fastpair } // namespace nearby