This interface consists of methods and properties supported by the Serial Terminal module.
This interface is exposed by the global object terminal
.
interface ITerminalManager {
// Properties
readonly ${sessions}: ${ITerminalSession}[];
// Methods
${closeAllSessions}(): void;
${createSession}(portName: string, deviceConfig?: ${IDeviceConfig}, showWindow?: boolean): ${ITerminalSession};
}
// This interface is not available in managed environment
// This interface is not available in native environment
readonly sessions: ${ITerminalSession}[];
// This property is not available in managed environment
// This property is not available in native environment
Returns the array of session objects.
Obtain a list of terminal sessions and print their baud rates:
var sessions = terminal.sessions;
for (var i = 0; i < sessions.length; ++i)
alert(sessions[i].config.baudRate);
closeAllSessions(): void;
// This method is not available in managed environment
// This method is not available in native environment
Call this method to stop and close all serial terminal sessions.
createSession(portName: string, deviceConfig?: ${IDeviceConfig}, showWindow?: boolean): ${ITerminalSession};
// This method is not available in managed environment
// This method is not available in native environment
portName
deviceConfig
showWindow
true
to create a visible terminal session, omit or pass false
to create invisible session.Returns the reference to created empty session object.
Creates new terminal session.
Create new terminal session:
var session = terminal.createSession("COM1", { baudRate: 115200, dataBits: 8, stopBits: 1,
parity: Terminal.Parity.None, flowControl: flowControl.hardware }, false);