Ip 852 router example application details, Ip-852 router example application details – Echelon LonTal Stack User Manual

Page 227

Advertising
background image

LonTalk Stack Developer’s Guide

215

4. Run the LonWorks Interface Developer by double-clicking the Simple

Example.lidprj file. This generates an updated application framework.

5. Modify the callback handler functions in the FtxlHandlers.c and

main.c files as required.

6. Rebuild the project.
7. Optionally, load the generated XIF file into the Echelon Smart

Transceiver or Neuron Chip.

8. Load the new executable file into the host processor.

IP-852 Router Example Application Details

The IP-852 router example implements an IP-852 to native LonWorks router.
Router applications do not implement functional blocks, network variables, or

configuration properties or other objects used by device applications; therefore,

the IP-852 router project does not include a model file or a LID project.

The Ip852Router project is stored in the Examples\Ip852Router directory.

This folder contains the main application file (main.cpp), the Visual Studio

project file (Ip852Router.vcproj), and a ReadMe (Readme.txt).

The main.cpp file contains the main() function. The main() function performs

the following tasks:

1. Processes the command parameters: niName (the network interface name),

ipAddress (the IPV4 address in decimal dotted format), and port (the port

used by the device). Prints an error and returns if the parameters are
invalid.

2. Creates a LtLogicalChannel object, passing in the name of the network

interface. Essentially, this opens the native LonTalk network interface.

3. Reads the unique ID from the native LonWorks interface.

4. Creates a LtIp852Router object and starts the router by calling the object’s

Start() method with the following parameters:

• An ltAppIndex of 0. This the application index of the native LonWorks

side of the router. The LonTalk Stack requires an application index
whenever there is more than one stack. It is mainly used to store the

unique ID of the stack and to name persistence files.

LtUniqueId. The uniqueId of the native LonWorks side of the router.
pLtChannel. The pointer to the native LonWorks channel

• An ipAppIndex of 1

.

This is the application index of the IP-852 router

side.

ipUid

.

The unique ID of the IP-852 router side. This example uses a

dummy unique ID.

ipAddress

.

A 32-bit integer representing the IP address of the IP-852

router side.

ipPort. The port number on which the IP-852 router side is listening.

Advertising