mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
175 lines
5.6 KiB
C++
175 lines
5.6 KiB
C++
|
|
/*
|
|
* This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT!
|
|
*/
|
|
|
|
#ifndef __sdbuscpp__sharing_linux_daemon_nearby_sharing_client_h__proxy__H__
|
|
#define __sdbuscpp__sharing_linux_daemon_nearby_sharing_client_h__proxy__H__
|
|
|
|
#include <sdbus-c++/sdbus-c++.h>
|
|
#include <string>
|
|
#include <tuple>
|
|
|
|
namespace com {
|
|
namespace google {
|
|
namespace nearby {
|
|
|
|
class sharing_proxy {
|
|
public:
|
|
static constexpr const char* INTERFACE_NAME = "com.google.nearby.sharing";
|
|
|
|
protected:
|
|
sharing_proxy(sdbus::IProxy& proxy) : m_proxy(proxy) {}
|
|
|
|
sharing_proxy(const sharing_proxy&) = delete;
|
|
sharing_proxy& operator=(const sharing_proxy&) = delete;
|
|
sharing_proxy(sharing_proxy&&) = delete;
|
|
sharing_proxy& operator=(sharing_proxy&&) = delete;
|
|
|
|
~sharing_proxy() = default;
|
|
|
|
void registerProxy() {
|
|
m_proxy.uponSignal("TargetDiscovered")
|
|
.onInterface(INTERFACE_NAME)
|
|
.call(
|
|
[this](const std::map<std::string, sdbus::Variant>& share_target) {
|
|
this->onTargetDiscovered(share_target);
|
|
});
|
|
m_proxy.uponSignal("TargetUpdated")
|
|
.onInterface(INTERFACE_NAME)
|
|
.call(
|
|
[this](const std::map<std::string, sdbus::Variant>& share_target) {
|
|
this->onTargetUpdated(share_target);
|
|
});
|
|
m_proxy.uponSignal("TargetLost")
|
|
.onInterface(INTERFACE_NAME)
|
|
.call(
|
|
[this](const std::map<std::string, sdbus::Variant>& share_target) {
|
|
this->onTargetLost(share_target);
|
|
});
|
|
m_proxy.uponSignal("IncomingTransfer")
|
|
.onInterface(INTERFACE_NAME)
|
|
.call([this](const std::string& direction,
|
|
const std::map<std::string, sdbus::Variant>& share_target,
|
|
const std::map<std::string, sdbus::Variant>& transfer) {
|
|
this->onIncomingTransfer(direction, share_target, transfer);
|
|
});
|
|
m_proxy.uponSignal("TransferUpdate")
|
|
.onInterface(INTERFACE_NAME)
|
|
.call([this](const std::string& direction,
|
|
const std::map<std::string, sdbus::Variant>& share_target,
|
|
const std::map<std::string, sdbus::Variant>& transfer) {
|
|
this->onTransferUpdate(direction, share_target, transfer);
|
|
});
|
|
m_proxy.uponSignal("StatusChanged")
|
|
.onInterface(INTERFACE_NAME)
|
|
.call([this](const std::map<std::string, sdbus::Variant>& status) {
|
|
this->onStatusChanged(status);
|
|
});
|
|
}
|
|
|
|
virtual void onTargetDiscovered(
|
|
const std::map<std::string, sdbus::Variant>& share_target) = 0;
|
|
virtual void onTargetUpdated(
|
|
const std::map<std::string, sdbus::Variant>& share_target) = 0;
|
|
virtual void onTargetLost(
|
|
const std::map<std::string, sdbus::Variant>& share_target) = 0;
|
|
virtual void onIncomingTransfer(
|
|
const std::string& direction,
|
|
const std::map<std::string, sdbus::Variant>& share_target,
|
|
const std::map<std::string, sdbus::Variant>& transfer) = 0;
|
|
virtual void onTransferUpdate(
|
|
const std::string& direction,
|
|
const std::map<std::string, sdbus::Variant>& share_target,
|
|
const std::map<std::string, sdbus::Variant>& transfer) = 0;
|
|
virtual void onStatusChanged(
|
|
const std::map<std::string, sdbus::Variant>& status) = 0;
|
|
|
|
public:
|
|
std::tuple<bool, std::string> StartReceive() {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("StartReceive")
|
|
.onInterface(INTERFACE_NAME)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> StopReceive() {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("StopReceive")
|
|
.onInterface(INTERFACE_NAME)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> StartDiscovery() {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("StartDiscovery")
|
|
.onInterface(INTERFACE_NAME)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> StopDiscovery() {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("StopDiscovery")
|
|
.onInterface(INTERFACE_NAME)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> SendFile(const int64_t& share_target_id,
|
|
const std::string& path) {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("SendFile")
|
|
.onInterface(INTERFACE_NAME)
|
|
.withArguments(share_target_id, path)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> Accept(const int64_t& share_target_id) {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("Accept")
|
|
.onInterface(INTERFACE_NAME)
|
|
.withArguments(share_target_id)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> Reject(const int64_t& share_target_id) {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("Reject")
|
|
.onInterface(INTERFACE_NAME)
|
|
.withArguments(share_target_id)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> Cancel(const int64_t& share_target_id) {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("Cancel")
|
|
.onInterface(INTERFACE_NAME)
|
|
.withArguments(share_target_id)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
std::tuple<bool, std::string> Shutdown() {
|
|
std::tuple<bool, std::string> result;
|
|
m_proxy.callMethod("Shutdown")
|
|
.onInterface(INTERFACE_NAME)
|
|
.storeResultsTo(result);
|
|
return result;
|
|
}
|
|
|
|
private:
|
|
sdbus::IProxy& m_proxy;
|
|
};
|
|
|
|
} // namespace nearby
|
|
} // namespace google
|
|
} // namespace com
|
|
|
|
#endif
|