Esempio n. 1
0
//*******************************************************************************
// Method      : CTestAppConsole::ProcessMainInput()
// Purpose     : Obtain user's option and decide which test case to run next.
// Parameters  : 
// Return Value: 
//*******************************************************************************
void CTestAppConsole::ProcessMainInput()
	{
    TBuf<80> line;
	GetStringFromConsole(line);
	
	if ( line.Length() > 0 )
	    {
		TChar inputChar = line[0];
		
		TInt err( KErrNone );
		TBool testsRun( ETrue );
		switch( inputChar )
			{
			case '1':
                err = RunInterfaceTests();
			    break;
			case '2':
			    err = RunAudioControlTests();
			    break;
			case '3':
			    err = RunRtcpTests();
				break;
			case '4':
			    err = RunDtmfTests();
				break;
			case '5':
			    err = RunAsyncFeatureTests();
			    break;
		    case 's':
			    err = RunSecureTests();
			    break;
			case '0':
				testsRun = EFalse;
				CActiveScheduler::Stop();
				break;
			default:
			    testsRun = EFalse;
				DisplayMsg( KTxtWrongOption );
				break;		
			}
	    
        if ( err )
            {
            iConsole->Printf( _L("Some tests failed: %d, check logs\n"), err );
            RDebug::Print( _L("\nSome tests failed: %d, check logs\n"), err );
            }
        else if ( testsRun )
            {
            iConsole->Printf( _L( "ALL TESTS OK\n" ) );
            RDebug::Print( _L( "\nAll tests OK\n" ) );
            }
        else
            {
            
            }
	    }
	
	// Ready to get next input option.
   	DoRead();
	}
Esempio n. 2
0
//*******************************************************************************
// Method      : CTestAppConsole::QueryIPAddress()
// Purpose     : 
// Parameters  : 
// Return Value: 
//*******************************************************************************
void CTestAppConsole::QueryIPAddress()
    {    
    TBuf16<80> line;
    
    // Query IP address and parse it
    TUint32 address;
    RArray<TUint32> values;
    TInt inputErr( 0 );
    
    iConsole->Printf( _L("\nINPUT IP (use dot as a separator): ") );
    iConsole->Printf( _L("\nPress enter if IP not needed in tests\n\n") );
    GetStringFromConsole( line );
    	
    if ( line.Length() != 0 )
        {
        TInt dotIndex( 0 );
        TBool dotExist = ETrue;

        while ( dotExist )
            {
            dotIndex = line.Locate( '.' );

            // True if last attribute value
            if( KErrNotFound == dotIndex  )
                {
                dotExist = EFalse;
                dotIndex = line.Length();
                }

            TUint8 number;
            TLex16 lex = line.Mid( 0, dotIndex );

            inputErr = lex.Val( number, EDecimal );
                
            if ( !inputErr )
                {
                values.AppendL( number );
                }
                
            if( dotExist )
                {
                line.Delete( 0, dotIndex + 1 );
                }
            }
            
        if ( !inputErr && values.Count() == 4 )
            {
            address = INET_ADDR( values[0], values[1], values[2], values[3] );
            iNetsettings.iRemoteAddress.SetAddress( address );    
            }
	    }
    }
Esempio n. 3
0
void CTestAppConsole::SetUpRtpStack()
    {
    TDes* line = new TBuf<80>;
   
    iConsole->ClearScreen();
    iConsole->Printf( _L("\nEnter the IAP ID: ") );
    GetStringFromConsole(*line);

    TLex lex(*line);
    lex.Val(iIapid,EDecimal);

    // Get Remote Port number
	iConsole->ClearScreen();
    iConsole->Printf(_L("\nMccEnter the Local port number "));

	GetStringFromConsole(*line);

    //Use INPUT
    TLex lex2(*line);
    lex2.Val(iPort,EDecimal);

    //Use INPUT
    iConsole->ClearScreen();
		
	TBuf<128> theInput;

	iConsole->Printf(_L("\nEnter the Remote IP address "));	
	GetStringFromConsole(*line);

	theInput.Copy( *line );
	iRemoteAddr.SetFamily(KAfInet);
	iRemoteAddr.Input(theInput);
    iRemoteAddr.SetPort(iPort);
    
    delete line;
    };
Esempio n. 4
0
//*******************************************************************************
// Method      : CTestAppConsole::QueryNetworkSettings()
// Purpose     : 
// Parameters  : 
// Return Value: 
//*******************************************************************************
void CTestAppConsole::QueryNetworkSettings()
    {
    TBuf16<80> line;
    
    iConsole->Printf( _L("\nQUERYING NETWORK SETTINGS") );
    iConsole->Printf( _L("\nPress enter to use existing value") );
    
    TUint iap( KTestIapId );
    TInt inputErr( 0 );
    do 
        {
        iConsole->Printf( _L("\nINPUT IAPID: ") );
    	GetStringFromConsole( line );
    	if ( line.Length() != 0 )
    	    {
        	TLex lex( line );
        	inputErr = lex.Val( iap );    	    
    	    }
        } while ( inputErr );
    
    iNetsettings.iIapId = iap;
    }
Esempio n. 5
0
void TERMWINDOWMEMBER fkey(uint inkey)
    {
    int key = inkey >> 8;

    // this handles the keys for dialout mode
    if (DoWhat == DIALOUT)
        {
        dialout_fkey = key;
        return;
        }

    // let RLM take over keyboard if it wants
    if (!CitadelIsConfiguring && rlmEvent(LT_KEYSTROKE, key, inkey))
        {
        return;
        }

    if (cfg.FullConLock && ConsoleLock.IsLocked() && ScreenSaver.IsOn() &&
            key != ALT_L)
        {
        return;
        }

    if (!LockMessages(MSG_CONSOLE))
        {
        cOutOfMemory(49);
        }

    if (key == CTL_F2)      // CTRL_F2 is never locked.
        {
#ifndef WINCIT
        if (allWindows)
            {
            setFocus(allWindows->wnd);
            }
#endif
        }
    else if (key != ALT_F1 && ConsoleLock.IsLocked(key == F6 || key == ALT_F6 || key == SFT_F6 || key == CTL_F6))
        {
#ifndef WINCIT
        if (key == ALT_L && ConsoleLock.MayUnlock())
            {
            GetStringFromConsole(getmsg(MSG_CONSOLE, 0), LABELSIZE, ns, GetSysPWHandler, TRUE);
            }
        else
            {
            if (cfg.VerboseConsole)
                {
                CitWindowsNote(NULL, (key == ALT_L) ? getmsg(MSG_CONSOLE, 1) : getmsg(MSG_CONSOLE, 2));
                }
            }
#endif
        }
    else
        {
        // Console is not locked

        if (CitadelIsConfiguring)
            {
            // Only let certain keystrokes through if configuring
            if (key != CTL_F6 && key != F7 && key != F8 && key != ALT_D && key != ALT_L && key != ALT_M &&
                    key != ALT_S && key != ALT_U)
                {
                WaitUntilDoneConfiguring();
                key = 0;
                }
            }

        ScreenSaver.Update();
        switch (key)
            {
            case F1:
                {
                CITWINDOW *w = CitWindowsMsg(NULL, getmsg(MSG_CONSOLE, 3));

#ifndef WINCIT
                CommPort->DropDtr();
#endif

                if (w)
                    {
                    destroyCitWindow(w, FALSE);
                    }

                break;
                }

#ifndef WINCIT
            case CTL_F1:
                {
                if (say_ascii != (int (cdecl *)(const char *, int)) nullFunc)
                    {
                    cfg.speechOn = !cfg.speechOn;

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 4), cfg.speechOn ? getmsg(317) : getmsg(316));
                        }
                    }
                else
                    {
                    cfg.speechOn = FALSE;

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 5));
                        }
                    }

                break;
                }
#endif

            case ALT_F1:
                {
                cls(SCROLL_SAVE);
                break;
                }

            case F2:
                {
                CITWINDOW *w = CitWindowsMsg(NULL, getmsg(19));

                Initport();

                if (w)
                    {
                    destroyCitWindow(w, FALSE);
                    }

                break;
                }

            case F3:
                {
                sysReq = !sysReq;

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 6), sysReq ? getmsg(317) : getmsg(316));
                    }

                break;
                }

            case ALT_F3:
                {
                if (sysReq)
                    {
                    altF3Timeout = 0;
                    sysReq = FALSE;

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 6), getmsg(316));
                        }
                    }
                else
                    {
                    altF3Timeout = time(NULL) + cfg.altF3Time;
                    sysReq = TRUE;

                    if (cfg.VerboseConsole)
                        {
                        long tme = time(NULL);

                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 7), (altF3Timeout - tme) / 60, (altF3Timeout - tme) % 60);
                        }
                    }

                break;
                }

            case F4:
                {
                if (!StatusLine.ToggleFullScreen(WC_TWp))
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 8));
                        }
                    }

                break;
                }

            case F5:
                {
                if (onConsole)
                    {
                    OC.whichIO = MODEM;
                    OC.setio();

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 9), getmsg(MSG_CONSOLE, 10));
                        }
                    }
                else
                    {
                    OC.whichIO = CONSOLE;
                    OC.setio();

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 9), getmsg(MSG_CONSOLE, 11));
                        }
                    }

                break;
                }

            case F6:
                {
                sysopkey = TRUE;
                break;
                }

#ifndef WINCIT
            case CTL_F6:
                {
                doConsoleSysop();
                break;
                }
#endif

            case ALT_F6:
                {
                CurrentUser->SetAide(!CurrentUser->IsAide());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
							CurrentUser->IsAide() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14), getmsg(385));
                    }

                break;
                }

            case SFT_F6:
                {
                CurrentUser->SetSysop(!CurrentUser->IsSysop());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
                            CurrentUser->IsSysop() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14), getmsg(386));
                    }

                break;
                }

            case F7:
                {
                cfg.noBells++;

                if (cfg.noBells == 3)
                    {
                    cfg.noBells = 0;
                    }

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 15), getmsg(MSG_CONSOLE, 16 + cfg.noBells));
                    }

                break;
                }

            case ALT_C:
            case F8:
                {
                chatkey = !chatkey;
                break;
                }

            case F9:
                {
                cfg.noChat = !cfg.noChat;
                chatReq = FALSE;

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 19), cfg.noChat ? getmsg(316) : getmsg(317));
                    }

                break;
                }

            case F10:
            case ALT_H:
                {
                StatusLine.ToggleHelp(WC_TWp);
                break;
                }

            case ALT_F10:
                {
                StatusLine.ToggleSecond(WC_TWp);
                break;
                }

            case SFT_F10:
                {
                StatusLine.Toggle(WC_TWp);
                break;
                }

#ifdef WINCIT
            case F11:
                {
				TermWindowCollection.FocusPrev();
                break;
                }

            case F12:
                {
				TermWindowCollection.FocusNext();
                break;
                }
#endif

            case ALT_A:
                {
                CurrentUser->SetAccounting(!CurrentUser->IsAccounting());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 20), CurrentUser->IsAccounting() ? getmsg(317) : getmsg(316));
                    }

                break;
                }

            case ALT_D:
                {
                if (debug)
                    {
                    TurnDebugOff();

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 21), getmsg(316));
                        }
                    }
                else
                    {
                    if (TurnDebugOn())
                        {
                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 21), getmsg(317));
                            }
                        }
                    else
                        {
                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 22));
                            }
                        }
                    }

                break;
                }

#ifndef WINCIT
            case ALT_K:
                {
                if (!allWindows)
                    {
                    if (cfg.scrollSize)
                        {
                        DisplayScrollBackBuffer();
                        time(&LastActiveTime);
                        }
                    else
                        {
                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 23), citfiles[C_CONFIG_CIT]);
                            }
                        }
                    }
                else
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 24));
                        }
                    }

                break;
                }
#endif

            case ALT_L:
                {
                if (*cfg.f6pass)
                    {
                    if (!SameString(cfg.f6pass, getmsg(670)))
                        {
                        ConsoleLock.Lock();

                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 32));
                            }
                        }
                    }
                else
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 33), citfiles[C_CONFIG_CIT]);
                        }
                    }

                break;
                }

            case ALT_M:
                {
                memoryDump();
                break;
                }

            case ALT_P:
                {
                if (OC.Printing)
                    {
                    OC.Printing = FALSE;
                    fclose(OC.PrintFile);

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 25));
                        }
                    }
                else
                    {
#ifndef WINCIT
                    if (cfg.printerprompt)
                        {
                        GetStringFromConsole(getmsg(289), 63, cfg.printer, StartPrinting, FALSE);
                        }
                    else
#endif
                        {
                        char Buffer[sizeof(cfg.homepath) + sizeof(cfg.printer)];
                        sprintf(Buffer, sbs, cfg.homepath, cfg.printer);

                        StartPrinting(Buffer);
                        }
                    }

                break;
                }

            case ALT_R:
                repeatevent = TRUE;
                // fall through

            case ALT_F:
                forceevent = TRUE;
                // fall through

            case ALT_E:
                eventkey = TRUE;
                break;


            case ALT_S:
                {
                if (ScreenSaver.TurnOn())
                    {
#ifndef WINCIT
                    while ((*sp_press)());
#endif
                    }
                else
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 26));
                        }
                    }

                break;
                }

            case ALT_T:
                {
                CurrentUser->SetProblem(!CurrentUser->IsProblem());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
                            CurrentUser->IsProblem() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14),
							getmsg(MSG_CONSOLE, 27));
                    }

                break;
                }

            case ALT_U:
                {
                cfg.ignore_uptime = !cfg.ignore_uptime;

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 28),
							citfiles[C_CONFIG_CIT], cfg.ignore_uptime ? getmsg(317) : getmsg(316));
                    }

                break;
                }

            case ALT_V:
                {
                CurrentUser->SetVerified(!CurrentUser->IsVerified());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
							CurrentUser->IsVerified() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14),
							getmsg(MSG_CONSOLE, 29));
                    }

                break;
                }

            case ALT_X:
            case ALT_F4:
                {
#ifndef WINCIT
                if (cfg.AltXPrompt)
                    {
                    GetYNFromConsole(getmsg(MSG_CONSOLE, 30), 0, ExitYNHandler);
                    }
                else
#endif
                    {
                    ExitToMsdos = TRUE;
                    }

                break;
                }

            case ALT_Z:
                {
                if (CommPort->HaveConnection() || debug)
                    {
                    sleepkey = TRUE;
                    }

                break;
                }

            case ALT_3:
                {
                CurrentUser->SetOut300(!CurrentUser->IsOut300());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
                            CurrentUser->IsOut300() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14),
                            getmsg(MSG_CONSOLE, 31));
                    }

                break;
                }

            case PGUP:
                {
                CurrentUser->SetCredits(CurrentUser->GetCredits() + 5 * 60);
                break;
                }

            case PGDN:
                {
                CurrentUser->SetCredits(CurrentUser->GetCredits() - 5 * 60);
                break;
                }
            }
        }

    UnlockMessages(MSG_CONSOLE);

    StatusLine.Update(WC_TWp);
    }