Overriding a callback function – Echelon ISI User Manual
Page 64

ISI Programmer’s Guide
62
Overriding a Callback Function
You can have the ISI engine call functions in your application in response to key
ISI events. These functions are called
callback functions
, because the ISI engine
calls back to your application. To simplify the use of callback functions, the ISI
library includes implementations of all ISI API callback functions. As a result,
you do not have to provide any callback functions. For example, the ISI library
contains a default implementation of the IsiUpdateUserInterface() callback
function. In this case, the default implementation does nothing. To create your
own IsiUpdateUserInterface() function, override the function with your own
application-specific implementation.
Other common callback functions are the IsiGetAssembly() and
IsiGetNextAssembly() functions. You can override these functions to create
application-specific connections.
To override a default implementation, redefine the function with a matching
name and prototype in your application. When the linker recognizes a function
within the application space, it will no longer link the implementation contained
in the library.
When overriding a callback function, avoid calling ISI functions or initiating
time-consuming operations from the override function. Doing so may cause the
ISI engine to function incorrectly. The exceptions to this are when the function
simply returns a flag, such as IsiIsRunning() and IsiIsBecomingHost(), or when
the function is intended to be called from a callback function, like
IsiInitiateAutoEnrollment().
The following table lists the callback functions implemented in the ISI library
and the reasons to override each one.
Function Name
Reason to Override
IsiCreateCsmo()
Override this function to host connections
that offer more than the default
information, which is the following: the
group ID returned by the
IsiGetPrimaryGroup() function, the
Application field determined by the device’s
program ID, the Width field set by the value
returned by IsiGetWidth(), the Direction
field set to isiDirectionAny, the NvType field
set to the primary network variable’s SNVT
ID, and all other fields set to zero.yyy
IsiCreatePeriodicMsg()
This function is used to determine when a
device should send a periodic message. It
should only be overridden if a device needs a
hook into the periodic message scheduler.