The network variable table, Network variable attributes – Echelon LonTal Stack User Manual

Page 115

Advertising
background image

LonTalk Stack Developer’s Guide

103

For the network management tool, however, the read-only file remains

non-writeable. If your application uses the direct memory files feature to access
the files, the LonTalk Interface Developer utility generates code that declares

this direct memory files window segment as non-modifiable. If your application

uses L

ON

W

ORKS

FTP to access the files, your implementation of the L

ON

W

ORKS

file transfer protocol and server must prevent write operations to the read-only

value file under all circumstances.

The Network Variable Table

The network variable table lists all the network variables that are defined by
your application. It contains a pointer to each network variable and the initial

(or declared) length of each network variable, in bytes. It also contains an
attribute byte that contains flags which define the characteristics of each

network variable.
The network variable table acts as a bridge between your application and the
LonTalk API. The LonTalk Interface Developer utility generates the network

variable table, along with the LonInit() function that reads the table and

register the network variables with the LonTalk API.

A LonTalk Stack application typically accesses a network variable value through

the C global variable that implements the network variable. However, the

LonTalk API also provides a function that returns the pointer to a network
variable’s value as a function of its index:

void* const LonGetNvValue(unsigned index);

You can use this function for any network variable, including static network

variables, dynamic network variables, and configuration property network
variables. The LonGetNvValue() function returns NULL for an invalid index,

or returns a pointer to the value.

For dynamic network variables, you must use the LonGetNvValue() function

because there is no global C variable or network variable table entry for a

dynamic network variable.

Network Variable Attributes

The network variable table (nvTable[])in the FtxlDev.c file includes a bitmask

for each network variable to define the network variable’s attributes, including,

for example, whether the network variable is:

• An output network variable
• Persistent
• Polled
• Synchronous
• Of changeable type

The FtxlTypes.h file defines the bitmasks for these attributes. For example,
LON_NV_IS_OUTPUT is the mask for an output network variable,

LON_NV_POLLED is the mask for a polled network variable, and so on.

The LonTalk API does not propagate a polled output network variable's value to

the network when your application calls the LonPropagateNv() function. For

Advertising