当前位置: 首页>>代码示例>>C++>>正文


C++ CConsoleBase类代码示例

本文整理汇总了C++中CConsoleBase的典型用法代码示例。如果您正苦于以下问题:C++ CConsoleBase类的具体用法?C++ CConsoleBase怎么用?C++ CConsoleBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CConsoleBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExecuteL

void CDeleteCommand::ExecuteL(CConsoleBase& aConsole)
	{
	// Connect to the SIF server
	RSoftwareInstall sif;
	TInt err = sif.Connect();
	if (err != KErrNone)
		{
		aConsole.Printf(KTxtSifConnectionFailure);
		User::Leave(err);
		}
	CleanupClosePushL(sif);

	// Delete the component
	TRequestStatus status;
	sif.Uninstall(iComponentId, status);
	aConsole.Printf(KTxtDeleting);
	User::WaitForRequest(status);
	if (status.Int() != KErrNone)
		{
		User::Leave(status.Int());
		}

	// Disconnect from the SIF server
	CleanupStack::PopAndDestroy(&sif);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:25,代码来源:command.cpp

示例2: WriteLog

/**
 *
 * Write to the log.
 *
 * @param	"const TDesC& aMsg"
 *			The message string to write
 *
 * @param	"TInt aLogMode"
 *			The log mode (as bitmask of TTestFrameworkLogMode)
 *
 * @xxxx
 *
 */
void CTestFrameworkServer::WriteLog(const TDesC& aMsg, TInt aLogMode)
{
    if(aLogMode & ELogToConsole)
    {
        if(iConsole)
        {
            CConsoleBase* theConsole = iConsole->Console();
            theConsole->Printf(aMsg);
            theConsole->Printf(_L("\n")); // add newline
        }
    }

    if(aLogMode & ELogToFile)
    {
        if(iFileLogger)
        {
            iFileLogger->WriteLog(aMsg);
        }
    }

    if(aLogMode & ELogToPort)
    {
        RDebug::Print(aMsg);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:38,代码来源:TestFrameworkServer.cpp

示例3: UseKernelCpuTime

void UseKernelCpuTime()
{
    test.Start(_L("Create CCpuMeter"));
    CCpuMeter* m = CCpuMeter::New();
    test_NotNull(m);
    TInt iv = 1000500;	// on average 1000.5 ms
    TRequestStatus s;
    CConsoleBase* console = test.Console();
    console->Read(s);
    FOREVER
    {
        User::AfterHighRes(1000000);
        m->Measure();
        m->Display(iv);
        while (s!=KRequestPending)
        {
            User::WaitForRequest(s);
            TKeyCode k = console->KeyCode();
            if (k == EKeyEscape)
            {
                delete m;
                return;
            }
            if (m->iNumCpus > 1)
            {
                // SMP only options
                if (k == EKeySpace)
                    m->DisplayCoreControlInfo();
                else if (k>='1' && k<=('0'+m->iNumCpus))
                    m->ChangeNumberOfCores(k - '0');
            }
            console->Read(s);
        }
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:35,代码来源:cpumeter.cpp

示例4: ConsolePrintL

void CCTSYIntegrationTestSuiteStepBase::ConsolePrintL(const TDesC& aText )
	{
	CConsoleBase* con = NULL;
	TRAPD(err, con = Console::NewL(_L("Interactive Print"), TSize(KConsFullScreen, KConsFullScreen)));
	TEST(err == KErrNone);

	CleanupStack::PushL(con);
	con->Printf(_L("%S"), &aText);
	CleanupStack::PopAndDestroy(); // con
	
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:11,代码来源:cctsyintegrationtestsuitebase.cpp

示例5: mainL

LOCAL_C void mainL()
	{
	CCommandLineArguments* cmdLine = CCommandLineArguments::NewLC();
	CConsoleBase* console = Console::NewL(_L("Siftestintegrationlockfile"),TSize(KConsFullScreen,KConsFullScreen));
	CleanupStack::PushL(console);
	TInt argTotal(cmdLine->Count());
	if (argTotal < 2  || argTotal > 3)
		{
		console->Printf(_L("Incorrect arguments specified: expected 1, received %d"), argTotal - 1);
		User::Leave(KErrArgument);
		}
		
	TPtrC filename(cmdLine->Arg(1));
	_LIT(KDoLockFileParam, " lockfile");
	if (argTotal == 2)
		{
		RBuf params;
		params.CreateL(filename.Length() + KDoLockFileParam().Length());
		params.CleanupClosePushL();
		params.Append(cmdLine->Arg(1));
		params.Append(KDoLockFileParam());
		// Since this executable is used by TEF, we wish to lock the file after the launched process has exited, so we spawn this process again with a different set of parameters
		RProcess newInstance;
		User::LeaveIfError(newInstance.Create(_L("Siftestintegrationlockfile"), params));
		CleanupClosePushL(newInstance);
		newInstance.Resume();
		TRequestStatus status;		
		newInstance.Rendezvous(status);
		User::WaitForRequest(status);
		User::LeaveIfError(status.Int());
		CleanupStack::PopAndDestroy(2, &params); // newInstance
		}
	else
		{
		// This is the execution for locking the file, invoked using the branch above
		console->Printf(_L("Locking file %S for read"), &filename);	
		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
	
		RFile file;
		User::LeaveIfError(file.Open(fs, filename, EFileShareReadersOnly|EFileRead));
		CleanupClosePushL(file);
		// Signal the invoker only here, so that the file will definitely get locked before TEF proceeds to the next step
		RProcess::Rendezvous(KErrNone);		
		
		User::After(10*1000*1000); // Wait for 10 seconds
	
		CleanupStack::PopAndDestroy(2 , &fs); // file
		}
	CleanupStack::PopAndDestroy(2, cmdLine); // console,
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:52,代码来源:siftestintegrationlockfile.cpp

示例6: HTI_LOG_FUNC_IN

// -----------------------------------------------------------------------------
// CHtiFramework::StartL
// The method that gets the show going.
// -----------------------------------------------------------------------------
TInt CHtiFramework::StartL()
    {
    HTI_LOG_FUNC_IN( "CHtiFramework::StartL" );

    CConsoleBase* console = iDispatcher->GetConsole();
    if ( console )
        {
        console->Printf( _L( "HTI up and running.\n" ) );
        }

    // start scheduler
    CActiveScheduler::Start();

    HTI_LOG_FUNC_OUT( "CHtiFramework::StartL" );
    return KErrNone;

    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:21,代码来源:HtiFramework.cpp

示例7: DoPauseL

TInt CCTSYIntegrationTestSuiteStepBase::DoPauseL(const TDesC& aText, TTimeDuration aTimeout /* = ETimeMedium */)
/**
 Performs a pause, usually to allow user to intervene in Manual tests
 
 @param		aText - text for prompt
 @param		aTimeout - 
 @return	KErrNone if user pressed a key
 */
	{
	TInt ret = KErrNone;
		
	CConsoleBase* con = NULL;
	TRAPD(err, con = Console::NewL(_L("Interactive Test"), TSize(KConsFullScreen, KConsFullScreen)));

	INFO_PRINTF2(_L("Console status = %d"), err);
	TEST(err == KErrNone);
	CleanupStack::PushL(con);
	
	TConsoleReadRequestStatus readRequest(*con);
	//add to cleanup stack
	CleanupStack::PushL(readRequest);
	con->Printf(_L("%S (timeout %d secs) ..."), &aText, aTimeout / KOneSecond);
	con->Read(readRequest);
	
	ret = WaitForRequestWithTimeOut(readRequest, aTimeout);	
		
	if (ret == KErrTimedOut)
		{
		WARN_PRINTF1(_L("[doPause] No keypress detected, timeout! Manual action may not have occurred."));
		}

	if (readRequest.Int() == KRequestPending)	
		{
		readRequest.Cancel();
		}
	
	CleanupStack::PopAndDestroy(); // readRequest
	CleanupStack::PopAndDestroy(); // con
	
	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:41,代码来源:cctsyintegrationtestsuitebase.cpp

示例8: SetUpTestL

void CThreadBase::SetUpTestL( const TDesC& aThreadName )
	{
	// Set's up extra resources.
	CConsoleBase* console = NULL;
	TSize size;

	// Create and name an RTest
	iTest = new(ELeave) RTest(aThreadName);
	iTest->Start(_L("Starting test"));

	// Position our console window
	size = iTest->Console()->ScreenSize();
	size.iWidth = size.iWidth - 4;
	size.iHeight = (size.iHeight / 2) - 3;

	console = Console::NewL(aThreadName, size);
	delete const_cast<RTest*>(iTest)->Console();
	
	iTest->SetConsole(console);
	console->ClearScreen();
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:21,代码来源:threadbase.cpp

示例9: ActiveTestL

LOCAL_C void ActiveTestL()
    {
	CConsoleBase* console = Console::NewL(_L("ACTIVETEST"), TSize(KConsFullScreen, KConsFullScreen));
	CleanupStack::PushL(console);

	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	CActiveConsole* activeConsole = CActiveConsole::NewLC(*console);
	activeConsole->RequestCharacter();
	CActiveScheduler::Start();
	// NB CActiveScheduler::Start only returns when someone somewhere has 
	// called CActiveScheduler::Stop.

	CleanupStack::PopAndDestroy(2); // activeConsole, scheduler

	console->Printf(_L("\nPress any key"));
	console->Getch(); // get and ignore character
	CleanupStack::PopAndDestroy(); // console
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:21,代码来源:activetest.cpp

示例10: MainL

LOCAL_C void MainL()
	{
	_LIT(KTitle,"TestExecuteLogger Test Code for serial logging");
	CConsoleBase* console = Console::NewL(KTitle,TSize(KConsFullScreen,KConsFullScreen));
	CleanupStack::PushL(console);
	CTestExecuteLogger logger;

	TInt logLevel =1  ;
	TBool separateLogFiles(EFalse); 
	_LIT(KScriptPath,"E:\\plattest\\Selective.script");
	TPtrC scriptFilePath(KScriptPath);

	console->Write(_L("logger.InitialiseLoggingL next2 \n")) ; 
	logger.InitialiseLoggingL(scriptFilePath, separateLogFiles, logLevel);
	
	console->Write(_L("post logger.InitialiseLoggingL next \n"));
	TestWorkAPIsL(logger, console)	;
	
	console->Write(_L("attempting TerminateLoggingL \n")) ; 
	logger.TerminateLoggingL(3, 4, 3); //suggested by todays fortune cookie...

	console->Write(_L("Done testing, press a key to finish \n")) ; 
	console->Getch() ; 
	CleanupStack::PopAndDestroy(console);	
	}
开发者ID:fedor4ever,项目名称:testfw,代码行数:25,代码来源:testexecuteloggingtest.cpp

示例11: mainL

LOCAL_C void mainL()
	{

	TInt timerDuration(KDefaultTimeout);

	// There's only something useful to do if the timeDuration is
	// a positive value.
	if(timerDuration > 0)
		{
		CConsoleBase* console; // write all your messages to this

		console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
		
		console->Printf(KFormatRunning, timerDuration);

		while(1)
		{
		//console->Printf(KTxtExampleCode);
		User::After(1000000); //After 1 sec
		}

		}
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:23,代码来源:console_infinite_exe.cpp

示例12: MainL

static void MainL(void)
/**
Takes a User Prompt Service policy resource file and dumps it as human readable text to the 
console. The user may also specify the name of an output file on the command line. If so, text
is also written to this file.
*/
	{
	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
		
	CConsoleBase* console = Console::NewL(KAppName, TSize(KDefaultConsWidth, KDefaultConsHeight));
	CleanupStack::PushL(console);
	
	CCommandLineArguments* args = CCommandLineArguments::NewLC();
	
	if (args->Count() > 1)
		{		
		CPolicyReader* reader = CPolicyReader::NewLC(fs, args->Arg(1));		
		CPrinter* printer(0);
		if (args->Count() > 2)
			{
			RFile outFile;
			User::LeaveIfError(outFile.Replace(fs, args->Arg(2), EFileShareExclusive | EFileWrite));
			CleanupClosePushL(outFile);
			printer = CPrinter::NewLC(console, outFile);		
			
			CleanupStack::Pop(printer); 
			CleanupStack::PopAndDestroy(&outFile);
			CleanupStack::PushL(printer);
			}
		else
			{
			printer = CPrinter::NewLC(console);	
			}
		__UHEAP_MARK;
		PrintPoliciesL(printer, reader);
		__UHEAP_MARKEND;
		
		if (args->Count() < 3)
			{
			// If no output file is specified then pause after finishing
			// because the console will vanish when it is closed.
			console->Printf(_L("Press any key to continue\r\n"));
			console->Getch();
			}		
		CleanupStack::PopAndDestroy(2, reader); // printer, reader		
		}
	else 
		{
		console->Printf(_L("Usage: dumppolicy.exe policy.rsc <output.txt>\r\n"));
		console->Printf(_L("Press any key to continue\r\n"));
		console->Getch();
		}
	
	CleanupStack::PopAndDestroy(3, &fs); // args, console, fs
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:57,代码来源:dumppolicy.cpp

示例13: StartConsoleL

/**
 @fn void StartConsoleL()
 Start the console and create the ini file, then call the read method
 to manually test the contents.
 */
LOCAL_C void StartConsoleL()
    {
    // set INI file drive
    IniFileName[0] = 'A' + static_cast<TInt>(RFs::GetSystemDrive());
    
	// Create the console and put it on the cleanup stack
	CConsoleBase* console = 
		Console::NewL(KConsoleName, TSize(KConsFullScreen, KConsFullScreen));
	CleanupStack::PushL(console);

	// Call the main function and trap the result
	TRAPD(error, WriteIniFileL()); // create the ini file
	if(!error)
		{
		TRAPD(error2, ReadIniFileL()); // perform test
		error = error2;
		}
	if (error)
		console->Printf(KFailedMessage, error);
	else
		console->Printf(KOkMessage);

	CleanupStack::PopAndDestroy(console);	// close console
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:29,代码来源:EComSrvrIniWriter.cpp

示例14: InitConsoleL

LOCAL_C void InitConsoleL()
    {
    // create a full screen console object
    CConsoleBase* console;
    console = Console::NewL(KTxtTitle, TSize(KConsFullScreen,KConsFullScreen));
      
    CleanupStack::PushL(console);
  
    //Gets the size of the console
    TSize screenSize = console->ScreenSize();
    test.Printf(_L("Screen size %d %d\r\n"),screenSize.iWidth,screenSize.iHeight);
  
    // Gets the cursor's x-position
    TInt x = console->WhereX();
    // Gets the cursor's y-position
    TInt y = console->WhereY();
    test_Equal(x, 0);
    test_Equal(y, 0);
    test.Printf(_L("**1** Cursor positions x: %d  y: %d\r\n"),x, y);
  
    // Sets the cursor's x-position
    for(TInt i=0; i<4; i++)
        {
        console->SetPos(screenSize.iWidth + i);
        x = console->WhereX();
        test_Equal(x, screenSize.iWidth -3);
		}
    
    test.Printf(_L("**2** Cursor positions x: %d  y: %d\r\n"),x, y);
      
    // Clears the console and set cursor to position 0,0
    console->ClearScreen();
    test_Equal(console->WhereX(), 0);
	test_Equal(console->WhereY(), 0);
        
    // Sets the cursor's x-position and y-position
    for(TInt j=0; j<4; j++)
        {
        console->SetPos(screenSize.iWidth - j, screenSize.iHeight - j);
        x = console->WhereX();
        y = console->WhereY();
        test_Equal(x, screenSize.iWidth -3);
		test_Equal(y, screenSize.iHeight -3);
		}
    test.Printf(_L("**3** Cursor positions x: %d  y: %d\r\n"),x, y);
     
    console->SetPos(0,0);
    x = console->WhereX();
    y = console->WhereY();
    test_Equal(x, 0);
    test_Equal(y, 0);
	test.Printf(_L("**4** Cursor positions x: %d  y: %d\r\n"),x, y);
  
    console->SetPos(screenSize.iWidth/2,screenSize.iHeight/2);
    x = console->WhereX();
    y = console->WhereY();
    test.Printf(_L("**5** Cursor positions x: %d  y: %d\r\n"),x, y);
  
    // Sets the percentage height of the cursor
    console->SetCursorHeight(50);
  
    // Gets the current cursor position relative to the console window
    TPoint cursorPos = console->CursorPos();
    test.Printf(_L("CursorPos iX: %d  iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
    
    // Puts the cursor at the specified position relative
    // to the current cursor position
    TPoint relPos;
    relPos.iX = screenSize.iWidth/4;
    relPos.iY = screenSize.iHeight/4;
    console->SetCursorPosRel(relPos);
    cursorPos = console->CursorPos();
    test.Printf(_L("CursorPosRel iX: %d  iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
  
    // Puts the cursor at the absolute position in the window
    cursorPos.iX = screenSize.iWidth/6;
    cursorPos.iY = screenSize.iHeight/6;
    console->SetCursorPosAbs(cursorPos);
    cursorPos = console->CursorPos();
    test.Printf(_L("CursorPosAbs iX: %d  iY: %d\r\n"),cursorPos.iX, cursorPos.iY);
  
    // Sets a new console title
    console->SetTitle(KTxtNewTitle);
    // Writes the content of the specified descriptor to the console window
    console->Write(KTxtWrite);
    cursorPos.iX = cursorPos.iX + 6;
    console->SetCursorPosAbs(cursorPos);
    // Clears the console from the current cursor position to the end of the line
    console->ClearToEndOfLine();
    // Clears the console and set cursor to position 0,0
    console->ClearScreen();
  
    TUint keyModifiers = console->KeyModifiers();
	test.Printf(_L("keyModifiers %d"),keyModifiers);
    TKeyCode keyCode = console->KeyCode();
    ReadConsole(console);
  
    SimulateKeyPress(EStdKeyEnter);
    keyCode = console->Getch();
  
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:t_console.cpp

示例15:

TInt GetNumberEntry
(
	const TInt aMaxDigits,	// max numbers of digits
	const TInt aMin,		// min value allowed
	const TInt aMax,		// max value allowed
	const TInt aInputWait,	// (s) how long to wait for each user key entry
	const TInt aDefaultVal,	// default value if timed out
	const TDesC &aPrompt	// string prompt
)
/**
 * This method gets numeric user entry from the console. It checks that the key entered
 * is between 0 to 9 inclusive. This method exits by user hitting the
 * Enter key or timing out.
 *
 * @param aMaxNumbers integer for max numbers of digits
 * @param aMin integer for min value allowed
 * @param aMax integer for max value allowed
 * @param aInputWait integer for number of seconds to wait for each user key entry
 * @param aDefaultVal integer for default value if time-out occurs without
 * @param aPrompt string prompt
 * @return KErrNone.
 */
{
TInt keyFolded;				 // actual digit entered, not TKeyCode
TRequestStatus stat1,stat2;
RTimer timer;
TBool bCorrectEntry = EFalse;
TInt userNum = -1;
TInt limit;
TKeyCode key;

	TTimeIntervalMicroSeconds32 anInterval = aInputWait * 1000000;
	CConsoleBase *pConsole = test.Console();
	timer.CreateLocal();

	while (!bCorrectEntry)
		{
		userNum = -1;
		limit = aMaxDigits;
		key = EKeyNull;

		INFO_PRINTF1(aPrompt); // print prompt
		INFO_PRINTF1(_L(" (range %d-%d) or <CR> for default of %d: "), aMin, aMax, aDefaultVal);
		// exits loop when Enter keyed or limit reached (by decrement to 0)
		while ((key != EKeyEnter) && limit)
			{
			pConsole->Read(stat1);				// set read
			timer.After(stat2, anInterval);		// set wait for this period
			User::WaitForRequest(stat1,stat2);  // whatever comes first

			if(stat1 == KErrNone)					// user entered key
				{
				timer.Cancel();
				User::WaitForRequest(stat2);

				key = pConsole->KeyCode();
				if((key >= '0') && (key <= '9'))
					{
					// valid digit
					keyFolded = (TKeyCode)(key - '0');  // convert to digit
					INFO_PRINTF1(_L("%d"), keyFolded);	// echo
					limit--;			// tracks number of digits

					// "append" to number
					if (-1 == userNum)	   // ie first char entered
						{
						userNum = keyFolded;
						}
					else					//  next char entered
						{
						userNum = userNum * 10 + keyFolded;  // shift
						}
					}
				}
			else	// timer went off, use default unless valid key entered before timer expired
				{
				pConsole->ReadCancel();
				User::WaitForRequest(stat1);
				if (-1 == userNum)
					{
					// no value entered before timer went off
					userNum = aDefaultVal;
					}
				break;
				}
			} // endwhile

		test.Printf (_L("\n"));
		if ((userNum >= aMin) && (userNum <= aMax))
			{
			bCorrectEntry = ETrue;  // exit loop
			}
		else						// return to loop
			{
			if (userNum == -1)
				{
				// <CR> was entered before any numbers, so use default
				userNum = aDefaultVal;
				break;
				}
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:101,代码来源:Te_LoopBackt_tsylb.cpp


注:本文中的CConsoleBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。