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

IDevice Interface

This is a base interface for all supported device types: alias, shared, remote and local bridge.

Declaration

interface IDevice {
    // Properties
    readonly ${port}: number;
    readonly ${devicePath}: string;
    readonly ${openingInfo}: ${IOpeningInfo};
    readonly ${compatibilityFlags}: ${CompatibilityFlags};
    ${isVolatile}: boolean;
    ${isUnlocked}: boolean;

    // Methods
    ${deleteDevice}(): void;
}
public interface IDevice
{
    // Properties
    uint ${port} { get; }
    string ${devicePath} { get; }
    ${IOpeningInfo} ${openingInfo} { get; }
    ${CompatibilityFlags} ${compatibilityFlags} { get; }
    bool ${isVolatile} { get; set; }
    bool ${isUnlocked} { get; set; }

    // Methods
    void ${deleteDevice}();
}
struct IDevice : IDispatch
{
    // Properties
    unsigned ${port};  // get 
    _bstr_t ${devicePath};  // get 
    ${IOpeningInfo} ${openingInfo};  // get 
    ${CompatibilityFlags} ${compatibilityFlags};  // get 
    VARIANT_BOOL ${isVolatile};  // get set 
    VARIANT_BOOL ${isUnlocked};  // get set 

    // Methods
    HRESULT ${deleteDevice}();
};

IDevice Properties

port

readonly port: number;
uint port { get; }
unsigned port;  // get 

Contains the port number assigned by the OS to the current virtual serial port device.

devicePath

readonly devicePath: string;
string devicePath { get; }
_bstr_t devicePath;  // get 

Contains the unique port path. This unique path may be passed to CreateFile function instead of usual COMn.

openingInfo

readonly openingInfo: ${IOpeningInfo};
${IOpeningInfo} openingInfo { get; }
${IOpeningInfo} openingInfo;  // get 

An object whose properties can be queried to get the information about the process that opened the port and current port parameters.

If the port is not currently opened, an exception is thrown.

compatibilityFlags

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

Virtual device compatibility flags.

isVolatile

isVolatile: boolean;
bool isVolatile { get; set; }
VARIANT_BOOL isVolatile;  // get set 

If set to true, the virtual serial device is volatile: the client application will only be able to open it if it is not locked (isUnlocked property is also true). The value of this property is persisted.

isUnlocked

isUnlocked: boolean;
bool isUnlocked { get; set; }
VARIANT_BOOL isUnlocked;  // get set 

Port opening attempts will fail if this property is false when isVolatile is true. For non-volatile ports the value of this property is ignored.

This property is not persisted. It is automatically set to false when the port device driver is restarted.

IDevice Methods

deleteDevice

deleteDevice(): void;
void deleteDevice();
HRESULT deleteDevice();

Call this method to delete the virtual serial port device. Actual device is deleted immediately (notifying any registered listeners through their ISerialPortLibraryListener.deleted method), however, the API device object is only destroyed when all references are released.

ISerialPortLibrary.getPorts and ISerialPortLibrary.getPortsJs methods do not list deleted devices, even if there are still references to them.