Echelon OpenLDV User Manual

Page 157

Advertising
background image

OpenLDV Programmer’s Guide

149

close calls. The OpenLDV driver calls these driver functions to interact with the

custom network interface.
You can create an OpenLDV application that manages the custom network

interfaces supported by your custom Windows driver, similar to the Echelon

L

ON

W

ORKS

Interfaces application. The OpenLDV application should perform the

following basic tasks:

1. Create an LDVDriverInfo object:

a. Set the size equal to the struct size.
b. Set the id to any unused value > 127. Values less than 127 are

reserved for Echelon use.

c. Set the type to LDV_DRIVER_TYPE_LNI. This value specifies a

Windows device driver.

d. Set the name to a suitable name for your driver.
e. Set the desc to a suitable description for your driver.

LDVDriverInfo myDriver =

{ (DWORD)sizeof(LDVDriverInfo),

(LDVDriverID)myDriverID,

(LDVDriverType)LDV_DRIVER_TYPE_LNI,

(LPCSTR)myDriverName,

(LPCSTR)myDriverDesc

};

2. Call the ldv_set_driver_info() function:

LDVCode rc = ldv_set_driver_info(

myDriver.id,

*myDriver);

3. Create devices that use this driver.
4. Create an LDVDeviceInfo object:

a. Set the size equal to the struct size.
b. Set the driver to NULL. This parameter is ignored for the

ldv_set_device_info() function.

c. Set the name to a suitable name for your device. The name must

be unique for the computer. The name must not begin with “X.”

(that naming convention is reserved for xDriver devices). The

name can follow the “LON1” naming convention, but you must

ensure that no naming conflicts arise.

d. Set physName to a suitable physical name (matching the name

specified in your Windows driver) for the device. This name must

follow the Windows \\.\name.0 format. You can match the

physName parameter with the name parameter.

e. Set the desc to a suitable description for your device.
f. Set the caps to suitable capabilities for your device. For

example, your custom network interface might operate as a Layer

5 device and use the SICB data format, so you specify a logical

Advertising