diff --git a/cpp/core/internal/mediums/webrtc/peer_connection_observer_impl.cc b/cpp/core/internal/mediums/webrtc/peer_connection_observer_impl.cc index a86a1eaa..789f1c51 100644 --- a/cpp/core/internal/mediums/webrtc/peer_connection_observer_impl.cc +++ b/cpp/core/internal/mediums/webrtc/peer_connection_observer_impl.cc @@ -16,7 +16,6 @@ PeerConnectionObserverImpl::PeerConnectionObserverImpl( void PeerConnectionObserverImpl::OnIceCandidate( const webrtc::IceCandidateInterface* candidate) { - NEARBY_LOG(INFO, "OnIceCandidate"); local_ice_candidate_listener_.local_ice_candidate_found_cb(candidate); } diff --git a/cpp/core/internal/p2p_cluster_pcp_handler.cc b/cpp/core/internal/p2p_cluster_pcp_handler.cc index f3d76db3..f5071877 100644 --- a/cpp/core/internal/p2p_cluster_pcp_handler.cc +++ b/cpp/core/internal/p2p_cluster_pcp_handler.cc @@ -137,12 +137,14 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( Status P2pClusterPcpHandler::StopAdvertisingImpl(ClientProxy* client) { if (client->GetClientId() == bluetooth_classic_advertiser_client_id_) { bluetooth_medium_.TurnOffDiscoverability(); + bluetooth_classic_advertiser_client_id_ = 0; } else { NEARBY_LOG(INFO, "Skipped BT TurnOffDiscoverability for client %d, client that " "turned on discoverability is %d", client->GetClientId(), bluetooth_classic_advertiser_client_id_); } + bluetooth_medium_.StopAcceptingConnections(client->GetAdvertisingServiceId()); ble_medium_.StopAdvertising(client->GetAdvertisingServiceId()); @@ -621,12 +623,14 @@ Status P2pClusterPcpHandler::StopDiscoveryImpl(ClientProxy* client) { wifi_lan_medium_.StopDiscovery(client->GetDiscoveryServiceId()); if (client->GetClientId() == bluetooth_classic_discoverer_client_id_) { bluetooth_medium_.StopDiscovery(); + bluetooth_classic_discoverer_client_id_ = 0; } else { NEARBY_LOG(INFO, "Skipped BT stopDiscovery for client %d, client that started " "discovery is %d", client->GetClientId(), bluetooth_classic_discoverer_client_id_); } + ble_medium_.StopScanning(client->GetDiscoveryServiceId()); return {Status::kSuccess}; } diff --git a/cpp/core/internal/p2p_cluster_pcp_handler.h b/cpp/core/internal/p2p_cluster_pcp_handler.h index 39d0a165..016298fc 100644 --- a/cpp/core/internal/p2p_cluster_pcp_handler.h +++ b/cpp/core/internal/p2p_cluster_pcp_handler.h @@ -186,8 +186,8 @@ class P2pClusterPcpHandler : public BasePcpHandler { WifiLan& wifi_lan_medium_; mediums::WebRtc& webrtc_medium_; InjectedBluetoothDeviceStore& injected_bluetooth_device_store_; - std::int64_t bluetooth_classic_discoverer_client_id_; - std::int64_t bluetooth_classic_advertiser_client_id_; + std::int64_t bluetooth_classic_discoverer_client_id_{0}; + std::int64_t bluetooth_classic_advertiser_client_id_{0}; }; } // namespace connections diff --git a/cpp/core/internal/payload_manager.cc b/cpp/core/internal/payload_manager.cc index b77981e6..58a0c91c 100644 --- a/cpp/core/internal/payload_manager.cc +++ b/cpp/core/internal/payload_manager.cc @@ -34,13 +34,6 @@ bool PayloadManager::SendPayloadLoop( EndpointsToEndpointIds(pair.first); const Endpoints& unavailable_endpoints = pair.second; - NEARBY_LOG(INFO, - "SendPayloadLoop: Available: { %s }; Unavailable: { %s }; " - "payload_id=%" PRIX64 "; self=%p", - ToString(available_endpoint_ids).c_str(), - ToString(unavailable_endpoints).c_str(), - static_cast(payload_header.id()), this); - // First, handle any non-available endpoints. for (const auto& endpoint : unavailable_endpoints) { HandleFinishedOutgoingPayload( @@ -143,8 +136,6 @@ PayloadManager::GetAvailableAndUnavailableEndpoints( Endpoints available; Endpoints unavailable; for (auto* endpoint_info : pending_payload.GetEndpoints()) { - NEARBY_LOG(INFO, "EndpointInfo: %p; id=%s; status=%d", endpoint_info, - endpoint_info->id.c_str(), endpoint_info->status.Get()); if (endpoint_info->status.Get() == PayloadManager::EndpointInfo::Status::kAvailable) { available.push_back(endpoint_info); @@ -373,19 +364,15 @@ void PayloadManager::OnIncomingFrame( ProcessControlPacket(to_client, from_endpoint_id, frame); break; case PayloadTransferFrame::DATA: - NEARBY_LOG(INFO, "PayloadManager::OnIncomingFrame [DATA]: self=%p; id=%s", - this, from_endpoint_id.c_str()); ProcessDataPacket(to_client, from_endpoint_id, frame); break; default: NEARBY_LOG( - INFO, + WARNING, "PayloadManager: invalid frame; remote endpoint: self=%p; id=%s", this, from_endpoint_id.c_str()); break; } - NEARBY_LOG(INFO, "PayloadManager::OnIncomingFrame [DONE]: self=%p; id=%s", - this, from_endpoint_id.c_str()); } void PayloadManager::OnEndpointDisconnect(ClientProxy* client, @@ -801,7 +788,7 @@ void PayloadManager::ProcessDataPacket( } else { pending_payload = GetPayload(payload_header.id()); if (!pending_payload) { - NEARBY_LOG(INFO, + NEARBY_LOG(WARNING, "ProcessDataPacket: [missing] id=%s; payload_id=%" PRIX64, from_endpoint_id.c_str(), static_cast(payload_header.id())); @@ -833,7 +820,7 @@ void PayloadManager::ProcessDataPacket( if (pending_payload->GetInternalPayload() ->AttachNextChunk(ByteArray(std::move(*payload_chunk.mutable_body()))) .Raised()) { - NEARBY_LOG(INFO, + NEARBY_LOG(WARNING, "ProcessDataPacket: [data: error] id=%s; payload_id=%" PRIX64, from_endpoint_id.c_str(), pending_payload->GetId()); HandleFinishedIncomingPayload( @@ -842,8 +829,6 @@ void PayloadManager::ProcessDataPacket( return; } - NEARBY_LOG(INFO, "ProcessDataPacket: [data: ok] id=%s; payload_id=%" PRIX64, - from_endpoint_id.c_str(), pending_payload->GetId()); HandleSuccessfulIncomingChunk(to_client, from_endpoint_id, payload_header, payload_chunk.flags(), payload_chunk.offset(), payload_body_size); diff --git a/cpp/platform/public/ble.cc b/cpp/platform/public/ble.cc index fe77ec21..6acc9a90 100644 --- a/cpp/platform/public/ble.cc +++ b/cpp/platform/public/ble.cc @@ -37,18 +37,10 @@ bool BleMedium::StartScanning( auto pair = peripherals_.emplace( &peripheral, absl::make_unique()); auto& context = *pair.first->second; - if (!pair.second) { - NEARBY_LOG(INFO, - "Discovering (again) peripheral=%p, impl=%p, " - "peripheral name=%s", - &context.peripheral, &peripheral, - peripheral.GetName().c_str()); - } else { + if (pair.second) { context.peripheral = BlePeripheral(&peripheral); NEARBY_LOG(INFO, - "Discovering peripheral=%p, impl=%p, " - "peripheral name=%s", - &context.peripheral, &peripheral, + "Discovered peripheral '%s'", peripheral.GetName().c_str()); discovered_peripheral_callback_.peripheral_discovered_cb( context.peripheral, service_id, diff --git a/proto/connections/offline_wire_formats.proto b/proto/connections/offline_wire_formats.proto index 20a21c9d..5225503e 100644 --- a/proto/connections/offline_wire_formats.proto +++ b/proto/connections/offline_wire_formats.proto @@ -266,6 +266,8 @@ message MediumMetadata { optional bytes ip_address = 3; // True if local device supports 6GHz. optional bool supports_6_ghz = 4; + // True if local device has mobile radio. + optional bool mobile_radio = 5; } // LocationHint is used to specify a location as well as format.