Commit f1a33c6d authored by claes's avatar claes

rtmon can be started via statussrv

parent 5ad190de
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/pwr_rtmon_gtk \
$(bld_dir)/pwr_rtmon_gtk.o \
$(pwr_eobj)/stdsoap2.o \
$(wb_msg_eobjs) $(rt_msg_eobjs) \
-L/usr/X11R6/lib \
-L/opt/gnome/lib \
-lpwr_statussrv -lpwr_ge_gtk -lpwr_ge -lpwr_wb_gtk -lpwr_wb -lpwr_wb_gtk -l pwr_wb -lpwr_ge_gtk -lpwr_ge \
-lpwr_flow_gtk -lpwr_flow -lpwr_glow_gtk -lpwr_glow -lpwr_rt_gtk -lpwr_rt \
-lpwr_co_gtk -lpwr_co -lpwr_rt -lpwr_co -lpwr_flow_gtk -lpwr_flow \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy -lantlr \
-lrpcsvc -lpthread -lm -ldb_cxx -lz
endif
/*
* Proview $Id: pwr_rtmon_gtk.cpp,v 1.1 2007-05-25 13:41:30 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.
*/
/* pwr_rtmonitor_gtk.cpp -- Runtime Monitor */
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "pwr.h"
#include "co_rtmon_gtk.h"
static void usage()
{
printf("\nUsage: pwr_rtmonitor\n");
}
static void rtmon_help_cb( void *ctx, char *topic)
{
}
static void rtmon_close_cb( void *ctx)
{
exit(0);
}
int main( int argc, char *argv[])
{
int sts;
char display[80] = "";
if ( argc > 1) {
for ( int i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-h") == 0) {
usage();
exit(0);
}
else if ( strcmp( argv[i], "--display") == 0 && i + 1 < argc) {
strncpy( display, argv[i+1], sizeof(display));
}
}
}
gtk_init( &argc, &argv);
RtMon *rtmon = new RtMonGtk( NULL, NULL, "Runtime Monitor", display, &sts);
rtmon->help_cb = rtmon_help_cb;
rtmon->close_cb = rtmon_close_cb;
gtk_main();
return (0);
}
include $(pwre_dir_symbols)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_sroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_sroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o\
-lpwr_rt -lpwr_co \
-lpwr_msg_dummy \
-lrpcsvc -lpthread -lm -lrt
endif
/*
* Proview $Id: pwr_rtmon.cpp,v 1.1 2007-05-25 13:41:30 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund 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.
*/
/* pwr_rtmonitor.cpp Runtime Monitor */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "pwr.h"
static void usage()
{
printf("\nUsage: pwr_rtmonitor [-f windowmgr]");
}
int main( int argc, char *argv[])
{
int i;
int found = 0;
char wmg[80];
pwr_tFileName file;
if ( argc > 1) {
for ( i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-f") == 0) {
if ( i+1 >= argc) {
usage();
exit(0);
}
found = 1;
strcpy( wmg, argv[i+1]);
i++;
}
}
}
if ( !found)
strcpy( wmg, "gtk");
strcpy( file, argv[0]);
strcat( file, "_");
strcat( file, wmg);
execvp( file, argv);
}
/*
* Proview $Id: co_rtmon_gtk.cpp,v 1.2 2007-05-21 15:29:41 claes Exp $
* Proview $Id: co_rtmon_gtk.cpp,v 1.3 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -27,6 +27,7 @@
#include "co_cdh.h"
#include "co_time.h"
#include "co_syi.h"
#include "rt_gdh.h"
#include "co_lng.h"
......@@ -53,15 +54,24 @@ static void destroy_event( GtkWidget *w, gpointer data)
RtMonGtk::RtMonGtk( void *rtmon_parent_ctx,
GtkWidget *rtmon_parent_wid,
char *rtmon_name,
char *rtmon_display,
pwr_tStatus *status) :
RtMon( rtmon_parent_ctx, rtmon_name, status), parent_wid(rtmon_parent_wid),
RtMon( rtmon_parent_ctx, rtmon_name, rtmon_display, status), parent_wid(rtmon_parent_wid),
clock_cursor(0), timerid(0), old_status(9999)
{
char nodename[80];
char title[200];
pwr_tStatus sts;
syi_NodeName( &sts, nodename, sizeof(nodename));
strcpy( title, nodename);
strcat( title, " ");
strcat( title, rtmon_name);
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 330,
"default-width", 480,
"title", rtmon_name,
"title", title,
NULL);
g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
......@@ -215,16 +225,19 @@ RtMonGtk::RtMonGtk( void *rtmon_parent_ctx,
bbox_start = gtk_button_new_with_label( "Start Runtime");
gtk_widget_set_size_request( bbox_start, 170, 25);
g_object_set( bbox_start, "can-focus", FALSE, NULL);
g_signal_connect( bbox_start, "clicked",
G_CALLBACK(activate_start), this);
bbox_restart = gtk_button_new_with_label( "Restart Runtime");
gtk_widget_set_size_request( bbox_restart, 170, 25);
g_object_set( bbox_restart, "can-focus", FALSE, NULL);
g_signal_connect( bbox_restart, "clicked",
G_CALLBACK(activate_restart), this);
bbox_stop = gtk_button_new_with_label( "Stop Runtime");
gtk_widget_set_size_request( bbox_stop, 170, 25);
g_object_set( bbox_stop, "can-focus", FALSE, NULL);
g_signal_connect( bbox_stop, "clicked",
G_CALLBACK(activate_stop), this);
......
/*
* Proview $Id: co_rtmon_gtk.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Proview $Id: co_rtmon_gtk.h,v 1.2 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -31,6 +31,7 @@ class RtMonGtk : public RtMon {
RtMonGtk( void *rtmon_parent_ctx,
GtkWidget *rtmon_parent_wid,
char *rtmon_name,
char *rtmon_display,
pwr_tStatus *status);
~RtMonGtk();
......
/*
* Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.3 2007-05-21 15:29:41 claes Exp $
* Proview $Id: co_statusmon_nodelist_gtk.cpp,v 1.4 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -98,6 +98,9 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
GtkWidget *file_open_opplace = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Open Operatorplace"));
g_signal_connect(file_open_opplace, "activate", G_CALLBACK(activate_open_opplace), this);
GtkWidget *file_open_rtmon = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Open Runtime Monitor"));
g_signal_connect(file_open_rtmon, "activate", G_CALLBACK(activate_open_rtmon), this);
GtkWidget *file_save = gtk_image_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_Save Configuration"));
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(file_save),
gtk_image_new_from_stock( "gtk-save", GTK_ICON_SIZE_MENU));
......@@ -109,6 +112,7 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_remove_node);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open_xtt);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open_opplace);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_open_rtmon);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget *file = gtk_menu_item_new_with_mnemonic(CoWowGtk::translate_utf8("_File"));
......@@ -216,6 +220,14 @@ NodelistGtk::NodelistGtk( void *nodelist_parent_ctx,
g_object_set( tools_op, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_op,CoWowGtk::translate_utf8("Start Operatorplace on selected node"), "");
GtkWidget *tools_rtmon = gtk_button_new();
dcli_translate_filename( fname, "$pwr_exe/xtt_rtmon.png");
gtk_container_add( GTK_CONTAINER(tools_rtmon),
gtk_image_new_from_file( fname));
g_signal_connect(tools_rtmon, "clicked", G_CALLBACK(activate_open_rtmon), this);
g_object_set( tools_rtmon, "can-focus", FALSE, NULL);
gtk_toolbar_append_widget( tools, tools_rtmon,CoWowGtk::translate_utf8("Start Runtime Monitor on selected node"), "");
GtkWidget *tools_zoom_in = gtk_button_new();
gtk_container_add( GTK_CONTAINER(tools_zoom_in),
gtk_image_new_from_stock( "gtk-zoom-in", GTK_ICON_SIZE_SMALL_TOOLBAR));
......@@ -338,6 +350,13 @@ void NodelistGtk::activate_open_opplace( GtkWidget *w, gpointer data)
nodelist->activate_open_opplace();
}
void NodelistGtk::activate_open_rtmon( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
nodelist->activate_open_rtmon();
}
void NodelistGtk::activate_save( GtkWidget *w, gpointer data)
{
Nodelist *nodelist = (Nodelist *)data;
......
/*
* Proview $Id: co_statusmon_nodelist_gtk.h,v 1.2 2007-05-21 14:20:58 claes Exp $
* Proview $Id: co_statusmon_nodelist_gtk.h,v 1.3 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -66,6 +66,7 @@ class NodelistGtk : public Nodelist {
static void activate_remove_node( GtkWidget*w, gpointer data);
static void activate_open_xtt( GtkWidget*w, gpointer data);
static void activate_open_opplace( GtkWidget*w, gpointer data);
static void activate_open_rtmon( 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);
......
/*
* Proview $Id: co_rtmon.cpp,v 1.3 2007-05-24 14:50:13 claes Exp $
* Proview $Id: co_rtmon.cpp,v 1.4 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -34,14 +34,19 @@
#include "co_syi.h"
#include "rt_xnav_msg.h"
RtMon::RtMon( void *nodelist_parent_ctx,
char *nodelist_name,
RtMon::RtMon( void *rtmon_parent_ctx,
char *rtmon_name,
char *rtmon_display,
pwr_tStatus *status) :
parent_ctx(nodelist_parent_ctx),
parent_ctx(rtmon_parent_ctx),
nodelistnav(NULL), rtmon_displayed(0), help_cb(0), close_cb(0)
{
pwr_tStatus sts;
if ( rtmon_display)
strcpy( display, rtmon_display);
else
strcpy( display, "");
syi_NodeName( &sts, nodename, sizeof(nodename));
*status = 1;
......@@ -76,6 +81,18 @@ void RtMon::activate_restart()
}
void RtMon::activate_stop()
{
char nodename[40];
char text[80] = "Do you want to stop Runtime Environment on ";
pwr_tStatus sts;
syi_NodeName( &sts, nodename, sizeof(nodename));
strcat( text, nodename);
wow->DisplayQuestion( this, "Stop Runtime", text, stop_ok_cb, 0, 0);
}
void RtMon::stop_ok_cb( void *ctx, void *data)
{
char cmd[] = "rt_ini -s";
......@@ -91,14 +108,25 @@ void RtMon::activate_reset()
void RtMon::activate_xtt()
{
char cmd[] = "rt_xtt -q &";
pwr_tCmd cmd;
char displaystr[120] = "";
if ( strcmp( display, "") != 0)
sprintf( displaystr, "--display %s", display);
sprintf( cmd, "rt_xtt -q %s &", displaystr);
system( cmd);
}
void RtMon::activate_op()
{
char cmd[] = "rt_xtt -q -s -c &";
pwr_tCmd cmd;
char displaystr[120] = "";
if ( strcmp( display, "") != 0)
sprintf( displaystr, "--display %s", display);
sprintf( cmd, "rt_xtt -q -s -c %s &", displaystr);
system( cmd);
}
/*
* Proview $Id: co_rtmon.h,v 1.1 2007-05-16 12:32:26 claes Exp $
* Proview $Id: co_rtmon.h,v 1.2 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -37,6 +37,7 @@ class RtMon {
public:
RtMon( void *rtmon_parent_ctx,
char *rtmon_name,
char *rtmon_display,
pwr_tStatus *status);
virtual ~RtMon();
......@@ -49,6 +50,7 @@ class RtMon {
void (*india_ok_cb)( RtMon *, char *);
CoWow *wow;
char nodename[40];
char display[80];
virtual void pop() {}
virtual void set_clock_cursor() {}
......@@ -63,6 +65,7 @@ class RtMon {
void activate_reset();
void activate_xtt();
void activate_op();
static void stop_ok_cb( void *ctx, void *data);
};
#endif
......
/*
* Proview $Id: co_statusmon_nodelist.cpp,v 1.4 2007-05-24 14:50:13 claes Exp $
* Proview $Id: co_statusmon_nodelist.cpp,v 1.5 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -153,6 +153,22 @@ void Nodelist::activate_open_opplace()
statussrv_XttStart( node_name, opplace, "", display);
}
void Nodelist::activate_open_rtmon()
{
char node_name[80];
int sts;
char display[80];
sts = nodelistnav->get_selected_node( node_name);
if ( EVEN(sts)) {
nodelistnav->wow->DisplayError( "Open Xtt", "Select a node");
return;
}
get_display( display);
statussrv_RtMonStart( node_name, "", display);
}
void Nodelist::activate_save()
{
nodelistnav->save();
......
/*
* Proview $Id: co_statusmon_nodelist.h,v 1.2 2007-05-21 14:20:58 claes Exp $
* Proview $Id: co_statusmon_nodelist.h,v 1.3 2007-05-25 13:39:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -64,6 +64,7 @@ class Nodelist {
void activate_remove_node();
void activate_open_xtt();
void activate_open_opplace();
void activate_open_rtmon();
void activate_save();
static void find_node_cb( void *ctx, pwr_tOid oid);
static void add_node_ok( Nodelist *nodelist, char *node_name, char *opplace);
......
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