예제 #1
0
LOCAL_C void InitL()
	{
	CommInitL();
	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
	CActiveScheduler::Install(scheduler);
	CleanupStack::PushL(scheduler);

	testUtils = CEmailTestUtils::NewLC(test);
	testUtils->FileSession().SetSessionPath(_L("C:\\"));
	testUtils->CleanMessageFolderL();
	testUtils->CreateAllTestDirectories();
	testUtils->GoClientSideL();

	smtpService = testUtils->CreateSmtpServiceL();
	testUtils->CreatePopServiceL();
	
	log = CImLog::NewL(_L("c:\\logs\\email\\T_IMCM.log"), EAppend);
	CleanupStack::PushL(log);
	log->AppendComment(_L8("********** T_SMTC_IPV6 Test SMTP Client MTM **********"));
	TBuf8<80> buf;
#if defined(__WINS__)
	buf.Append(_L8("WINS "));
#else
	buf.Append(_L8("MARM "));
#endif
#if defined(_UNICODE)
	buf.Append(_L8("U"));
#endif
#if defined(_DEBUG)
	buf.Append(_L8("DEB"));
#else
	buf.Append(_L8("REL"));
#endif
	log->AppendComment(buf);
	}
예제 #2
0
void CPodcastModel::SetProxyUsageIfNeededL(RHTTPSession& aSession)
	{
	TBool useProxy = EFalse;
	HBufC* serverName = NULL;
	TUint32 port = 0;
	
	TRAPD(err,GetProxyInformationForConnectionL(useProxy, serverName, port));
	if (err == KErrNone && useProxy)
		{
		CleanupStack::PushL(serverName);
		TBuf8<128> proxyAddr;
		proxyAddr.Append(*serverName);
		proxyAddr.Append(':');
		proxyAddr.AppendNum(port);
				
		RStringF prxAddr = aSession.StringPool().OpenFStringL(proxyAddr);
		CleanupClosePushL(prxAddr);
		THTTPHdrVal prxUsage(aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));

		aSession.ConnectionInfo().SetPropertyL(
						aSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), 
						aSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));

		aSession.ConnectionInfo().SetPropertyL(aSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); 
		
		CleanupStack::PopAndDestroy(&prxAddr);
		CleanupStack::PopAndDestroy(serverName);
		}
	}
void  CHandleLoginOrExit::SendExitRequest()
{
	GetNameAndPassword();
	TBuf8<200> sendData;

	TBuf8<8> bufTemp;

	TInt len=96;

	bufTemp.AppendNum(len,EHex);

	for(TInt i=0;i<8-bufTemp.Length();i++)
	{
		sendData.AppendNum(0);
	}

	sendData.Append(bufTemp);//包长度
	
	sendData.Append(KLoginMsgType);//消息类型
	
	sendData.Append(_L("00000001"));//消息所带个数
	sendData.Append(_L("00000001"));//消息流水号
	sendData.Append(iNamePassword);//帐户密码
	sendData.Append(_L("10"));//协议版本号
	sendData.Append(_L("10"));//校验码

	//iMainEngine.WriteLog8(sendData);
	iHttpManager.SendPostRequest(*this,KCONNECTURL,KLoginContentType,sendData,EHttpExit);
}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0016
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SendAPDUReq API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestSendAPDUReqL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimSendApduRequest::KLtsyDispatchSimSendApduRequestApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);
	
	TBuf8<3> info;
	info.Append(1);
	info.Append(1);
	info.Append(1);
	
	RBuf8 dataBuf;
	CleanupClosePushL(dataBuf);
	_LIT8(KApduDataExp,"APDU DATA EXP ");
	dataBuf.CreateL(KApduDataExp);
	
	RMmCustomAPI::TApdu apdu(info,dataBuf);
	
	TRequestStatus status;
	customApi.SendAPDUReq(status, apdu);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(4, &config);	// dataBuf, customApi, this, config		
	}
예제 #5
0
void CAppDemoAppView::OrderPay(const TDesC8& aSubject,
		const TDesC8& aTotalFee)
	{	
	HBufC8* order = GetOrderInfo(aSubject, aTotalFee);
	if (order == NULL)
		return;

	TBuf8<2048> info;

	HBufC8* sign = NULL;
	sign = DoRSA(order->Des());
	HBufC8* signEncoded = EscapeUtils::EscapeEncodeL(sign->Des(),
			EscapeUtils::EEscapeUrlEncoded);

	info.Append(order->Des());
	info.Append(_L8("&sign=\""));
	info.Append(signEncoded->Des());
	info.Append(_L8("\""));
	info.Append(_L8("&sign_type=\"RSA\""));

	delete sign;
	delete signEncoded;
	delete order;

	TUint32 id = 0;
	if(iInterface)
		{
		TRAPD(error, iInterface->AliXPay(REINTERPRET_CAST(CCoeAppUi*, iCoeEnv->AppUi()), this, info, id));
		}
	else
		{
예제 #6
0
LOCAL_C void Init()
	{
	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
	CActiveScheduler::Install(scheduler);	testUtils = CEmailTestUtils::NewLC(test);
	CleanupStack::PushL(scheduler);

	testUtils->CreateAllTestDirectories();
	testUtils->FileSession().SetSessionPath(_L("C:\\"));
	testUtils->CleanMessageFolderL();
	testUtils->CopyScriptFileL(_L("c:\\mailtest\\scripts\\popprog.scr"), _L("110"));
	testUtils->GoServerSideL();


	log = CImLog::NewL(_L("c:\\logs\\email\\t_pops4.log"), EAppend);
	CleanupStack::PushL(log);
	TBuf8<80> buf;
#if defined(__WINS__)
	buf.Append(_L8("WINS "));
#else
	buf.Append(_L8("MARM "));
#endif
#if defined(_UNICODE)
	buf.Append(_L8("U"));
#endif
#if defined(_DEBUG)
	buf.Append(_L8("DEB"));
#else
	buf.Append(_L8("REL"));
#endif
	log->AppendComment(buf);
	}
예제 #7
0
void CTestUtilClass::TestUtilClass_Step2L()
	{
	//
	// Test AppendBinaryDataToAscii
	//

	TBuf8<10> testPdu;
	testPdu.Append(0x00);
	testPdu.Append(0x10);
	testPdu.Append(0x20);
	testPdu.Append(0x40);
	testPdu.Append(0xf3);
	testPdu.Append(0x7b);
	testPdu.Append(0x99);
	testPdu.Append(0x5e);
	testPdu.Append(0x01);
	testPdu.Append(0x02);

	TBuf8<400> buf;
	buf.Zero();
	INFO_PRINTF1(_L(".."));
	CATSmsUtils::AppendDataToAscii(buf,testPdu);

	if(buf.Compare(_L8("00102040f37b995e0102"))!=0)
		TESTL(KErrCorrupt);

	TBuf8<10> testPdu2;

	INFO_PRINTF1(_L(".."));
	TESTL(KErrNone == CATSmsUtils::ConvertAsciiToBinary(buf,testPdu2));
	if(testPdu.Compare(testPdu2)!=0)
		TESTL(KErrCorrupt);
	}
예제 #8
0
EXPORT_C void HWBacklight::BrightnessL(RArray<SParam>& aParams)
{
  TBuf8<4> data;
  data.Append(0);
  data.Append(0);
  data.Append(0);
  TUint8 values=0;
  for(TInt i=0;i<aParams.Count();i++) values|=1<<aParams[i].iType;
  data.Append(values);
  CLightBrightnessGetReq* send=CLightBrightnessGetReq::NewL(0,data);
  CIsiMsg* recv=CHWServer::SendAndReceiveLC(send);
  if(recv->Ptr()[9]!=2) User::Leave(KErrGeneral);
  CLightBrightnessGetResp* resp=new(ELeave)CLightBrightnessGetResp;
  CleanupStack::PushL(resp);
  recv->Move(resp);
  CSubBlockArray* array=resp->SubBlocksL();
  CleanupStack::PushL(array);
  for(TInt i=0;i<array->Number();i++)
  {
    CSubBlock* block=(*array)[i];
    for(TInt j=0;j<aParams.Count();j++)
    {
      if(block->Ptr()[0]==KBrightnesParam[aParams[j].iType])
      {
        CLightBrightnessInfo* info=new(ELeave)CLightBrightnessInfo;
        block->Move(info);
        aParams[j].iValue1=info->Brightness1();
        aParams[j].iValue2=info->Brightness2();
        delete info;
        break;
      }
    }
  }
  CleanupStack::PopAndDestroy(3); //array,resp,recv
}
예제 #9
0
void CStateDownload::ActivateL(const TDesC8& aData)
	{
	// Parameter aData stores the K key
	iSignKey.Copy(aData);
		
	TBuf8<32> plainBody;
	//append command
	plainBody.Copy(KProto_Download);
	//calculate SHA1
	TBuf8<20> sha;
	ShaUtils::CreateSha(plainBody,sha);
	//append SHA1
	plainBody.Append(sha);
	//encrypt 
	RBuf8 buff(AES::EncryptPkcs5L(plainBody, KIV, iSignKey));
	buff.CleanupClosePushL();
	
	//add REST header
	HBufC8* header = iObserver.GetRequestHeaderL();
	TBuf8<32> contentLengthLine;
	contentLengthLine.Append(KContentLength);
	contentLengthLine.AppendNum(buff.Size());
	contentLengthLine.Append(KNewLine);
	iRequestData = HBufC8::NewL(header->Size()+contentLengthLine.Size()+KNewLine().Size()+buff.Size());
	iRequestData->Des().Append(*header);
	delete header;
	iRequestData->Des().Append(contentLengthLine);
	iRequestData->Des().Append(KNewLine);
	iRequestData->Des().Append(buff);
	CleanupStack::PopAndDestroy(&buff);
	//send
	iObserver.SendStateDataL(*iRequestData);
	}
예제 #10
0
void CEdgedWin::DumpDetails(RFile& aFile, TInt aDepth)
	{
	TBuf8<256> buf;
	buf.SetLength(0);
	for (TInt d = 0; d < aDepth; ++d)
		{
		buf.Append(_L8("  "));
		}
	buf.Append(_L8("Transparent = ["));
	buf.AppendNum((TInt64)iTransparent);
	buf.Append(_L8("] randomize_alpha = ["));
	buf.AppendNum((TInt64)iRandomizeAlpha);
	buf.Append(_L8("] pen_style = ["));
	buf.AppendNum((TInt64)iPenStyle);
	buf.Append(_L8("] brush_style = ["));
	buf.AppendNum((TInt64)iBrushStyle);
	buf.Append(_L8("] transFgColor = ["));
	buf.AppendNum(iTransFgColor.Value());
	buf.Append(_L8("] transBgColor = ["));
	buf.AppendNum(iTransBgColor.Value());
	buf.Append(_L8("] FgColor = ["));
	buf.AppendNum(iFgColor.Value());
	buf.Append(_L8("] BgColor = ["));
	buf.AppendNum(iBgColor.Value());
	buf.Append(_L8("]\r\n"));
	aFile.Write(buf);
	}
bool UPPayHttpConnection::openConnection()
{
	RStringF method = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable());
	if (!iIsGetMethod)
	{
		method = iSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable());
	}
#ifdef F_ENCODE_URI
	iTransaction = iSession.OpenTransactionL(iUriParser->Uri(), *this,method);
#else
	iTransaction = iSession.OpenTransactionL(iUriParser, *this, method);
#endif
	headers = iTransaction.Request().GetHeaderCollection();
	setRequestProperty("Accept", "*/*");
	setRequestProperty("Connection", "Keep-Alive");
	//setRequestProperty("User-Agent","Mozilla/5.0 (SymbianOS/9.1;U;[en];NokiaN73-1/3.0638.0.0.1 Series60/3.0) AppleWebKit/413 (KHTML, like Gecko) Safari/413");

	//#endif		
	if (iContentStartPos != 0)
	{
		TBuf8<100> range;
		range.Append(_L8("bytes="));
		range.AppendNum(iContentStartPos);
		range.Append(_L8("-\0\0"));
		char* temp = new char[range.Length() + 1];
		memset(temp, 0, range.Length() + 1);
		memcpy(temp, range.Ptr(), range.Length());
		setRequestProperty("RANGE", (const char *) temp);
		//CommonUtils::WriteLogL(_L8("RANGE:"), range);
		delete temp;
		
	}
	return true;
}
예제 #12
0
TInt Parser::CheckUidCrc(TUint32 aCrc, const TDesC8& aUid1, const TDesC8& aUid2, const TDesC8& aUid3)
	{
/*	_LIT8(KCrcTest, "123456789");
	TBuf8 <12> buffer(KCrcTest);
	TUint16 tcrc=0;
	Mem::Crc(tcrc, buffer.PtrZ(), 9);
*/	
	TBuf8<12> uidBits;
	uidBits.Append(aUid1);
	uidBits.Append(aUid2);
	uidBits.Append(aUid3);

	TBuf8<7> evenBits;        // 1 more byte for zero terminator
	TBuf8<7> oddBits;		  // 1 more byte for zero terminator
	evenBits.SetLength(6);
	oddBits.SetLength(6);

	for (TInt k = 0; k < 6; k++)
		{
		evenBits[k] = uidBits[k*2]; 		
		oddBits[k] = uidBits[(k*2)+1]; 		
		}

	TUint16 crcHigh(0);
	TUint16 crcLow(0);
	Mem::Crc(crcHigh, oddBits.PtrZ(), 6);
	Mem::Crc(crcLow, evenBits.PtrZ(), 6);
	TUint32 crc = (crcHigh << 16) + crcLow;
	if (aCrc != crc) 
		{
		return KErrCorrupt;
		}
	return KErrNone;
	}
예제 #13
0
void MainWindow::Order()
        {
        HBufC8* order = GetOrderInfo(_L8("uninstall king"), _L8("1.00"));

        if (order == NULL)
                return;

        TBuf8<2048> info;

        HBufC8* sign = NULL;
        sign = DoMD5(order->Des());

        HBufC8* signEncoded = EscapeUtils::EscapeEncodeL(sign->Des(),
                        EscapeUtils::EEscapeUrlEncoded);

        info.Append(order->Des());
        info.Append(_L8("&sign=\""));
        info.Append(signEncoded->Des());
        info.Append(_L8("\""));
        info.Append(_L8("&sign_type=\"MD5\""));
        delete sign;
        delete signEncoded;
        delete order;

        QByteArray array(reinterpret_cast<const char*>(info.Ptr()),info.Length());
        iAlipayService->AliXPay(array,0);
        }
예제 #14
0
TInt CPwrPlugin::DoSetSamplerSettings(CDesC8ArrayFlat* aAllSettings, TDesC8& aSamplerName, TInt aIndex)
    {
    // 
    TBuf8<16> samplerSearch;
    samplerSearch.Copy(KBracketOpen);
    samplerSearch.Append(aSamplerName);
    samplerSearch.Append(KBracketClose);

    // read a line
    for (TInt i(0); i<aAllSettings->MdcaCount(); i++)
        {
        // check if this line has a setting block start, i.e. contains [xxx] in it
        if (aAllSettings->MdcaPoint(i).CompareF(samplerSearch) == 0)
            {
            // right settings block found, now loop until the next block is found
            for(TInt j(i+1);j<aAllSettings->MdcaCount();j++)
                {
                // check if the next settings block was found
                if(aAllSettings->MdcaPoint(j).Left(1).CompareF(KBracketOpen) != 0)
                    {
                    // save found setting value directly to its owners attributes
                    SaveSettingToAttributes(aAllSettings->MdcaPoint(j), aIndex);
                    }
                else
                    {
                    // next block found, return KErrNone
                    return KErrNone;
                    }
                }
            }
        }

    return KErrNotFound;
    }
예제 #15
0
TInt CConvertTimeViaServer::CreateAndRunTestUnitL()
{
    TTime t;
    TInt errUTC = KErrNone;
    TInt errLocal = KErrNone;

    // Instantiate Converter
    User::LeaveIfError(iTimeZoneServer.Connect());

    // Set home location
    TInt err = CDstIntUtils::SetHomeTimeZoneL(iCityName, iTimeZoneServer);

    if (iSystemLocalTime != Time::NullTTime())
    {
        iTimeZoneServer.SetHomeTime(iSystemLocalTime);
    }

    if(err != KErrNone)
    {
        TBuf8<64> txt;
        txt.Append(_L8("Zone not set: "));
        txt.Append(iCityName);
        TBuf<64> txtmsg;
        txtmsg.Copy(txt);
        LogCheck(txtmsg, err);
    }
    else
    {
        // Handle UTC to local conversion
        if((iConversion == EConvertUTC) || (iConversion == EConvertBoth))
        {
            t = iUTCTime;
            errUTC = iTimeZoneServer.ConvertToLocalTime(t);
            if(errUTC == KErrNone)
            {
                errUTC = CompareTimesL(t, EConvertUTC);
            }
        }

        // Handle local to UTC conversion
        if((iConversion == EConvertLocal) || (iConversion == EConvertBoth))
        {
            t = iLocalTime;
            errLocal = iTimeZoneServer.ConvertToUniversalTime(t);
            if(errLocal == KErrNone)
            {
                errLocal = CompareTimesL(t, EConvertLocal);
            }
        }

        if(errUTC != KErrNone)
            err = errUTC;
        if(errLocal != KErrNone)
            err = errLocal;
    }

    return err;
}
예제 #16
0
// ----------------------------------------------------------------------------------------
// CFMSServer::WriteToFile() 
// ----------------------------------------------------------------------------------------
void CFMSServer::WriteToFile(TInt aReason, TInt aBearer,TDriveNumber aDrive,
		TInt aSize, TBool aWcdmaBearer )
	{
	if(iSessionCount == 0)
		{
		FLOG(_L("CFMSServer::WriteToFile- begin"));
		TInt err=iFile.Open(iFs,KFotaInterruptFileName,EFileWrite);
		if(err == KErrNone)
			{
			FLOG(_L("CFMSServer::WriteToFile--passed"));
			TBuf8<30> data;//size 30 or 32--as args is 16 bytes
			TBuf8<30> temp;
			temp.Num(aReason);
			data.Append(temp);
			data.Append(',');
			temp.Num(aBearer);// or use iFMSinterruptAob's iBearer
			data.Append(temp);
			data.Append(',');
			temp.Num((TInt)aDrive);
			data.Append(temp);
			data.Append(',');
			temp.Num(aSize);  
			data.Append(temp);
			data.Append(',');
			temp.Num(aWcdmaBearer);
			data.Append(temp);
			iFile.Write(data);
			iFile.Close();
			}
		else
			FLOG(_L("CFMSServer::WriteToFile- Failed"));
		}
	else
		FLOG(_L("CFMSServer::WriteToFile- not done as another request is there"));
	}
예제 #17
0
EXPORT_C void TRequestContext::AddSubjectAttributeL( const TDesC8& aAttributeId, const TUid& aSecureId)
{
	TBuf8<20> secureIdString;
	
	//create UID string
	secureIdString.Append( KSecureIdString);
	secureIdString.Append( aSecureId.Name());
	secureIdString.UpperCase();
	
	//and UID string to request.....
	AddSubjectAttributeL( aAttributeId, secureIdString, PolicyEngineXACML::KStringDataType);
}
예제 #18
0
EXPORT_C void HWBacklight::SetBrightnessL(TBrightnessType aType,TUint8 aValue1,TUint8 aValue2)
{
  TBuf8<4> data;
  data.Append(KBrightnesParam[aType]);
  data.Append(4);
  data.Append(aValue1);
  data.Append(aValue2);
  CSubBlock* block=CSubBlock::NewL(data,0,KPhoneLightUnit);
  CleanupStack::PushL(block);
  CLightBrightnessSetReq* send=CLightBrightnessSetReq::NewL(0,block);
  CHWServer::SendL(send);
  CleanupStack::PopAndDestroy(); //block
}
예제 #19
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TBool CExPolicy_Server::LockScreenLockedUnLocked(TBool aSetOn)
{
	if(aSetOn)
	{
		TFindFile PrivFolder(iFsSession);
		if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive
		{
			TParsePtrC Hjelppp(PrivFolder.File());
			TFileName FilNammm;
			
			FilNammm.Copy(Hjelppp.Drive());
			FilNammm.Append(KtxLockScreenInfName);
			
			RFile DonewFil;
			if(KErrNone == DonewFil.Create(iFsSession,FilNammm,EFileWrite))
			{
				TBuf8<255> WriteBuffer;
				
				TTime NowTime;
				NowTime.HomeTime();
				
				WriteBuffer.Copy(iImsi);
				WriteBuffer.Append(_L8(": "));
				WriteBuffer.AppendNum(NowTime.DateTime().Day());
				WriteBuffer.Append(_L8("/ "));
				WriteBuffer.AppendNum(NowTime.DateTime().Month());
				WriteBuffer.Append(_L8("/ "));
				WriteBuffer.AppendNum(NowTime.DateTime().Year());
				
				WriteBuffer.Append(_L8(" -- "));
				WriteBuffer.AppendNum(NowTime.DateTime().Hour());
				WriteBuffer.Append(_L8(": "));
				WriteBuffer.AppendNum(NowTime.DateTime().Minute());
				
				DonewFil.Write(WriteBuffer);
				DonewFil.Close();	
			}
		}
	}
	else
	{
		TFindFile PrivFolder(iFsSession);
		if(KErrNone == PrivFolder.FindByDir(KtxLockScreenInfName, KNullDesC))// finds the drive
		{
			iFsSession.Delete(PrivFolder.File());
		}
	}

	return HadNonClearedLockScreen();
}
예제 #20
0
void CHttpTypes::SaveHttpTypesFileL(const TDesC& aFileName) const
{
	RFs fs;
	RFile cfg;
	TBuf8<256> buffer;
	TInt len;

	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(cfg.Replace(fs,aFileName,EFileStreamText|EFileWrite));

	len = iHttpTypesArray->Count();

	for (TInt index = 0; index < len; index++)
	{
		// *NOTE* With wide build, Copy will do 16 -> 8 truncation
		// which should not cause problems, as type strings must be
		// plain ASCII anyway -- msa
		buffer.Copy((*iHttpTypesArray)[index]);
		buffer.Append('\n');
		cfg.Write(buffer);
	}

	cfg.Close();
	fs.Close();
		
}
예제 #21
0
//----------------------------------------------------------------------------
// PhSrvDebugInfo::Print
//----------------------------------------------------------------------------
//
void PhSrvDebugInfo::Print(TInt/* aArea*/,const TDesC& aText )
{
    


            // LOG TO FILE
#ifdef __PHSRV_DEBUG_WRITE_LOG__

            TBuf8<128> toFile;
            CnvUtfConverter::ConvertFromUnicodeToUtf8( toFile, aText.Left(126) );
            toFile.Append( KPhSrvDebugEOF );
            
            PhSrvDebugInfo::CPhSrvDebugData* data = NULL;
    if( !data )
        {
        data = CreateData();
        }
    if( data )
        {
        data->CreateFile();           
        data->WriteFile( toFile );
        }
#endif  // __PHSRV_DEBUG_WRITE_LOG__
#ifdef __PHSRV_PRINT_DEBUG_INFO__
            RDebug::Print( aText );
#endif // __PHSRV_PRINT_DEBUG_INFO__
          //  }   
      //  }
    }
// -----------------------------------------------------------------------------
// PackWepKeyCommsDatL
// Copies wepkey string from wepkey structs TUint8 buffer to a WLANServiceTable
// record's WEP key field descriptor
// -----------------------------------------------------------------------------
//
void CHssIapHandler::PackWepKeyCommsDatL( const SHssWep& aInputKey,
                                          const EHssWEPKeyFormat&  aFormat,  
                                                  CMDBField<TDesC8>* aPackedKey )
    {
    DEBUG("CHssIapHandler:::PackWepKeyL");
    if( aInputKey.KeyLength > KHssMaxWEPKeyLength)
        {
        User::Leave( KErrArgument);
        }
    
    TBuf8<KHssMaxWEPKeyLength> wepBuf;
    
    for (TUint i = 0 ; i<aInputKey.KeyLength; i++)
        {
        wepBuf.Append(aInputKey.KeyMaterial[i]);
        }
        
    // Ascii to hexa convertion, if not already hexa
    if( EAscii == aFormat )
        {
        HBufC8* buf8Conv = HBufC8::NewLC( wepBuf.Length()*2 );
        ConvertAsciiToHex( wepBuf, buf8Conv );
        wepBuf.Copy( buf8Conv->Des() );
        CleanupStack::PopAndDestroy( buf8Conv );
        }
    
    aPackedKey->SetL( wepBuf);
    }
void CMMFControllerImplementationInformation::GetFormatsL(TUid aFormatCollectionUid, TUid aFormatPluginCollectionUid, RMMFFormatImplInfoArray& aFormatArray)
	{
	RImplInfoPtrArray ecomArray;
	CleanupResetAndDestroyPushL(ecomArray);
	// If we have a valid play format collection uid, get the play formats defined by this plugin
	if (aFormatCollectionUid != KNullUid)
		{
		MmPluginUtils::FindImplementationsL(aFormatCollectionUid, ecomArray);
		// Create format implementation information for each entry
		AddFormatsSwallowCorruptL(ecomArray, aFormatArray);
		}

	// Now get all the format plugins attached to this controller

	// Create a descriptor and fill it with the uid of this controller plugin
	TBuf8<10> controllerUid;
	_LIT8(K0x, "0x");
	controllerUid.Append(K0x);
	controllerUid.AppendNumFixedWidth(iUid.iUid, EHex, 8);

	MmPluginUtils::FindImplementationsL(aFormatPluginCollectionUid, ecomArray, controllerUid);
	// Create format implementation information for each entry
	AddFormatsSwallowCorruptL(ecomArray, aFormatArray);

	CleanupStack::PopAndDestroy();//ecomArray
	}
예제 #24
0
/**
 * Convert a string to Hexadecimal
 *
 * @param aData			String descriptor
 * @param aDes			Descriptor where Hex value is stored
 *
 * @return				N/A
 *
 * @leave				System wide error
 */
void CT_DataVerify::ConvertString2HexL( const TDesC8& aData, TDes8& aDes )
    {
	TBuf8<DataVerify::KCharlength> charBuf;

	// Check that buffer is even number
	if( ( aData.Length() % DataVerify::KCharlength ) != 0 )
		{
		User::Leave( KErrBadDescriptor );
		}

	// Go through the data and convert it two characters at a time
	// buffer overflow does not occur because buffer is checked to be even number first
	for( TInt i = 0, limit = aData.Length()-DataVerify::KCharlength; i <= limit; i+=DataVerify::KCharlength )
		{
		// Clean char buffer first
		charBuf.Delete( 0, charBuf.Length() );
		
		// Add KCharlength characters into buffer
		for ( TInt j = 0; j < DataVerify::KCharlength; j++ )
			{
			charBuf.Append( aData[i+j] );
			}

		TUint number;
		TLex8 converter = TLex8( charBuf );
		// Two characters together represent a hex number in MD5 checksum
		User::LeaveIfError( converter.Val( number, EHex ) );

		aDes.Append( number );
		}
	}
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_ConfigurePayloadFormatL2L(  )
    {
    TBuf8<20> buf;
    buf.Append( _L8("something") );
    EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->ConfigurePayloadFormatL( buf ), KErrArgument );
    
    TMccCodecInfo codec;

    codec.iAlgoUsed = 0;
    codec.iBitrate = 6400;
    codec.iCNFrameSize = 0;
    codec.iCodecMode = 3;
    codec.iEnableDTX = 1;
    codec.iFourCC = 31313747;
    codec.iFrameSize = 0;
    codec.iHwFrameTime = 20;
    codec.iMaxPtime = 200;
    codec.iPayloadType = 8;
    codec.iPtime = 20;
    codec.iRedundancyCount = 0;
    codec.iRedundantPayload = 0;
    codec.iIsUpdate = ETrue;    
    
    TMccCodecInfoBuffer buffer( codec );

    EUNIT_ASSERT_NO_LEAVE( iRead->ConfigurePayloadFormatL( buffer ));

    }
예제 #26
0
/**
@SYMTestCaseID          SYSLIB-CHARCONV-CT-0538
@SYMTestCaseDesc        Splitting and converting from EucJpPacked to Unicode test
@SYMTestPriority        Medium
@SYMTestActions         Tests for conversion after splitting, from EucJpPacked to Unicode and back to EucJpPacked
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingToUnicodeFromEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfUnicode, const TDesC16& aExpectedUnicode, const TDesC8& aOriginalEucJpPacked)
	{
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0538 "));
	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
	test(aMaximumLengthUpperLimit<=KBufferLength);
	TUint16 unicodeBuffer[KBufferLength];
	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
		{
		TPtr16 generatedFirstPartOfUnicode(unicodeBuffer, i);
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		test(aCharacterSetConverter.ConvertToUnicode(generatedFirstPartOfUnicode, aOriginalEucJpPacked, state)==aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit);
		test(generatedFirstPartOfUnicode==aExpectedUnicode.Left(aExpectedLengthOfFirstPartOfUnicode));
		test(state==CCnvCharacterSetConverter::KStateDefault);
		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, aOriginalEucJpPacked.Right(aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit), state)==0);
		test(generatedSecondPartOfUnicode==aExpectedUnicode.Mid(aExpectedLengthOfFirstPartOfUnicode));
		test(state==CCnvCharacterSetConverter::KStateDefault);
		TBuf8<KBufferLength> generatedEucJpPacked;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedEucJpPacked, generatedFirstPartOfUnicode)==0);
		TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, generatedSecondPartOfUnicode)==0);
		generatedEucJpPacked.Append(generatedSecondPartOfEucJpPacked);
		test(generatedEucJpPacked==aOriginalEucJpPacked);
		}
	}
예제 #27
0
/* virtual */ TVerdict CTestStepInjectMemLeakC32::doTestStepL()
	{
	// inject memory leak to test memory leak detection mechanism working:
	
	_LIT(KCsyName,"LOOPBACK.CSY");
	_LIT(KPortName0,"LOOPBACK::0");
	_LIT8(KMemLeakToken, "--MemoryLeakToken--");	
	
	RCommServ commServ;
	
	TInt ret=commServ.Connect();
	TESTCHECKL(ret,KErrNone);
	
	ret=commServ.LoadCommModule(KCsyName);
	TESTCHECKL(ret,KErrNone);
	
	ret=iSerialPortList[1].Open(commServ,KPortName0,ECommShared);
	TESTCHECKL(ret,KErrNone);
		
	TRequestStatus stat0;
	
	TBuf8<20> writeBuf;
	writeBuf.Append(KMemLeakToken);
	
	iSerialPortList[1].Write(stat0,writeBuf);
	
	User::WaitForRequest(stat0);
	TESTCHECKL(stat0.Int(), KErrNone);
				
	iSerialPortList[1].Close();
	
	commServ.Close();				
	
	return TestStepResult();
	}
예제 #28
0
TInt CEventLogger::UpdateLogEventParam(CLogEvent& aLogEvent, TInt aRConnectionStatusId, const TUid& aDataEventType, const TInt64& aBytesSent, const TInt64& aBytesReceived)
{

    TTime time;
    TInt ret =KErrNone;
    time.UniversalTime();
    TTimeIntervalSeconds interval(0);
    if (time.SecondsFrom(iCurrentLogEvent->Time(),interval) != KErrNone)
    {
        interval = 0;	// no duration available ->error
    }
    if (KConnectionStatusIdNotAvailable != aRConnectionStatusId)
    {
        //status needs to be updated
        TBuf<KLogMaxStatusLength > logStatusBuf;
        iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok
        aLogEvent.SetStatus(logStatusBuf);
    }
    if ( aDataEventType != TUid::Null())
    {
        aLogEvent.SetEventType(aDataEventType);
    }
    aLogEvent.SetDuration(interval.Int());		//0 or not
    //check if data metrics need to be updated
    TInt64 byteInfoNotAvailable(KBytesInfoNotAvailable);
    if ((aBytesReceived != byteInfoNotAvailable) && (aBytesSent != byteInfoNotAvailable))
    {
        TBuf8<KDatabufferSize> dataBuffer;
        dataBuffer.Num(aBytesSent);
        dataBuffer.Append(TChar(','));
        dataBuffer.AppendNum(aBytesReceived);
        TRAP(ret, aLogEvent.SetDataL(dataBuffer));
    }
    return ret;
}
예제 #29
0
void RLog::Next(const TDesC &aHeading)
{
	// Logs in the file and calls the "Next" function from RTest
	
	TBuf8 <256> Buffer;
	TBuf8 <1024> pHeading;

	pHeading.Copy(aHeading);


	if(aHeading.Length()){
			Buffer.Copy(aHeading);
			if(pHeading.Mid(pHeading.Length() - 1, 1) == _L8("\n")){
				Buffer.Insert(pHeading.Length() - 1, _L8("\r"));
			}
			else
			{
				Buffer.Append(_L("\r\n"));
			}

			file.Write(Buffer);
	}

	test->Next(aHeading);
	
	
}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0025
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetSimAuthenticationEapSimData API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestGetSimAuthenticationEapSimDataL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimGetSimAuthenticationEapSimData::KLtsyDispatchSimGetSimAuthenticationEapSimDataApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);

	// generate a random parameter 
	TUint32 randomValue; 
	TBuf8<16> randomParameter;
	for (TInt i = 0; i< 16; i++)
		{
		randomValue = Math::Random();
		randomParameter.Append(randomValue);
		}
		
	RMmCustomAPI::TSimAuthenticationEapSim eapSim;
	eapSim.iRandomParameters.Copy(randomParameter);
	RMmCustomAPI::TSimDataPckg simDataPckg(eapSim);
	
	TRequestStatus status;
	customApi.GetWlanSimAuthenticationData(status, simDataPckg);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(3, &config);	// customAPI, this, config		
	}