Using snmp support, Example fpm applications and drivers – Echelon i.LON SmartServer 2.0 User Manual
Page 116

102
Creating Freely Programmable Modules
• Add your user help functions to the UFPT<FPM>_Utils.cpp file (this file is created when you
create a new FPM project). This further isolates your code for debugging, and it enables you to
port the code over to another FPM project.
• Insert printf()statements in your code frequently. This enables you to do some debugging
with the console port of the i.LON during runtime, as the console port will receive the
printf()
statements. The following example demonstrates a printf()statement that you can
use to debug your code.
printf("[%s %i] value of %s: %d",
__FILE__,
__LINE__,
in1.GetDpPropertyAsString(FPM::Dp::cfgUCPTname),
*in1);
Note that console port displays the status of your FPMs during a reboot.
It is especially important to follow these guidelines because the compiler errors you may receive may
only have a generic description that does not indicate which line of code caused the error. In addition,
the errors may not appear on the actual line of code causing the error; instead, an error may appear one
or two lines above the incorrect code.
Using SNMP Support
You can create an FPM that provides SmartSever system information via the Simple Network
Management Protocol (SNMP). To do this, you use the i.LON SmartServer 2.0 Programming Tool
and a VxWorks 6.2 Development Tool that includes the SNMP v1/v2c or v3 agent components (for
example, PID 3.2 including the GNU compiler). The SmartServer does not support eXtensible agent
(AgentX) components.
The following table lists the default SmartServer system information that you can provide over SNMP:
System
Description and name of the Smart Server and other information.
Interfaces
IP interface information such as speed and address.
IP address table
Internal IP address table on the SmartServer.
Route Entries
The routing table of the SmartServer.
You can use the VxWorks SNMP API provided by a VxWorks 6.2 Development Tool to change the
management information base (MIB-II) configuration that is complied in the SmartServer’s
i.LonSystem image. You can add or delete MIB-II tree elements, and then map these elements to data
points in an FPM application running on the SmartServer. You can then read and write to these data
points over SNMP. You can also the SNMP trap service to send messages or alarms from an FPM
application running on a SmartServer to an external SNMP trap server.
For more information on SNMP programming, see the
Guide 10.0.
The LonWorks\iLON\Development\eclipse\workspace.fpm directory on your computer contains
example SNMP client and server FPMs. You can upload these FPMs to your SmartServer and run
them, or you can edit the project files for each example to see how they are implemented.
Example FPM Applications and Drivers
The LonWorks\iLON\Development\eclipse\workspace.fpm directory on your computer contains
one FPM application example and one FPM driver example, in addition to the example SNMP client
and server FPMs mentioned in the previous section. You can upload these FPMs to your SmartServer
and run them, or you can edit the project files for each example to see how they are implemented. The
FPM examples are listed below:
• Rs232Driver. This FPM driver demonstrates how to read and write data from a RS-232 interface.