chromium/services/device/geolocation/wifi_data_provider_linux.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Provides wifi scan API binding for suitable for typical linux distributions.
// Currently, only the NetworkManager API is used, accessed via D-Bus (in turn
// accessed via the GLib wrapper).

#include "services/device/geolocation/wifi_data_provider_linux.h"

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
#include "services/device/geolocation/wifi_data_provider_handle.h"
#include "services/device/public/mojom/geolocation_internals.mojom.h"

namespace device {
namespace {
// The time periods between successive polls of the wifi data.
const int kDefaultPollingIntervalMilliseconds =;           // 10s
const int kNoChangePollingIntervalMilliseconds =;      // 2 mins
const int kTwoNoChangePollingIntervalMilliseconds =;  // 10 mins
const int kNoWifiPollingIntervalMilliseconds =;            // 20s

const char kNetworkManagerServiceName[] =;
const char kNetworkManagerPath[] =;
const char kNetworkManagerInterface[] =;

// From http://projects.gnome.org/NetworkManager/developers/spec.html
enum {};

// Wifi API binding to NetworkManager, to allow reuse of the polling behavior
// defined in WifiDataProviderCommon.
// TODO(joth): NetworkManager also allows for notification based handling,
// however this will require reworking of the threading code to run a GLib
// event loop (GMainLoop).
class NetworkManagerWlanApi : public WifiDataProviderCommon::WlanApiInterface {};

// Convert a wifi frequency to the corresponding channel. Adapted from
// geolocation/wifilib.cc in googleclient (internal to google).
int frquency_in_khz_to_channel(int frequency_khz) {}

NetworkManagerWlanApi::NetworkManagerWlanApi() {}

NetworkManagerWlanApi::~NetworkManagerWlanApi() {}

bool NetworkManagerWlanApi::Init() {}

bool NetworkManagerWlanApi::InitWithBus(scoped_refptr<dbus::Bus> bus) {}

bool NetworkManagerWlanApi::GetAccessPointData(
    WifiData::AccessPointDataSet* data) {}

bool NetworkManagerWlanApi::GetAdapterDeviceList(
    std::vector<dbus::ObjectPath>* device_paths) {}

bool NetworkManagerWlanApi::GetAccessPointsForAdapter(
    const dbus::ObjectPath& adapter_path,
    WifiData::AccessPointDataSet* data) {}

std::unique_ptr<dbus::Response> NetworkManagerWlanApi::GetAccessPointProperty(
    dbus::ObjectProxy* access_point_proxy,
    const std::string& property_name) {}

}  // namespace

// static
WifiDataProvider* WifiDataProviderHandle::DefaultFactoryFunction() {}

WifiDataProviderLinux::WifiDataProviderLinux() {}

WifiDataProviderLinux::~WifiDataProviderLinux() {}

std::unique_ptr<WifiDataProviderCommon::WlanApiInterface>
WifiDataProviderLinux::CreateWlanApi() {}

std::unique_ptr<WifiPollingPolicy>
WifiDataProviderLinux::CreatePollingPolicy() {}

std::unique_ptr<WifiDataProviderCommon::WlanApiInterface>
WifiDataProviderLinux::CreateWlanApiForTesting(scoped_refptr<dbus::Bus> bus) {}

}  // namespace device