summaryrefslogtreecommitdiff
path: root/decorators/libdecorator/mrmiclient.h
blob: 02a7ac63b977a824974274e7126c35fe67610514 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of mcompositor.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
// -*- C++ -*-
#ifndef MRMICLIENT_H
#define MRMICLIENT_H

#include <QVariant>
#include <QObject>
#include <mexport.h>

class MRmiClientPrivate;
class MRmiClientPrivateSocket;

/*!
 * \class MRmiClient
 *
 * \brief The MRmiClient allows member functions of QObjects exported by
 * MRmiServer from another process to be invoked remotely.
 */
class M_EXPORT MRmiClient: public QObject
{
    Q_OBJECT

public:

    /*!
     * Creates a MRmiClient
     *
     * \param key the key used to identify the remote MRmiServer
     * \param parent the parent QObject
     */
    explicit MRmiClient(const QString& key, QObject* parent  = 0);

    /*!
     * Disconnects all connections and destroys this object
     */
    virtual ~MRmiClient();

    /*!
     * Invoked the remote function
     *
     * \param objectName the name of the remote object. Currently unused
     * \param method literal string of the method name of the remote object
     * \param argN QVariant representation of the arguments of the remote method
     */
    void invoke(const char* objectName, const char* method);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0,   const QVariant& arg1);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0,   const QVariant& arg1,
                const QVariant& arg2);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0,  const QVariant& arg1,
                const QVariant& arg2,   const QVariant& arg3);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0, const QVariant& arg1,
                const QVariant& arg2,   const QVariant& arg3,
                const QVariant& arg4);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0,   const QVariant& arg,
                const QVariant& arg2, const QVariant& arg3,
                const QVariant& arg4, const QVariant& arg5);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0, const QVariant& arg1,
                const QVariant& arg2,   const QVariant& arg3,
                const QVariant& arg4, const QVariant& arg5,
                const QVariant& arg6);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0, const QVariant& arg1,
                const QVariant& arg2,   const QVariant& arg3,
                const QVariant& arg4,   const QVariant& arg5,
                const QVariant& arg6,   const QVariant& arg7);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0, const QVariant& arg1,
                const QVariant& arg2,   const QVariant& arg3,
                const QVariant& arg4, const QVariant& arg5,
                const QVariant& arg6,   const QVariant& arg7,
                const QVariant& arg8);
    void invoke(const char* objectName, const char* method,
                const QVariant& arg0, const QVariant& arg1,
                const QVariant& arg2,   const QVariant& arg3,
                const QVariant& arg4,   const QVariant& arg5,
                const QVariant& arg6,   const QVariant& arg7,
                const QVariant& arg8,   const QVariant& arg9);

Q_SIGNALS:
    /*!
     * Signal emitted when a remote function has a return value expected
     *
     * \param arg QVariant representation of the data returned.
     */
    void returnValue(const QVariant& arg);

private:
    Q_DISABLE_COPY(MRmiClient)
    Q_DECLARE_PRIVATE(MRmiClient)

    void initConnection();
    void finalizeConnection();

    MRmiClientPrivate * const d_ptr;
    friend class MRmiClientPrivateSocket;

    Q_PRIVATE_SLOT(d_func(), void _q_readyRead())
};

#endif // QRMICLIENT_H