Callback functions are user-defined functions that notify an application when an event has occurred. These functions are registered with Monitor Client Library API calls for:
Alarms
Error information
When either of the above events occur, a callback function is executed.
SMC_VOID CallbackFunction (SMC_CONNECT_ID clientId, SMC_COMMAND_ID commandId, SMC_VOIDP userDataHandle)
identifies the connection.
identifies the instance of a command.
user data pointer for a given connection. An application can set this pointer by using smc_connect_props.
When an event triggers a callback function, you can request information about the event. Data is accessed by calling smc_get_command_info from within the callback function. This function takes a connection ID, a command ID, and an enumerator constant that identifies which piece of data the user is interested in. The data available depends on the type of callback. Table 3-3 describes the data available for alarm callbacks. Table 3-4 describes the data available for error callbacks.
Information type |
Description |
---|---|
SMC_INFO_ALARM_ACTION_DATA |
String supplied for alarmActionData upon creation of the alarm. |
SMC_INFO_ALARM_ALARMID |
Identifies the alarm. |
SMC_INFO_ALARM_CURRENT_VALUE |
Current value that met or exceeded the alarm threshold. |
SMC_INFO_ALARM_DATAITEM |
Data item on which the alarm was set. Points to a SMC_DATAITEM_STRUCT. |
SMC_INFO_ALARM_ROW |
Row containing the data item value that triggered the alarm. |
SMC_INFO_ALARM_THRESHOLD_VALUE |
Threshold value defined for this alarm. |
SMC_INFO_ALARM_TIMESTAMP |
Time (in the Adaptive Server time zone) marking the end of the sample interval in whose data the alarm condition was met. |
SMC_INFO_ALARM_VIEWID |
Identifies a view created on the connection. |
Information type |
Description |
---|---|
SMC_INFO_ERR_MAPSEVERITY |
Monitor Client Library severity level. |
SMC_INFO_ERR_MSG |
Text of the error message. (See Appendix D, “Troubleshooting Information and Error Messages”.) |
SMC_INFO_ERR_NUM |
Number of the error. |
SMC_INFO_ERR_SEVERITY |
Severity of the error message. |
SMC_INFO_ERR_SOURCE |
Source of the error message. One of the following:
|
SMC_INFO_ERR_STATE |
State of the error. Useful for technical support in diagnosing internal errors. |