utilities/serviceipcclient/platform/qt/serviceipclocalsocket_p.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /**
       
     2    This file is part of CWRT package **
       
     3 
       
     4    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
       
     5 
       
     6    This program is free software: you can redistribute it and/or modify
       
     7    it under the terms of the GNU (Lesser) General Public License as
       
     8    published by the Free Software Foundation, version 2.1 of the License.
       
     9    This program is distributed in the hope that it will be useful, but
       
    10    WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       
    12    (Lesser) General Public License for more details. You should have
       
    13    received a copy of the GNU (Lesser) General Public License along
       
    14    with this program. If not, see <http://www.gnu.org/licenses/>.
       
    15 */
       
    16 
       
    17 
       
    18 #ifndef serviceipclocalsocket_p_h
       
    19 #define serviceipclocalsocket_p_h
       
    20 
       
    21 #include <QtCore>
       
    22 #include <QtNetwork>
       
    23 #include "serviceipc_p.h"
       
    24 
       
    25 namespace WRT {
       
    26 
       
    27     class ServiceLocalSocketIPC : public QObject, public ServiceFwIPCPrivate
       
    28     {
       
    29     Q_OBJECT
       
    30     public:
       
    31         ServiceLocalSocketIPC();
       
    32     
       
    33         virtual ~ServiceLocalSocketIPC();
       
    34     
       
    35     public:
       
    36     
       
    37         bool connect(const QString& aServerName);
       
    38     
       
    39         void disconnect();
       
    40     
       
    41         bool startServer(const QString& aServerName, const QString& aExeName);
       
    42     
       
    43         bool sendSync(const QString& aRequestType, const QByteArray& aData);
       
    44     
       
    45         void sendAsync(const QString& aRequestType, const QByteArray& aData);
       
    46     
       
    47         QByteArray readAll();
       
    48     
       
    49         bool waitForRead();
       
    50     
       
    51     private slots:
       
    52     
       
    53         void handleError(QLocalSocket::LocalSocketError socketError);
       
    54     
       
    55         void handleReadyRead();
       
    56     
       
    57     private:
       
    58         int doMapErrors( int aError );
       
    59     
       
    60     private:
       
    61         enum TBufferType {
       
    62             ENoBuffer,
       
    63             ESyncBuffer,
       
    64             EAsyncBuffer
       
    65         };
       
    66     // Member Variables
       
    67     private:
       
    68         QLocalSocket* m_Socket;
       
    69         QByteArray m_AsyncData;
       
    70         TBufferType m_BufferType;
       
    71     };
       
    72 
       
    73 }
       
    74 #endif // serviceipclocalsocket_p_h