Virtual Serial Port Tools - Advanced serial port configurations for your custom ports usage scenario
Download Virtual Serial Port Tools Hide this button

ISerialPortLibrary Interface

interface ISerialPortLibrary {
    // Properties
    ${compatibilityFlags}: ${CompatibilityFlags};

    // Methods
    ${createAliasPort}(port?: number | string): ${IAliasPortDevice};
    ${createBridgePort}(port?: number | string): ${IBridgePortDevice};
    ${createSharedPort}(port?: number | string, reserved?: boolean): ${ISharedPortDevice};
    ${createTcpPort}(port?: number | string): ${ITcpPortDevice};
    ${createRemotePort}(port?: number | string): ${IRemotePortDevice};
    ${createPipePort}(port?: number | string): ${IPipePortDevice};
    ${getRemoteSharedPortsJs}(hostName: string): ${IRemotePortDescription}[];
    ${getPortsJs}(type: ${SerialPortType}): ${IDevice}[];
    ${getPortsJs#getPortsJs1}(type: ${SerialPortType.Remote#SerialPortType}): ${IRemotePortDevice}[];
    ${getPortsJs#getPortsJs2}(type: ${SerialPortType.Shared#SerialPortType}): ${ISharedPortDevice}[];
    ${getPortsJs#getPortsJs3}(type: ${SerialPortType.Alias#SerialPortType}): ${IAliasPortDevice}[];
    ${getPortsJs#getPortsJs4}(type: ${SerialPortType.Bridge#SerialPortType}): ${IBridgePortDevice}[];
    ${getPortsJs#getPortsJs5}(type: ${SerialPortType.Pipe#SerialPortType}): ${IPipePortDevice}[];
    ${getPortsJs#getPortsJs6}(type: ${SerialPortType.Tcp#SerialPortType}): ${ITcpPortDevice}[];
    ${createTimeoutsObject}(readIntervalTimeout: number,
        readTotalTimeoutMultiplier: number,
        readTotalTimeoutConstant: number,
        writeTotalTimeoutMultiplier: number,
        writeTotalTimeoutConstant: number): ${ITimeouts};
    ${installLicenseFile}(path: string): void;
}
public interface ISerialPortLibrary
{
    // Properties
    ${CompatibilityFlags} ${compatibilityFlags} { get; set; }

    // Methods
    ${IAliasPortDevice} ${createAliasPort}(object port);
    ${IBridgePortDevice} ${createBridgePort}(object port);
    ${ISharedPortDevice} ${createSharedPort}(object port, bool reserved);
    ${ITcpPortDevice} ${createTcpPort}(object port);
    ${IRemotePortDevice} ${createRemotePort}(object port);
    ${IPipePortDevice} ${createPipePort}(object port);
    Array ${getRemoteSharedPorts}(string hostName);
    Array ${getPorts}(${SerialPortType} type);
    ${ITimeouts} ${createTimeoutsObject}(uint readIntervalTimeout,
        uint readTotalTimeoutMultiplier,
        uint readTotalTimeoutConstant,
        uint writeTotalTimeoutMultiplier,
        uint writeTotalTimeoutConstant);
    void ${addListener}(${ISerialPortLibraryListener} pListener);
    void ${removeListener}(${ISerialPortLibraryListener} pListener);
    void ${installLicenseFile}(string path);
    void ${installLicenseInMemory}(byte[] data);
}
struct ISerialPortLibrary : IDispatch
{
    // Properties
    ${CompatibilityFlags} ${compatibilityFlags};  // get set 

    // Methods
    ${IAliasPortDevicePtr#IAliasPortDevice} ${createAliasPort}(const _variant_t & port);
    ${IBridgePortDevicePtr#IBridgePortDevice} ${createBridgePort}(const _variant_t & port);
    ${ISharedPortDevicePtr#ISharedPortDevice} ${createSharedPort}(const _variant_t & port, VARIANT_BOOL reserved);
    ${ITcpPortDevicePtr#ITcpPortDevice} ${createTcpPort}(const _variant_t & port);
    ${IRemotePortDevicePtr#IRemotePortDevice} ${createRemotePort}(const _variant_t & port);
    ${IPipePortDevicePtr#IPipePortDevice} ${createPipePort}(const _variant_t & port);
    SAFEARRAY(${IRemotePortDescription}) ${getRemoteSharedPorts}(_bstr_t hostName);
    SAFEARRAY(${IDevice}) ${getPorts}(${SerialPortType} type);
    ${ITimeoutsPtr#ITimeouts} ${createTimeoutsObject}(unsigned readIntervalTimeout,
        unsigned readTotalTimeoutMultiplier,
        unsigned readTotalTimeoutConstant,
        unsigned writeTotalTimeoutMultiplier,
        unsigned writeTotalTimeoutConstant);
    HRESULT ${addListener}(${ISerialPortLibraryListener *#ISerialPortLibraryListener} pListener);
    HRESULT ${removeListener}(${ISerialPortLibraryListener *#ISerialPortLibraryListener} pListener);
    HRESULT ${installLicenseFile}(_bstr_t path);
    HRESULT ${installLicenseInMemory}(SAFEARRAY(BYTE) data);
};

ISerialPortLibrary Properties

compatibilityFlags

compatibilityFlags: ${CompatibilityFlags};
${CompatibilityFlags} compatibilityFlags { get; set; }
${CompatibilityFlags} compatibilityFlags;  // get set 

Zero or more of compatibility flags that can be set to increase compatibility with legacy software.

ISerialPortLibrary Methods

createAliasPort

createAliasPort(port?: number | string): ${IAliasPortDevice};
${IAliasPortDevice} createAliasPort(object port);
${IAliasPortDevicePtr#IAliasPortDevice} createAliasPort(const _variant_t & port);
port
Port number or a string formatted as COMn. If omitted, a next available port number is automatically selected.

The method returns a reference to created port device.

Create new alias virtual serial port.

createBridgePort

createBridgePort(port?: number | string): ${IBridgePortDevice};
${IBridgePortDevice} createBridgePort(object port);
${IBridgePortDevicePtr#IBridgePortDevice} createBridgePort(const _variant_t & port);
port
Port number or a string formatted as COMn. If omitted, a next available port number is automatically selected.

The method returns a reference to created port device.

Create new virtual serial port that will act as one of the local bridge sides.

createSharedPort

createSharedPort(port?: number | string, reserved?: boolean): ${ISharedPortDevice};
${ISharedPortDevice} createSharedPort(object port, bool reserved);
${ISharedPortDevicePtr#ISharedPortDevice} createSharedPort(const _variant_t & port, VARIANT_BOOL reserved);
port
Port number or a string formatted as COMn. If omitted, a next available port number is automatically selected.
reserved
This parameter is reserved, you must pass false to it, or omit entirely.

The method returns a reference to created port device.

Create new shared virtual serial port.

createTcpPort

createTcpPort(port?: number | string): ${ITcpPortDevice};
${ITcpPortDevice} createTcpPort(object port);
${ITcpPortDevicePtr#ITcpPortDevice} createTcpPort(const _variant_t & port);
port
Port number or a string formatted as COMn. If omitted, a next available port number is automatically selected.

The method returns a reference to created port device.

Create new TCP virtual serial port.

createRemotePort

createRemotePort(port?: number | string): ${IRemotePortDevice};
${IRemotePortDevice} createRemotePort(object port);
${IRemotePortDevicePtr#IRemotePortDevice} createRemotePort(const _variant_t & port);
port
Port number or a string formatted as COMn. If omitted, a next available port number is automatically selected.

The method returns a reference to created port device.

Create new remote virtual serial port.

createPipePort

createPipePort(port?: number | string): ${IPipePortDevice};
${IPipePortDevice} createPipePort(object port);
${IPipePortDevicePtr#IPipePortDevice} createPipePort(const _variant_t & port);
port
Port number or a string formatted as COMn. If omitted, a next available port number is automatically selected.

Create new pipe virtual serial port.

getRemoteSharedPorts

// This method is not available in scripting environment
Array getRemoteSharedPorts(string hostName);
SAFEARRAY(${IRemotePortDescription}) getRemoteSharedPorts(_bstr_t hostName);
hostName
Name of the remote host which ports you want to enumerate.

Method returns an array of IRemotePortDescription objects containing all shared ports on a remote server.

Get a list of all shared serial ports on a remote server specified by hostname parameter.

getRemoteSharedPortsJs

getRemoteSharedPortsJs(hostName: string): ${IRemotePortDescription}[];
// This method is not available in managed environment
// This method is not available in native environment
hostName
Name of the remote host which ports you want to enumerate.

Method returns an array of IRemotePortDescription objects containing all shared ports on a remote server.

Get a list of all shared serial ports on a remote server specified by hostname parameter.

getPorts

// This method is not available in scripting environment
Array getPorts(${SerialPortType} type);
SAFEARRAY(${IDevice}) getPorts(${SerialPortType} type);
type
The type of port devices to return.

This method returns an array of all local virtual serial port devices of specified type.

getPortsJs

getPortsJs(type: ${SerialPortType}): ${IDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A type of virtual serial port to return.

This method returns an array of all local virtual serial port devices of specified type.

getPortsJs

getPortsJs(type: ${SerialPortType.Remote#SerialPortType}): ${IRemotePortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A remote virtual serial port type.

This method returns an array of all remote virtual serial port devices.

getPortsJs

getPortsJs(type: ${SerialPortType.Shared#SerialPortType}): ${ISharedPortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A shared virtual serial port type.

This method returns an array of all shared virtual serial port devices.

getPortsJs

getPortsJs(type: ${SerialPortType.Alias#SerialPortType}): ${IAliasPortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A alias virtual serial port type.

This method returns an array of all alias virtual serial port devices.

getPortsJs

getPortsJs(type: ${SerialPortType.Bridge#SerialPortType}): ${IBridgePortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A bridge virtual serial port type.

This method returns an array of all bridge virtual serial port devices.

getPortsJs

getPortsJs(type: ${SerialPortType.Pipe#SerialPortType}): ${IPipePortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A pipe virtual serial port type.

This method returns an array of all pipe virtual serial port devices.

getPortsJs

getPortsJs(type: ${SerialPortType.Tcp#SerialPortType}): ${ITcpPortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
A TCP/IP virtual serial port type.

This method returns an array of all TCP/IP virtual serial port devices.

createTimeoutsObject

createTimeoutsObject(readIntervalTimeout: number,
    readTotalTimeoutMultiplier: number,
    readTotalTimeoutConstant: number,
    writeTotalTimeoutMultiplier: number,
    writeTotalTimeoutConstant: number): ${ITimeouts};
${ITimeouts} createTimeoutsObject(uint readIntervalTimeout,
    uint readTotalTimeoutMultiplier,
    uint readTotalTimeoutConstant,
    uint writeTotalTimeoutMultiplier,
    uint writeTotalTimeoutConstant);
${ITimeoutsPtr#ITimeouts} createTimeoutsObject(unsigned readIntervalTimeout,
    unsigned readTotalTimeoutMultiplier,
    unsigned readTotalTimeoutConstant,
    unsigned writeTotalTimeoutMultiplier,
    unsigned writeTotalTimeoutConstant);
readIntervalTimeout
Read interval timeout.
readTotalTimeoutMultiplier
Read total timeout multiplier.
readTotalTimeoutConstant
Read total timeout constant.
writeTotalTimeoutMultiplier
Write total timeout multiplier.
writeTotalTimeoutConstant
Write total timeout constant.

This method creates a timeouts override object. Scripting languages may construct and assign timeouts override objects directly, while native and managed languages may use this helper method to create a pre-filled timeouts override object.

addListener

// This method is not available in scripting environment
void addListener(${ISerialPortLibraryListener} pListener);
HRESULT addListener(${ISerialPortLibraryListener *#ISerialPortLibraryListener} pListener);
pListener
Pointer or reference to the listener interface implemented by the caller.

Adds specified listener object to the list of listener objects. When new virtual serial devices are created or deleted, library calls methods of the supplied listener object, passing the list of affected devices.

removeListener

// This method is not available in scripting environment
void removeListener(${ISerialPortLibraryListener} pListener);
HRESULT removeListener(${ISerialPortLibraryListener *#ISerialPortLibraryListener} pListener);
pListener
Pointer or reference to the listener interface implemented by the caller.

Removes specified listener object from the list of listener objects.

installLicenseFile

installLicenseFile(path: string): void;
void installLicenseFile(string path);
HRESULT installLicenseFile(_bstr_t path);
path
A full path to license file.

Install the given license file. Throws an exception if an error occurs.

installLicenseInMemory

// This method is not available in scripting environment
void installLicenseInMemory(byte[] data);
HRESULT installLicenseInMemory(SAFEARRAY(BYTE) data);
data
License data in memory.

Install the license from the memory buffer.