beautypg.com

The network variable table, Network variable attributes – Echelon FTXL User Manual

Page 83

background image

FTXL User’s Guide

71

• Defining the LON_READONLY_FILE_IS_WRITEABLE macro to 1

causes the read-only value file to be writeable by the local application.

Because it is now allocated in volatile memory, your driver for non-

volatile data must also be able to read and write the read-only value file.

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

FTXL 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 FTXL LonTalk API.
An FTXL application typically accesses a network variable value through the C
global variable that implements the network variable. However, the FTXL

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