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

_IMonitoringEvents Interface

An event source interface for managed and scripting clients. You do not explicitly implement this interface. It is usually implemented by the language runtime. You register the so-called “events”, one for each method of this interface to handle specific monitored requests.

This interface is used by managed clients. The language runtime usually uses the methods of this interface automatically, allowing the client to register events, callbacks or delegates, which are called when the Serial Monitoring Control library fires these events. There is a proprietary interface in each managed language to connect to event sources. You will see Microsoft C# examples in this documentation, for other languages, please consult their documentation for a proper syntax to handle events.

Declaration

// This interface is not available in scripting environment
public interface _IMonitoringEvents
{

    // Methods
    void ${OnConnection}(DateTime time, ${ConnectionState} cs, string Name);
    void ${OnOpen}(DateTime time, string Name, uint ProcessId);
    void ${OnClose}(DateTime time);
    void ${OnRead}(DateTime time, Array array);
    void ${OnWrite}(DateTime time, Array array);
    void ${OnTransmit}(DateTime time, Array array);
    void ${OnBaudRate}(DateTime time, uint BaudRate, bool bGet);
    void ${OnSerialChars}(DateTime fTime, byte Eof, byte Error, byte Break, byte Event, byte Xon, byte Xoff, bool bGet);
    void ${OnCommStatus}(DateTime fTime,
        uint Errors,
        uint HoldReasons,
        uint AmountInInQueue,
        uint AmountInOutQueue,
        bool EofReceived,
        bool WaitForImmediate);
    void ${OnDTRRTS}(DateTime fTime, bool DTR, bool RTS);
    void ${OnHandflow}(DateTime fTime, uint ControlHandShake, uint FlowReplace, uint XonLimit, uint XoffLimit, bool bGet);
    void ${OnLineControl}(DateTime fTime, uint WordLength, ${STOPBITS} StopBits, ${PARITY} Parity, bool bGet);
    void ${OnStats}(DateTime fTime,
        uint ReceivedCount,
        uint TransmittedCount,
        uint FrameErrorCount,
        uint SerialOverrunErrorCount,
        uint BufferOverrunErrorCount,
        uint ParityErrorCount);
    void ${OnTimeouts}(DateTime fTime,
        uint ReadIntervalTimeout,
        uint ReadTotalTimeoutMultiplier,
        uint ReadTotalTimeoutConstant,
        uint WriteTotalTimeoutMultiplier,
        uint WriteTotalTimeoutConstant,
        bool bGet);
    void ${OnWaitMask}(DateTime fTime, ${EVENTS} WaitMask, bool bGet);
    void ${OnPurge}(DateTime fTime, ${PURGE} Purge);
    void ${OnSetQueueSize}(DateTime fTime, uint InSize, uint OutSize);
    void ${OnSetBreak}(DateTime fTime, bool bOn);
    void ${OnDTR}(DateTime fTime, bool bSet);
    void ${OnReset}(DateTime fTime);
    void ${OnRTS}(DateTime fTime, bool bSet);
    void ${OnXOFF}(DateTime fTime);
    void ${OnXON}(DateTime fTime);
    void ${OnWaitOnMask}(DateTime fTime, ${EVENTS} WaitMask);
    void ${OnGetModemStatus}(DateTime fTime, ${MODEMSTATUS} ModemStatus);
    void ${OnGetProperties}(DateTime fTime,
        ushort PacketLength,
        ushort PacketVersion,
        uint MaxTxQueue,
        uint MaxRxQueue,
        uint CurrentTxQueue,
        uint CurrentRxQueue,
        ${BAUDRATES} MaxBaudRate,
        ${PROVIDERTYPE} ProviderType,
        ${PROVIDERCAPS} ProviderCaps,
        ${PROVIDERSETTABLE} ProviderSettableParams,
        ${BAUDRATES} SettableBaudRates,
        ${DATABITS_ST} SettableData,
        ${STOPPARITY_ST} SettableStopParity);
    void ${OnClearStats}(DateTime fTime);
}
// This interface is not available in native environment

_IMonitoringEvents Methods

OnConnection

// This method is not available in scripting environment
void OnConnection(DateTime time, ${ConnectionState} cs, string Name);
// This method is not available in native environment
time
The time of the event.
cs
The connection state. Indicates whether the monitor is connecting to the device, or disconnecting from it. See the ConnectionState enumeration for more information.
Name
The name of the serial device the monitor is connecting to (disconnecting from).

Fired when the monitor object attaches/detaches itself to/from the serial device.

OnOpen

// This method is not available in scripting environment
void OnOpen(DateTime time, string Name, uint ProcessId);
// This method is not available in native environment
time
The time of the event.
Name
String containing the name of the process opening the device.
ProcessId
The process identifier.

Fired when the device is opened by the monitored application.

OnClose

// This method is not available in scripting environment
void OnClose(DateTime time);
// This method is not available in native environment
time
The time of the event.

Fired when the device is closed by the monitored application.

OnRead

// This method is not available in scripting environment
void OnRead(DateTime time, Array array);
// This method is not available in native environment
time
The time of the event.
array
The data array. Contains the data read by the application in one function call. This parameter is a byte array.

Called when the monitored application is reading data.

Binding the OnRead event in C#:

// Binding the event handler
monitor.OnRead += (time, array)=>
{
	var data = (byte[]) array;	// cast the object array to the byte array
	for (int i = 0; i < data.Length; i++)	// read and process data
		ProcessCharacter(data[i]);
};

OnWrite

// This method is not available in scripting environment
void OnWrite(DateTime time, Array array);
// This method is not available in native environment
time
The time of the event.
array
The data array. Contains the data written by the application in one function call. This parameter is a byte array.

Called when the monitored application is writing data.

OnTransmit

// This method is not available in scripting environment
void OnTransmit(DateTime time, Array array);
// This method is not available in native environment
time
The time of the event.
array
The data array. Contains the data transmitted by the application in one function call. This parameter is a byte array.

Called when the monitored application is transmitting data.

OnBaudRate

// This method is not available in scripting environment
void OnBaudRate(DateTime time, uint BaudRate, bool bGet);
// This method is not available in native environment
time
The time of the event.
BaudRate
The baud rate to set or get.
bGet
true if application is reading current baud rate, or false if it is changing it.

Called when the monitored application retrieves/sets current baud rate.

OnSerialChars

// This method is not available in scripting environment
void OnSerialChars(DateTime fTime, byte Eof, byte Error, byte Break, byte Event, byte Xon, byte Xoff, bool bGet);
// This method is not available in native environment
fTime
The time of the event.
Eof
EOF character.
Error
ERROR character.
Break
BREAK character.
Event
EVENT character.
Xon
XON character.
Xoff
XOFF character.
bGet
true if application is reading special characters, or false if it is changing them.

Fired when the monitored application retrieves/sets special serial characters.

OnCommStatus

// This method is not available in scripting environment
void OnCommStatus(DateTime fTime,
    uint Errors,
    uint HoldReasons,
    uint AmountInInQueue,
    uint AmountInOutQueue,
    bool EofReceived,
    bool WaitForImmediate);
// This method is not available in native environment
fTime
The time of the event.
Errors
The number of errors for the port.
HoldReasons
The number of hold reasons on the port.
AmountInInQueue
Amount of data in the input queue, in bytes.
AmountInOutQueue
Amount of data in the output queue, in bytes.
EofReceived
true if the EOF has been received.
WaitForImmediate
true if the port is in wait state.

Fired when the monitored application reads the comm port status.

OnDTRRTS

// This method is not available in scripting environment
void OnDTRRTS(DateTime fTime, bool DTR, bool RTS);
// This method is not available in native environment
fTime
The time of the event.
DTR
DTR line state.
RTS
RTS line state.

Fired when the monitored application retrieves DTR and RTS line states.

OnHandflow

// This method is not available in scripting environment
void OnHandflow(DateTime fTime, uint ControlHandShake, uint FlowReplace, uint XonLimit, uint XoffLimit, bool bGet);
// This method is not available in native environment
fTime
The time of the event.
ControlHandShake
ControlHandShake
FlowReplace
FlowReplace
XonLimit
XonLimit
XoffLimit
XoffLimit
bGet
true if the application reads the handshake information or false otherwise.

OnLineControl

// This method is not available in scripting environment
void OnLineControl(DateTime fTime, uint WordLength, ${STOPBITS} StopBits, ${PARITY} Parity, bool bGet);
// This method is not available in native environment
fTime
The time of the event.
WordLength
Byte size.
StopBits
Stop bits. One of the values from the STOPBITS enumeration.
Parity
Parity. One of the values from the PARITY enumeration.
bGet
true if the application reads the line control settings, false if writes it.

Fired when the monitored application retrieves/sets the line control options (such as stop bits, parity and word length).

OnStats

// This method is not available in scripting environment
void OnStats(DateTime fTime,
    uint ReceivedCount,
    uint TransmittedCount,
    uint FrameErrorCount,
    uint SerialOverrunErrorCount,
    uint BufferOverrunErrorCount,
    uint ParityErrorCount);
// This method is not available in native environment
fTime
The time of the event.
ReceivedCount
The number of received bytes.
TransmittedCount
The number of transmitted bytes.
FrameErrorCount
The number of frame errors.
SerialOverrunErrorCount
The number of serial overrun errors.
BufferOverrunErrorCount
The number of buffer overrun errors.
ParityErrorCount
The number of parity errors.

Fired when the monitored application reads port statistics.

OnTimeouts

// This method is not available in scripting environment
void OnTimeouts(DateTime fTime,
    uint ReadIntervalTimeout,
    uint ReadTotalTimeoutMultiplier,
    uint ReadTotalTimeoutConstant,
    uint WriteTotalTimeoutMultiplier,
    uint WriteTotalTimeoutConstant,
    bool bGet);
// This method is not available in native environment
fTime
The time of the event.
ReadIntervalTimeout
Read interval timeout.
ReadTotalTimeoutMultiplier
Read total timeout multiplier.
ReadTotalTimeoutConstant
Read total timeout constant.
WriteTotalTimeoutMultiplier
Write total timeout multiplier.
WriteTotalTimeoutConstant
Write total timeout constant.
bGet
true if the application reads this information or false otherwise.

Fired when the monitored application retrieves/sets port timeouts.

OnWaitMask

// This method is not available in scripting environment
void OnWaitMask(DateTime fTime, ${EVENTS} WaitMask, bool bGet);
// This method is not available in native environment
fTime
The time of the event.
WaitMask
The wait mask. See the EVENTS enumeration.
bGet
true if the monitored application reads the wait mask or false otherwise.

Fired when the monitored application retrieves/sets the wait mask.

OnPurge

// This method is not available in scripting environment
void OnPurge(DateTime fTime, ${PURGE} Purge);
// This method is not available in native environment
fTime
The time of the event.
Purge
The bit mask indicating what data to purge. See the PURGE enumeration for more information.

Fired when the monitored application purges the port.

OnSetQueueSize

// This method is not available in scripting environment
void OnSetQueueSize(DateTime fTime, uint InSize, uint OutSize);
// This method is not available in native environment
fTime
The time of the event.
InSize
The size of the input queue.
OutSize
The size of the output queue.

Fired when the monitored application sets queue sizes.

OnSetBreak

// This method is not available in scripting environment
void OnSetBreak(DateTime fTime, bool bOn);
// This method is not available in native environment
fTime
The time of the event.
bOn
true if application sets the break signal, or false otherwise.

Fired when the monitored application sets/resets the break signal.

OnDTR

// This method is not available in scripting environment
void OnDTR(DateTime fTime, bool bSet);
// This method is not available in native environment
fTime
The time of the event.
bSet
true if the application sets the DTR line state, or false if the application resets it.

Fired when the monitored application sets/resets DTR line state.

OnReset

// This method is not available in scripting environment
void OnReset(DateTime fTime);
// This method is not available in native environment
fTime
The time of the event.

Fired when the monitored application resets the port.

OnRTS

// This method is not available in scripting environment
void OnRTS(DateTime fTime, bool bSet);
// This method is not available in native environment
fTime
The time of the event.
bSet
true if the application sets the RTS line state, or false if the application resets it.

Fired when the monitored application sets/resets RTS line state.

OnXOFF

// This method is not available in scripting environment
void OnXOFF(DateTime fTime);
// This method is not available in native environment
fTime
The time of the event.

Fired when the monitored application sends the XOFF character.

OnXON

// This method is not available in scripting environment
void OnXON(DateTime fTime);
// This method is not available in native environment
fTime
The time of the event.

Fired when the monitored application sends the XON character.

OnWaitOnMask

// This method is not available in scripting environment
void OnWaitOnMask(DateTime fTime, ${EVENTS} WaitMask);
// This method is not available in native environment
fTime
The time of the event.
WaitMask
The wait mask to wait. See the EVENTS enumeration for more information.

Fired when the monitored application waits on mask.

OnGetModemStatus

// This method is not available in scripting environment
void OnGetModemStatus(DateTime fTime, ${MODEMSTATUS} ModemStatus);
// This method is not available in native environment
fTime
The time of the event.
ModemStatus
The modem status is returned as a combination of flags in the MODEMSTATUS enumeration.

Fired when the monitored application reads the modem status.

OnGetProperties

// This method is not available in scripting environment
void OnGetProperties(DateTime fTime,
    ushort PacketLength,
    ushort PacketVersion,
    uint MaxTxQueue,
    uint MaxRxQueue,
    uint CurrentTxQueue,
    uint CurrentRxQueue,
    ${BAUDRATES} MaxBaudRate,
    ${PROVIDERTYPE} ProviderType,
    ${PROVIDERCAPS} ProviderCaps,
    ${PROVIDERSETTABLE} ProviderSettableParams,
    ${BAUDRATES} SettableBaudRates,
    ${DATABITS_ST} SettableData,
    ${STOPPARITY_ST} SettableStopParity);
// This method is not available in native environment
fTime
The time of the event.
PacketLength
The packet length, in bytes.
PacketVersion
The packet version.
MaxTxQueue
Maximum transmit queue size, in bytes.
MaxRxQueue
Maximum receive queue size, in bytes.
CurrentTxQueue
Current transmit queue size, in bytes.
CurrentRxQueue
Current receive queue size, in bytes.
MaxBaudRate
Maximum baud rate.
ProviderType
Provider type. See the PROVIDERTYPE enumeration for more information.
ProviderCaps
Provider capabilities. See the PROVIDERCAPS enumeration for more information.
ProviderSettableParams
Provider settable parameters. Indicates what port parameters may be set for a given device. See the PROVIDERSETTABLE enumeration for more information.
SettableBaudRates
The bit mask indicating what baud rates are supported for a given device. See the BAUDRATES enumeration for more information.
SettableData
The bit mask indicating what data bits are supported for a given device. See the DATABITS_ST enumeration for more information.
SettableStopParity
The bit mask indicating what stop bits and parity are supported for a given device. See the STOPPARITY_ST enumeration for more information.

Fired when the monitored application retrieves the comm properties.

OnClearStats

// This method is not available in scripting environment
void OnClearStats(DateTime fTime);
// This method is not available in native environment
fTime
The time of the event.

Fired when the monitored application clears the statistics.