Echelon OpenLDV User Manual

Page 141

Advertising
background image

OpenLDV Programmer’s Guide

133

Windows Vista or Windows 7: \Users\Public\Documents

\LonWorks\OpenLDV SDK\xDriver API Examples

Windows XP: \Documents and Settings\All Users\Documents

\LonWorks\OpenLDV SDK\xDriver API Examples

The example applications are also installed as a ZIP file in the L

ON

W

ORKS

\OpenLDV SDK\SourceArchive folder on your computer. The ZIP file is

named xDriverApiExamplesSource_vn.nn.nnn.ZIP file (where n.nn.nnn

represent the current version and build of the OpenLDV SDK).
The C++ sample program uses a comma-separated variable (CSV) file as its

database to store the SCO information for the lookup extension. Because the

database is a CSV file, the sample program uses standard file I/O methods for

managing the database.
The Visual Basic sample program uses ADO.NET to connect to a database that

stores the information that the lookup extension must fill into the SCO each time

an xDriver connection is initiated. It retrieves this information from the

database using standard ADO techniques, and uses the properties and methods

of the xDriver type library to fill this information into the SCO.
ADO.NET can use either SQL or OLE connections to access a database. In

general, you use only one connection type to access your database, but this

sample is coded to implement either connection type on a per-session basis.

Comments are included within the programming sample to provide further

guidance.
If you are using an LNS Server, for a downlink session, the sample lookup

extension component is launched by an LNS application after the System object

for the remote network is opened. The New() function is called first. The

SetInstance and the SetOptions functions are called next to initialize the SCO

with any user-defined parameters. If parameters are not specified, predefined

defaults are used. The DownlinkLookup() function is then called by the

xDriver manager automatically, and the downlink lookup key is extracted from

the passed-in SCO. The downlink lookup key is used to locate the database record

for the RNI. The UpdateSCO() helper function, which extracts the required

fields from the located database record and fills them into the SCO, is then

called.
If you are using an LNS Server, for an uplink session, the sample lookup

extension component is launched when the uplink session request is received by

the LNS Server. The New() function is called first. The SetInstance and the

SetOptions functions are called next to initialize the SCO with user-defined

parameters. If parameters are not specified, predefined defaults are used. The

UplinkLookup() function is then called by the xDriver automatically, and the

uplink lookup key is extracted from the passed-in SCO. The uplink lookup key is

used to locate the database record for the RNI that has requested the uplink

session. The UpdateSCO() helper function, which extracts the required fields

from the located database record and fills them into the SCO, is then called.
The UpdateLookup function is called after the SCO has been filled in during an

xDriver session if the current and next authentication keys filled in differ, which

indicates that a change to the authentication key used by the RNI is required.

The UpdateLookup function must be coded to implement an update to the

xDriver database to reflect this change. The xDriver database must always store

the correct values of the current and next authentication keys for an RNI, and

Advertising