Commit c64f5ec8 authored by Claes Sjofors's avatar Claes Sjofors

Xtt operator log configured in OpPlace object, attribute Options

parent d1102104
......@@ -206,6 +206,18 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Operatorplace options.
! - OperatorLog will turn on the operator logging when rt_xtt is started.
! The logging is stored in $pwrp_log/xtt_'opplace'.log
! - OperatorExendedLog will also store all mouse and motion events in the
! logfile.
!*/
Object Options $Attribute 47
Body SysBody
Attr TypeRef = "pwrb:Type-OpPlaceOptionsMask"
EndBody
EndObject
!/**
! Specifies the maximum number of contemporary alarms in
! the user's alarm list.
! The number should exceed the maximum number of
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2012 SSAB EMEA AB.
!
! This file is part of Proview.
!
! 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 Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_opplaceoptionsmask.wb_load -- Defines the mask type OpPlaceOptionsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Bitmask for opplace options.
!
! @b See also
! @classlink OpPlace pwrb_opplace.html
!*/
Object OpPlaceOptionsMask $TypeDef 66
Body SysBody
Attr Type = pwr_eType_Mask
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Mask"
Attr Elements = 1
EndBody
!/**
! Activate operator log
!*/
Object OperatorLog $Bit
Body SysBody
Attr PgmName = "OperatorLog"
Attr Text = "OperatorLog"
Attr Value = 1
EndBody
EndObject
!/**
! Also store mouse and motion events in the operator log.
!*/
Object OperatorExtendedLog $Bit
Body SysBody
Attr PgmName = "OperatorExtendedLog"
Attr Text = "OperatorExtendedLog"
Attr Value = 2
EndBody
EndObject
EndObject
EndSObject
......@@ -40,7 +40,7 @@
#include "pwr.h"
#include "cow_log.h"
#define xttlog_cLogFile "$pwrp_log/xtt.log"
#define xttlog_cLogFile "$pwrp_log/xtt_%s.log"
typedef enum {
xttlog_eCategory_,
......
......@@ -3675,6 +3675,15 @@ int XNav::init_brow_base_cb( FlowCtx *fctx, void *client_data)
else
xnav->login();
if ( xnav->opplace_p && (xnav->opplace_p->Options & pwr_mOpPlaceOptionsMask_OperatorLog ||
xnav->opplace_p->Options & pwr_mOpPlaceOptionsMask_OperatorExtendedLog)) {
pwr_tCmd cmd;
strcpy( cmd, "oplog start");
if ( xnav->opplace_p->Options & pwr_mOpPlaceOptionsMask_OperatorExtendedLog)
strcat( cmd, " /event");
xnav->command( cmd);
}
// Execute the setup script
xnav->gbl.setupscript_exec( xnav);
......
......@@ -6047,6 +6047,7 @@ static int xnav_oplog_func(void *client_data,
char arg1_str[80];
int arg1_sts;
pwr_tCmd cmd;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str));
......@@ -6056,7 +6057,18 @@ static int xnav_oplog_func(void *client_data,
int event = ODD( dcli_get_qualifier( "/EVENT", 0, 0));
if ( EVEN( dcli_get_qualifier( "/FILE", file_str, sizeof(file_str)))) {
strcpy( file_str, xttlog_cLogFile);
char *s;
if ( (s = strrchr( xnav->opplace_name, '-')))
s++;
else
s = xnav->opplace_name;
sprintf( file_str, xttlog_cLogFile, cdh_Low(s));
// Save any previous file with this name
sprintf( cmd, "pwrp_env.sh save file %s", file_str);
system( cmd);
}
if ( event)
......@@ -6083,7 +6095,14 @@ static int xnav_oplog_func(void *client_data,
int pid;
if ( EVEN( dcli_get_qualifier( "/FILE", file_str, sizeof(file_str)))) {
strcpy( file_str, xttlog_cLogFile);
char *s;
if ( (s = strrchr( xnav->opplace_name, '-')))
s++;
else
s = xnav->opplace_name;
sprintf( file_str, xttlog_cLogFile, cdh_Low(s));
}
if ( ODD( dcli_get_qualifier( "/SPEED", speed_str, sizeof(speed_str)))) {
......
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