diff --git a/internal/platform/implementation/linux/avahi.cc b/internal/platform/implementation/linux/avahi.cc index 3d601898..86517920 100644 --- a/internal/platform/implementation/linux/avahi.cc +++ b/internal/platform/implementation/linux/avahi.cc @@ -46,7 +46,7 @@ void ServiceBrowser::onItemNew(const int32_t &interface, info.SetServiceName(r_name); info.SetIPAddress(r_address); info.SetPort(r_port); - info.SetServiceType(r_type); + info.SetServiceType(r_type + "."); // discovery callback expects an extra period at t for (auto &attr : r_txt) { auto attr_str = std::string(attr.begin(), attr.end()); size_t pos = attr_str.find('='); diff --git a/internal/platform/implementation/linux/platform.cc b/internal/platform/implementation/linux/platform.cc index 7659973c..43f9bdf1 100644 --- a/internal/platform/implementation/linux/platform.cc +++ b/internal/platform/implementation/linux/platform.cc @@ -42,7 +42,7 @@ #include "internal/platform/implementation/linux/timer.h" // #include "internal/platform/implementation/linux/wifi_direct.h" // #include "internal/platform/implementation/linux/wifi_hotspot.h" -// #include "internal/platform/implementation/linux/wifi_lan.h" +#include "internal/platform/implementation/linux/wifi_lan.h" // #include "internal/platform/implementation/linux/wifi_medium.h" #include "internal/platform/implementation/platform.h" @@ -305,10 +305,9 @@ std::unique_ptr ImplementationPlatform::CreateWifiMedium() { std::unique_ptr ImplementationPlatform::CreateWifiLanMedium() { - return nullptr; - // auto nm = - // std::make_shared(linux::getSystemBusConnection()); - // return std::make_unique(nm); + auto nm = std::make_shared( + linux::getSystemBusConnection()); + return std::make_unique(nm); } std::unique_ptr diff --git a/internal/platform/implementation/linux/wifi_lan.cc b/internal/platform/implementation/linux/wifi_lan.cc index 56befda9..1415a06c 100644 --- a/internal/platform/implementation/linux/wifi_lan.cc +++ b/internal/platform/implementation/linux/wifi_lan.cc @@ -101,6 +101,7 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo &nsd_service_info) { auto entry_group = std::make_unique(*system_bus_, entry_group_path); + LOG(INFO) << __func__ << ": Adding avahi service with service type: " << nsd_service_info.GetServiceType(); try { entry_group->AddService( @@ -161,7 +162,7 @@ bool WifiLanMedium::StartDiscovery( LOG(INFO) << __func__ << ": Created a new org.freedesktop.Avahi.ServiceBrowser object at " - << browser_object_path; + << browser_object_path << " for service_type: " << service_type; absl::MutexLock l(&service_browsers_mutex_); service_browsers_.emplace( diff --git a/internal/platform/wifi_lan.cc b/internal/platform/wifi_lan.cc index 92b760b4..6098ba67 100644 --- a/internal/platform/wifi_lan.cc +++ b/internal/platform/wifi_lan.cc @@ -155,7 +155,10 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_id, service_type_to_services_map_.insert( {service_type, absl::flat_hash_set()}); } - + LOG(INFO)<< " : Before calling Start discovery"; + for (const auto& [key, value] : service_type_to_callback_map_) { + LOG(INFO) << "key=" << key << " value=" << value; + } bool success = impl_->StartDiscovery(service_type, std::move(api_callback)); if (!success) { // If failed, then revert back the insertion.