smf/smfservermodule/smfclient/client/smfclientqt.h
changeset 18 013a02bf2bb0
parent 17 106a4bfcb866
child 19 c412f0526c34
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0"
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  */
       
    15 
       
    16 #ifndef SMFCLIENTQT_H
       
    17 #define SMFCLIENTQT_H
       
    18 
       
    19 #include <QObject>
       
    20 #include <QByteArray>
       
    21 #include <QString>
       
    22 #include <QLocalSocket>
       
    23 
       
    24 #include "smfglobal.h"
       
    25 
       
    26 class SmfClientQt : public QObject
       
    27 {
       
    28 Q_OBJECT
       
    29 
       
    30 public:
       
    31     explicit SmfClientQt(QObject *parent = 0);
       
    32     ~SmfClientQt();
       
    33 
       
    34 public:
       
    35     /**
       
    36      * Send a request to the server.
       
    37      * @param aSerializedData serialized by the caller.
       
    38      * @param aInterfaceName Interface name
       
    39      * @param requestType Opcode
       
    40      */
       
    41     int sendRequest(QByteArray& aSerializedData,
       
    42                 QString aInterfaceName,
       
    43                 SmfRequestTypeID requestType);
       
    44 
       
    45     /**
       
    46      * This overloaded API is for ESmfGetServices, where data should be
       
    47      * fetched synchronously
       
    48      */
       
    49     QByteArray sendRequest(QString aInterfaceName,
       
    50                 SmfRequestTypeID requestType);
       
    51 
       
    52     /**
       
    53      * For testing purpose only
       
    54      */
       
    55     int sendDummyRequest(QByteArray* provider,QString aInterfaceName,
       
    56                 SmfRequestTypeID requestType);
       
    57 
       
    58     /**
       
    59     * CancelRequest.
       
    60     * Cancels an outstanding request.
       
    61     */
       
    62     void CancelRequest();
       
    63 
       
    64 private slots:
       
    65     void connectionEstablished();
       
    66     void readIncomingData();
       
    67     void handleError(QLocalSocket::LocalSocketError error);
       
    68 
       
    69 private:
       
    70     QLocalSocket *m_serverConnection;
       
    71 };
       
    72 
       
    73 #endif // SMFCLIENTQT_H