Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
Public Member Functions | List of all members
TerminalLine Class Reference

TerminalLine manages the terminal lines, virtual terminal lines, and console lines. More...

Inheritance diagram for TerminalLine:
ConsoleLine VirtualLine

Public Member Functions

string getName ()
 Returns the name of this terminal line. More...
 
Device getOwnerDevice ()
 Returns the owner device of this terminal line. More...
 
string getMode ()
 Returns the mode this terminal line is in. More...
 
string getPrompt ()
 Returns the prompt of this terminal line. More...
 
CommandHistory getUserHistory ()
 Returns the user history of this terminal line. More...
 
CommandHistory getConfigHistory ()
 Returns the config history of this terminal line. More...
 
CommandHistory getCurrentHistory ()
 Returns the current history of this terminal line. More...
 
int getHistorySize ()
 Returns the history size. More...
 
string getCommandInput ()
 Returns the command input. More...
 
int getTelnetClientCount ()
 Returns the number of telnet clients. More...
 
TelnetClientProcess getTelnetClientAt (int)
 Returns the telnet client at the specified index. More...
 
void enterCommand (string)
 Enters a command to the terminal line. More...
 
void terminalUpdated (string)
 IPC event. More...
 
void moreDisplayed ()
 Event happens when a –More– display is generated. More...
 
void enterChar (byte, SpecialChar)
 Enters the specified ascii or special character into the terminal. More...
 
void outputWritten (string, bool, int)
 This event is emitted when output is written to the terminal line. More...
 
void cursorPositionChanged (int)
 This event is emitted when the cursor position has moved to the specified position from the end of the terminal. More...
 
void directiveSent (DirectiveCommand, int)
 This event is emitted when a directive command is sent. More...
 
void commandStarted (string, string, string, string)
 This event is emitted when a command has started. More...
 
void commandEnded (string, CommandStatus)
 This event is emitted when a command has ended. More...
 
void commandAutoCompleted (string, string)
 This event is emitted when a command has been auto completed. More...
 
void modeChanged (string, string, string)
 This event is emitted when the mode has changed. More...
 
void promptChanged (string)
 This event is emitted when the prompt has changed. More...
 
void commandSelectedFromHistory (string)
 This event is emitted when a command from the history has been selected. More...
 
void setSettings (int, string, Parity, string, FlowControl)
 Sets the connection settings to this terminal. More...
 
int getSpeed () const
 
byte getDataBits () const
 
Parity getParity () const
 
string getStopBits () const
 
FlowControl getFlowControl () const
 
void println (string)
 This function gets the flow control. More...
 
void flush (int)
 This function remove the first number of lines in the buffer. More...
 

Detailed Description

TerminalLine manages the terminal lines, virtual terminal lines, and console lines.

Member Function Documentation

◆ commandAutoCompleted()

void TerminalLine::commandAutoCompleted ( string  ,
string   
)

This event is emitted when a command has been auto completed.

  • inputCommand, the user-entered command.
  • completeCommand, the resolved complete command.

IPC event.

◆ commandEnded()

void TerminalLine::commandEnded ( string  ,
CommandStatus   
)

This event is emitted when a command has ended.

  • inputCommand, the user-entered command.
  • status, the command status. Command statuses: eStatusOk = 0, eErrorAmbiguous = 1, eErrorInvalid = 2, eErrorIncomplete = 3, eErrorNotImplemented = 4

IPC event.

◆ commandSelectedFromHistory()

void TerminalLine::commandSelectedFromHistory ( string  )

This event is emitted when a command from the history has been selected.

  • historyCommand, the command from the history that was selected.

IPC event.

◆ commandStarted()

void TerminalLine::commandStarted ( string  ,
string  ,
string  ,
string   
)

This event is emitted when a command has started.

  • inputCommand, the user-entered command.
  • completeCommand, the resolved complete command.
  • processedCommand, the completed commands processed without errors.
  • inputMode, the mode where the command is executed.

IPC event.

◆ cursorPositionChanged()

void TerminalLine::cursorPositionChanged ( int  )

This event is emitted when the cursor position has moved to the specified position from the end of the terminal.

  • positionFromEnd, the position from the end of the terminal.

IPC event.

◆ directiveSent()

void TerminalLine::directiveSent ( DirectiveCommand  ,
int   
)

This event is emitted when a directive command is sent.

  • directiveCommand, the directive command that was sent. Directive commands: eBackspace = 0, eDeleteLine = 1
  • cursorPositionFromEnd, where the output is inserted from the end of the buffer as a positive number or 0; 0 means the end.

IPC event.

◆ enterChar()

void TerminalLine::enterChar ( byte  ,
SpecialChar   
)

Enters the specified ascii or special character into the terminal.

Parameters
ascii,anyASCII character. Includes: Backspace = 8 Ctrl+C = 3 Ctrl+Z = 26 Ctrl+Shift+6 = 30 Enter = 13 Line Feed = 10 Tab = 9 Question = '?' Space = ' ' Ctrl+B = 2 Ctrl+F = 6 Ctrl+P = 16 Ctrl+N = 14 Ctrl+A = 1 Ctrl+E = 5 Ctrl+U = 21
enum<SpecialChar>,aspecial character key. Special characters: eNoChar = 0, eArrowRight = 1, eArrowLeft, eArrowUp, eArrowDown
Remarks
If ascii is 0, then specialChar will be examined.

◆ enterCommand()

void TerminalLine::enterCommand ( string  )

Enters a command to the terminal line.

◆ flush()

void TerminalLine::flush ( int  )

This function remove the first number of lines in the buffer.

Parameters
lineCount,thenumber of lines to be removed

◆ getCommandInput()

string TerminalLine::getCommandInput ( )

Returns the command input.

Returns
string, the command input.

◆ getConfigHistory()

CommandHistory TerminalLine::getConfigHistory ( )

Returns the config history of this terminal line.

Returns
CommandHistory, the CommandHistory object.

◆ getCurrentHistory()

CommandHistory TerminalLine::getCurrentHistory ( )

Returns the current history of this terminal line.

Returns
CommandHistory, the CommandHistory object.

◆ getDataBits()

byte TerminalLine::getDataBits ( ) const

This function gets the data bits.

◆ getFlowControl()

FlowControl TerminalLine::getFlowControl ( ) const

This function gets the flow control.

◆ getHistorySize()

int TerminalLine::getHistorySize ( )

Returns the history size.

Returns
int, the history size.

◆ getMode()

string TerminalLine::getMode ( )

Returns the mode this terminal line is in.

Returns
string, the mode this terminal line is in.

◆ getName()

string TerminalLine::getName ( )

Returns the name of this terminal line.

Returns
string, the name of this terminal line.

◆ getOwnerDevice()

Device TerminalLine::getOwnerDevice ( )

Returns the owner device of this terminal line.

Returns
Device, the device that owns this terminal line.

◆ getParity()

Parity TerminalLine::getParity ( ) const
Parameters
[in]paritya parity bit value
    This function sets the parity bit.

◆ getPrompt()

string TerminalLine::getPrompt ( )

Returns the prompt of this terminal line.

Returns
string, the prompt of this terminal line.

◆ getSpeed()

int TerminalLine::getSpeed ( ) const

This function gets the baud rate.

◆ getStopBits()

string TerminalLine::getStopBits ( ) const

This function gets the stop bits.

◆ getTelnetClientAt()

TelnetClientProcess TerminalLine::getTelnetClientAt ( int  )

Returns the telnet client at the specified index.

Parameters
index,theindex of the telnet client of interest.
Returns
TelnetClientProcess, the TelnetClientProcess object at the specified index.

◆ getTelnetClientCount()

int TerminalLine::getTelnetClientCount ( )

Returns the number of telnet clients.

Returns
int, the number of telnet clients.

◆ getUserHistory()

CommandHistory TerminalLine::getUserHistory ( )

Returns the user history of this terminal line.

Returns
CommandHistory, the CommandHistory object.

◆ modeChanged()

void TerminalLine::modeChanged ( string  ,
string  ,
string   
)

This event is emitted when the mode has changed.

  • newMode, the new mode name.
  • newModeArg, includes extra info to identify the new mode.
  • newPrompt, the new prompt.

IPC event.

◆ moreDisplayed()

void TerminalLine::moreDisplayed ( )

Event happens when a –More– display is generated.

IPC event.

◆ outputWritten()

void TerminalLine::outputWritten ( string  ,
bool  ,
int   
)

This event is emitted when output is written to the terminal line.

  • newOutput, the output appended to the terminal.
  • isDebug, true if the output is debug output, otherwise false.
  • cursorPositionFromEnd, where the output is inserted from the end of the buffer as a positive number or 0; 0 means the end.
Remarks
This event replaces terminalUpdated(string updatedStr).
VirtualLine also sends out this event for outputs to Telnet or SSH.

IPC event.

◆ println()

void TerminalLine::println ( string  )

This function gets the flow control.

Parameters
output,theoutput string to be printed to terminal line

◆ promptChanged()

void TerminalLine::promptChanged ( string  )

This event is emitted when the prompt has changed.

  • newPrompt, the new prompt.

IPC event.

◆ setSettings()

void TerminalLine::setSettings ( int  ,
string  ,
Parity  ,
string  ,
FlowControl   
)

Sets the connection settings to this terminal.

Parameters
intspeed, any Speed setting of either: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
charbits, The number of data bits, from 5 to 8, inclusive
enum<Parity>parity, The parity mode, even, odd, none, mark, space
stringstopbits, The stop bits, 1, 1.5, or 2
enum<FlowControl>flowcontrol, The flow control method, Xon/Xoff, Hardware, None

◆ terminalUpdated()

void TerminalLine::terminalUpdated ( string  )

IPC event.

Deprecated:
This event is emitted when the terminal line is updated.
  • updatedStr, the output appended to the terminal.

The documentation for this class was generated from the following file: