traceservices/tracefw/ulogger/src/uloggerserver/uloggerserver.cpp
branchRCL_3
changeset 23 26645d81f48d
parent 0 08ec8eefde2f
child 24 cc28652e0254
equal deleted inserted replaced
21:28839de615b4 23:26645d81f48d
   274 	{
   274 	{
   275 	RArray<TPtrC8> activePluginsArray;
   275 	RArray<TPtrC8> activePluginsArray;
   276 	TInt ret= KErrNone;
   276 	TInt ret= KErrNone;
   277 	//check configuration file in user path (\\ulogger\\uloggerconfig.ini)	
   277 	//check configuration file in user path (\\ulogger\\uloggerconfig.ini)	
   278 
   278 
   279 	ret = GetInstalledInputPlugins(activePluginsArray);
   279 	ret = GetInstalledInputPluginsL(activePluginsArray);
   280 	if(ret==KErrNone)
   280 	if(ret==KErrNone)
   281 		{
   281 		{
   282 		ret = KErrNotFound;
   282 		ret = KErrNotFound;
   283 		for(TInt i=0;i<activePluginsArray.Count();i++)
   283 		for(TInt i=0;i<activePluginsArray.Count();i++)
   284 			{
   284 			{
   332 	TPtrC8 pluginName(aMediaName);
   332 	TPtrC8 pluginName(aMediaName);
   333 	if(!CheckPluginExists(pluginName, EOutputPluginFilter) && !CheckPluginExists(pluginName, EInputPluginFilter))
   333 	if(!CheckPluginExists(pluginName, EOutputPluginFilter) && !CheckPluginExists(pluginName, EInputPluginFilter))
   334 		return KErrNotFound;
   334 		return KErrNotFound;
   335 	else
   335 	else
   336 		{
   336 		{
   337 		TInt ret = GetValues(aMediaName,aListBuffer);
   337 		TInt ret = GetValuesL(aMediaName,aListBuffer);
   338 		if(ret == KErrNotFound) //this error indicate that there is no section in config file, plug-in exists
   338 		if(ret == KErrNotFound) //this error indicate that there is no section in config file, plug-in exists
   339 			ret = KErrNone;
   339 			ret = KErrNone;
   340 		return ret;
   340 		return ret;
   341 		}
   341 		}
   342 }
   342 }
   345 
   345 
   346 /**
   346 /**
   347 Function to get values from the configuration file (i.e. for filters,plugin settings)
   347 Function to get values from the configuration file (i.e. for filters,plugin settings)
   348 This should leave with KErrNotFound if it cannot find the configuration file
   348 This should leave with KErrNotFound if it cannot find the configuration file
   349 */
   349 */
   350 TInt CULoggerServer::GetValues(const TDesC8 &aSectionName, RArray<TPtrC8>& aListBuffer)
   350 TInt CULoggerServer::GetValuesL(const TDesC8 &aSectionName, RArray<TPtrC8>& aListBuffer)
   351 {	
   351 {	
   352 	TPtrC8 key;
   352 	TPtrC8 key;
   353 	TPtrC8 val;
   353 	TPtrC8 val;
   354 	TInt err = KErrNotFound;	
   354 	TInt err = KErrNotFound;	
   355 
   355 
   384 @aDupCategory duplicate filters which are not set
   384 @aDupCategory duplicate filters which are not set
   385 @aFilter value that describes primary or secondary filter
   385 @aFilter value that describes primary or secondary filter
   386 @return KErrNone, if successful, otherwise one of the other system-wide
   386 @return KErrNone, if successful, otherwise one of the other system-wide
   387         error codes.
   387         error codes.
   388 */
   388 */
   389 TInt CULoggerServer::SetActiveFilter(RArray<TUint32> aCategory, TInt aFilterType)
   389 TInt CULoggerServer::SetActiveFilterL(RArray<TUint32> aCategory, TInt aFilterType)
   390 {
   390 {
   391 	TInt error = KErrNone;
   391 	TInt error = KErrNone;
   392 	if(aFilterType == 1)
   392 	if(aFilterType == 1)
   393 		{
   393 		{
   394 		if(aCategory.Count()==0 || aCategory.Count()>KMaxPrimaryFiltersLimit)
   394 		if(aCategory.Count()==0 || aCategory.Count()>KMaxPrimaryFiltersLimit)
   488 
   488 
   489 @aSize The size to be set for the BTrace buffer.
   489 @aSize The size to be set for the BTrace buffer.
   490 @return KErrNone, if successful, otherwise one of the other system-wide
   490 @return KErrNone, if successful, otherwise one of the other system-wide
   491         error codes.
   491         error codes.
   492 */
   492 */
   493 TInt CULoggerServer::SetBufferSize(TInt aSize)
   493 TInt CULoggerServer::SetBufferSizeL(TInt aSize)
   494 	{
   494 	{
   495 	if(aSize > KMaxBufferSize || aSize < 1)
   495 	if(aSize > KMaxBufferSize || aSize < 1)
   496 		return KErrArgument;
   496 		return KErrArgument;
   497 
   497 
   498 	
   498 	
   530 
   530 
   531 @aSize The size to be set for the Data Notification size.
   531 @aSize The size to be set for the Data Notification size.
   532 @return KErrNone, if successful, otherwise one of the other system-wide
   532 @return KErrNone, if successful, otherwise one of the other system-wide
   533         error codes.
   533         error codes.
   534 */
   534 */
   535 TInt CULoggerServer::SetDataNotificationSize(TInt aSize)
   535 TInt CULoggerServer::SetDataNotificationSizeL(TInt aSize)
   536 	{
   536 	{
   537 	if(aSize > KMaxDnsSize || aSize < 0)
   537 	if(aSize > KMaxDnsSize || aSize < 0)
   538 		return KErrArgument;
   538 		return KErrArgument;
   539 	TInt size, r;
   539 	TInt size, r;
   540 	TRAP_IGNORE((r=GetBufandDataNotifyValuesL(KBuffer,size)));
   540 	TRAP_IGNORE((r=GetBufandDataNotifyValuesL(KBuffer,size)));
   642 	{
   642 	{
   643 	TInt ret = KErrNotFound;
   643 	TInt ret = KErrNotFound;
   644 	RArray<TPtrC8> aValues;
   644 	RArray<TPtrC8> aValues;
   645 	if(aFilterType == 1)
   645 	if(aFilterType == 1)
   646 		{
   646 		{
   647 		ret = GetValues(KPrimaryFilterSection,aValues);
   647 		ret = GetValuesL(KPrimaryFilterSection,aValues);
   648 		if(ret==KErrNone)	
   648 		if(ret==KErrNone)	
   649 			{
   649 			{
   650 			TInt i =0;
   650 			TInt i =0;
   651 			TPtrC8 val;	
   651 			TPtrC8 val;	
   652 			TUint8 int_val;
   652 			TUint8 int_val;
   662 				}					
   662 				}					
   663 			}
   663 			}
   664 		}
   664 		}
   665 	else if(aFilterType == 2)
   665 	else if(aFilterType == 2)
   666 		{
   666 		{
   667 		ret = GetValues(KSecondaryFilterSection,aValues);
   667 		ret = GetValuesL(KSecondaryFilterSection,aValues);
   668 		if(ret==KErrNone)	
   668 		if(ret==KErrNone)	
   669 			{
   669 			{
   670 			TInt i =0;
   670 			TInt i =0;
   671 			TPtrC8 val;	
   671 			TPtrC8 val;	
   672 			TUint int_val;
   672 			TUint int_val;
   737 	return error;
   737 	return error;
   738 	}
   738 	}
   739 	
   739 	
   740 
   740 
   741 
   741 
   742 TInt CULoggerServer::GetInstalledInputPlugins(RArray<TPtrC8>& aListBuffer)
   742 TInt CULoggerServer::GetInstalledInputPluginsL(RArray<TPtrC8>& aListBuffer)
   743 	{
   743 	{
   744 	#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
   744 	#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
   745 	__MARK_METHOD("CULoggerServer::GetInstalledControlPlugins")
   745 	__MARK_METHOD("CULoggerServer::GetInstalledControlPlugins")
   746 	#endif
   746 	#endif
   747 	
   747 	
   771 Function to retrieve the Active plugin name 
   771 Function to retrieve the Active plugin name 
   772 This should leave with KErrNotFound if cannot find one or any system wide error codes
   772 This should leave with KErrNotFound if cannot find one or any system wide error codes
   773 */
   773 */
   774 TInt CULoggerServer::GetActiveOutputPlugin(RArray<TPtrC8>& aListBuffer)
   774 TInt CULoggerServer::GetActiveOutputPlugin(RArray<TPtrC8>& aListBuffer)
   775 	{
   775 	{
   776 	TInt errCode = GetValues(KActiveSection,aListBuffer);
   776 	TInt errCode = GetValuesL(KActiveSection,aListBuffer);
   777 	//plugins are received as, e.g. '1 uloggerfileplugin' (.ini file syntax)
   777 	//plugins are received as, e.g. '1 uloggerfileplugin' (.ini file syntax)
   778 	//we have to remove number from array
   778 	//we have to remove number from array
   779 	for(TInt i=0; i<aListBuffer.Count(); ++i)
   779 	for(TInt i=0; i<aListBuffer.Count(); ++i)
   780 		{
   780 		{
   781 		TInt v;
   781 		TInt v;
   811 Function to retrieve the Active control plugin name 
   811 Function to retrieve the Active control plugin name 
   812 This should leave with KErrNotFound if cannot find one or any system wide error codes
   812 This should leave with KErrNotFound if cannot find one or any system wide error codes
   813 */
   813 */
   814 TInt CULoggerServer::GetActiveInputPlugin(RArray<TPtrC8>& aListBuffer)
   814 TInt CULoggerServer::GetActiveInputPlugin(RArray<TPtrC8>& aListBuffer)
   815 	{
   815 	{
   816 	return GetValues(KActiveControlSection,aListBuffer);
   816 	return GetValuesL(KActiveControlSection,aListBuffer);
   817 	}
   817 	}
   818 
   818 
   819 /**
   819 /**
   820 Function to Deactivate active control plugin 
   820 Function to Deactivate active control plugin 
   821 This should leave with KErrNotFound if cannot find one or any system wide error codes
   821 This should leave with KErrNotFound if cannot find one or any system wide error codes
   882 		}
   882 		}
   883 
   883 
   884 	if(iBtraceOpen == EFalse)
   884 	if(iBtraceOpen == EFalse)
   885 		{
   885 		{
   886 		if(iIsBooting)
   886 		if(iIsBooting)
   887 			error = TraceSettingsOnBoot();
   887 			error = TraceSettingsOnBootL();
   888 		else
   888 		else
   889 			error = iTrace.Open();
   889 			error = iTrace.Open();
   890 
   890 
   891 		if(error == KErrNone)
   891 		if(error == KErrNone)
   892 			{
   892 			{
  1013 
  1013 
  1014 /**
  1014 /**
  1015 Gets the Trace settings on boot
  1015 Gets the Trace settings on boot
  1016 @return none
  1016 @return none
  1017 */
  1017 */
  1018 TInt CULoggerServer::TraceSettingsOnBoot()
  1018 TInt CULoggerServer::TraceSettingsOnBootL()
  1019 {
  1019 {
  1020 
       
  1021 	TInt trace = FALSE;
  1020 	TInt trace = FALSE;
  1022 	
  1021 	
  1023 	RArray<TUint32> category;
  1022 	RArray<TUint32> category;
  1024 	TInt error = iTrace.Open();
  1023 	TInt error = iTrace.Open();
  1025 	if(error != KErrNone)
  1024 	if(error != KErrNone)
  1026 		return error;
  1025 		return error;
  1027 	
  1026 	
  1028 	TInt bufferSize = iTrace.BufferSize(); //To get the buffer size set at boot	
  1027 	TInt bufferSize = iTrace.BufferSize(); //To get the buffer size set at boot	
  1029 	if(bufferSize <= 0 && bufferSize > KMaxBufferSize)
  1028 	if(bufferSize <= 0 && bufferSize > KMaxBufferSize)
  1030 		SetBufferSize(KMaxBufferSize); //Update config
  1029 		SetBufferSizeL(KMaxBufferSize); //Update config
  1031 	else
  1030 	else
  1032 		SetBufferSize(bufferSize); //Update config
  1031 		SetBufferSizeL(bufferSize); //Update config
  1033 	for(TUint i=0; i<KMaxPrimaryFiltersLimit; i++)
  1032 	for(TUint i=0; i<KMaxPrimaryFiltersLimit; i++)
  1034 	{
  1033 	{
  1035 		trace = iTrace.Filter(i);
  1034 		trace = iTrace.Filter(i);
  1036 		if(trace == 1)         
  1035 		if(trace == 1)         
  1037 			category.AppendL((TUint32)i);				
  1036 			category.AppendL((TUint32)i);				
  1345 				filterArray.AppendL(val);
  1344 				filterArray.AppendL(val);
  1346 				}
  1345 				}
  1347 			
  1346 			
  1348 			if(errCode == KErrNone)
  1347 			if(errCode == KErrNone)
  1349 				{
  1348 				{
  1350 				errCode = SetActiveFilter(filterArray, EPrimaryFilter);
  1349 				errCode = SetActiveFilterL(filterArray, EPrimaryFilter);
  1351 				result.Num(errCode);
  1350 				result.Num(errCode);
  1352 			
  1351 			
  1353 				//create acknowledment
  1352 				//create acknowledment
  1354 				result.Num(errCode);
  1353 				result.Num(errCode);
  1355 				data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
  1354 				data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
  1403 				}
  1402 				}
  1404 			if(errCode != KErrNone)
  1403 			if(errCode != KErrNone)
  1405 				break;
  1404 				break;
  1406 			
  1405 			
  1407 			//create ack
  1406 			//create ack
  1408 			errCode = SetActiveFilter(filterArray, ESecondaryFilter);
  1407 			errCode = SetActiveFilterL(filterArray, ESecondaryFilter);
  1409 			result.Num(errCode);
  1408 			result.Num(errCode);
  1410 			data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
  1409 			data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
  1411 		
  1410 		
  1412 			filterArray.Close();
  1411 			filterArray.Close();
  1413 			}
  1412 			}
  1434 			if(aArguments.Count() > 0)
  1433 			if(aArguments.Count() > 0)
  1435 				{
  1434 				{
  1436 				TInt bufSize;
  1435 				TInt bufSize;
  1437 				TLex8 lex(aArguments[0]);
  1436 				TLex8 lex(aArguments[0]);
  1438 				if((errCode = lex.Val(bufSize)) == KErrNone)
  1437 				if((errCode = lex.Val(bufSize)) == KErrNone)
  1439 					errCode = SetBufferSize(bufSize);
  1438 					errCode = SetBufferSizeL(bufSize);
  1440 				}
  1439 				}
  1441 			else
  1440 			else
  1442 				errCode = KErrArgument;
  1441 				errCode = KErrArgument;
  1443 
  1442 
  1444 			result.Num(errCode);
  1443 			result.Num(errCode);
  1483 			if(aArguments.Count() > 0)
  1482 			if(aArguments.Count() > 0)
  1484 				{
  1483 				{
  1485 				TInt dns;
  1484 				TInt dns;
  1486 				TLex8 lex(aArguments[0]);
  1485 				TLex8 lex(aArguments[0]);
  1487 				if((errCode = lex.Val(dns)) == KErrNone)
  1486 				if((errCode = lex.Val(dns)) == KErrNone)
  1488 					errCode = SetDataNotificationSize(dns);
  1487 					errCode = SetDataNotificationSizeL(dns);
  1489 					else
  1488 					else
  1490 						errCode = KErrArgument;
  1489 						errCode = KErrArgument;
  1491 				}
  1490 				}
  1492 			else
  1491 			else
  1493 				errCode = KErrArgument;
  1492 				errCode = KErrArgument;
  1935 			#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
  1934 			#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
  1936 			__LOG("EGetControlPlugins")
  1935 			__LOG("EGetControlPlugins")
  1937 			#endif
  1936 			#endif
  1938 			
  1937 			
  1939 			RArray<TPtrC8> tmpArray;
  1938 			RArray<TPtrC8> tmpArray;
  1940 			errCode = GetInstalledInputPlugins(tmpArray);
  1939 			errCode = GetInstalledInputPluginsL(tmpArray);
  1941 
  1940 
  1942 			result.Num(errCode);
  1941 			result.Num(errCode);
  1943 			data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
  1942 			data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
  1944 
  1943 
  1945 			//create payload
  1944 			//create payload
  2013 void CULoggerServer::FilterPlugins(TPluginFilter aFilter, RArray<TPtrC8>& aPluginList)
  2012 void CULoggerServer::FilterPlugins(TPluginFilter aFilter, RArray<TPtrC8>& aPluginList)
  2014 	{
  2013 	{
  2015 	TInt errCode = 0;
  2014 	TInt errCode = 0;
  2016 	CPlugin::TPluginInterface interfaceId;
  2015 	CPlugin::TPluginInterface interfaceId;
  2017 	//assign filter value
  2016 	//assign filter value
  2018 	aFilter==EOutputPluginFilter ? interfaceId=MOutputPlugin::iInterfaceId : interfaceId=MInputPlugin::iInterfaceId;
  2017 	interfaceId = (aFilter == EOutputPluginFilter ? MOutputPlugin::iInterfaceId : MInputPlugin::iInterfaceId);
  2019 	
  2018 	
  2020 	//filter plugins
  2019 	//filter plugins
  2021 	TInt i=0;
  2020 	TInt i=0;
  2022 	while(i<aPluginList.Count())
  2021 	while(i<aPluginList.Count())
  2023 		{
  2022 		{
  2054 	{
  2053 	{
  2055 	RArray<TPtrC8> pluginsArray;
  2054 	RArray<TPtrC8> pluginsArray;
  2056 	if(aPluginFilter == EOutputPluginFilter)
  2055 	if(aPluginFilter == EOutputPluginFilter)
  2057 		GetInstalledOutputPlugins(pluginsArray);
  2056 		GetInstalledOutputPlugins(pluginsArray);
  2058 	else if(aPluginFilter == EInputPluginFilter)
  2057 	else if(aPluginFilter == EInputPluginFilter)
  2059 		GetInstalledInputPlugins(pluginsArray);
  2058 		GetInstalledInputPluginsL(pluginsArray);
  2060 
  2059 
  2061 	for(TInt i=0; i<pluginsArray.Count(); ++i)
  2060 	for(TInt i=0; i<pluginsArray.Count(); ++i)
  2062 		if(aPluginName.Compare(pluginsArray[i])==0)
  2061 		if(aPluginName.Compare(pluginsArray[i])==0)
  2063 			{
  2062 			{
  2064 			pluginsArray.Close();
  2063 			pluginsArray.Close();