ximpfw/core/srcclient/ximpsrvrootclient.cpp
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 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:  XIMP Framework server root client implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include "ximpbase.h"
       
    21 #include "ximpsrvrootclient.h"
       
    22 #include "ximpprocessstarter.h"
       
    23 #include "ximprootserverdefs.h"
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <s32mem.h>
       
    27 
       
    28 
       
    29 //Include Root server namespace
       
    30 using namespace NRootSrv;
       
    31 
       
    32 // ======== MEMBER FUNCTIONS ========
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // RXIMPSrvRootClient::RXIMPSrvRootClient()
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 EXPORT_C RXIMPSrvRootClient::RXIMPSrvRootClient()
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // RXIMPSrvRootClient::Connect()
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C TInt RXIMPSrvRootClient::Connect()
       
    48     {
       
    49     TFileName fullExePath;
       
    50     XIMPProcessStarter::FullExePathForClienLocation( NName::KExecutable,
       
    51                                                      fullExePath );
       
    52 
       
    53     TInt ret = XIMPProcessStarter::ConnectToServer( fullExePath,
       
    54                                             KNullDesC,
       
    55                                             NULL,
       
    56                                             *this,
       
    57                                             NName::KSymbianServer,
       
    58                                             TVersion( NVersion::KMajor,
       
    59                                                       NVersion::KMinor,
       
    60                                                       NVersion::KBuild ),
       
    61                                             NRequest::KMsgSlotCount );
       
    62 
       
    63     if ( ret == KErrNone )
       
    64         {
       
    65         TIpcArgs msgArgs;
       
    66         ret = SendReceive( NRequest::EBecomeRootSession, msgArgs );
       
    67         }
       
    68 
       
    69     return ret;
       
    70     }
       
    71 
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // RXIMPSrvRootClient::Close()
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 EXPORT_C void RXIMPSrvRootClient::Close()
       
    78     {
       
    79     RSessionBase::Close();
       
    80     #if _BullseyeCoverage
       
    81     cov_write();
       
    82     #endif
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // RXIMPSrvRootClient::GetProtocolListL()
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C HBufC8* RXIMPSrvRootClient::GetKnownProtocolsL()
       
    91     {
       
    92     return GetDataL( NRequest::ERootSsPrepareProtocolList );
       
    93     }
       
    94 
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL()
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C HBufC8* RXIMPSrvRootClient::GetSupportedFrameworkFeaturesL()
       
   101     {
       
   102     return GetDataL( NRequest::ERootSsPrepareSupportedFeatures );
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // RXIMPSrvRootClient::GetDataL()
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 HBufC8* RXIMPSrvRootClient::GetDataL( TInt aMsg )
       
   111     {
       
   112     TInt bufSize = SendReceive( aMsg );
       
   113     User::LeaveIfError( bufSize );
       
   114 
       
   115     HBufC8* buf = HBufC8::NewLC( bufSize );
       
   116     TPtr8 ptrBuf( buf->Des() );
       
   117 
       
   118     TIpcArgs msgArgs;
       
   119     msgArgs.Set( 0, &ptrBuf );
       
   120 
       
   121     User::LeaveIfError( SendReceive( NRequest::ERootSsFetchServerSideData, msgArgs ) );
       
   122 
       
   123     CleanupStack::Pop( buf );
       
   124     return buf;
       
   125     }
       
   126 
       
   127 
       
   128 // End of file
       
   129