homescreenapp/hsdomainmodel/inc/hsipcchannel.h
changeset 35 f9ce957a272c
equal deleted inserted replaced
5:c743ef5928ba 35:f9ce957a272c
       
     1 #ifndef HSIPCHANNEL_H
       
     2 #define HSIPCHANNEL_H
       
     3 
       
     4 #include <QLocalSocket>
       
     5 #include <QVariantMap>
       
     6 
       
     7 #include "hsdomainmodel_global.h"
       
     8 
       
     9 class QDataStream;
       
    10 
       
    11 class HSDOMAINMODEL_EXPORT HsIpcChannel : public QObject
       
    12 {
       
    13     Q_OBJECT
       
    14 public:
       
    15     
       
    16     virtual ~HsIpcChannel();
       
    17 
       
    18     bool isConnected() const;
       
    19     bool sendMessage(const QVariantMap &message);
       
    20     bool waitForSendMessage(const QVariantMap &message);
       
    21     bool waitForReadMessage(QVariantMap &message);
       
    22     virtual void closeConnection()=0;
       
    23 
       
    24 signals:
       
    25     void connectionEstablished();
       
    26     void connectionError();
       
    27     void messageReceived(const QVariantMap &message);
       
    28     void disconnected();
       
    29 private slots:
       
    30     void onReadyRead();
       
    31     void onError(QLocalSocket::LocalSocketError socketError);
       
    32 
       
    33 protected:
       
    34      HsIpcChannel(QObject *parent = 0);
       
    35      
       
    36 protected:
       
    37     quint32 mBlockSize;
       
    38     QLocalSocket *mSocket;
       
    39 };
       
    40 
       
    41 #endif // HsIpcChannel_H