interface ISession {
// Properties
readonly ${state}: ${Session.State};
${precise}: boolean;
readonly ${visualizers}: ${IVisualizer}[];
// Methods
${addDevice}(deviceName?: string, serverName?: string): void;
${addDevice#addDevice1}(device?: { serial: string }, serverName?: string): void;
${addDevice#addDevice2}(device?: { usb: { device?: string; port?: number; address?: number; serialNumber?: string; } }, serverName?: string): void;
${addDevice#addDevice3}(device?: { network: string }, serverName?: string): void;
${addDevice#addDevice4}(device?: { virtual: any }, serverName?: string): ${ISession};
${addDevice#addDevice5}(device?: { playback: { path: string; stream?: number; } }, serverName?: string): void;
${addDevice#addDevice6}(device?: { bridge: string | ${IBridge} }, serverName?: string): void;
${addVisualizer}(name: string): ${IVisualizer};
${addVisualizer#addVisualizer1}(name: "Data Recording",
config?: ${VisConfig.Recorder}): ${DataRecording.IRecordingVisualizer2};
${addVisualizer#addVisualizer2}(name: "Structure View",
structure_view_config?: { filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
${addVisualizer#addVisualizer3}(name: "Raw Data View",
raw_data_view_config?: { filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
${addVisualizer#addVisualizer4}(name: "PPP View",
ppp_view_config?: { filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
${addVisualizer#addVisualizer5}(name: "Raw Exporter",
raw_exporter_config?: { exporter: ${VisConfig.Exporter}; filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
${addVisualizer#addVisualizer6}(name: "Text Exporter",
text_exporter_config?: { exporter: ${VisConfig.Exporter}; filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
${start}(): void;
${stop}(): void;
${pause}(): void;
${resume}(): void;
${setCaptureFilter}(config: ${VisConfig.Filter}): void;
${configureSource}(config: { playback: ${Playback.Config} }): void;
${configureSource#configureSource1}(config: { path: string }): void;
${configureSource#configureSource2}(config: { serial: ${Serial.CommunicationsMode}; }): void;
${configureSource#configureSource3}(config: { serial: { mode: ${Serial.CommunicationsMode}; script?: string; discardEmptyReads?: boolean; terminal?: ${IDeviceConfig}; } }): void;
${configureSource#configureSource4}(config: { multi: ${Multi.Color}[]; }): void;
${saveToLog}(config: ${VisConfig.Recorder}): Promise<void>;
}
// This interface is not available in managed environment
// This interface is not available in native environment
readonly state: ${Session.State};
// This property is not available in managed environment
// This property is not available in native environment
Returns current session state.
precise: boolean;
// This property is not available in managed environment
// This property is not available in native environment
Returns or sets current session's precise timing mode. Timing mode may only be changed before the session is started.
readonly visualizers: ${IVisualizer}[];
// This property is not available in managed environment
// This property is not available in native environment
Returns an array of references to data visualizer objects.
Note that each time you query this property, a new object is created for each data visualizer. This means that expression session.visualizers[0] === session.visualizers[0]
will never be true. Use the IVisualizer.equals method to test whether two references describe the same object.
addDevice(deviceName?: string, serverName?: string): void;
// This method is not available in managed environment
// This method is not available in native environment
deviceName
serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
This overload uses generic string matching. It cycles through all installed modules and performs exact device name match. Serial module also supports device names of the form “COMx” where x is a number from 1 to 255.
addDevice(device?: { serial: string }, serverName?: string): void;
// This method is not available in managed environment
// This method is not available in native environment
device
serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
addDevice(device?: { usb: { device?: string; port?: number; address?: number; serialNumber?: string; } }, serverName?: string): void;
// This method is not available in managed environment
// This method is not available in native environment
device
device
, port
and address
fields use to identify the device you want to monitor. Alternatively, use the serialNumber
field to identify the device.serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
addDevice(device?: { network: string }, serverName?: string): void;
// This method is not available in managed environment
// This method is not available in native environment
device
serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
addDevice(device?: { virtual: any }, serverName?: string): ${ISession};
// This method is not available in managed environment
// This method is not available in native environment
device
serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
addDevice(device?: { playback: { path: string; stream?: number; } }, serverName?: string): void;
// This method is not available in managed environment
// This method is not available in native environment
device
serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
addDevice(device?: { bridge: string | ${IBridge} }, serverName?: string): void;
// This method is not available in managed environment
// This method is not available in native environment
device
serverName
Adds a specified device to the session. A monitoring session may have several devices but they all must be of the same type.
Adding devices to the session:
var session = monitoring.createSession();
// Add COM1 serial device to it (use automatic matching):
session.addDevice("COM1");
// Add specific serial device:
session.addDevice({ serial: "Communications Port (COM1)" });
// Add specific USB device:
session.addDevice({ usb: { device: "USB Input Device", port: 4, address: 1 } });
// Add specific network adapter:
session.addDevice({ network: "Realtek PCIe GBE Family Controller(802.3)" });
// Add specific log file:
session.addDevice({ playback: { path: "C:\\temp\\Communications Port (COM1)$140408$1.dmslog8", stream: 0 } });
// Create remote monitoring session for serial port
session.addDevice("COM5", "remote_server_name");
addVisualizer(name: string): ${IVisualizer};
// This method is not available in managed environment
// This method is not available in native environment
name
Adds a data visualizer to the session. The method takes a name of data visualizer and an optional configuration object. Several data visualizers support configuration while some require it.
This method is overloaded to help check syntax.
addVisualizer(name: "Data Recording",
config?: ${VisConfig.Recorder}): ${DataRecording.IRecordingVisualizer2};
// This method is not available in managed environment
// This method is not available in native environment
name
config
Adds a Data Recording component to the session.
addVisualizer(name: "Structure View",
structure_view_config?: { filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
// This method is not available in managed environment
// This method is not available in native environment
name
structure_view_config
filter
object) and Root Protocol (bind
string). See VisConfig.Filter for more information on configuring Display Filter. Root Protocol may be configured using the bind
parameter.Adds a Structure View data visualizer to the session.
addVisualizer(name: "Raw Data View",
raw_data_view_config?: { filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
// This method is not available in managed environment
// This method is not available in native environment
name
raw_data_view_config
filter
object) and Root Protocol (bind
string). See VisConfig.Filter for more information on configuring Display Filter. Root Protocol may be configured using the bind
parameter.Adds a Raw Data View data visualizer to the session.
addVisualizer(name: "PPP View",
ppp_view_config?: { filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
// This method is not available in managed environment
// This method is not available in native environment
name
ppp_view_config
filter
object) and Root Protocol (bind
string). See VisConfig.Filter for more information on configuring Display Filter. Root Protocol may be configured using the bind
parameter.Adds a PPP View data visualizer to the session.
addVisualizer(name: "Raw Exporter",
raw_exporter_config?: { exporter: ${VisConfig.Exporter}; filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
// This method is not available in managed environment
// This method is not available in native environment
name
raw_exporter_config
filter
object) and Root Protocol (bind
string). To configure exporter, see the VisConfig.Exporter topic for more information.Adds a Raw Exporter data processing module to the session.
addVisualizer(name: "Text Exporter",
text_exporter_config?: { exporter: ${VisConfig.Exporter}; filter?: ${VisConfig.Filter}; bind?: string; }): ${IVisualizer};
// This method is not available in managed environment
// This method is not available in native environment
name
text_exporter_config
filter
object) and Root Protocol (bind
string). To configure exporter, see the VisConfig.Exporter topic for more information.Adds a Text Exporter data processing module to the session.
Adding devices to the session:
var session = monitoring.createSession();
// Add Request View visualizer
session.addVisualizer("Request View");
// Add Structure View visualizer with default configuration
session.addVisualizer("Structure View");
// Add PPP View visualizer and configure both Display Filter and Root Protocol
session.addVisualizer("PPP View",{filter: {name:"IO packets only"}, bind: "PPP"});
// Add Raw Exporter and configure it
session.addVisualizer("Raw Exporter",{exporter: {path: "c:\\temp\\raw.bin", overwrite: true, nocache: false}});
start(): void;
// This method is not available in managed environment
// This method is not available in native environment
Start monitoring session. Make sure at least one device and one data visualizer are successfully added to the session before calling this method. You may add devices using ISession.addDevice method and visualizers using ISession.addVisualizer.
Several data sources may support or require configuration using ISession.configureSource method.
An optional Capture Filter may be specified for monitoring session using ISession.setCaptureFilter method.
Creating, configuring and starting a monitoring session:
var session = monitoring.createSession();
session.addDevice({ serial: "Communications Port (COM1)" });
session.addVisualizer("Data View");
session.start();
stop(): void;
// This method is not available in managed environment
// This method is not available in native environment
Stops a monitoring session. A monitoring session object may not be used after the session has been stopped. Only requesting the session state is allowed it.
pause(): void;
// This method is not available in managed environment
// This method is not available in native environment
Pauses a running monitoring session.
resume(): void;
// This method is not available in managed environment
// This method is not available in native environment
Resumes a paused monitoring session.
setCaptureFilter(config: ${VisConfig.Filter}): void;
// This method is not available in managed environment
// This method is not available in native environment
config
Configure session's Capture Filter.
Configuring Capture Filter:
// Use predefined capture filter
session.setCaptureFilter({ name: "IO packets only"});
// Use custom capture filter
session.setCaptureFilter({ expression: "usb.urb.BulkOrInterrupt.TransferBufferLength > 500" });
configureSource(config: { playback: ${Playback.Config} }): void;
// This method is not available in managed environment
// This method is not available in native environment
config
Configure the Playback data source.
Configure Playback Source:
var session = monitoring.createSession();
session.addDevice({ playback: { path: "C:\\temp\\Communications Port (COM1)$140408$1.dmslog8", stream: 0 } });
session.configureSource({ playback: { scale: Playback.Scale.FourToOne }});
configureSource(config: { path: string }): void;
// This method is not available in managed environment
// This method is not available in native environment
config
Configure the Import Source.
configureSource(config: { serial: ${Serial.CommunicationsMode}; }): void;
// This method is not available in managed environment
// This method is not available in native environment
config
Configure the Serial data source.
var session = monitoring.createSession();
session.addDevice({ serial: "Communications Port (COM1)" });
session.configureSource({ serial: Serial.CommunicationsMode.PPP});
configureSource(config: { serial: { mode: ${Serial.CommunicationsMode}; script?: string; discardEmptyReads?: boolean; terminal?: ${IDeviceConfig}; } }): void;
// This method is not available in managed environment
// This method is not available in native environment
config
discardEmptyReads
(defaults to true
). You can also configure the terminal session by passing the IDeviceConfig interface.Configure the Serial data source.
configureSource(config: { multi: ${Multi.Color}[]; }): void;
// This method is not available in managed environment
// This method is not available in native environment
config
Configure the Multi-Source data source.
Configure both Serial and Multi-Source:
var session = monitoring.createSession();
session.addDevice({ serial: "Communications Port (COM1)" });
session.addDevice({ serial: "Next connected device" });
session.configureSource({ multi: [{ r: 250, g: 187, b: 0, a: 112 }, { r: 64, g: 64, b: 64, a: 112 }],
serial: Serial.CommunicationsMode.PPP});
saveToLog(config: ${VisConfig.Recorder}): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
config
path
parameter must be specified and must be the full path to the resulting log file. Other configuration parameters may be omitted, in which case defaults will be used.Start the Save to Log command on the current session object. This method pauses the monitoring session, asynchronously executes the save to log command and then resumes the session. It can throw a number of exceptions if given parameters are not valid or the session is currently in invalid state.
async function saveSession(session: ISession, path: string) {
await session.saveToLog({ path: path });
}