qthighway/xqserviceipc/xqserviceipc/xqserviceipc_apasymbiansession.cpp
branchRCL_3
changeset 10 cd2778e5acfe
parent 9 5d007b20cfd0
child 11 19a54be74e5e
equal deleted inserted replaced
9:5d007b20cfd0 10:cd2778e5acfe
     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:  
       
    19 *
       
    20 */
       
    21 
       
    22 #include "xqservicelog.h"
       
    23 
       
    24 #include "xqserviceipc_apasymbiansession.h"
       
    25 
       
    26 #include "xqserviceipcconst.h"
       
    27 #include <QString>
       
    28 
       
    29 #include <xqservicemanager.h>
       
    30 
       
    31 #include <QString>
       
    32 
       
    33 namespace QtService
       
    34 {
       
    35 // ============================== MEMBER FUNCTIONS ============================
       
    36 
       
    37 /*!
       
    38     \class RApaIPCSession
       
    39     \brief Symbian class encapsulating RMessage2 interface
       
    40 */
       
    41 
       
    42 /*!
       
    43     Send a message.
       
    44     \param aFunction Function code.
       
    45     \return message Completion code.
       
    46 */
       
    47 TInt RApaIPCSession::SendReceiveL(TInt aFunction) const
       
    48 {
       
    49     XQSERVICE_DEBUG_PRINT("RApaIPCSession::SendReceiveL(1)");
       
    50     return User::LeaveIfError(RSessionBase::SendReceive(aFunction));
       
    51 }
       
    52 
       
    53 /*!
       
    54     Send a message.
       
    55     \param aFunction Function code.
       
    56     \param aArgs Parameter to server.
       
    57     \return Message completion code.
       
    58 */
       
    59 TInt RApaIPCSession::SendReceiveL(TInt aFunction, const TIpcArgs& aArgs) const
       
    60 {
       
    61     XQSERVICE_DEBUG_PRINT("RApaIPCSession::SendReceiveL(2)");
       
    62     return User::LeaveIfError(RSessionBase::SendReceive(aFunction,aArgs));
       
    63 }
       
    64 
       
    65 /*!
       
    66     Send message asynchronously.
       
    67     \param aFunction Function code.
       
    68     \param aStatus The request status object used to contain the 
       
    69            completion status of the request.
       
    70 */
       
    71 EXPORT_C void RApaIPCSession::SendReceive(TInt aFunction,
       
    72                                           TRequestStatus& aStatus) const
       
    73 {
       
    74     XQSERVICE_DEBUG_PRINT("RApaIPCSession::SendReceive(1)");
       
    75     RSessionBase::SendReceive(aFunction,aStatus);
       
    76     XQSERVICE_DEBUG_PRINT("RApaIPCSession::SendReceive(1) done");
       
    77 }
       
    78 
       
    79 /*!
       
    80     Send message asynchronously.
       
    81     \param aFunction Function code.
       
    82     \param aArgs Parameter to server.
       
    83     \param aStatus The request status object used to contain the 
       
    84            completion status of the request.
       
    85 */
       
    86 void RApaIPCSession::SendReceive(TInt aFunction,
       
    87                                        const TIpcArgs& aArgs,
       
    88                                        TRequestStatus& aStatus) const
       
    89 {
       
    90     XQSERVICE_DEBUG_PRINT("RApaIPCSession::SendReceive(2)");
       
    91     RSessionBase::SendReceive(aFunction,aArgs,aStatus);
       
    92     XQSERVICE_DEBUG_PRINT("RApaIPCSession::SendReceive(2) done");
       
    93 }
       
    94 
       
    95 /*!
       
    96     Connect to server.
       
    97     \param aServer Server name.
       
    98     \param aVersion Version of the server.
       
    99     \return KErrNone on success, otherwise system error code.
       
   100 */
       
   101 TInt RApaIPCSession::Connect(const TDesC& aServer, 
       
   102                                  const TVersion& aVersion)
       
   103 {
       
   104     QString server = QString::fromUtf16(aServer.Ptr(), aServer.Length());
       
   105     XQSERVICE_DEBUG_PRINT("RApaIPCSession::Connect %s", qPrintable(server));
       
   106     iVersion = aVersion;
       
   107     return CreateSession(aServer, aVersion, 10);
       
   108 }
       
   109 
       
   110 /*!
       
   111     Get version info.
       
   112     \return Version info.
       
   113 */
       
   114 TVersion RApaIPCSession::Version() const
       
   115 {
       
   116     XQSERVICE_DEBUG_PRINT("RApaIPCSession::Version");
       
   117     return iVersion;
       
   118 }
       
   119 
       
   120 /*!
       
   121     Get service uid.
       
   122     \return Service uid.
       
   123 */
       
   124 TUid RApaIPCSession::ServiceUid() const
       
   125 {
       
   126     XQSERVICE_DEBUG_PRINT("RApaIPCSession::ServiceUid");
       
   127     return iUid;
       
   128 }
       
   129 
       
   130 /*!
       
   131     Set service uid.
       
   132     \param uid Service uid to set.
       
   133 */
       
   134 void RApaIPCSession::setServiceUid(TInt uid)
       
   135 {
       
   136     XQSERVICE_DEBUG_PRINT("RApaIPCSession::setServiceUid %x", uid);
       
   137     iUid.iUid = uid;
       
   138 }
       
   139 
       
   140 }
       
   141 
       
   142 // END OF FILE