traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.cpp
branchRCL_3
changeset 25 047f208ea78f
parent 24 cc28652e0254
equal deleted inserted replaced
24:cc28652e0254 25:047f208ea78f
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    30 #endif
    30 #endif
    31 
    31 
    32 
    32 
    33 namespace Ulogger {
    33 namespace Ulogger {
    34 
    34 
       
    35 
       
    36 void CleanupPointerArray( TAny* aArray )
       
    37     {
       
    38     static_cast< RPointerArray< TPluginConfiguration >* >( aArray )->ResetAndDestroy();
       
    39     static_cast< RPointerArray< TPluginConfiguration >* >( aArray )->Close();
       
    40     }
       
    41 
       
    42 void CleanupResetAndDestroyPushL( RPointerArray< TPluginConfiguration >& aArray )
       
    43     {
       
    44     TCleanupItem item( CleanupPointerArray, &aArray );
       
    45     CleanupStack::PushL( item );
       
    46     }
    35 
    47 
    36 /*Default constructor*/
    48 /*Default constructor*/
    37 CULoggerServer::CULoggerServer(TInt aPriority)
    49 CULoggerServer::CULoggerServer(TInt aPriority)
    38 : CServer2( aPriority )
    50 : CServer2( aPriority )
    39 
    51 
  1146 			j=j+2;
  1158 			j=j+2;
  1147 			}
  1159 			}
  1148 		}
  1160 		}
  1149 	}
  1161 	}
  1150 
  1162 
  1151 
       
  1152 void CULoggerServer::InitializeFrameworksL()
  1163 void CULoggerServer::InitializeFrameworksL()
  1153 	{
  1164 	{
  1154 	//<create plugin allocator (plugins)>
  1165 	//<create plugin allocator (plugins)>
  1155 	//output settings
  1166 	//output settings
  1156 	RBuf8 outPluginName;
  1167 	RBuf8 outPluginName;
  1157 	outPluginName.Create(KMaxPluginName);
  1168 	outPluginName.Create(KMaxPluginName);
       
  1169 	outPluginName.CleanupClosePushL();
  1158 	RPointerArray<TPluginConfiguration> outputPluginSettings;
  1170 	RPointerArray<TPluginConfiguration> outputPluginSettings;
       
  1171 	CleanupResetAndDestroyPushL(outputPluginSettings);
  1159 	GetPluginAndSettingsL(outPluginName, &outputPluginSettings, EOutputPluginFilter);
  1172 	GetPluginAndSettingsL(outPluginName, &outputPluginSettings, EOutputPluginFilter);
  1160 
  1173 
  1161 	//control settings
  1174 	//control settings
  1162 	RBuf8 inputPluginName;
  1175 	RBuf8 inputPluginName;
  1163 	inputPluginName.Create(KMaxPluginName);
  1176 	inputPluginName.Create(KMaxPluginName);
       
  1177 	inputPluginName.CleanupClosePushL();
  1164 	RPointerArray<TPluginConfiguration> inputPluginSettings;
  1178 	RPointerArray<TPluginConfiguration> inputPluginSettings;
       
  1179 	CleanupResetAndDestroyPushL(inputPluginSettings);
  1165 	this->GetPluginAndSettingsL(inputPluginName, &inputPluginSettings, EInputPluginFilter);
  1180 	this->GetPluginAndSettingsL(inputPluginName, &inputPluginSettings, EInputPluginFilter);
  1166 
  1181 
  1167 	#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
  1182 	#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
  1168 	__LOG("before creating CPluginAllocator")
  1183 	__LOG("before creating CPluginAllocator")
  1169 	#endif
  1184 	#endif
  1182 	//Initialize Control Framework
  1197 	//Initialize Control Framework
  1183 	if(!iInputFramework)
  1198 	if(!iInputFramework)
  1184 		iInputFramework = CInputFramework::NewL(iPluginAllocator->GetInputPlugin(), inputPluginSettings, this);
  1199 		iInputFramework = CInputFramework::NewL(iPluginAllocator->GetInputPlugin(), inputPluginSettings, this);
  1185 
  1200 
  1186 	//cleanup
  1201 	//cleanup
  1187 	outPluginName.Close();
  1202 	CleanupStack::PopAndDestroy(4,&outPluginName);
  1188 	outputPluginSettings.ResetAndDestroy();
  1203 	iDataWatcher = CULoggerWatcher::NewL();
  1189 	outputPluginSettings.Close();
       
  1190 	inputPluginName.Close();
       
  1191 	inputPluginSettings.ResetAndDestroy();
       
  1192 	inputPluginSettings.Close();
       
  1193 
       
  1194 	iDataWatcher = CULoggerWatcher::NewL();	
       
  1195 	}
  1204 	}
  1196 
  1205 
  1197 
  1206 
  1198 void CULoggerServer::PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray<TPtrC8>& aArray)
  1207 void CULoggerServer::PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray<TPtrC8>& aArray)
  1199 	{
  1208 	{