function get(obj: object, path: string, forceReference?: boolean): any;
A first argument to a processPacket
method is a reference to an object that represents a bound packet to a custom view script. For performance reasons, parsed fields are not directly accessible to the script. Instead, it must call a get
function, passing it the bound packet object, a full path to the required field and an optional boolean
argument, which, being set to true
, forces the evaluation of the ref() function for the result.
function format(fmtString: string, ...values: any[]) : string;
format
function takes a format string and a list of arguments to substitute in a format string and returns a resulting string.
Visualizer Host is an object accessible to a custom view script via a global variable nvis
. It implements the following interface:
interface IVisualizerHost {
// Enable or disable line numbers and optionally set scheme for line numbers
enableLineNumbers(state: boolean, scheme?: number): void;
// Add new block, optionally set background color
addBlock(color?: number): void;
// Add text. '\n' character is used to separate lines
addText(text: string, scheme?: number): void;
// Low-level add text
addTextRaw(...args: (string | number | boolean)[]): void;
// Add a line break
addNewLine(): void;
// Add a dump
addDump(scheme: number, obj: object): void;
// Add a formatted table
addTable(nameScheme: number, valueScheme: number, ...rows: any[]): void;
// Format packet time
formatTime(entryTime: number, prevEntryTime: number): string;
// Get multi-source device name
getDeviceName(ordinal: number): string;
// Visualize bound field
visualize(obj: object): string;
// Control flow: set variable
setVariable(varName: string, varValue: number): void;
// Control flow: if
ifEq(varName: string, varValue: number): void;
// Control flow: if not
ifNotEq(varName: string, varValue: number): void;
// Control flow: end if
ifEnd(): void;
// Control flow: else
ifElse(): void;
}
enableLineNumbers
IVisualizerHost
interface that is allowed to be called outside of the execution of processPacket
method.addBlock
addText
'\n'
character. A second optional argument specifies the visual scheme (as an ordinal in visual scheme array) to be used to display the text. If omitted, the current scheme is used.addTextRaw
string
, a number
or a boolean
. If an argument is a string, it is added to the visualizer. Note that the string is not scanned for new line characters. A number changes the current visual scheme to a given one. A special value of -1 reverts the most recent visual scheme change. A boolean value (no matter whether it is true or false) adds a newline.addNewLine
addDump
addTable
formatTime
getDeviceName
visualize
setVariable
processPacket
is not guaranteed, preventing the custom view script of maintaining any inter-packet state. To overcome this limitation, a custom view script may have any number of named variables, access to which is synchronized. That means, that variable set during processing of packet N
is guaranteed to have the same value during processing of packet N+1
.ifEq
ifElse
or ifEnd
method is invoked.ifNotEq
ifElse
or ifEnd
method is invoked.ifEnd
ifElse
ifEnd
method is invoked.