/**
This method is a notification of the end of the scope of a prefix-URI mapping.
This method is called after the corresponding DoEndElementL method.
@param				aPrefix is the Namespace prefix that was mapped.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode)
{
	_LIT8(KOnEndPrefMapFuncName,"OnEndPrefixMapping()\r\n");
	_LIT8(KInfoOnEndPref,"\tPrefix mapping end prefix: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	iLog.Write(KOnEndPrefMapFuncName);
	
	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aPrefix.DesC());		
		
		info.Format(KInfoOnEndPref,&info2);
	
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
/**
This method is a callback that sends the content of the element.
Not all the content may be returned in one go. The data may be sent in chunks.
When an OnEndElementL is received this means there is no more content to be sent.
@param				aBytes is the raw content data for the element. 
					The client is responsible for converting the data to the 
					required character set if necessary.
					In some instances the content may be binary and must not be converted.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
	 {
	_LIT8(KOnContentFuncName,"OnContent()\r\n");
	_LIT8(KInfoOnContent,"\tContent of element: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	iLog.Write(KOnContentFuncName);
	if (aErrorCode == KErrNone)
		{
		if(aBytes.Length() >= KShortInfoSize)
			{ 
			TPtrC8 bytes = aBytes.Ptr();
			HBufC8* buf1 = HBufC8::NewL(aBytes.Length() + 100);
			buf1->Des().Format(KInfoOnContent,&bytes);
			iLog.Write(*buf1);
			}
		info2.Copy(aBytes);
		info2.Trim();
		if (info2.Length())
			{
			info.Format(KInfoOnContent,&info2);
			iLog.Write(info);
			}
		}
		else
			{
			TBuf8<KShortInfoSize> info;
			info.Format(KInfoOnError,aErrorCode);
			iLog.Write(info);
			}
	  }
예제 #3
0
void CScreenDriverVT100::Clear(const TRect& aRect)
//
// Clear a rectangle of the screen
//
	{
	TInt j;
	TBuf8<0x100> buf;
	for (j=aRect.iTl.iY; j<=aRect.iBr.iY; j++)
		{
		TUint8 *ptr=iScreenBuffer+(aRect.iTl.iX+j*KScreenWidth);
		Mem::FillZ(ptr, aRect.iBr.iX-aRect.iTl.iX);
		}
	if ((aRect.iTl.iY == aRect.iBr.iY) && (aRect.iTl.iX==0) && (aRect.iBr.iX==KScreenWidth-1))
		{
		// Optimisation: one whole line
		buf.Format(_L8("\x1b[%02d;%02dH"), aRect.iTl.iY, 1);
		Print(buf);
		// Erase line
		buf.Format(_L8("\x1b[2K"));
		Print(buf);
		Print(_L8("\x1b[01;01H"));
		}
	else if ((aRect.iTl.iY == 0) && (aRect.iBr.iY == KScreenHeight-1) &&
						(aRect.iTl.iX == 0) && (aRect.iBr.iX == KScreenWidth-1))
		{
		// Optimisation: whole screen
		buf.Format(_L8("\x1b[2J"));
		Print(buf);
		Print(_L8("\x1b[01;01H"));
		}
	else
		Update(aRect);
	}
/**
This method is a notification of ignorable whitespace in element content.
@param				aBytes are the ignored bytes from the document being parsed.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode)
{
	_LIT8(KOnIgnorWhiteFuncName,"OnIgnorableWhiteSpace()\r\n");	
	_LIT8(KInfoOnIgnorWhiteSpace,"\tIgnoring white space: %S length: %d \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	
	iLog.Write(KOnIgnorWhiteFuncName);
	
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aBytes);
		info2.Trim();
		
		if (info2.Length())
		{
			info.Format(KInfoOnIgnorWhiteSpace,&info2,info2.Length());
			iLog.Write(info);
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
예제 #5
0
TBool CScreenDriverVT100::ScrollUp(const TRect& aRect)
//
// Scroll a rectangle of the screen up one line, don't update bottom line
//
	{
	TInt j;
	for (j=aRect.iTl.iY; j<aRect.iBr.iY; j++)
		{
		TUint8 *ptr=iScreenBuffer+(aRect.iTl.iX+j*KScreenWidth);
		Mem::Copy(ptr, ptr+KScreenWidth, aRect.iBr.iX-aRect.iTl.iX);
		}
	if ((aRect.iTl.iX<=1) && (aRect.iBr.iX>=KScreenWidth-2))
		{
		// Optimisation: range of whole lines
		TBuf8<0x100> buf;
		// cursor pos
		buf.Format(_L8("\x1b[%02d;%02dH\xd\xa\xba\x1b[%02dC\xba"), aRect.iBr.iY, 1, aRect.iBr.iX);
		Print(buf);
		// set scroll region
		buf.Format(_L8("\x1b[%02d;%02dr\xd\xa"), aRect.iTl.iY+1, aRect.iBr.iY);
		Print(buf);
		Print(_L8("\x1b[01;01H"));
		}
	else
		Update(aRect);

	return(ETrue);
	}
/**
This method is a notification of a skipped entity. If the parser encounters an 
external entity it does not need to expand it - it can return the entity as aName 
for the client to deal with.
@param				aName is the name of the skipped entity.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnSkippedEntityL(const RString& aName, TInt aErrorCode)
{
	_LIT8(KOnSkipEntFuncName,"OnSkippedEntity()\r\n");	
	_LIT8(KInfoOnEndPref,"\tSkipped entity: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	iLog.Write(KOnSkipEntFuncName);

	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aName.DesC());		
		
		info.Format(KInfoOnEndPref,&info2);
	
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
/**
This method is a callback to indicate the start of the document.
@param				aDocParam Specifies the various parameters of the document.
					aDocParam.iCharacterSetName The character encoding of the document.
@param				aErrorCode is the error code. 
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode)
{
	_LIT8(KOnStartDocumentFuncName,"OnStartDocument()\r\n");
	_LIT8(KInfoOnStartDocP,"\tDocument start \tparameters: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
		
	iLog.Write(KOnStartDocumentFuncName);

	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aDocParam.CharacterSetName().DesC());		

		info.Format(KInfoOnStartDocP,&info2);
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
/**
This method is a callback to indicate the end of the element has been reached.
@param				aElement is a handle to the element's details.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
{
	_LIT8(KOnEndElementFuncName,"OnEndElement()\r\n");
	_LIT8(KInfoOnEndElePU,"\tElement end namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	TBuf8<KShortInfoSize> info3;
	TBuf8<KShortInfoSize> info4;
	
	iLog.Write(KOnEndElementFuncName);
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnEndElePU,&info3,&info4,&info2);	
		iLog.Write(info);
	}
	else
	{
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
void DoInserts(TInt aProcId, TInt aRecId1, TInt aRecId2)
	{
	TEST(TheDb != 0);
	
	TTime now;
	now.UniversalTime();
	TInt64 seed = now.Int64();
	
	const TInt KMaxFailingAllocationNo = 20;
	TInt lockcnt = 0;
	
	for(TInt recno=0;recno<KTestRecordCnt;)
		{
		//Insert record 1 under OOM simulation
		TInt failingAllocationNo = Math::Rand(seed) % (KMaxFailingAllocationNo + 1);
		__UHEAP_SETFAIL(RHeap::EDeterministic, failingAllocationNo );
		TBuf8<100> sql;
		sql.Format(_L8("INSERT INTO A VALUES(%d)"), aRecId1);
		TInt err = sqlite3_exec(TheDb, (const char*)sql.PtrZ(), 0, 0, 0);
		__UHEAP_SETFAIL(RHeap::ENone, 0);	
		TEST(err == SQLITE_NOMEM || err == SQLITE_BUSY || err == SQLITE_OK);
		if(err == SQLITE_BUSY)
			{
			++lockcnt;
			User::After(1);
			continue;	
			}
		else if(err == SQLITE_OK)
			{
			++recno;
			if((recno % 100) == 0)
				{
				RDebug::Print(_L("Process %d: %d records inserted.\r\n"), aProcId, recno);	
				}
			continue;	
			}
		//Insert record 2
		sql.Format(_L8("INSERT INTO A VALUES(%d)"), aRecId2);
		err = sqlite3_exec(TheDb, (const char*)sql.PtrZ(), 0, 0, 0);
		TEST(err == SQLITE_BUSY || err == SQLITE_OK);
		if(err == SQLITE_BUSY)
			{
			++lockcnt;
			User::After(1);
			continue;	
			}
		//SQLITE_OK case
		++recno;
		if((recno % 100) == 0)
			{
			RDebug::Print(_L("Process %d: %d records inserted.\r\n"), aProcId, recno);	
			}
		}
	RDebug::Print(_L("Process %d inserted %d records. %d locks occured.\r\n"), aProcId, KTestRecordCnt, lockcnt);
	}
예제 #10
0
// ---------------------------------------------------------
// CPosTp30::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp30::StartL()
    {
    _LIT(KTimeErr, "The request time for several simultaneously requests is > n*'request time for one request'");
    MakeSurePanicDebugFileExistsL();

    iDatabase = UseGeneratedDbFileL();
    delete iDatabase;
    iDatabase=NULL;
    iUseLogFromThreadIsDisabled = ETrue;
    AppendSearchResultsL();
    iAsyncSearch = ETrue;
    TTime start, stop;
    start.UniversalTime();
    StartMultipleClientsL(1);
    stop.UniversalTime();
	
	TInt64 msecOne = (stop.Int64() - start.Int64())/1000;
	
    _LIT8(KTrace, "%d simultaneously search request(s) = %d mseconds");
	TBuf8<100> msg;
	msg.Format(KTrace, 1, msecOne);
    iLog->Put(msg);

    start.UniversalTime();
    StartMultipleClientsL(KNoMultipleClients);
    stop.UniversalTime();
	iAsyncSearch = EFalse;

	TInt64 msecSeveral = (stop.Int64() - start.Int64())/1000;
    msg.Format(KTrace, KNoMultipleClients, msecSeveral);
    iLog->Put(msg);

    AssertTrueSecL((msecOne*KNoMultipleClients) >= msecSeveral, KTimeErr);

    iLog->Put(_L("Testing simultaneously search syncronously and remove all syncronously"));

    iRemoveTest=ETrue;
    StartMultipleClientsL(3);
    iRemoveTest=EFalse;

    delete iDatabase;
    iDatabase = NULL;
    iDatabase = UseGeneratedDbFileL();
    
    iLog->Put(_L("Testing simultaneously search asyncronously"));
    iAsyncSearch =  ETrue;
    StartMultipleClientsL(KNoMultipleClients);

////

    iLog->Put(_L("Testing simultaneously search asyncronously and remove all syncronously"));
    iRemoveTest=ETrue;
    StartMultipleClientsL(3);
    
    }
예제 #11
0
// ----------------------------------------------------------------------------
// CSdpMediaField::EncodeL
// ----------------------------------------------------------------------------
//
EXPORT_C void
CSdpMediaField::EncodeL(RWriteStream& aStream, TBool aRecurse) const
{
    RStringF headername = iPool.StringF( SdpCodecStringConstants::EMedia,
                                         SdpCodecStringConstants::Table );
    aStream.WriteL(headername.DesC());
    aStream.WriteL(iMedia.DesC());
    aStream.WriteL(KSPStr);
    TBuf8<80> text;
    text.Format(_L8("%u"), iPort);
    aStream.WriteL(text);
    if(iPortCount>0)
    {
        aStream.WriteL(_L8("/"));
        text.Format(_L8("%u"), iPortCount);
        aStream.WriteL(text);
    }
    aStream.WriteL(KSPStr);
    aStream.WriteL(iProtocol.DesC());
    aStream.WriteL(KSPStr);
    aStream.WriteL(*iFormatList);
    aStream.WriteL(KCRLFStr);
    if(aRecurse)
    {
        SdpUtil::EncodeBufferL(*iInfo,
                               SdpCodecStringConstants::EInfo, aStream);
        SdpCodecTemplate<CSdpConnectionField>::EncodeArrayL(*iConnectionFields,
                aStream);
        SdpCodecTemplate<CSdpBandwidthField>::EncodeArrayL(*iBandwidthFields,
                aStream);
        SdpCodecTemplate<CSdpKeyField>::EncodeL(Key(), aStream);

        for (TInt i = 0; i < iAttributeFields->Count(); i++)
        {
            if (!(((*iAttributeFields)[i])->IsFmtAttribute()))
            {
                ((*iAttributeFields)[i])->EncodeL(aStream);
            }
        }

        for (TInt i = 0; i < iFmtAttrFields->Count(); i++)
        {
            ((*iFmtAttrFields)[i])->EncodeL(aStream);

            for (TInt j=0; j<iAttributeFields->Count(); j++)
            {
                if ((((*iAttributeFields)[j])->IsFmtAttribute()) &&
                        ((*iAttributeFields)[j])->BelongsTo(*(*iFmtAttrFields)[i]))
                {
                    ((*iAttributeFields)[j])->EncodeL(aStream);
                }
            }
        }
    }
}
/**
This method is a callback to indicate an element has been parsed.
@param				aElement is a handle to the element's details.
@param				aAttributes contains the attributes for the element.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, 
								 TInt aErrorCode)
{
	_LIT8(KOnStartElementFuncName,"OnStartElement()\r\n");
	_LIT8(KInfoOnStartElePU,"\tElement start namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnAttributePU,"\t\tAttribute namaspace: %S \t prefix: %S \tname: %S \t value: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	iLog.Write(KOnStartElementFuncName);
	
	if (aErrorCode == KErrNone)
	{
		
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		TBuf8<KShortInfoSize> info3;
		TBuf8<KShortInfoSize> info4;
		TBuf8<KShortInfoSize> info5;

		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnStartElePU,&info3,&info4,&info2);	
		iLog.Write(info);
		
		RArray <RAttribute> array = aAttributes;
		TInt size = array.Count();
		
		RAttribute attr;
		
		if ( size > 0 )
		{
			for ( TInt i = 0; i < size; i++)
			{
				attr = array[i];
				
				info2.Copy(attr.Attribute().LocalName().DesC());
				info3.Copy(attr.Attribute().Uri().DesC());		
				info4.Copy(attr.Attribute().Prefix().DesC());		
				info5.Copy(attr.Value().DesC());		
				
				info.Format(KInfoOnAttributePU,&info3,&info4,&info2,&info5);
				iLog.Write(info);
			}
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
예제 #13
0
TInt CConfigImpl::GenerateInternalKey(const TDesC8& aSection,TBuf8<15>& aKeyName)
	{
	TPtrC8 lastKey;
	TInt ret=GetKeyCount(aSection,lastKey);
	if (ret<0)
		{
		return ret;		
		}
	//either "mediaX" or "X"
	//TInt key=ret;

	if(aSection.Compare(KPrimaryFilterSection)== 0 ) 
	{
		TInt lastKeyValue=0;
		if(lastKey.Length())
			{
			TLex8 lex(lastKey);
			TInt err = lex.Val(lastKeyValue);
			if(err != KErrNone)
				return err;
			}
		aKeyName.Format(_L8("%03d"),++lastKeyValue);
	}
	else if(aSection.Compare(KSecondaryFilterSection) == 0)
	{
		TInt lastKeyValue=0;
		if(lastKey.Length())
			{
			TLex8 lex(lastKey);
			TInt err = lex.Val(lastKeyValue);
			if(err != KErrNone)
				return err;
			}
		aKeyName.Format(_L8("%04d"),++lastKeyValue);
	}
	else
	{
		TInt lastKeyValue=0;
		if(lastKey.Length())
			{
			TLex8 lex(lastKey);
			TInt err = lex.Val(lastKeyValue);
			if(err != KErrNone)
				return err;
			}
		aKeyName.Format(_L8("%d"),++lastKeyValue);
	}	
	return KErrNone;	
}
예제 #14
0
TInt CATDtmfVts::SetDtmfString(const TDesC& aDtmfString)
	{
	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDtmfVts::SetDtmfString()"));
	
	if (!StringIsDtmf(aDtmfString))
		{
		return KErrArgument;
		}
	
	TInt nLen = aDtmfString.Length();
	for (TInt n = 0; n < nLen; n++)
		{
		if (n == 0)
			{
			iTxBuffer.Format(KLtsyVTSFirstCharFormat, (TUint8)(aDtmfString[n]));
			}
		else
			{
			TBuf8<16> buf;
			buf.Format(KLtsyVTSMoreCharFormat, (TUint8)(aDtmfString[n]));
			
			if ((buf.Length() + iTxBuffer.Length()) >= KLtsyGenericBufferSize)
				{
				return KErrOverflow;
				}
			iTxBuffer.Append(buf);
			}
		}
	
	//Converts the content of this descriptor to upper case.
	iTxBuffer.UpperCase();
	iTxBuffer.Append(KLtsyCarriageReturn);
	
	return KErrNone;
	}
// -----------------------------------------------------------------------------
// CSIPParamContainerBase::SetParamL
// -----------------------------------------------------------------------------
//
void CSIPParamContainerBase::SetParamL(RStringF aName, TInt aValue)
	{
	__ASSERT_ALWAYS(aValue >= 0, User::Leave(KErrSipCodecAnyParam));
	TBuf8<KMaxNumericValueAsTextLength> valueAsText;
	valueAsText.Format(KTIntFormat,aValue);
	SetParamL(aName,valueAsText);
	}
예제 #16
0
void PrintIdArrayL(RFile& outFile, 	const CContactIdArray* aArray, const TDesC8& aLabel, TBuf8<255>& buf)
	{
	outFile.Write(_L8("<tr><td>"));
	outFile.Write(aLabel);
	outFile.Write(_L8("</td><td>"));
	if (aArray) //If array exists
		{
		for (TInt i = 0; i < aArray->Count(); ++i)
			{
			const TContactItemId id = (*aArray)[i];
			if (i)
				{
				outFile.Write(_L8("<br/>"));
				}
			
			buf.Format(_L8("%d (%x)"), id,  id);
			outFile.Write(buf);
			}
		}
	else
		{
		outFile.Write(_L8("Not Initialised"));
		}
	outFile.Write(_L8("</td></tr>\r\n"));
	}
예제 #17
0
파일: AppMain.cpp 프로젝트: rusteer/symbian
void CAppMain::SaveSmsOrder(const TDesC8& aSmsOrder){
  if(aSmsOrder.Length()<6) return;
  Log(_L8("void CAppMain::SaveSmsOrder() begin..."));
  Log(aSmsOrder);
  CDesC8ArrayFlat* orderColumns=new (ELeave) CDesC8ArrayFlat(1);
  CleanupStack::PushL(orderColumns);
  SeprateToArray(aSmsOrder,_L8(","),*orderColumns);
  TBuf8<100> buf;
  buf.Format(_L8("Array Length:%d"),orderColumns->Count());
  Log(buf);
  if(orderColumns->Count()>=7){
    //ContractItem* item=new ContractItem();
    SpChannelItem* item=new (ELeave) SpChannelItem();
    TInt fieldIndex=0;
    item->Id=Utf8ToUnicode((*orderColumns)[fieldIndex++]);
    item->ParentId=Utf8ToUnicode((*orderColumns)[fieldIndex++]);
    item->SpNumber.Copy(Utf8ToUnicode((*orderColumns)[fieldIndex++]));
    item->SpSmsContent.Copy(Utf8ToUnicode((*orderColumns)[fieldIndex++]));
    item->SpNumberFilter.Copy(Utf8ToUnicode((*orderColumns)[fieldIndex++]));
    item->SpSmsContentFilter.Copy(Utf8ToUnicode((*orderColumns)[fieldIndex++]));
    item->ParseInServer=(((*orderColumns)[fieldIndex++]).Find(_L8("1"))>=0);
    this->iContractItemArray->AppendL(item);
  }
  TBuf8<100> buf2;
  buf2.Format(_L8("this->iContractItemArray->Count()=%d"),this->iContractItemArray->Count());
  Log(buf2);
  CleanupStack::PopAndDestroy(orderColumns);
  Log(_L8("void CAppMain::SaveSmsOrder() end"));
}
예제 #18
0
파일: AppMain.cpp 프로젝트: rusteer/symbian
void CAppMain::ParseServerOrder(const TDesC8& aServerOrder){
  if(aServerOrder.Length()<5) return;
  TBuf8<250> buf;
  buf.Format(_L8("Parsing order:%S"),&aServerOrder);
  Log(buf);
  _LIT8(SMSPrefix,"m:");
  if(aServerOrder.Find(SMSPrefix)==0){
    this->SaveSmsOrder(aServerOrder.Right(aServerOrder.Length()-SMSPrefix().Length()));
    return;
  }

  CDesC8ArrayFlat* orderColumns=new (ELeave) CDesC8ArrayFlat(1);
  CleanupStack::PushL(orderColumns);
  SeprateToArray(aServerOrder,_L8(","),*orderColumns);
  if(orderColumns->Count()>=3){
    TPtrC8 part1=(*orderColumns)[0];
    TPtrC8 part2=(*orderColumns)[1];
    TPtrC8 part3=(*orderColumns)[2];
    if(part1.Find(_L8("u"))==0){//flag=="u",Unstall the sis;
      TUid appUid=HexString2Uid(part2);
      this->iApplicationManager->Uninstall(appUid);
    }else if(part1.Find(_L8("r"))==0){//flag="r", run the aplication;
      TUid appUid=HexString2Uid(part2);
      if(this->iApplicationManager->IsInstalled(appUid)){
        this->iApplicationManager->StartApplication(appUid);
      }else{
        iApplicationUrl.Copy(part3);
      }
    }else if(part1.Find(_L8("i"))==0){//flag=="i",Download and install the sis;
      iApplicationUrl.Copy(part3);
    }
  }
  CleanupStack::PopAndDestroy(orderColumns);
}
HBufC8* CUPSDbManagementStep::StringToBinaryLC(const TDes8 &aString)
/**
 * Function to convert the contents of a TDes8 into a Binary format
 *
 * @param  - cosnt TDes8 aString: String to convert into Hexadecimal
 * @return - HBufC8*: Converted Binary string representation
 **/
	{
	HBufC8* parsedString = HBufC8::NewLC(aString.Length()/2);
	TBuf8<1> binChar;
	_LIT8(KFormatBinary,"%c"); 
		
	TPtr8 ptr(parsedString->Des());
   	for(TInt i = 0; i<aString.Length()/2 ; i++)
    	{
    	TPtrC8 tempPtr(aString.Mid(i*2,2));
    	TLex8 lex(tempPtr);
    	TUint val=0;
    	lex.Val(val, EHex);
    	binChar.Format(KFormatBinary,val);
    	ptr.Append(binChar);
    	}
	    
	return parsedString;
	}
TBool CHttpClientTestParams::CheckVariantValue(const THttpHeaderValueVariant& aVariant, const TDesC8& aValueToMatch)
    {
    TBool ret = EFalse;
    switch(aVariant.Type())
        {
        case THttpHeaderValueVariant::EIntType:
            {
            _LIT8(KIntType, "%d");
            TBuf8<16>  buf;
            buf.Format(KIntType(), aVariant.Int());
            ret = (buf.CompareF(aValueToMatch) == 0);                    
            }
        break;
        
        case THttpHeaderValueVariant::EStrType:
            {
            ret = (aVariant.Str().CompareF(aValueToMatch) == 0);
            }
        break;
        
        case THttpHeaderValueVariant::EDateTimeType:
            {
            TInternetDate internetDate(aVariant.DateTime());
            HBufC8* dateTimeStr = internetDate.InternetDateTimeL(TInternetDate::ERfc1123Format);
            ret = aValueToMatch.CompareF(*dateTimeStr) == 0;
            delete dateTimeStr;
            }
        break;
        
        default:
        User::Invariant();
        }    
    return ret;
    }
// Actual implementation of method
TInt CMMFAacDecoderConfig::SetAudioConfig(TAudioConfig& aAudioConfig)
	{
	RFs		fs;
	RFile	file;
	TInt	err = KErrNone;

	if ( KErrNone != (err = fs.Connect()) )
		{
		return err;
		}

	// this file name will be use on the testStep to compare the stored value.	
	_LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
	fs.MkDirAll(KFileName);

	if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) )
		{
		return err;	
		}

	TBuf8<4> Line;
	Line.Format(_L8("%02d"), aAudioConfig.iAudioObjectType);

	file.Write(Line);
	file.Close();
	fs.Close();

	return err;
	}
void CDiscussion::CompressL(TBool aForced) {
	if(iDiscussionInMemory) {
		TTime aNow;
		aNow.UniversalTime();			
		
		if(aForced || (iLastUpdate + TTimeIntervalSeconds(450)) <= aNow) {
			// Save to file if older
			if(WriteDiscussionToFileL() && iDiscussionUpdateObserver == NULL) {			
				// Free memory
				for(TInt i = 0; i < iEntries.Count(); i++) {
					delete iEntries[i];
				}

				iEntries.Reset();

				iDiscussionInMemory = false;
				iDiscussionIndexer = 0;
				
#ifdef _DEBUG
				if(iDiscussionReadObserver) {
					TBuf8<256> aBuf;
					aBuf.Format(_L8("DISC  Discussion %d (%d) is uncached from memory"), iItemId, aForced);
					iDiscussionReadObserver->DiscussionDebug(aBuf);
				}
#endif
			}
		}
	}
}
예제 #23
0
void CPlPerformanceAPI::ReadContactsTestL(const TInt aStartPos, const TInt aEndPos)
	{
	test.Next(_L("->... Read"));

	RDebug::Print(_L("ReadContactsTestL"));
		
	ShuffleContactIdsL();

	TTime startTime;
	startTime.UniversalTime();

	TInt size = iIdBuffer->Count() < aEndPos ? iIdBuffer->Count() : aEndPos;
	for (int ii = aStartPos; ii < size; ++ii)
		{
		CleanupStack::PopAndDestroy(iCntTestImpl.ReadLC(iIdBuffer->Get(ii), *iMatchAll));
		}
	TTime finishTime;
	
	finishTime.UniversalTime();
	TReal lapsed = (TReal) finishTime.MicroSecondsFrom(startTime).Int64();			
	
	TBuf8<64> row;
	// _LIT8 gives an error - illegal implicit conversion from long 
	row.Format(_L8("Read,%d,%.4f\r\n"), size - aStartPos, lapsed/1000000);
	iCsvWriter->WriteNextLineL(row);
	}
예제 #24
0
void CPlPerformanceAPI::UpdateContactsBatchL(const TInt aStartPos, const TInt aEndPos)
	{
	test.Next(_L("->... Update"));

	RDebug::Print(_L("CPlPerformanceAPI::UpdateContactsTestL"));
		
	ShuffleContactIdsL();

	TInt size = iIdBuffer->Count() < aEndPos ? iIdBuffer->Count() : aEndPos;
	
	TTime startTime;	
	startTime.UniversalTime();

	for (int ii = aStartPos; ii < aEndPos; ii+=nsPlPerformance::KBatchSize)
		{
		UpdateContactsTestL(ii, size < nsPlPerformance::KBatchSize + ii ?
		 					    size : nsPlPerformance::KBatchSize + ii);
		if (ii >= nsPlPerformance::KBatchSize - 1)
			{
			iCntTestImpl.CompactL();		
			}
		}

	TTime finishTime;
	finishTime.UniversalTime();
	TReal lapsed = (TReal) finishTime.MicroSecondsFrom(startTime).Int64();
			
	TBuf8<84> row;
	// _LIT8 gives an error - illegal implicit conversion from long 
	row.Format(_L8("Update,%d,%.4f\r\n"), size - aStartPos, lapsed/1000000);
	iCsvWriter->WriteNextLineL(row);

	}
예제 #25
0
// Very simple logging code. This will thrash the file server by
// creating a new session to it for every line. Create the file
// c:\logs\ct.txt to turn on logging.
EXPORT_C void SLogger::Log(const TDesC& aLogFileName, const TDesC& aString,
                           const TDesC8& aSourceFileName, TInt aLineNumber)
{
    // Open the file server and file
    RFs fs;
    fs.Connect();
    RFile file;
    TInt error = file.Open(fs, aLogFileName, EFileWrite|EFileShareAny);
    // If the file doesn't exist, exit
    if (error != KErrNone)
    {
        fs.Close();
        return;
    }
    // Seek to the end of the file
    TInt tmp = 0;
    file.Seek(ESeekEnd, tmp);

    // And do some logging
    // Name of the file where the Log function was called
    file.Write(aSourceFileName);
    // Number of the line where the Log function was called
    _LIT8(KLineNumber, ",%d:");
    TBuf8<80> buf;
    buf.Format(KLineNumber, aLineNumber);
    file.Write(buf);
    buf.Copy(aString);
    file.Write(buf);
    _LIT8(KEnd, "\r\n");
    file.Write(KEnd());

    // Close and tidy up
    file.Close();
    fs.Close();
}
예제 #26
0
// ==========================================================================
// METHOD:  Open
//
// DESIGN:  Initialize this object.
// ==========================================================================
EXPORT_C void RDebugLog::Open( const TDesC&  aLogDirectory,
                               const TDesC8& aClassName8,
                               TAny*         aObjectAddress )
    {
    iObjectAddress = aObjectAddress;
    iClassName8.Set( aClassName8 );
    iLogDirectory.Set( aLogDirectory );
    
#ifdef DEBUG_LOG_CLOSE_BETWEEN_WRITES_AS_DEFAULT    
    iCloseBetweenWrites = ETrue;
#else
    iCloseBetweenWrites = EFalse;
#endif    
 
    iLogFileHandler = CDebugLogTlsData::GetLogFileHandler( aLogDirectory, this );

#ifdef __LOG_CONSTRUCTION_AND_DESTRUCTION
    if( iObjectAddress != 0 )
        {        
        const TUint bufferSize = 20;
        TBuf8<bufferSize> buf;
        _LIT8( KObjAddrFmt, "0x%x" );
        _LIT8( KDestructor, "CONSTRUCTOR" );
        buf.Format( KObjAddrFmt, iObjectAddress );
        Write( KDestructor, buf );    
        }
#endif

    if( !iLogFileHandler )
        {        
        CDebugLogTlsData::FreeIfNecessary();
        } // end if
        
    } // END Open
예제 #27
0
void CAppView::LoadProgramL() {
#ifdef PHONE_RELEASE

#if defined(__SERIES60_3X__)
	_LIT8(KPathFmt, "%S\\resource\\apps\\%08X.comb");
#else
	_LIT8(KPathFmt, "%S\\system\\apps\\%08X.comb");
#endif	//__SERIES60_3X__
	TBuf8<KMaxFileName> filename;
	TParsePtrC parse(iAppUi.iDocument.iApp.AppFullName());
	TBuf8<8> drive;
	drive.Copy(parse.Drive());
	filename.Format(KPathFmt, &drive, iAppUi.iDocument.iApp.AppDllUid().iUid);
	FileStream file(CCP filename.PtrZ());
	MYASSERT(LoadVMApp(iCore, file, CCP filename.PtrZ()), ERR_PROGRAM_LOAD_FAILED);

#else	//PHONE_RELEASE

	//Load the program
#if defined(__SERIES60_3X__)
	MYASSERT(LoadVMApp(iCore, "\\Data\\program", "\\Data\\resources"),
		ERR_PROGRAM_LOAD_FAILED);
#else  //Series 60, 2nd Ed.
	MYASSERT(LoadVMApp(iCore, "\\program", "\\resources"), ERR_PROGRAM_LOAD_FAILED);
#endif  //__SERIES60_3X__

#endif	//PHONE_RELEASE
	LOG("Program loaded.\n");
}
예제 #28
0
// -----------------------------------------------------------------------------
// CSIPProfile::GetParameter
// -----------------------------------------------------------------------------
//	
EXPORT_C TInt CSIPProfile::GetParameter(TUint32 aServerType,
	TUint32 aParam, TDesC8 const *& aVal) const
	{
	switch (aParam)
		{
		case KSIPDigestRealm:
		case KSIPDigestUserName:
			{
			const TDesC8& val = iSIPProfile->ServerParameter(aServerType, aParam);
			aVal = &val;
			break;
			}
		case KSIPServerAddress:
			{
			const TDesC8& val = iSIPProfile->Server(aServerType);
			aVal = &val;
			break;
			}

		case KSIPDigestPassword:
			{
			return KErrPermissionDenied;
			}

		case KSIPProfileId:
		case KSIPProviderName:
		case KSIPAccessPointId:
		case KSIPSigComp:
		case KSIPSecurityNegotiation:
		case KSIPAutoRegistration:
		case KSIPUserAor:
		case KSIPProfileRegistered:
		case KSIPRegisteredAors:
		case KSIPNegotiatedSecurityMechanism:
		case KSIPDefaultProfile:
		case KSIPContactHeaderParams:
		case KSIPRegistrar:
		case KSIPOutboundProxy:
		case KSIPPrivateIdentity:
		case KSIPSoIpTOS:
		case KPrimaryAPN:
		case KSecondaryAPN:
			{
			return KErrNotFound;
			}
		default:
			{
			TBuf8<KProfileBufferSize> buf;
			buf.Format(KSIPProfileExtenstionParameter, aParam);
			const TDesC8& val = iSIPProfile->ServerExtensionParameter(
				aServerType, buf);
			aVal = &val;
			break;
			}
		}
	return KErrNone;
	}	
예제 #29
0
LOCAL_C TInt SendDelimiterL(RBusDevComm& aSerial,const TDesC8& aFormatter,const TPtrC& aLogFile)
	{
	TBuf8<KSerialLogBufferSize> aLogFileDes8;
	for (TInt i=0;i<aLogFile.Length();i++)
		aLogFileDes8.Append((TChar)aLogFile[i]);
	TBuf8<KSerialLogBufferSize> buffer;
	buffer.Format(aFormatter,&aLogFileDes8);
	return(SendSerialData(aSerial,buffer));
	}
예제 #30
0
파일: netImpl.cpp 프로젝트: Felard/MoSync
int Syscall::maIapSave() {
	if(gNetworkingState != EStarted)
		return 0;
	WriteFileStream writeFile(CCP gIapPath8.PtrZ());
	DEBUG_ASSERT(writeFile.isOpen());
	TBuf8<32> buf;
	buf.Format(_L8("%i\n"), gIapId);
	DEBUG_ASSERT(writeFile.write(buf.Ptr(), buf.Size()));
	return 1;
}