This PR adds desktop linux implementations for the wifi_lan medium using avahi. The real heroes behind this PR are @vibhavp and @proatgram who have already submitted a PR before. I do not claim credit for most of this code, but I will do my best to fix any bugs and maintain the linux implementation. I decided to make a seperate PR with wifi-lan medium only due to their PR being inactive for the past year. Another reason was that their initial PR was very large with a lot of components added, which might have made it hard to review. All I did was remove wifi_hotspot, wifi_direct, bluetooth_classic and ble. My plan is to create seperate PRs with all those mediums included.
As far as I can tell, all utility classes were referenced directly from the windows implementation. Some files were directly copied and some altered to fit the linux environment. So the bulk of this PR is either the same code in the windows implementation, or slightly altered versions of it
The following is extracted from the original PR
This PR adds an implementation geared towards Desktop Linux systems in internal/platform/implementation/linux. The motivation behind the code is to rely on widely available interfaces to implement mediums, and to use D-Bus as the primary transport for talking to system services. The code is broadly untested (and undocumented!), and is currently missing an implementation for the Bluetooth Low Energy medium, as I still haven't gotten around to understanding BlueZ's LE interfaces, parts of which are currently marked as experimental.
The implementation tries to rely on as few external libraries as possible, and as such, pulls in sdbus-c++, libsystemd, and libcurl via pkg-config rules added to WORKSPACE
Networking
The only supported backend right now is NetworkManager as its status as the de-facto network configuration service on Linux desktops.
Scanning for WiFi APs, creating hotspots, connecting to WiFi networks, and fetching networking and connectivity information is done through the NetworkManager D-Bus APIs.
api::WifiLan uses the Avahi's D-Bus interfaces for performing service discovery and advertising.
api::DeviceInfo
Download and AppData paths are handled using the environment variables specified by the XDG Base Directory Spec.
Screen lock information and support for preventing device sleep is provided via org.freedesktop.login1 (implemented by systemd-logind).
Device type and name are looked up from org.freedesktop.hostname1 (implemented by systemd-hostnamed).
Miscellaneous
api::LogMessage: All LogMessages are sent to a glog LogSink that implements the org.freedesktop.LogControl1 D-Bus interface, to allow the log target and severity threshold to be externally controlled via the default bus connection (at the name com.google.nearby).
HTTP requests are executed using libcurl.
How did you test this change?
Wifi lan medium was tested using the walkietalkie example app that was in @vibhavp's walkietalkie branch. This app broke when the repo was updated to match upstream. It was already broken due to the original creator's own ble updates. I have since cherry picked working versions and it is available on my own walkietalkie branch
Sidenote
I'm learning cpp and bazel as I go so forgive me if I seem a little dense at times
Amazing work. I am happy to see that this project is still being worked on in the Linux/UNIX space. I'm excited to test out the progress that has been achieved.
Summary
This PR adds desktop linux implementations for the
wifi_lan
medium usingavahi
. The real heroes behind this PR are @vibhavp and @proatgram who have already submitted a PR before. I do not claim credit for most of this code, but I will do my best to fix any bugs and maintain the linux implementation. I decided to make a seperate PR withwifi-lan
medium only due to their PR being inactive for the past year. Another reason was that their initial PR was very large with a lot of components added, which might have made it hard to review. All I did was removewifi_hotspot, wifi_direct, bluetooth_classic and ble
. My plan is to create seperate PRs with all those mediums included.As far as I can tell, all utility classes were referenced directly from the
windows
implementation. Some files were directly copied and some altered to fit the linux environment. So the bulk of this PR is either the same code in the windows implementation, or slightly altered versions of itThe following is extracted from the original PR
How did you test this change?
Wifi lan medium was tested using the walkietalkie example app that was in @vibhavp's walkietalkie branch. This app broke when the repo was updated to match upstream. It was already broken due to the original creator's own
ble
updates. I have since cherry picked working versions and it is available on my own walkietalkie branchSidenote
I'm learning cpp and bazel as I go so forgive me if I seem a little dense at times