Rejecting a type change, Handling dynamic network variables – Echelon LonTal Stack User Manual
Page 136
124
Developing a LonTalk Stack Device Application
callback handler function can report the correct current size for any implemented
network variable. Your myGetNvTypeCp() function could handle that
mapping.
For the convenience of network management tools, you can also declare a
SCPTmaxNVLength configuration property to inform the tools of the maximum
type length supported by the changeable-type network variable. For example:
network input cp SCPTnvType nciNvType;
const SCPTmaxNVLength cp_family nciNvMaxLength;
network output changeable_type SNVT_volt_f nvoVolt
nv_properties {
nciNvType,
nciNvMaxLength=sizeof(SNVT_volt_f)
};
Rejecting a Type Change
If a network management tool attempts to change the type of a changeable-type
network variable to a type that is not supported by the application (or is an
unknown type), your application must do the following:
• Report the error within a maximum of 30 seconds from the receipt of the
type change request. The application should signal an invalid_request
through the Node Object functional block and optionally disable the
related functional block. If the application does not include a Node Object
functional block, the application can set an application-specific error code
and take the device offline (use the offline parameter with the
LonSetNodeMode() function).
• Reset the SCPTnvType value to the last known good value.
• Reset all other housekeeping data, if any, so that the last known good
type is re-established.
Handling Dynamic Network Variables
To define the maximum number of supported dynamic network variables for your
LonTalk Stack device, you use the LonTalk Interface Developer utility (the
Application Configuration page) to specify the total number of dynamic variables
that the application supports. This number represents the application’s capacity
for dynamic network variables; the actual dynamic network variables are created
or deleted when the application is running. The process of managing dynamic
network variables is handled by the LonTalk host stack and the API, but to use
the dynamically created network variables, your application must respond to
related events.
The application must be able to handle the addition, modification, or deletion of
dynamic network variables. Dynamic network variable requests can come from a
network management tool or from another L
ON
W
ORKS
device on the network.
You must add code to the following event handler functions to support dynamic
network variables:
• LonNvAdded()
The LonTalk host stack calls this function when a dynamic network