Echelon OpenLDV User Manual Page 99

  • Download
  • Add to my manuals
  • Print
  • Page
    / 194
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 98
OpenLDV Programmer’s Guide 91
NiSendImmediate(), NiGetNextResponse(), NiSendResponse(), NiClose(),
and NiEncryption().
The OpenLDVni.h header file contains details about this class and its usage.
The COpenLDVni class also implements and controls a worker thread,
COpenLDVmessagePump. This thread operates as a message pump, receiving
and dispatching uplink messages from the COpenLDVapi class.
To dispatch an incoming message, a message dispatcher decodes the message,
takes appropriate action local to the OpenLDV application, and responds
accordingly to the network. For example, the incoming message might describe
an update to an input network variable. The message dispatcher for the
application receiving this message must recognize the message as a network-
variable update message, and route the new network-variable data to the
relevant application storage. Other message types might also cause interaction
with the network. For example, the application might receive a network-variable
fetch message. In this case, the dispatcher must obtain the current value of the
network variable in question, and report the value to the network by constructing
an appropriate response message.
The message pump thread in this example application uses the functions
provided by the COpenLDVni and COpenLDVapi classes to retrieve and
dispatch messages. These messages are sent using an NiDispatch method. The
COpenLDVni class specifies, but does not implement, such a NiDispatch
method. Therefore, the COpenLDVni class is an abstract C++ class.
The OpenLDV Developer Example implements an example for an application-
specific message dispatcher (COpenLDVexampleDispatcher), derived from
the COpenLDVni class, which implements the NiDispatch method.
The example dispatcher implements handlers for a variety of messages, including
handlers for selected network management and diagnostics messages such as
HandleQuerySnvt, HandleSetNodeMode, or HandleServicePin.
You can use the COpenLDVexampleDispatcher class as an example for your
OpenLDV application, but you must adapt and rewrite the dispatcher for the
application.
The OpenLDVexampleDispatcher.h header file and the
OpenLDVexampleDispatcher.cpp implementation file contain comments
that describe the details of the implementation.
Toolkits and User Interface
The OpenLDV Developer Example provides a simple user interface based on a
single dialog. The OpenLDV ExampleDlg.cpp implementation file contains
event handlers related to that user interface, such as the various click-event
handlers related to buttons. The same COpenLDV ExampleDlg class also
provides example instantiation of the above classes.
For most operations, however, the dialog uses the COpenLDVtools class as a
toolkit. This class provides a simple interface that implements selected
operations such as QueryDomain, LeaveDomain, or UpdateDomain. The
COpenLDvtools class also implements a FindDevices() function that
demonstrates the implementation of multi-transaction sequences within the
context of this framework.
Page view 98
1 2 ... 94 95 96 97 98 99 100 101 102 103 104 ... 193 194

Comments to this Manuals

No comments