void CCamcTestClient_visualcheck::RunLTrappedL() { #ifdef _DEBUG RDebug::Print(_L("CamCTestClient VisualCheck:RunL")); #endif if ( iOpenReady ) { iOpenReady = EFalse; switch(iAction) { case K_VC_test_case_101: { break; } case K_VC_test_case_102: { iCamc->SetVideoFrameSizeL(TSize(128,96)); iCamc->SetVideoFrameRateL(TReal32(3)); iCamc->SetVideoBitRateL(TInt(28000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_103: { iCamc->SetVideoFrameSizeL(TSize(128,96)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(28000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(6700); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_104: { iCamc->SetVideoFrameSizeL(TSize(128,96)); iCamc->SetVideoFrameRateL(TReal32(10)); iCamc->SetVideoBitRateL(TInt(28000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(5150); iCamc->SetMaxClipSizeL(250000); break; } case K_VC_test_case_105: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(1)); iCamc->SetVideoBitRateL(TInt(42000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(7400); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_106: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(3)); iCamc->SetVideoBitRateL(TInt(42000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(4750); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_107: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(42000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); break; } case K_VC_test_case_108_a: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(8)); iCamc->SetVideoBitRateL(TInt(128000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); iCamc->SetMaxClipSizeL(250000); break; } case K_VC_test_case_108_b: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(1)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); iCamc->SetMaxClipSizeL(250000); break; } case K_VC_test_case_109: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(3)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); break; } case K_VC_test_case_110: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(42000)); iCamc->SetAudioEnabledL(EFalse); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_111: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetAudioEnabledL(EFalse); iCamc->SetMaxClipSizeL(500000); break; } case K_VC_test_case_112: { iCamc->SetVideoFrameSizeL(TSize(128,96)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_113: { iCamc->SetMaxClipSizeL(50); break; } case K_VC_test_case_114: { break; } case K_VC_test_case_115: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(KMMFVariableVideoBitRate); break; } case K_VC_test_case_116: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); break; } case K_VC_test_case_117: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetMaxClipSizeL(95000); break; } case K_VC_test_case_118: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(5)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(12200); break; } case K_VC_test_case_119: { iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(7)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetMaxClipSizeL(95000); iCamc->SetAudioEnabledL(ETrue); iCamc->SetAudioBitRateL(5150); break; } case K_VC_test_case_120: { iCamc->SetVideoFrameSizeL(TSize(128,96)); iCamc->SetVideoFrameRateL(TReal32(10)); iCamc->SetVideoBitRateL(TInt(64000)); iCamc->SetMaxClipSizeL(500000); break; } case K_VC_test_case_121: { iCamc->SetVideoFrameSizeL(TSize(352,288)); iCamc->SetVideoFrameRateL(TReal32(15)); iCamc->SetVideoBitRateL(TInt(384000)); iCamc->SetAudioEnabledL(ETrue); break; } default: break; } iCamc->Prepare(); } else if ( iPrepareReady ) { iPrepareReady = EFalse; iCamc->Record(); switch(iAction) { case K_VC_test_case_101: { CTimer::After( 30 * TInt32 ( 1E6 ) ); // Records for 30 sec break; } case K_VC_test_case_102: case K_VC_test_case_103: case K_VC_test_case_104: case K_VC_test_case_105: case K_VC_test_case_106: case K_VC_test_case_108_a: case K_VC_test_case_117: case K_VC_test_case_119: case K_VC_test_case_113: { // The timeout will be generated by the SetMaxClipSize. break; } case K_VC_test_case_114: { CTimer::After( 1 * TInt32 ( 1E6 ) ); // Records for 1 sec break; } case K_VC_test_case_116: { CTimer::After( 10 * TInt32 ( 1E6 ) ); // Records for 10 sec iStartRecording2ndTime = EFalse; break; } default: { CTimer::After( 10 * TInt32 ( 1E6 ) ); break; } } } else if ( iRecordingReady ) { iRecordingReady = EFalse; iCamc->Close(); iClosed = ETrue; CTimer::After(1000); } else if (iClosed) { CActiveScheduler::Stop(); } else if ( iPaused ) //resume { switch(iAction) { case K_VC_test_case_107: { iCamc->Record(); CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec. iPaused = EFalse; iAction = K_VC_none; break; } case K_VC_test_case_109: case K_VC_test_case_118: { if ( iDoublePause ) { iCamc->Record(); CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes iPaused = EFalse; iAction = K_VC_none; } else { iCamc->Record(); CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes iPaused = EFalse; iDoublePause = ETrue; } break; } case K_VC_test_case_112: { iCamc->Record(); iPaused = EFalse; break; } case K_VC_test_case_115: { if ( iDoublePause ) { iCamc->Record(); iAction = K_VC_none; // Record until disk full } else { iCamc->Record(); CTimer::After( 2*60 * TInt32 ( 1E6 ) ); // Record 2 minutes iPaused = EFalse; iDoublePause = ETrue; } break; } case K_VC_test_case_121: { iCamc->Record(); CTimer::After( 50 * TInt32 ( 1E6 ) ); // Records for 50 sec. iPaused = EFalse; iAction = K_VC_none; break; } default: break; } } else //timer { switch(iAction) { case K_VC_test_case_107: { iCamc->PauseL(); iPaused = ETrue; CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec break; } case K_VC_test_case_108_a: { if ( i2ndTime ) { // Volume down iCamc->SetGainL( 1 ); iAction = K_VC_none; } else { // Volume Up TInt aSetGain; aSetGain = iCamc->MaxGainL(); iCamc->SetGainL( aSetGain ); CTimer::After( 15 * TInt32 ( 1E6 ) ); i2ndTime = ETrue; } break; } case K_VC_test_case_108_b: { if ( i2ndTime ) { // Volume down iCamc->SetGainL( 1 ); iAction = K_VC_none; } else { // Volume Up TInt aSetGain; aSetGain = iCamc->MaxGainL(); iCamc->SetGainL( aSetGain ); CTimer::After( 15 * TInt32 ( 1E6 ) ); i2ndTime = ETrue; } break; } case K_VC_test_case_109: case K_VC_test_case_115: case K_VC_test_case_118: { iCamc->PauseL(); iPaused = ETrue; if ( i2ndTime ) { CTimer::After( 30 * TInt32 ( 1E6 ) ); // Pauses for 30s } else { CTimer::After( 10 * TInt32 ( 1E6 ) ); // Pauses for 10s i2ndTime = ETrue; } break; } case K_VC_test_case_110: { iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_10 ); break; } case K_VC_test_case_111: { iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_11 ); iAction = K_VC_none; break; } case K_VC_test_case_112: { iCamc->PauseL(); iPaused = ETrue; CTimer::After( 10 * TInt32 ( 1E6 ) ); break; } case K_VC_test_case_116: { if(iStartRecording2ndTime) { iPrepareReady = ETrue; CTimer::After( 10 * TInt32 ( 1E6 ) ); iAction = K_VC_none; } else { iCamc->Stop(); CTimer::After( 3 * TInt32 ( 1E6 ) ); iStartRecording2ndTime = ETrue; } break; } case K_VC_test_case_120: { iCamc->SetVideoBitRateL( TCVC_VIDEO_BIT_RATE_20 ); iAction = K_VC_none; break; } case K_VC_test_case_121: { iCamc->PauseL(); iPaused = ETrue; CTimer::After( 5 * TInt32 ( 1E6 ) ); // Pause 5 sec break; } default: iCamc->Stop(); // Simulates that iRecording has been completed through the // MvruoRecordComplete callback iRecordingReady=ETrue; CTimer::After( 1 * TInt32 ( 1E6 ) ); } } }
void CTe_LbsRootApiTestSuiteStepBase::SetTestRepositorySettingsL(TInt aTestStep) { CRepository* rep = CRepository::NewL(KLbsCenRepUid); CleanupStack::PushL(rep); // clean out any existing entries TUint32 errorKey; User::LeaveIfError(rep->Delete(KLbsSystemTransientKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessTransientKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessNameFirstKey, 0xFFFFF000, errorKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessUidFirstKey, 0xFFFFF000, errorKey)); User::LeaveIfError(rep->Delete(KLbsRootProcessIsServerFirstKey, 0xFFFFF000, errorKey)); // For testing, set LbsRoot to 'transient' mode User::LeaveIfError(rep->Set(KLbsRootProcessTransientKey, EFalse)); User::LeaveIfError(rep->Set(KLbsSystemTransientKey, ETrue)); // set the entries for the 'dummy' processes to // be used for the test TUint nameKey = KLbsRootProcessNameFirstKey; TUint uidKey = KLbsRootProcessUidFirstKey; TUint isProcessKey = KLbsRootProcessIsServerFirstKey; switch(aTestStep) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: default: { User::LeaveIfError(rep->Set(nameKey++, KNrhName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNrhUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KAgpsName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KAgpsUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KNgName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNgUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); break; } // cases 10-18 yet to be ported case 19: { // Force a panic on the first process to be started User::LeaveIfError(rep->Set(nameKey++, KPanickingProcessName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KPanickingUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KAgpsName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KAgpsUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KNgName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNgUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); break; } case 20: { // Force a panic on the second process to be started User::LeaveIfError(rep->Set(nameKey++, KNrhName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNrhUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KPanickingProcessName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KPanickingUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); User::LeaveIfError(rep->Set(nameKey++, KNgName)); User::LeaveIfError(rep->Set(uidKey++, TInt(KNgUid.iUid))); User::LeaveIfError(rep->Set(isProcessKey++, EFalse)); break; } } CleanupStack::PopAndDestroy(rep); }
/** @SYMTestCaseID SYSLIB-DBMS-CT-0640 @SYMTestCaseDesc Tests for RDbView @SYMTestPriority Medium @SYMTestActions Tests for a restricted sized window @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestRestrictedL() { test.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0640 Behaviour at start of set ")); test(TheView.Prepare(TheDatabase,KOrderQuery,KSingleSlotWindow)==KErrNone); test(TheView.EvaluateAll()==KErrNone); test(TheView.CountL()==1); test(!TheView.Unevaluated()); test(TheView.NextL()); test(!TheView.Unevaluated()); TheView.GetL(); TInt id=TheView.ColInt(1); test(!TheView.NextL()); test(TheView.Unevaluated()); Evaluate(); test(TheView.CountL()==1); test(TheView.AtRow()); test(!TheView.PreviousL()); test(TheView.Unevaluated()); Evaluate(); test(TheView.CountL()==1); test(TheView.AtRow()); TheView.GetL(); test(TheView.ColInt(1)==id); test(!TheView.PreviousL()); test(TheView.Unevaluated()); Evaluate(); test(TheView.CountL()==1); test(TheView.AtBeginning()); test(TheView.NextL()); TheView.GetL(); test(TheView.ColInt(1)==id); test(!TheView.Unevaluated()); test.Next(_L("Behaviour at end of set")); GotoEndL(); test(TheView.LastL()); test(!TheView.Unevaluated()); TheView.GetL(); id=TheView.ColInt(1); test(!TheView.PreviousL()); test(TheView.Unevaluated()); Evaluate(); test(TheView.CountL()==1); test(TheView.AtRow()); test(!TheView.NextL()); test(TheView.Unevaluated()); Evaluate(); test(TheView.CountL()==1); test(TheView.AtRow()); TheView.GetL(); test(TheView.ColInt(1)==id); test(!TheView.NextL()); test(TheView.Unevaluated()); Evaluate(); test(TheView.CountL()==1); test(TheView.AtEnd()); test(TheView.PreviousL()); TheView.GetL(); test(TheView.ColInt(1)==id); test(!TheView.Unevaluated()); TheView.Close(); // test.Next(_L("Forward and backwards slots")); test(TheView.Prepare(TheDatabase,KOrderQuery,KSmallWindow)==KErrNone); test(TheView.EvaluateAll()==KErrNone); test(TheView.CountL()==5); test(TheView.FirstL()); CheckWindowL(4,0); test(TheView.NextL()); test(TheView.NextL()); // now on preferred slot (id=2) test(!TheView.Unevaluated()); test(TheView.NextL()); test(TheView.Unevaluated()); Evaluate(); CheckWindowL(2,2); test(TheView.LastL()); // id=5 Evaluate(); test(TheView.LastL()); // id=7 Evaluate(); // should now have last five rows CheckWindowL(2,2); test(TheView.LastL()); // id=9 Evaluate(); // no more rows CheckWindowL(0,4); // all behind us now TheView.GetL(); test(TheView.ColInt(1)==9); TheView.FirstL(); // id=5 Evaluate(); TheView.FirstL(); // id=3 Evaluate(); TheView.FirstL(); // id=1 Evaluate(); CheckWindowL(3,1); // test.Next(_L("Bookmarks")); TDbBookmark mark=TheView.Bookmark(); test(TheView.NextL()); test(TheView.NextL()); test(TheView.NextL()); Evaluate(); TRAPD(r,TheView.GotoL(mark)); test(r!=KErrNone); TheView.FirstL(); Evaluate(); TRAP(r,TheView.GotoL(mark)); test(r==KErrNone); test.Next(_L("Delete")); test(TheView.FirstL()); TheView.GetL(); test(TheView.ColInt(1)==0); TheView.DeleteL(); test(TheView.CountL()==4); TheView.FirstL(); CheckWindowL(3,0); test.Next(_L("Insert")); TheView.InsertL(); TheView.SetColL(1,TInt(0)); TheView.PutL(); test(TheView.CountL()==4); TheView.FirstL(); TheView.GetL(); test(TheView.ColInt(1)==1); TheView.Reset(); test(TheView.EvaluateAll()==KErrNone); test(TheView.FirstL()); TheView.GetL(); test(TheView.ColInt(1)==0); // test.End(); TheView.Close(); }
{_S("=40"),NO_ROWS} }; struct TypeInt64 { public: static const TText* const KType; static const TInt64 KValues[]; static const TSelectTest KTests[]; }; const TText* const TypeInt64::KType=_S("BIGINT"); const TInt64 TypeInt64::KValues[]= { MAKE_TINT64(0x80000000, 0x00000000), // min int64 _LINT64(-4294967296), TInt(0x80000000), // -2147483648! -1, 0u, 1u, 2147483647u, _LINT64(2147483648), _LINT64(4294967295), _LINT64(4294967296), _LINT64(9223372036854775807) // max int64 }; const TSelectTest TypeInt64::KTests[]= { {_S("IS NULL"),ROW(0)}, {_S("IS NOT NULL"),ALL_ROWS}, {_S("=0"),ROW(5)}, {_S("<>0"),ALL_ROWS-ROW(5)},
void CCamcTestClient_2::RunLTrappedL() { TBool prepare = EFalse; if ( iOpenReady ) { iOpenReady = EFalse; // Set default parameters. They can be overwritten depending on the test case. iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(15)); iCamc->SetVideoBitRateL(TInt(50000)); iCamc->SetAudioEnabledL(ETrue); switch ( iAction ) { case KcloseWhenControllerReady: { iCamc->Close(); iClosed = 1; break; } case KprepareWhenControllerReady: { prepare = ETrue; break; } case KrecordWhenControllerReady: { iCamc->Record(); break; } case KSetPriorityLWhenControllerReady : { iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime ); prepare = ETrue; break; } case KSetVideoFrameRateLWhenControllerReady : { iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) ); prepare = ETrue; break; } case KSetVideoFrameSizeLWhenControllerReady : { iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE ); prepare = ETrue; break; } case KSetVideoFrameSizeLWhenControllerReady_MPEG4 : { iCamc->SetVideoFrameSizeL( TC2_CIF_VIDEO_FRAME_SIZE ); prepare = ETrue; break; } case KSetVideoBitRateLWhenControllerReady : { iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE ); prepare = ETrue; break; } case KSetAudioBitRateLWhenControllerReady : { iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE ); prepare = ETrue; break; } case KSetAudioEnabledLWhenControllerReady : { iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED ); prepare = ETrue; break; } case KSetMaxClipSizeLWhenControllerReady : { iCamc->SetMaxClipSizeL( 10000 ); prepare = ETrue; break; } case KSetVideoTypeLWhenControllerReady : { iCamc->SetVideoTypeL( TC2_VIDEO_TYPE ); prepare = ETrue; break; } case KSetAudioTypeLWhenControllerReady : { iCamc->SetAudioTypeL( TC2_AUDIO_TYPE ); prepare = ETrue; break; } default: { prepare = ETrue; break; } } if ( prepare ) { iCamc->Prepare(); } } else if ( iPrepareReady ) { TBool record = EFalse; switch ( iAction ) { case KcloseWhenPrepareReady: { iCamc->Close(); iClosed = 1; break; } case KcloseWhenPrepareReadyUsingAACandMPEG4: { iCamc->Close(); iClosed = 1; break; } case KprepareWhenPrepareReady: { iAction = Knone; iPrepareReady = EFalse; iCamc->Prepare(); break; } case KprepareWhenPrepareReadySetVideoAttributes: { iAction = Knone; iPrepareReady = EFalse; iCamc->SetVideoFrameSizeL( TSize(176,144) ); iCamc->SetVideoFrameRateL( TReal32(15) ); iCamc->SetVideoBitRateL( TInt(50000) ); iCamc->SetAudioEnabledL( EFalse ); iCamc->Prepare(); break; } case KrecordWhenPrepareReady: { record = ETrue; break; } case KSetPriorityLWhenPrepareReady : { if (!iSecondTime) { iCamc->SetPriorityL(EMdaPriorityNormal,EMdaPriorityPreferenceTime ); record = EFalse; iCamc->Prepare(); iSecondTime = ETrue; } else { record= ETrue; } break; } case KSetVideoFrameRateLWhenPrepareReady : { iCamc->SetVideoFrameRateL( TReal32(TC2_VIDEO_FRAME_RATE) ); record = ETrue; break; } case KSetVideoFrameSizeLWhenPrepareReady : { iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE ); record = ETrue; break; } case KSetVideoBitRateLWhenPrepareReady : { iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE ); record = ETrue; break; } case KSetAudioBitRateLWhenPrepareReady : { iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE ); record = EFalse; iCamc->Prepare(); iAction = Knone; break; } case KSetAudioEnabledLWhenPrepareReady : { iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED ); record = ETrue; break; } case KSetMaxClipSizeLWhenPrepareReady : { iCamc->SetMaxClipSizeL( 10000 ); record = ETrue; break; } case KSetVideoTypeLWhenPrepareReady : { iCamc->SetVideoTypeL( TC2_VIDEO_TYPE ); record = ETrue; break; } case KSetAudioTypeLWhenPrepareReady : { iCamc->SetAudioTypeL( TC2_AUDIO_TYPE ); record = ETrue; break; } case KSetMaxClipSizeLWhenControllerReady : { record = ETrue; iTimeout = 40 * 1E6; // Wait for 10 seconds. break; } default: { record = ETrue; break; } } if ( record ) { iPrepareReady = EFalse; iCamc->Record(); CTimer::After( iTimeout ); } } else if ( iRecordingReady ) { TBool closeCam = ETrue; switch ( iAction ) { case KcloseWhenRecordingReady: { iAction = Knone; iCamc->Close(); closeCam = EFalse; // False because we want to stop the Active scheduler // yet CTimer::After( 10000 ); break; } case KprepareWhenRecordingReady: { iAction = Knone; iRecordingReady = EFalse; iCamc->Prepare(); closeCam = EFalse; // Should start a new recording break; } case KrecordWhenRecordingReady: { iAction = Knone; iRecordingReady = EFalse; iCamc->Record(); closeCam = EFalse; CTimer::After( (TInt) (10*1E6) ); // Starts a new recording break; } default: break; } // //////////////////////////////////////////////////////////////// // Check here if the settings were taken into use // (For functions with a get) switch ( iSavedAction ) { case KSetPriorityLWhenPrepareReady : case KSetPriorityLWhenRecording: case KSetPriorityLWhenControllerReady : { TInt priority; TMdaPriorityPreference pref; iCamc->GetPriorityL(priority, pref); __ASSERT_ALWAYS( priority == EMdaPriorityNormal, User::Leave( KErrGetNotEqualToValuePreviouslySet )); __ASSERT_ALWAYS( pref == EMdaPriorityPreferenceTime, User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetVideoFrameRateLWhenPrepareReady : case KSetVideoFrameRateLWhenRecording: case KSetVideoFrameRateLWhenControllerReady : { TReal32 frameRate; frameRate = iCamc->VideoFrameRateL(); __ASSERT_ALWAYS( frameRate == TC2_VIDEO_FRAME_RATE , User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetVideoFrameSizeLWhenPrepareReady : // Should have left already case KSetVideoFrameSizeLWhenRecording: // Should have left already User::Panic(_L("Should never come here"),0); break; case KSetVideoFrameSizeLWhenControllerReady : { TSize frameSize; iCamc->GetVideoFrameSizeL( frameSize ); __ASSERT_ALWAYS( frameSize== TC2_VIDEO_FRAME_SIZE , User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetVideoFrameSizeLWhenControllerReady_MPEG4 : { TSize cifFrameSize; iCamc->GetVideoFrameSizeL( cifFrameSize ); __ASSERT_ALWAYS( cifFrameSize== TC2_CIF_VIDEO_FRAME_SIZE , User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetVideoBitRateLWhenPrepareReady : case KSetVideoBitRateLWhenRecording: case KSetVideoBitRateLWhenControllerReady : { TInt bitRate; bitRate = iCamc->VideoBitRateL(); __ASSERT_ALWAYS( bitRate == TC2_VIDEO_BIT_RATE , User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetAudioBitRateLWhenPrepareReady : case KSetAudioBitRateLWhenControllerReady : { TInt bitRate; bitRate = iCamc->AudioBitRateL(); __ASSERT_ALWAYS( bitRate == TC2_AUDIO_BIT_RATE , User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetVideoTypeLWhenPrepareReady : // Should have left already case KSetVideoTypeLWhenRecording: // Should have left already User::Panic(_L("Should never come here"),0); break; case KSetVideoTypeLWhenControllerReady : { TPtrC8 videoType = iCamc->VideoFormatMimeType(); TPtrC8 expectedVideoType[TC2_VIDEO_TYPES_ARRAY_LENGTH] = TC2_VIDEO_TYPES_ARRAY ; TBool found = 0; for (TInt i=0; i<TC2_VIDEO_TYPES_ARRAY_LENGTH ; i++) { if ( expectedVideoType[i] == videoType) { found = 1; } } __ASSERT_ALWAYS( found, User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } case KSetAudioTypeLWhenPrepareReady : // Should have left already case KSetAudioTypeLWhenRecording: // Should have left already User::Panic(_L("Should never come here"),0); break; case KSetAudioTypeLWhenControllerReady : { TFourCC audioType; audioType = iCamc->AudioTypeL(); __ASSERT_ALWAYS( audioType == TC2_AUDIO_TYPE , User::Leave( KErrGetNotEqualToValuePreviouslySet )); break; } default: break; } if (closeCam) { iRecordingReady = EFalse; // Close will panic if called here... iCamc->Close(); CActiveScheduler::Stop(); } } else if ( iPaused ) //resume { iPaused = EFalse; iCamc->Record(); } else //timer { switch ( iAction ) { case KcloseWhenRecording: { iCamc->Close(); iClosed = 1; break; } case KprepareWhenRecording: { // Should leave. iAction = Knone; iCamc->Prepare(); break; } case KrecordWhenRecording: { // Should be ignored iAction = Knone; iCamc->Record(); CTimer::After ( (TInt) 1E6 ); // Wait 1 Second break; } case KSetPriorityLWhenRecording : { iAction = Knone; iCamc->SetPriorityL( EMdaPriorityNormal,EMdaPriorityPreferenceTime ); CTimer::After( iTimeout ); break; } case KSetVideoFrameRateLWhenRecording: { iAction = Knone; iCamc->SetVideoFrameRateL( TReal32( TC2_VIDEO_FRAME_RATE ) ); CTimer::After( iTimeout ); break; } case KSetVideoFrameSizeLWhenRecording : { iCamc->SetVideoFrameSizeL( TC2_VIDEO_FRAME_SIZE ); break; } case KSetVideoBitRateLWhenRecording : { iAction = Knone; iCamc->SetVideoBitRateL( TC2_VIDEO_BIT_RATE ); CTimer::After( iTimeout ); break; } case KSetAudioBitRateLWhenRecording : { iAction = Knone; // Should leave iCamc->SetAudioBitRateL( TC2_AUDIO_BIT_RATE ); // If it has left yet, problem ! User::Leave(KErrCorrupt); CTimer::After( iTimeout ); break; } case KSetAudioEnabledLWhenRecording : { iAction = Knone; iCamc->SetAudioEnabledL( TC2_AUDIO_ENABLED ); CTimer::After( iTimeout ); break; } case KSetMaxClipSizeLWhenRecording: { iAction = Knone; iCamc->SetMaxClipSizeL( 10000 ); CTimer::After( iTimeout ); break; } case KSetVideoTypeLWhenRecording: { iAction = Knone; // Should leave iCamc->SetVideoTypeL( TC2_VIDEO_TYPE ); // If it has left yet, problem ! User::Leave(KErrCorrupt); CTimer::After( iTimeout ); break; } case KSetAudioTypeLWhenRecording: { iAction = Knone; // Should leave iCamc->SetAudioTypeL( TC2_AUDIO_TYPE ); // If it has left yet, problem ! User::Leave(KErrCorrupt); CTimer::After( iTimeout ); break; } default: { iCamc->Stop(); // Simulates that iRecording has been completed through the // MvruoRecordComplete callback iRecordingReady=ETrue; CTimer::After( 1000 ); break; } } } if ( iClosed ) { iCamc->Stop(); CActiveScheduler::Stop(); } }
TRomDir* DirEntry::CreateRomEntries(char*& anAddr) const { TInt i; TInt count=iDir->Count(); TInt subdircount=0; for(i=0; i<count; i++) { Entry* pE=(Entry*)&(*iDir)[i]; if (pE->IsDir()) { subdircount++; // Recursively build & place the subdirectories DirEntry *pD=(DirEntry*)pE; TRomDir *pR=pD->iDir->iRomDir; if (!pR) { pR=pD->CreateRomEntries(anAddr); pD->iDir->iRomDir=pR; } } } // Now place & build the TRomDir for this directory TInt *pS=(TInt*)anAddr; iDir->iRomDir=(TRomDir*)anAddr; *pS=0; anAddr+=sizeof(TInt); char* offsetbase=anAddr; SortableEntry* array=new SortableEntry [count]; if (array==0) { Print(EError,"Failed to allocate array of SortableEntry\n"); exit(-1); } for(i=0; i<count; i++) { Entry* pE=(Entry*)&(*iDir)[i]; array[i].iOffset=anAddr-offsetbase; array[i].iEntry=pE; TRomEntry *pR=pE->CreateRomEntry(anAddr); if (pE->IsDir()) { TRomDir *pD=((DirEntry*)pE)->iDir->iRomDir; if (pD) pR->iAddressLin=ActualToRomAddress(pD); else Print(EError,"Failed to fix up subdirectory address\n"); } } *pS=TInt(anAddr-(char*)pS-sizeof(TInt)); // Emit table of offsets for the subdirs and files in sorted order if (gSortedRomFs) { TInt filecount=count-subdircount; if (filecount>65535 || subdircount>65535) { Print(EError,"Too many files or subdirectories\n"); exit(-1); } TUint16* ptr=(TUint16*)anAddr; *ptr++=(TUint16)subdircount; *ptr++=(TUint16)filecount; qsort(array,count,sizeof(SortableEntry),&compare); for (i=0; i<count; i++) { unsigned int scaledOffset = array[i].iOffset>>2; if ((array[i].iOffset & 3) != 0 || scaledOffset > 65535) Print(EError, "Bad offset into directory\n"); *ptr++ = (TUint16)scaledOffset; } anAddr=(char*)ALIGN4((int)ptr); } delete [] array; return (TRomDir*)pS; }
///////////////////////////////////////////////// // Tql-Lexical-Chars void TTqlChDef::SetChTy(const TTqlLxChTy& ChTy, const TStr& Str){ for (int ChN=0; ChN<Str.Len(); ChN++){ChTyV[Str[ChN]-TCh::Mn]=TInt(ChTy);} }
void TJsonVal::Save(TSOut& SOut) const { TInt((int)JsonValType).Save(SOut); Bool.Save(SOut); Num.Save(SOut); Str.Save(SOut); ValV.Save(SOut); KeyValH.Save(SOut); }
void CCamcTestClient_9::RunLTrappedL() { if ( iOpenReady ) { iOpenReady = EFalse; switch ( iAction ) { case K_Tc9_PrepareWhenControllerReadyWhitoutSetting: case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting: case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting: { break; } case K_TC9_NewFileNameWhenInternalStop: { iCamc->SetMaxClipSizeL(TC9_FILE_SIZE_LIMIT) ; break; } case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat: { iCamc->SetVideoFrameSizeL(TSize(352,288)); iCamc->SetVideoFrameRateL(TReal32(15)); iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE ); iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE_AAC )); break; } default: { // Set default parameters. They can be overwritten depending on the test case. iCamc->SetVideoFrameSizeL(TSize(176,144)); iCamc->SetVideoFrameRateL(TReal32(15)); iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE ); iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE )); break; } } switch ( iAction ) { case K_Tc9_PrepareWhenControllerReadyWhitoutSetting: { break; } case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting: { iCamc->SetVideoBitRateL(TInt(50000)); break; } case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting: { iCamc->SetVideoFrameSizeL(TSize(176,144)); break; } case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0: { iCamc->SetMaxClipSizeL( 0 ); break; } case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize: { iCamc->SetMaxClipSizeL( KMMFNoMaxClipSize ); break; } case K_Tc9_OpenFileInAFolderNonExistent: { AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), iFileName); TMMFFileParams params; params.iPath = iFileName; TPckgC<TMMFFileParams> pckg(params); TUid controllerUid = {0x101F8503}; // controller implementation interface uid TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); if (ret != 0) { User::Leave(K_Tc9_ValueNotExpected); } iAction = K_Tc9_none; break; } default: { break; } } iCamc->Prepare(); } else if ( iPrepareReady ) { TBool record = EFalse; switch ( iAction ) { case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0: case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize: { iPrepareReady = EFalse; iCamc->Record(); record = EFalse; break; } case K_TC9_NewFileNameWhenPreparedNotRecording: { if (!iNewFileName) { AddDriveLetterToPath(_L("NewFileName.3gp"),iFileName); TMMFFileParams params; params.iPath = iFileName; TPckgC<TMMFFileParams> pckg(params); TUid controllerUid = {0x101F8503}; // controller implementation interface uid TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); if (ret != 0) { User::Leave(K_Tc9_ValueNotExpected); } iCamc->Prepare(); iAction = K_Tc9_none; } break; } case K_TC9_NewFileNameWhenInternalStop : { iPrepareReady = EFalse; iCamc->Record(); // No timer need, will eventually stop because of filesize limit. break; } default: { record = ETrue; break; } } if ( record ) { iPrepareReady = EFalse; iCamc->Record(); CTimer::After( iTimeout ); } } else if ( iRecordingReady ) { TBool close = EFalse; iRecordingReady = EFalse; TMMFFileParams params; switch ( iAction ) { case K_Tc9_RecordTimeAvailWhenRecordingReady: { // Compare if default size limit is correctly returned by // a RecordTimeAvailableL TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable(); TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6; //Max time is 3600s = 60min PRINT((_L("CCamCTest_9::RecordTimeAvailable5: timeRemainingInSec: %d "), I64INT(timeRemainingInSec ))); // Duration value depends on available disk drive space. // Get the free space of the disk drive: RFs fsSession; fsSession.Connect(); TVolumeInfo volumeInfo; TInt err = fsSession.Volume(volumeInfo,EDriveC); fsSession.Close(); if (err) { User::Leave( KErrGeneral) ; } // Possible duration = available disk space/videobitrate TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC9_VIDEO_BIT_RATE+TC9_AUDIO_BIT_RATE)/8); // If there is more space than the max length of the video -> // set the calculatedDuration to max length if ( calculatedDuration > KMaxVideoLength) { calculatedDuration = KMaxVideoLength; } RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 timeRemaining is %d "), I64INT(timeRemainingInSec )); RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 calculatedDuration is %d "), I64INT(calculatedDuration ) ); // Allows 5% error margin: if ( ( timeRemainingInSec > calculatedDuration*1.05 ) || ( timeRemainingInSec < calculatedDuration*0.95 ) ) { RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 is leaving, because timeRemaining != Calculated ") ); User::Leave( K_Tc9_ValueNotWithinRange ) ; } close = ETrue; break; } case K_TC9_NewFileNameWhenRecordSecondTime : { if (!iRecord2ndTime) { iRecord2ndTime =ETrue; AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName ); params.iPath = iFileName; TPckgC<TMMFFileParams> pckg(params); TUid controllerUid = {0x101F8503}; // controller implementation interface uid TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); if (ret != 0) { User::Leave(K_Tc9_ValueNotExpected); } iCamc->Prepare(); iAction = K_Tc9_none; } break; } case K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat : { if (!iRecord2ndTime) { iRecord2ndTime =ETrue; AddDriveLetterToPath(_L("NewFileName.3g2"), iFileName ); params.iPath = iFileName; TPckgC<TMMFFileParams> pckg(params); TUid controllerUid = {0x101F8503}; // controller implementation interface uid TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); if (ret != 0) { User::Leave(K_Tc9_ValueNotExpected); } iCamc->Prepare(); iAction = K_Tc9_none; } break; } case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat : { if (!iRecord2ndTime) { iRecord2ndTime =ETrue; AddDriveLetterToPath(_L("NewFileName.mp4"), iFileName ); params.iPath = iFileName; TPckgC<TMMFFileParams> pckg(params); TUid controllerUid = {0x101F8503}; // controller implementation interface uid TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); if (ret != 0) { User::Leave(K_Tc9_ValueNotExpected); } iCamc->Prepare(); iAction = K_Tc9_none; } break; } case K_TC9_NewFileNameWhenInternalStop : { if (!iRecord2ndTime) { iRecord2ndTime =ETrue; AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName ); params.iPath = iFileName; TPckgC<TMMFFileParams> pckg(params); TUid controllerUid = {0x101F8503}; // controller implementation interface uid TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8); if (ret != 0) { User::Leave(K_Tc9_ValueNotExpected); } iCamc->Prepare(); } else { close = ETrue; } break; } default: { close = ETrue; break; } } if (close) { iCamc->Close(); iClosed = ETrue; CTimer::After( 1000 ); } } else { RunLContinuedL(); } if ( iClosed ) { iCamc->Stop(); CActiveScheduler::Stop(); } }
void TLxChDef::SetChTy(const TLxChTy& ChTy, const TStr& Str) { for (int CC=0; CC<Str.Len(); CC++) { ChTyV[Str[CC]-TCh::Mn]=TInt(ChTy); } }
///////////////////////////////////////////////// // Json-Value TJsonVal::TJsonVal(TSIn& SIn): JsonValType((TJsonValType)(TInt(SIn).Val)), Bool(SIn), Num(SIn), Str(SIn), ValV(SIn), KeyValH(SIn) { }
TLxChDef::TLxChDef(const TLxChDefTy& ChDefTy): ChTyV(TCh::Vals), UcChV(TCh::Vals) { if (ChDefTy==lcdtUsAscii) { // Character-Types ChTyV.PutAll(TInt(lctSpace)); SetChTy(lctNum, "0123456789"); SetChTy(lctAlpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); SetChTy(lctAlpha, "abcdefghijklmnopqrstuvwxyz"); SetChTy(lctAlpha, "@_"); SetChTy(lctSSym, "\"'.,:;+-*/%!#|&<=>?()[]{}"); SetChTy(lctTerm, TStr(TCh::CrCh)); SetChTy(lctTerm, TStr(TCh::LfCh)); SetChTy(lctTerm, TStr(TCh::EofCh)); // Upper-Case for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++) { UcChV[Ch-TCh::Mn]=TCh(char(Ch)); } SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("Dd"); SetUcCh("Ee"); SetUcCh("Ff"); SetUcCh("Gg"); SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj"); SetUcCh("Kk"); SetUcCh("Ll"); SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo"); SetUcCh("Pp"); SetUcCh("Qq"); SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("Tt"); SetUcCh("Uu"); SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy"); SetUcCh("Zz"); } else if (ChDefTy==lcdtYuAscii) { // Character-Types ChTyV.PutAll(TInt(lctSpace)); SetChTy(lctNum, "0123456789"); SetChTy(lctAlpha, "ABC^]D\\EFGHIJKLMNOPQRS[TUVWXYZ@"); SetChTy(lctAlpha, "abc~}d|efghijklmnopqrs{tuvwxyz`"); SetChTy(lctAlpha, "_"); SetChTy(lctSSym, "\".,:;+-*/%!#&<=>?()"); SetChTy(lctTerm, TStr(TCh::CrCh)); SetChTy(lctTerm, TStr(TCh::LfCh)); SetChTy(lctTerm, TStr(TCh::EofCh)); // Upper-Case for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++) { UcChV[Ch-TCh::Mn]=TCh(char(Ch)); } SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("^~"); SetUcCh("]}"); SetUcCh("Dd"); SetUcCh("\\|"); SetUcCh("Ee"); SetUcCh("Ff"); SetUcCh("Gg"); SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj"); SetUcCh("Kk"); SetUcCh("Ll"); SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo"); SetUcCh("Pp"); SetUcCh("Qq"); SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("[{"); SetUcCh("Tt"); SetUcCh("Uu"); SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy"); SetUcCh("Zz"); SetUcCh("@`"); } else { Fail; } }
EXPORT_C TInt TBtreeKey::Compare(const TAny* aLeft,const TAny* aRight) const // // do the right thing // { UPTR left; left.tany=aLeft; UPTR right; right.tany=aRight; switch (iCmpType) { case ECmpNormal8: return Mem::Compare(left.tuint8,iKeyLength,right.tuint8,iKeyLength); case ECmpFolded8: return Mem::CompareF(left.tuint8,iKeyLength,right.tuint8,iKeyLength); case ECmpCollated8: return Mem::CompareC(left.tuint8,iKeyLength,right.tuint8,iKeyLength); case ECmpNormal16: return Mem::Compare(left.tuint16,iKeyLength,right.tuint16,iKeyLength); case ECmpFolded16: return Mem::CompareF(left.tuint16,iKeyLength,right.tuint16,iKeyLength); case ECmpCollated16: return Mem::CompareC(left.tuint16,iKeyLength,right.tuint16,iKeyLength); case ECmpCollated16+ECmpNormal8+1: return Mem::Compare(left.tuint8+1,*left.tuint8,right.tuint8+1,*right.tuint8); case ECmpCollated16+ECmpFolded8+1: return Mem::CompareF(left.tuint8+1,*left.tuint8,right.tuint8+1,*right.tuint8); case ECmpCollated16+ECmpCollated8+1: return Mem::CompareC(left.tuint8+1,*left.tuint8,right.tuint8+1,*right.tuint8); case ECmpCollated16+ECmpNormal16+1: return Mem::Compare(left.tuint16+1,*left.tuint16,right.tuint16+1,*right.tuint16); case ECmpCollated16+ECmpFolded16+1: return Mem::CompareF(left.tuint16+1,*left.tuint16,right.tuint16+1,*right.tuint16); case ECmpCollated16+ECmpCollated16+1: return Mem::CompareC(left.tuint16+1,*left.tuint16,right.tuint16+1,*right.tuint16); case ECmpTInt8: return *left.tint8-*right.tint8; case ECmpTUint8: return TInt(*left.tuint8)-TInt(*right.tuint8); case ECmpTInt16: return *left.tint16-*right.tint16; case ECmpTUint16: return TInt(*left.tuint16)-TInt(*right.tuint16); case ECmpTInt32: if (*left.tint32<*right.tint32) return -1; if (*left.tint32>*right.tint32) return 1; break; case ECmpTUint32: if (*left.tuint32<*right.tuint32) return -1; if (*left.tuint32>*right.tuint32) return 1; break; case ECmpTInt64: if (*left.tint64<*right.tint64) return -1; if (*left.tint64>*right.tint64) return 1; break; default: break; } return 0; }
/* ------------------------------------------------------------------------------- Class: TStifUtil Method: CorrectFilePath Description: Checks if file path contains drive letter. If not file is serched on all drives and first hit is added to file name. Parameters: TDes& aFilePath: in/out: file path to correct Return Values: None Errors/Exceptions: Leaves if some of called leaving methods leaves ------------------------------------------------------------------------------- */ EXPORT_C void TStifUtil::CorrectFilePathL( TDes& aFilePath ) { _LIT( KDriveSelector, ":\\" ); _LIT( KDriveSelectorFormat_1, "%c:" ); _LIT( KDriveSelectorFormat_2, "%c:\\" ); TChar KDriveZ = EDriveZ;//'Z'; _LIT( KBackslash, "\\" ); TInt length = aFilePath.Length(); if (length == 0 ) { return; } if (length > 2 ) { // Check if file path contains drive selector if ( aFilePath.Mid( 1, 2 ) == KDriveSelector ) { // File path contains selector letter so we have nothing to do here return; } } // Check if file path contains backslash at the begining and // select proper drive selector format according to this information TInt driveSelectorFormat = 2; if ( aFilePath.Mid( 0, 1 ) == KBackslash ) { driveSelectorFormat = 1; } RFs rfs; if ( rfs.Connect() != KErrNone ) { return; } // Get available drives list, revers it order and move z drive at // the end of the list. TDriveList drivesList; rfs.DriveList(drivesList); // Set drive variable to last drive (except for Z, which will be checked at the end) char drive = 'Y' ; // Loop through all the drives in following order: YX..CBAZ while(drive >= 'A' && drive <= 'Z') { // Do further action only if drive exists TInt driveint; rfs.CharToDrive(drive, driveint); if(drivesList[driveint]) { //further checking (drive selector and file existence) // Prepare drive selector TBuf<3> driveSelector; if ( driveSelectorFormat == 1 ) { driveSelector.Format( KDriveSelectorFormat_1, drive ); } else if ( driveSelectorFormat == 2 ) { driveSelector.Format( KDriveSelectorFormat_2, drive ); } aFilePath.Insert( 0, driveSelector ); TEntry entry; if ( rfs.Entry(aFilePath, entry) == KErrNone ) { rfs.Close(); return; } // File does not exists on selected drive. Restoring orginal file path aFilePath.Delete( 0, driveSelector.Length() ); }//if(drivesList[driveint]) // Select next drive if(drive == 'Z') break; // the last driver else if(drive == 'A' ) drive = 'Z'; //after checking A check Z else drive = (TChar)(TInt(drive)-1) ; //after checking Y check X and so on in reverse alphabetical order } //while rfs.Close(); }
TGStatVec::TGStatVec(TSIn& SIn) : TmUnit((TTmUnit) TInt(SIn).Val), StatFSet(SIn), GStatV(SIn) { }
TStringKernel::TStringKernel(TSIn& SIn) { KernelType = TInt(SIn); Lambda = TFlt(SIn); SeqLen = TInt(SIn); GapLen = TInt(SIn); AlphN = TInt(SIn); LinCombV.Load(SIn); WeightV.Load(SIn); }
void TGStatVec::Save(TSOut& SOut) const { TInt(TmUnit).Save(SOut); StatFSet.Save(SOut); GStatV.Save(SOut); }
void CBCTestFontInputCase::TestFontSpecL() { // Test some API here TAknFontSpecification fontSpec( 3 ); fontSpec.SetExactMatchRequired( ETrue ); _LIT( stMatch, " Test SetExactMatchRequired() " ); AssertTrueL( ETrue, stMatch ); fontSpec.SetTextPaneHeight( TInt( 3 ) ); _LIT( stPaneHeight, " Test SetTextPaneHeight()" ); AssertTrueL( ETrue, stPaneHeight ); fontSpec.SetFontCategory( EAknFontCategoryUndefined ); _LIT( stFontCate, " Test SetFontCategory() " ); AssertTrueL( ETrue, stFontCate ); fontSpec.SetPosture( EPostureUpright ); _LIT( stPost, " Test SetPosTure() " ); AssertTrueL( ETrue, stPost ); fontSpec.SetTextPaneHeightIsDesignHeight( ETrue ); _LIT( stHeighIsDesHeight, " Test SetTextPaneHeightIsDesignHeight() " ); AssertTrueL( ETrue, stHeighIsDesHeight ); fontSpec.SetUnits( TAknFontSpecification::EPixels); _LIT( stUnits, " Test SetUnits()" ); AssertTrueL( ETrue, stUnits ); fontSpec.SetWeight( EStrokeWeightNormal ); _LIT( stWeight, " Test SetWeight() " ); AssertTrueL( ETrue, stWeight ); TAknTextDecorationMetrics txtDecMetric( 3 ); txtDecMetric.BaselineToUnderlineOffset(); _LIT( bsLnToUnderLn," Test BaseLineToUnderline)ffset() " ); AssertTrueL( ETrue, bsLnToUnderLn ); txtDecMetric.UnderlineHeight(); _LIT( underLnHeight," Test UnderlineHeight() " ); AssertTrueL( ETrue, underLnHeight ); TInt lef,rgt,tp,bt; txtDecMetric.GetLeftAndRightMargins( lef, rgt ); _LIT( gtLeftAndRight, " Test GetLeftAndRightMargins() " ); AssertTrueL( ETrue, gtLeftAndRight ); txtDecMetric.GetTopAndBottomMargins( tp,bt ); _LIT( gtTandB, " Test GetTopAndBottomMargins() " ); AssertTrueL( ETrue, gtTandB ); txtDecMetric.CursorWidth(); _LIT( CurWidth, " Test CursorWidth() " ); AssertTrueL( ETrue, CurWidth ); TAknTextDecorationMetrics txtDecMetric1( CCoeEnv::Static()->NormalFont() ); _LIT( txtDecMetricsFont, " Test TAKnTextDecorationMetrics( Font )" ); AssertTrueL( ETrue, txtDecMetricsFont ); TAknTextDecorationMetrics txtDecMetric2( fontSpec ); _LIT( txtDecMetricsSpec," Test TAKnTextDecorationMetrics( Font )" ); AssertTrueL( ETrue, txtDecMetricsSpec ); const CAknLayoutFont* layoutFont = AknLayoutUtils::LayoutFontFromId( 3 ); TInt maxAscent = layoutFont->MaxAscent(); _LIT( KLayoutFont1, "CAknLayoutFont::MaxAscent" ); AssertTrueL( ETrue, KLayoutFont1 ); TAknTextDecorationMetrics metrics = layoutFont->TextDecorationMetrics(); _LIT( KLayoutFont2, "CAknLayoutFont::TextDecorationMetrics" ); AssertTrueL( ETrue, KLayoutFont2 ); }
void THttpChDef::SetChTy(const THttpChTy& ChTy, const char& Ch){ IAssert(ChTyV[Ch-TCh::Mn]==int(hpctUndef)); ChTyV[Ch-TCh::Mn]=TInt(ChTy);}
void CBCTestFontInputCase::TestLafEnvL() { LafEnv::Beep(); _LIT( beep," Test Beep() " ); AssertTrueL( ETrue,beep ); LafEnv::ClockDllName(); _LIT( clkName," Test ClockDllName() " ); AssertTrueL( ETrue,clkName ); LafEnv::CoctlResourceFile(); _LIT( ctlResFile," Test CoctlResourceFile() " ); AssertTrueL( ETrue,ctlResFile ); LafEnv::CreateTextParserL( TInt( 3 ) ); _LIT( crtTxtParser," Test CreateTextParserL() " ); AssertTrueL( ETrue,crtTxtParser); LafEnv::DefaultBusyMsgCorner(); _LIT(defBusyMsg," Test DefaultBusyMsgCorner() " ); AssertTrueL( ETrue,defBusyMsg ); LafEnv::IsTaskListDisabledAtInitialization(); _LIT( isTaskInit," Test IsTaskListDisabledAtInitialization" ); AssertTrueL( ETrue,isTaskInit ); LafEnv::EditableControlStandardHeight( CEikonEnv::Static()->LafEnv() ); _LIT( editHeight," Test EditableControlStandardHeight() " ); AssertTrueL( ETrue,editHeight ); LafEnv::IsDefaultKey( EAknSoftkeyBack ); _LIT( isDefKey," Test IsDefaultKey() " ); AssertTrueL( ETrue,isDefKey ); CColorList *clrList = LafEnv::CreateColorListL( *CEikonEnv::Static() ); _LIT(crtClrList," Test CreateColorListL() " ); AssertTrueL( ETrue,crtClrList ); LafEnv::UpdateColorListL( clrList ); _LIT( upClrList," Test UpdateColorListL() " ); AssertTrueL( ETrue, upClrList ); TInt fId = LafEnv::LoadPrivResFileL( *CEikonEnv::Static() ); _LIT( ldResFile," Test LoadPrivResFileL() " ); AssertTrueL( ETrue,ldResFile ); CEikonEnv::Static()->DeleteResourceFile( fId ); fId = LafEnv::LoadCoreResFileL( *CEikonEnv::Static() ); CEikonEnv::Static()->DeleteResourceFile( fId ); _LIT( cResFile," Test LoadCoreResFileL() " ); AssertTrueL( ETrue,cResFile ); CArrayPtr<CLafSystemFont> *ftArray = new (ELeave) CArrayPtrSeg<CLafSystemFont>(10); LafEnv::CreateSystemFontsL( *CEikonEnv::Static(),*ftArray ); _LIT( crtSysFont," Test CreateSystemFontsL() " ); AssertTrueL( ETrue,crtSysFont ); LafEnv::UpdateSystemFontsL( CEikonEnv::Static(),*ftArray ); _LIT( upSysFont," Test UpdateSystemFontsL() " ); AssertTrueL( ETrue,upSysFont ); LafEnv::ReleaseSystemFonts(*ftArray); delete ftArray; CArrayPtrFlat<CFbsBitmap> *arBitmaps = new CArrayPtrFlat<CFbsBitmap>(16); LafEnv::CreateSystemBitmapsL( *CEikonEnv::Static(), *arBitmaps); _LIT( crtSysBitmap," Test CreateSystemBitmapsL() " ); AssertTrueL( ETrue,crtSysBitmap ); LafEnv::UpdateSystemBitmapsL(*CEikonEnv::Static() , *arBitmaps,*clrList ); _LIT( upSysBitmap," Test UpdateSystemBitmapsL() " ); AssertTrueL( ETrue,upSysBitmap ); delete clrList; delete arBitmaps; MEikBusyMsgWin *msgWin = LafEnv::NewBusyMsgWinL( *CCoeEnv::Static()); msgWin->Release(); _LIT( newMsgWin," Test NewBusyMsgWinL() " ); AssertTrueL( ETrue,newMsgWin ); RWindowGroup rWinGrup = CCoeEnv::Static()->RootWin(); MEikInfoMsgWin* infMsgWin = LafEnv::NewInfoMsgWinL( *CCoeEnv::Static(), rWinGrup ); _LIT( newinfMsgWinGrup," Test NewInfoMsgWinL() " ); AssertTrueL( ETrue,newinfMsgWinGrup); infMsgWin->Release(); infMsgWin = LafEnv::NewInfoMsgWinL( *CCoeEnv::Static() ); _LIT( newinfMsgWin," Test NewInfoMsgWinL() " ); AssertTrueL( ETrue,newinfMsgWin ); infMsgWin->Release(); LafEnv::DefaultLineSpacingInTwips(); _LIT( defLnSpaTwip," Test DefaultLineSpaceingInTwinps() " ); AssertTrueL( ETrue,defLnSpaTwip ); TCharFormat charFormat; TCharFormatMask charFormatMask; LafEnv::PrepareCharFormatAndMask( charFormat,charFormatMask ); _LIT( preCharFormat," Test PrepareCharFormatAndMask() " ); AssertTrueL( ETrue,preCharFormat ); TGulBorder tBorder; TRect tRect; TGulBorder::TColors bColors; LafEnv::DrawLogicalBorder( tBorder,CCoeEnv::Static()->SystemGc(),tRect,bColors); _LIT( drawLogBoder," Test DrawLogicalBorder()" ); AssertTrueL( ETrue,drawLogBoder ); TBuf<32> fPath; TUid apUid = { 0x101F84F3 }; RApaLsSession *rLsSession = new ( ELeave ) RApaLsSession(); LafEnv::GetDefaultPath( fPath,apUid,*rLsSession,*CCoeEnv::Static() ); delete rLsSession; _LIT(msg1," Alert 1 " ); _LIT(msg2," Alert 2 " ); _LIT(disAlert, " Test DisplayAlertAsNotifier() " ); LafEnv::DisplayAlertAsNotifier( msg1,msg2 ); AssertTrueL( ETrue,disAlert ); CFbsBitmap* bmp1 = new( ELeave ) CFbsBitmap(); CleanupStack::PushL( bmp1 ); CFbsBitmap* bmp2 = new( ELeave ) CFbsBitmap(); CleanupStack::PushL( bmp2 ); const TDesC& fileName = AknIconUtils::AvkonIconFileName(); bmp1->Load( fileName, EMbmAvkonQgn_indi_battery_strength ); bmp2->Load( fileName, EMbmAvkonQgn_prop_battery_icon ); CArrayPtrFlat<CFbsBitmap>* bmpArray = new( ELeave ) CArrayPtrFlat<CFbsBitmap>( 2 ); CleanupStack::PushL( bmpArray ); bmpArray->AppendL( bmp1 ); bmpArray->AppendL( bmp2 ); TUid matchUid = TUid::Uid( KLafUidEikonGrayVal ); CFbsBitmap* bmp = LafEnv::MatchBitmap( *bmpArray, matchUid ); _LIT( KMatchBitmap, "LafEnv::MatchBitmap" ); AssertNotNullL( bmp, KMatchBitmap ); CleanupStack::PopAndDestroy( 3 ); // are bmp1, bmp2 and bmpArray }
LOCAL_C TInt testAsyncAccess(TAny* aData) // /// Test read file handling. /// /// @param aData pointer to the thread data area { TThreadData& data = *(TThreadData*)aData; TFileName fileName = data.iFile; TBool dowrite = (data.iData != NULL); TBuf8<KBufLen>* buffer = gBufferArr[data.iNum]; TRequestStatus* status = gStatusArr[data.iNum]; RFs myFs; TInt r = myFs.Connect(); TEST(r==KErrNone); r = myFs.SetSessionPath(gSessionPath); if (r != KErrNone) TTest::Fail(HERE, _L("SetSessionPath returned %d"), r); TVolumeInfo vol; TInt drv; r = myFs.CharToDrive(fileName[0], drv); if (r != KErrNone) TTest::Fail(HERE, _L("CharToDrive(%c) returned %d"), fileName[0], r); r = myFs.Volume(vol, drv); if (r != KErrNone) TTest::Fail(HERE, _L("Volume() returned %d"), r); TInt64 maxwrite = vol.iFree / 2 - KBufLen; if (maxwrite < KBufLen*2) TTest::Fail(HERE, _L("Not enough space to do test, only %d KB available"), TInt(vol.iFree/1024)); RFile f; RTimer timer; TRequestStatus tstat; TTime startTime; TTime endTime; TTimeIntervalMicroSeconds timeTaken; TInt wrnum = 0; TInt rdnum = 0; TInt opnum = 0; TInt opfin = 0; TInt i; timer.CreateLocal(); if (dowrite) { r = f.Replace(myFs, fileName, EFileStreamText | EFileWrite); TEST(r==KErrNone); // wait for both tasks to have a chance to complete opening the files User::After(1000); for (i = 0; i < KNumBuf; i++) buffer[i].Fill('_', KBufLen); timer.After(tstat, KTimeBM * KSecond); startTime.HomeTime(); while (tstat == KRequestPending) { TInt pos = TInt((wrnum * KBufLen) % maxwrite); TInt bnum = opnum++ % KNumBuf; f.Write(pos, buffer[bnum], status[bnum]); if (opnum - opfin > KMaxLag) { while (status[opfin % KNumBuf] == KRequestPending) User::WaitForRequest(status[opfin % KNumBuf]); opfin++; } ++wrnum; } while (opfin < opnum) { while (status[opfin % KNumBuf] == KRequestPending) User::WaitForRequest(status[opfin % KNumBuf]); opfin++; } endTime.HomeTime(); TTimeIntervalMicroSeconds timeTaken=endTime.MicroSecondsFrom(startTime); TInt64 dtime = timeTaken.Int64(); TInt64 dsize = wrnum * KBufLen * TInt64(KSecond); TInt32 speed = TInt32((dsize + dtime/2) / dtime); AddStats(gWrStats, dsize, dtime); TTest::Printf(_L("%8d writes in %6d mS = %8d bytes per second\n"), wrnum, TInt32(dtime)/1000, speed); } else { r = f.Open(myFs, fileName, EFileStreamText); TEST(r==KErrNone); timer.After(tstat, KTimeBM * KSecond); startTime.HomeTime(); while (tstat == KRequestPending) { TInt pos = TInt((rdnum * KBufLen) % maxwrite); TInt bnum = opnum++ % KNumBuf; f.Read(pos, buffer[bnum], status[bnum]); if (opnum - opfin > KMaxLag) { User::WaitForRequest(status[opfin++ % KNumBuf]); } ++rdnum; } while (opfin < opnum) { if (status[opfin % KNumBuf] == KRequestPending) User::WaitForRequest(status[opfin % KNumBuf]); opfin++; } endTime.HomeTime(); timeTaken=endTime.MicroSecondsFrom(startTime); TInt64 dtime = timeTaken.Int64(); TInt64 dsize = rdnum * KBufLen * TInt64(KSecond); TInt32 speed = TInt32((dsize + dtime/2) / dtime); AddStats(gRdStats, dsize, dtime); // wait to allow the dust to settle User::After(KSecond); TTest::Printf(_L("%8d reads in %6d mS = %8d bytes per second\n"), rdnum, TInt32(dtime)/1000, speed); myFs.Delete(fileName); } timer.Cancel(); timer.Close(); f.Close(); myFs.Close(); return r; }
void CTcpSymbianEngine::RunL() { DBG("RunL, EngineState: %d, iStatus: %d", EngineState(), iStatus.Int()); iTimer->Cancel(); // Cancel TimeOut timer before handling completion switch(EngineState()){ case EConnecting: // IP connection request if (iStatus == KErrNone){ DBG("Connection completed Ok"); // Connection completed sucessfully iConsole.ConnectionNotify(isab::Module::CONNECTED, isab::Module::REQUESTED); SetEngineState(EConnected); Read(); //Start CTcpSymbianRead Active object } else { WARN("Unable to connect, removing host from cache."); iDNSCache.Remove(*iHostName); if (iStatus == KErrCouldNotConnect){ ResetL(EConnectFailed, isab::Module::NO_RESPONSE); } else if (iStatus == KErrTimedOut) { ResetL(ETimedOut, isab::Module::NO_RESPONSE); } else{ WARN("EConnectFailed, INTERNAL_ERROR"); ResetL(EConnectFailed, isab::Module::INTERNAL_ERROR); //XXX handle the different cases } } break; case ELookingUp: iResolver.Close(); if (iStatus == KErrNone) { DBG("Name lookup ok"); // DNS look up successful // Extract domain name and IP address from name record class TInetAddr addr = TInetAddr::Cast(iNameEntry().iAddr); //cache the ip for later. TInt cacheStat = iDNSCache.CacheHost(*iHostName, addr.Address()); DBG("Host cached with result %d", cacheStat); cacheStat = cacheStat; // And connect to the IP address Connect(addr.Address(), iPort); //setactive here } else { //includes KErrTimedOut WARN("Lookup failed"); ResetL(ELookUpFailed, isab::Module::LOOKUP_FAILED); } break; case ELinking: if(iStatus == KErrNone){ DBG("Link layer setup ok"); OpenSocketL(); //cannot open socket until here. We need RConnection. StartLookupL(); //setactive here } else { //includes KErrCanceled and KErrTimedOut WARN("Link layer setup failed"); ResetL(ELinkFailed, isab::Module::TRANSPORT_FAILED); } break; case EBroken: DBG("Broken"); ResetL( EngineState(), isab::Module::CHANNEL_FAILED ); break; case EClosing: if(iStatus == KErrNone){ DBG("Closing ok"); ResetL(EComplete, isab::Module::REQUESTED); } else if(iStatus == KErrTimedOut){ ResetL(ETimedOut); } else { ResetL(EngineState()); //XXX ??? } break; case ESwitching: if(iStatus == KErrNone){ //the connection has been closed, start a new connection //using the values in iHostName, iPort, and iIAP. SetEngineState(EComplete); ConnectL(); } else if(iStatus == KErrTimedOut){ ResetL(ETimedOut); } else { ResetL(EngineState()); } break; case EClosed: DBG("Closed"); ResetL( EngineState(), isab::Module::BY_PEER ); break; default: ERR("PANIC KEchoEngine EBadEngineState (%d)", TInt(EBadEngineState)); User::Panic(KEchoEngine, EBadEngineState); break; }; if(!IsActive()){ DBG("Signal OperationComplete"); iConsole.OperationComplete(); DBG("Signaled OperationComplete"); } }
TInt TUptTraceCalls::DoSendTraceL(const TApiRunConfig& aApiRunConfig, TApiRunResults& aApiRunResults) { TInt error = KErrGeneral; TBool logged = EFalse; TUint32 stackbase=0; TUint32 before=0; aApiRunResults.iApiStackUsage = 0; switch(aApiRunConfig.iApiId) { case EUptPrintTDesC8_big: case EUptKernelPrintfDesc8_big: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrint(attributes, KStringDesc8 );//TPtrC8((const TUint8*)KBigData8, KBigSize8) __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptPrintTDesC8_huge: case EUptKernelPrintfDesc8_huge: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrint(attributes, KStringDescHuge8);//TPtrC8((const TUint8*)KHugeData8, KHugeSize8) __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptPrintTDesC16_big: #ifndef __KERNEL_MODE__ { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrint(attributes, KStringDesc16);//TPtrC16((const TUint16*)KBigData16, KBigSize16) __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } #endif break; case EUptPrintTDesC16_huge: #ifndef __KERNEL_MODE__ { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrint(attributes, KStringDescHuge16);//TPtrC16((const TUint16*)KHugeData16, KHugeSize16) __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } #endif break; case EUptTraceTDesC8_big: case EUptKernelTraceDesc8_big: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KStringDesc8);//TPtrC8((const TUint8*)KBigData8, KBigSize8)); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTDesC8_huge: case EUptKernelTraceDesc8_huge: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KStringDescHuge8);//TPtrC8((const TUint8*)KHugeData8, KHugeSize8)); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTDesC16_big: #ifndef __KERNEL_MODE__ { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KStringDesc16);//TPtrC16((const TUint16*)KBigData16, KBigSize16)); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } #endif break; case EUptTraceTDesC16_huge: #ifndef __KERNEL_MODE__ { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KStringDescHuge16);//TPtrC16((const TUint16*)KHugeData16, KHugeSize16)); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } #endif break; case EUptPrintfchar: case EUptKernelPrintfchar: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrintf(attributes, KPrintfCStyleString); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptPrintfTRefByValueTDesC8: case EUptKernelPrintfTRefByValueTDesC8: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrintf(attributes, KDesC8Formatted,2); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptPrintfTRefByValueTDesC16: #ifndef __KERNEL_MODE__ { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstPrintf(attributes, KDesCFormatted16,2); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } #endif break; case EUptTrace: case EUptKernelTrace: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTUint32: case EUptKernelTraceTUint32: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KData1); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTUint32TUint32: case EUptKernelTraceTUint32TUint32: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KData1, KData2); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTAnySmallStruct: case EUptKernelTraceTAnySmallStruct: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KSmallData, KSmallSize); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTAnyBigStruct: case EUptKernelTraceTAnyBigStruct: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KBigData8, KBigSize8); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTAnyHugeStruct: case EUptKernelTraceTAnyHugeStruct: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KHugeData8, KHugeSize8); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTemplatedSmallStruct: case EUptKernelTraceTemplatedSmallStruct: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KStructForTemplated); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTemplatedBigStruct: case EUptKernelTraceTemplatedBigStruct: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KBigData8); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptTraceTemplatedHugeStruct: case EUptKernelTraceTemplatedHugeStruct: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = OstTrace(attributes, KTraceId, KHugeData8); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EUptIsTraceActive: case EUptKernelIsTraceActive: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTraceContext attributes(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter); logged = IsTraceActive(attributes); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case UPTTraceTest: case UPTKernelTraceTest: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); SanityFoo(); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case UPTKernelNegativeFunctionalityTest: { logged = OstTrace(TTraceContext(KComponentId+1, KGroupId+1, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId+2, KGroupId+2, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); } break; case UPTKernelMultipleFunctionalityTest: { logged = OstTrace(TTraceContext(KComponentId, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId + 1, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId + 2, KGroupId, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId, KGroupId + 2, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId + 2, KGroupId + 2, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId + 1, KGroupId + 2, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); logged = OstTrace(TTraceContext(KComponentId, KGroupId + 1, aApiRunConfig.iHasContext, aApiRunConfig.iHasProgramCounter), KTraceId); } break; case BTraceFiltered4: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTraceFiltered4(KGroupId,0 ,KComponentId); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTraceFiltered8: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTraceFiltered8(KGroupId,0 ,KComponentId,KData1); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTraceFiltered12: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTraceFiltered12(KGroupId,0 ,KComponentId,KData1,KData2); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTraceFilteredBig: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTraceFilteredBig(KGroupId,0 ,KComponentId,KHugeData8,sizeof(KHugeData8)); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTrace0: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTrace0(KGroupId,0 ); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTrace4: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTrace4(KGroupId,0 ,KData1); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTrace8: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTrace8(KGroupId,0 ,KData1, KData2); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case BTrace12: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); logged = BTrace12(KGroupId,0 ,KData1, KData2, KData3); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case UPTKernelBaseline: case UPTBaseline: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDef0: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDef0( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDef0, "EOstTraceDef0" ) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDef1: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDef1( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDef1, "EOstTraceDef1 - %u" , KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDefData: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF //const TAny* y = &KData1; __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDefData( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDefData, "EOstTraceDefData", &KData1, sizeof(KData1) ) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDefExt1: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDefExt1( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDefExt1, "OstTraceDefExt1 - %s", KDefault8 ) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDefExt2: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDefExt2( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDefExt2, "OstTraceDefExt2 - %u - %u", KData1 , KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDefExt3: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDefExt3( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDefExt3, "OstTraceDefExt3 - %u - %u - %u", KData1 , KData1, KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDefExt4: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDefExt4( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDefExt4, "OstTraceDefExt4 - %u - %u - %u - %u", KData1 , KData1, KData1, KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceDefExt5: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceDefExt5( OST_TRACE_CATEGORY_ALL, TRACE_FATAL, TEST_OstTraceDefExt5, "OstTraceDefExt5 - %u - %u - %u - %u - %u", KData1, KData1, KData1, KData1, KData1 ) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTrace0: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTrace0( TRACE_FATAL, TEST_OSTTRACE0, "EOstTrace0" ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTrace1: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTrace1( TRACE_FATAL, TEST_OSTTRACE1, "EOstTrace1 - %u" , KData1); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceData: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF //const TAny* y = &KData1; __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceData( TRACE_FATAL, TEST_OSTTRACEDATA, "EOSTTraceData", &KData1, sizeof(KData1) ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceExt1: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceExt1( TRACE_FATAL, TEST_OSTTRACEEXT1, "OSTTraceExt1 - %hhd", KData8 ) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceExt2: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceExt2( TRACE_FATAL, TEST_OSTTRACEEXT2, "OSTTraceExt2 - %u - %u", KData1 ,KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceExt3: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceExt3( TRACE_FATAL, TEST_OSTTRACEEXT3, "OSTTraceExt3 - %u - %u - %u", KData1 ,KData1, KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceExt4: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceExt4( TRACE_FATAL, TEST_OSTTRACEEXT4, "OSTTraceExt4 - %u - %u - %u - %u", KData1 ,KData1, KData1, KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceExt5: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceExt5( TRACE_FATAL, TEST_OSTTRACEEXT5, "OSTTraceExt5 - %u - %u - %u - %u - %u", KData1 ,KData1, KData1, KData1, KData1) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionEntry0: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceFunctionEntry0( TEST_OSTTraceFunctionalityEntry0 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionEntry1: { //const TAny* y = &KData1; __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceFunctionEntry1( TEST_OSTTraceFunctionalityEntry1, KData1 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionEntryExt: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceFunctionEntryExt( TEST_OSTTraceFunctionalityExt, (const TAny*)&KData1 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionEntryExtCtorInitList: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTestCtor testCtorA( 1, 2 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionEntryExtCtorNoInitList: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); TTestCtor testCtorB( 3 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionExit0: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceFunctionExit0( TEST_OstTraceFunctionExit0 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionExit1: { //const TAny* y = &KData1; __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceFunctionExit1( TEST_OSTTRACEFUNCTIONEXIT1, KData1 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceFunctionExitExt: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceFunctionExitExt( TEST_OSTTRACEFUNCTIONEXITEXT, (const TAny*)&KData1, TInt(0) ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceEventStart0: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceEventStart0( TEST_OSTTRACEEVENTSTART0, "EOstTraceEventStart0" ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceEventStart1: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceEventStart1( TEST_OSTTRACEEVENTSTART1, "EOstTraceEventStart1 - %u", KData1 ) ; logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceEventStop: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceEventStop( TEST_OSTTRACEEVENTSTOP, "EOstTraceEventStop", TEST_OSTTRACEEVENTSTART0 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceState0: { __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceState0( TEST_OSTTRACESTATE0, "Test State Name", "Test State Value" ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceState1: { //const TAny* y = &KData1; __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceState1( TEST_OSTTRACESTATE1, "Test State Name", "Test State Value", KData1 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceData96: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceData( TRACE_FATAL, TEST_OSTTRACEDATA96, "EOSTTraceData96", KBigData8, KBigSize8 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; case EOstTraceData1000: { /** Preprocessor level for all traces on. This should not be used from traces */ #define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF __MARK_INITIAL_STACK(aApiRunConfig.iDoStack, stackbase, before); OstTraceData( TRACE_FATAL, TEST_OSTTRACEDATA1000, "EOSTTraceData1000", KHugeData8, KHugeSize8 ); logged = EFalse; __RETURN_STACK_SIZE(aApiRunConfig.iDoStack, stackbase, before, aApiRunResults.iApiStackUsage); } break; default: error = KErrNotSupported; break; } //if the "trace" is in fact not an actual trace and trace not sent - this is a true result TBool realTrace = ETrue; switch(aApiRunConfig.iApiId) { case UPTTraceTest: case UPTKernelTraceTest: case UPTKernelNegativeFunctionalityTest: case UPTKernelMultipleFunctionalityTest: case UPTBaseline: case UPTKernelBaseline: case UPTFooUserTime: case UPTFooKernelTime: realTrace = EFalse; break; default: break; } //ensure correct error values for the current test configurations are returned to the test framework if(!logged) { if(error!=KErrNotSupported) error = KErrGeneral; } else error = KErrNone; //if trace has been disabled and trace not sent - this is a true result #ifdef TE_UPT_TRACE_DISABLED if(error == KErrGeneral) error = KErrNone; #endif if(error == KErrGeneral && realTrace == EFalse) error = KErrNone; //returns KErrNone if logged, KErrNotLogged if not logged, KErrGeneral if any other problem... return error; }
// ----------------------------------------------------------------------------- // CExprUDPMsg::TryParsingL // ----------------------------------------------------------------------------- // TInt CExprUDPMsg::TryParsingL( TDes8& aData, TInt& aLength ) { __ASSERT_ALWAYS( aData.Left( KUDPPrefix().Length() ) == KUDPPrefix, User::Panic( _L("Protocol"), 1 ) ); // UDP:0123,000e,[Some test data] TInt frameOverhead = KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length() + KHexDecimalLength + KLengthSuffix().Length() + KDataSuffix().Length() + KMessageSuffix().Length(); if ( aData.Length() >= frameOverhead ) { TPtrC8 portPtr( aData.Mid( KUDPPrefix().Length(), KHexDecimalLength ) ); TLex8 portLexer( portPtr ); TUint port; if ( portLexer.Val( port, EHex ) != KErrNone ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, port = %d" ), port ); //Check port suffix if ( aData.Mid( KUDPPrefix().Length() + KHexDecimalLength, KPortSuffix().Length() ) != KPortSuffix ) { return KErrCorrupt; } TPtrC8 lengthPtr( aData.Mid( KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length(), KHexDecimalLength ) ); TLex8 lengthLexer( lengthPtr ); TUint length; if ( lengthLexer.Val( length, EHex ) != KErrNone ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, length = %d" ), length ); //Check length suffix if ( aData.Mid( KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length() + KHexDecimalLength, KLengthSuffix().Length() ) != KLengthSuffix ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, parsing data" ), length ); if ( aData.Length() >= TInt( frameOverhead + length ) ) { TInt messagePos = KUDPPrefix().Length() + KHexDecimalLength + KPortSuffix().Length() + KHexDecimalLength + KLengthSuffix().Length(); TPtrC8 message( aData.Mid( messagePos, length ) ); if ( aData.Mid( messagePos + length, KDataSuffix().Length() ) != KDataSuffix ) { return KErrCorrupt; } DEBUG_PRINT( DEBUG_STRING( "CExprUDPMsg::TryParsingL, message OK" ) ); if ( aData.Mid( messagePos + length + KDataSuffix().Length(), KMessageSuffix().Length() ) != KMessageSuffix ) { return KErrCorrupt; } // send parsed results iObserver->FrameParsedL( port, message ); // set the length of the handled message aLength = frameOverhead + length; return KErrNone; } } return KErrNone; }
virtual void SetItemDataL(TInt aIndex ) { TInt i = aIndex; if ( ! iItems[i] ) return; TSettingItem s=TClSettings::GetKClSettings(i); switch(s.iDatatype) { case EEnum: if ( iOnlyContextLogPublishing && s.iSettingNo == SETTING_MEDIA_UPLOAD_ENABLE ) { CAknEnumeratedTextPopupSettingItem *list= (CAknEnumeratedTextPopupSettingItem *)iItems[i]; auto_ptr<CArrayPtr< CAknEnumeratedText > > enumarr( new (ELeave) CArrayPtrFlat< CAknEnumeratedText >(2)); auto_ptr<CArrayPtr< HBufC > > popuparr( new (ELeave) CArrayPtrFlat< HBufC >(2)); TInt resource=R_NO; for (int j=0; j<2; j++) { auto_ptr<HBufC> text(iEikEnv->AllocReadResourceL(resource)); auto_ptr<HBufC> popup(text->AllocL()); auto_ptr<CAknEnumeratedText> item( new (ELeave) CAknEnumeratedText(TInt(j), text.get())); text.release(); enumarr->AppendL(item.get()); item.release(); popuparr->AppendL(popup.get()); popup.release(); resource=R_YES; } list->SetEnumeratedTextArrays(enumarr.release(), popuparr.release()); list->HandleTextArrayUpdateL(); list->UpdateListBoxTextL (); } break; case EAP: { CAknEnumeratedTextPopupSettingItem *list=(CAknEnumeratedTextPopupSettingItem *)iItems[i]; TInt *list_id=(TInt*)iData[i]; auto_ptr<CCommsDatabase> db(CCommsDatabase::NewL(EDatabaseTypeIAP)); #if defined(__S60V3__) && defined(__WINS__) db->ShowHiddenRecords(); #endif CCommsDbTableView* iViewP=db->OpenTableLC(TPtrC(IAP)); CleanupStack::Pop(); auto_ptr<CCommsDbTableView> iView(iViewP); auto_ptr<CArrayPtr< CAknEnumeratedText > > enumarr( new (ELeave) CArrayPtrFlat< CAknEnumeratedText >(4)); auto_ptr<CArrayPtr< HBufC > > popuparr( new (ELeave) CArrayPtrFlat< HBufC >(4)); TInt err; TUint32 id=-1; #ifndef __JAIKU__ { TBuf<30> KNoAp=_L("No connection selected"); auto_ptr<HBufC> text(KNoAp.AllocL()); auto_ptr<HBufC> popup(KNoAp.AllocL()); auto_ptr<CAknEnumeratedText> item(new (ELeave) CAknEnumeratedText(-1, text.get())); text.release(); enumarr->AppendL(item.get()); item.release(); popuparr->AppendL(popup.get()); popup.release(); } #endif bool seen=false; TUint first_id=-1; err=iView->GotoFirstRecord(); while( err == KErrNone ) { auto_ptr<HBufC> text(HBufC::NewL(KCommsDbSvrMaxColumnNameLength)); TPtr ptr(text->Des()); #if defined(__S60V3__) && !defined(__WINS__) iView->ReadTextL(TPtrC(IAP_BEARER_TYPE), ptr); // if (ptr.FindF(_L("LAN")) != KErrNotFound) goto skip; #endif { if (first_id==-1) first_id=id; iView->ReadUintL(TPtrC(COMMDB_ID), id); if ( (TInt)id==*list_id) { seen=true; } ptr.Set(text->Des()); iView->ReadTextL(TPtrC(COMMDB_NAME), ptr); auto_ptr<HBufC> popup(text->AllocL()); auto_ptr<CAknEnumeratedText> item(new (ELeave) CAknEnumeratedText(TInt(id), text.get())); text.release(); enumarr->AppendL(item.get()); item.release(); popuparr->AppendL(popup.get()); popup.release(); } skip: err=iView->GotoNextRecord(); } if (!seen) *list_id=first_id; #ifdef __JAIKU__ if (first_id==-1) { TBuf<30> KNoAp=_L("No connection selected"); auto_ptr<HBufC> text(KNoAp.AllocL()); auto_ptr<HBufC> popup(KNoAp.AllocL()); auto_ptr<CAknEnumeratedText> item(new (ELeave) CAknEnumeratedText(-1, text.get())); text.release(); enumarr->AppendL(item.get()); item.release(); popuparr->AppendL(popup.get()); popup.release(); } #endif list->SetEnumeratedTextArrays(enumarr.release(), popuparr.release()); list->HandleTextArrayUpdateL(); list->UpdateListBoxTextL (); } break; default: break; } }
TBool DoTestThreadCpuTime2() // Returns ETrue if test passed { test.Start(_L("Testing time shared between threads")); if (numCpus > 1) { test.Printf(_L("** SMP system detected - not testing time shared between threads until load balancing optimized **\n")); return ETrue; } const TInt KMaxThreads = 4; TThreadParam threadParam; RThread* threads = NULL; threads = new(ELeave) RThread[numCpus*KMaxThreads]; FailIfError((threadParam.iSem).CreateLocal(0)); TBool pass = ETrue; for (TInt numThreads = 1 ; pass && numThreads <= KMaxThreads ; ++numThreads) { test.Printf(_L(" testing with %d threads on each of %d CPUs:\n"), numThreads, numCpus); TInt i, j, k; for (i = 0 ; i < numThreads ; ++i) { for (j = 0 ; j < numCpus ; ++j) { TBuf<16> name; name.AppendFormat(_L("Thread%d%d"), i, j); threadParam.iCpu = j; k = i+j*KMaxThreads; FailIfError(threads[k].Create(name, ThreadFunction, 1024, NULL, &threadParam)); threads[k].SetPriority(EPriorityLess); threads[k].Resume(); } } User::After(KShortWait); // Pause to allow thread setup (threadParam.iSem).Signal(numThreads*numCpus); User::After(KLongWait); for (i = 0 ; i < numThreads ; ++i) for (j = 0 ; j < numCpus ; ++j) threads[i+j*KMaxThreads].Suspend(); TInt expected = KLongWait / numThreads; for (i = 0 ; i < numThreads ; ++i) { for (j = 0 ; j < numCpus ; ++j) { k = i+j*KMaxThreads; TTimeIntervalMicroSeconds time; FailIfError(threads[k].GetCpuTime(time)); TReal error = (100.0 * Abs(time.Int64() - expected)) / expected; test.Printf(_L(" %d%d: time == %ld, error == %d%%\n"), i, j, time.Int64(), TInt(error)); if (error >= 5.0) pass = EFalse; threads[k].Kill(KErrNone); TRequestStatus status; threads[k].Logon(status); User::WaitForRequest(status); test(status == KErrNone); CLOSE_AND_WAIT(threads[k]); } } } (threadParam.iSem).Close(); test.End(); return pass; }
/** @SYMTestCaseID SYSLIB-DBMS-CT-0639 @SYMTestCaseDesc Tests for navigation @SYMTestPriority Medium @SYMTestActions Tests for the unlimited (dynaset) window @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestUnlimitedL() { test.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0639 EvaluateAll ")); test(TheView.Prepare(TheDatabase,KOrderQuery,TDbWindow::EUnlimited)==KErrNone); test(TheView.EvaluateAll()==KErrNone); test(!TheView.Unevaluated()); test(TheView.CountL()==KRecords); TInt cc=0; for (TheView.BeginningL();TheView.NextL();) ++cc; test(cc==KRecords); for (TheView.EndL();TheView.PreviousL();) --cc; test(cc==0); test(!TheView.Unevaluated()); test.Next(_L("Incremental evaluate")); TheView.Reset(); cc=TheView.CountL(TheView.EQuick); test(cc==0); test(!TheView.FirstL()); while (TheView.Unevaluated()) { test(TheView.Evaluate()>=KErrNone); TInt ii=TheView.CountL()-cc; test(ii>=0); cc+=ii; while (--ii>=0) { test(TheView.AtRow()); TheView.NextL(); } test(!TheView.AtRow()); } test(cc==KRecords); test.Next(_L("Insert")); // The new records should go on the end of the set TheView.InsertL(); TheView.SetColL(1,TInt(-1)); TheView.PutL(); test(TheView.CountL()==KRecords+1); test(TheView.LastL()); TheView.GetL(); test(TheView.ColInt(1)==-1); // because of order, it should appear at beginning on re-evaluation TheView.Reset(); test(TheView.EvaluateAll()==KErrNone); test(TheView.CountL()==KRecords+1); test(TheView.FirstL()); TheView.GetL(); test(TheView.ColInt(1)==-1); test.Next(_L("Update")); // updated records should not move (or disappear) in the set TheView.UpdateL(); TheView.SetColL(1,KRecords); TheView.PutL(); test(TheView.CountL()==KRecords+1); test(TheView.FirstL()); TheView.GetL(); test(TheView.ColInt(1)==KRecords); // because of order, it should appear at end on re-evaluation TheView.Reset(); test(TheView.EvaluateAll()==KErrNone); test(TheView.CountL()==KRecords+1); test(TheView.LastL()); TheView.GetL(); test(TheView.ColInt(1)==KRecords); test.Next(_L("Bookmarks")); TDbBookmark mark=TheView.Bookmark(); TheView.BeginningL(); TRAPD(r,TheView.GotoL(mark)); test(r==KErrNone); TheView.GetL(); test(TheView.ColInt(1)==KRecords); test(!TheView.NextL()); test(TheView.PreviousL()); test.Next(_L("Delete")); // should disappear from the set TheView.DeleteL(); test(TheView.CountL()==KRecords); for (TheView.BeginningL();TheView.NextL();) { TheView.GetL(); test(TheView.ColInt(1)!=KRecords); } TRAP(r,TheView.GotoL(mark)); test(r!=KErrNone); TheView.Reset(); test(TheView.EvaluateAll()==KErrNone); test(TheView.CountL()==KRecords); for (TheView.BeginningL();TheView.NextL();) { TheView.GetL(); test(TheView.ColInt(1)!=KRecords); } TRAP(r,TheView.GotoL(mark)); test(r!=KErrNone); test.End(); TheView.Close(); }
TInt CMP4Demux::ReadAndSendFrames() { DASSERT( iGotFrame ); // Find the correct channel. If there is no channel open for this // type of frames, we'll simply ignore it TOutputChannel *chan = 0; TUint i; for ( i = 0; i < iNumOutputChannels; i++ ) { if ( iOutputChannels[i].iDataType == iFrameType ) chan = &iOutputChannels[i]; } if ( chan ) { // OK, we have a target channel. Get a block from its queue TPtr8 *block = 0; // NOTE: if output block does not need to be saved in any case, make it a local variable //PRINT((_L("framelen = %d, bytesdemuxed = %d\n"), iFrameLen, iBytesDemuxed)); TUint blockLen = iFrameLen; TPtr8 readDes(0,0); TInt error; if ( iFrameType == EDataVideo ) { // make room for timestamp blockLen += 4; } TRAP( error, (block = chan->iTargetQueue->GetFreeBlockL(blockLen)) ); if ( error != KErrNone ) return error; if ( iFrameType == EDataVideo ) { TUint8 *p = (TUint8 *)(block->Ptr()) + 4; readDes.Set( p, 0, TInt(iFrameLen) ); } else { readDes.Set( *block ); } TUint32 numReadFrames = 0; TUint32 timeStamp; // read frame(s) from parser error = iParser->ReadFrames(readDes, CMP4Parser::TFrameType(iFrameType), numReadFrames, timeStamp); if ( error != KErrNone ) return error; DASSERT( numReadFrames > 0 ); if ( iFrameType == EDataAudio ) { block->SetLength(readDes.Length()); } else { block->SetLength(readDes.Length() + 4); // put timestamp in the output block before the actual frame data TUint* d = (TUint *)(block->Ptr()); Mem::Copy(d, &timeStamp, 4); } iBytesDemuxed += TUint( readDes.Length() ); // Send the block chan->iTargetQueue->WriteBlock(block); iFrameLen = 0; iFrameType = EDataNone; iGotFrame = EFalse; } else { PRINT((_L("Unknown channel\n"))); } return KErrNone; }
void CBasicMathsFB::MiscDivL() { __UHEAP_MARK; TUint seed = 10; TUint diviser = 2; TInt dividendInt = 10; RInteger dividend = RInteger::NewL(seed); CleanupStack::PushL(dividend); TInt longInt = dividend.ConvertToLongL(); // Test for inequality FALSE TBool res0 = dividend != dividendInt; if (res0) { iResult = EFalse; } // Test for inequality TRUE res0 = dividend != TInt(diviser); if (!res0) { iResult = EFalse; } // Test for equality TRUE res0 = dividend >= dividend; if (!res0) { iResult = EFalse; } RInteger quotient; CleanupStack::PushL(quotient); // 10 / 2 = 5 TRAPD(res, quotient = dividend.DividedByL(diviser)); if (res != KErrNone) { User::Leave(res); } else if (quotient != (dividendInt/diviser)) { iResult = EFalse; } // Test for greater value TRUE and equality FALSE res0 = dividend >= quotient; if (!res0) { iResult = EFalse; } // Test for greater value FALSE and equality FALSE res0 = quotient >= dividend; if (res0) { iResult = EFalse; } // 10 / 10 = 1 TRAPD(res1, dividend /= dividendInt); if (res1 != KErrNone) { User::Leave(res); } else if (dividend != (dividendInt/seed)) { iResult = EFalse; } // 1 % 10 = 1 (dividend = 1, due to last step) TRAPD(res2, dividend %= dividendInt); if (res2 != KErrNone) { User::Leave(res); } else if (dividend != (dividendInt/seed)) { iResult = EFalse; } // 1 x 1 = 1 (dividend = 1, due to last step) RInteger squaredInt = dividend.SquaredL(); CleanupStack::PushL(squaredInt); if ( squaredInt != (dividendInt/seed)) { iResult = EFalse; } RInteger expSeed = RInteger::NewL(10); CleanupStack::PushL(expSeed); RInteger exponent = RInteger::NewL(3); CleanupStack::PushL(exponent); RInteger expResult; CleanupStack::PushL(expResult); TRAPD(res3, expResult = expSeed.ExponentiateL(exponent)); if (res3 != KErrNone) { User::Leave(res); } else if (expResult != (10*10*10)) { iResult = EFalse; } CleanupStack::PopAndDestroy(6, ÷nd); // dividend, quotient, squardInt, expSeed, exponent, expResult __UHEAP_MARKEND; }
// // The benchmark-suite entry point. // GLDEF_C TInt E32Main() { RTest test(_L("Benchmark Suite")); test.Title(); AddProperty(); AddThread(); AddIpc(); AddSync(); AddOverhead(); AddrtLatency(); TInt r = User::LoadPhysicalDevice(KBMPddFileName); BM_ERROR(r, (r == KErrNone) || (r == KErrAlreadyExists)); r = User::LoadLogicalDevice(KBMLddFileName); BM_ERROR(r, (r == KErrNone) || (r == KErrAlreadyExists)); r = ::bmTimer.Open(); BM_ERROR(r, (r == KErrNone)); r = ::bmDriver.Open(); BM_ERROR(r, (r == KErrNone)); TBMTimeInterval::Init(); TInt seconds = KBMSecondsPerProgram; TInt len = User::CommandLineLength(); if (len) { // // Copy the command line in a buffer // TInt size = len * sizeof(TUint16); HBufC8* hb = HBufC8::NewMax(size); BM_ERROR(KErrNoMemory, hb); TPtr cmd((TUint16*) hb->Ptr(), len); User::CommandLine(cmd); // // Check for the TBMSpawnArgs magic number. // TBMSpawnArgs* args = (TBMSpawnArgs*) hb->Ptr(); if (args->iMagic == TBMSpawnArgs::KMagic) { // // This is a child process - call it's entry point // return ::ChildMain(args); } else { // // A real command line - the time (in seconds) for each benchmark program. // TLex l(cmd); r = l.Val(seconds); if (r != KErrNone) { test.Printf(_L("Usage: bm_suite <seconds>\n")); BM_ERROR(r, 0); } } delete hb; } { TBMTicks ticks = 1; TBMNs ns; ::bmTimer.TicksToNs(&ticks, &ns); test.Printf(_L("High resolution timer tick %dns\n"), TInt(ns)); test.Printf(_L("High resolution timer period %dms\n"), BMNsToMs(TBMTimeInterval::iStampPeriodNs)); } test.Start(_L("Performance Benchmark Suite")); BMProgram* prog = ::bmSuite; while (prog) { // // For each program from the benchmark-suite's list // // // Remember the number of open handles. Just for a sanity check .... // TInt start_thc, start_phc; RThread().HandleCount(start_phc, start_thc); test.Printf(_L("%S\n"), &prog->Name()); // // A benchmark-suite's thread can run at any of three possible absolute priorities: // KBMPriorityLow, KBMPriorityMid and KBMPriorityHigh. // The main thread starts individual benchmark programs at KBMPriorityMid // prog->iOrigAbsPriority = BMProgram::SetAbsPriority(RThread(), KBMPriorityMid); // // First of all figure out how many iteration would be required to run this program // for the given number of seconds. // TInt count; TBMNs ns = 0; TBMUInt64 iter = KBMCalibrationIter; for (;;) { TBMTimeInterval ti; ti.Begin(); prog->Run(iter, &count); ns = ti.EndNs(); // run at least 100ms (otherwise, could be too much impricise ...) if (ns > BMMsToNs(100)) break; iter *= 2; } test.Printf(_L("%d iterations in %dms\n"), TInt(iter), BMNsToMs(ns)); iter = (BMSecondsToNs(seconds) * iter) / ns; test.Printf(_L("Go for %d iterations ...\n"), TInt(iter)); // // Now the real run ... // TBMResult* results = prog->Run(iter, &count); // Restore the original priority BMProgram::SetAbsPriority(RThread(), prog->iOrigAbsPriority); // // Now print out the results // for (TInt i = 0; i < count; ++i) { if (results[i].iMax) { test.Printf(_L("%S. %d iterations; Avr: %dns; Min: %dns; Max: %dns\n"), &results[i].iName, TInt(results[i].iIterations), TInt(results[i].iAverage), TInt(results[i].iMin), TInt(results[i].iMax)); TInt j; BM_ASSERT((TBMResult::KHeadSize % 4) == 0); test.Printf(_L("Head:")); for (j = 0; j < TBMResult::KHeadSize; j += 4) { test.Printf(_L(" %d %d %d %d "), TInt(results[i].iHead[j]), TInt(results[i].iHead[j+1]), TInt(results[i].iHead[j+2]), TInt(results[i].iHead[j+3])); } test.Printf(_L("\n")); BM_ASSERT((TBMResult::KTailSize % 4) == 0); test.Printf(_L("Tail:")); for (j = 0; j < TBMResult::KTailSize; j += 4) { test.Printf(_L(" %d %d %d %d "), TInt(results[i].iTail[j]), TInt(results[i].iTail[j+1]), TInt(results[i].iTail[j+2]), TInt(results[i].iTail[j+3])); } test.Printf(_L("\n")); } else { test.Printf(_L("%S. %d iterations; Avr: %dns\n"), &results[i].iName, TInt(results[i].iIterations), TInt(results[i].iAverage)); } } // // Sanity check for open handles // TInt end_thc, end_phc; RThread().HandleCount(end_phc, end_thc); BM_ASSERT(start_thc == end_thc); BM_ASSERT(start_phc == end_phc); // and also for pending requests ... BM_ASSERT(RThread().RequestCount() == 0); prog = prog->Next(); // // This can be used to run forever ... // // if (prog == NULL) // prog = ::bmSuite; // } test.End(); ::bmDriver.Close(); ::bmTimer.Close(); return 0; }