testContext Structure

All of the callback functions take as their first argument a structure describing the context of the call:

struct testContext {

   void *who

   void *amapConn;

   void (*dispFunc)(struct testContext *context,

                    struct AlarmInfo* pAI);

   void (*ClearDisp)(struct testContext *context);

   void (*LostAM)(struct testContext *context);

   int (*MaxAlarms)(struct testContext *context);

   void (*SetDisplayRedraw)(struct testContext *context, int val);

   void (*UpdateCount)(struct testContext *context,

                    RCM_ALARM_DATA *alarmData);

   void (*DoRcmError)(struct testContext *context, int state);

   void (*DoConnectionFormed)(struct testContext *context);

   SAmapCallbacks AmapCallbacks ;

};

The following table summarizes the fields on the testContext structure and their meaning:

Field

Description

Who

A pointer to the object which owns the CAmvConn instance

AmapConn

AMAP connection instance

DispFunc

Function that adds an alarm

ClearDisp

Function that removes all alarms

LostAM

Function to notify of loss of AM connection

MaxAlarms

Returns the maximum number of dynamic alarms

SetDisplayRedraw

Should display be updated?

UpdateCount

Function to notify of new alarm count or update time

DoRcmError

Function to notify of lost of RCM connection

DoConnectionFormed

Function to notify of connection completion

AmapCallbacks

Structure with pointers to dynamic mode callback functions

By casting the who pointer to the appropriate type, members of the owner class can be accessed. By casting the amapConn pointer as a CAmvConn*, members of the connection can be accessed. For example:

_tprintf(_T("Project:\t%s\n"),

          (CAmvConn*)(testContext->amapConn)->GetConnectedSystem());

Thus the same callback functions can be used to process all the connections for your viewer and can determine which connection they are being called for through the amapConn pointer in the context.

More information

CAmvConn Syntax.