Virtual Serial Port Tools - Advanced serial port configurations for your custom ports usage scenario
Docs

ISerialPortLibrary Interface

interface ISerialPortLibrary {
    // Methods
    ${createAliasPort}(port?: number | string): ${IAliasPortDevice};
    ${createSharedPort}(port?: number | string, reserved?: boolean): ${ISharedPortDevice};
    ${createRemotePort}(port?: number | string): ${IRemotePortDevice};
    ${getRemoteSharedPortsJs}(hostName: string): ${IRemotePortDescription}[];
    ${getPortsJs}(type: ${SerialPortType}): ${IRemotePortDevice}[];
    ${installLicenseFile}(path: string): void;
}
public interface ISerialPortLibrary
{
    // Methods
    ${IAliasPortDevice} ${createAliasPort}(object port);
    ${ISharedPortDevice} ${createSharedPort}(object port, bool reserved);
    ${IRemotePortDevice} ${createRemotePort}(object port);
    Array ${getRemoteSharedPorts}(string hostName);
    Array ${getPorts}(${SerialPortType} type);
    void ${addListener}(${ISerialPortLibraryListener} pListener);
    void ${removeListener}(${ISerialPortLibraryListener} pListener);
    void ${installLicenseFile}(string path);
    void ${installLicenseInMemory}(byte[] data);
}
struct ISerialPortLibrary : IDispatch
{
    // Methods
    ${IAliasPortDevicePtr#IAliasPortDevice} ${createAliasPort}(const _variant_t & port);
    ${ISharedPortDevicePtr#ISharedPortDevice} ${createSharedPort}(const _variant_t & port, VARIANT_BOOL reserved);
    ${IRemotePortDevicePtr#IRemotePortDevice} ${createRemotePort}(const _variant_t & port);
    SAFEARRAY(${IRemotePortDescription}) ${getRemoteSharedPorts}(_bstr_t hostName);
    SAFEARRAY(${IRemotePortDevice}) ${getPorts}(${SerialPortType} type);
    HRESULT ${addListener}(${ISerialPortLibraryListener *#ISerialPortLibraryListener} pListener);
    HRESULT ${removeListener}(${ISerialPortLibraryListener *#ISerialPortLibraryListener} pListener);
    HRESULT ${installLicenseFile}(_bstr_t path);
    HRESULT ${installLicenseInMemory}(SAFEARRAY(BYTE) data);
};

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.

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.

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.

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(${IRemotePortDevice}) 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}): ${IRemotePortDevice}[];
// This method is not available in managed environment
// This method is not available in native environment
type
The type of port devices to return.

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

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.