Ldv_open_cap(), Syntax – Echelon OpenLDV User Manual

Page 33

Advertising
background image

OpenLDV Programmer’s Guide

25

the network interface enters an initial quiet mode (flush state) after a reset. To

start using such a network interface, the OpenLDV application must cancel the

quiet mode with the niFLUSH_CANCEL immediate network interface

command. For more information about immediate commands, see Immediate

Commands on page 77.
The OpenLDV API clears old data from internal buffers during processing of the

ldv_open() function before retrieving new data. Thus, your application does not

need to perform this task.
For xDriver-based remote network interfaces that use the xDriver default lookup

extension, the name specified as the id parameter should match an entry created

for a device with the L

ON

W

ORKS

Interfaces application in the Windows Control

Panel. See Chapter 5, Using the xDriver Default Profile, on page 93, for more

information. For xDriver-based remote network interfaces that use a custom

(non-default) xDriver profile with a custom lookup extension, the name specified

as the id parameter must exist in the custom database. See Chapter 6,

Extending xDriver, on page 99, for more information.
If you do not specify a valid network interface name as the id parameter when

you call this function, or if the network interface referenced by the id parameter

cannot be found, the LDV_INVALID_DEVICE_ID or

LDVX_INVALID_XDRIVER return code is returned.
Each network interface can only be part of one OpenLDV session at a time on a

particular computer. If you call this function for a network interface that is being

used by another process on your computer, the function will fail, and the

LDV_ACCESS_DENIED return code is returned.
If you use xDriver to open a remote network interface while a remote client on

another computer is using it, the call to ldv_open() might initially appear to

succeed. However, when you call ldv_read() or ldv_write() to read or write a

message to the network interface later, the LDVX_READ_FAILED or

LDVX_WRITE_FAILED failure code is returned, indicating that the session has

failed. The timing of the failure depends on the setting of the Synchronous

Timeout field of the xDriver profile that is handling the session. For more

information about xDriver profiles, see xDriver Profiles on page 134.

ldv_open_cap()

Call this function to establish communications between your application and a

network interface. Additionally, you can request an operational mode for the

network interface so that it opens in the specified mode. This function returns a

unique handle that you can provide to the other OpenLDV functions to identify

this instance of the network interface.

Syntax

LDVCode ldv_open_cap(

LPCSTR szDevice,

LdvHandle* pHandle,

LDVDeviceCaps nDeviceCaps,

HWND hWnd,

LONG tag

)

Advertising