qthighway/xqserviceipc/xqserviceipc/xqserviceipc_symbiansession.cpp
changeset 24 9d760f716ca8
parent 4 90517678cc4f
equal deleted inserted replaced
19:46686fb6258c 24:9d760f716ca8
    26 namespace QtService
    26 namespace QtService
    27 {
    27 {
    28 // ============================== MEMBER FUNCTIONS ============================
    28 // ============================== MEMBER FUNCTIONS ============================
    29 
    29 
    30 /*!
    30 /*!
    31  \class RServiceIPCSession
    31     \class RServiceIPCSession
    32 
    32     \brief Symbian class encapsulating RMessage2 interface
    33  Symbian class encapsulating RMessage2 interface
       
    34  */
    33  */
    35 
    34 
    36 /*!
    35 /*!
    37  Send a message
    36     Send a message.
    38  @param aFunction function code
    37     \param aFunction Function code.
    39  @return message completion code
    38     \return Message completion code.
    40  */
    39  */
    41 TInt RServiceIPCSession::SendReceiveL(TInt aFunction) const
    40 TInt RServiceIPCSession::SendReceiveL(TInt aFunction) const
    42 {
    41 {
    43     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceiveL(1)");
    42     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceiveL(1)");
    44     return User::LeaveIfError(RSessionBase::SendReceive(aFunction));
    43     return User::LeaveIfError(RSessionBase::SendReceive(aFunction));
    49     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::Send");
    48     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::Send");
    50     return RSessionBase::Send(aFunction, aArgs);
    49     return RSessionBase::Send(aFunction, aArgs);
    51 }
    50 }
    52 
    51 
    53 /*!
    52 /*!
    54  Send a message
    53     Send a message.
    55  @param aFunction function code
    54     \param aFunction Function code.
    56  @param aArgs parameter to server
    55     \param aArgs Parameter to server.
    57  @return message completion code
    56     \return Message completion code.
    58  */
    57  */
    59 TInt RServiceIPCSession::SendReceiveL(TInt aFunction, const TIpcArgs& aArgs) const
    58 TInt RServiceIPCSession::SendReceiveL(TInt aFunction, const TIpcArgs& aArgs) const
    60 {
    59 {
    61     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceiveL(2)");
    60     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceiveL(2)");
    62     return User::LeaveIfError(RSessionBase::SendReceive(aFunction, aArgs));
    61     return User::LeaveIfError(RSessionBase::SendReceive(aFunction, aArgs));
    63 }
    62 }
    64 
    63 
    65 /*!
    64 /*!
    66  Send message asynchronously
    65     Send message asynchronously.
    67  @param aFunction function code
    66     \param aFunction Function code.
    68  @param aStatus the request status object used to contain the 
    67     \param aStatus The request status object used to contain the 
    69  completion status of the request
    68                    completion status of the request.
    70  */
    69 */
    71 EXPORT_C void RServiceIPCSession::SendReceive(TInt aFunction,
    70 EXPORT_C void RServiceIPCSession::SendReceive(TInt aFunction,
    72                                               TRequestStatus& aStatus) const
    71                                               TRequestStatus& aStatus) const
    73 {
    72 {
    74     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceive(1)");
    73     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceive(1)");
    75     RSessionBase::SendReceive(aFunction, aStatus);
    74     RSessionBase::SendReceive(aFunction, aStatus);
    76 }
    75 }
    77 
    76 
    78 /*!
    77 /*!
    79  Send message asynchronously
    78     Send message asynchronously.
    80  @param aFunction function code
    79     \param aFunction Function code.
    81  @param aArgs parameter to server
    80     \param aArgs Parameter to server.
    82  @param aStatus the request status object used to contain the 
    81     \param aStatus The request status object used to contain the
    83  completion status of the request
    82                    completion status of the request.
    84  */
    83 */
    85 void RServiceIPCSession::SendReceive(TInt aFunction,
    84 void RServiceIPCSession::SendReceive(TInt aFunction,
    86                                      const TIpcArgs& aArgs,
    85                                      const TIpcArgs& aArgs,
    87                                      TRequestStatus& aStatus) const
    86                                      TRequestStatus& aStatus) const
    88 {
    87 {
    89     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceive(2)");
    88     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::SendReceive(2)");
    90     RSessionBase::SendReceive(aFunction, aArgs, aStatus);
    89     RSessionBase::SendReceive(aFunction, aArgs, aStatus);
    91 }
    90 }
    92 
    91 
    93 /*!
    92 /*!
    94  Connect to server
    93     Connect to server.
    95  @param aServer server name
    94     \param aServer server name.
    96  @param aVersion version of the server
    95     \param aVersion version of the server.
    97  @return KErrNone success, otherwise system error code
    96     \return KErrNone success, otherwise system error code.
    98  */
    97 */
    99 TInt RServiceIPCSession::Connect(const TDesC& aServer, const TVersion& aVersion)
    98 TInt RServiceIPCSession::Connect(const TDesC& aServer, const TVersion& aVersion)
   100 {
    99 {
   101     QString server = QString::fromUtf16(aServer.Ptr(), aServer.Length());
   100     QString server = QString::fromUtf16(aServer.Ptr(), aServer.Length());
   102     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::Connect %s", qPrintable(server));
   101     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::Connect %s", qPrintable(server));
   103     iVersion = aVersion;
   102     iVersion = aVersion;
   104     return CreateSession(aServer, aVersion, 1);
   103     return CreateSession(aServer, aVersion, 1);
   105 }
   104 }
   106 
   105 
   107 /*!
   106 /*!
   108  Get version info
   107     Get version info.
   109  @return version info
   108     \return Version info.
   110  */
   109 */
   111 TVersion RServiceIPCSession::Version() const
   110 TVersion RServiceIPCSession::Version() const
   112 {
   111 {
   113     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::Version");
   112     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::Version");
   114     return iVersion;
   113     return iVersion;
   115 }
   114 }
   116 
   115 
   117 /*!
   116 /*!
   118  Start the server 
   117     Start the server .
   119  @param aImage binary name to start
   118     \param aImage Binary name to start.
   120  @return KErrNone if started properly
   119     \return KErrNone if started properly.
   121  */
   120 */
   122 TInt RServiceIPCSession::StartServer(const TDesC& aImage)
   121 TInt RServiceIPCSession::StartServer(const TDesC& aImage)
   123 {
   122 {
   124     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::StartServer");
   123     XQSERVICE_DEBUG_PRINT("RServiceIPCSession::StartServer");
   125     RProcess server;
   124     RProcess server;
   126     TInt ret = server.Create(aImage, KNullDesC);
   125     TInt ret = server.Create(aImage, KNullDesC);