-
Notifications
You must be signed in to change notification settings - Fork 2
/
acknowledge.c
116 lines (101 loc) · 3.5 KB
/
acknowledge.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 Deutches Elektronen-Synchrotron in der Helmholtz-
* Gemelnschaft (DESY).
* Copyright (c) 2002 Berliner Speicherring-Gesellschaft fuer Synchrotron-
* Strahlung mbH (BESSY).
* Copyright (c) 2002 Southeastern Universities Research Association, as
* Operator of Thomas Jefferson National Accelerator Facility.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* This file is distributed subject to a Software License Agreement found
* in the file LICENSE that is included with this distribution.
\*************************************************************************/
/* acknowledge.c */
/************************DESCRIPTION***********************************
This file contains routines for alarm acknowledgement
**********************************************************************/
#include <stdio.h>
#include <Xm/Xm.h>
#include "alh.h"
#include "alLib.h"
#include "line.h"
#include "ax.h"
extern int _passive_flag; /* Passive flag. Albert */
extern int _global_flag;
extern int _DB_call_flag;
extern char * alhAlarmSeverityString[];
extern const char *executionModeString[];
/*************************************************************
* channel acknowledgement
***************************************************************/
void ackChan(CLINK *clink)
{
struct chanData *cdata;
if (clink == NULL) return;
cdata = (struct chanData *)clink->pchanData;
if (cdata->unackSevr == NO_ALARM) return;
if(_DB_call_flag) alLog2DBAckChan(cdata->name);
if (_global_flag && !_passive_flag) {
alCaPutGblAck(cdata->chid,&cdata->unackSevr);
if(cdata->ackPVId) alCaPutAckValue(cdata->ackPVId,&cdata->ackPVValue);
} else {
alSetUnackSevChan(clink,NO_ALARM);
}
}
/*************************************************************
* group acknowledgement
***************************************************************/
static void ackGroup(GLINK *glink)
{
SLIST *list;
SNODE *pt;
if (glink == NULL) return;
if (glink->pgroupData->unackSevr == NO_ALARM) return;
list = &(glink->chanList);
pt = sllFirst(list);
while (pt) {
ackChan((CLINK *)pt);
pt = sllNext(pt);
}
list = &(glink->subGroupList);
pt = sllFirst(list);
while (pt) {
ackGroup((GLINK *)pt);
pt = sllNext(pt);
}
}
/***************************************************
ack_callback
****************************************************/
void ack_callback(Widget widget, struct anyLine * line,
XmAnyCallbackStruct * cbs)
{
GLINK *glink;
CLINK *clink;
ALINK *area; /* We need it in passive mode only; Albert */
if (_passive_flag) {
XtVaGetValues(widget, XmNuserData, &area, NULL);
createDialog(area->form_main, XmDIALOG_WARNING,
"You can't acknowledge alarms in passive mode.", " ");
return;
}
if (line->linkType == GROUP) {
glink = (GLINK *)(line->link);
if (glink->pgroupData->unackSevr == NO_ALARM) return;
alLogOpModAckMessage(ACK_GROUP,(GCLINK*)glink,
"%s Ack Group (%s)",
executionModeString[_global_flag],
alhAlarmSeverityString[line->unackSevr]);
ackGroup(glink);
} else if (line->linkType == CHANNEL) {
clink = (CLINK *)(line->link);
if (clink->pchanData->unackSevr == NO_ALARM) return;
alLogOpModAckMessage(ACK_CHANNEL,(GCLINK*)clink,
"%s Ack Channel (%s)",
executionModeString[_global_flag],
alhAlarmSeverityString[line->unackSevr]);
ackChan(clink);
}
}