Commit dbaa139c authored by claes's avatar claes

Functionality to view userstatus in statusmonitor

parent 25f74fcd
/* /*
* Proview $Id: co_rtmon_gtk.cpp,v 1.3 2007-05-25 13:39:28 claes Exp $ * Proview $Id: co_rtmon_gtk.cpp,v 1.4 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -161,7 +161,8 @@ RtMonGtk::RtMonGtk( void *rtmon_parent_ctx, ...@@ -161,7 +161,8 @@ RtMonGtk::RtMonGtk( void *rtmon_parent_ctx,
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));
nodelistnav = new NodelistNavGtk( this, vbox, 0, nodename, 0, &nodelistnav_widget); nodelistnav = new NodelistNavGtk( this, vbox, 0, nodename, nodelist_eMode_SystemStatus,
0, &nodelistnav_widget);
// Toolbar // Toolbar
GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL); GtkToolbar *tools = (GtkToolbar *) g_object_new(GTK_TYPE_TOOLBAR, NULL);
......
/* /*
* Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.5 2007-06-01 11:29:02 claes Exp $ * Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.6 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -50,10 +50,10 @@ static void destroy_event( GtkWidget *w, gpointer data) ...@@ -50,10 +50,10 @@ static void destroy_event( GtkWidget *w, gpointer data)
NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid, GtkWidget *nodelist_parent_wid,
char *nodelist_name, int msgw_pop, char *nodelist_name, int nodelist_mode,
pwr_tStatus *status) : int msgw_pop, pwr_tStatus *status) :
Nodelist( nodelist_parent_ctx, nodelist_name, status), parent_wid(nodelist_parent_wid), Nodelist( nodelist_parent_ctx, nodelist_name, nodelist_mode, status),
clock_cursor(0), india_widget(0) parent_wid(nodelist_parent_wid), clock_cursor(0), india_widget(0)
{ {
pwr_tStatus sts; pwr_tStatus sts;
...@@ -148,6 +148,52 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, ...@@ -148,6 +148,52 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
GTK_WIDGET(view_gui_menu)); GTK_WIDGET(view_gui_menu));
// Submenu Mode
GSList *mode_group = NULL;
GtkWidget *view_mode_systemstatus = gtk_radio_menu_item_new_with_mnemonic( mode_group, "_SystemStatus");
mode_group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(view_mode_systemstatus));
g_signal_connect( view_mode_systemstatus, "activate",
G_CALLBACK(activate_mode_systemstatus), this);
GtkWidget *view_mode_userstatus1 = gtk_radio_menu_item_new_with_mnemonic( mode_group, "UserStatus_1");
mode_group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(view_mode_userstatus1));
g_signal_connect( view_mode_userstatus1, "activate",
G_CALLBACK(activate_mode_userstatus1), this);
GtkWidget *view_mode_userstatus2 = gtk_radio_menu_item_new_with_mnemonic( mode_group, "UserStatus_2");
mode_group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(view_mode_userstatus2));
g_signal_connect( view_mode_userstatus2, "activate",
G_CALLBACK(activate_mode_userstatus2), this);
GtkWidget *view_mode_userstatus3 = gtk_radio_menu_item_new_with_mnemonic( mode_group, "UserStatus_3");
mode_group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(view_mode_userstatus3));
g_signal_connect( view_mode_userstatus3, "activate",
G_CALLBACK(activate_mode_userstatus3), this);
GtkWidget *view_mode_userstatus4 = gtk_radio_menu_item_new_with_mnemonic( mode_group, "UserStatus_4");
mode_group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(view_mode_userstatus4));
g_signal_connect( view_mode_userstatus4, "activate",
G_CALLBACK(activate_mode_userstatus4), this);
GtkWidget *view_mode_userstatus5 = gtk_radio_menu_item_new_with_mnemonic( mode_group, "UserStatus_5");
mode_group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(view_mode_userstatus5));
g_signal_connect( view_mode_userstatus5, "activate",
G_CALLBACK(activate_mode_userstatus5), this);
GtkWidget *view_mode = gtk_menu_item_new_with_mnemonic( "_Mode");
GtkMenu *view_mode_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(view_mode_menu), view_mode_systemstatus);
gtk_menu_shell_append(GTK_MENU_SHELL(view_mode_menu), view_mode_userstatus1);
gtk_menu_shell_append(GTK_MENU_SHELL(view_mode_menu), view_mode_userstatus2);
gtk_menu_shell_append(GTK_MENU_SHELL(view_mode_menu), view_mode_userstatus3);
gtk_menu_shell_append(GTK_MENU_SHELL(view_mode_menu), view_mode_userstatus4);
gtk_menu_shell_append(GTK_MENU_SHELL(view_mode_menu), view_mode_userstatus5);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(view_mode),
GTK_WIDGET(view_mode_menu));
GtkWidget *view_zoom_in = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _In")); GtkWidget *view_zoom_in = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("Zoom _In"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(view_zoom_in), gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(view_zoom_in),
gtk_image_new_from_stock( "gtk-zoom-in", GTK_ICON_SIZE_MENU)); gtk_image_new_from_stock( "gtk-zoom-in", GTK_ICON_SIZE_MENU));
...@@ -171,6 +217,7 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, ...@@ -171,6 +217,7 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_show_events); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_show_events);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_pop_events); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_pop_events);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_gui); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_gui);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_mode);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_in); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_in);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_out); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_out);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_reset); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), view_zoom_reset);
...@@ -199,7 +246,7 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx, ...@@ -199,7 +246,7 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
msg_window->find_wnav_cb = find_node_cb; msg_window->find_wnav_cb = find_node_cb;
msg_window->msg( 'I', "Status Montitor started"); msg_window->msg( 'I', "Status Montitor started");
nodelistnav = new NodelistNavGtk( this, vbox, msg_window, 0, msgw_pop, nodelistnav = new NodelistNavGtk( this, vbox, msg_window, 0, mode, msgw_pop,
&nodelistnav_widget); &nodelistnav_widget);
// Toolbar // Toolbar
...@@ -422,6 +469,60 @@ void NodelistGtk::activate_gui_gtk( GtkWidget *w, gpointer data) ...@@ -422,6 +469,60 @@ void NodelistGtk::activate_gui_gtk( GtkWidget *w, gpointer data)
strcpy( nodelist->remote_gui, ""); strcpy( nodelist->remote_gui, "");
} }
void NodelistGtk::activate_mode_systemstatus( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
int set = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w)) ? 1 : 0;
if ( set)
nodelist->nodelistnav->set_mode( nodelist_eMode_SystemStatus);
}
void NodelistGtk::activate_mode_userstatus1( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
int set = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w)) ? 1 : 0;
if ( set)
nodelist->nodelistnav->set_mode( nodelist_eMode_Status1);
}
void NodelistGtk::activate_mode_userstatus2( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
int set = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w)) ? 1 : 0;
if ( set)
nodelist->nodelistnav->set_mode( nodelist_eMode_Status2);
}
void NodelistGtk::activate_mode_userstatus3( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
int set = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w)) ? 1 : 0;
if ( set)
nodelist->nodelistnav->set_mode( nodelist_eMode_Status3);
}
void NodelistGtk::activate_mode_userstatus4( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
int set = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w)) ? 1 : 0;
if ( set)
nodelist->nodelistnav->set_mode( nodelist_eMode_Status4);
}
void NodelistGtk::activate_mode_userstatus5( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
int set = gtk_check_menu_item_get_active( GTK_CHECK_MENU_ITEM(w)) ? 1 : 0;
if ( set)
nodelist->nodelistnav->set_mode( nodelist_eMode_Status5);
}
void NodelistGtk::activate_zoom_in( GtkWidget *w, gpointer data) void NodelistGtk::activate_zoom_in( GtkWidget *w, gpointer data)
{ {
Nodelist *nodelist = (Nodelist *)data; Nodelist *nodelist = (Nodelist *)data;
......
/* /*
* Proview $Id: co_statusmon_nodelist_gtk.h,v 1.4 2007-06-01 11:29:02 claes Exp $ * Proview $Id: co_statusmon_nodelist_gtk.h,v 1.5 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -34,7 +34,7 @@ class NodelistGtk : public Nodelist { ...@@ -34,7 +34,7 @@ class NodelistGtk : public Nodelist {
public: public:
NodelistGtk( void *nodelist_parent_ctx, NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid, GtkWidget *nodelist_parent_wid,
char *nodelist_name, int msgw_pop, char *nodelist_name, int nodelist_mode, int msgw_pop,
pwr_tStatus *status); pwr_tStatus *status);
~NodelistGtk(); ~NodelistGtk();
...@@ -72,6 +72,12 @@ class NodelistGtk : public Nodelist { ...@@ -72,6 +72,12 @@ class NodelistGtk : public Nodelist {
static void activate_pop_events( GtkWidget *w, gpointer data); static void activate_pop_events( GtkWidget *w, gpointer data);
static void activate_gui_motif( GtkWidget *w, gpointer data); static void activate_gui_motif( GtkWidget *w, gpointer data);
static void activate_gui_gtk( GtkWidget *w, gpointer data); static void activate_gui_gtk( GtkWidget *w, gpointer data);
static void activate_mode_systemstatus( GtkWidget *w, gpointer data);
static void activate_mode_userstatus1( GtkWidget *w, gpointer data);
static void activate_mode_userstatus2( GtkWidget *w, gpointer data);
static void activate_mode_userstatus3( GtkWidget *w, gpointer data);
static void activate_mode_userstatus4( GtkWidget *w, gpointer data);
static void activate_mode_userstatus5( GtkWidget *w, gpointer data);
static void activate_zoom_in( GtkWidget*w, gpointer data); static void activate_zoom_in( GtkWidget*w, gpointer data);
static void activate_zoom_out( GtkWidget*w, gpointer data); static void activate_zoom_out( GtkWidget*w, gpointer data);
static void activate_zoom_reset( GtkWidget*w, gpointer data); static void activate_zoom_reset( GtkWidget*w, gpointer data);
......
/* /*
* Proview $Id: co_statusmon_nodelistnav_gtk.cpp,v 1.3 2007-05-24 14:50:13 claes Exp $ * Proview $Id: co_statusmon_nodelistnav_gtk.cpp,v 1.4 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -42,10 +42,11 @@ NodelistNavGtk::NodelistNavGtk( void *nodelist_parent_ctx, ...@@ -42,10 +42,11 @@ NodelistNavGtk::NodelistNavGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid, GtkWidget *nodelist_parent_wid,
MsgWindow *nodelist_msg_window, MsgWindow *nodelist_msg_window,
char *nodelist_nodename, char *nodelist_nodename,
int nodelist_mode,
int nodelist_msgw_pop, int nodelist_msgw_pop,
GtkWidget **w) : GtkWidget **w) :
NodelistNav( nodelist_parent_ctx, nodelist_msg_window, nodelist_nodename, NodelistNav( nodelist_parent_ctx, nodelist_msg_window, nodelist_nodename,
nodelist_msgw_pop), nodelist_mode, nodelist_msgw_pop),
parent_wid(nodelist_parent_wid) parent_wid(nodelist_parent_wid)
{ {
form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget); form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget);
......
/* /*
* Proview $Id: co_statusmon_nodelistnav_gtk.h,v 1.1 2007-05-16 12:32:26 claes Exp $ * Proview $Id: co_statusmon_nodelistnav_gtk.h,v 1.2 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -35,7 +35,7 @@ class NodelistNavGtk : public NodelistNav { ...@@ -35,7 +35,7 @@ class NodelistNavGtk : public NodelistNav {
GtkWidget *nodelistnav_parent_wid, GtkWidget *nodelistnav_parent_wid,
MsgWindow *nodelistnav_msg_window, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_msg_nodename, char *nodelistnav_msg_nodename,
int nodelist_msgw_pop, int nodelistnav_mode, int nodelist_msgw_pop,
GtkWidget **w); GtkWidget **w);
~NodelistNavGtk(); ~NodelistNavGtk();
......
/* /*
* Proview $Id: co_statusmon_nodelist.cpp,v 1.6 2007-06-01 11:29:02 claes Exp $ * Proview $Id: co_statusmon_nodelist.cpp,v 1.7 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
#include "rt_xnav_msg.h" #include "rt_xnav_msg.h"
Nodelist::Nodelist( void *nodelist_parent_ctx, Nodelist::Nodelist( void *nodelist_parent_ctx,
char *nodelist_name, pwr_tStatus *status) : char *nodelist_name, int nodelist_mode, pwr_tStatus *status) :
parent_ctx(nodelist_parent_ctx), parent_ctx(nodelist_parent_ctx),
nodelistnav(NULL), nodelist_displayed(0), help_cb(0), close_cb(0) nodelistnav(NULL), nodelist_displayed(0), help_cb(0), close_cb(0), mode(nodelist_mode)
{ {
strcpy( remote_gui, ""); strcpy( remote_gui, "");
*status = 1; *status = 1;
......
/* /*
* Proview $Id: co_statusmon_nodelist.h,v 1.4 2007-06-01 11:29:02 claes Exp $ * Proview $Id: co_statusmon_nodelist.h,v 1.5 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -37,6 +37,7 @@ class Nodelist { ...@@ -37,6 +37,7 @@ class Nodelist {
public: public:
Nodelist( void *nodelist_parent_ctx, Nodelist( void *nodelist_parent_ctx,
char *nodelist_name, char *nodelist_name,
int nodelist_mode,
pwr_tStatus *status); pwr_tStatus *status);
virtual ~Nodelist(); virtual ~Nodelist();
...@@ -50,6 +51,7 @@ class Nodelist { ...@@ -50,6 +51,7 @@ class Nodelist {
CoWow *wow; CoWow *wow;
MsgWindow *msg_window; MsgWindow *msg_window;
char remote_gui[20]; char remote_gui[20];
int mode;
virtual void pop() {} virtual void pop() {}
virtual void set_clock_cursor() {} virtual void set_clock_cursor() {}
......
/* /*
* Proview $Id: co_statusmon_nodelistnav.cpp,v 1.4 2007-05-24 14:50:13 claes Exp $ * Proview $Id: co_statusmon_nodelistnav.cpp,v 1.5 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "flow_browapi.h" #include "flow_browapi.h"
#include "co_statusmon_nodelistnav.h" #include "co_statusmon_nodelistnav.h"
#include "statussrv_utl.h" #include "statussrv_utl.h"
#include "rt_pwr_msg.h"
#include "xnav_bitmap_leaf12.h" #include "xnav_bitmap_leaf12.h"
#include "xnav_bitmap_map12.h" #include "xnav_bitmap_map12.h"
...@@ -251,10 +252,12 @@ int NodelistNav::init_brow_cb( FlowCtx *fctx, void *client_data) ...@@ -251,10 +252,12 @@ int NodelistNav::init_brow_cb( FlowCtx *fctx, void *client_data)
return 1; return 1;
} }
NodelistNav::NodelistNav( void *nodelist_parent_ctx, MsgWindow *nodelistnav_msg_window, char *nodelistnav_nodename, int nodelistnav_msgw_pop) : NodelistNav::NodelistNav( void *nodelist_parent_ctx, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_nodename, int nodelistnav_mode, int nodelistnav_msgw_pop) :
parent_ctx(nodelist_parent_ctx), parent_ctx(nodelist_parent_ctx),
nodelist_size(0), trace_started(0), scantime(4000), first_scan(1), nodelist_size(0), trace_started(0), scantime(4000), first_scan(1),
msg_window(nodelistnav_msg_window), msgw_pop(nodelistnav_msgw_pop) msg_window(nodelistnav_msg_window), msgw_pop(nodelistnav_msgw_pop),
mode(nodelistnav_mode)
{ {
if ( nodelistnav_nodename) if ( nodelistnav_nodename)
strcpy( nodename, nodelistnav_nodename); strcpy( nodename, nodelistnav_nodename);
...@@ -342,6 +345,11 @@ void NodelistNav::unzoom() ...@@ -342,6 +345,11 @@ void NodelistNav::unzoom()
brow_UnZoom( brow->ctx); brow_UnZoom( brow->ctx);
} }
void NodelistNav::set_mode( int nodelist_mode)
{
mode = nodelist_mode;
}
void NodelistNav::set_nodraw() void NodelistNav::set_nodraw()
{ {
brow_SetNodraw( brow->ctx); brow_SetNodraw( brow->ctx);
...@@ -814,6 +822,8 @@ int NodelistNav::update_nodes() ...@@ -814,6 +822,8 @@ int NodelistNav::update_nodes()
pwr_tStatus sts; pwr_tStatus sts;
statussrv_sGetStatus response; statussrv_sGetStatus response;
int nodraw = 0; int nodraw = 0;
pwr_tStatus current_status;
char current_status_str[120];
for ( int i = 0; i < (int) node_list.size(); i++) { for ( int i = 0; i < (int) node_list.size(); i++) {
sts = statussrv_GetStatus( node_list[i].node_name, &response); sts = statussrv_GetStatus( node_list[i].node_name, &response);
...@@ -838,50 +848,63 @@ int NodelistNav::update_nodes() ...@@ -838,50 +848,63 @@ int NodelistNav::update_nodes()
} }
} }
if ( node_list[i].item->data.SystemStatus != response.SystemStatus) { if ( EVEN(sts)) {
current_status = response.SystemStatus;
strncpy( current_status_str, response.SystemStatusStr, sizeof(current_status_str));
}
else {
switch ( mode) {
case nodelist_eMode_SystemStatus:
current_status = response.SystemStatus;
strncpy( current_status_str, response.SystemStatusStr, sizeof(current_status_str));
break;
case nodelist_eMode_Status1:
current_status = response.UserStatus[0];
strncpy( current_status_str, response.UserStatusStr[0], sizeof(current_status_str));
break;
case nodelist_eMode_Status2:
current_status = response.UserStatus[1];
strncpy( current_status_str, response.UserStatusStr[1], sizeof(current_status_str));
break;
case nodelist_eMode_Status3:
current_status = response.UserStatus[2];
strncpy( current_status_str, response.UserStatusStr[2], sizeof(current_status_str));
break;
case nodelist_eMode_Status4:
current_status = response.UserStatus[3];
strncpy( current_status_str, response.UserStatusStr[3], sizeof(current_status_str));
break;
case nodelist_eMode_Status5:
current_status = response.UserStatus[4];
strncpy( current_status_str, response.UserStatusStr[4], sizeof(current_status_str));
break;
}
}
if ( node_list[i].item->data.CurrentStatus != current_status) {
// Change color // Change color
if ( !nodraw) { if ( !nodraw) {
brow_SetNodraw( brow->ctx); brow_SetNodraw( brow->ctx);
nodraw = 1; nodraw = 1;
} }
node_list[i].item->update_color( this, response.SystemStatus); node_list[i].item->update_color( this, current_status);
// Message if switch to error // Message if switch to error
if ( !first_scan && ODD(sts)) { if ( !first_scan && ODD(sts)) {
message( response.SystemStatus, node_list[i].node_name, i, response.SystemStatusStr); message( current_status, node_list[i].node_name, i, current_status_str);
#if 0
switch ( node_list[i].item->data.SystemStatus & 7) {
case 3:
case 1:
case 0: {
switch ( response.SystemStatus & 7) {
case 2:
case 4: {
// From Info or Warning to Error or Fatal
char msg[200];
sprintf( msg, "Error status on %s\n\n%s", node_list[i].node_name,
response.SystemStatusStr);
wow->DisplayError( "System Status", msg);
beep();
break;
}
}
break;
}
}
#endif
} }
else if ( EVEN(response.SystemStatus) && ODD(sts)) else if ( EVEN(current_status) && ODD(sts))
// Message even status first scan // Message even status first scan
message( response.SystemStatus, node_list[i].node_name, i, response.SystemStatusStr); message( current_status, node_list[i].node_name, i, current_status_str);
} }
if ( strcmp( node_list[i].item->data.SystemStatusStr, response.SystemStatusStr) != 0) if ( strcmp( node_list[i].item->data.CurrentStatusStr, current_status_str) != 0)
brow_SetAnnotation( node_list[i].item->node, 2, response.SystemStatusStr, brow_SetAnnotation( node_list[i].item->node, 2, current_status_str,
strlen(response.SystemStatusStr)); strlen(current_status_str));
node_list[i].item->data.CurrentStatus = current_status;
strncpy( node_list[i].item->data.CurrentStatusStr, current_status_str,
sizeof(node_list[i].item->data.SystemStatusStr));
node_list[i].item->data.SystemStatus = response.SystemStatus; node_list[i].item->data.SystemStatus = response.SystemStatus;
strncpy( node_list[i].item->data.SystemStatusStr, response.SystemStatusStr, strncpy( node_list[i].item->data.SystemStatusStr, response.SystemStatusStr,
......
/* /*
* Proview $Id: co_statusmon_nodelistnav.h,v 1.2 2007-05-21 14:20:58 claes Exp $ * Proview $Id: co_statusmon_nodelistnav.h,v 1.3 2007-09-06 11:22:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -52,6 +52,15 @@ using namespace std; ...@@ -52,6 +52,15 @@ using namespace std;
class MsgWindow; class MsgWindow;
typedef enum {
nodelist_eMode_SystemStatus,
nodelist_eMode_Status1,
nodelist_eMode_Status2,
nodelist_eMode_Status3,
nodelist_eMode_Status4,
nodelist_eMode_Status5
} nodelist_eMode;
typedef enum { typedef enum {
nodelistnav_eItemType_Node, nodelistnav_eItemType_Node,
nodelistnav_eItemType_Attr, nodelistnav_eItemType_Attr,
...@@ -86,12 +95,16 @@ class NodelistNavBrow { ...@@ -86,12 +95,16 @@ class NodelistNavBrow {
class NodeData { class NodeData {
public: public:
NodeData() : NodeData() :
SystemStatus(0), SystemTime(pwr_cNTime), BootTime(pwr_cNTime), RestartTime(pwr_cNTime), CurrentStatus(0), SystemStatus(0), SystemTime(pwr_cNTime),
BootTime(pwr_cNTime), RestartTime(pwr_cNTime),
Restarts(0) Restarts(0)
{ {
strcpy( Description, ""); strcpy( Description, "");
strcpy( CurrentStatusStr, "");
strcpy( SystemStatusStr, ""); strcpy( SystemStatusStr, "");
} }
pwr_tStatus CurrentStatus;
char CurrentStatusStr[120];
pwr_tStatus SystemStatus; pwr_tStatus SystemStatus;
char SystemStatusStr[120]; char SystemStatusStr[120];
pwr_tString80 Description; pwr_tString80 Description;
...@@ -123,7 +136,8 @@ class NodelistNode { ...@@ -123,7 +136,8 @@ class NodelistNode {
class NodelistNav { class NodelistNav {
public: public:
NodelistNav( void *ev_parent_ctx, MsgWindow *nodelistnav_msg_window, NodelistNav( void *ev_parent_ctx, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_nodename, int nodelistnav_msgw_pop); char *nodelistnav_nodename, int nodelistnav_mode,
int nodelistnav_msgw_pop);
virtual ~NodelistNav(); virtual ~NodelistNav();
void *parent_ctx; void *parent_ctx;
...@@ -139,6 +153,7 @@ class NodelistNav { ...@@ -139,6 +153,7 @@ class NodelistNav {
char nodename[40]; char nodename[40];
static const char config_file[40]; static const char config_file[40];
int msgw_pop; int msgw_pop;
int mode;
virtual void set_input_focus() {} virtual void set_input_focus() {}
virtual void trace_start() {} virtual void trace_start() {}
...@@ -146,6 +161,7 @@ class NodelistNav { ...@@ -146,6 +161,7 @@ class NodelistNav {
void zoom( double zoom_factor); void zoom( double zoom_factor);
void unzoom(); void unzoom();
void set_mode( int nodelist_mode);
void set_nodraw(); void set_nodraw();
void reset_nodraw(); void reset_nodraw();
void read(); void read();
......
/* /*
* Proview $Id: wb_wtt_gtk.cpp,v 1.15 2007-06-29 10:12:38 claes Exp $ * Proview $Id: wb_wtt_gtk.cpp,v 1.16 2007-09-06 11:22:55 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -891,7 +891,8 @@ void WttGtk::activate_statusmon( GtkWidget *w, gpointer data) ...@@ -891,7 +891,8 @@ void WttGtk::activate_statusmon( GtkWidget *w, gpointer data)
Wtt *wtt = (Wtt *)data; Wtt *wtt = (Wtt *)data;
pwr_tStatus sts; pwr_tStatus sts;
Nodelist *nl = new NodelistGtk( wtt, ((WttGtk *)wtt)->toplevel, "Supervision Center", 0, &sts); Nodelist *nl = new NodelistGtk( wtt, ((WttGtk *)wtt)->toplevel, "Supervision Center",
nodelist_eMode_SystemStatus, 0, &sts);
nl->set_scantime(3); nl->set_scantime(3);
nl->help_cb = wtt_help_cb; nl->help_cb = wtt_help_cb;
} }
......
/* /*
* Proview $Id: rt_statusmon_gtk.cpp,v 1.3 2007-05-21 14:26:54 claes Exp $ * Proview $Id: rt_statusmon_gtk.cpp,v 1.4 2007-09-06 11:23:29 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -40,6 +40,7 @@ static void statusmon_close( void *ctx) ...@@ -40,6 +40,7 @@ static void statusmon_close( void *ctx)
int main( int argc, char *argv[]) int main( int argc, char *argv[])
{ {
int sts; int sts;
int mode = nodelist_eMode_SystemStatus;
if ( argc > 1) { if ( argc > 1) {
for ( int i = 1; i < argc; i++) { for ( int i = 1; i < argc; i++) {
...@@ -47,12 +48,32 @@ int main( int argc, char *argv[]) ...@@ -47,12 +48,32 @@ int main( int argc, char *argv[])
usage(); usage();
exit(0); exit(0);
} }
else if ( strcmp( argv[i], "-m") == 0) {
if ( argc == i) {
usage();
exit(0);
}
if ( strcmp( argv[i+1], "1") == 0)
mode = nodelist_eMode_Status1;
else if ( strcmp( argv[i+1], "2") == 0)
mode = nodelist_eMode_Status2;
else if ( strcmp( argv[i+1], "3") == 0)
mode = nodelist_eMode_Status3;
else if ( strcmp( argv[i+1], "4") == 0)
mode = nodelist_eMode_Status4;
else if ( strcmp( argv[i+1], "5") == 0)
mode = nodelist_eMode_Status5;
else {
usage();
exit(0);
}
}
} }
} }
gtk_init( &argc, &argv); gtk_init( &argc, &argv);
Nodelist *nl = new NodelistGtk( NULL, NULL, "Status Monitor", msgw_ePop_No, &sts); Nodelist *nl = new NodelistGtk( NULL, NULL, "Status Monitor", mode, msgw_ePop_No, &sts);
nl->close_cb = statusmon_close; nl->close_cb = statusmon_close;
nl->set_scantime(3); nl->set_scantime(3);
......
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