Commit d2f2b499 authored by Claes Sjofors's avatar Claes Sjofors

Opwindow layout options, oldest alarm showed first, and time before ack is allowed

parent d0d3d409
......@@ -121,5 +121,27 @@ SObject pwrb:Type
Attr Value = 64
EndBody
EndObject
!/**
! Show the oldest not acknowledged alarm in the operator window.
! Otherwise the most recent not acknowledged alarm is shown.
!*/
Object ShowOldestNotAckedAlarm $Bit
Body SysBody
Attr PgmName = "ShowOldestNotAckedAlarm"
Attr Text = "ShowOldestNotAckedAlarm"
Attr Value = 128
EndBody
EndObject
!/**
! Check that an alarm has been visible in the operator window
! for some time before it can be acknowledged.
!*/
Object CheckAckAlarmTime $Bit
Body SysBody
Attr PgmName = "CheckAckAlarmTime"
Attr Text = "CheckAckAlarmTime"
Attr Value = 256
EndBody
EndObject
EndObject
EndSObject
......@@ -924,9 +924,10 @@ void OpGtk::update_alarm_info()
int show_time = 0;
time_eFormat time_format = time_eFormat_Time;
char* s;
int backward = layout_mask & pwr_mOpWindLayoutMask_ShowOldestNotAckedAlarm ? 1 : 0;
if (get_alarm_info_cb) {
sts = (get_alarm_info_cb)(parent_ctx, &info);
sts = (get_alarm_info_cb)(parent_ctx, &info, backward, a_height);
if (EVEN(sts))
return;
......
......@@ -231,7 +231,7 @@ void OpMotif::update_alarm_info()
char text[120];
if (get_alarm_info_cb) {
sts = (get_alarm_info_cb)(parent_ctx, &info);
sts = (get_alarm_info_cb)(parent_ctx, &info, 0, 5);
if (EVEN(sts))
return;
......
......@@ -579,9 +579,10 @@ void OpQt::update_alarm_info()
int show_time = 0;
time_eFormat time_format = time_eFormat_Time;
char* s;
int backward = layout_mask & pwr_mOpWindLayoutMask_ShowOldestNotAckedAlarm ? 1 : 0;
if (get_alarm_info_cb) {
sts = (get_alarm_info_cb)(parent_ctx, &info);
sts = (get_alarm_info_cb)(parent_ctx, &info, backward, a_height);
if (EVEN(sts)) {
return;
}
......
......@@ -399,9 +399,9 @@ void Ev::blk_activate_help()
(help_cb)(parent_ctx, "opg_blocklist");
}
int Ev::get_alarm_info(evlist_sAlarmInfo* info)
int Ev::get_alarm_info(evlist_sAlarmInfo* info, int backward, int alarmsize)
{
return ala->get_alarm_info(info);
return ala->get_alarm_info(info, backward, alarmsize);
}
int Ev::outunit_connect(pwr_tObjid user)
......@@ -454,7 +454,7 @@ void Ev::update(double scantime)
ala->beep(scantime);
}
void Ev::ack_last_prio(unsigned long type, unsigned long prio)
void Ev::ack_last_prio(unsigned long type, unsigned long prio, int backward, int timecheck)
{
mh_sEventId* id;
int sts;
......@@ -464,7 +464,7 @@ void Ev::ack_last_prio(unsigned long type, unsigned long prio)
parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
sts = ala->get_last_not_acked_prio(&id, type, prio);
sts = ala->get_last_not_acked_prio(&id, type, prio, backward, timecheck);
if (ODD(sts)) {
mh_sEventId lid = *id;
......@@ -526,7 +526,7 @@ void Ev::ack_all()
int Ev::get_last_not_acked_prio(
mh_sEventId** id, unsigned long type, unsigned long prio)
{
return ala->get_last_not_acked_prio(id, type, prio);
return ala->get_last_not_acked_prio(id, type, prio, 0, 0);
}
void Ev::create_aliaslist(void* up)
......
......@@ -167,8 +167,8 @@ public:
{
return blk_displayed;
}
int get_alarm_info(evlist_sAlarmInfo* info);
void ack_last_prio(unsigned long type, unsigned long prio);
int get_alarm_info(evlist_sAlarmInfo* info, int backward, int alarmsize);
void ack_last_prio(unsigned long type, unsigned long prio, int backward, int timecheck);
void ack_all();
int get_last_not_acked_prio(
mh_sEventId** id, unsigned long type, unsigned long prio);
......
......@@ -245,7 +245,7 @@ void EvAla::ack_last_prio(unsigned long type, unsigned long prio)
parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
sts = ala->get_last_not_acked_prio(&id, type, prio);
sts = ala->get_last_not_acked_prio(&id, type, prio, 0, 0);
if (ODD(sts)) {
mh_sEventId lid = *id;
......@@ -277,7 +277,7 @@ void EvAla::ack_all()
int EvAla::get_last_not_acked_prio(
mh_sEventId** id, unsigned long type, unsigned long prio)
{
return ala->get_last_not_acked_prio(id, type, prio);
return ala->get_last_not_acked_prio(id, type, prio, 0, 0);
}
pwr_tStatus EvAla::mh_ack(mh_sAck* MsgP)
......
......@@ -240,7 +240,7 @@ void EvEve::ack_last_prio(unsigned long type, unsigned long prio)
parent_ctx, pwr_mAccess_RtEventsAck | pwr_mAccess_System))
return;
sts = ala->get_last_not_acked_prio(&id, type, prio);
sts = ala->get_last_not_acked_prio(&id, type, prio, 0, 0);
if (ODD(sts)) {
mh_sEventId lid = *id;
......@@ -272,7 +272,7 @@ void EvEve::ack_all()
int EvEve::get_last_not_acked_prio(
mh_sEventId** id, unsigned long type, unsigned long prio)
{
return ala->get_last_not_acked_prio(id, type, prio);
return ala->get_last_not_acked_prio(id, type, prio, 0, 0);
}
pwr_tStatus EvEve::mh_ack(mh_sAck* MsgP)
......
......@@ -1841,7 +1841,7 @@ ItemAlarm::ItemAlarm(EvList* item_evlist, const char* item_name,
: event_type(item_event_type), evlist(item_evlist), tree_node(0),
time(item_time), eventtype(item_eventtype), eventflags(item_eventflags),
eventprio(item_eventprio), eventid(item_eventid), object(*item_object),
status(item_status), supobject(*item_supobject), check(0)
status(item_status), supobject(*item_supobject), check(0), display_time(pwr_cNTime)
{
type = evlist_eItemType_Alarm;
brow_tNodeClass nc;
......@@ -2493,17 +2493,24 @@ int EvList::get_last_not_acked_beep(mh_sEventId** id)
return found;
}
int EvList::get_last_not_acked_prio(
mh_sEventId** id, unsigned long type, unsigned long prio)
int EvList::get_last_not_acked_prio(mh_sEventId** id, unsigned long type,
unsigned long prio, int backward, int timecheck)
{
int i;
int i, j;
brow_tObject* object_list;
int object_cnt;
ItemAlarm* object_item;
pwr_tTime current;
brow_GetObjectList(browbase->ctx, &object_list, &object_cnt);
for (i = 0; i < object_cnt; i++) {
brow_GetUserData(object_list[i], (void**)&object_item);
if ( backward)
j = object_cnt - i - 1;
else
j = i;
brow_GetUserData(object_list[j], (void**)&object_item);
switch (object_item->type) {
case evlist_eItemType_Alarm:
switch (object_item->event_type) {
......@@ -2512,6 +2519,16 @@ int EvList::get_last_not_acked_prio(
&& object_item->event_type == (evlist_eEventType)type
&& object_item->eventprio == prio) {
*id = &object_item->eventid;
if ( timecheck) {
pwr_tDeltaTime diff;
pwr_tFloat32 fdiff;
time_GetTime( &current);
time_Adiff( &diff, &current, &object_item->display_time);
time_DToFloat( &fdiff, &diff);
if ( fdiff < 1)
return 0;
}
return 1;
}
break;
......@@ -2520,6 +2537,16 @@ int EvList::get_last_not_acked_prio(
if (object_item->status & mh_mEventStatus_NotAck
&& object_item->event_type == (evlist_eEventType)type) {
*id = &object_item->eventid;
if ( timecheck) {
pwr_tDeltaTime diff;
pwr_tFloat32 fdiff;
time_GetTime( &current);
time_Adiff( &diff, &current, &object_item->display_time);
time_DToFloat( &fdiff, &diff);
if ( fdiff < 1)
return 0;
}
return 1;
}
break;
......@@ -2532,9 +2559,9 @@ int EvList::get_last_not_acked_prio(
return 0;
}
int EvList::get_alarm_info(evlist_sAlarmInfo* info)
int EvList::get_alarm_info(evlist_sAlarmInfo* info, int backward, int alarmsize)
{
int i;
int i, j;
brow_tObject* object_list;
int object_cnt;
ItemAlarm* object_item;
......@@ -2548,7 +2575,11 @@ int EvList::get_alarm_info(evlist_sAlarmInfo* info)
brow_GetObjectList(browbase->ctx, &object_list, &object_cnt);
for (i = 0; i < object_cnt; i++) {
brow_GetUserData(object_list[i], (void**)&object_item);
if ( backward)
j = object_cnt - i - 1;
else
j = i;
brow_GetUserData(object_list[j], (void**)&object_item);
switch (object_item->type) {
case evlist_eItemType_Alarm:
switch (object_item->event_type) {
......@@ -2585,6 +2616,8 @@ int EvList::get_alarm_info(evlist_sAlarmInfo* info)
info->a_alarm_active[a_cnt]
= object_item->status & mh_mEventStatus_NotRet;
info->a_alarm_exist[a_cnt] = 1;
if ( object_item->display_time.tv_sec == 0 && a_cnt < alarmsize)
time_GetTime( &object_item->display_time);
a_cnt++;
break;
case mh_eEventPrio_B:
......@@ -2601,6 +2634,8 @@ int EvList::get_alarm_info(evlist_sAlarmInfo* info)
info->b_alarm_active[b_cnt]
= object_item->status & mh_mEventStatus_NotRet;
info->b_alarm_exist[b_cnt] = 1;
if ( object_item->display_time.tv_sec == 0)
time_GetTime( &object_item->display_time);
b_cnt++;
break;
case mh_eEventPrio_C:
......@@ -2617,6 +2652,8 @@ int EvList::get_alarm_info(evlist_sAlarmInfo* info)
info->c_alarm_active[c_cnt]
= object_item->status & mh_mEventStatus_NotRet;
info->c_alarm_exist[c_cnt] = 1;
if ( object_item->display_time.tv_sec == 0)
time_GetTime( &object_item->display_time);
c_cnt++;
break;
case mh_eEventPrio_D:
......@@ -2633,6 +2670,8 @@ int EvList::get_alarm_info(evlist_sAlarmInfo* info)
info->d_alarm_active[d_cnt]
= object_item->status & mh_mEventStatus_NotRet;
info->d_alarm_exist[d_cnt] = 1;
if ( object_item->display_time.tv_sec == 0)
time_GetTime( &object_item->display_time);
d_cnt++;
break;
default:;
......@@ -2656,6 +2695,8 @@ int EvList::get_alarm_info(evlist_sAlarmInfo* info)
= object_item->status & mh_mEventStatus_NotRet;
info->i_alarm_exist[i_cnt] = 1;
info->i_alarm_eventtype[i_cnt] = object_item->event_type;
if ( object_item->display_time.tv_sec == 0)
time_GetTime( &object_item->display_time);
i_cnt++;
}
break;
......
......@@ -245,9 +245,9 @@ public:
void set_display_hundredth(int value);
void set_hide_object(int value);
void set_hide_text(int value);
int get_alarm_info(evlist_sAlarmInfo* info);
int get_last_not_acked_prio(
mh_sEventId** id, unsigned long type, unsigned long prio);
int get_alarm_info(evlist_sAlarmInfo* info, int backward, int alarmsize);
int get_last_not_acked_prio(mh_sEventId** id, unsigned long type,
unsigned long prio, int backward, int timecheck);
int get_selected_event(char* eventname, ItemAlarm** item);
int get_destination(pwr_tTime time, void** dest);
void block_remove();
......@@ -304,6 +304,7 @@ public:
pwr_tText256 eventmoretext;
pwr_tAttrRef supobject;
int check;
pwr_tTime display_time;
void update_text(int tree_node);
};
......
......@@ -134,14 +134,20 @@ void Op::activate_exit()
void Op::activate_aalarm_ack()
{
int backward = layout_mask & pwr_mOpWindLayoutMask_ShowOldestNotAckedAlarm ? 1 : 0;
int timecheck = layout_mask & pwr_mOpWindLayoutMask_CheckAckAlarmTime ? 1 : 0;
if (ack_last_cb)
(ack_last_cb)(parent_ctx, evlist_eEventType_Alarm, mh_eEventPrio_A);
(ack_last_cb)(parent_ctx, evlist_eEventType_Alarm, mh_eEventPrio_A, backward, timecheck);
}
void Op::activate_balarm_ack()
{
int backward = layout_mask & pwr_mOpWindLayoutMask_ShowOldestNotAckedAlarm ? 1 : 0;
int timecheck = layout_mask & pwr_mOpWindLayoutMask_CheckAckAlarmTime ? 1 : 0;
if (ack_last_cb)
(ack_last_cb)(parent_ctx, balarm_type, balarm_prio);
(ack_last_cb)(parent_ctx, balarm_type, balarm_prio, backward, timecheck);
}
void Op::activate_alarmlist()
......
......@@ -97,8 +97,8 @@ public:
void (*map_cb)(void*);
void (*help_cb)(void*, const char*);
void (*close_cb)(void*);
int (*get_alarm_info_cb)(void*, evlist_sAlarmInfo*);
void (*ack_last_cb)(void*, unsigned long, unsigned long);
int (*get_alarm_info_cb)(void*, evlist_sAlarmInfo*, int, int);
void (*ack_last_cb)(void*, unsigned long, unsigned long, int, int);
int (*is_authorized_cb)(void*, unsigned int);
CoWow* wow;
pwr_tMask layout_mask;
......
......@@ -153,9 +153,9 @@ static int xnav_op_command_cb(void* xnav, char* command);
static void xnav_op_close_cb(void* ctx);
static void xnav_op_help_cb(void* ctx, const char* key);
static void xnav_op_map_cb(void* ctx);
static int xnav_op_get_alarm_info_cb(void* xnav, evlist_sAlarmInfo* info);
static void xnav_op_ack_last_cb(
void* xnav, unsigned long type, unsigned long prio);
static int xnav_op_get_alarm_info_cb(void* xnav, evlist_sAlarmInfo* info, int backward, int alarmsize);
static void xnav_op_ack_last_cb(void* xnav, unsigned long type, unsigned long prio, int backward,
int timecheck);
static void xnav_trend_close_cb(void* ctx, XttTrend* trend);
static void xnav_trend_command_cb(void* ctx, const char* key);
static void xnav_trend_help_cb(void* ctx, const char* key);
......@@ -279,7 +279,8 @@ dcli_tCmdTable xnav_command_table[] = {
{ "dcli_arg1", "/REGULAREXPRESSION", "/NEXT", "" } },
{ "EVENTLIST", &xnav_eventlist_func,
{
"dcli_arg1", "/PRIORITY", "/NAME", "/ALL", "/AUTOACKNOWLEDGE", "",
"dcli_arg1", "/PRIORITY", "/NAME", "/ALL", "/AUTOACKNOWLEDGE", "/OLDEST",
"/TIMECHECK", "",
} },
{ "TEST", &xnav_test_func, { "dcli_arg1", "dcli_arg2", "" } },
{ "LOGGING", &xnav_logging_func,
......@@ -2594,6 +2595,11 @@ static int xnav_eventlist_func(void* client_data, void* client_flag)
char autoack_str[80];
mh_sEventId* id;
int all;
int oldest;
int timecheck;
oldest = ODD(dcli_get_qualifier("/OLDEST", 0, 0));
timecheck = ODD(dcli_get_qualifier("/TIMECHECK", 0, 0));
all = ODD(dcli_get_qualifier("/ALL", 0, 0));
if (all) {
......@@ -2630,28 +2636,28 @@ static int xnav_eventlist_func(void* client_data, void* client_flag)
if (ODD(dcli_get_qualifier("/PRIORITY", prio_str, sizeof(prio_str)))) {
str_ToUpper(prio_str, prio_str);
if (streq(prio_str, "A"))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_A);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_A, oldest, timecheck);
else if (streq(prio_str, "B"))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_B);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_B, oldest, timecheck);
else if (streq(prio_str, "C"))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_C);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_C, oldest, timecheck);
else if (streq(prio_str, "D"))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_D);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_D, oldest, timecheck);
else if (str_StartsWith(prio_str, "I"))
xnav->ev->ack_last_prio(evlist_eEventType_Info, 0);
xnav->ev->ack_last_prio(evlist_eEventType_Info, 0, oldest, timecheck);
else if (streq(prio_str, "NOA")) {
if (ODD(xnav->ev->get_last_not_acked_prio(
&id, evlist_eEventType_Alarm, mh_eEventPrio_B)))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_B);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_B, oldest, timecheck);
else if (ODD(xnav->ev->get_last_not_acked_prio(
&id, evlist_eEventType_Alarm, mh_eEventPrio_C)))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_C);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_C, oldest, timecheck);
else if (ODD(xnav->ev->get_last_not_acked_prio(
&id, evlist_eEventType_Alarm, mh_eEventPrio_D)))
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_D);
xnav->ev->ack_last_prio(evlist_eEventType_Alarm, mh_eEventPrio_D, oldest, timecheck);
else if (ODD(xnav->ev->get_last_not_acked_prio(
&id, evlist_eEventType_Info, 0)))
xnav->ev->ack_last_prio(evlist_eEventType_Info, 0);
xnav->ev->ack_last_prio(evlist_eEventType_Info, 0, oldest, timecheck);
} else
xnav->message('E', "Unknown priority");
} else
......@@ -9718,19 +9724,19 @@ void XNav::ge_event_exec(
}
}
static int xnav_op_get_alarm_info_cb(void* xnav, evlist_sAlarmInfo* info)
static int xnav_op_get_alarm_info_cb(void* xnav, evlist_sAlarmInfo* info, int backward, int alarmsize)
{
if (((XNav*)xnav)->ev)
return ((XNav*)xnav)->ev->get_alarm_info(info);
return ((XNav*)xnav)->ev->get_alarm_info(info, backward, alarmsize);
else
return 0;
}
static void xnav_op_ack_last_cb(
void* xnav, unsigned long type, unsigned long prio)
static void xnav_op_ack_last_cb(void* xnav, unsigned long type, unsigned long prio, int backward,
int timecheck)
{
if (((XNav*)xnav)->ev)
((XNav*)xnav)->ev->ack_last_prio(type, prio);
((XNav*)xnav)->ev->ack_last_prio(type, prio, backward, timecheck);
}
static int xnav_op_command_cb(void* xnav, char* command)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment