Exemplo n.º 1
0
EXPORT_C TInt CMsvTestUtils::AppendScheduleTimeL(TMsvId aEntryId, TDes& rOutput)
	{
	TTime entryTime, schTime;
	TTaskInfo info;
	TInt err = ScheduleTime(aEntryId, entryTime, schTime, info);

	if (!err)
		{
		TBuf<128> dateString;

		entryTime.FormatL(dateString, _L("\tEntry: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
		rOutput.Append(dateString);

		schTime.FormatL(dateString, _L("\n\tSched: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
		rOutput.Append(dateString);

		rOutput.AppendFormat(_L(" (taskId %d)\n"), info.iTaskId);
		}
	else
		{
		rOutput.AppendFormat(_L("\tError %d: Cannot read schedule time for msg %d\n"), err, aEntryId);
		}

	return err;
	}
Exemplo n.º 2
0
EXPORT_C void TSTStringFormatter::AppendFileLength(TInt64 aLength, TDes &aLengthStr) 
{ 
        if (aLength<0) return; 

        TInt range; 
        for (range=0;range<3;++range) 
        { 
                if (aLength<1000*1000) break; // keep some digits from fraction 
                aLength/=1000; 
        } 

#ifdef EKA2 
        TReal len=aLength; 
#else 
        TReal len=aLength.GetTInt(); 
#endif 

        if (len>1000) { len/=1000; ++range; } 

        if (range==0) 
                aLengthStr.AppendFormat(_L("%.0f"),len); 
        else 
                aLengthStr.AppendFormat(_L("%.1f"),len); 

        switch (range) 
        { 
                case 0: aLengthStr.Append(_L(" B")); break; 
                case 1: aLengthStr.Append(_L(" kB")); break; 
                case 2: aLengthStr.Append(_L(" MB")); break; 
                case 3: aLengthStr.Append(_L(" GB")); break; 
                case 4: aLengthStr.Append(_L(" TB")); break; 
                default: __ASSERT_DEBUG(false,User::Panic(_L("#TStringFormatter"),0)); 
        } 
} 
Exemplo n.º 3
0
void CWsWindow::StatusDump(TDes &aBuf)
	{
	_LIT(KStatusString1,"CWsWindow[0x%x]RWindow[0x%x,%d],Pos(%d,%d),Size(%d,%d)");
	_LIT(KStatusString3,",Mode=%d");
	_LIT(KStatusInvisible,",Inv");
	aBuf.AppendFormat(KStatusString1,this,iClientHandle,LogHandle(),iRel.iTl.iX,iRel.iTl.iY,Size().iWidth,Size().iHeight);
	aBuf.AppendFormat(KStatusString3,(TInt)iScreen->DisplayMode());
	if (!IsVisible())
		aBuf.Append(KStatusInvisible);
	}
Exemplo n.º 4
0
// Gets the CPU count of all threads in process aproc 
//and returns the hour minute second in the references passed
//If CPU count cant be obtained returns -1
	int getCpuCount(TFileName& apname,TDes& aResult)
	{
		TInt64 proctime=0;
		int res;
		RThread thrd;
		TTimeIntervalMicroSeconds cputime(0);
		TBool notime;
		TFileName aprocname(apname);
		aprocname.Append('*');
		TFindThread tfinder(aprocname);
		notime=false;
		while(1)
			{
			res = tfinder.Next(aprocname);
			if(res!=KErrNone)	
				{
				break;							
				}
			res=thrd.Open(tfinder);
			if(res!=KErrNone)
				{
				notime=true;
				continue;
				}
			res=thrd.GetCpuTime(cputime);
			if(res!=KErrNone)	
				{
				// GetCpuTime() not supported. 
				//kernel doesn't support this
				}
			proctime+=cputime.Int64();
			thrd.Close();
			}
		TTime time(proctime);
		TDateTime date=time.DateTime();
			
		if(date.Day()==0)
			{
			aResult.AppendFormat(_L(" %02d:%02d:%02d "),date.Hour(),date.Minute(),date.Second());
			}
		else
			{	
			aResult.AppendFormat(_L(" %d-%02d:%02d:%02d "),date.Day(),date.Hour(),date.Minute(),date.Second());
			}
		if(notime)
			{	
			aResult.Append(_L("?"));
			}
		if(!notime)
			return 0;
		else
			return -1;	
	}
Exemplo n.º 5
0
// Gets memory information of the process aproc
	int getMemoryInfo(RProcess& aproc,TDes&  aResult)
		{
		
		int res=KErrNone;
		#ifdef __WINSCW__
		aResult.AppendFormat(_L("     ?           ?      "));
		#else
		TModuleMemoryInfo mem;
		res=aproc.GetMemoryInfo(mem);
		aResult.AppendFormat(_L("%-11u %-10u"),mem.iCodeBase,(mem.iCodeSize + mem.iInitialisedDataSize+mem.iConstDataSize + mem.iUninitialisedDataSize)/512);
		#endif
		return res;
		}
Exemplo n.º 6
0
/**
This function is used by RMobileSmartCardEap::Open() to convert the
TAID (which is binary data) to a string that can be passed through
ETel.  The conversion changes the binary data to a string of
hexadecimal semi-octets.

@param aBinData Buffer containing the binary data to be converted.
@param aText Buffer will contain the text representation of aBinData on
             return.

@see RMobileSmartCardEap::Open()
*/
void RMobileSmartCardEap::ConvertBinToText(const TDesC8& aBinData, TDes& aText)
	{
	TInt binLength = aBinData.Length();

	for (TInt pos = 0; pos < binLength; pos++)
		{
		_LIT(format, "%02X");
		aText.AppendFormat(format, aBinData[pos]);
		}
	}
void AppendInterfaceProperties(TDes& aDes, const SCdlInterface& aInterface)
	{
	aDes.AppendFormat(_L("%S\nUid: 0x%08x\nMajorVer: %d\nMinorVer: %d\nFlags: 0x%08x\nAPI size: %d\nEng major: %d\nEng minor: %d"), 
		aInterface.iName,
		aInterface.iUid,
		aInterface.iMajorVer,
		aInterface.iMinorVer,
		aInterface.iFlags,
		aInterface.iApiSize,
		aInterface.iMajorEngVer,
		aInterface.iMinorEngVer
		);
	}
void TEventEntry::ToStr(TDes& aStr)
	{
	if (IsEvent())  							// Event or Action
		{
		aStr.Append(KLitEvent);
		}
	else
		{
		aStr.Append(KLitAction);
		}

	if (iSequenceNumber>=0)
		{
		aStr.AppendFormat(KLit02D, iSequenceNumber);		
		}

	aStr.Append(KLitColon);

	if (iType!=EActionUserWait)
		{
		aStr.AppendFormat(KLitA02D, iAlarmIdx);	// Alarm idx
		}
	
	aStr.AppendFormat(KLitS, &TypeToStr());	// Event name


	if (iType==EEventVisible)  			// Visibility
		{
		aStr.AppendFormat(KLitS, &BoolToStr(iVisible));
		}
	
	if (iType==EEventSetState) 			// State flags
		{
		aStr.AppendFormat(KLitFlags, iAltSFlags);
		}

	if (iType==EActionUserWait)
		{
		aStr.AppendFormat(KLitDSec, iPeriod);
		if (iAlarmIdx==KBogusAlarmIdx)  aStr.AppendFormat(KLitCompleted);
		}
		
	if (iType==EActionSnooze || iType==EActionPauseSound)
		{
		aStr.AppendFormat(KLitForDMinutes, iPeriod/60);
		}
	}
Exemplo n.º 9
0
void CHlpFileEntry::MakeLocaleSpecificExtension(TDes& aNameToAppendTo, TLanguage aLanguage) const
	{
	_LIT(KLocaleExtensionFormat, ".H%02d");
	aNameToAppendTo.AppendFormat(KLocaleExtensionFormat, aLanguage);
	}
Exemplo n.º 10
0
void CTestList::AppendProfileCount(TDes &aDes, TInt aNum)
{
    aDes.AppendFormat(_L("%d, "),aNum);
}
Exemplo n.º 11
0
void CTestList::AppendProfileNum(TDes &aDes, TInt aNum)
{
    aDes.AppendFormat(_L("%d.%02d, "),aNum/1000000,(aNum%1000000)/10000);
}