Roll forward to cl/321106672

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: Iabb20e9c7f7487268fa3ebbbeb58540092e10e0e
This commit is contained in:
Alexey Polyudov
2020-07-15 11:16:39 -07:00
parent 999cdd9903
commit 6f9228fa6b
26 changed files with 477 additions and 235 deletions
+15 -9
View File
@@ -8,8 +8,8 @@ namespace nearby {
bool WifiLanMedium::StartAdvertising(
const std::string& service_id,
const std::string& wifi_lan_service_info_name) {
return impl_->StartAdvertising(service_id, wifi_lan_service_info_name);
const std::string& service_info_name) {
return impl_->StartAdvertising(service_id, service_info_name);
}
bool WifiLanMedium::StopAdvertising(const std::string& service_id) {
@@ -34,13 +34,18 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_id,
&service, absl::make_unique<ServiceDiscoveryInfo>());
auto& context = *pair.first->second;
if (!pair.second) {
NEARBY_LOG(INFO, "Adding (again) service=%p, impl=%p",
&context.service, &service);
NEARBY_LOG(INFO,
"Discovering (again) service=%p, impl=%p, "
"service_info_name=%s",
&context.service, &service,
service.GetName().c_str());
return;
}
context.service = WifiLanService(&service);
NEARBY_LOG(INFO, "Adding service=%p, impl=%p", &context.service,
&service);
NEARBY_LOG(
INFO,
"Discovering service=%p, impl=%p, service_info_name=%s",
&context.service, &service, service.GetName().c_str());
discovered_service_callback_.service_discovered_cb(
context.service, service_id);
},
@@ -86,12 +91,13 @@ bool WifiLanMedium::StartAcceptingConnections(
&socket, absl::make_unique<AcceptedConnectionInfo>());
auto& context = *pair.first->second;
if (!pair.second) {
NEARBY_LOG(INFO, "Adding (again) socket=%p, impl=%p",
NEARBY_LOG(INFO, "Accepting (again) socket=%p, impl=%p",
&context.socket, &socket);
context.socket = WifiLanSocket(&socket);
} else {
NEARBY_LOG(INFO, "Accepting socket=%p, impl=%p",
&context.socket, &socket);
}
NEARBY_LOG(INFO, "Adding socket=%p, impl=%p", &context.socket,
&socket);
accepted_connection_callback_.accepted_cb(context.socket,
service_id);
},
+3 -2
View File
@@ -12,7 +12,8 @@
namespace location {
namespace nearby {
// Opaque wrapper over a WifiLan service which contains encoded service name.
// Opaque wrapper over a WifiLan service which contains packed
// |WifiLanServiceInfo| string name.
class WifiLanService final {
public:
WifiLanService() = default;
@@ -113,7 +114,7 @@ class WifiLanMedium final {
~WifiLanMedium() = default;
bool StartAdvertising(const std::string& service_id,
const std::string& wifi_lan_service_info_name);
const std::string& service_info_name);
bool StopAdvertising(const std::string& service_id);
// Returns true once the WifiLan discovery has been initiated.