Commit 64d17aa8 authored by claes's avatar claes

Runtime monitor and Status monitor added

parent 27fd78da
/*
* Proview $Id: rt_statussrv.cpp,v 1.1 2007-05-11 15:01:23 claes Exp $
* Proview $Id: rt_statussrv.cpp,v 1.2 2007-05-16 12:32:55 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -62,7 +62,7 @@ static status_server *statussrv;
static void *statussrv_cyclic( void *arg);
int main()
int main( int argc, char *argv[])
{
struct soap soap;
int m,s; // Master and slave sockets
......@@ -71,14 +71,20 @@ int main()
qcom_sQid qini;
qcom_sQattr qAttr;
qcom_sQid qid = qcom_cNQid;
int restarts;
int restarts = 10;
int ignore_config = 0;
for ( int i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-i") == 0)
ignore_config = 1;
}
sts = gdh_Init("status_server");
if ( EVEN(sts)) {
exit(sts);
}
errh_Init("status_server", errh_eNAnix /* errh_eAnix_status_server */);
errh_Init("status_server", errh_eAnix_statussrv);
errh_SetStatus( PWR__SRVSTARTUP);
if (!qcom_Init(&sts, 0, "status_server")) {
......@@ -133,7 +139,7 @@ int main()
}
#if 0
if ( !ignore_config) {
// Get StatusServerConfig object
pwr_tOid config_oid;
sts = gdh_GetClassList( pwr_cClass_StatusServerConfig, &config_oid);
......@@ -150,7 +156,7 @@ int main()
}
aproc_RegisterObject( config_oid);
#endif
}
// Read version file
......
This diff is collapsed.
/*
* Proview $Id: co_rtmon_gtk.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_rtmon_gtk_h
#define co_rtmon_gtk_h
/* co_rtmon_gtk.h -- Status Monitor */
#ifndef co_rtmon_h
# include "co_rtmon.h"
#endif
class RtMonGtk : public RtMon {
public:
RtMonGtk( void *rtmon_parent_ctx,
GtkWidget *rtmon_parent_wid,
char *rtmon_name,
pwr_tStatus *status);
~RtMonGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_nodelist;
GtkWidget *toplevel;
GtkWidget *form_nodelist;
GtkWidget *nodelistnav_widget;
GtkWidget *bbox_label;
GtkWidget *bbox_label_eb;
GtkWidget *bbox_start;
GtkWidget *bbox_restart;
GtkWidget *bbox_stop;
GtkWidget *bbox_image;
GtkWidget *bbox_image_gray;
GtkWidget *tools_xtt;
GtkWidget *tools_op;
GtkWidget *file_xtt;
GtkWidget *file_op;
GdkCursor *clock_cursor;
gint timerid;
pwr_tStatus old_status;
void pop();
void set_clock_cursor();
void reset_cursor();
void free_cursor();
void create_input_dialog();
void open_input_dialog( char *text, char *title,
char *init_text,
void (*ok_cb)( RtMon *, char *));
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_exit( GtkWidget*w, gpointer data);
static void activate_start( GtkWidget *w, gpointer data);
static void activate_restart( GtkWidget *w, gpointer data);
static void activate_stop( GtkWidget *w, gpointer data);
static void activate_reset( 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_reset( GtkWidget*w, gpointer data);
static void activate_xtt( GtkWidget*w, gpointer data);
static void activate_op( GtkWidget*w, gpointer data);
static void activate_help( GtkWidget*w, gpointer data);
};
#endif
This diff is collapsed.
/*
* Proview $Id: co_statusmon_nodelist_gtk.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_statusmon_nodelist_gtk_h
#define co_statusmon_nodelist_gtk_h
/* co_statusmon_nodelist_gtk.h -- Status Monitor */
#ifndef co_statusmon_nodelist_h
# include "co_statusmon_nodelist.h"
#endif
#ifndef co_wow_gtk_h
# include "co_wow_gtk.h"
#endif
class NodelistGtk : public Nodelist {
public:
NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid,
char *nodelist_name, int msgw_pop,
pwr_tStatus *status);
~NodelistGtk();
GtkWidget *parent_wid;
GtkWidget *parent_wid_nodelist;
GtkWidget *toplevel;
GtkWidget *form_nodelist;
GtkWidget *nodelistnav_widget;
GdkCursor *clock_cursor;
GtkWidget *india_widget;
GtkWidget *india_label;
GtkWidget *india_text;
CoWowFocusTimerGtk focustimer;
void pop();
void set_clock_cursor();
void reset_cursor();
void free_cursor();
void create_input_dialog();
void open_input_dialog( char *text, char *title,
char *init_text,
void (*ok_cb)( Nodelist *, char *));
static gboolean action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer data);
static void activate_exit( GtkWidget*w, gpointer data);
static void activate_add_node( GtkWidget*w, gpointer data);
static void activate_remove_node( GtkWidget*w, gpointer data);
static void activate_save( GtkWidget*w, gpointer data);
static void activate_show_events( GtkWidget *w, gpointer data);
static void activate_pop_events( 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_reset( GtkWidget*w, gpointer data);
static void activate_help( GtkWidget*w, gpointer data);
static void activate_india_ok( GtkWidget *w, gpointer data);
static void activate_india_cancel( GtkWidget *w, gpointer data);
};
#endif
/*
* Proview $Id: co_statusmon_nodelistnav_gtk.cpp,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* co_statusmon_nodelistnav_gtk.cpp -- Console message window. */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <gtk/gtk.h>
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "co_wow_gtk.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "rt_syi.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_gtk.h"
#include "co_statusmon_nodelistnav_gtk.h"
NodelistNavGtk::NodelistNavGtk( void *nodelist_parent_ctx,
GtkWidget *nodelist_parent_wid,
MsgWindow *nodelist_msg_window,
char *nodelist_nodename,
int nodelist_msgw_pop,
GtkWidget **w) :
NodelistNav( nodelist_parent_ctx, nodelist_msg_window, nodelist_nodename,
nodelist_msgw_pop),
parent_wid(nodelist_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new( init_brow_cb, this, &brow_widget);
gtk_widget_show_all( brow_widget);
*w = form_widget;
wow = new CoWowGtk( parent_wid);
}
//
// Delete ev
//
NodelistNavGtk::~NodelistNavGtk()
{
if ( trace_started)
g_source_remove( trace_timerid);
delete brow;
gtk_widget_destroy( form_widget);
}
void NodelistNavGtk::beep()
{
gdk_display_beep( gtk_widget_get_display( form_widget));
}
void NodelistNavGtk::set_input_focus()
{
gtk_widget_grab_focus( brow_widget);
}
void NodelistNavGtk::trace_start()
{
NodelistNavGtk::trace_scan( this);
}
static gboolean nodelistnavgtk_trace_scan( void *data)
{
NodelistNavGtk::trace_scan( (NodelistNav *)data);
return FALSE;
}
void NodelistNavGtk::trace_scan( NodelistNav *nodelistnav)
{
if ( nodelistnav->trace_started) {
nodelistnav->update_nodes();
brow_TraceScan( nodelistnav->brow->ctx);
((NodelistNavGtk *)nodelistnav)->trace_timerid = g_timeout_add( nodelistnav->scantime,
nodelistnavgtk_trace_scan, nodelistnav);
}
}
/*
* Proview $Id: co_statusmon_nodelistnav_gtk.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_statusmon_nodelistnav_gtk_h
#define co_statusmon_nodelistnav_gtk_h
/* co_statusmon_nodelistnav_gtk.h -- Console message window. */
// Status is defined as int i xlib...
#ifndef co_statusmon_nodelistnav_h
# include "co_statusmon_nodelistnav.h"
#endif
class NodelistNavGtk : public NodelistNav {
public:
NodelistNavGtk( void *ev_parent_ctx,
GtkWidget *nodelistnav_parent_wid,
MsgWindow *nodelistnav_msg_window,
char *nodelistnav_msg_nodename,
int nodelist_msgw_pop,
GtkWidget **w);
~NodelistNavGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
gint trace_timerid;
void start_trace( pwr_tObjid Objid, char *object_str);
void set_input_focus();
void trace_start();
void beep();
static void trace_scan( NodelistNav *nodelistnav);
};
#endif
/**
* Proview $Id: co_msgwindow.cpp,v 1.12 2007-05-11 15:12:45 claes Exp $
* Proview $Id: co_msgwindow.cpp,v 1.13 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -72,6 +72,17 @@ void MsgWindow::message( int severity, const char *text, msgw_ePop pop, pwr_tOid
default_window->map();
}
void MsgWindow::msg( int severity, const char *text, msgw_ePop pop, pwr_tOid oid, bool is_plc)
{
if ( severity == 'O')
severity = 'I';
insert( severity, text, oid, is_plc);
if ( (pop == msgw_ePop_Yes ||
(pop == msgw_ePop_Default && ( severity == 'E' || severity == 'F' || severity == 'W'))))
map();
}
void MsgWindow::message( const co_error& e, const char *text1, const char *text2, pwr_tOid oid, bool is_plc)
{
pwr_tStatus sts = e.sts();
......
/**
* Proview $Id: co_msgwindow.h,v 1.7 2007-01-04 07:51:42 claes Exp $
* Proview $Id: co_msgwindow.h,v 1.8 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -73,6 +73,8 @@ class MsgWindow {
void insert( int severity, const char *text, pwr_tOid oid = pwr_cNOid, bool is_plc = false);
void set_nodraw() { msgnav->set_nodraw(); nodraw++;}
void reset_nodraw();
void msg( int severity, const char *text, msgw_ePop pop = msgw_ePop_Default,
pwr_tOid oid = pwr_cNOid, bool is_plc = false);
static void set_default( MsgWindow *msgw) { default_window = msgw;}
static void message( int severity, const char *text, msgw_ePop pop = msgw_ePop_Default,
pwr_tOid oid = pwr_cNOid, bool is_plc = false);
......
/*
* Proview $Id: co_rtmon.cpp,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* co_statusmon_nodelist.cpp -- Status Monitor */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "co_cdh.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "co_lng.h"
#include "co_wow.h"
#include "co_rtmon.h"
#include "rt_syi.h"
#include "rt_xnav_msg.h"
RtMon::RtMon( void *nodelist_parent_ctx,
char *nodelist_name,
pwr_tStatus *status) :
parent_ctx(nodelist_parent_ctx),
nodelistnav(NULL), rtmon_displayed(0), help_cb(0), close_cb(0)
{
pwr_tStatus sts;
syi_NodeName( &sts, nodename, sizeof(nodename));
*status = 1;
}
//
// Delete nodelist
//
RtMon::~RtMon()
{
}
void RtMon::activate_help()
{
if ( help_cb)
(help_cb)( parent_ctx, "runtime monitor");
}
void RtMon::activate_start()
{
char cmd[] = "rt_ini -i &";
system( cmd);
}
void RtMon::activate_restart()
{
char cmd[] = "rt_ini -r";
system( cmd);
}
void RtMon::activate_stop()
{
char cmd[] = "rt_ini -s";
system( cmd);
}
void RtMon::activate_reset()
{
char cmd[] = "source pwr_stop.sh";
system( cmd);
}
void RtMon::activate_xtt()
{
char cmd[] = "rt_xtt -q &";
system( cmd);
}
void RtMon::activate_op()
{
char cmd[] = "rt_xtt -q -s -c &";
system( cmd);
}
/*
* Proview $Id: co_rtmon.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_rtmon_h
#define co_rtmon_h
/* co_rtmon.h -- Status Monitor node list */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef co_statusmon_nodelistnav
# include "co_statusmon_nodelistnav.h"
#endif
class CoWow;
class MsgWindow;
class RtMon {
public:
RtMon( void *rtmon_parent_ctx,
char *rtmon_name,
pwr_tStatus *status);
virtual ~RtMon();
void *parent_ctx;
char name[80];
NodelistNav *nodelistnav;
int rtmon_displayed;
void (*help_cb)( void *, char *);
void (*close_cb)( void *);
void (*india_ok_cb)( RtMon *, char *);
CoWow *wow;
char nodename[40];
virtual void pop() {}
virtual void set_clock_cursor() {}
virtual void reset_cursor() {}
virtual void free_cursor() {}
void set_scantime( float scantime) { nodelistnav->scantime = int(scantime * 1000);}
void activate_help();
void activate_start();
void activate_restart();
void activate_stop();
void activate_reset();
void activate_xtt();
void activate_op();
};
#endif
/*
* Proview $Id: co_statusmon_nodelist.cpp,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* co_statusmon_nodelist.cpp -- Status Monitor */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "co_cdh.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
#include "rt_gdh.h"
#include "co_lng.h"
#include "co_wow.h"
#include "co_statusmon_nodelist.h"
#include "rt_xnav_msg.h"
Nodelist::Nodelist( void *nodelist_parent_ctx,
char *nodelist_name, pwr_tStatus *status) :
parent_ctx(nodelist_parent_ctx),
nodelistnav(NULL), nodelist_displayed(0), help_cb(0), close_cb(0)
{
*status = 1;
}
//
// Delete nodelist
//
Nodelist::~Nodelist()
{
}
void Nodelist::activate_help()
{
if ( help_cb)
(help_cb)( parent_ctx, "consolelog");
}
void Nodelist::find_node_cb( void *ctx, pwr_tOid oid)
{
Nodelist *nodelist = (Nodelist *)ctx;
if ( nodelist->nodelistnav->select_node( oid.oix))
nodelist->pop();
}
void Nodelist::add_node_ok( Nodelist *nodelist, char *node_name)
{
nodelist->nodelistnav->add_node( node_name);
}
void Nodelist::activate_add_node()
{
open_input_dialog( "Enter node name", "Add Node", "",
add_node_ok);
}
void remove_node_ok( void *ctx, void *data)
{
Nodelist *nodelist = (Nodelist *)ctx;
nodelist->nodelistnav->remove_node( (char *)data);
}
void Nodelist::activate_remove_node()
{
static char node_name[80];
char msg[100];
int sts;
sts = nodelistnav->get_selected_node( node_name);
if ( EVEN(sts)) {
nodelistnav->wow->DisplayError( "Remove Node", "Select a node");
return;
}
sprintf( msg, "Do you want to remove node %s", node_name);
nodelistnav->wow->DisplayQuestion( this, "Remove Node", msg, remove_node_ok,
NULL, node_name);
}
void Nodelist::activate_save()
{
nodelistnav->save();
}
/*
* Proview $Id: co_statusmon_nodelist.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_statusmon_nodelist_h
#define co_statusmon_nodelist_h
/* co_statusmon_nodelist.h -- Status Monitor node list */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef co_statusmon_nodelistnav
# include "co_statusmon_nodelistnav.h"
#endif
class CoWow;
class MsgWindow;
class Nodelist {
public:
Nodelist( void *nodelist_parent_ctx,
char *nodelist_name,
pwr_tStatus *status);
virtual ~Nodelist();
void *parent_ctx;
char name[80];
NodelistNav *nodelistnav;
int nodelist_displayed;
void (*help_cb)( void *, char *);
void (*close_cb)( void *);
void (*india_ok_cb)( Nodelist *, char *);
CoWow *wow;
MsgWindow *msg_window;
virtual void pop() {}
virtual void set_clock_cursor() {}
virtual void reset_cursor() {}
virtual void free_cursor() {}
virtual void open_input_dialog( char *text, char *title,
char *init_text,
void (*ok_cb)( Nodelist *, char *)) {}
void set_scantime( float scantime) { nodelistnav->scantime = int(scantime * 1000);}
void activate_help();
void activate_add_node();
void activate_remove_node();
void activate_save();
static void find_node_cb( void *ctx, pwr_tOid oid);
static void add_node_ok( Nodelist *nodelist, char *node_name);
};
#endif
This diff is collapsed.
/*
* Proview $Id: co_statusmon_nodelistnav.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef co_statusmon_nodelistnav_h
#define co_statusmon_nodelistnav_h
/* co_statusmon_nodelistnav.h -- Status Monitor. */
// Status is defined as int i xlib...
#include <vector>
#include "statussrv_utl.h"
using namespace std;
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef rt_errh_h
# include "rt_errh.h"
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browctx.h"
#endif
#ifndef flow_browapi_h
#include "flow_browapi.h"
#endif
class MsgWindow;
typedef enum {
nodelistnav_eItemType_Node,
nodelistnav_eItemType_Attr,
nodelistnav_eItemType_AttrSts,
nodelistnav_eItemType_AttrSysSts
} nodelistnav_eItemType;
class NodelistNavBrow {
public:
NodelistNavBrow( BrowCtx *brow_ctx, void *evl) : ctx(brow_ctx), nodelistnav(evl) {};
~NodelistNavBrow();
BrowCtx *ctx;
void *nodelistnav;
brow_tNodeClass nc_event;
brow_tNodeClass nc_node;
brow_tNodeClass nc_attr;
brow_tNodeClass nc_sys_sts_attr;
brow_tNodeClass nc_sts_attr;
flow_sAnnotPixmap *pixmap_leaf;
flow_sAnnotPixmap *pixmap_map;
flow_sAnnotPixmap *pixmap_openmap;
flow_sAnnotPixmap *pixmap_attr;
void free_pixmaps();
void allocate_pixmaps();
void create_nodeclasses();
void brow_setup();
};
class NodeData {
public:
NodeData() :
SystemStatus(0), SystemTime(pwr_cNTime), BootTime(pwr_cNTime), RestartTime(pwr_cNTime),
Restarts(0)
{
strcpy( Description, "");
strcpy( SystemStatusStr, "");
}
pwr_tStatus SystemStatus;
char SystemStatusStr[120];
pwr_tString80 Description;
pwr_tTime SystemTime;
pwr_tTime BootTime;
pwr_tTime RestartTime;
int Restarts;
char Version[20];
};
class ItemNode;
class CoWow;
class NodelistNode {
public:
NodelistNode( char *name) :
item(0), connection_sts(0), init_done(0)
{
strncpy( node_name, name, sizeof(node_name));
}
char node_name[80];
ItemNode *item;
pwr_tStatus connection_sts;
int init_done;
};
class NodelistNav {
public:
NodelistNav( void *ev_parent_ctx, MsgWindow *nodelistnav_msg_window,
char *nodelistnav_nodename, int nodelistnav_msgw_pop);
virtual ~NodelistNav();
void *parent_ctx;
NodelistNavBrow *brow;
int nodelist_size;
int max_size;
vector<NodelistNode> node_list;
int trace_started;
int scantime;
int first_scan;
CoWow *wow;
MsgWindow *msg_window;
char nodename[40];
static const char config_file[40];
int msgw_pop;
virtual void set_input_focus() {}
virtual void trace_start() {}
virtual void beep() {}
void zoom( double zoom_factor);
void unzoom();
void set_nodraw();
void reset_nodraw();
void read();
void draw();
int update_nodes();
void force_trace_scan();
void message( pwr_tStatus sts, char *node, int idx, char *text);
int select_node( int idx);
void remove_node( char *name);
int get_selected_node( char *name);
void save();
void add_node( char *name);
void set_msgw_pop( int pop) { msgw_pop = pop;}
static void attrvalue_to_string( int type_id, void *value_ptr,
char *str, int size, int *len, char *format);
static int init_brow_cb( FlowCtx *fctx, void *client_data);
static int brow_cb( FlowCtx *ctx, flow_tEvent event);
static int trace_scan_bc( brow_tObject object, void *p);
static int trace_connect_bc( brow_tObject object, char *name, char *attr,
flow_eTraceType type, void **p);
static int trace_disconnect_bc( brow_tObject object);
};
class ItemBase {
public:
ItemBase( NodelistNav *item_nodelistnav, char *item_name) :
nodelistnav(item_nodelistnav)
{
strcpy( name, item_name);
}
virtual ~ItemBase() {}
nodelistnav_eItemType type;
NodelistNav *nodelistnav;
brow_tNode node;
char name[120];
virtual int open_children( NodelistNav *nodelistnav, double x, double y) {return 1;}
virtual int close( NodelistNav *nodelistnav, double x, double y) {return 1;}
};
class ItemNode : public ItemBase {
public:
ItemNode( NodelistNav *item_nodelistnav, char *item_name,
brow_tNode dest, flow_eDest dest_code);
NodeData data;
statussrv_sGetExtStatus xdata;
int syssts_open;
int open_children( NodelistNav *nodelistnav, double x, double y);
int close( NodelistNav *nodelistnav, double x, double y);
int update_color( NodelistNav *nodelistnav, pwr_tStatus sts);
};
//! Item for a normal attribute.
class ItemAttr : public ItemBase {
public:
ItemAttr( NodelistNav *item_nodelistnav, char *item_name, char *attr,
int attr_type, int attr_size, void *attr_value_p,
brow_tNode dest, flow_eDest dest_code);
void *value_p;
char old_value[120];
int first_scan;
int type_id;
int size;
};
//! Item for a system status attribute.
class ItemAttrSysSts : public ItemBase {
public:
ItemAttrSysSts( NodelistNav *item_nodelistnav, char *item_name, char *attr,
int attr_type, int attr_size, void *attr_value_p, void *attr_status_p,
ItemNode *attr_parent, brow_tNode dest, flow_eDest dest_code);
void *value_p;
void *status_p;
char old_value[120];
int first_scan;
int type_id;
int size;
ItemNode *parent;
virtual int open_children( NodelistNav *nodelistnav, double x, double y);
virtual int close( NodelistNav *nodelistnav, double x, double y);
};
//! Item for a server status attribute.
class ItemAttrSts : public ItemBase {
public:
ItemAttrSts( NodelistNav *item_nodelistnav, char *item_name, char *attr,
char *attr_value_p,
pwr_tStatus *attr_status_p, char *attr_name_p,
ItemAttrSysSts *attr_parent, brow_tNode dest,
flow_eDest dest_code);
char *value_p;
pwr_tStatus *status_p;
char *name_p;
char old_value[120];
char old_name[120];
int first_scan;
int type_id;
int size;
ItemAttrSysSts *parent;
};
#endif
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