本文整理汇总了C++中TRAPD函数的典型用法代码示例。如果您正苦于以下问题:C++ TRAPD函数的具体用法?C++ TRAPD怎么用?C++ TRAPD使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRAPD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateDummyDeferredListL
//
// Run the tests
//
TVerdict CCmdTestMultipleWait::doTestStepL()
{
CreateDummyDeferredListL();
SsmCommandFactory::DelegateTo(this);
// common BIC tests
__UHEAP_MARK;
TRAPD(err, doTestNewLWithGoodDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestNewLWithBadDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestInternalizeLWithGoodDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestInternalizeLWithBadDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestResourceReaderWithGoodDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestResourceReaderWithMissingDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestResourceReaderWithBadDataL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestCommandTypeL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestCmdFailureIgnoreSeverityL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestCmdFailureHighSeverityL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestCancelCmdIgnoreSeverityL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
__UHEAP_MARK;
TRAP(err, doTestCancelCmdHighSeverityL());
TEST(err == KErrNone);
__UHEAP_MARKEND;
return TestStepResult();
}
示例2: TRAPD
/** Creates a new setting with a floating-point value.
@param aKey New setting key.
@param aValue Setting value.
@return
KErrNone if successful,
KErrAlreadyExists if a setting with that key already exists
plus other system-wide error codes.
@post
Transactions fail on all error conditions.
Outside transactions: on success the new setting is persistent,
on failure the repository is unmodified.
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
*/
EXPORT_C TInt CRepository::Create(TUint32 aKey, const TReal& aValue)
{
TRAPD(err,iImpl->CreateSettingL(aKey,aValue,NULL));
return err;
}
示例3: Delete
/** Deletes all the settings that exist and match the specification:
(key & mask) == (partialKey & mask)
Partial key is guaranteed to be masked before use.
Examples of use:
- To delete a single key.
Delete(key, 0xFFFFFFFF, errorKey);
- To delete all keys from 0 to 0xFF:
Delete(0, 0xFFFFFF00, errorKey);
(digits from 0 to 0xFF would be ignored if given in the partial key)
- To delete all keys matching 0x5B??3A?6:
Delete(0x5B003A06, 0xFF00FF0F, errorKey);
@param aPartialKey
Contains a bit pattern that all the keys must at least partially
match.
@param aMask
Has bits set for all the bits in aPartialKey that must match the keys being deleted.
@param aErrorKey If the delete operation fails this contains the key involved in the
failure, or aPartialKey or KUnspecifiedKey if it could not be attributed to any key
@return
KErrNone if successful,
KErrNotFound if no items were found in the partial key range.
plus other system-wide error codes.
@post
Transactions fail on all error conditions except KErrNotFound
Outside transactions: on success the changes are persistent, on failure the
repository is unmodified.
@capability Dependent Caller must satisfy the write policies of all settings found in the
partial key range.
*/
EXPORT_C TInt CRepository::Delete(TUint32 aPartialKey, TUint32 aMask, TUint32& aErrorKey)
{
TRAPD(ret,iImpl->DeleteRangeL(aPartialKey,aMask,aErrorKey));
return ret;
}
示例4: TRAPD
// -----------------------------------------------------------------------------
// CDRMHelperServer::CheckPermission().
// This function check timebased contraints for a permission
// -----------------------------------------------------------------------------
//
void CDRMHelperServer::CheckPermission(
CDRMPermission* aPermission ,
const TUint8& aPermType ,
TTimeBased& aTime ,
TTimeIntervalSeconds& aInterval,
const RPointerArray<HBufC8>& aIndividual )
{
#ifdef _DRM_TESTING
TRAPD(err,WriteL(_L8("CheckPermission")));
#endif
CDRMConstraint* c = NULL;
ContentAccess::TIntent type = MapPermissionType(aPermType);
TTime temp;
temp.HomeTime();
TUint32 reason( 0 );
TBool validity = EFalse;
aTime.SetStart(Time::MinTTime());
aTime.SetEnd(Time::MinTTime());
if (aPermission->iAvailableRights & type)
{
c = aPermission->ConstraintForIntent(type);
if (!c)
{
return;
}
if (aPermission->iAvailableRights & ERightsTopLevel)
{
CDRMConstraint* temp = aPermission->TopLevelConstraint();
c->Merge(*temp);
}
validity = c->Valid( temp, aIndividual, reason );
if ( !validity && reason & EConstraintIndividual )
{
return;
}
if (c->iActiveConstraints==EConstraintNone ||
c->iActiveConstraints == EConstraintIndividual )
{
aTime.SetStart(Time::MinTTime());
aTime.SetEnd(Time::MaxTTime());
return;
}
if (c->iActiveConstraints & EConstraintInterval)
{
if (c->iIntervalStart == Time::NullTTime())
{
aInterval = c->iInterval;
}
else
{
aTime.SetStart(c->iIntervalStart);
aTime.SetEnd(c->iIntervalStart + c->iInterval);
}
}
if (c->iActiveConstraints & EConstraintStartTime)
{
if ( !(c->iActiveConstraints & EConstraintInterval ) )
{
aTime.SetStart( c->iStartTime );
if (c->iActiveConstraints&EConstraintEndTime)
{
aTime.SetEnd( c->iEndTime );
}
else
{
aTime.SetEnd( Time::MaxTTime() );
}
}
else
{
aTime.SetStart( aTime.StartTime() > c->iStartTime ? aTime.StartTime() : c->iStartTime );
if (c->iActiveConstraints&EConstraintEndTime)
{
aTime.SetEnd( aTime.EndTime() < c->iEndTime ? aTime.EndTime() : c->iEndTime );
}
}
}
else
{
if (c->iActiveConstraints==EConstraintEndTime)
{
if ( !(c->iActiveConstraints & EConstraintInterval ) )
{
aTime.SetStart(Time::MinTTime());
aTime.SetEnd( c->iEndTime );
}
else
{
aTime.SetEnd( aTime.EndTime() < c->iEndTime ? aTime.EndTime() : c->iEndTime );
}
}
}
//.........这里部分代码省略.........
示例5: TestStepResult
//Encrypted Data
TVerdict CTPKCS7EncryptedDataTest::doTestStepL()
{
if (TestStepResult() != EPass)
{
return TestStepResult();
}
TInt reason;
// Read from INI file.
GetIntFromConfig(ConfigSection(),_L("Reason"),reason);
//Is Valid
TBool expectedValid;
TBool checkValid;
checkValid = GetBoolFromConfig(ConfigSection(),_L("IsValid"), expectedValid);
__UHEAP_MARK;
CPKCS7ContentInfo *contentInfo = NULL;
TRAPD (err, contentInfo = CPKCS7ContentInfo::NewL(iRawData->Des()));
CleanupStack::PushL(contentInfo);
if(err == KErrNone)
{
CPKCS7EncryptedDataObject* p7 = NULL;
TInt type = contentInfo->ContentType();
if( contentInfo->ContentType() == CPKCS7ContentInfo::EContentTypeEncryptedData)
{
TRAPD (err, p7 = CPKCS7EncryptedDataObject::NewL(*contentInfo));
CleanupStack::PushL(p7);
__UHEAP_MARK;
if (checkValid)
{
if(!expectedValid && err == reason)
{
CleanupStack::PopAndDestroy(2,contentInfo);//p7, contentInfo
return TestStepResult();
}
if(!expectedValid && contentInfo->ContentType() == 1)
{
CleanupStack::PopAndDestroy(2,contentInfo);//p7, contentInfo
return TestStepResult();
}
}
if (err != KErrNone)
{
SetTestStepResult(EFail);
ERR_PRINTF2(_L("Got %d building PKCS7 object"), err);
}
//CONTENT TYPE
CPKCS7EncryptedDataObject::TContentType contentType = p7->ContentType();
if(contentType != CPKCS7EncryptedDataObject::EPkcs7Data)
{
SetTestStepResult(EFail);
ERR_PRINTF1(_L("ContentType does not match"));
CleanupStack::PopAndDestroy(3,contentInfo);//expectedContentType, p7, contentInfo
return TestStepResult();
}
else
{
INFO_PRINTF1(_L("ContentType matches"));
}
//ENCRYPTEDCONTENT DATA
const TDesC8& contentData = p7->EncryptedContentInfoData();
if(contentData.Compare(*iContentData) != 0)
{
SetTestStepResult(EFail);
ERR_PRINTF1(_L("EncryptedContentData does not match"));
CleanupStack::PopAndDestroy(2,contentInfo); //p7, contentInfo
return TestStepResult();
}
else
{
INFO_PRINTF1(_L("EncryptedContentData matches"));
}
//SALT
const CPBEncryptParms& encryptParams = p7->EncryptParams();
if((encryptParams.Salt()).Compare(*iSaltValue) != 0)
{
SetTestStepResult(EFail);
ERR_PRINTF1(_L("Salt Value does not match"));
CleanupStack::PopAndDestroy(2, contentInfo);//p7,contentInfo
return TestStepResult();
}
else
{
INFO_PRINTF1(_L("Salt Value matches"));
}
//ITERATION COUNT
TBool checkIteration;
//.........这里部分代码省略.........
示例6: switch
// -----------------------------------------------------------------------------
// CSIPProfile::GetParameter
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CSIPProfile::GetParameter(TUint32 aParam, TDesC8 const *& aVal) const
{
switch (aParam)
{
case KSIPProviderName:
{
const TDesC8& val= iSIPProfile->ProviderName();
aVal = &val;
break;
}
case KSIPUserAor:
{
const TDesC8& val = iSIPProfile->AOR();
aVal = &val;
break;
}
case KSIPPrivateIdentity:
{
const TDesC8& val = iSIPProfile->PrivateIdentity();
aVal = &val;
break;
}
case KSIPNegotiatedSecurityMechanism:
{
if(iSIPProfileRegistry)
{
TRAPD(err,iSIPProfileRegistry->NegotiatedSecurityMechanismL(*iSIPProfile));
if (err != KErrNone)
{
return err;
}
}
const TDesC8& val = iSIPProfile->NegotiatedSecurityMechanism();
aVal = &val;
break;
}
case KSIPProfileId:
case KSIPAccessPointId:
case KSIPSigComp:
case KSIPSecurityNegotiation:
case KSIPAutoRegistration:
case KSIPProfileRegistered:
case KSIPRegisteredAors:
case KSIPDefaultProfile:
case KSIPContactHeaderParams:
case KSIPRegistrar:
case KSIPOutboundProxy:
case KSIPDigestUserName:
case KSIPDigestRealm:
case KSIPServerAddress:
case KSIPDigestPassword:
{
return KErrNotFound;
}
default:
{
return iSIPProfile->ExtensionParameter(aParam, aVal);
}
}
return KErrNone;
}
示例7: TRACES
// ----------------------------------------------------------------------------
// CSysApFeatureManager::ConstructL()
// ----------------------------------------------------------------------------
void CSysApFeatureManager::ConstructL()
{
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL()") ) );
FeatureManager::InitializeLibL();
iFeatMgrActive = ETrue;
iSimSupported = FeatureManager::FeatureSupported( KFeatureIdSimCard );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: SIM card supported=%d"), iSimSupported ) );
iOfflineModeSupported = FeatureManager::FeatureSupported( KFeatureIdOfflineMode );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Offline mode supported=%d"), iOfflineModeSupported ) );
iCoverDisplaySupported = FeatureManager::FeatureSupported( KFeatureIdCoverDisplay );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Cover display supported=%d"), iCoverDisplaySupported ) );
iGripNotSupported = FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: iGripNotSupported=%d"), iGripNotSupported ) );
iLocationPrivacySupported = FeatureManager::FeatureSupported( KFeatureIdPrivacyFramework );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Location Privacy supported=%d"), iLocationPrivacySupported ) );
iMMCSupported = FeatureManager::FeatureSupported( KFeatureIdMmc );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: MMC supported=%d"), iMMCSupported ) );
iMMCHotSwapSupported = FeatureManager::FeatureSupported( KFeatureIdMmcHotswap );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: MMC HotSwap supported=%d"), iMMCHotSwapSupported ) );
iStarterExtensionsSupported = FeatureManager::FeatureSupported( KFeatureIdExtendedStartup );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Starter Extensions supported=%d"), iStarterExtensionsSupported ) );
iCameraSupported = FeatureManager::FeatureSupported( KFeatureIdCamera );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Camera supported=%d"), iCameraSupported ) );
iBtSupported = FeatureManager::FeatureSupported( KFeatureIdBt );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Bluetooth supported=%d"), iBtSupported ) );
iLockSupported = FeatureManager::FeatureSupported( KFeatureIdMmcLock );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Memory card lock supported=%d"), iLockSupported ) );
iEject = FeatureManager::FeatureSupported( KFeatureIdMmcEject );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Memory card sw eject supported=%d"), iEject ) );
iPowerSaveSupported = FeatureManager::FeatureSupported( KFeatureIdPowerSave );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Power save supported=%d"), iPowerSaveSupported ) );
iNoPowerKeySupported = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: No power key supported=%d"), iNoPowerKeySupported ) );
// iFmTxSupported = FeatureManager::FeatureSupported( KFeatureIdFmtx );
// TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: FM TX supported=%d"), iFmTxSupported ) );
// iPenEnabled = AknLayoutUtils::PenEnabled();
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Pen enabled=%d"), iPenEnabled ) );
iVmbxCallDivertIconSupported = FeatureManager::FeatureSupported( KFeatureIdVmbxCallDivertIcon );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: VMBX call divert icon supported=%d"), iVmbxCallDivertIconSupported ) );
iTouchUnlockStrokeSupported = FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke );
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: Touch unlock stroke supported=%d"), iTouchUnlockStrokeSupported ) );
// iFmTxRdsTextSupported = FeatureManager::FeatureSupported( KFeatureIdFfFmtxRdsText );
// TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: FM TX RDS-TEXT supported=%d"), iFmTxRdsTextSupported ) );
CRepository* repository = NULL;
TRAPD( err, repository = CRepository::NewL( KCRUidCoreApplicationUIsConf ) );
if ( err == KErrNone )
{
err = repository->Get( KCoreAppUIsSysAp, iSysApFeatures );
if ( err != KErrNone || iSysApFeatures < 0 ) // ERROR
{
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsSysAp=%d"), err, iSysApFeatures ) );
iSysApFeatures = 0;
}
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: KCoreAppUIsSysAp=%d"), iSysApFeatures ) );
err = repository->Get( KCoreAppUIsHotSwapMemoryCardHatch, iHatchSupported );
if ( err != KErrNone || iHatchSupported < 0 ) // ERROR
{
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsHotSwapMemoryCardHatch=%d"), err, iHatchSupported ) );
iHatchSupported = EFalse;
}
err = repository->Get( KCoreAppUIsLockedStateLights, iLockedStateLightsSupported );
if ( err != KErrNone || iLockedStateLightsSupported < 0 ) // ERROR
{
TRACES( RDebug::Print( _L("CSysApFeatureManager::ConstructL: ERROR: %d, KCoreAppUIsLightsLocked=%d"), err, iLockedStateLightsSupported ) );
iLockedStateLightsSupported = EFalse;
iLockedStateLightsIntensity = KHWRMDefaultIntensity;
}
if ( iLockedStateLightsSupported ) // get intensity only if configuration is supported
{
err = repository->Get( KCoreAppUIsLockedStateLightsIntensity, iLockedStateLightsIntensity );
//.........这里部分代码省略.........
示例8: FsFormatOpen
//.........这里部分代码省略.........
for(TInt cntFS=0; ;++cntFS)
{
nRes = drive.FSys().GetSupportedFileSystemName(cntFS, buf); //-- enumerate possible child file systems
if(nRes != KErrNone)
return KErrNotSupported; //-- the filesystem with the given name (fsNameHash) is not supported.
if(newFsNameHash == TVolFormatParam::CalcFSNameHash(buf))
{//-- the filesystem with the given name (fsNameHash) is supported, but some other filesystem can be already mounted
drive.Dismount();
bNeedForceMount = ETrue; //-- this will force the desired FS to be mounted
break;
}
}
}//if(fsNameHash)
//-- try force mounting the desired file system if it is required
if(bNeedForceMount)
{
const TInt KMaxRetries = 3;
for(TInt cnt=0; ; ++cnt)
{
drive.MountFileSystem(ETrue, newFsNameHash);
nMountRes = drive.GetReason();
if(nMountRes == KErrNone || nMountRes == KErrLocked)
break;
drive.Dismount(); //-- will reset mount retries counter
if(cnt >= KMaxRetries)
{
__PRINT1(_L("FsFormatOpen() can't mount FS! res:%d"), nMountRes);
return nMountRes;
}
}
}
ASSERT(nMountRes == KErrNone || nMountRes == KErrLocked);
__ASSERT_DEBUG(drive.CurrentMount().LockStatus()==0, Fault(ESvrFormatOpenFailed));
TDriveInfo dInfo;
drive.DriveInfo(dInfo);
const TInt mediaAtt = dInfo.iMediaAtt;
#if defined(_LOCKABLE_MEDIA)
if (!(fmtMode & EForceErase) && (mediaAtt & KMediaAttLocked))
{
// if attempting to format a locked drive, dismount otherwise subsequent
// requests will operate on a mount that has been forcibly mounted (a few lines above)
CMountCB* pM = &drive.CurrentMount();
if(pM)
pM->Close();
drive.MountFileSystem(EFalse); // clear iCurrentMount
return KErrLocked;
}
#endif
if (!(mediaAtt & KMediaAttFormattable) || (mediaAtt & KMediaAttWriteProtected))
{
CMountCB* pM = &drive.CurrentMount();
if(pM)
pM->Close();
drive.MountFileSystem(EFalse);
return KErrAccessDenied;
}
//-- instantinate and open CFormatCB object for this drive
CFormatCB* formatCB=NULL;
TInt fmtHandle;
TRAPD(ret, formatCB = drive.FormatOpenL(aRequest, fmtHandle, fmtMode, pLDFormatInfo, pVolFormatParam ));
if (ret!=KErrNone)
{
if(formatCB)
formatCB->Close();
return ret;
}
TPtrC8 pH((TUint8*)&fmtHandle,sizeof(TInt));
aRequest->WriteL(KMsgPtr3,pH);
TInt count=100;
TPtrC8 pCount((TUint8*)&count,sizeof(TInt));
aRequest->WriteL(KMsgPtr2,pCount);
aRequest->Session()->IncResourceCount();
return KErrNone;
}
示例9: INFO_PRINTF1
/** Play and record an audio file using the UseOldCodecAudioController
* which uses CMMFCodecs and the 'null' pcm16->pcm16 hw device plugin
* This is for DEF039267
*/
TVerdict CTestMmfAclntOldCodecFile::DoTestStepL( void )
{
INFO_PRINTF1( _L("TestPlayerUtils : File"));
TVerdict ret = EFail;
iError = KErrTimedOut;
TBuf<KSizeBuf> filename;
TPtrC filename1;
if(!GetStringFromConfig(iSectName,iKeyName,filename1))
return EInconclusive;
GetDriveName(filename);
filename.Append(filename1);
TUid useCMMFCodecAudioController;
useCMMFCodecAudioController.iUid = KMmfUidUseOldCodecAudioController;
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
TRAPD(err, recUtil->OpenFileL(filename,useCMMFCodecAudioController));
if (err)
{
INFO_PRINTF2( _L("error opening record to file %d "), err);
}
else
{
CActiveScheduler::Start();
TTimeIntervalMicroSeconds duration = recUtil->Duration();
// Wait for initialisation callback
INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility"));
// Check for errors.
if (iError == KErrNone && recUtil != NULL)
{
if(iPlay)
{
iError = KErrTimedOut;
TRAPD(err, recUtil->PlayL());
if (err)
{
INFO_PRINTF2( _L("error opening record to file %d "), err);
}
else
{
//lets time how long the file plays for and check
//it has played for the full time
TTime startTime(0);
TTime endTime(0);
startTime.HomeTime();
// Wait for init callback
CActiveScheduler::Start();
endTime.HomeTime();
//check file played for the expected time - allow margin of error + 1S -0.5S
TTimeIntervalMicroSeconds playduration = endTime.MicroSecondsFrom(startTime);
if ( (playduration.Int64() < (duration.Int64()-KOneSecond/2)) ||
(playduration.Int64() > (duration.Int64()+KOneSecond)) )
{
INFO_PRINTF2(_L("file didn't play for the expected duration expected %ld"), duration.Int64());
INFO_PRINTF2(_L("but actual duration was %ld"), playduration.Int64());
}
else if(iError == KErrNone)
ret = EPass;
}
}
}
recUtil->Close();
}
//now try recording file
TFourCC recordedDataType;
TUid format;
format.iUid = KMmfUidFormatWAVWrite;
//check that the datatype is a valid datatype to record
if (!iKeyName.Compare(_L("ALAW ")))
recordedDataType.Set(KMMFFourCCCodeALAW);
else if (!iKeyName.Compare(_L("PCMU8")))
recordedDataType.Set(KMMFFourCCCodePCMU8);
else if (!iKeyName.Compare(_L("MULAW")))
recordedDataType.Set(KMMFFourCCCodeMuLAW);
else if (!iKeyName.Compare(_L("IMAD")))
recordedDataType.Set(KMMFFourCCCodeIMAD);
else if (!iKeyName.Compare(_L("GSM610")))
recordedDataType.Set(KMMFFourCCCodeGSM610);
//rename file to indicate it is recorded
if (recordedDataType != KMMFFourCCCodeNULL)
{
TInt matchpos = filename.Find(_L(".wav"));//get position of extension
filename.Insert(matchpos,_L("recorded"));//change filename to indicate it is recorded
//delete file prior to recording
RFs fs;
//.........这里部分代码省略.........
示例10: Dprint
// ---------------------------------------------------------
// TInt RSCPClient::Connect()
// Creates a new session, and starts the server, if required.
//
// Status : Approved
// ---------------------------------------------------------
//
EXPORT_C TInt RSCPClient::Connect()
{
Dprint( (_L("--> RSCPClient::Connect()") ));
// Use a mutex-object so that two processes cannot start the server at the same time
RMutex startMutex;
TRAPD( errf, FeatureManager::InitializeLibL() );
if( errf != KErrNone )
{
return errf;
}
if(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))
{
isFlagEnabled = ETrue;
}
else
{
isFlagEnabled = EFalse;
}
FeatureManager::UnInitializeLib();
TInt mRet = startMutex.OpenGlobal( KSCPServerName );
if ( mRet == KErrNotFound )
{
mRet = startMutex.CreateGlobal( KSCPServerName );
}
if ( mRet != KErrNone )
{
return mRet;
}
// Acquire the mutex
startMutex.Wait();
TInt retry = KSCPConnectRetries;
TInt r;
for (;;)
{
r = CreateSession( KSCPServerName, Version(), KDefaultMessageSlots );
if ( ( r != KErrNotFound ) && ( r != KErrServerTerminated ) )
{
break;
}
if ( --retry == 0 )
{
break;
}
r = StartServer();
if ( ( r != KErrNone ) && ( r != KErrAlreadyExists ) )
{
break;
}
}
Dprint( (_L("<-- RSCPClient::Connect(), exiting: %d"), r ));
// Release the mutex
startMutex.Signal();
startMutex.Close();
return r;
}
示例11: ASSERT
TVerdict CAppFwkStartSafeTestStepProcMonSysRestart::doTestStepL()
{
#ifdef __WINSCW__
ASSERT(0);
#endif
CActiveScheduler* sched = new(ELeave) CActiveScheduler; //lint !e527 Unreachable
CleanupStack::PushL(sched); //lint !e527 Unreachable
CActiveScheduler::Install(sched);
iNotifier = CSaveNotifier::NewL(*this);
CStartSafe* startSafe = CStartSafe::NewL();
CleanupStack::PushL( startSafe );
CStartupProperties* prop = CStartupProperties::NewLC();
prop->SetFileParamsL(KTestProcGood, KNullDesC);
prop->SetStartMethod(EWaitForStart);
prop->SetMonitored(ETrue);
prop->SetRecoveryParams(ERestartOS, 0);
TInt tried;
RProcess proc;
CleanupClosePushL(proc);
TRAPD(err, startSafe->StartAndMonitorL(*prop, proc, tried));
TEST(KErrNone == err);
CleanupStack::Pop(&proc);
CleanupStack::PopAndDestroy(prop);
CleanupStack::PopAndDestroy(startSafe);
INFO_PRINTF1(_L("Process monitoring setup with TRecoveryMethod=ERestartOS"));
proc.Kill(KErrNone);
proc.Close();
TTime init;
init.UniversalTime();
INFO_PRINTF4( _L("Process killed at time %d:%d.%d"), init.DateTime().Minute(), init.DateTime().Second(), init.DateTime().MicroSecond());
INFO_PRINTF1(_L("Starting scheduler (expecting an OS restart)"));
CActiveScheduler::Start(); //Wait for MSaveObserver callback
//resume here after callback has stopped the scheduler
TESTE(iCallbackReceived, iCallbackReceived);
if(iCallbackReceived)
{
const TTimeIntervalMicroSeconds elapsedTime = iShutdownPerformed.MicroSecondsFrom(init);
const TDateTime dt = iShutdownPerformed.DateTime();
const TInt64 value = elapsedTime.Int64();
INFO_PRINTF5(_L("Shutdown callback received at time %d:%d.%d (after %d microseconds)"), dt.Minute(), dt.Second(), dt.MicroSecond(), value);
TESTE((value >= 0) && (value < 1000000), value); // within 1 second
}
else
{
INFO_PRINTF1( _L("Restart didn't take place :-("));
TEST(EFalse);
}
//abort restart
iNotifier->HandleError(KErrNone);
CleanupStack::PopAndDestroy(sched);
return TestStepResult();
}
示例12: FindCustomInterface
/**
* CMMFDevSound::CBody::CustomInterface
*
* Returns custom interface proxy object created by Proxy Custom Interface
* Utility.
*
* @param TUid
* UID of the custom interface object to be started.
*
* @return TAny*
* Pointer to the Interface Returned by the DevSoundProxy member.
*/
TAny* CMMFDevSound::CBody::CustomInterface(TUid aInterfaceId)
{
// check if this UID refers to CancelInitialize()
if (aInterfaceId == KMmfUidDevSoundCancelInitializeCustomInterface)
{
MMMFDevSoundCancelInitialize* result = this;
return result;
}
// check if this UID refers to EmptyBuffers()
if (aInterfaceId == KMmfUidDevSoundEmptyBuffersCustomInterface)
{
MMMFDevSoundEmptyBuffers* result = this;
return result;
}
if (aInterfaceId == KMmfUidDevSoundAudioResourceCustomInterface)
{
MAutoPauseResumeSupport* result = this;
return result;
}
if (aInterfaceId == KMmfUidDevSoundTimePlayedCustomInterface)
{
MMMFDevSoundTimePlayed* result = this;
return result;
}
if (aInterfaceId == KMmfUidDevSoundQueryIgnoresUnderflowCustomInterface)
{
MMMFDevSoundQueryIgnoresUnderflow* result = this;
return result;
}
if (aInterfaceId == KMmfUidDevSoundAudioClientThreadInfoCustomInterface)
{
MAudioClientThreadInfo* result = this;
return result;
}
if (aInterfaceId == KMmfUidDevSoundTruePauseCustomInterface)
{
MMMFDevSoundTruePause* result = this;
return result;
}
// first check if we already have resolved a custom interface of this type
TInt index = FindCustomInterface(aInterfaceId);
MMMFDevSoundCustomInterfaceMuxPlugin* ptr = NULL;
// if we found the interface, take a copy of this instead
if (index != KNullHandle)
{
// check our index is valid
ptr = iCustomInterfaceArray[index-1].iInterface;
if (ptr)
{
return ptr->CustomInterface(aInterfaceId);
}
}
else
{
// else try and instantiate a plugin tunnelling
// pair to support this Custom Interface
TRAPD(err, ptr = iMuxUtility->CreateCustomInterfaceMuxL(aInterfaceId));
if (ptr && (err == KErrNone))
{
TMMFDevSoundCustomInterfaceData data;
data.iInterface = ptr;
data.iId = aInterfaceId;
// attempt to open remote demux
// this will store a handle in the mux plugin if successful
// and also return it here - invalid handle = -1
data.iHandle = ptr->OpenInterface(aInterfaceId);
// if the handle is greater than zero then we know we have
// successfully opened the interface
if (data.iHandle > KNullHandle)
{
// append this to the current interface list
TInt err = KErrNone;
err = iCustomInterfaceArray.Append(data);
if (err == KErrNone)
{
// return the custom interface on the ptr
//.........这里部分代码省略.........
示例13: ProcessMainL
/**
* Subroutine performing pre-processing tasks for testexecute execution
* Also, responsible for triggering the state machine through instance of ScriptMaster
* @param aScheduler - Instance of ActiveScheduler created through MainL()
* @param aSysDrive - Default system drive letter to be used for all script parsing
*/
LOCAL_C void ProcessMainL(CActiveScheduler* aScheduler, const TDriveName aSysDrive)
{
TDriveName defaultSysDrive(aSysDrive);
TDriveName testSysDrive(KTEFLegacySysDrive);
TInt waitForLoggingTime = 0;
TBuf<KMaxTestExecuteNameLength> htmlLogPath;
// Create a object of the Parser for TestExecute.ini
CTestExecuteIniData* parseTestExecuteIni = NULL;
TRAPD(err, parseTestExecuteIni = CTestExecuteIniData::NewL(defaultSysDrive));
if (err == KErrNone)
{
CleanupStack::PushL(parseTestExecuteIni);
// Extract all the key values within the object
parseTestExecuteIni->ExtractValuesFromIni();
}
// Read and parse the command line for the flags
// -d -slf -help and -v
TBuf<KMaxTestExecuteCommandLength> commandLine;
TDesC* selTestCfgFileData = NULL; //the pointer to the data of in the .tcs file
ReadCommandLineL(commandLine);
// Make lower case because we parse it for flags and search for ".script"
commandLine.LowerCase();
TBool separateLogFiles(EFalse); // -slf
TBool justInTime(EFalse); // -d
TBool graphicalWindowServer(EFalse); // -gws
TBool helpRequest(EFalse); // -help
TBool versionRequest(EFalse); // -v
TBool includeSelectiveCases(EFalse); // -tci
TBool excludeSelectiveCases(EFalse); // -tcx
TBool pipe(EFalse) ;
// Set up the bools from the command line
ParseCommandLine(commandLine,separateLogFiles,justInTime,graphicalWindowServer,includeSelectiveCases, excludeSelectiveCases,pipe, helpRequest,versionRequest,*parseTestExecuteIni,err);
// If -d then set Just In Time debugging. Panicks break into debug on emulator
(justInTime) ? (User::SetJustInTime(ETrue)) : (User::SetJustInTime(EFalse));
// Hooks for creating the Graphical Window server
#ifdef GWS
#endif
// Create a console
_LIT(KMessage,"TestExecute Script Engine");
CConsoleBase* console = Console::NewL(KMessage,TSize(KConsFullScreen,KConsFullScreen));
CleanupStack::PushL(console);
console->SetCursorHeight(0);
RConsoleLogger consoleLogger(*console);
CScriptControl::iRunScriptFailCount=0;
// A lex for getting the first command line argument, ie the script file path
TLex lex(commandLine);
TPtrC scriptFilePath(lex.NextToken());
TInt ret = KErrNotFound;
if (scriptFilePath.CompareF(KNull) != 0)
{
_LIT(KTEFSwitchPrefix, "-");
if(scriptFilePath.Mid(0,1).CompareF(KTEFSwitchPrefix) == 0)
{
// If the first command line argument is not the script file path but a optional switches
// Then set the script file path for the execution to be 'blank'
scriptFilePath.Set(KNull);
}
else
{
TBuf<KBuffSize> tempScriptPath(scriptFilePath);
// Check whether script name is provided along with folder path in the command line
// If not, take the path from testexecute.ini & name from the command line
ret=scriptFilePath.FindC(KTEFColon);
if(ret==KErrNotFound)
{
if (parseTestExecuteIni != NULL)
{
TBuf<KMaxTestExecuteNameLength> tempBuffer;
parseTestExecuteIni->GetKeyValueFromIni(KTEFDefaultScriptPath, tempBuffer);
// If the relative script file path does not refer to the root,
// we will look for DefaultScriptDir entry in testexecute.ini
// If available prepend it to the relative path
// else if the relative path refers to root,
// then set the default system drive, i.e. c:
// else leaving it as it is (considering invalid path)
if (scriptFilePath.Left(1).CompareF(KTEFSlash) != 0 &&
tempBuffer.Length() > 0)
scriptFilePath.Set(tempBuffer);
else if (scriptFilePath.Left(1).CompareF(KTEFSlash) == 0)
scriptFilePath.Set(defaultSysDrive);
else
scriptFilePath.Set(KNull);
}
else
{
// If the file path is not provided in command line as well as in testexecute.ini
//.........这里部分代码省略.........
示例14: TRAPD
void CSwiTask::Log(const TDesC& aLine)
{
TRAPD(e,iPassiveLogger->AppendL(aLine));
}
示例15: GetParentContext
//.........这里部分代码省略.........
{
blit = BlitAndClear( aInstance, aGc, drawRect,
imgData, imgIID, bgLayout, paDelta, drawParam );
}
else
{
blit = Blit( aInstance, aGc, drawRect,
imgData, imgIID, bgLayout, paDelta, drawParam );
}
if ( !blit )
{
blitFailed = ETrue;
}
}
else
{
if( !(drawParam&KAknsDrawParamNoClearUnderImage) &&
!(drawParam&KAknsDrawParamPrepareOnly) )
{
// Clear only if permitted
aGc.DrawRect( drawRect );
}
}
}
if( bgLayout )
{
if (!(aDrawParam & KAknsDrawParamIgnoreLayerMask) && aContext->IsCompatibleWithType(EAknsControlContextTypeMasked))
{
CAknsMaskedLayerBackgroundControlContext* layeredCxt = static_cast<CAknsMaskedLayerBackgroundControlContext*>(aContext);
if (layeredCxt->iOffScreenBmp)
{
CAknsMaskedBitmapItemData* maskedImgData = NULL;
TRAPD( err, maskedImgData = CAknsMaskedBitmapItemData::NewL() );
if ( err != KErrNone )
{
return EFalse;
}
maskedImgData->SetBitmap(layeredCxt->iOffScreenBmp);
maskedImgData->SetMask(layeredCxt->iLayerMask);
TAknsBackground* childLayout = bgLayout->iNext;
blitAttempted = ETrue;
blit = Blit( aInstance, aGc, drawRect, maskedImgData,
KAknsIIDNone, childLayout, paDelta, drawParam );
if ( !blit )
{
blitFailed = ETrue;
}
maskedImgData->SetBitmap(NULL);
maskedImgData->SetMask(NULL);
delete maskedImgData;
if (!(aDrawParam & KAknsDrawParamPrepareOnly))
{
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
}
retVal = !blitFailed;
return retVal;
}
}
if (!aContext->IsCompatibleWithType(EAknsControlContextTypeFrame))
{