smf/smfservermodule/smfclient/smfclientqt.h
changeset 18 013a02bf2bb0
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     
       
    33     ~SmfClientQt();
       
    34 
       
    35 public:
       
    36     /**
       
    37      * Send a request to the server.
       
    38      * @param aSerializedData serialized by the caller.
       
    39      * @param aInterfaceName Interface name
       
    40      * @param requestType Opcode
       
    41      */
       
    42     int sendRequest(QByteArray& aSerializedData,
       
    43                 QString aInterfaceName,
       
    44                 SmfRequestTypeID requestType);
       
    45 
       
    46     /**
       
    47      * This overloaded API is for ESmfGetServices, where data should be
       
    48      * fetched synchronously
       
    49      */
       
    50     QByteArray sendRequest(QString aInterfaceName,
       
    51                 SmfRequestTypeID requestType);
       
    52 
       
    53     /**
       
    54      * For testing purpose only
       
    55      */
       
    56     int sendDummyRequest(QByteArray* provider,QString aInterfaceName,
       
    57                 SmfRequestTypeID requestType);
       
    58 
       
    59     /**
       
    60     * CancelRequest.
       
    61     * Cancels an outstanding request.
       
    62     */
       
    63     void CancelRequest();
       
    64 
       
    65 private slots:
       
    66     void connectionEstablished();
       
    67     void readIncomingData();
       
    68     void handleError(QLocalSocket::LocalSocketError error);
       
    69 
       
    70 private:
       
    71     QLocalSocket *m_serverConnection;
       
    72 	};
       
    73 
       
    74 #endif // SMFCLIENTQT_H