Handling management commands, Sending an application message to the network, Receiving an application message from the network – Echelon FTXL User Manual
Page 106
![background image](/manuals/735717/106/background.png)
94
Developing an FTXL Application
Sending an Application Message to the
Network
Call the LonSendMsg() function to send an application message. This function
forwards the message to the FTXL LonTalk protocol stack, which in turn
transmits the message on the network. After the message is sent, the FTXL
LonTalk protocol stack calls the LonEventReady() callback handler function to
inform the application that an event has been enqueued. When the application
calls the LonEventPump() function, the FTXL LonTalk API calls your
LonMsgCompleted() event handler function. This function notifies your
application of the success or failure of the transmission. You can use this
function for any application-specific processing of message transmission
completion.
To be able to send an application message, the FTXL device must be configured
and online. If the application calls the LonSendMsg() function when the device is
either not configured or not online, the function returns the LonApiOffline error
code.
You can send an application message as a request message that causes the
generation of a response by the receiving device or devices. If you send a request
message, the receiving device (or devices) sends a response (or responses) to the
message. When the FTXL Transceiver receives a response, it enqueues the
response and calls the LonEventReady() callback handler function to inform that
application that an event has been enqueued. When the application calls the
LonEventPump() function, the FTXL LonTalk API calls your
LonResponseArrived() event handler function for each response it receives.
Receiving an Application Message from the
Network
When the FTXL LonTalk protocol stack receives an application message from the
network, it forwards the message to the LonEventPump() function in the FTXL
LonTalk API, which in turn calls your LonMsgArrived() callback handler
function. Your implementation of this function must process the application
message.
The FTXL LonTalk protocol stack does not call the LonMsgArrived() callback
handler function if an application message is received while the FTXL device is
either unconfigured or offline.
If the message is a request message, your implementation of the
LonMsgArrived() callback handler function must determine the appropriate
response and send it using the LonSendResponse() function.
Handling Management Commands
L
ON
W
ORKS
installation and maintenance tools use network management
commands to set and maintain the network configuration for a device. The FTXL
LonTalk protocol stack automatically handles most network management
commands that are received from these tools. A few network management
commands might require additional application-specific processing, so the FTXL
LonTalk API forwards the request to your application through the network