Mynvupdateoccurred() – Echelon FTXL User Manual
Page 218
![background image](/manuals/735717/218/background.png)
206
Example FTXL Applications
This functional separation approach keeps changes to the LonTalk Interface
Developer utility-generated files to a minimum. For a production-level
application, you can place application-specific code wherever your application
design requires it.
For the dynamic interface example application, the following API event handler
functions have been implemented to provide application-specific behavior:
• LonReset(): This function is called when the device is reset. This
function calls myReset() in main.c. The myReset() function calls the
ProcessTypeChange() utility function.
• LonOnline(): This function is called when the device comes online. This
function calls myOnline() in main.c. The myOnline() function calls the
ProcessTypeChange() utility function.
• LonNvUpdateOccurred(): This function is called when the host processor
receives a network-variable update. This function calls the
myNvUpdateOccurred() function in main.c.
• LonNvAdded(): This function is called when a dynamic network variable
is added to the FTXL device. It is also called during device startup to
retrieve dynamic network variables that were created prior to device
reset. This function calls the myNvAdded() function in main.c.
• LonNvTypeChanged(): This function is called when the any of the
attributes of a dynamic network variable change. This function calls the
myNvTypeChanged() function in main.c.
• LonNvDeleted(): This function is called when a dynamic network
variable is deleted. This function calls the myNvDeleted() function in
main.c.
myNvUpdateOccurred()
The myNvUpdateOccurred() function contains a C switch statement, which
contains three case statements and a default statement to process the following
types of updates:
• A change to the nciNvType configuration network variable (CPNV),
which controls the type of the nviVolt and nvoVoltFb network variables.
• A change to the node object’s nviRequest network variable, which controls
the status of the FTXL device’s functional blocks.
• A change to the voltage amplifier’s nviVolt network variable, which
controls the application’s behavior as a voltage amplifier.
• Any other change, which is processed as a dynamic network variable
update. The change is ignored if it does not affect the logical circuit
defined for tracking the device’s aggregated current usage (that is, the
dynamic network variable is not of type SNVT_amp and named according
the required naming convention).
The case statement for the nciNvType CPNV (specified by the
LonNvIndexNciNvType network variable index) calls the ProcessTypeChange()
utility function.
The case statement for the nviRequest CPNV (specified by the
LonNvIndexNviRequest network variable index) performs the following tasks: