mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxsession.cpp
changeset 0 a2952bb97e68
child 1 7f2202662322
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  RMPXSession testing implementation (mpxsession.h)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <s32mem.h>
       
    20 
       
    21 #include <mpxcollectionframeworkdefs.h>
       
    22 
       
    23 #include "commontestclass.h"
       
    24 
       
    25 _LIT(KMPXCollectionServerName,"MPXCollectionServer");
       
    26 _LIT(KMPXCollectionServerImg,"mpxcollectionserver");        // DLL/EXE name
       
    27 // UID
       
    28 const TUid KMPXCollectionServerUid3={0x101FFC31};  
       
    29 // Serverversion number
       
    30 const TUint KMPXCollectionServerMajorVersionNumber=0;
       
    31 const TUint KMPXCollectionServerMinorVersionNumber=1;
       
    32 const TUint KMPXCollectionServerBuildVersionNumber=1;
       
    33 
       
    34 // Begin RMPXSession testing implementation (mpxsession.h)=======================================
       
    35 // -----------------------------------------------------------------------------
       
    36 // CCommonTestClass::VersionRMPXSession()
       
    37 // Returns: Symbian OS errors.
       
    38 // -----------------------------------------------------------------------------
       
    39 TInt CCommonTestClass::VersionRMPXSession()
       
    40     {
       
    41 	FTRACE(FPrint(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version begin")));
       
    42     iLog->Log(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version begin"));
       
    43     TInt err = KErrNone;
       
    44     RMPXSession session;
       
    45     session.Version();
       
    46 	FTRACE(FPrint(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version end err=%d"), err));
       
    47     iLog->Log(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version end err=%d"), err);
       
    48 	return err;
       
    49     }
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CCommonTestClass::ConnectRMPXSessionL()
       
    54 // Returns: Symbian OS errors.
       
    55 // -----------------------------------------------------------------------------
       
    56 TInt CCommonTestClass::ConnectRMPXSessionL()
       
    57     {
       
    58 	FTRACE(FPrint(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect begin")));
       
    59     iLog->Log(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect begin"));
       
    60     TInt err = KErrNone;
       
    61     RMPXSession session;
       
    62     User::LeaveIfError(
       
    63         session.Connect(KMPXCollectionServerName,
       
    64                      KMPXCollectionServerImg,
       
    65                      TVersion(KMPXCollectionServerMajorVersionNumber,
       
    66                      KMPXCollectionServerMinorVersionNumber,
       
    67                      KMPXCollectionServerBuildVersionNumber)));
       
    68     session.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid));                      
       
    69     session.Close();
       
    70 	FTRACE(FPrint(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect end err=%d"), err));
       
    71     iLog->Log(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect end err=%d"), err);
       
    72 	return err;
       
    73     }
       
    74 
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CCommonTestClass::ReconnectRMPXSessionL()
       
    78 // Returns: Symbian OS errors.
       
    79 // -----------------------------------------------------------------------------
       
    80 TInt CCommonTestClass::ReconnectRMPXSessionL()
       
    81     {
       
    82 	FTRACE(FPrint(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect begin")));
       
    83     iLog->Log(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect begin"));
       
    84     TInt err = KErrNone;
       
    85     RMPXSession session;
       
    86     User::LeaveIfError(
       
    87         session.Connect(KMPXCollectionServerName,
       
    88                      KMPXCollectionServerImg,
       
    89                      TVersion(KMPXCollectionServerMajorVersionNumber,
       
    90                      KMPXCollectionServerMinorVersionNumber,
       
    91                      KMPXCollectionServerBuildVersionNumber)));
       
    92     session.Close();
       
    93     
       
    94     User::LeaveIfError( session.Reconnect() );
       
    95     session.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid));                      
       
    96     session.Close();
       
    97     
       
    98 	FTRACE(FPrint(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect end err=%d"), err));
       
    99     iLog->Log(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect end err=%d"), err);
       
   100 	return err;
       
   101     }
       
   102 
       
   103 // CCommonTestClass::SendReceiveLRMPXSessionL()
       
   104 // Returns: Symbian OS errors.
       
   105 // -----------------------------------------------------------------------------
       
   106 TInt CCommonTestClass::SendReceiveLRMPXSessionL()
       
   107     {
       
   108 	FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL begin")));
       
   109     iLog->Log(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL begin"));
       
   110     
       
   111     TInt err = KErrNone;
       
   112     RMPXSession session;
       
   113     User::LeaveIfError(
       
   114         session.Connect(KMPXCollectionServerName,
       
   115                      KMPXCollectionServerImg,
       
   116                      TVersion(KMPXCollectionServerMajorVersionNumber,
       
   117                      KMPXCollectionServerMinorVersionNumber,
       
   118                      KMPXCollectionServerBuildVersionNumber)));
       
   119     session.SendReceiveL(EMcsSetMode);                      
       
   120     session.Close();
       
   121 	
       
   122     FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err));
       
   123     iLog->Log(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err);
       
   124 	return err;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CCommonTestClass::SendReceiveStatusRMPXSessionL()
       
   129 // Returns: Symbian OS errors.
       
   130 // -----------------------------------------------------------------------------
       
   131 TInt CCommonTestClass::SendReceiveStatusRMPXSessionL()
       
   132     {
       
   133 	FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL begin")));
       
   134     iLog->Log(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL begin"));
       
   135     
       
   136     TInt err = KErrNone;
       
   137     RMPXSession session;
       
   138     User::LeaveIfError(
       
   139         session.Connect(KMPXCollectionServerName,
       
   140                      KMPXCollectionServerImg,
       
   141                      TVersion(KMPXCollectionServerMajorVersionNumber,
       
   142                      KMPXCollectionServerMinorVersionNumber,
       
   143                      KMPXCollectionServerBuildVersionNumber)));
       
   144     session.SendReceiveL(EMcsSetMode);                      
       
   145     TRequestStatus status = 5;
       
   146     session.SendReceive( EMcsGetUid, status );  
       
   147     User::WaitForRequest( status ); //added on 2009,2,12
       
   148     session.Close();
       
   149 	
       
   150     FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err));
       
   151     iLog->Log(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err);
       
   152 	return err;
       
   153     }
       
   154 
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CCommonTestClass::SendReceiveStatus3RMPXSessionL()
       
   158 // Returns: Symbian OS errors.
       
   159 // -----------------------------------------------------------------------------
       
   160 TInt CCommonTestClass::SendReceiveStatus3RMPXSessionL()
       
   161     {
       
   162 	FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL begin")));
       
   163     iLog->Log(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL begin"));
       
   164     
       
   165     TInt err = KErrNone;
       
   166     RMPXSession session;
       
   167     User::LeaveIfError(
       
   168         session.Connect(KMPXCollectionServerName,
       
   169                      KMPXCollectionServerImg,
       
   170                      TVersion(KMPXCollectionServerMajorVersionNumber,
       
   171                      KMPXCollectionServerMinorVersionNumber,
       
   172                      KMPXCollectionServerBuildVersionNumber)));
       
   173     TRequestStatus status;
       
   174     session.SendReceive(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid), status); 
       
   175     User::WaitForRequest( status ); //added on 2009,2,12
       
   176     session.Close();
       
   177 	
       
   178     FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err));
       
   179     iLog->Log(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err);
       
   180 	return err;
       
   181     }
       
   182 // -----------------------------------------------------------------------------
       
   183 // CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL()
       
   184 // Returns: Symbian OS errors.
       
   185 // -----------------------------------------------------------------------------
       
   186 TInt CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL()
       
   187     {
       
   188 	FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL begin")));
       
   189     iLog->Log(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL begin"));
       
   190     TInt err = KErrNone;
       
   191     RMPXSession session;
       
   192     User::LeaveIfError(
       
   193         session.Connect(KMPXCollectionServerName,
       
   194                      KMPXCollectionServerImg,
       
   195                      TVersion(KMPXCollectionServerMajorVersionNumber,
       
   196                      KMPXCollectionServerMinorVersionNumber,
       
   197                      KMPXCollectionServerBuildVersionNumber)));
       
   198     session.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid));                      
       
   199     session.Close();
       
   200 	FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err));
       
   201     iLog->Log(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err);
       
   202 	return err;
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // CCommonTestClass::CreateRMPXSessionL()
       
   207 // Returns: Symbian OS errors.
       
   208 // -----------------------------------------------------------------------------
       
   209 TInt CCommonTestClass::CreateRMPXSession()
       
   210     {
       
   211 	FTRACE(FPrint(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession begin")));
       
   212     iLog->Log(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession begin"));
       
   213     TInt err = KErrNone;
       
   214     RMPXSession session;
       
   215 	FTRACE(FPrint(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession end err=%d"), err));
       
   216     iLog->Log(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession end err=%d"), err);
       
   217 	return err;
       
   218     }
       
   219 
       
   220 // -----------------------------------------------------------------------------
       
   221 // CCommonTestClass::CloseAndDestructRMPXSession()
       
   222 // Returns: Symbian OS errors.
       
   223 // -----------------------------------------------------------------------------
       
   224 TInt CCommonTestClass::CloseAndDestructRMPXSession()
       
   225     {
       
   226 	FTRACE(FPrint(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession begin")));
       
   227     iLog->Log(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession begin"));
       
   228     TInt err = KErrNone;
       
   229     RMPXSession session;
       
   230     session.Close();
       
   231 	FTRACE(FPrint(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession end err=%d"), err));
       
   232     iLog->Log(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession end err=%d"), err);
       
   233 	return err;
       
   234     }
       
   235 
       
   236 // end of RMPXSession (mpxsession.h) =============================================
       
   237 
       
   238