User guide

70 How Devices Communicate Using Network Variables
configuration property access through LW-FTP and check, in the
stop_transfer( ) function, whether the SCPTnvType value has been
modified. Alternatively, you can implement the SCPTnvType
configuration property as a configuration network variable and check the
current type in the task for the nv_update_occurs(
cpnv-name
) event.
For example, the following code declares a changeable-type output
network variable with its SCPTnvType configuration property.
Example:
SCPTnvType cp_family cp_info(reset_required) nvType;
network output changeable_type SNVT_volt_f nvoValue
nv_properties { nvType };
4 You can optionally declare a SCPTmaxNVLength configuration property
that applies to the changeable-type network variable. This configuration
property can be used to inform network tools of the maximum type length
supported by the changeable-type network variable. This value is a
constant, so declare this configuration property with the const modifier.
For example, the following code adds a SCPTmaxNVLength configuration
property to the example in the previous step.
Example:
SCPTnvType cp_family cp_info(reset_required) nvType;
const SCPTmaxNVLength cp_family nvMaxLength;
network output changeable_type SNVT_volt_f nvoValue
nv_properties { nvType,
nvMaxLength=sizeof(SNVT_volt_f) };
5 Implement code in your Neuron C application to process changes to the
SCPTnvType value. The required code is described in the following
section.
Implement code to provide information about the current length of the
network variable to the Neuron firmware. This is described in
Processing
a Size Change
on page 74.
Implement your application’s algorithm such that it can process all
possible types the changeable-type network variable might use at
runtime. An example and fragment for such code is shown in
Changeable-Type Example
on page 75.
6 The LonMaker browser provides your integrators with a user interface to
change network variable types. You typically want a custom interface for
integrators to change network variable types on your device. For
example, the custom interface could restrict the available types to the
types supported by your application, thus preventing configuration
errors. To provide a custom interface, implement code in your plug-in to
provide an interface for users to change the network variable type. The
required plug-in code is discussed in the
LNS Plug-in Programmer’s
Guide
.
You cannot change the type of a configuration property unless it inherits its type
from a changeable-type network variable. In this case, the configuration