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.
// 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
// 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
cs
Name
Fired when the monitor object attaches/detaches itself to/from the serial device.
// 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
Name
ProcessId
Fired when the device is opened by the monitored application.
// This method is not available in scripting environment
void OnClose(DateTime time);
// This method is not available in native environment
time
Fired when the device is closed by the monitored application.
// This method is not available in scripting environment
void OnRead(DateTime time, Array array);
// This method is not available in native environment
time
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]);
};
// This method is not available in scripting environment
void OnWrite(DateTime time, Array array);
// This method is not available in native environment
time
array
Called when the monitored application is writing data.
// This method is not available in scripting environment
void OnTransmit(DateTime time, Array array);
// This method is not available in native environment
time
array
Called when the monitored application is transmitting data.
// 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
BaudRate
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.
// 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
Eof
Error
Break
Event
Xon
Xoff
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.
// 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
Errors
HoldReasons
AmountInInQueue
AmountInOutQueue
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.
// 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
DTR
RTS
Fired when the monitored application retrieves DTR and RTS line states.
// 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
ControlHandShake
FlowReplace
XonLimit
XoffLimit
bGet
true
if the application reads the handshake information or false
otherwise.// 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
Fired when the monitored application retrieves/sets the line control options (such as stop bits, parity and word length).
// 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
ReceivedCount
TransmittedCount
FrameErrorCount
SerialOverrunErrorCount
BufferOverrunErrorCount
ParityErrorCount
Fired when the monitored application reads port statistics.
// 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
ReadIntervalTimeout
ReadTotalTimeoutMultiplier
ReadTotalTimeoutConstant
WriteTotalTimeoutMultiplier
WriteTotalTimeoutConstant
bGet
true
if the application reads this information or false
otherwise.Fired when the monitored application retrieves/sets port timeouts.
// 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
WaitMask
bGet
true
if the monitored application reads the wait mask or false
otherwise.Fired when the monitored application retrieves/sets the wait mask.
// This method is not available in scripting environment
void OnPurge(DateTime fTime, ${PURGE} Purge);
// This method is not available in native environment
fTime
Purge
Fired when the monitored application purges the port.
// 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
InSize
OutSize
Fired when the monitored application sets queue sizes.
// This method is not available in scripting environment
void OnSetBreak(DateTime fTime, bool bOn);
// This method is not available in native environment
fTime
bOn
true
if application sets the break signal, or false
otherwise.Fired when the monitored application sets/resets the break signal.
// This method is not available in scripting environment
void OnDTR(DateTime fTime, bool bSet);
// This method is not available in native environment
fTime
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.
// This method is not available in scripting environment
void OnReset(DateTime fTime);
// This method is not available in native environment
fTime
Fired when the monitored application resets the port.
// This method is not available in scripting environment
void OnRTS(DateTime fTime, bool bSet);
// This method is not available in native environment
fTime
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.
// This method is not available in scripting environment
void OnXOFF(DateTime fTime);
// This method is not available in native environment
fTime
Fired when the monitored application sends the XOFF character.
// This method is not available in scripting environment
void OnXON(DateTime fTime);
// This method is not available in native environment
fTime
Fired when the monitored application sends the XON character.
// This method is not available in scripting environment
void OnWaitOnMask(DateTime fTime, ${EVENTS} WaitMask);
// This method is not available in native environment
fTime
WaitMask
Fired when the monitored application waits on mask.
// This method is not available in scripting environment
void OnGetModemStatus(DateTime fTime, ${MODEMSTATUS} ModemStatus);
// This method is not available in native environment
fTime
ModemStatus
Fired when the monitored application reads the modem status.
// 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
PacketLength
PacketVersion
MaxTxQueue
MaxRxQueue
CurrentTxQueue
CurrentRxQueue
MaxBaudRate
ProviderType
ProviderCaps
ProviderSettableParams
SettableBaudRates
SettableData
SettableStopParity
Fired when the monitored application retrieves the comm properties.
// This method is not available in scripting environment
void OnClearStats(DateTime fTime);
// This method is not available in native environment
fTime
Fired when the monitored application clears the statistics.