summaryrefslogtreecommitdiff
path: root/x11/ipc/client/ocopclient.h
blob: 53018a582aa6f4f2b98ad03bb5676af2669a7b78 (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
#ifndef OPIE_OCOP_CLIENT_H
#define OPIE_OCOP_CLIENT_H


#include <qobject.h>
#include <qcstring.h>
#include <qmap.h>
#include <qsignal.h>
#include <qstring.h>
#include <qsocketnotifier.h>


/**
 * This is the OCOP client
 * It currently only supports
 * asking if a Channel is registered,
 * calling and receiving calls
 */
class OCOPPacket;
class OCOPClient : public QObject{
    Q_OBJECT
public:

    /**
     * Occasionally I decide to start a Server from here
     */
    OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l);
    ~OCOPClient();

    bool isRegistered( const QCString& )const;
    void send( const QCString& chan, const QCString&, const QByteArray& msg );

    /**
     * add a channel and does connect to a signal
     * callback is the object
     * slot is the SLOT()
     */
    void addChannel( const QCString& channel );
    void delChannel( const QCString& channel );

    /* make it singleton? */
    //static OCOPClient* self();
/* no direct signals due the design */
signals:
    void called(const QCString&, const QCString&, const QByteArray& );
private slots:
    void init();
    void init(const QCString& pa);
    void newData();
private:
    void startUP();
    OCOPPacket packet()const;
    void call( const OCOPPacket& );

    QSocketNotifier* m_notify;
    int m_socket;
    int m_tries;

};

#endif