Writing Monitors for the Event Monitoring Service (December 1999)

Chapter 3 107
Creating a Resource Monitor
Processing a Resource Update Event
Processing a Resource Update Event
The Resource Update Event occurs when the EMS API needs an update
on the value of a resource. The resource monitor should be developed to
respond to this event by obtaining the current value of the resource. The
polling interval between Resource Update Events is set by the client
application in the monitor request. The EMS API will send Resource
Update Events to the resource monitor at every polling interval, and the
resource monitor will respond by returning the current value of the
resource.
After obtaining the current resource value, the resource monitor will call
rm_notify(), which sends the current resource value to the EMS API. If
the resource value meets the notification criteria, rm_notify() will send
a Notification Message to the target application.
The Resource Update Event is specified by a return_type of
RM_RESOURCE_UPDATE_EVENT from rm_get_next_event().
Replying to Resource Update Events
To respond to a resource update event for your resource monitor, include
the following information.
Check that the resource requested is supported
Get the current value for that resource. If the monitor has an error
trying to obtain the value:
Determine how the monitor proceeds when it receives an error while
trying to obtain the value. The choices are:
set RmResourceType = RM_ERROR_TYPE
or set the RmResourceValue to some defined error state or value
Set RmMonitorReturnData.
This applies if the monitor has any specific details of information
about the resource or current value.
If using character/ascii data in MonitorReturnData field, append null
terminator (\o) and include null terminator (strlen+1) in the
RmMonitorReturnDataLen.