summaryrefslogtreecommitdiff
path: root/x11/ipc/client/ocopclient.h
blob: db04d3789b2c0305147a0d5c18154d2192d023c3 (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
#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(const QCString& pa);
    void newData();
private:
    OCOPPacket packet();
    void call( const OCOPPacket& );

    QSocketNotifier* m_notify;
    int m_socket;
private slots:

};

#endif