Defining host network variables, Using message monitor points – Echelon LNS User Manual

Page 238

Advertising
background image

LNS Programmer's Guide

224

4. You can now control the input network variables on the network by

writing to the host network variable on the PC. Or, you can monitor value
changes on the device network variables though the

OnNvMonitorPointUpdateEvent

event.

Defining Host Network Variables

An LNS application can dynamically create and delete local host network variables (i.e.

network variables on the Network Service Device being used by the LNS application). All
host network variables become part of the local Network Service Device’s main interface,

which is accessible by reading the

Interface

property contained in the

NetworkServiceDevice

object’s

AppDevice

object. It is not possible to add network

variables directly to the main interface.

However, you can add network variables to custom

Interface

objects created by LNS

applications. To do so, use the

Interfaces

collection returned by the

NetworkServiceDevice

object’s

Interfaces

property. For more information on

custom interfaces, including how to add and remove network variables from them, see
Using Dynamic Device Interfaces on page 179.

Using Message Monitor Points

LNS supports the transmission and receipt of application messages and foreign frame

messages. Application messages and foreign frame messages are network messages that

do not relate to network variables, network management or diagnostic services.
Application messages use a 0x00...0x3E message code range, and are sometimes used for

non-interoperable data exchange. Foreign frame messages use the 0x40...0x4E message

code range and are sometimes used when tunneling packets related to other
communication protocols through a L

ON

W

ORKS

network. This allows you to use your

application to monitor and control devices that use application messaging.

Application messages are explicitly constructed in the transmitting device, unlike

network variable messages, which are implicitly constructed by writing to a network

variable or by calling library functions. Message monitoring is implemented by
connecting an output message tag on a device on the network to an input message tag on

the LNS application’s Network Service Device. Note that application messages cannot be

polled, and therefore application message monitoring always requires a bound
connection.

Message control is implemented with message monitor points. You can use the message

monitor points to send explicit messages to the device synchronously or asynchronously.

When using message monitor points, you should note that the maximum size of any
application message is usually 40 bytes. However, this varies depending on the network

buffers and the application buffers in the network interface you are using, as well as on

any network or application buffers in any intervening routers along the message’s path,
and in the application device that is receiving the message. If a message fails as a result

of being too large, the failure will appear to be the same as any communication failure,

and the device receiving the message will not respond. As a result, you should be careful
not to exceed your available network resources when creating an application to send

application messages.

Advertising