commsprocess/commsrootserverconfig/rootsrv/c32startcli.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19 */
       
    20 #include<e32std.h>
       
    21 #include<e32cmn.h>
       
    22 #include<e32base.h>
       
    23 #include <comms-infras/c32startcli.h>
       
    24 
       
    25 #include <comms-infras/commsdebugutility.h>
       
    26 
       
    27 __FLOG_STMT(_LIT8(KSubsysRs,"RootServer");) // subsystem name
       
    28 __FLOG_STMT(_LIT8(KComponentRs,"event");) // component name
       
    29 
       
    30 using namespace RootServer;
       
    31 
       
    32 EXPORT_C RRsConfigurator::RRsConfigurator()
       
    33 	/** Default Constructor
       
    34 	*/
       
    35 	{
       
    36 	}
       
    37 	
       
    38 EXPORT_C TInt  RRsConfigurator::Connect()
       
    39 	/** Use this function to open a session to the Configurator Server,
       
    40 	which is used to load the modules on demand.
       
    41     Default number of message slots is defined in KDefaultMessageSlots.
       
    42     As with any server, the connection should be closed after use.
       
    43     RHandleBase provides the necessary Close() function, which should be
       
    44     called when the server session is no longer required. 
       
    45     @return An error code
       
    46     @internalTechnology
       
    47     @capability NetworkControl 
       
    48 	*/
       
    49 	{
       
    50 	__FLOG_DECLARATION_VARIABLE;
       
    51 	__FLOG_OPEN(KSubsysRs, KComponentRs);
       
    52 	__FLOG_1(_L("RRsConfigurator::Connect: client %d"), (TUint) RThread().Id());
       
    53 
       
    54 	TInt err = CreateSession(KRsConfiguratorServerName, TVersion(0, 0, 0));
       
    55 	
       
    56 	if (err==KErrNotFound)
       
    57 		{
       
    58 		err = StartC32();
       
    59 		if (err==KErrNone)
       
    60 			{
       
    61 			err=CreateSession(KRsConfiguratorServerName, TVersion(0, 0, 0));
       
    62 			}
       
    63 		}
       
    64 
       
    65 	__FLOG_CLOSE;
       
    66     return(err); 
       
    67 	}
       
    68 
       
    69 
       
    70 EXPORT_C void RRsConfigurator::LoadCpm(const TCFModuleName& aName,TRequestStatus& aStatus)
       
    71 	/** Launch a new Comms Provider Module on demand
       
    72 	The name of the new CPM instance must be unique and must
       
    73 	be used in any further communication concerning this CPM instance, such as binding.
       
    74 	@param aName Name of module to load.
       
    75 	@see TCFModuleName
       
    76     @internalTechnology
       
    77     @capability NetworkControl
       
    78 	*/
       
    79 	{
       
    80 	SendReceive(CSLoadCpm, TIpcArgs(&aName), aStatus);
       
    81 	}
       
    82 
       
    83 EXPORT_C void RRsConfigurator::UnloadCpm(const TCFModuleName& aName,TRSUnLoadType aType, TRequestStatus& aStatus)
       
    84 	/** Unloads a Comms Provider Module. This interannly calls root server UnLoadCpm() method
       
    85     @param aStatus The request status used to contain completion information for the function.
       
    86     @param aName Name of module to unload
       
    87     @param aType unload type ( Graceful/Optional/ungraceful/immediate)
       
    88 	@see TCFModuleName
       
    89 	@see TRSUnLoadType
       
    90 	@internalTechnology
       
    91     @capability NetworkControl PowerMgmt
       
    92     */
       
    93 	{
       
    94 	SendReceive(CSUnloadCpm, TIpcArgs(&aName,aType), aStatus);
       
    95 	}
       
    96 
       
    97 EXPORT_C void RRsConfigurator::CancelLoadCpm(const TCFModuleName& aName)
       
    98 	/** Cancels asynchronous loading of a comms Provider Module.
       
    99     There is no guarantee the module loading is canceled.
       
   100     A best effort is made and the asynchronous request waiting for
       
   101     the module to load returns with KErrCanceled on success.
       
   102     @param aName Name of module which is loading.
       
   103     @see TCFModuleName
       
   104     @internalTechnology
       
   105     @capability NetworkControl
       
   106     */
       
   107 	{
       
   108 	SendReceive(CSCancelLoadCpm, TIpcArgs(&aName));
       
   109 	}
       
   110 
       
   111 EXPORT_C void RRsConfigurator::CancelUnloadCpm(const TCFModuleName& aName)
       
   112 	/** Cancel asynchronous unloading of a comms Provider Module.
       
   113     There is no guarantee the module unloading is canceled.
       
   114     A best effort is made and the asynchronous request waiting for
       
   115     the module to load returns KErrCanceled on success.
       
   116     @param aName Name of module which is unloading.
       
   117     @see TCFModuleName
       
   118     @internalTechnology
       
   119     @capability NetworkControl PowerMgmt
       
   120     */
       
   121 	{
       
   122 	SendReceive(CSCancelUnloadCpm, TIpcArgs(&aName));
       
   123 	}
       
   124 
       
   125 
       
   126 EXPORT_C TInt RRsConfigurator::EnumerateModules(const TCFGroupName& aGroupName, TRSIter &aPosition, TCFModuleName& aModuleName)
       
   127 	/** Through repeated calls returns the list of module names that are associated with provided group name. 
       
   128 	@param aGroupName for which the module names have to be retrieved
       
   129 	@param aPosition Position in enumeration.
       
   130     @param aName Contains module upon successful return.
       
   131     @see TCFModuleName
       
   132     @see TCFGroupName
       
   133     @return An error code.
       
   134     @internalTechnology
       
   135     @capability NetworkControl
       
   136 	*/
       
   137 	{
       
   138 	__FLOG_STATIC0(KSubsysRs,KComponentRs,_L("RRsConfigurator::EnumerateModules"));
       
   139 	TPckg<TRSIter> pkgPos(aPosition);
       
   140 	TInt err = SendReceive(CSEnumerateModules, TIpcArgs(&pkgPos, &aGroupName,&aModuleName));
       
   141 	return err;
       
   142 	}
       
   143 
       
   144 EXPORT_C TInt RRsConfigurator::GetModuleIniData(const TCFModuleName& aModuleName, TDes8& aIniData, TInt& aRequiredInidataSize)
       
   145 	/** Gets you the module [inidata] section, which contains information specific to CPM
       
   146 	@param aName Name of module for which [inidata] section is fetched.
       
   147 	@param aIniData contains inidata on return.
       
   148 	@param aRequiredInidataSize contains actual size of the inidata on return.Using this the caller may resize the buffer and use the method again in case of KErrOverflow. 
       
   149 	@return An error code.
       
   150 	@internalTechnology
       
   151 	@capability NetworkControl
       
   152 	*/
       
   153 	{
       
   154 	TPckg<TInt> pkgActualSize(aRequiredInidataSize);
       
   155 	TInt err = SendReceive(CSGetModuleIniData, TIpcArgs(&aModuleName, &aIniData, &pkgActualSize));
       
   156 	return err;
       
   157 	}
       
   158 
       
   159