qthighway/xqserviceipc/xqserviceipc/xqserviceipc_symbian.h
branchRCL_3
changeset 9 5d007b20cfd0
equal deleted inserted replaced
8:885c2596c964 9:5d007b20cfd0
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:  Symbian client side implementation for IPC
       
    19 *
       
    20 */
       
    21 
       
    22 #ifndef C_XQSERVICEIPC_SYMBIAN_H
       
    23 #define C_XQSERVICEIPC_SYMBIAN_H
       
    24 
       
    25 #include <QtCore/qobject.h>
       
    26 #include <xqserviceipc_p.h>
       
    27 #include <e32base.h>
       
    28 #include <xqsharablefile.h>
       
    29 #include "xqserviceipc_symbiansession.h"
       
    30 
       
    31 namespace QtService {
       
    32     // Sharable file utility
       
    33     bool TransferSharableFile(TIpcArgs *args, const XQSharableFile *file);
       
    34     
       
    35     class CServiceSymbianIPC : public CActive, public ServiceFwIPCPrivate
       
    36     {
       
    37     
       
    38     public:
       
    39     
       
    40         virtual ~CServiceSymbianIPC();
       
    41     
       
    42         static CServiceSymbianIPC* NewL();
       
    43     
       
    44         // From ServiceFwIPCPrivate
       
    45     protected:
       
    46     
       
    47         bool connect(const QString& aServerName);
       
    48     
       
    49         void disconnect();
       
    50     
       
    51         bool startServer(const QString& aServerName, const QString& aExeName, quint64& processId, int options = 0);
       
    52     
       
    53         bool sendSync(const QString& aRequestType, const QByteArray& aData);
       
    54     
       
    55         void sendAsync(const QString& aRequestType, const QByteArray& aData);
       
    56     
       
    57         void readAll( QByteArray& aArray );
       
    58         
       
    59         QByteArray readAll();
       
    60     
       
    61         bool waitForRead();
       
    62     
       
    63         // From CActive
       
    64     protected:
       
    65     
       
    66         void RunL();
       
    67 
       
    68         TInt RunError(TInt err);
       
    69     
       
    70         void DoCancel();
       
    71     
       
    72     private:
       
    73         
       
    74         enum TState
       
    75             {
       
    76             ESend,
       
    77             ERead,
       
    78             EDone
       
    79             };
       
    80         
       
    81         void doReadAllL(QByteArray& aArray);
       
    82         
       
    83         QByteArray doReadAllL();
       
    84     
       
    85         int doMapErrors( TInt aError );
       
    86         
       
    87     private:
       
    88     
       
    89         CServiceSymbianIPC();
       
    90     
       
    91         void ConstructL();
       
    92     
       
    93     private:
       
    94         RServiceIPCSession iSession;
       
    95         HBufC8* iAsyncData; // member variable to keep alive any data for async ops
       
    96         TPtrC8 iAsyncDataPtr;
       
    97         HBufC* iRequestData;
       
    98         TPtrC iRequestDataPtr;
       
    99         TInt iDataSize;
       
   100         TState iState;
       
   101         QByteArray* iArray; //not owed
       
   102         RBuf8 iBuf;
       
   103     };
       
   104 
       
   105 }
       
   106 #endif // C_XQSERVICEIPC_SYMBIAN_H