Communicating with other devices using application, Messages – Echelon LonTal Stack User Manual
Page 137
LonTalk Stack Developer’s Guide
125
variable is added. On device startup, it calls this function for each
dynamic network variable that had been previously defined.
• LonNvTypeChanged()
The LonTalk host stack calls this function when a dynamic network
variable definition is changed.
• LonNvDeleted()
The LonTalk host stack calls this function when a dynamic network
variable is deleted.
For the LonNvAdded() and LonNvTypeChanged() event handler functions,
the LonTalk host stack passes the index value for the dynamic network variable,
and a pointer to the network variable’s attributes, such as direction, size, name,
and self-documentation string.
When a dynamic network variable is first added, the name and the
self-documentation string for the network variable might be blank. A network
management tool can update the name or the self-documentation string in a
subsequent network management message, for which the LonTalk host stack
calls the LonNvTypeChanged() event handler.
Communicating with Other Devices Using Application
Messages
Application messages are used to create both standard and proprietary (that is,
non-interoperable) interfaces for a device. You can use application messages for
standard interfaces such as L
ON
W
ORKS
FTP or LonMark data log transfer, and
you can use application messages if your device needs a proprietary interface
that does not need to interoperate with devices from other manufacturers, for
example, to implement a manufacturing-test interface that is only used during
manufacturing test of your device. You can also use the same mechanism that is
used for application messaging to create foreign-frame messages (for proprietary
gateways) and explicitly addressed network variable messages.
One interoperable use for application messages is to implement the L
ON
W
ORKS
file transfer protocol. This protocol is used to exchange large blocks of data
between devices or between devices and tools, and is also used to access
configuration files on some devices.
The content of an application message is defined by a message code that is sent as
part of the message. The message codes that are available for use by your
application are standard application messages and user-defined application
messages. User-defined application messages use message codes 0 to 47 (0x0 to
0x2F). Your application must define the meaning of each user-defined message
code. Standard application messages are defined by L
ON
M
ARK
International,
and use message codes 48 to 62 (0x30 to 0x3E).
The message code is followed by a variable-length data field, that is, a message
code could have one byte of data in one instance and 25 bytes of data in another
instance.