Roll forward to cl/321106672

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: I6e34e075aa2cbbacba714019f6d0e7506313e53d
This commit is contained in:
Alexey Polyudov
2020-07-15 11:20:49 -07:00
parent 0e066caada
commit ae277748ce
26 changed files with 477 additions and 235 deletions
+15 -9
View File
@@ -22,8 +22,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) {
@@ -48,13 +48,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);
},
@@ -100,12 +105,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
@@ -26,7 +26,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;
@@ -127,7 +128,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.