Presentation layer, Overview of the openldv api – Echelon OpenLDV User Manual

Page 21

Advertising
background image

OpenLDV Programmer’s Guide

13

The OpenLDV API does not include an application layer. However, the

OpenLDV Developer Example demonstrates how to integrate an application

layer (which dispatches incoming messages to an application-specific message

dispatcher) with the OpenLDV API. For more information about the OpenLDV

Developer Example and the message dispatcher it employs, see Chapter 4, The

OpenLDV Developer Example, on page 89.

Presentation Layer

The presentation layer is responsible for translating messages between the lower

layers, providing an easier-to-use presentation format used by the application

layer. For example, all incoming network variable update messages from a

network interface are recognized by this layer, updating the application’s

network variable values and notifying the application layer of the change.
The presentation layer can also manage network management messages and

diagnostics services, such as the responses to Query SI network management

commands (see Receiving Messages from the Network Interface on page 75).
The OpenLDV API does not include a presentation layer. However, the

OpenLDV Developer Example demonstrates how to integrate a presentation

layer with the OpenLDV API. The OpenLDV Developer Example also includes

code that handles several network management commands and diagnostics.

Overview of the OpenLDV API

The OpenLDV API is implemented by a 32-bit C DLL that is compatible with

both 64- and 32-bit versions of Windows. All data types defined for the API

assume a 32-bit compiler; for example, pointers reference 32-bit addresses, each

enum is a 32-bit type, size_t is an unsigned 32-bit type, and so on. The

OpenLDV header file, ldv32.h, includes the following type definitions for native

data types, rather than using compiler-dependent types:

typedef void* PVOID;

typedef short SHORT; /* signed 16-bit */

typedef long

LONG;

/* signed 32-bit */

typedef unsigned char

BYTE;

/* unsigned 8-bit */

typedef unsigned short WORD;

/* unsigned 16-bit */

typedef unsigned long

DWORD; /* unsigned 32-bit */

typedef char* LPSTR;

typedef const char* LPCSTR;

typedef void* HANDLE;

Each function of the OpenLDV API uses extern “C” and __stdcall calling

conventions.
An alternative to the OpenLDV API is the COpenLDVapi class provided with

the OpenLDV developer example described in Chapter 4. This class provides a

COM interface with thread-safe, synchronized, access to downlink messages

(ldv_write()). The same interface also implements a reader thread,

COpenLDVreader, which queries uplink messages (ldv_read()) and supplies

data to a protected queue. The COpenLDVapi::Read() function queries that

queue, thereby providing coordinated access to both uplink and downlink

messages.

Advertising