Configuration property syntax, Keywords – Echelon LonTal Stack User Manual
Page 183
LonTalk Stack Developer’s Guide
171
Network variable properties can be shared between two or more network
variables. The use of the global keyword creates a CP family member that is
shared between two or more network variables. The use of the static keyword
creates a CP family member that is shared between all the members of a network
variable array, but not with any other network variables outside the array.
Example:
// CP for heartbeat and throttle (default 1 min each)
SCPTmaxSndT cp_family cpMaxSendT = { 0, 0, 1, 0, 0 };
SCPTminSndT cp_family cpMinSendT = { 0, 0, 1, 0, 0 };
// NV with heartbeat and throttle:
network output SNVT_lev_percent nvoValue
nv_properties {
cpMaxSendT,
// override default for minSendT to 30 seconds:
cpMinSendT = { 0, 0, 0, 30, 0 }
};
Configuration Property Syntax
[ const ] type cp_family [ cp-modifiers ] identifier
[ [ array-bound ] ] [ = initial-value ] ;
The declaration for a configuration property is similar to a C language typedef
declaration because no actual variables are created as a result of the declaration.
In the case of a type definition, variables are instantiated when the type
definition is used in a later declaration that is not, itself, another typedef. At
that time, variables are instantiated, which means that variables are declared
and memory is allocated for and assigned to the variables. The variables can
then be used in later expressions in the executable code of the program.
The instantiation of CP family members occurs when the CP family declaration’s
identifier is used in a property list. However, a configuration network variable is
already instantiated at the time it is declared. For a configuration network
variable, the property list serves only to identify the association between the
configuration property and the object or objects to which it applies.
Configuration properties can apply to a device, one or more functional blocks, or
one or more network variables. In each case, a configuration property is made to
apply to its respective objects through a property list.
The brackets around array-bound are shown in bold type. The brackets do not,
in this case, indicate an optional field. They are a required part of the syntax for
declaring an array, and must be entered into the program code.
Keywords
const
Declares the configuration property as a constant, so that it is allocated in
non-modifiable memory.
In general, a configuration property can be modifiable, either from within the
LonTalk Stack application or from a network management tool, and thus is
not declared with this keyword.