diff --git a/sharing/linux/daemon/nearby_sharing_client.h b/sharing/linux/daemon/nearby_sharing_client.h new file mode 100644 index 00000000..732dd39a --- /dev/null +++ b/sharing/linux/daemon/nearby_sharing_client.h @@ -0,0 +1,174 @@ + +/* + * This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT! + */ + +#ifndef __sdbuscpp___home_lasan_Dev_nearby_latest_sharing_linux_daemon_nearby_sharing_client_h__proxy__H__ +#define __sdbuscpp___home_lasan_Dev_nearby_latest_sharing_linux_daemon_nearby_sharing_client_h__proxy__H__ + +#include +#include +#include + +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& share_target) { + this->onTargetDiscovered(share_target); + }); + m_proxy.uponSignal("TargetUpdated") + .onInterface(INTERFACE_NAME) + .call( + [this](const std::map& share_target) { + this->onTargetUpdated(share_target); + }); + m_proxy.uponSignal("TargetLost") + .onInterface(INTERFACE_NAME) + .call( + [this](const std::map& share_target) { + this->onTargetLost(share_target); + }); + m_proxy.uponSignal("IncomingTransfer") + .onInterface(INTERFACE_NAME) + .call([this](const std::string& direction, + const std::map& share_target, + const std::map& transfer) { + this->onIncomingTransfer(direction, share_target, transfer); + }); + m_proxy.uponSignal("TransferUpdate") + .onInterface(INTERFACE_NAME) + .call([this](const std::string& direction, + const std::map& share_target, + const std::map& transfer) { + this->onTransferUpdate(direction, share_target, transfer); + }); + m_proxy.uponSignal("StatusChanged") + .onInterface(INTERFACE_NAME) + .call([this](const std::map& status) { + this->onStatusChanged(status); + }); + } + + virtual void onTargetDiscovered( + const std::map& share_target) = 0; + virtual void onTargetUpdated( + const std::map& share_target) = 0; + virtual void onTargetLost( + const std::map& share_target) = 0; + virtual void onIncomingTransfer( + const std::string& direction, + const std::map& share_target, + const std::map& transfer) = 0; + virtual void onTransferUpdate( + const std::string& direction, + const std::map& share_target, + const std::map& transfer) = 0; + virtual void onStatusChanged( + const std::map& status) = 0; + + public: + std::tuple StartReceive() { + std::tuple result; + m_proxy.callMethod("StartReceive") + .onInterface(INTERFACE_NAME) + .storeResultsTo(result); + return result; + } + + std::tuple StopReceive() { + std::tuple result; + m_proxy.callMethod("StopReceive") + .onInterface(INTERFACE_NAME) + .storeResultsTo(result); + return result; + } + + std::tuple StartDiscovery() { + std::tuple result; + m_proxy.callMethod("StartDiscovery") + .onInterface(INTERFACE_NAME) + .storeResultsTo(result); + return result; + } + + std::tuple StopDiscovery() { + std::tuple result; + m_proxy.callMethod("StopDiscovery") + .onInterface(INTERFACE_NAME) + .storeResultsTo(result); + return result; + } + + std::tuple SendFile(const int64_t& share_target_id, + const std::string& path) { + std::tuple result; + m_proxy.callMethod("SendFile") + .onInterface(INTERFACE_NAME) + .withArguments(share_target_id, path) + .storeResultsTo(result); + return result; + } + + std::tuple Accept(const int64_t& share_target_id) { + std::tuple result; + m_proxy.callMethod("Accept") + .onInterface(INTERFACE_NAME) + .withArguments(share_target_id) + .storeResultsTo(result); + return result; + } + + std::tuple Reject(const int64_t& share_target_id) { + std::tuple result; + m_proxy.callMethod("Reject") + .onInterface(INTERFACE_NAME) + .withArguments(share_target_id) + .storeResultsTo(result); + return result; + } + + std::tuple Cancel(const int64_t& share_target_id) { + std::tuple result; + m_proxy.callMethod("Cancel") + .onInterface(INTERFACE_NAME) + .withArguments(share_target_id) + .storeResultsTo(result); + return result; + } + + std::tuple Shutdown() { + std::tuple result; + m_proxy.callMethod("Shutdown") + .onInterface(INTERFACE_NAME) + .storeResultsTo(result); + return result; + } + + private: + sdbus::IProxy& m_proxy; +}; + +} // namespace nearby +} // namespace google +} // namespace com + +#endif diff --git a/sharing/linux/daemon/nearby_sharing_dbus_interface.xml b/sharing/linux/daemon/nearby_sharing_dbus_interface.xml new file mode 100644 index 00000000..42773eb2 --- /dev/null +++ b/sharing/linux/daemon/nearby_sharing_dbus_interface.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sharing/linux/daemon/nearby_sharing_server.h b/sharing/linux/daemon/nearby_sharing_server.h new file mode 100644 index 00000000..391a4c31 --- /dev/null +++ b/sharing/linux/daemon/nearby_sharing_server.h @@ -0,0 +1,168 @@ + +/* + * This file was automatically generated by sdbus-c++-xml2cpp; DO NOT EDIT! + */ + +#ifndef __sdbuscpp___home_lasan_Dev_nearby_latest_sharing_linux_daemon_nearby_sharing_server_h__adaptor__H__ +#define __sdbuscpp___home_lasan_Dev_nearby_latest_sharing_linux_daemon_nearby_sharing_server_h__adaptor__H__ + +#include +#include +#include + +namespace com { +namespace google { +namespace nearby { + +class sharing_adaptor { + public: + static constexpr const char* INTERFACE_NAME = "com.google.nearby.sharing"; + + protected: + sharing_adaptor(sdbus::IObject& object) : m_object(object) {} + + sharing_adaptor(const sharing_adaptor&) = delete; + sharing_adaptor& operator=(const sharing_adaptor&) = delete; + sharing_adaptor(sharing_adaptor&&) = delete; + sharing_adaptor& operator=(sharing_adaptor&&) = delete; + + ~sharing_adaptor() = default; + + void registerAdaptor() { + m_object + .addVTable( + sdbus::registerMethod("StartReceive") + .withOutputParamNames("ok", "message") + .implementedAs([this]() { return this->StartReceive(); }), + sdbus::registerMethod("StopReceive") + .withOutputParamNames("ok", "message") + .implementedAs([this]() { return this->StopReceive(); }), + sdbus::registerMethod("StartDiscovery") + .withOutputParamNames("ok", "message") + .implementedAs([this]() { return this->StartDiscovery(); }), + sdbus::registerMethod("StopDiscovery") + .withOutputParamNames("ok", "message") + .implementedAs([this]() { return this->StopDiscovery(); }), + sdbus::registerMethod("SendFile") + .withInputParamNames("share_target_id", "path") + .withOutputParamNames("ok", "message") + .implementedAs([this](const int64_t& share_target_id, + const std::string& path) { + return this->SendFile(share_target_id, path); + }), + sdbus::registerMethod("Accept") + .withInputParamNames("share_target_id") + .withOutputParamNames("ok", "message") + .implementedAs([this](const int64_t& share_target_id) { + return this->Accept(share_target_id); + }), + sdbus::registerMethod("Reject") + .withInputParamNames("share_target_id") + .withOutputParamNames("ok", "message") + .implementedAs([this](const int64_t& share_target_id) { + return this->Reject(share_target_id); + }), + sdbus::registerMethod("Cancel") + .withInputParamNames("share_target_id") + .withOutputParamNames("ok", "message") + .implementedAs([this](const int64_t& share_target_id) { + return this->Cancel(share_target_id); + }), + sdbus::registerMethod("Shutdown") + .withOutputParamNames("ok", "message") + .implementedAs([this]() { return this->Shutdown(); }), + sdbus::registerSignal("TargetDiscovered") + .withParameters>( + "share_target"), + sdbus::registerSignal("TargetUpdated") + .withParameters>( + "share_target"), + sdbus::registerSignal("TargetLost") + .withParameters>( + "share_target"), + sdbus::registerSignal("IncomingTransfer") + .withParameters, + std::map>( + "direction", "share_target", "transfer"), + sdbus::registerSignal("TransferUpdate") + .withParameters, + std::map>( + "direction", "share_target", "transfer"), + sdbus::registerSignal("StatusChanged") + .withParameters>( + "status")) + .forInterface(INTERFACE_NAME); + } + + public: + void emitTargetDiscovered( + const std::map& share_target) { + m_object.emitSignal("TargetDiscovered") + .onInterface(INTERFACE_NAME) + .withArguments(share_target); + } + + void emitTargetUpdated( + const std::map& share_target) { + m_object.emitSignal("TargetUpdated") + .onInterface(INTERFACE_NAME) + .withArguments(share_target); + } + + void emitTargetLost( + const std::map& share_target) { + m_object.emitSignal("TargetLost") + .onInterface(INTERFACE_NAME) + .withArguments(share_target); + } + + void emitIncomingTransfer( + const std::string& direction, + const std::map& share_target, + const std::map& transfer) { + m_object.emitSignal("IncomingTransfer") + .onInterface(INTERFACE_NAME) + .withArguments(direction, share_target, transfer); + } + + void emitTransferUpdate( + const std::string& direction, + const std::map& share_target, + const std::map& transfer) { + m_object.emitSignal("TransferUpdate") + .onInterface(INTERFACE_NAME) + .withArguments(direction, share_target, transfer); + } + + void emitStatusChanged(const std::map& status) { + m_object.emitSignal("StatusChanged") + .onInterface(INTERFACE_NAME) + .withArguments(status); + } + + private: + virtual std::tuple StartReceive() = 0; + virtual std::tuple StopReceive() = 0; + virtual std::tuple StartDiscovery() = 0; + virtual std::tuple StopDiscovery() = 0; + virtual std::tuple SendFile(const int64_t& share_target_id, + const std::string& path) = 0; + virtual std::tuple Accept( + const int64_t& share_target_id) = 0; + virtual std::tuple Reject( + const int64_t& share_target_id) = 0; + virtual std::tuple Cancel( + const int64_t& share_target_id) = 0; + virtual std::tuple Shutdown() = 0; + + private: + sdbus::IObject& m_object; +}; + +} // namespace nearby +} // namespace google +} // namespace com + +#endif