Send alarms and messages


From an application you can send alarms and messages to the alarmlist and eventlist of
the operator. First you have to connect to the event monitor with mh_ApplConnect() which
takes the object identity for the application object as first argument. For subclasses to
the rt_appl class this identity is fetched with apploid().

#include "rt_mh_appl.h"

pwr_tUInt32 num;
pwr_tOid aoid = apploid();
sts = mh_ApplConnect( aoid, mh_mApplFlags(0), "", mh_eEvent_Info, mh_eEventPrio_A,
mh_mEventFlags_Bell, "", &num);
   if (EVEN(sts)) throw co_error(sts);

We then can send alarms with mh_ApplMessage().

mh_sApplMessage msg;
pwr_tUInt32 msgid;

memset( &msg, 0, sizeof(msg));
msg.EventFlags = mh_mEventFlags(mh_mEventFlags_Returned |
mh_mEventFlags_NoObject |
mh_mEventFlags_Bell);
time_GetTime( &msg.EventTime);
strcpy( msg.EventName, "Message from ra_myappl");
strcpy( msg.EventText, "I'm up and running now !");
msg.EventType = mh_eEvent_Alarm;
msg.EventPrio = mh_eEventPrio_B;

sts = mh_ApplMessage( &msgid, &msg);
if (EVEN(sts)) throw co_error(sts);


Fig The alarm in the alarmlist.