Technical information

The RMS Enterprise SDK (v4)
33
RMS Enterprise - NetLinx Programmer’s Guide
For detailed information, please review the source code and code comments inside the RmsApi.axi Include File. Additionally,
please see the NetLinx Programming sections in this document where the usage of many of these functions in the RmsApi are
demonstrated:
See Programming - RMS Required Modules on page 45.
See Programming - Asset Management on page 47.
See Programming - Client Messaging on page 109.
See Programming - Advanced Topics on page 111.
RMS Event Listener
The RMS Event listener is a common Include File that is consumed by many components of the RMS Enterprise SDK. In a typical
user program you will most likely never need to interact with the RMS Event listener directly, because the RMS Enterprise SDK
wraps most of the necessary functionality into more convenient and abstract implementations.
However if you do require lower level access and integration with RMS, you can consume this Include File directly to listen for
RMS event notifications. The RMS Event listener listens for command data events directly on the RMS NetLinx virtual device API
and parses the event command data and finally invokes callback method calls to any subscribers. By default no RMS events are
monitored, your user code must subscribe for each particular event of interest that you want the RMS Event Listener to invoke a
callback method on.
The diagram in FIG. 14 illustrates the file dependency chain for the RmsEventListener Include File integration:
The code snippet below demonstrates how to subscribe for the System Power notification event.
// subscribe to system event notification callback methods
#DEFINE INCLUDE_RMS_EVENT_SYSTEM_POWER_CALLBACK;
// include RmsEventListener (which also includes RMS API)
#INCLUDE 'RmsEventListener';
If an event subscription compiler directive is included, then the user code must implement the required callback method so the
RMS Event Listener can perform the callback invocation. The following code snippet illustrates the required method that must be
included in the user code.
// include callback method for RmsEventListener to call
DEFINE_FUNCTION RmsEventSystemPowerChanged(CHAR powerOn)
{
}
A complete listing of eligible RMS notification events and their respective callback method signatures are included in the
comments inside the RMSEventListener.axi file.
FIG. 14 RMS SDK File Dependencies - Event Listener Implementation
If you are already using the RmsSystemEventHandler Include File, it already defines
the include definition for the RmsEventListener Include File and it already subscribes
to both the system power and system mode RMS event notification callback method.
It is not possible to register two callback methods in a single compiled NetLinx
program, except for inside NetLinx modules which are independently compiled as
separate programs outside the scope of the main NetLinx program.