Commit 416afe4f authored by claes's avatar claes

Historical eventlist added

parent 50bfa0e5
......@@ -7,6 +7,6 @@ link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
-lpwr_ge -lpwr_rt -lpwr_co -lpwr_flow -lpwr_glow \
-lpwr_msg_dummy -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lSM -lICE\
-lrpcsvc -lpthread -lm -lrt
-ldb -lrpcsvc -lpthread -lm -lrt
endif
......@@ -70,6 +70,7 @@ static XtActionsRec HotkeyActions[] = {
static xnav_sStartMenu alarm_menu[] = {
{ "Alarm list", xnav_eItemType_Command, (void *) "show alarm"},
{ "Event list", xnav_eItemType_Command, (void *) "show event"},
{ "Historical list", xnav_eItemType_Command, (void *) "show hist"},
{ "", 0, NULL}};
static xnav_sStartMenu nethandler_menu[] = {
{ "Link", xnav_eItemType_Command, (void *) "show link"},
......
......@@ -74,6 +74,33 @@ static pwr_tStatus OpenCrossrefFilter( xmenu_sMenuCall *ip)
return 1;
}
//
// Hist event
//
static pwr_tStatus HistEvent( xmenu_sMenuCall *ip)
{
char cmd[200];
char name[120];
int sts;
sts = gdh_ObjidToName( ip->Pointed.Objid, name, sizeof(name),
cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
strcpy( cmd, "show hist ");
strcat( cmd, name);
((XNav *)ip->EditorContext)->command( cmd);
return 1;
}
//
// Open crossref filter
//
static pwr_tStatus HistEventFilter( xmenu_sMenuCall *ip)
{
return 1;
}
//
// Open trace
//
......@@ -987,6 +1014,8 @@ pwr_dExport pwr_BindXttMethods($Object) = {
pwr_BindXttMethod(OpenObjectFilter),
pwr_BindXttMethod(OpenCrossref),
pwr_BindXttMethod(OpenCrossrefFilter),
pwr_BindXttMethod(HistEvent),
pwr_BindXttMethod(HistEventFilter),
pwr_BindXttMethod(OpenTrace),
pwr_BindXttMethod(OpenTraceFilter),
pwr_BindXttMethod(OpenTrend),
......
......@@ -378,16 +378,24 @@ void EvList::event_info( mh_sMessage *msg)
msg->Status & mh_mEventStatus_NotRet))
return;
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
if ( type != ev_eType_HistList )
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
}
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
new ItemAlarm( this, "Alarm",
......@@ -412,16 +420,24 @@ void EvList::event_alarm( mh_sMessage *msg)
msg->Status & mh_mEventStatus_NotRet))
return;
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
if ( type != ev_eType_HistList )
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
}
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
new ItemAlarm( this, "Alarm",
......@@ -441,20 +457,27 @@ void EvList::event_ack( mh_sAck *msg)
flow_eDest dest_code;
brow_tNode dest_node;
if ( type == ev_eType_EventList)
if ( type == ev_eType_EventList || type == ev_eType_HistList)
{
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
if(type == ev_eType_EventList)
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
}
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
new ItemAlarm( this, "Alarm",
event->Info.EventTime, "",
event->Info.EventName, event->Info.EventFlags,
......@@ -463,6 +486,7 @@ void EvList::event_ack( mh_sAck *msg)
dest_node, dest_code);
size++;
}
else
{
// Alarmlist
......@@ -506,20 +530,27 @@ void EvList::event_return( mh_sReturn *msg)
flow_eDest dest_code;
brow_tNode dest_node;
if ( type == ev_eType_EventList)
if ( type == ev_eType_EventList || type == ev_eType_HistList)
{
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
if(type == ev_eType_EventList)
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
sts = get_destination( event->Info.EventTime, (void **)&dest);
if ( EVEN(sts))
{
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
}
}
else
{
dest_code = flow_eDest_Before;
dest_node = dest->node;
dest_code = flow_eDest_IntoLast;
dest_node = NULL;
}
new ItemAlarm( this, "Alarm",
event->Info.EventTime, event->Msg.EventText,
event->Info.EventName, event->Info.EventFlags,
......@@ -528,6 +559,7 @@ void EvList::event_return( mh_sReturn *msg)
dest_node, dest_code);
size++;
}
else
{
// Alarmlist
......
......@@ -71,7 +71,8 @@ typedef struct {
typedef enum {
ev_eType_AlarmList,
ev_eType_EventList
ev_eType_EventList,
ev_eType_HistList
} ev_eType;
typedef enum {
......
This diff is collapsed.
#ifndef xtt_hist_h
#define xtt_hist_h
/* xtt_hist.h -- Historical event window in xtt
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined OS_LINUX
#if defined __cplusplus
extern "C" {
#include "rt_elog.h"
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef xtt_evlist
# include "xtt_evlist.h"
#endif
#define ERROR_TIME_CONVERT -99
class Hist {
public:
Hist(
void *hist_parent_ctx,
Widget hist_parent_wid,
char *hist_name, pwr_tObjid objid,
pwr_tStatus *status);
~Hist();
void *parent_ctx;
Widget parent_wid;
Widget parent_wid_hist;
char name[80];
Widget toplevel_hist;
Widget toplevel_search;
Widget form_hist;
Widget hist_widget;
Widget start_time_help_lbl_w;
Widget start_time_entry_w;
Widget stop_time_entry_w;
Widget event_text_entry_w;
Widget event_name_entry_w;
Widget alarm_toggle_w;
Widget info_toggle_w;
Widget ack_toggle_w;
Widget ret_toggle_w;
Widget prioA_toggle_w;
Widget prioB_toggle_w;
Widget prioC_toggle_w;
Widget prioD_toggle_w;
Widget nrofevents_string_lbl_w;
Widget search_string_lbl_w;
Widget search_string2_lbl_w;
Widget search_string3_lbl_w;
Widget search_string4_lbl_w;
pwr_tObjid user;
int hist_display_ack;
int hist_display_return;
void (*close_cb)( void *);
void (*start_trace_cb)( void *, pwr_tObjid, char *);
void (*display_in_xnav_cb)( void *, pwr_tObjid);
void (*update_info_cb)( void *);
void (*help_cb)( void *, char *);
void (*popup_menu_cb)( void *, pwr_sAttrRef, unsigned long,
unsigned long, char *, Widget * );
EvList *hist;
int hist_size;
char *minTime_str;
char *maxTime_str;
char *eventName_str;
char *eventText_str;
bool eventPrio_A;
bool eventPrio_B;
bool eventPrio_C;
bool eventPrio_D;
bool eventType_Ack;
bool eventType_Alarm;
bool eventType_Info;
bool eventType_Return;
bool eventType_Cancel;
bool eventType_Block;
bool eventType_Unblock;
bool eventType_Reblock;
bool eventType_CancelBlock;
void get_hist_list();
pwr_tStatus hist_add_ack_mess( mh_sAck *MsgP);
pwr_tStatus hist_add_return_mess( mh_sReturn *MsgP);
pwr_tStatus hist_add_alarm_mess( mh_sMessage *MsgP);
pwr_tStatus hist_add_info_mess( mh_sMessage *MsgP);
pwr_tStatus hist_clear_histlist();
int check_conditions(sEvent *evp);
int compareStr(char *, char *);
void printSearchStr_en_us();
void printSearchStr_sv_se();
};
#if defined __cplusplus
}
#endif
#else
// Dummy for other platforms then OS_LINUX
class Hist {
public:
Hist(
void *hist_parent_ctx,
Widget hist_parent_wid,
char *hist_name, pwr_tObjid objid,
pwr_tStatus *status) : parent_ctx(hist_parent_ctx) {}
void *parent_ctx;
void (*close_cb)( void *);
void (*start_trace_cb)( void *, pwr_tObjid, char *);
void (*display_in_xnav_cb)( void *, pwr_tObjid);
void (*update_info_cb)( void *);
void (*help_cb)( void *, char *);
void (*popup_menu_cb)( void *, pwr_sAttrRef, unsigned long,
unsigned long, char *, Widget * );
};
#endif
#endif
......@@ -48,6 +48,7 @@ static void op_activate_aalarm_incr( Widget w, Op *op, XmAnyCallbackStruct *data
static void op_activate_aalarm_decr( Widget w, Op *op, XmAnyCallbackStruct *data);
static void op_activate_alarmlist( Widget w, Op *op, XmAnyCallbackStruct *data);
static void op_activate_eventlist( Widget w, Op *op, XmAnyCallbackStruct *data);
static void op_activate_eventlog( Widget w, Op *op, XmAnyCallbackStruct *data);
static void op_activate_navigator( Widget w, Op *op, XmAnyCallbackStruct *data);
static void op_activate_help( Widget w, Op *op, XmAnyCallbackStruct *data);
static void op_activate_appl1( Widget w, Op *op, XmAnyCallbackStruct *data);
......@@ -123,6 +124,7 @@ Op::Op(
{"op_activate_balarm_ack",(caddr_t)op_activate_balarm_ack },
{"op_activate_alarmlist",(caddr_t)op_activate_alarmlist },
{"op_activate_eventlist",(caddr_t)op_activate_eventlist },
{"op_activate_eventlog",(caddr_t)op_activate_eventlog },
{"op_activate_navigator",(caddr_t)op_activate_navigator },
{"op_activate_help",(caddr_t)op_activate_help },
{"op_create_balarm_label",(caddr_t)op_create_balarm_label },
......@@ -764,6 +766,13 @@ static void op_activate_eventlist( Widget w, Op *op, XmAnyCallbackStruct *data)
op->command_cb( op->parent_ctx, cmd);
}
static void op_activate_eventlog( Widget w, Op *op, XmAnyCallbackStruct *data)
{
char cmd[20] = "show histlist";
if ( op->command_cb)
op->command_cb( op->parent_ctx, cmd);
}
static void op_activate_navigator( Widget w, Op *op, XmAnyCallbackStruct *data)
{
if ( op->map_cb)
......
......@@ -10,6 +10,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "co_nav_help.h"
extern "C" {
#include "pwr_privilege.h"
#include "rt_gdh.h"
......
......@@ -64,6 +64,10 @@ extern "C" {
#include "xtt_ev.h"
#endif
#ifndef xtt_hist_h
#include "xtt_hist.h"
#endif
#ifndef xtt_op_h
#include "xtt_op.h"
#endif
......@@ -139,7 +143,8 @@ typedef enum {
applist_eType_Graph,
applist_eType_Attr,
applist_eType_Trend,
applist_eType_Crossref
applist_eType_Crossref,
applist_eType_Hist
} applist_eType;
class ApplListElem {
......
......@@ -14,6 +14,8 @@
# include <stdlib.h>
# include <ctype.h>
#include "co_nav_help.h"
extern "C" {
#include "rt_gdh.h"
#include "pwr_privilege.h"
......@@ -87,6 +89,9 @@ static int xnav_attribute_func (
char *return_string);
static int xnav_ge_command_cb( ge_tCtx gectx, char *command);
static void xnav_ge_close_cb( ge_tCtx gectx);
//new code by Jonas Nylund 030131
static void xnav_hist_close_cb( void *ctx);
//end new code by Jonas Nylund 030131
static void xnav_op_command_cb( void *xnav, char *command);
static void xnav_op_close_cb( void *ctx);
static void xnav_op_help_cb( void *ctx, char *key);
......@@ -1424,6 +1429,42 @@ static int xnav_show_func( void *client_data,
else
xnav->ev->map_eve();
}
/*new code by Jonas Nylund 030122*/
else if ( strncmp( arg1_str, "HISTLIST", strlen( arg1_str)) == 0)
{
char hist_title[40];
char name_str[80];
pwr_tObjid objid = pwr_cNObjid;
if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str)))
{
sts = gdh_NameToObjid ( name_str, &objid);
if (EVEN(sts))
{
xnav->message('E', "Object not found");
return XNAV__HOLDCOMMAND;
}
}
strcpy( hist_title, Lng::translate( "Hist list"));
Hist *hist;
hist = new Hist( xnav, xnav->parent_wid, hist_title, objid, &sts);
if ( EVEN(sts))
{
delete hist;
hist = NULL;
xnav->message('E', "Unable to load histlist");
return XNAV__SUCCESS;
}
xnav->appl.insert( applist_eType_Hist, (void *)hist, pwr_cNObjid, "", "");
hist->close_cb = xnav_hist_close_cb;
hist->start_trace_cb = xnav_start_trace_cb;
hist->help_cb = xnav_ev_help_cb;
hist->display_in_xnav_cb = xnav_ev_display_in_xnav_cb;
hist->update_info_cb = xnav_ev_update_info_cb;
hist->popup_menu_cb = xnav_popup_menu_cb;
}
/*end new code by Jonas Nylund 030122*/
else if ( strncmp( arg1_str, "ALARMLIST", strlen( arg1_str)) == 0)
{
......@@ -2462,6 +2503,21 @@ static int xnav_close_func( void *client_data,
elem = elem->next;
}
//new code Jonas Nylund 030131
// Close all hists
type = applist_eType_Hist;
for ( elem = xnav->appl.root; elem;) {
if ( elem->type == type) {
next_elem = elem->next;
delete (Hist *)elem->ctx;
xnav->appl.remove( elem->ctx);
elem = next_elem;
continue;
}
elem = elem->next;
}
// Close navigator
keep = 0;
for ( i = 0; i < names; i++) {
......@@ -2533,6 +2589,14 @@ static void xnav_ge_close_cb( ge_tCtx gectx)
((XNav *)gectx->parent_ctx)->appl.remove( (void *)gectx);
}
//new code Jonas Nylund 030131
static void xnav_hist_close_cb( void *ctx)
{
((XNav *)((Hist *)ctx)->parent_ctx)->appl.remove( (void *)ctx);
delete (Hist *)ctx;
}
//end new code Jonas Nylund 030131
static void xnav_trend_close_cb( void *ctx, XttTrend *trend)
{
XNav *xnav = (XNav *) ctx;
......
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