summaryrefslogtreecommitdiffstats
path: root/lib/DBus/DBusClientProxy.h
blob: f0b8a001ddbd49a4bf9934e554a4e49e6aa753bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* 
    Copyright (C) 2009  Jiri Moskovcak (jmoskovc@redhat.com) 
    Copyright (C) 2009  RedHat inc. 
 
    This program is free software; you can redistribute it and/or modify 
    it under the terms of the GNU General Public License as published by 
    the Free Software Foundation; either version 2 of the License, or 
    (at your option) any later version. 
 
    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 
 
    You should have received a copy of the GNU General Public License along 
    with this program; if not, write to the Free Software Foundation, Inc., 
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
    */
    
#include <dbus-c++/dbus.h>
#include <dbus-c++/glib-integration.h>
#include "DBusCommon.h"

class CDBusClient_proxy
 : public DBus::InterfaceProxy
{
public:

    CDBusClient_proxy()
    : DBus::InterfaceProxy(CC_DBUS_IFACE)
    {
        //# define connect_signal(interface, signal, callback)
        connect_signal(CDBusClient_proxy, Crash, _Crash_stub);
    }

public:

    /* properties exported by this interface */
public:

    /* methods exported by this interface,
     * this functions will invoke the corresponding methods on the remote objects
     */
     /*
     
     < 
      <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
      <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
      <m_sUUID;m_sUID;m_sCount;m_sExecutable;m_sPackage>
      ...
      >
      */
    dbus_vector_crash_infos_t GetCrashInfos(const std::string &pUID)
    {
        DBus::CallMessage call;
        
        DBus::MessageIter wi = call.writer();

        wi << pUID;
        call.member("GetCrashInfos");
        DBus::Message ret = invoke_method(call);
        DBus::MessageIter ri = ret.reader();

        dbus_vector_crash_infos_t argout;
        ri >> argout;
        return argout;
    }
public:

    /* signal handlers for this interface
     */
     virtual void Crash(std::string& value) = 0;

private:

    /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
     */
    void _Crash_stub(const ::DBus::SignalMessage &sig)
    {
        DBus::MessageIter ri = sig.reader();

        std::string value; ri >> value;
        Crash(value);
    }
};