本文整理汇总了C++中TRAP函数的典型用法代码示例。如果您正苦于以下问题:C++ TRAP函数的具体用法?C++ TRAP怎么用?C++ TRAP使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRAP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rfs
TInt RMmCustomAPI::GetParameterValue(TInt aLineNumber,TInt aIndex )
{
if ( KErrNone != iFileError)
return -1;
RFile fread;
TInt lError = fread.Open(iFs,KMyFile,EFileRead);
RFileReadStream rfs(fread);
TChar delmeter(10);
TInt ret = -9999;
TInt err;
if ( KErrNone == lError )
{
for(TInt i = 0; i < aLineNumber; i++ )
{
TRAP(err,rfs.ReadL(iLineBuffer,delmeter));
if(err != KErrNone)
{
rfs.Close();
fread.Close();
return -1;
}
iLineBuffer.Copy(iLineBuffer.Left(iLineBuffer.Length() - 2 ));
}
}
TBuf8<64> restBuffer;
TInt pos = KErrNotFound;
TChar c(44); // 44 means ','
if(aIndex != -1 )
{
for(TInt i = 0; i < aIndex; i++ )
{
pos = iLineBuffer.Locate(c);
if(pos == KErrNotFound)
break;
restBuffer.Copy(iLineBuffer.Left(pos ));
iLineBuffer.Copy(iLineBuffer.Mid( pos + 1));
}
if(pos != KErrNotFound)
iLineBuffer.Copy(restBuffer);
}
if(ret == -9999)
{
pos = iLineBuffer.Locate(c);
if(pos != KErrNotFound)
{
restBuffer.Copy(iLineBuffer.Left(pos ));
iLineBuffer.Copy(restBuffer);
}
TLex8 input(iLineBuffer);
input.Val(ret);
}
rfs.Close();
fread.Close();
return ret;
#if 0
RFs fs;
RFile fread;
TInt lError = fs.Connect();
if ( KErrNone != lError )
return -1;
lError = fread.Open(fs,KMyFile,EFileRead);
RFileReadStream rfs(fread);
TBuf8<8> buf;
TChar delmeter(10);
TInt ret = -999;
TInt err;
if ( KErrNone == lError )
{
for(TInt i = 0; i < aIndex; i++ )
{
TRAP(err,rfs.ReadL(buf,delmeter));
if(err != KErrNone)
{
rfs.Close();
fread.Close();
fs.Close();
return -1;
}
buf.Copy(buf.Left(buf.Length() - 2 ));
}
}
if(ret == -999)
{
TLex8 input(buf);
input.Val(ret);
}
rfs.Close();
fread.Close();
//.........这里部分代码省略.........
示例2: INFO_PRINTF1
TVerdict CTestDevVideoPlayGetSupportedSnapshotFormats::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
{
TVerdict ret = EFail;
TInt expErr = KErrNone;
INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSupportedSnapshotFormats"));
// expected results
if (iTestType != ETestValid)
{
ERR_PRINTF1(_L("Error - invalid test step type"));
return EInconclusive;
}
TInt err = KErrNone;
// THwDeviceId hwDecoder = 0;
// THwDeviceId hwPostProc = 0;
// select decoder
// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
if (err != KErrNone)
{
ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
return EInconclusive;
}
// select post-processor
// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
if (err != KErrNone)
{
ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
return EInconclusive;
}
// initialize CDevVideoPlay and wait for response
// iError is set by the MdvpoInitComplete callback
aDevVideoPlay.Initialize();
if (iError != KErrNone)
{
ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
return EInconclusive;
}
RArray<TUncompressedVideoFormat> vidFormats;
// get a list of supported formats from the plugin
TRAP(err, aDevVideoPlay.GetSupportedSnapshotFormatsL(vidFormats) )
// check picture and timestamp from callback
if (err == KErrNone)
{
if ( vidFormats.Count() == 3)
{
if ((vidFormats[0] == KTestVidFormat1) &&
(vidFormats[1] == KTestVidFormat2) &&
(vidFormats[2] == KTestVidFormat3) )
{
INFO_PRINTF1(_L("Snapshot format list checks ok"));
ret = EPass;
}
else
{
ERR_PRINTF1(_L("Error - Snapshot format list is corrupt!"));
}
}
}
else
{
ERR_PRINTF3(_L("GetSupportedSnapshotFormatsL() gave error %d (expected %d)"),err, expErr);
}
vidFormats.Reset();
vidFormats.Close();
return ret;
}
示例3: TRAPD
void CCustomCommand::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
{
#ifdef _DEBUG
RDebug::Print (_L ("CCustomCommand::MoscoStateChangeEvent"));
#endif
logger->Log(_L("MoscoStateChangeEvent called, error: %d prev: %d curr : %d"),aErrorCode,aPreviousState,aCurrentState);
iCallBackErr = aErrorCode;
TUint bitRate = recorder->SourceBitRateL();
logger->Log(_L("SourceBitRateL %d "),bitRate);
if (recorder && aErrorCode == KErrNone && aCurrentState == CMdaAudioClipUtility::EOpen && aPreviousState == 0)
{
TBuf8<25> dataFrom;
TRequestStatus status;
TMMFMessageDestinationPckg dummyPckg;
TInt dummyFunc = 100;
TBuf8<8> dummyBuff;
// Initialize
recorder->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
logger->Log(_L("Mode set"));
recorder->SetGain(recorder->MaxGain());
logger->Log(_L("Gain set"));
recorder->SetVolume(recorder->MaxVolume());
logger->Log(_L("Volume set"));
recorder->SetPosition(TTimeIntervalMicroSeconds(TInt64(0)));
logger->Log(_L("Position set"));
TRAPD(err, recorder->PlayControllerCustomCommandSync(dummyPckg, dummyFunc,
dummyBuff, dummyBuff, dataFrom));
if (err != KErrNone)
{
logger->Log(_L("PlayControllerCustomCommandSync with dataFrom - err=%d"), err);
}
logger->Log(_L("PlayControllerCustomCommandSync with dataFrom successful"));
TRAP(err, recorder->PlayControllerCustomCommandSync(dummyPckg, dummyFunc,
dummyBuff, dummyBuff));
if (err != KErrNone)
{
logger->Log(_L("PlayControllerCustomCommandSync - err=%d"), err);
}
logger->Log(_L("PlayControllerCustomCommandSync successful"));
recorder->RegisterForAudioLoadingNotification(*this);
logger->Log(_L("RegisterForAudioLoadingNotification set"));
recorder->RegisterAudioResourceNotification(*this,KUidInterfaceMMFController);
logger->Log(_L("RegisterAudioResourceNotification set"));
recorder->CancelRegisterAudioResourceNotification(KUidInterfaceMMFController);
logger->Log(_L("CancelRegisterAudioResourceNotification set"));
//PlayController
TRAPD(err1, recorder->RecordControllerCustomCommandSync(dummyPckg, dummyFunc,
dummyBuff, dummyBuff, dataFrom));
if (err1 != KErrNone)
{
logger->Log(_L("RecordControllerCustomCommandSync with dataFrom - err=%d"), err1);
}
logger->Log(_L("RecordControllerCustomCommandSync with dataFrom successful"));
TRAP(err, recorder->RecordControllerCustomCommandSync(dummyPckg, dummyFunc,
dummyBuff, dummyBuff));
if (err != KErrNone)
{
logger->Log(_L("RecordControllerCustomCommandSync - err=%d"), err);
}
logger->Log(_L("RecordControllerCustomCommandSync successful"));
logger->Log(_L("Using UseSharedHeap"));
recorder->UseSharedHeap();
recorder->PlayL();
return;
}
if (recorder && aErrorCode == KErrNone && aCurrentState == CMdaAudioClipUtility::EOpen && aPreviousState == CMdaAudioClipUtility::EPlaying)
{
// Create DRM custom command
MMMFDRMCustomCommand* drmCustomCommand;
drmCustomCommand = recorder->GetDRMCustomCommand();
if (drmCustomCommand == NULL)
{
//.........这里部分代码省略.........
示例4: kgdb_debugger
/* KGDB functions to use existing PowerPC64 hooks. */
static int kgdb_debugger(struct pt_regs *regs)
{
return !kgdb_handle_exception(1, computeSignal(TRAP(regs)),
DIE_OOPS, regs);
}
示例5: PRINT
// -----------------------------------------------------------------------------
// CSendObject::ReserveObjectL
// -----------------------------------------------------------------------------
//
TInt CSendObject::ReserveObjectL()
{
PRINT( _L( "MM MTP => CSendObject::ReserveObjectL" ) );
TInt err = KErrNone;
iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId );
iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle,
iParentHandle );
iReceivedObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, iFullPath );
iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EFormatCode,
iObjectFormat );
// Reserves space for and assigns an object handle to the object described
// by the specified object information record.
TRAP( err, iObjectMgr.ReserveObjectHandleL( *iReceivedObjectInfo,
iObjectSize ) );
iRollbackList.Append( &CSendObject::UnreserveObjectL );
PRINT2( _L( "MM MTP => CSendObject::ReserveObjectL iObjectsize = %Lu, Operation: 0x%x" ), iObjectSize, iOperationCode );
if ( err != KErrNone )
{
PRINT1( _L( "MM MTP <> ReserveObjectHandleL err = %d" ), err );
}
if ( err == KErrNone )
{
delete iFileReceived;
iFileReceived = NULL;
PRINT2( _L( "MM MTP <> CSendObject::ServiceObjectL, iFullPath is %S, iObjectSize: %Lu" ), &iFullPath, iObjectSize );
iRollbackList.Append( &CSendObject::RemoveObjectFromFs );
TRAP( err, iFileReceived = CMTPTypeFile::NewL( iFs, iFullPath, EFileWrite ) );
PRINT1( _L("MM MTP <> CMTPTypeFile::NewL Leave Code is: %d"), err );
}
if ( err == KErrNone )
{
TRAP( err, iFileReceived->SetSizeL( iObjectSize ) );
PRINT1( _L( "MM MTP <> SetSizeL leave code:%d" ), err );
if ( err == KErrDiskFull )
{
SendResponseL( EMTPRespCodeStoreFull );
Rollback();
return err;
}
}
if ( err == KErrNone && iObjectSize == 0 )
{
// Already trapped inside SaveEmptyFileL.
SaveEmptyFileL();
if ( iOperationCode == EMTPOpCodeSendObjectPropList )
{
// Only leave when getting proplist element from data received by fw.
// It should not happen after ReceiveDataL in which construction of proplist already succeed.
SetObjectPropListL();
}
iObjectMgr.CommitReservedObjectHandleL( *iReceivedObjectInfo );
iRollbackList.Reset();
}
if ( err == KErrNone )
{
iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId );
iFramework.RouteRequestRegisterL( iExpectedSendObjectRequest, iConnection );
TUint32 parameters[3];
parameters[0] = iStorageId;
parameters[1] = iParentHandle;
parameters[2] = iReceivedObjectInfo->Uint( CMTPObjectMetaData::EHandle );
SendResponseL( EMTPRespCodeOK, 3, parameters );
}
else
{
SendResponseL( EMTPRespCodeGeneralError );
Rollback();
}
PRINT( _L( "MM MTP <= CSendObject::ReserveObjectL" ) );
return err;
}
示例6: TDateTime
TInt CConvertTime::CreateAndRunTestUnitL()
{
TTime t;
TInt converterErrUTC = KErrNone;
TInt rulesErrUTC = KErrNone;
TInt converterErrLocal = KErrNone;
TInt rulesErrLocal = KErrNone;
User::LeaveIfError(iTimeZoneServer.Connect());
// Set home location
TInt err = CDstIntUtils::SetHomeTimeZoneL(iCityName, iTimeZoneServer);
if (iSystemLocalTime != Time::NullTTime())
{
iTimeZoneServer.SetHomeTime(iSystemLocalTime);
}
// Instantiate Converter
CTzConverter *converter = CTzConverter::NewL(iTimeZoneServer);
CleanupStack::PushL(converter);
CTzId* tzId = CTzId::NewL(iCityName);
CleanupStack::PushL(tzId);
CTzRules* rules = iTimeZoneServer.GetTimeZoneRulesL(*tzId, TDateTime(0, EJanuary, 0, 0, 0, 0, 0), TDateTime(9999, EJanuary, 0, 0, 0, 0, 0), ETzWallTimeReference);
CleanupStack::PopAndDestroy(tzId);
CleanupStack::PushL(rules);
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;
converterErrUTC = converter->ConvertToLocalTime(t);
if(converterErrUTC == KErrNone)
{
converterErrUTC = CompareTimesL(t, EConvertUTC);
}
t = iUTCTime;
TRAP(rulesErrUTC, rules->ConvertToLocalL(t));
if(rulesErrUTC == KErrNone)
{
rulesErrUTC = CompareTimesL(t, EConvertUTC);
}
}
// Handle local to UTC conversion
if((iConversion == EConvertLocal) || (iConversion == EConvertBoth))
{
t = iLocalTime;
converterErrLocal = converter->ConvertToUniversalTime(t);
if(converterErrLocal == KErrNone)
{
converterErrLocal = CompareTimesL(t, EConvertLocal);
}
t = iLocalTime;
TRAP(rulesErrLocal, rules->ConvertToUtcL(t));
if(rulesErrLocal == KErrNone)
{
rulesErrLocal = CompareTimesL(t, EConvertLocal);
}
}
if(converterErrUTC != KErrNone)
err = converterErrUTC;
if(converterErrLocal != KErrNone)
err = converterErrLocal;
if(rulesErrUTC != KErrNone)
err = rulesErrUTC;
if(rulesErrLocal != KErrNone)
err = rulesErrLocal;
}
CleanupStack::PopAndDestroy(rules);
CleanupStack::PopAndDestroy(converter);
return err;
}
示例7: TRAPD
// ---------------------------------------------------------
// CPosTp154::DoCancelTestL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp154::DoCancelTestL()
{
iLog->Log(_L("DoCancelTestL"));
iLandmarkParser = CPosLandmarkParser::NewL(KKmzMimeType);
iLandmarkParser->SetInputFileL(KKMZFile);
iOperation = iLandmarkParser->ParseContentL();
TRequestStatus status = KPosLmOperationNotComplete;
TReal32 progress;
// 1 ) Cancel parse function by deleting iOperation
delete iOperation;
iOperation = NULL;
TUint32 nr = iLandmarkParser->NumOfParsedLandmarks();
if ((TInt)nr != 0)
{
iLog->Log(_L("No landmarks should be found"));
User::Leave(KErrNone);
}
// No landmark should be found
TRAPD(err, iLandmarkParser->LandmarkLC());
if (err != KErrNotFound)
{
iLog->Log(_L("ERROR: No Landmark should be found"));
iErrorsFound++;
}
// 1 ) Cancel parse function by changing input
iOperation = iLandmarkParser->ParseContentL();
// Get the first landmark
iOperation->NextStep(status, progress);
// Wait for NextStep to complete
User::WaitForRequest(status);
nr = iLandmarkParser->NumOfParsedLandmarks();
if ((TInt)nr != 1)
{
iLog->Log(_L("One landmark should be found"));
User::Leave(KErrNone);
}
// Change input
iLandmarkParser->SetInputFileL(KKMZFile);
nr = iLandmarkParser->NumOfParsedLandmarks();
if ((TInt)nr != 0)
{
iLog->Log(_L("No landmarks should be found"));
User::Leave(KErrNone);
}
// No landmark should be found
TRAP(err, iLandmarkParser->LandmarkLC());
if (err != KErrNotFound)
{
iLog->Log(_L("ERROR: No Landmark should be found"));
iErrorsFound++;
}
delete iOperation;
iOperation = NULL;
delete iLandmarkParser;
iLandmarkParser = NULL;
iLog->Log(_L("DoCancelTestL Done"));
}
示例8: switch
void CPlayAudioFile::RunL()
{
THwDeviceInitParams initParams;
TInt err = KErrNone;
switch (iState)
{
case EHwDeviceCreateAndInit:
{
err = OMX_Init();
if (err != KErrNone)
{
iParent->SetVerdict(_L("The OMX Core cannot be initialised"), EFail);
SetState(EHwDeviceError);
}
initParams.iHwDeviceObserver = this;
TRAP(err, iHwDevice = CMMFHwDevice::NewL(TUid::Uid(KUidHwDeviceAudioAdapter)));
if (err != KErrNone)
{
iParent->SetVerdict(_L("The Hw Device Adapter cannot be created"), EFail);
OMX_Deinit();
SetState(EHwDeviceError);
}
MMdfHwDeviceSetup* setup = (MMdfHwDeviceSetup*)iHwDevice->CustomInterface(KUidHwDeviceSetupInterface);
if (setup != NULL)
{
//Play is pcmU8 -> pcm16
TRAPD(err, setup->SetDataTypesL(KMMFFourCCCodeTestPCMU8, KMMFFourCCCodePCM16));
if (err == KErrNotFound)
{
iParent->SetVerdict(_L("Cannot load the PU"), EFail);
delete iHwDevice;
OMX_Deinit();
SetState(EHwDeviceError);
break;
}
}
err = iHwDevice->Init(initParams);
if (err != KErrNone)
{
CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot be initialised"));
break;
}
iParent->SetVerdict(_L("The Hw Device Adapter created & initialised"));
SetState(EHwDeviceStartDecode);
break;
}
case EHwDeviceStartDecode:
{
// if we are playing a file, first we have to open the file
err = ReadTestFileInBuffer();
if (err != KErrNone)
{
CleanupAndSetDeviceError(_L("Cannot open the file to be played"));
break;
}
iParent->SetVerdict(_L("The files to be played has opened successfully"));
// tell the HwDeviceAdapter to play the file
err = iHwDevice->Start(EDevDecode, EDevInFlow);
if (err != KErrNone)
{
CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot start"));
break;
}
iParent->SetVerdict(_L("The Hw Device Adapter has started successfully"));
break;
}
case EHwDeviceAllowToComplete:
break;
case EHwDeviceDone:
{
delete iHwDevice;
OMX_Deinit();
Cancel();
CActiveScheduler::Stop();
break;
}
case EHwDeviceError:
{
CActiveScheduler::Stop();
break;
}
default:
{
CleanupAndSetDeviceError(_L("Unknown CPlayAudioFile iState"));
break;
}
}
}
示例9: SetTestStepID
void CT_AddressStringTokenizerStep::RunTestCases()
{
TInt err;
SetTestStepID(_L("UIF-ETUL-0001"));
INFO_PRINTF1(_L("Test to search URLs"));
TRAP(err, SearchURLsL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0002"));
INFO_PRINTF1(_L("Test to search EMailAddresses"));
TRAP(err, SearchEMailAddressesL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0003"));
INFO_PRINTF1(_L("Test to search PhoneNumbers"));
TRAP(err, SearchPhoneNumbersL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0004"));
INFO_PRINTF1(_L("Tests for PhoneNos with Min. 3 nos. in a string \n\t\t\t\t\t\t\t when the string is considered as a phone no.\n"));
TRAP(err, SearchPhoneNumbersWithMin3NosL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0005"));
INFO_PRINTF1(_L("Tests for PhoneNos with Min. 8 nos. in a string \n\t\t\t\t\t\t\t when the string is considered as a phone no.\n"));
TRAP(err, SearchPhoneNumbersWithMin8NosL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0006"));
INFO_PRINTF1(_L("Tests for PhoneNos with Min. 15 nos. in a string \n\t\t\t\t\t\t\t when the string is considered as a phone no.\n"));
TRAP(err, SearchPhoneNumbersWithMin15NosL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0007"));
INFO_PRINTF1(_L("Test to search URL's, EMailAddresses, PhoneNumbers"));
TRAP(err, SearchAllL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0008"));
INFO_PRINTF1(_L("Test to check the positions"));
TRAP(err, CheckPositionsL());
TEST(err == KErrNone);
RecordTestResultL();
SetTestStepID(_L("UIF-ETUL-0009"));
INFO_PRINTF1(_L("Test to Parse URI file"));
TRAP(err, ParseURIFileL());
TEST(err == KErrNone);
RecordTestResultL();
TestOOMForAddressStringTokenizer();
SetTestStepID(_L("UIF-ETUL-0024"));
INFO_PRINTF1(_L("Test Phone Search Separators"));
TRAP(err, TestPhoneSearchSeparatorsL());
TEST(err == KErrNone);
RecordTestResultL();
CloseTMSGraphicsStep();
}
示例10: TRAP
// -----------------------------------------------------------------------------
// RMmCustomAPI::Open
// This method opens a RMmCustomAPI subsession from RMobilePhone.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt RMmCustomAPI::Open( RMobilePhone& /*aPhone*/ )
{
TInt error = KErrNone;
TRAP(error,ConstructL());
return error;
}
示例11: INFO_PRINTF1
void CT_LbsConflictStep_X3PMenuPush::NotifyMeasurementControlLocation(const TPositionInfo& aPosition,
const RLbsAssistanceDataBuilderSet& aData,
const TLbsNetPosRequestQuality& aQuality)
{
T_LbsUtils utils;
TInt err;
// Determine and record sequence event.
if (iState == EReqX3PMenu)
{
INFO_PRINTF1(_L("Got - X3P(MENU) MOLR - NetSim Notify Measurement Control Location - Event."));
// cannot record this event since it may/maynot occur depending on timing but ...
// SetCurrentSeqEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementControlLocation);
// ... if we do get one of these, we must get a failure message so add that to adhoc list
SetVerifyAdhocEvent(ESelf_MOLR_NetSim_Got_NotifyMeasurementReportControlFailure);
}
else if(iState == EReqX3PPush)
{
INFO_PRINTF1(_L("Got - X3P(PUSH) MOLR - NetSim Notify Measurement Control Location - Event."));
SetCurrentSeqEvent(EX3P_PUSH_MOLR_NetSim_Got_NotifyMeasurementControlLocation);
}
// Verify the reference position.
TPositionInfo verifyRefPosInfo;
verifyRefPosInfo.SetPosition(iRefPos);
if (!utils.Compare_PosInfo(verifyRefPosInfo, aPosition))
{
INFO_PRINTF1(_L("Failed test, position incorrect."));
SetTestStepResult(EFail);
}
// Verify the assistance data.
RLbsAssistanceDataBuilderSet& data = const_cast<RLbsAssistanceDataBuilderSet&>(aData);
RUEPositioningGpsReferenceTimeBuilder* refTimeBuilder = NULL;
data.GetDataBuilder(refTimeBuilder);
// Create a reader from the builder's data to allow us to verify the actual
// assistance data.
RUEPositioningGpsReferenceTimeReader refTimeReader;
TRAP(err, refTimeReader.OpenL());
if (err == KErrNone)
{
refTimeReader.DataBuffer() = refTimeBuilder->DataBuffer();
if (!utils.VerifySimpleAssistanceData(refTimeReader))
{
INFO_PRINTF1(_L("Failed test, assistance data incorrect."));
SetTestStepResult(EFail);
}
refTimeReader.Close();
}
else
{
INFO_PRINTF2(_L("Failed test, assistance data reader err %d."), err);
SetTestStepResult(EFail);
}
// TODO: Check if we can verify aQuality in any way.
(void)aQuality;
}
示例12: CActiveScheduler
/** Convert times using multiple TZ converter objects
*/
void CTestTZServer::MulitpleTZConverterL()
{
CActiveScheduler* scheduler;
scheduler = new CActiveScheduler();
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);
TPtrC ptrSystemTime;
TESTL(GetStringFromConfig(ConfigSection(), KTime, ptrSystemTime));
TTime time(ptrSystemTime);
_LIT8(KEuropeLondon, "Europe/London");
CTzId* zoneId = CTzId::NewL(KEuropeLondon);
CleanupStack::PushL(zoneId);
RTz tz;
CTzConverter* timeConverter = NULL;
CTzConverter* timeConverter1 = NULL;
CTzConverter* timeConverter2 = NULL;
CTzConverter* timeConverter3 = NULL;
CTzConverter* timeConverter4 = NULL;
CTzConverter* timeConverter5 = NULL;
CTzConverter* timeConverter6 = NULL;
CTzConverter* timeConverter7 = NULL;
CleanupClosePushL(tz);
User::LeaveIfError(tz.Connect());
TRAPD(err,timeConverter = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter);
TRAP(err,timeConverter1 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter1);
TRAP(err,timeConverter2 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter2);
TRAP(err,timeConverter3 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter3);
TRAP(err,timeConverter4 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter4);
TRAP(err,timeConverter5 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter5);
TRAP(err,timeConverter6 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter6);
TRAP(err,timeConverter7 = CTzConverter::NewL(tz));
TESTL(err == KErrNone);
CleanupStack::PushL(timeConverter7);
TRAP(err, timeConverter->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter1->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter2->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter3->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter4->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter5->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter6->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter7->ConvertToLocalTime(time, *zoneId));
TESTL(err == KErrNone);
TRAP(err, timeConverter->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter1->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter2->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter3->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter4->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter5->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter6->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter7->ConvertToLocalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter->ConvertToUniversalTime(time));
TESTL(err == KErrNone);
TRAP(err, timeConverter1->ConvertToUniversalTime(time));
//.........这里部分代码省略.........
示例13: TRAP
void game::init_traps()
{
int id = -1;
#define TRAP(name, sym, color, visibility, avoidance, difficulty, action, ...) \
id++;\
traps.push_back(new trap(id, sym, color, name, visibility, avoidance,\
difficulty, action, __VA_ARGS__));
TRAP("none", '?', c_white, 20, 0, 0, &trapfunc::none, &trapfuncm::none,
NULL);
// Name Symbol Color Vis Avd Diff
TRAP("bubblewrap", '_', c_ltcyan, 0, 8, 0,
&trapfunc::bubble, &trapfuncm::bubble,
itm_bubblewrap, NULL);
// Name Symbol Colour Vis Avd Diff
TRAP("cot", '#', c_green, 0, 0, 0,
&trapfunc::none, &trapfuncm::cot,
itm_cot, NULL);
// Name Symbol Colour Vis Avd Diff
TRAP("brazier", '#', c_red, 0, 0, 0,
&trapfunc::none, &trapfuncm::none,
itm_brazier, NULL);
// Name Symbol Colour Vis Avd Diff
TRAP("roll mat", '#', c_blue, 0, 0, 0,
&trapfunc::none, &trapfuncm::none,
itm_rollmat, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("bear trap", '^', c_blue, 2, 7, 3,
&trapfunc::beartrap, &trapfuncm::beartrap,
itm_beartrap, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("buried bear trap", '^', c_blue, 9, 8, 4,
&trapfunc::beartrap, &trapfuncm::beartrap,
itm_beartrap, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("rabbit snare", '\\', c_brown, 5, 10, 2,
&trapfunc::snare, &trapfuncm::snare,
itm_stick, itm_string_36, NULL);
TRAP("spiked board", '_', c_ltgray, 1, 6, 0,
&trapfunc::board, &trapfuncm::board,
itm_board_trap, NULL);
TRAP("tripwire", '^', c_ltred, 6, 4, 3,
&trapfunc::tripwire, &trapfuncm::tripwire,
itm_string_36, NULL);
TRAP("crossbow trap", '^', c_green, 5, 4, 5,
&trapfunc::crossbow, &trapfuncm::crossbow,
itm_string_36, itm_crossbow, NULL);
TRAP("shotgun trap", '^', c_red, 4, 5, 6,// 2 shots
&trapfunc::shotgun, &trapfuncm::shotgun,
itm_string_36, itm_shotgun_sawn, NULL);
TRAP("shotgun trap", '^', c_red, 4, 5, 6,// 1 shot
&trapfunc::shotgun, &trapfuncm::shotgun,
itm_string_36, itm_shotgun_sawn, NULL);
TRAP("spinning blade engine", '_', c_ltred, 0, 0, 2,
&trapfunc::none, &trapfuncm::none,
itm_motor, itm_machete, itm_machete, NULL);
TRAP("spinning blade", '\\', c_cyan, 0, 4, 99,
&trapfunc::blade, &trapfuncm::blade,
NULL);
// Name Symbol Color Vis Avd Diff
TRAP("land mine", '_', c_red, 10, 14, 10,
&trapfunc::landmine, &trapfuncm::landmine,
itm_landmine, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("teleport pad", '_', c_magenta, 0, 15, 20,
&trapfunc::telepad, &trapfuncm::telepad,
itm_null, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("goo pit", '_', c_dkgray, 0, 15, 15,
&trapfunc::goo, &trapfuncm::goo,
itm_null, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("dissector", '7', c_cyan, 2, 20, 99,
&trapfunc::dissector, &trapfuncm::dissector,
itm_null, NULL);
// Name Symbol Color Vis Avd Diff
TRAP("sinkhole", '_', c_brown, 10, 14, 99,
&trapfunc::sinkhole, &trapfuncm::sinkhole,
itm_null, NULL);
TRAP("pit", '0', c_brown, 0, 8, 99,
&trapfunc::pit, &trapfuncm::pit,
itm_null, NULL);
//.........这里部分代码省略.........
示例14: alias
/**
ExecuteActionL
Obtain the input parameters
1. sendAsMessage
2. recipientAddress
3. alias (Default value implies empty string)
4. recipientAddress1
5. recipientType
IF alias for recipient address is provided as input
Call RSendAsMessage::AddRecipient (const TDesC& aAddress, const TDesC& aAlias,
TSendAsRecipientType aRecipientType) passing recipientAddress, alias and
recipientType as input parameters
ELSE
Call RSendAsMessage::AddRecipient (const TDesC& aAddress, TSendAsRecipientType aRecipientType) passing recipientAddress and recipientType as input parameters
@internalTechnology
@pre None
@post None
@leave System wide errors
*/
void CMtfTestActionSendAsAddMultipleRecipient::ExecuteActionL()
{
if((TestCase().TestStepResult()) == EPass)
{
TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsAddMultipleRecipient);
// Get test action input parameters
RSendAsMessage sendAsMessage = ObtainValueParameterL<RSendAsMessage>(TestCase(),
ActionParameters().Parameter(0));
HBufC* recipientAddress = ObtainParameterReferenceL<HBufC>(TestCase(),
ActionParameters().Parameter(1), NULL);
HBufC* alias = ObtainParameterReferenceL<HBufC>(TestCase(),
ActionParameters().Parameter(2), NULL);
RSendAsMessage::TSendAsRecipientType recipientType
= ObtainValueParameterL<RSendAsMessage::TSendAsRecipientType>(TestCase(),
ActionParameters().Parameter(3));
TUid msgTypeId = ObtainValueParameterL<TUid>(TestCase(),
ActionParameters().Parameter(4));
TInt expectedErr = ObtainValueParameterL<TInt>(TestCase(),
ActionParameters().Parameter(5));
//Get the second recipient address
HBufC* recipientAddress1 = ObtainParameterReferenceL<HBufC>(TestCase(),
ActionParameters().Parameter(6), NULL);
TInt err = KErrNone;
TBuf16<3> btAddress;
if(recipientAddress == NULL)
{
if( msgTypeId.operator == (KUidMsgTypeSMTP))
{
TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(), ActionParameters().Parameter(7), 0);
CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
CleanupStack::PushL(settings);
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(paramServiceId, smtpAccount);
accounts->LoadSmtpSettingsL(smtpAccount, *settings);
CleanupStack::PopAndDestroy(accounts);
recipientAddress=settings->EmailAddress().AllocL();
CleanupStack::PopAndDestroy(settings);
}
else
{
TestCase().ERR_PRINTF1(_L("Recipient address is not provided"));
TestCase().SetTestStepResult(EFail);
}
}
else
{
if( msgTypeId.operator == (KUidMsgTypeBt))
{
CMtfTestActionUtilsMessage::FormatBtRecipientAddress(*recipientAddress, btAddress);
}
}
if((TestCase().TestStepResult()) == EPass)
{
if(alias == NULL )
{
if( msgTypeId.operator == (KUidMsgTypeBt))
{
TRAP(err,sendAsMessage.AddRecipientL(btAddress, recipientType));
}
else
{
TRAP(err,sendAsMessage.AddRecipientL(*recipientAddress, recipientType));
TRAP(err, sendAsMessage.AddRecipientL(*recipientAddress1, recipientType));
}
if(err == expectedErr)
{
//.........这里部分代码省略.........
示例15: legacySize
//.........这里部分代码省略.........
}
}
// check if the icon is java icon
javaIcon = AknsJavaUtils::IsJavaIcon(filename);
if( AknIconUtils::IsMifFile( filename ) )
{
// SVG icon
// SVG always has only one icon
bitmapIndex = 0;
maskIndex = 1;
AknIconUtils::ValidateLogicalAppIconId( filename,
bitmapIndex, maskIndex );
if (javaIcon)
{
AknsJavaUtils::CreateIconLC(*lsSession, aAppUid, aBitmap,
aMask, bitmapIndex, maskIndex ); // aBitmap, aMask (2)
}
else
{
AknIconUtils::CreateIconLC( aBitmap, aMask, filename,
bitmapIndex, maskIndex ); // aBitmap, aMask (2)
}
AknInternalIconUtils::SetAppIcon(aBitmap); //icon case
return;
}
else
{
// MBM icon
AknIconUtils::ValidateLogicalAppIconId( filename,
bitmapIndex, maskIndex );
TRAP( ret, AknIconUtils::CreateIconL( aBitmap, aMask, filename,
bitmapIndex, maskIndex ) );
if( ret == KErrNone )
{
// These pushes are safe
CleanupStack::PushL( aBitmap ); // (1)
CleanupStack::PushL( aMask ); // (2)
}
else
{
bitmapIndex = 0;
maskIndex = 1;
AknIconUtils::ValidateLogicalAppIconId( filename,
bitmapIndex, maskIndex );
AknIconUtils::CreateIconLC( aBitmap, aMask, filename,
bitmapIndex, maskIndex ); // aBitmap, aMask (2)
}
AknInternalIconUtils::SetAppIcon(aBitmap); //icon case
return;
}
}
else if( ret!=KErrNotSupported )
{
// New framework, but no icon defined
forceDefaultIcon = ETrue;
}
CApaMaskedBitmap* apaBmp = CApaMaskedBitmap::NewLC(); // apaBmp (1)
// 3. Old (AIF-based) framework
if( !forceDefaultIcon )
{
TInt apaErr = lsSession->GetAppIcon( aAppUid, legacySize, *apaBmp );
// Use default icon if APPARC did not initialize icon bitmaps