Auto hotspot implementation
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
|
||||
namespace sdbus {
|
||||
class IConnection;
|
||||
};
|
||||
|
||||
|
||||
class DBusDispatcher {
|
||||
DBusDispatcher(const DBusDispatcher&) = delete;
|
||||
DBusDispatcher(DBusDispatcher&&) = delete;
|
||||
DBusDispatcher & operator=(const DBusDispatcher&) = delete;
|
||||
DBusDispatcher & operator=(const DBusDispatcher&&) = delete;
|
||||
public:
|
||||
DBusDispatcher(bool systemBus = true);
|
||||
~DBusDispatcher();
|
||||
|
||||
void Run();
|
||||
// Stop everything, shutting down gracefully.
|
||||
void Stop();
|
||||
void Wait();
|
||||
bool IsFinished();
|
||||
|
||||
// Stop, but don't wait. Suitable for use in a signal handler.
|
||||
// The callback is executed by the dispatcher thread, and can therefore call non-signal-safe functions.
|
||||
void SignalStop(std::function<void(void)> &&callback);
|
||||
|
||||
bool IsStopping();
|
||||
|
||||
using PostHandle = uint64_t;
|
||||
using PostCallback = std::function<void()>;
|
||||
PostHandle Post(PostCallback&&fn);
|
||||
|
||||
using clock = std::chrono::steady_clock;
|
||||
|
||||
template<class REP,class PERIOD>
|
||||
DBusDispatcher::PostHandle PostDelayed(const std::chrono::duration<REP,PERIOD>&delay,PostCallback&&fn)
|
||||
{
|
||||
return PostDelayed(
|
||||
std::chrono::duration_cast<clock::duration,REP,PERIOD>(delay),
|
||||
std::move(fn));
|
||||
}
|
||||
|
||||
DBusDispatcher::PostHandle PostDelayed(const clock::duration&delay,PostCallback&&fn);
|
||||
|
||||
bool CancelPost(DBusDispatcher::PostHandle handle);
|
||||
|
||||
sdbus::IConnection&Connection() { return *busConnection;}
|
||||
|
||||
private:
|
||||
std::atomic<bool> isFinished;
|
||||
std::atomic<bool> signalStopRequested;
|
||||
bool signalStopExecuted = false;
|
||||
std::function<void(void)> signalStopCallback;
|
||||
uint64_t NextHandle() {
|
||||
return nextHandle.fetch_add(1);
|
||||
}
|
||||
int GetEventTimeoutMs();
|
||||
std::atomic<PostHandle> nextHandle;
|
||||
int eventFd = -1;
|
||||
bool closed = false;
|
||||
void ThreadProc();
|
||||
void WakeThread();
|
||||
std::unique_ptr<sdbus::IConnection> busConnection;
|
||||
|
||||
struct CallbackEntry {
|
||||
PostCallback callback;
|
||||
clock::time_point time;
|
||||
PostHandle handle;
|
||||
};
|
||||
|
||||
std::atomic<bool> stopping;
|
||||
|
||||
std::vector<CallbackEntry> postedEvents;
|
||||
bool threadJoined;
|
||||
std::thread serviceThread;
|
||||
std::mutex postMutex;
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
|
||||
namespace impl {
|
||||
extern std::atomic<uint64_t> NextHandle;
|
||||
}
|
||||
|
||||
using DBusEventHandle=uint64_t;
|
||||
constexpr DBusEventHandle INVALID_DBUS_EVENT_HANDLE = 0;
|
||||
|
||||
|
||||
template <typename... ARG_TYPES>
|
||||
class DBusEvent {
|
||||
public:
|
||||
using Callback=std::function<void (ARG_TYPES...)>;
|
||||
|
||||
|
||||
DBusEventHandle add(Callback&&cb)
|
||||
{
|
||||
auto handle = impl::NextHandle.fetch_add(1,std::memory_order::acq_rel);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{m};
|
||||
callbacks[handle] = std::make_shared<Callback>(std::move(cb));
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
void remove(DBusEventHandle h)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{m};
|
||||
callbacks.erase(h);
|
||||
}
|
||||
|
||||
void fire(ARG_TYPES...args)
|
||||
{
|
||||
std::vector<std::shared_ptr<Callback>> cbs;
|
||||
cbs.reserve(callbacks.size());
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{m};
|
||||
for (const auto &cb: callbacks)
|
||||
{
|
||||
cbs.push_back(cb.second);
|
||||
}
|
||||
}
|
||||
for (auto&cb: cbs)
|
||||
{
|
||||
(*cb)(args...);
|
||||
}
|
||||
{
|
||||
// destruct shared_ptrs with mutex held.
|
||||
std::lock_guard<std::mutex> lock{m};
|
||||
cbs.clear();
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::map<DBusEventHandle,std::shared_ptr<Callback>> callbacks;
|
||||
std::mutex m;
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <filesystem>
|
||||
|
||||
enum class DBusLogLevel {
|
||||
Trace,
|
||||
Debug,
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
None
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
extern std::mutex logMutex;
|
||||
extern DBusLogLevel dbusLogLevel;
|
||||
}
|
||||
extern void SetDBusLogLevel(DBusLogLevel level);
|
||||
inline DBusLogLevel GetDBusLogLevel() {
|
||||
return impl::dbusLogLevel;
|
||||
}
|
||||
inline bool IsDBusLoggingEnabled(DBusLogLevel level) {
|
||||
return level >= impl::dbusLogLevel;
|
||||
}
|
||||
|
||||
class IDBusLogger {
|
||||
public:
|
||||
IDBusLogger() {}
|
||||
virtual ~IDBusLogger() { }
|
||||
virtual void LogError(const std::string&message) = 0;
|
||||
virtual void LogWarning(const std::string&message) = 0;
|
||||
virtual void LogInfo(const std::string&message) = 0;
|
||||
virtual void LogDebug(const std::string&message) = 0;
|
||||
virtual void LogTrace(const std::string&message) = 0;
|
||||
|
||||
};
|
||||
|
||||
void SetDBusConsoleLogger();
|
||||
void AddDBusConsoleLogger();
|
||||
void SetDBusSystemdLogger();
|
||||
void SetDBusFileLogger(const std::filesystem::path &path);
|
||||
void SetDBusLogger(std::unique_ptr<IDBusLogger>&&logger);
|
||||
|
||||
extern void LogError(const std::string&path,const char*method,const std::string&message);
|
||||
extern void LogInfo(const std::string&path,const char*method,const std::string&message);
|
||||
extern void LogDebug(const std::string&path,const char*method,const std::string&message);
|
||||
extern void LogWarning(const std::string&path,const char*method,const std::string&message);
|
||||
extern void LogTrace(const std::string&path,const char*method,const std::string&message);
|
||||
|
||||
extern void LogTrace(const std::string&path,const char*method,const std::function<std::string ()> &text);
|
||||
extern void LogDebug(const std::string&path,const char*method,const std::function<std::string ()> &text);
|
||||
extern void LogInfo(const std::string&path,const char*method,const std::function<std::string ()> &text);
|
||||
extern void LogWarning(const std::string&path,const char*method,const std::function<std::string ()> &text);
|
||||
extern void LogError(const std::string&path,const char*method,const std::function<std::string ()> &text);
|
||||
|
||||
|
||||
|
||||
class DBusLog {
|
||||
protected:
|
||||
DBusLog(const std::string &path)
|
||||
:path(path)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void LogError(const char*tag,const std::string&message)
|
||||
{
|
||||
::LogError(path,tag,message);
|
||||
}
|
||||
void LogWarning(const char *tag, const std::string&message)
|
||||
{
|
||||
::LogWarning(path,tag,message);
|
||||
}
|
||||
void LogDebug(const char*tag, const std::string &text)
|
||||
{
|
||||
::LogDebug(path,tag,text);
|
||||
}
|
||||
void LogDebug(const char*tag, const std::function<std::string ()> &text)
|
||||
{
|
||||
if (impl::dbusLogLevel > DBusLogLevel::Debug) return;
|
||||
::LogDebug(path,tag,text());
|
||||
}
|
||||
void LogTrace(const char*tag, const std::string &text)
|
||||
{
|
||||
::LogTrace(path,tag,text);
|
||||
}
|
||||
void LogTrace(const char*tag, const std::function<std::string ()> &text)
|
||||
{
|
||||
if (impl::dbusLogLevel > DBusLogLevel::Trace) return;
|
||||
::LogTrace(path,tag,text());
|
||||
}
|
||||
private:
|
||||
std::string path;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
|
||||
namespace sdbus {
|
||||
class Variant;
|
||||
}
|
||||
|
||||
extern std::ostream&operator<<(std::ostream&s, const sdbus::Variant&v);
|
||||
extern std::ostream&operator<<(std::ostream&s,const std::map<std::string, sdbus::Variant>& properties);
|
||||
@@ -0,0 +1,348 @@
|
||||
#pragma once
|
||||
|
||||
#include "DBusEvent.hpp"
|
||||
#include "DBusLog.hpp"
|
||||
#include "DBusDispatcher.hpp"
|
||||
|
||||
#include "dbus/org.freedesktop.NetworkManager.Device.WifiP2P.hpp"
|
||||
#include "dbus/org.freedesktop.NetworkManager.Device.hpp"
|
||||
#include "dbus/org.freedesktop.NetworkManager.Device.Wireless.hpp"
|
||||
#include "dbus/org.freedesktop.NetworkManager.Settings.Connection.hpp"
|
||||
#include "dbus/org.freedesktop.NetworkManager.WifiP2PPeer.hpp"
|
||||
#include "dbus/org.freedesktop.NetworkManager.AccessPoint.hpp"
|
||||
#include "dbus/org.freedesktop.NetworkManager.Connection.Active.hpp"
|
||||
|
||||
#include "dbus/org.freedesktop.NetworkManager.hpp"
|
||||
|
||||
#include "libnm/nm-dbus-interface.h"
|
||||
|
||||
namespace dbus::networkmanager {
|
||||
namespace nm_impl
|
||||
{
|
||||
extern std::string NetworkManagerStateToString(uint32_t state);
|
||||
std::string NetworkManagerDeviceStateToString(uint32_t state);
|
||||
};
|
||||
|
||||
class NetworkManager : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager_proxy>
|
||||
{
|
||||
public:
|
||||
using ptr = std::unique_ptr<NetworkManager>;
|
||||
NetworkManager(DBusDispatcher &dispatcher)
|
||||
: sdbus::ProxyInterfaces<org::freedesktop::NetworkManager_proxy>(
|
||||
dispatcher.Connection(),
|
||||
INTERFACE_NAME,
|
||||
"/org/freedesktop/NetworkManager")
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~NetworkManager()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
|
||||
static ptr Create(DBusDispatcher &dispatcher) { return std::make_unique<NetworkManager>(dispatcher); }
|
||||
DBusEvent<> OnCheckPermissions;
|
||||
DBusEvent<uint32_t> OnStateChanged;
|
||||
DBusEvent<const sdbus::ObjectPath &> OnDeviceAdded;
|
||||
DBusEvent<const sdbus::ObjectPath &> OnDeviceRemoved;
|
||||
|
||||
private:
|
||||
void EventTrace(const char *method, const std::string &message)
|
||||
{
|
||||
LogTrace(getObjectPath(), method, message);
|
||||
}
|
||||
virtual void onStateChanged(const uint32_t &state)
|
||||
{
|
||||
EventTrace("onStateChanged", nm_impl::NetworkManagerStateToString(state));
|
||||
OnStateChanged.fire(state);
|
||||
}
|
||||
|
||||
virtual void onCheckPermissions() { OnCheckPermissions.fire(); }
|
||||
|
||||
virtual void onDeviceAdded(const sdbus::ObjectPath &device_path)
|
||||
{
|
||||
EventTrace("onDeviceAdded", device_path.c_str());
|
||||
OnDeviceAdded.fire(device_path);
|
||||
}
|
||||
virtual void onDeviceRemoved(const sdbus::ObjectPath &device_path)
|
||||
{
|
||||
EventTrace("onDeviceRemoved", device_path.c_str());
|
||||
|
||||
OnDeviceRemoved.fire(device_path);
|
||||
}
|
||||
};
|
||||
|
||||
class Device : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::Device_proxy>
|
||||
{
|
||||
public:
|
||||
using ptr = std::unique_ptr<Device>;
|
||||
Device(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
: sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::Device_proxy>(
|
||||
dispatcher.Connection(),
|
||||
"org.freedesktop.NetworkManager",
|
||||
path)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~Device()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
|
||||
static ptr Create(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
{
|
||||
return std::make_unique<Device>(dispatcher, path);
|
||||
}
|
||||
DBusEvent<uint32_t, uint32_t, uint32_t> OnStateChanged;
|
||||
|
||||
private:
|
||||
const uint32_t NM_DEVICE_TYPE_WIFI_P2P = 30; // from lbnm-dev package.
|
||||
public:
|
||||
bool IsP2pDevice()
|
||||
{
|
||||
return this->DeviceType() == NM_DEVICE_TYPE_WIFI_P2P;
|
||||
}
|
||||
|
||||
private:
|
||||
void EventTrace(const char *method, const std::string &message)
|
||||
{
|
||||
LogTrace(getObjectPath(), method, message);
|
||||
}
|
||||
|
||||
virtual void onStateChanged(const uint32_t &new_state, const uint32_t &old_state, const uint32_t &reason)
|
||||
{
|
||||
EventTrace("onStateChanged", nm_impl::NetworkManagerDeviceStateToString(new_state));
|
||||
|
||||
OnStateChanged.fire(new_state, old_state, reason);
|
||||
}
|
||||
};
|
||||
class WifiP2P : public sdbus::ProxyInterfaces<
|
||||
org::freedesktop::NetworkManager::Device::WifiP2P_proxy>
|
||||
{
|
||||
public:
|
||||
using ptr = std::unique_ptr<WifiP2P>;
|
||||
using base = sdbus::ProxyInterfaces<
|
||||
org::freedesktop::NetworkManager::Device::WifiP2P_proxy>;
|
||||
|
||||
WifiP2P(DBusDispatcher &dispatcher, const std::string &objectPath)
|
||||
: base(dispatcher.Connection(), "org.freedesktop.NetworkManager", objectPath)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~WifiP2P()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
static ptr Create(DBusDispatcher &dispatcher, const std::string &objectPath)
|
||||
{
|
||||
return std::make_unique<WifiP2P>(dispatcher, objectPath);
|
||||
}
|
||||
DBusEvent<const sdbus::ObjectPath &> OnPeerAdded;
|
||||
DBusEvent<const sdbus::ObjectPath &> OnPeerRemoved;
|
||||
DBusEvent<uint32_t> OnStateChanged;
|
||||
|
||||
private:
|
||||
void EventTrace(const char *method, const std::string &message)
|
||||
{
|
||||
LogTrace(getObjectPath(), method, message);
|
||||
}
|
||||
virtual void onStateChanged(const uint32_t &new_state, const uint32_t &old_state, const uint32_t &reason)
|
||||
{
|
||||
EventTrace("onStateChanged", nm_impl::NetworkManagerStateToString(new_state));
|
||||
|
||||
OnStateChanged.fire(new_state);
|
||||
}
|
||||
|
||||
virtual void onPeerAdded(const sdbus::ObjectPath &peer)
|
||||
{
|
||||
EventTrace("onPeerAdded", peer);
|
||||
OnPeerAdded.fire(peer);
|
||||
}
|
||||
virtual void onPeerRemoved(const sdbus::ObjectPath &peer)
|
||||
{
|
||||
EventTrace("onPeerRemoved", peer);
|
||||
OnPeerRemoved.fire(peer);
|
||||
}
|
||||
};
|
||||
|
||||
class Connection : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::Settings::Connection_proxy>
|
||||
{
|
||||
public:
|
||||
using self = Connection;
|
||||
using ptr = std::unique_ptr<self>;
|
||||
|
||||
Connection(DBusDispatcher &dispatcher, const sdbus::ObjectPath &objectPath)
|
||||
: sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::Settings::Connection_proxy>(
|
||||
dispatcher.Connection(), "org.freedesktop.NetworkManager", objectPath)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
|
||||
static ptr Create(DBusDispatcher &dispatcher, const sdbus::ObjectPath &objectPath)
|
||||
{
|
||||
return std::make_unique<self>(dispatcher, objectPath);
|
||||
}
|
||||
|
||||
virtual ~Connection()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
DBusEvent<> OnUpdated;
|
||||
DBusEvent<> OnRemoved;
|
||||
|
||||
private:
|
||||
virtual void onUpdated() override
|
||||
{
|
||||
OnUpdated.fire();
|
||||
}
|
||||
virtual void onRemoved() override
|
||||
{
|
||||
OnRemoved.fire();
|
||||
}
|
||||
};
|
||||
class WifiP2PPeer : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::WifiP2PPeer_proxy>
|
||||
{
|
||||
public:
|
||||
using self = WifiP2PPeer;
|
||||
using ptr = std::unique_ptr<self>;
|
||||
|
||||
WifiP2PPeer(DBusDispatcher &dispatcher, const sdbus::ObjectPath &objectPath)
|
||||
: sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::WifiP2PPeer_proxy>(
|
||||
dispatcher.Connection(), "org.freedesktop.NetworkManager", objectPath)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~WifiP2PPeer()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
static ptr Create(DBusDispatcher &dispatcher, const sdbus::ObjectPath &objectPath)
|
||||
{
|
||||
return std::make_unique<self>(dispatcher, objectPath);
|
||||
}
|
||||
DBusEvent<const sdbus::ObjectPath &> OnPeerAdded;
|
||||
DBusEvent<const sdbus::ObjectPath &> OnPeerRemoved;
|
||||
|
||||
private:
|
||||
virtual void onPeerAdded(const sdbus::ObjectPath &peer)
|
||||
{
|
||||
OnPeerAdded.fire(peer);
|
||||
}
|
||||
virtual void onPeerRemoved(const sdbus::ObjectPath &peer)
|
||||
{
|
||||
OnPeerRemoved.fire(peer);
|
||||
}
|
||||
};
|
||||
|
||||
class DeviceWireless : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::Device::Wireless_proxy>
|
||||
{
|
||||
public:
|
||||
using self = DeviceWireless;
|
||||
using ptr = std::unique_ptr<self>;
|
||||
using proxy_t = org::freedesktop::NetworkManager::Device::Wireless_proxy;
|
||||
DeviceWireless(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
: sdbus::ProxyInterfaces<proxy_t>(
|
||||
dispatcher.Connection(),
|
||||
"org.freedesktop.NetworkManager",
|
||||
path)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~DeviceWireless()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
|
||||
static ptr Create(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
{
|
||||
return std::make_unique<self>(dispatcher, path);
|
||||
}
|
||||
DBusEvent<const sdbus::ObjectPath&> OnAccessPointAdded;
|
||||
DBusEvent<const sdbus::ObjectPath&> OnAccessPointRemoved;
|
||||
protected:
|
||||
void EventTrace(const char *method, const std::string &message)
|
||||
{
|
||||
LogTrace(getObjectPath(), method, message);
|
||||
}
|
||||
|
||||
virtual void onAccessPointAdded(const sdbus::ObjectPath& access_point) override {
|
||||
EventTrace("onAccessPointAdded", access_point.c_str());
|
||||
OnAccessPointAdded.fire(access_point);
|
||||
}
|
||||
virtual void onAccessPointRemoved(const sdbus::ObjectPath& access_point) {
|
||||
EventTrace("onAccessPointRemoved",access_point.c_str());
|
||||
|
||||
OnAccessPointRemoved.fire(access_point);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class AccessPoint : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::AccessPoint_proxy>
|
||||
{
|
||||
public:
|
||||
using self = AccessPoint;
|
||||
using ptr = std::unique_ptr<self>;
|
||||
using proxy_t = org::freedesktop::NetworkManager::AccessPoint_proxy;
|
||||
|
||||
AccessPoint(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
: sdbus::ProxyInterfaces<proxy_t>(
|
||||
dispatcher.Connection(),
|
||||
"org.freedesktop.NetworkManager",
|
||||
path)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~AccessPoint()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
|
||||
static ptr Create(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
{
|
||||
return std::make_unique<self>(dispatcher, path);
|
||||
}
|
||||
protected:
|
||||
void EventTrace(const char *method, const std::string &message)
|
||||
{
|
||||
LogTrace(getObjectPath(), method, message);
|
||||
}
|
||||
};
|
||||
class ActiveConnection : public sdbus::ProxyInterfaces<org::freedesktop::NetworkManager::Connection::Active_proxy>
|
||||
{
|
||||
public:
|
||||
using self = ActiveConnection;
|
||||
using ptr = std::unique_ptr<self>;
|
||||
using proxy_t = org::freedesktop::NetworkManager::Connection::Active_proxy;
|
||||
|
||||
ActiveConnection(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
: sdbus::ProxyInterfaces<proxy_t>(
|
||||
dispatcher.Connection(),
|
||||
"org.freedesktop.NetworkManager",
|
||||
path)
|
||||
{
|
||||
registerProxy();
|
||||
}
|
||||
virtual ~ActiveConnection()
|
||||
{
|
||||
unregisterProxy();
|
||||
}
|
||||
|
||||
static ptr Create(DBusDispatcher &dispatcher, const sdbus::ObjectPath &path)
|
||||
{
|
||||
return std::make_unique<self>(dispatcher, path);
|
||||
}
|
||||
DBusEvent<uint32_t,uint32_t> OnStateChanged;
|
||||
protected:
|
||||
void EventTrace(const char *method, const std::string &message)
|
||||
{
|
||||
LogTrace(getObjectPath(), method, message);
|
||||
}
|
||||
virtual void onStateChanged(const uint32_t& state, const uint32_t& reason) {
|
||||
OnStateChanged.fire(state,reason);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
@@ -21,6 +21,23 @@
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
||||
#ifndef NEW_WIFI_CONFIG
|
||||
// 0-> Old hostapd-based hotspot. Now dead code. Works with buster only.
|
||||
// 1-> NetworkManager-based hotspot (supported on bookworm or later).
|
||||
#define NEW_WIFI_CONFIG 1
|
||||
#endif
|
||||
|
||||
// Wifi P2P broken completely on Debian 12 updates on raspberry pi.
|
||||
//
|
||||
// Setting it to enable uses current-orphaned dead code as of PiPedal v1.2.49
|
||||
//
|
||||
// 0: disable.
|
||||
// 1: enable.
|
||||
#ifndef ENABLE_WIFI_P2P
|
||||
#define ENABLE_WIFI_P2P 0
|
||||
#endif
|
||||
|
||||
namespace pipedal {
|
||||
|
||||
|
||||
@@ -30,6 +47,12 @@ namespace pipedal {
|
||||
|
||||
class WifiConfigSettings {
|
||||
public:
|
||||
using ssid_t = std::vector<uint8_t>;
|
||||
WifiConfigSettings();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
bool valid_ = false;
|
||||
bool wifiWarningGiven_ = false;
|
||||
bool rebootRequired_ = false;
|
||||
@@ -37,13 +60,20 @@ namespace pipedal {
|
||||
std::string countryCode_ = "US"; // iso 3661
|
||||
std::string hotspotName_ = "pipedal";
|
||||
std::string mdnsName_ = "pipedal";
|
||||
std::vector<ssid_t> homeNetworks_;
|
||||
bool hasPassword_ = false;
|
||||
std::string password_;
|
||||
std::string channel_ = "g6";
|
||||
std::string channel_ = "";
|
||||
bool alwaysOn_ = false;
|
||||
|
||||
void ParseArguments(const std::vector<std::string> &arguments);
|
||||
static bool ValidateCountryCode(const std::string&value);
|
||||
static bool ValidateChannel(const std::string&countryCode,const std::string&value);
|
||||
|
||||
bool operator==(const WifiConfigSettings&other) const;
|
||||
bool ConfigurationChanged(const WifiConfigSettings&other) const;
|
||||
bool WantsHotspot(bool ethernetConnected,const std::vector<ssid_t> &availableNetworks);
|
||||
|
||||
public:
|
||||
DECLARE_JSON_MAP(WifiConfigSettings);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_AccessPoint_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_AccessPoint_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class AccessPoint_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.AccessPoint";
|
||||
|
||||
protected:
|
||||
AccessPoint_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~AccessPoint_proxy() = default;
|
||||
|
||||
public:
|
||||
uint32_t Flags()
|
||||
{
|
||||
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t WpaFlags()
|
||||
{
|
||||
return proxy_.getProperty("WpaFlags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t RsnFlags()
|
||||
{
|
||||
return proxy_.getProperty("RsnFlags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> Ssid()
|
||||
{
|
||||
return proxy_.getProperty("Ssid").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Frequency()
|
||||
{
|
||||
return proxy_.getProperty("Frequency").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string HwAddress()
|
||||
{
|
||||
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Mode()
|
||||
{
|
||||
return proxy_.getProperty("Mode").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t MaxBitrate()
|
||||
{
|
||||
return proxy_.getProperty("MaxBitrate").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint8_t Strength()
|
||||
{
|
||||
return proxy_.getProperty("Strength").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
int32_t LastSeen()
|
||||
{
|
||||
return proxy_.getProperty("LastSeen").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Connection_Active_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Connection_Active_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
namespace Connection {
|
||||
|
||||
class Active_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Connection.Active";
|
||||
|
||||
protected:
|
||||
Active_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("StateChanged").onInterface(INTERFACE_NAME).call([this](const uint32_t& state, const uint32_t& reason){ this->onStateChanged(state, reason); });
|
||||
}
|
||||
|
||||
~Active_proxy() = default;
|
||||
|
||||
virtual void onStateChanged(const uint32_t& state, const uint32_t& reason) = 0;
|
||||
|
||||
public:
|
||||
sdbus::ObjectPath Connection()
|
||||
{
|
||||
return proxy_.getProperty("Connection").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath SpecificObject()
|
||||
{
|
||||
return proxy_.getProperty("SpecificObject").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Id()
|
||||
{
|
||||
return proxy_.getProperty("Id").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Uuid()
|
||||
{
|
||||
return proxy_.getProperty("Uuid").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Type()
|
||||
{
|
||||
return proxy_.getProperty("Type").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> Devices()
|
||||
{
|
||||
return proxy_.getProperty("Devices").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t State()
|
||||
{
|
||||
return proxy_.getProperty("State").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t StateFlags()
|
||||
{
|
||||
return proxy_.getProperty("StateFlags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool Default()
|
||||
{
|
||||
return proxy_.getProperty("Default").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Ip4Config()
|
||||
{
|
||||
return proxy_.getProperty("Ip4Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Dhcp4Config()
|
||||
{
|
||||
return proxy_.getProperty("Dhcp4Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool Default6()
|
||||
{
|
||||
return proxy_.getProperty("Default6").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Ip6Config()
|
||||
{
|
||||
return proxy_.getProperty("Ip6Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Dhcp6Config()
|
||||
{
|
||||
return proxy_.getProperty("Dhcp6Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool Vpn()
|
||||
{
|
||||
return proxy_.getProperty("Vpn").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Controller()
|
||||
{
|
||||
return proxy_.getProperty("Controller").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Master()
|
||||
{
|
||||
return proxy_.getProperty("Master").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_DHCP4Config_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_DHCP4Config_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class DHCP4Config_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.DHCP4Config";
|
||||
|
||||
protected:
|
||||
DHCP4Config_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~DHCP4Config_proxy() = default;
|
||||
|
||||
public:
|
||||
std::map<std::string, sdbus::Variant> Options()
|
||||
{
|
||||
return proxy_.getProperty("Options").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_DHCP6Config_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_DHCP6Config_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class DHCP6Config_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.DHCP6Config";
|
||||
|
||||
protected:
|
||||
DHCP6Config_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~DHCP6Config_proxy() = default;
|
||||
|
||||
public:
|
||||
std::map<std::string, sdbus::Variant> Options()
|
||||
{
|
||||
return proxy_.getProperty("Options").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_Statistics_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_Statistics_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
namespace Device {
|
||||
|
||||
class Statistics_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Device.Statistics";
|
||||
|
||||
protected:
|
||||
Statistics_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~Statistics_proxy() = default;
|
||||
|
||||
public:
|
||||
uint32_t RefreshRateMs()
|
||||
{
|
||||
return proxy_.getProperty("RefreshRateMs").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void RefreshRateMs(const uint32_t& value)
|
||||
{
|
||||
proxy_.setProperty("RefreshRateMs").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
uint64_t TxBytes()
|
||||
{
|
||||
return proxy_.getProperty("TxBytes").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint64_t RxBytes()
|
||||
{
|
||||
return proxy_.getProperty("RxBytes").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_WifiP2P_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_WifiP2P_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
namespace Device {
|
||||
|
||||
class WifiP2P_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Device.WifiP2P";
|
||||
|
||||
protected:
|
||||
WifiP2P_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("PeerAdded").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& peer){ this->onPeerAdded(peer); });
|
||||
proxy_.uponSignal("PeerRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& peer){ this->onPeerRemoved(peer); });
|
||||
}
|
||||
|
||||
~WifiP2P_proxy() = default;
|
||||
|
||||
virtual void onPeerAdded(const sdbus::ObjectPath& peer) = 0;
|
||||
virtual void onPeerRemoved(const sdbus::ObjectPath& peer) = 0;
|
||||
|
||||
public:
|
||||
void StartFind(const std::map<std::string, sdbus::Variant>& options)
|
||||
{
|
||||
proxy_.callMethod("StartFind").onInterface(INTERFACE_NAME).withArguments(options);
|
||||
}
|
||||
|
||||
void StopFind()
|
||||
{
|
||||
proxy_.callMethod("StopFind").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
public:
|
||||
std::string HwAddress()
|
||||
{
|
||||
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> Peers()
|
||||
{
|
||||
return proxy_.getProperty("Peers").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,103 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_Wireless_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_Wireless_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
namespace Device {
|
||||
|
||||
class Wireless_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Device.Wireless";
|
||||
|
||||
protected:
|
||||
Wireless_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("AccessPointAdded").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& access_point){ this->onAccessPointAdded(access_point); });
|
||||
proxy_.uponSignal("AccessPointRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& access_point){ this->onAccessPointRemoved(access_point); });
|
||||
}
|
||||
|
||||
~Wireless_proxy() = default;
|
||||
|
||||
virtual void onAccessPointAdded(const sdbus::ObjectPath& access_point) = 0;
|
||||
virtual void onAccessPointRemoved(const sdbus::ObjectPath& access_point) = 0;
|
||||
|
||||
public:
|
||||
std::vector<sdbus::ObjectPath> GetAccessPoints()
|
||||
{
|
||||
std::vector<sdbus::ObjectPath> result;
|
||||
proxy_.callMethod("GetAccessPoints").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> GetAllAccessPoints()
|
||||
{
|
||||
std::vector<sdbus::ObjectPath> result;
|
||||
proxy_.callMethod("GetAllAccessPoints").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void RequestScan(const std::map<std::string, sdbus::Variant>& options)
|
||||
{
|
||||
proxy_.callMethod("RequestScan").onInterface(INTERFACE_NAME).withArguments(options);
|
||||
}
|
||||
|
||||
public:
|
||||
std::string HwAddress()
|
||||
{
|
||||
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string PermHwAddress()
|
||||
{
|
||||
return proxy_.getProperty("PermHwAddress").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Mode()
|
||||
{
|
||||
return proxy_.getProperty("Mode").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Bitrate()
|
||||
{
|
||||
return proxy_.getProperty("Bitrate").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> AccessPoints()
|
||||
{
|
||||
return proxy_.getProperty("AccessPoints").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath ActiveAccessPoint()
|
||||
{
|
||||
return proxy_.getProperty("ActiveAccessPoint").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t WirelessCapabilities()
|
||||
{
|
||||
return proxy_.getProperty("WirelessCapabilities").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
int64_t LastScan()
|
||||
{
|
||||
return proxy_.getProperty("LastScan").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,233 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Device_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class Device_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Device";
|
||||
|
||||
protected:
|
||||
Device_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("StateChanged").onInterface(INTERFACE_NAME).call([this](const uint32_t& new_state, const uint32_t& old_state, const uint32_t& reason){ this->onStateChanged(new_state, old_state, reason); });
|
||||
}
|
||||
|
||||
~Device_proxy() = default;
|
||||
|
||||
virtual void onStateChanged(const uint32_t& new_state, const uint32_t& old_state, const uint32_t& reason) = 0;
|
||||
|
||||
public:
|
||||
void Reapply(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection, const uint64_t& version_id, const uint32_t& flags)
|
||||
{
|
||||
proxy_.callMethod("Reapply").onInterface(INTERFACE_NAME).withArguments(connection, version_id, flags);
|
||||
}
|
||||
|
||||
std::tuple<std::map<std::string, std::map<std::string, sdbus::Variant>>, uint64_t> GetAppliedConnection(const uint32_t& flags)
|
||||
{
|
||||
std::tuple<std::map<std::string, std::map<std::string, sdbus::Variant>>, uint64_t> result;
|
||||
proxy_.callMethod("GetAppliedConnection").onInterface(INTERFACE_NAME).withArguments(flags).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Disconnect()
|
||||
{
|
||||
proxy_.callMethod("Disconnect").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void Delete()
|
||||
{
|
||||
proxy_.callMethod("Delete").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
public:
|
||||
std::string Udi()
|
||||
{
|
||||
return proxy_.getProperty("Udi").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Path()
|
||||
{
|
||||
return proxy_.getProperty("Path").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Interface()
|
||||
{
|
||||
return proxy_.getProperty("Interface").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string IpInterface()
|
||||
{
|
||||
return proxy_.getProperty("IpInterface").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Driver()
|
||||
{
|
||||
return proxy_.getProperty("Driver").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string DriverVersion()
|
||||
{
|
||||
return proxy_.getProperty("DriverVersion").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string FirmwareVersion()
|
||||
{
|
||||
return proxy_.getProperty("FirmwareVersion").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Capabilities()
|
||||
{
|
||||
return proxy_.getProperty("Capabilities").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Ip4Address()
|
||||
{
|
||||
return proxy_.getProperty("Ip4Address").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t State()
|
||||
{
|
||||
return proxy_.getProperty("State").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::Struct<uint32_t, uint32_t> StateReason()
|
||||
{
|
||||
return proxy_.getProperty("StateReason").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath ActiveConnection()
|
||||
{
|
||||
return proxy_.getProperty("ActiveConnection").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Ip4Config()
|
||||
{
|
||||
return proxy_.getProperty("Ip4Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Dhcp4Config()
|
||||
{
|
||||
return proxy_.getProperty("Dhcp4Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Ip6Config()
|
||||
{
|
||||
return proxy_.getProperty("Ip6Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath Dhcp6Config()
|
||||
{
|
||||
return proxy_.getProperty("Dhcp6Config").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool Managed()
|
||||
{
|
||||
return proxy_.getProperty("Managed").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void Managed(const bool& value)
|
||||
{
|
||||
proxy_.setProperty("Managed").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
bool Autoconnect()
|
||||
{
|
||||
return proxy_.getProperty("Autoconnect").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void Autoconnect(const bool& value)
|
||||
{
|
||||
proxy_.setProperty("Autoconnect").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
bool FirmwareMissing()
|
||||
{
|
||||
return proxy_.getProperty("FirmwareMissing").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool NmPluginMissing()
|
||||
{
|
||||
return proxy_.getProperty("NmPluginMissing").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t DeviceType()
|
||||
{
|
||||
return proxy_.getProperty("DeviceType").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> AvailableConnections()
|
||||
{
|
||||
return proxy_.getProperty("AvailableConnections").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string PhysicalPortId()
|
||||
{
|
||||
return proxy_.getProperty("PhysicalPortId").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Mtu()
|
||||
{
|
||||
return proxy_.getProperty("Mtu").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Metered()
|
||||
{
|
||||
return proxy_.getProperty("Metered").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> LldpNeighbors()
|
||||
{
|
||||
return proxy_.getProperty("LldpNeighbors").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool Real()
|
||||
{
|
||||
return proxy_.getProperty("Real").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Ip4Connectivity()
|
||||
{
|
||||
return proxy_.getProperty("Ip4Connectivity").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Ip6Connectivity()
|
||||
{
|
||||
return proxy_.getProperty("Ip6Connectivity").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t InterfaceFlags()
|
||||
{
|
||||
return proxy_.getProperty("InterfaceFlags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string HwAddress()
|
||||
{
|
||||
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> Ports()
|
||||
{
|
||||
return proxy_.getProperty("Ports").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_DnsManager_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_DnsManager_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class DnsManager_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.DnsManager";
|
||||
|
||||
protected:
|
||||
DnsManager_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~DnsManager_proxy() = default;
|
||||
|
||||
public:
|
||||
std::string Mode()
|
||||
{
|
||||
return proxy_.getProperty("Mode").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string RcManager()
|
||||
{
|
||||
return proxy_.getProperty("RcManager").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> Configuration()
|
||||
{
|
||||
return proxy_.getProperty("Configuration").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_IP4Config_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_IP4Config_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class IP4Config_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.IP4Config";
|
||||
|
||||
protected:
|
||||
IP4Config_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~IP4Config_proxy() = default;
|
||||
|
||||
public:
|
||||
std::vector<std::vector<uint32_t>> Addresses()
|
||||
{
|
||||
return proxy_.getProperty("Addresses").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> AddressData()
|
||||
{
|
||||
return proxy_.getProperty("AddressData").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Gateway()
|
||||
{
|
||||
return proxy_.getProperty("Gateway").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::vector<uint32_t>> Routes()
|
||||
{
|
||||
return proxy_.getProperty("Routes").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> RouteData()
|
||||
{
|
||||
return proxy_.getProperty("RouteData").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<uint32_t> Nameservers()
|
||||
{
|
||||
return proxy_.getProperty("Nameservers").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> NameserverData()
|
||||
{
|
||||
return proxy_.getProperty("NameserverData").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> Domains()
|
||||
{
|
||||
return proxy_.getProperty("Domains").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> Searches()
|
||||
{
|
||||
return proxy_.getProperty("Searches").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> DnsOptions()
|
||||
{
|
||||
return proxy_.getProperty("DnsOptions").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
int32_t DnsPriority()
|
||||
{
|
||||
return proxy_.getProperty("DnsPriority").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<uint32_t> WinsServers()
|
||||
{
|
||||
return proxy_.getProperty("WinsServers").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> WinsServerData()
|
||||
{
|
||||
return proxy_.getProperty("WinsServerData").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_IP6Config_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_IP6Config_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class IP6Config_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.IP6Config";
|
||||
|
||||
protected:
|
||||
IP6Config_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~IP6Config_proxy() = default;
|
||||
|
||||
public:
|
||||
std::vector<sdbus::Struct<std::vector<uint8_t>, uint32_t, std::vector<uint8_t>>> Addresses()
|
||||
{
|
||||
return proxy_.getProperty("Addresses").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> AddressData()
|
||||
{
|
||||
return proxy_.getProperty("AddressData").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Gateway()
|
||||
{
|
||||
return proxy_.getProperty("Gateway").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::Struct<std::vector<uint8_t>, uint32_t, std::vector<uint8_t>, uint32_t>> Routes()
|
||||
{
|
||||
return proxy_.getProperty("Routes").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, sdbus::Variant>> RouteData()
|
||||
{
|
||||
return proxy_.getProperty("RouteData").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::vector<uint8_t>> Nameservers()
|
||||
{
|
||||
return proxy_.getProperty("Nameservers").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> Domains()
|
||||
{
|
||||
return proxy_.getProperty("Domains").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> Searches()
|
||||
{
|
||||
return proxy_.getProperty("Searches").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<std::string> DnsOptions()
|
||||
{
|
||||
return proxy_.getProperty("DnsOptions").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
int32_t DnsPriority()
|
||||
{
|
||||
return proxy_.getProperty("DnsPriority").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Settings_Connection_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Settings_Connection_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
namespace Settings {
|
||||
|
||||
class Connection_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Settings.Connection";
|
||||
|
||||
protected:
|
||||
Connection_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("Updated").onInterface(INTERFACE_NAME).call([this](){ this->onUpdated(); });
|
||||
proxy_.uponSignal("Removed").onInterface(INTERFACE_NAME).call([this](){ this->onRemoved(); });
|
||||
}
|
||||
|
||||
~Connection_proxy() = default;
|
||||
|
||||
virtual void onUpdated() = 0;
|
||||
virtual void onRemoved() = 0;
|
||||
|
||||
public:
|
||||
void Update(const std::map<std::string, std::map<std::string, sdbus::Variant>>& properties)
|
||||
{
|
||||
proxy_.callMethod("Update").onInterface(INTERFACE_NAME).withArguments(properties);
|
||||
}
|
||||
|
||||
void UpdateUnsaved(const std::map<std::string, std::map<std::string, sdbus::Variant>>& properties)
|
||||
{
|
||||
proxy_.callMethod("UpdateUnsaved").onInterface(INTERFACE_NAME).withArguments(properties);
|
||||
}
|
||||
|
||||
void Delete()
|
||||
{
|
||||
proxy_.callMethod("Delete").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::map<std::string, std::map<std::string, sdbus::Variant>> GetSettings()
|
||||
{
|
||||
std::map<std::string, std::map<std::string, sdbus::Variant>> result;
|
||||
proxy_.callMethod("GetSettings").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::map<std::string, std::map<std::string, sdbus::Variant>> GetSecrets(const std::string& setting_name)
|
||||
{
|
||||
std::map<std::string, std::map<std::string, sdbus::Variant>> result;
|
||||
proxy_.callMethod("GetSecrets").onInterface(INTERFACE_NAME).withArguments(setting_name).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void ClearSecrets()
|
||||
{
|
||||
proxy_.callMethod("ClearSecrets").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void Save()
|
||||
{
|
||||
proxy_.callMethod("Save").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::map<std::string, sdbus::Variant> Update2(const std::map<std::string, std::map<std::string, sdbus::Variant>>& settings, const uint32_t& flags, const std::map<std::string, sdbus::Variant>& args)
|
||||
{
|
||||
std::map<std::string, sdbus::Variant> result;
|
||||
proxy_.callMethod("Update2").onInterface(INTERFACE_NAME).withArguments(settings, flags, args).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public:
|
||||
bool Unsaved()
|
||||
{
|
||||
return proxy_.getProperty("Unsaved").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Flags()
|
||||
{
|
||||
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Filename()
|
||||
{
|
||||
return proxy_.getProperty("Filename").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Settings_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_Settings_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class Settings_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.Settings";
|
||||
|
||||
protected:
|
||||
Settings_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("NewConnection").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& connection){ this->onNewConnection(connection); });
|
||||
proxy_.uponSignal("ConnectionRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& connection){ this->onConnectionRemoved(connection); });
|
||||
}
|
||||
|
||||
~Settings_proxy() = default;
|
||||
|
||||
virtual void onNewConnection(const sdbus::ObjectPath& connection) = 0;
|
||||
virtual void onConnectionRemoved(const sdbus::ObjectPath& connection) = 0;
|
||||
|
||||
public:
|
||||
std::vector<sdbus::ObjectPath> ListConnections()
|
||||
{
|
||||
std::vector<sdbus::ObjectPath> result;
|
||||
proxy_.callMethod("ListConnections").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
sdbus::ObjectPath GetConnectionByUuid(const std::string& uuid)
|
||||
{
|
||||
sdbus::ObjectPath result;
|
||||
proxy_.callMethod("GetConnectionByUuid").onInterface(INTERFACE_NAME).withArguments(uuid).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
sdbus::ObjectPath AddConnection(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection)
|
||||
{
|
||||
sdbus::ObjectPath result;
|
||||
proxy_.callMethod("AddConnection").onInterface(INTERFACE_NAME).withArguments(connection).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
sdbus::ObjectPath AddConnectionUnsaved(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection)
|
||||
{
|
||||
sdbus::ObjectPath result;
|
||||
proxy_.callMethod("AddConnectionUnsaved").onInterface(INTERFACE_NAME).withArguments(connection).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::tuple<sdbus::ObjectPath, std::map<std::string, sdbus::Variant>> AddConnection2(const std::map<std::string, std::map<std::string, sdbus::Variant>>& settings, const uint32_t& flags, const std::map<std::string, sdbus::Variant>& args)
|
||||
{
|
||||
std::tuple<sdbus::ObjectPath, std::map<std::string, sdbus::Variant>> result;
|
||||
proxy_.callMethod("AddConnection2").onInterface(INTERFACE_NAME).withArguments(settings, flags, args).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::tuple<bool, std::vector<std::string>> LoadConnections(const std::vector<std::string>& filenames)
|
||||
{
|
||||
std::tuple<bool, std::vector<std::string>> result;
|
||||
proxy_.callMethod("LoadConnections").onInterface(INTERFACE_NAME).withArguments(filenames).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ReloadConnections()
|
||||
{
|
||||
bool result;
|
||||
proxy_.callMethod("ReloadConnections").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void SaveHostname(const std::string& hostname)
|
||||
{
|
||||
proxy_.callMethod("SaveHostname").onInterface(INTERFACE_NAME).withArguments(hostname);
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<sdbus::ObjectPath> Connections()
|
||||
{
|
||||
return proxy_.getProperty("Connections").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Hostname()
|
||||
{
|
||||
return proxy_.getProperty("Hostname").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool CanModify()
|
||||
{
|
||||
return proxy_.getProperty("CanModify").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_WifiP2PPeer_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_WifiP2PPeer_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
namespace NetworkManager {
|
||||
|
||||
class WifiP2PPeer_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager.WifiP2PPeer";
|
||||
|
||||
protected:
|
||||
WifiP2PPeer_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
}
|
||||
|
||||
~WifiP2PPeer_proxy() = default;
|
||||
|
||||
public:
|
||||
std::string Name()
|
||||
{
|
||||
return proxy_.getProperty("Name").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Flags()
|
||||
{
|
||||
return proxy_.getProperty("Flags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Manufacturer()
|
||||
{
|
||||
return proxy_.getProperty("Manufacturer").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Model()
|
||||
{
|
||||
return proxy_.getProperty("Model").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string ModelNumber()
|
||||
{
|
||||
return proxy_.getProperty("ModelNumber").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Serial()
|
||||
{
|
||||
return proxy_.getProperty("Serial").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> WfdIEs()
|
||||
{
|
||||
return proxy_.getProperty("WfdIEs").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string HwAddress()
|
||||
{
|
||||
return proxy_.getProperty("HwAddress").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint8_t Strength()
|
||||
{
|
||||
return proxy_.getProperty("Strength").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
int32_t LastSeen()
|
||||
{
|
||||
return proxy_.getProperty("LastSeen").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,320 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_hpp__proxy__H__
|
||||
#define __sdbuscpp__dbus_hpp_org_freedesktop_NetworkManager_hpp__proxy__H__
|
||||
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
namespace org {
|
||||
namespace freedesktop {
|
||||
|
||||
class NetworkManager_proxy
|
||||
{
|
||||
public:
|
||||
static constexpr const char* INTERFACE_NAME = "org.freedesktop.NetworkManager";
|
||||
|
||||
protected:
|
||||
NetworkManager_proxy(sdbus::IProxy& proxy)
|
||||
: proxy_(proxy)
|
||||
{
|
||||
proxy_.uponSignal("CheckPermissions").onInterface(INTERFACE_NAME).call([this](){ this->onCheckPermissions(); });
|
||||
proxy_.uponSignal("StateChanged").onInterface(INTERFACE_NAME).call([this](const uint32_t& state){ this->onStateChanged(state); });
|
||||
proxy_.uponSignal("DeviceAdded").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& device_path){ this->onDeviceAdded(device_path); });
|
||||
proxy_.uponSignal("DeviceRemoved").onInterface(INTERFACE_NAME).call([this](const sdbus::ObjectPath& device_path){ this->onDeviceRemoved(device_path); });
|
||||
}
|
||||
|
||||
~NetworkManager_proxy() = default;
|
||||
|
||||
virtual void onCheckPermissions() = 0;
|
||||
virtual void onStateChanged(const uint32_t& state) = 0;
|
||||
virtual void onDeviceAdded(const sdbus::ObjectPath& device_path) = 0;
|
||||
virtual void onDeviceRemoved(const sdbus::ObjectPath& device_path) = 0;
|
||||
|
||||
public:
|
||||
void Reload(const uint32_t& flags)
|
||||
{
|
||||
proxy_.callMethod("Reload").onInterface(INTERFACE_NAME).withArguments(flags);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> GetDevices()
|
||||
{
|
||||
std::vector<sdbus::ObjectPath> result;
|
||||
proxy_.callMethod("GetDevices").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> GetAllDevices()
|
||||
{
|
||||
std::vector<sdbus::ObjectPath> result;
|
||||
proxy_.callMethod("GetAllDevices").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
sdbus::ObjectPath GetDeviceByIpIface(const std::string& iface)
|
||||
{
|
||||
sdbus::ObjectPath result;
|
||||
proxy_.callMethod("GetDeviceByIpIface").onInterface(INTERFACE_NAME).withArguments(iface).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
sdbus::ObjectPath ActivateConnection(const sdbus::ObjectPath& connection, const sdbus::ObjectPath& device, const sdbus::ObjectPath& specific_object)
|
||||
{
|
||||
sdbus::ObjectPath result;
|
||||
proxy_.callMethod("ActivateConnection").onInterface(INTERFACE_NAME).withArguments(connection, device, specific_object).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath> AddAndActivateConnection(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection, const sdbus::ObjectPath& device, const sdbus::ObjectPath& specific_object)
|
||||
{
|
||||
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath> result;
|
||||
proxy_.callMethod("AddAndActivateConnection").onInterface(INTERFACE_NAME).withArguments(connection, device, specific_object).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath, std::map<std::string, sdbus::Variant>> AddAndActivateConnection2(const std::map<std::string, std::map<std::string, sdbus::Variant>>& connection, const sdbus::ObjectPath& device, const sdbus::ObjectPath& specific_object, const std::map<std::string, sdbus::Variant>& options)
|
||||
{
|
||||
std::tuple<sdbus::ObjectPath, sdbus::ObjectPath, std::map<std::string, sdbus::Variant>> result;
|
||||
proxy_.callMethod("AddAndActivateConnection2").onInterface(INTERFACE_NAME).withArguments(connection, device, specific_object, options).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void DeactivateConnection(const sdbus::ObjectPath& active_connection)
|
||||
{
|
||||
proxy_.callMethod("DeactivateConnection").onInterface(INTERFACE_NAME).withArguments(active_connection);
|
||||
}
|
||||
|
||||
void Sleep(const bool& sleep)
|
||||
{
|
||||
proxy_.callMethod("Sleep").onInterface(INTERFACE_NAME).withArguments(sleep);
|
||||
}
|
||||
|
||||
void Enable(const bool& enable)
|
||||
{
|
||||
proxy_.callMethod("Enable").onInterface(INTERFACE_NAME).withArguments(enable);
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> GetPermissions()
|
||||
{
|
||||
std::map<std::string, std::string> result;
|
||||
proxy_.callMethod("GetPermissions").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void SetLogging(const std::string& level, const std::string& domains)
|
||||
{
|
||||
proxy_.callMethod("SetLogging").onInterface(INTERFACE_NAME).withArguments(level, domains);
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> GetLogging()
|
||||
{
|
||||
std::tuple<std::string, std::string> result;
|
||||
proxy_.callMethod("GetLogging").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t CheckConnectivity()
|
||||
{
|
||||
uint32_t result;
|
||||
proxy_.callMethod("CheckConnectivity").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t state()
|
||||
{
|
||||
uint32_t result;
|
||||
proxy_.callMethod("state").onInterface(INTERFACE_NAME).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
sdbus::ObjectPath CheckpointCreate(const std::vector<sdbus::ObjectPath>& devices, const uint32_t& rollback_timeout, const uint32_t& flags)
|
||||
{
|
||||
sdbus::ObjectPath result;
|
||||
proxy_.callMethod("CheckpointCreate").onInterface(INTERFACE_NAME).withArguments(devices, rollback_timeout, flags).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CheckpointDestroy(const sdbus::ObjectPath& checkpoint)
|
||||
{
|
||||
proxy_.callMethod("CheckpointDestroy").onInterface(INTERFACE_NAME).withArguments(checkpoint);
|
||||
}
|
||||
|
||||
std::map<std::string, uint32_t> CheckpointRollback(const sdbus::ObjectPath& checkpoint)
|
||||
{
|
||||
std::map<std::string, uint32_t> result;
|
||||
proxy_.callMethod("CheckpointRollback").onInterface(INTERFACE_NAME).withArguments(checkpoint).storeResultsTo(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CheckpointAdjustRollbackTimeout(const sdbus::ObjectPath& checkpoint, const uint32_t& add_timeout)
|
||||
{
|
||||
proxy_.callMethod("CheckpointAdjustRollbackTimeout").onInterface(INTERFACE_NAME).withArguments(checkpoint, add_timeout);
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<sdbus::ObjectPath> Devices()
|
||||
{
|
||||
return proxy_.getProperty("Devices").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> AllDevices()
|
||||
{
|
||||
return proxy_.getProperty("AllDevices").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> Checkpoints()
|
||||
{
|
||||
return proxy_.getProperty("Checkpoints").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool NetworkingEnabled()
|
||||
{
|
||||
return proxy_.getProperty("NetworkingEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool WirelessEnabled()
|
||||
{
|
||||
return proxy_.getProperty("WirelessEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void WirelessEnabled(const bool& value)
|
||||
{
|
||||
proxy_.setProperty("WirelessEnabled").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
bool WirelessHardwareEnabled()
|
||||
{
|
||||
return proxy_.getProperty("WirelessHardwareEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool WwanEnabled()
|
||||
{
|
||||
return proxy_.getProperty("WwanEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void WwanEnabled(const bool& value)
|
||||
{
|
||||
proxy_.setProperty("WwanEnabled").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
bool WwanHardwareEnabled()
|
||||
{
|
||||
return proxy_.getProperty("WwanHardwareEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool WimaxEnabled()
|
||||
{
|
||||
return proxy_.getProperty("WimaxEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void WimaxEnabled(const bool& value)
|
||||
{
|
||||
proxy_.setProperty("WimaxEnabled").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
bool WimaxHardwareEnabled()
|
||||
{
|
||||
return proxy_.getProperty("WimaxHardwareEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t RadioFlags()
|
||||
{
|
||||
return proxy_.getProperty("RadioFlags").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<sdbus::ObjectPath> ActiveConnections()
|
||||
{
|
||||
return proxy_.getProperty("ActiveConnections").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath PrimaryConnection()
|
||||
{
|
||||
return proxy_.getProperty("PrimaryConnection").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string PrimaryConnectionType()
|
||||
{
|
||||
return proxy_.getProperty("PrimaryConnectionType").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Metered()
|
||||
{
|
||||
return proxy_.getProperty("Metered").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
sdbus::ObjectPath ActivatingConnection()
|
||||
{
|
||||
return proxy_.getProperty("ActivatingConnection").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool Startup()
|
||||
{
|
||||
return proxy_.getProperty("Startup").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::string Version()
|
||||
{
|
||||
return proxy_.getProperty("Version").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<uint32_t> VersionInfo()
|
||||
{
|
||||
return proxy_.getProperty("VersionInfo").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::vector<uint32_t> Capabilities()
|
||||
{
|
||||
return proxy_.getProperty("Capabilities").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t State()
|
||||
{
|
||||
return proxy_.getProperty("State").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
uint32_t Connectivity()
|
||||
{
|
||||
return proxy_.getProperty("Connectivity").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool ConnectivityCheckAvailable()
|
||||
{
|
||||
return proxy_.getProperty("ConnectivityCheckAvailable").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
bool ConnectivityCheckEnabled()
|
||||
{
|
||||
return proxy_.getProperty("ConnectivityCheckEnabled").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void ConnectivityCheckEnabled(const bool& value)
|
||||
{
|
||||
proxy_.setProperty("ConnectivityCheckEnabled").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
std::string ConnectivityCheckUri()
|
||||
{
|
||||
return proxy_.getProperty("ConnectivityCheckUri").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
std::map<std::string, sdbus::Variant> GlobalDnsConfiguration()
|
||||
{
|
||||
return proxy_.getProperty("GlobalDnsConfiguration").onInterface(INTERFACE_NAME);
|
||||
}
|
||||
|
||||
void GlobalDnsConfiguration(const std::map<std::string, sdbus::Variant>& value)
|
||||
{
|
||||
proxy_.setProperty("GlobalDnsConfiguration").onInterface(INTERFACE_NAME).toValue(value);
|
||||
}
|
||||
|
||||
private:
|
||||
sdbus::IProxy& proxy_;
|
||||
};
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -327,6 +327,14 @@ namespace pipedal
|
||||
bool allowNaN() const { return allowNaN_; }
|
||||
void allowNaN(bool allow) { allowNaN_ = allow; }
|
||||
|
||||
void write(uint8_t value)
|
||||
{
|
||||
os << value;
|
||||
}
|
||||
void write(int8_t value)
|
||||
{
|
||||
os << value;
|
||||
}
|
||||
void write(long long value)
|
||||
{
|
||||
os << value;
|
||||
@@ -882,6 +890,13 @@ namespace pipedal
|
||||
skip_whitespace();
|
||||
*value = read_boolean();
|
||||
}
|
||||
void read(uint8_t*value)
|
||||
{
|
||||
skip_whitespace();
|
||||
is_ >> *value;
|
||||
if (is_.fail())
|
||||
throw JsonException("Invalid format.");
|
||||
}
|
||||
void read(int *value)
|
||||
{
|
||||
skip_whitespace();
|
||||
|
||||
Reference in New Issue
Block a user