Constant configuration properties – Echelon LonTal Stack User Manual
Page 114
102
Using the LonTalk Interface Developer Utility
resources. You can use any type of non-volatile memory, or any other media for
persistent data storage. The template file and the read-only value file would
normally be declared as const, and can be linked into a code segment, which
might relate to non-modifiable memory such as PROM or EPROM (these files
must not be changed at runtime). However, writable, non-volatile storage must
be implemented for the writable configuration property value file.
The details of such persistent storage are subject to the host platform
requirements and capabilities; persistent storage options include: flash memory,
EEPROM memory, non-volatile RAM, or storage in a file or database on a hard
drive.
You can specify initializers for network variables or configuration properties in
the model file. Alternatively, you can specify initializers for configuration
properties in the resource file that defines the configuration property type or
functional profile. For network variables without explicit initialization, the rules
imposed by your host development environment apply. These values might have
random content, or might automatically be preset to a well-defined value.
Constant Configuration Properties
In general, a configuration property can be modifiable, either from within the
LonTalk Stack application or from a network management tool. However, the
LonTalk Interface Developer utility declares constant configuration property files
as constants (using the C const keyword), so that they are allocated in
non-modifiable memory.
A special class of configuration properties is the device-specific configuration
property. A device-specific configuration property is considered variable to the
application (that is, your application can change it), but constant to the external
interface. These properties might, for example, be used to store calibration data
that is gathered during the device’s auto-tuning procedure.
However, a paradox arises because the network manager expects this
configuration property within the read-only value file, but the read-only value file
must be writable from the local application. This paradox is known as the
writeable read-only value file.
The LonTalk Stack presents the following solution to resolve this paradox:
• Before the inclusion of the FtxlDev.h header file into the FtxlDev.c file,
you can define the LON_READONLY_FILE_IS_WRITEABLE macro to
a value of 1 (one). If you do not define this macro, or define it to equate to
zero, the read-only value file is constant. This is the default state. The
LON_READONLY_FILE_IS_WRITEABLE macro is used within the
FtxlDev.h header to define the read-only file’s storage type with the
LON_READONLY_FILE_STORAGE_TYPE macro, which in turn is
used in declaration and specification of the lonReadOnlyValueFile
variable.
• 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.