Serial Port Monitoring Control - ActiveX Component Library for RS232 Data Monitoring, API for Software Developers
Download Serial Port Monitoring Control Hide this button

IDevice Interface

This interface is implemented by the Serial Monitoring library for each registered serial device. Use this interface to query the serial device properties.

Declaration

interface IDevice {
    // Properties
    readonly ${Name}: string;
    readonly ${ConnectionString}: string;
    readonly ${Present}: boolean;
    readonly ${Type}: ${DeviceType};
    readonly ${Port}: string;
    readonly ${Icon}: number;
    readonly ${OpenedBy}: boolean;
}
public interface IDevice
{
    // Properties
    string ${Name} { get; }
    string ${ConnectionString} { get; }
    bool ${Present} { get; }
    ${DeviceType} ${Type} { get; }
    string ${Port} { get; }
    ulong ${Icon} { get; }
    bool ${OpenedBy} { get; }
}
struct IDevice : IDispatch
{
    // Properties
    _bstr_t ${Name};  // get 
    _bstr_t ${ConnectionString};  // get 
    VARIANT_BOOL ${Present};  // get 
    ${DeviceType} ${Type};  // get 
    _bstr_t ${Port};  // get 
    HICON ${Icon};  // get 
    VARIANT_BOOL ${OpenedBy};  // get 
};

IDevice Properties

Name

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

This property returns the string containing the device name. This name can be used only for identification purposes and shows the driver-assigned name for the serial device.

ConnectionString

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

Returns the device connection string. This is the preferred way to work with the serial devices in the native code. If you need to open the device in your code (instead of monitoring it), find the device using the Devices collection, and query its ConnectionString property. Then pass the returned string to the CreateFile Windows API function to get the handle to the device.

Present

readonly Present: boolean;
bool Present { get; }
VARIANT_BOOL Present;  // get 

The Serial Monitoring Control's devices collection always contains all serial devices registered in your system. Some of the devices may not be physically present or may be disabled in the Device Manager. However those devices are still present in the Devices collection, but the Present property is false for them. It is an error to try to attach the monitor object to the non-present device.

Type

readonly Type: ${DeviceType};
${DeviceType} Type { get; }
${DeviceType} Type;  // get 

This property contains the device's type. See the DeviceType enumeration for a list of possible values.

Port

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

Port name.

NOTE

For several kinds of serial devices this property returns an empty string. In this case use the ConnectionString property to get the correct device address.

Icon

readonly Icon: number;
ulong Icon { get; }
HICON Icon;  // get 

Use the returned icon handle to display the device class image. The icon is a system-defined icon for a device class (port or modem). You should not destroy the returned handle with a call to DestroyObject function.

OpenedBy

readonly OpenedBy: boolean;
bool OpenedBy { get; }
VARIANT_BOOL OpenedBy;  // get 

The Serial Monitoring Control lets you determine the name and process identifier of the process currently having the serial device opened. This property contains the name of the process which currently has the device opened. The returned string is in form processname (processid) where the processname is the name of the executable file (without extension) and processid is the numeric process identifier. Both values are the same as displayed by the Windows Task Manager. If the device is not currently opened by any process, the returned string is empty.