Openldv adapter, Operator class, Dispatcher class – Echelon Mini EVK User Manual

Page 96: Connector wrapper class, Sessioneventtrap class

Advertising
background image

OpenLDV Adapter

This section describes the classes and files of the Monitoring & Control Example

Application that invoke the OpenLDV API.

Operator Class

The Operator class is derived from the Dispatcher class. It completes the

dispatching of uplink messages, and processes complex operations messages. It

also overrides some of the virtual methods to stop uplink data from propagating
into the client application. The Operator also contains transaction services like

the NiSendMsgWait() class, which handles outgoing messages (addressed to the
local network interface or a remote device by subnet/node, Neuron ID, and

broadcast) and waits for completion messages.

Dispatcher Class

The Dispatcher class is derived from the Connector class. It completes the
dispatching of uplink messages. All uplink dispatching follows the same scheme:

a related virtual method is called, where the default implementation (provided in

this class) fires the related On* event. The Dispatcher class is an example for
an application- specific message dispatcher. It can be re-written to adapt to each

specific application.

Connector Wrapper Class

The Connector class is a Microsoft .NET wrapper that is built on top of the

OpenLDV API. The Connecter class provides an interface via the Open, Close,

Read and Write methods.

The class further provides thread-safe, synchronized access to the downlink

message path (ldv_write). The Connector class also implements and controls an
uplink reader thread (Listener method), which fetches packets from the interface

(ldv_read), deciphers the uplink data, and then dispatches it to the relevant

event handler.
The Connector example class also implements the low-level uplink data

notification, so that the application’s user interface can subscribe to the event to
trace the incoming/outgoing packets.

SessionEventTrap Class

The SessionEventTrap class captures xDriver session events. xDriver is a

component of OpenLDV that is used to manage connections to remote network
interfaces such as the i.LON 100 Internet Server. These events require a valid

window handle, which is the reason that this class is derived from the
System.Windows.Forms.Form form and implemented as a hidden form. The

form captures the xDriver session events, and relays them back to the Connector

class, which then fires the OnSesionChange event for client notification.

90

Mini EVK User’s Guide

Advertising