beautypg.com

Shutdown(), Fpm application example, Fpm driver example – Echelon i.LON SmartServer 2.0 User Manual

Page 222: Methods, Variable types, See methods fo

background image

208

Appendix A - Programmer’s Reference

Shutdown()

The Shutdown() routine in the .cpp file is called when your FPM stops or is disabled. You can use
the Shutdown () routine to stop timers and close RS-232 and RS-485 connections in an FPM driver.
In addition, you can use Shutdown() routine to free previously allocated memory and perform any
required cleanup before shutting down the FPM.

• You can stop a timer using use the Stop()and StopAllTimers()methods of the

CFPM_Timer

class.

• You can end communication between your FPM and the devices connected to the RS-232 and RS-

485 serial ports on the SmartServer using the rs232_close() and rs485_close()
methods. For more information on these methods, see RS-232 Interface Methods and RS-485
Interface Methods
later in this appendix.

FPM Application Example

The following example demonstrates code you could use in the Shutdown()routine of an FPM
Application. In this example, a timer is stopped.

void CUFPT_FPM_Application::Shutdown()

{

m_oTimer1.Stop;

}

FPM Driver Example

The following example demonstrates code you could use in the Shutdown()routine of an FPM
driver. In this example, the FPM closes the connection to an RS-232 interface and then stops all
running timers.

void CUFPT_FPM_Driver::Shutdown()

{
rs232_close(_rs232_fd);

StopAllTimers();

}

Methods

This section describes the methods provided by Echelon that you can use when writing the
Initialize()

, Work(), OnTimer(), and Shutdown() routines in your FPM. These methods

include data point methods, timer methods, RS-232 methods, and RS-485 methods.

Variable Types

The variable types that you can use when calling the Initialize(), Work(), OnTimer(), and
Shutdown()

routines in your FPM are listed in the following table. These variable types are defined

in the types_base.h file in the LonWorks\iLON\Development\compiler\echelon\fpm\include-4.03
and LonWorks\iLON\Development\compiler\echelon\fpm\include folders on your computer.

Variable Type

Size

Byte (equivalent to unsigned char) 8 Bits
unsigned char

8 Bits

char 8

Bits

unsigned short

16 Bits

short 16

Bits