Tasks performed by an ftxl application – Echelon FTXL User Manual

Page 92

Advertising
background image

80

Developing an FTXL Application

7. Calling the LonNvdExitTransaction() callback handler function to clear

the transaction.

8. Freeing the buffer that contains the serialized image.

The FTXL LonTalk protocol stack determines the size of the serialized image and

handles the serialization of the data for the LonNvdSegNetworkImage and
LonNvdSegNodeDefinition segments, but not for the application-defined

LonNvdSegApplicationData segment. Intstead, theFTXL LonTalk protocol stack
calls the LonNvdGetApplicationSegmentSize() callback handler function in step 1

above, and the LonNvdSerializeSegment() callback handler function during step

3 above when it processes the LonNvdSegApplicationData segment. Both of
these callback handler functions are generated by the LonTalk Interface

Developer utility.
The FTXL LonTalk protocol stack uses a low-priority operating system task or
thread (typically lower than the application task) to write NVD to persistent

memory. By using a low-priority task or thread, writing NVD should not block

the running of the application or the FTXL LonTalk protocol stack. In addition,
FTXL LonTalk protocol stack ensures that these NVD-management functions are

never called by more than one task or thread at a time.
The application can update configuration network variables (CPNVs) and user
files directly, without the FTXL LonTalk protocol stack’s knowledge. The

application must inform the FTXL LonTalk protocol stack when this occurs so
that the FTXL LonTalk protocol stack can manage the write transaction. Thus,

the application should call the LonNvdAppSegHasBeenUpdated() function to

initiate an NVD transaction for the application segment.

Tasks Performed by an FTXL Application

The main() function of an FTXL application typically performs only the following

actions:

1. Creates one or more operating system contexts (tasks or threads)

2. Starts the operating system (if it is not already started)

Within one of the newly created tasks, the application life cycle includes two

phases:

• Initialization
• Normal processing

The initialization phase of an FTXL application includes a call to the LonInit()

API function to initialize the FTXL LonTalk protocol stack and the FTXL

Transceiver. The initialization phase defines basic parameters for L

ON

W

ORKS

network communication, such as the communication parameters for the physical

transceiver in use, and defines the application’s external interface: its network
variables, configuration properties, and self-documentation data. Successful

completion of the initialization phase causes the FTXL Transceiver to leave Quiet

mode, after which it can send and receive messages over the network. During the
initialization phase, the application also creates at least one operating system

event (or other protected shared resource).
During normal processing, which is often implemented within an infinite loop,
the application waits for an operating system event whenever it is not busy.

When the event occurs, the application calls the LonEventPump() API function to

Advertising