From 3ca0d6c07b45fd0aca092bd6d9272b2f0dda6fe1 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Tue, 7 Jul 2009 16:17:24 +0200 Subject: Added dbus client to commlayer --- lib/CommLayer/CommLayerClientDBus.cpp | 13 +++++++++ lib/CommLayer/CommLayerClientDBus.h | 17 ++++++++++++ lib/CommLayer/DBusClientProxy.h | 51 +++++++++++++++++++++++++++++++---- lib/CommLayer/DBusCommon.h | 2 -- lib/CommLayer/DBusServerProxy.h | 1 - lib/CommLayer/Makefile.am | 3 ++- 6 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 lib/CommLayer/CommLayerClientDBus.cpp create mode 100644 lib/CommLayer/CommLayerClientDBus.h (limited to 'lib/CommLayer') diff --git a/lib/CommLayer/CommLayerClientDBus.cpp b/lib/CommLayer/CommLayerClientDBus.cpp new file mode 100644 index 0000000..6f4e4b5 --- /dev/null +++ b/lib/CommLayer/CommLayerClientDBus.cpp @@ -0,0 +1,13 @@ +#include "CommLayerClientDBus.h" +CCommLayerClientDBus::CCommLayerClientDBus(DBus::Connection &connection, const char *path, const char *name) +: DBus::ObjectProxy(connection, path, name) +{ +} +CCommLayerClientDBus::~CCommLayerClientDBus() +{ +}; + +void Crash(std::string &value) +{ + std::cout << "Another Crash?" << std::endl; +} diff --git a/lib/CommLayer/CommLayerClientDBus.h b/lib/CommLayer/CommLayerClientDBus.h new file mode 100644 index 0000000..9e63f58 --- /dev/null +++ b/lib/CommLayer/CommLayerClientDBus.h @@ -0,0 +1,17 @@ +#include +#include +#include + +class CCommLayerClientDBus +: public CDBusClient_proxy, + public DBus::IntrospectableProxy, + public DBus::ObjectProxy +{ + public: + CCommLayerClientDBus(DBus::Connection &connection, const char *path, const char *name); + ~CCommLayerClientDBus(); + void Crash(std::string &value) + { + std::cout << "Another Crash?" << std::endl; + } +}; diff --git a/lib/CommLayer/DBusClientProxy.h b/lib/CommLayer/DBusClientProxy.h index 4bbf5ee..8895a11 100644 --- a/lib/CommLayer/DBusClientProxy.h +++ b/lib/CommLayer/DBusClientProxy.h @@ -33,9 +33,6 @@ public: connect_signal(CDBusClient_proxy, Crash, _Crash_stub); } -public: - - /* properties exported by this interface */ public: /* methods exported by this interface, @@ -50,13 +47,12 @@ public: ... > */ - vector_crash_infos_t GetCrashInfos(const std::string &pUID) + vector_crash_infos_t GetCrashInfos() { DBus::CallMessage call; DBus::MessageIter wi = call.writer(); - wi << pUID; call.member("GetCrashInfos"); DBus::Message ret = invoke_method(call); DBus::MessageIter ri = ret.reader(); @@ -65,6 +61,51 @@ public: ri >> argout; return argout; } + + bool DeleteDebugDump(const std::string& pUUID) + { + DBus::CallMessage call; + + DBus::MessageIter wi = call.writer(); + + wi << pUUID; + call.member("DeleteDebugDump"); + DBus::Message ret = invoke_method(call); + DBus::MessageIter ri = ret.reader(); + + bool argout; + ri >> argout; + return argout; + } + + map_crash_report_t CreateReport(const std::string& pUUID) + { + DBus::CallMessage call; + + DBus::MessageIter wi = call.writer(); + + wi << pUUID; + call.member("CreateReport"); + DBus::Message ret = invoke_method(call); + DBus::MessageIter ri = ret.reader(); + + map_crash_report_t argout; + ri >> argout; + return argout; + }; + + void Report(map_crash_report_t pReport) + { + DBus::CallMessage call; + + DBus::MessageIter wi = call.writer(); + + wi << pReport; + call.member("Report"); + DBus::Message ret = invoke_method(call); + DBus::MessageIter ri = ret.reader(); + } + public: /* signal handlers for this interface diff --git a/lib/CommLayer/DBusCommon.h b/lib/CommLayer/DBusCommon.h index 0f58abc..0ea94d3 100644 --- a/lib/CommLayer/DBusCommon.h +++ b/lib/CommLayer/DBusCommon.h @@ -21,6 +21,4 @@ #define CC_DBUS_PATH "/com/redhat/abrt" #define CC_DBUS_IFACE "com.redhat.abrt" -typedef std::vector< std::map > dbus_vector_map_crash_infos_t; - #include "CrashTypes.h" diff --git a/lib/CommLayer/DBusServerProxy.h b/lib/CommLayer/DBusServerProxy.h index 45de2f8..e8e43c5 100644 --- a/lib/CommLayer/DBusServerProxy.h +++ b/lib/CommLayer/DBusServerProxy.h @@ -128,7 +128,6 @@ private: { DBus::MessageIter ri = call.reader(); - std::string argin1; ri >> argin1; vector_crash_infos_t argout1 = GetCrashInfos(call.sender()); DBus::ReturnMessage reply(call); DBus::MessageIter wi = reply.writer(); diff --git a/lib/CommLayer/Makefile.am b/lib/CommLayer/Makefile.am index 96f897b..5a1fa50 100644 --- a/lib/CommLayer/Makefile.am +++ b/lib/CommLayer/Makefile.am @@ -3,7 +3,8 @@ libABRTCommLayer_la_SOURCES = CommLayerServer.h CommLayerServer.cpp \ CommLayerServerSocket.h CommLayerServerSocket.cpp \ CommLayerServerDBus.h CommLayerServerDBus.cpp \ DBusServerProxy.h Observer.h DBusCommon.h \ - CommLayerInner.h CommLayerInner.cpp + CommLayerInner.h CommLayerInner.cpp \ + DBusClientProxy.h CommLayerClientDBus.h CommLayerClientDBus.cpp libABRTCommLayer_la_LIBADD = ../../lib/MiddleWare/libABRTMiddleWare.la $(DL_LIBS) $(DBUSCPP_LIBS) libABRTCommLayer_la_LDFLAGS = -version-info 0:1:0 -- cgit