Commit 3a72aa92 authored by Claes Sjofors's avatar Claes Sjofors

Remote logg function remote_logg() added, and some doc added

parent 9265ec85
......@@ -234,3 +234,6 @@ typedef struct {
int maxremao; /* Number of Ao in subsystem */
int maxremco; /* Number of Pi in subsystem */
} remnode_item;
pwr_tStatus remote_logg( int identity, char *str, int size);
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2013 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.
*/
#include "pwr.h"
#include "co_time.h"
#include "rt_qcom.h"
#include "pwr_remoteclasses.h"
#include "remote.h"
pwr_tStatus remote_logg( int identity, char *str, int size)
{
qcom_sPut put;
qcom_sQid qid;
char *logmsg;
char timstr[26];
int logsize = size + 5 + sizeof(timstr);
pwr_tStatus sts;
time_AtoAscii( 0, time_eFormat_DateAndTime,
timstr, sizeof(timstr));
logmsg = malloc(logsize);
*(int *)logmsg = identity;
strcpy( &logmsg[4], timstr);
strcat( &logmsg[4], " ");
strncat( &logmsg[4], str, size+1);
put.data = logmsg;
put.size = logsize;
put.type.b = qcom_eBtype__;
put.type.s = qcom_eStype__;
put.reply.qix = 0;
put.reply.nid = 0;
qid = qcom_cNQid;
qid.qix = rs_pwr_logg_qix;
sts = qcom_Put(&sts, &qid, &put);
free(logmsg);
return sts;
}
......@@ -33,9 +33,66 @@
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! remote_c_LoggConfig.wb_load -- Defines the class LoggConfig.
! remote_c_loggconfig.wb_load -- Defines the class LoggConfig.
!
SObject Remote:Class
!/**
! @Version 1.0
! @Group Servers,NodeConfiguration
! @Summary Configures logging of remote messages and other logging.
! Configures logging of remote messages and other logging.
!
! @b Remote logging
! Remote messages can be logged to file by setting LoggLevel in the
! RemTrans object to a value between 1 and 4.
!
! LoggLevel Description
!
! 0 No logging.
! 1 Logging of time, message lenght and status when an error
! has occured.
! 2 Logging of time, message lenght and status for every message.
! 3 Logging of time, length, status and the first 48 bytes
! in hexadecimal code.
! 4 Logging of time, length, status and the whole message
! in hex code.
!
! The Identity for a LoggConfig object handling the remote logging should
! be set to 90.
!
! @ Other logging
! Other loggings can be made by sending a QCom message to queue
! rs_pwr_logg_qix. The first 32-bit word in the message should be the
! Identity of the LoggConfig object, and the following data the string
! to be logged.
!
! @b Example Logging to LoggConfig with Identity 100
!
! qcom_sPut put;
! qcom_sQid qid;
! char *logmsg;
! int logsize = 80;
! int identity = 100;
! pwr_tStatus sts;
!
! logmsg = malloc(logsize);
! *(int *)logmsg = identity;
! strcpy( &logmsg[4], "Some message");
! put.data = logmsg;
! put.size = logsize;
! put.type.b = qcom_eBtype__;
! put.type.s = qcom_eStype__;
! put.reply.qix = 0;
! put.reply.nid = 0;
! qid = qcom_cNQid;
! qid.qix = rs_pwr_logg_qix;
! qcom_Put(&sts, &qid, &put);
!
! free(logmsg);
!
! @b See also
! @classlink RemTrans remote_remtrans.html
!*/
Object LoggConfig $ClassDef 27
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
......@@ -48,14 +105,17 @@ SObject Remote:Class
Body SysBody
Attr StructName = "LoggConfig"
EndBody
!
! Parameter Description
!
!/**
! Name of log file, eg $pwrp_log/remote.log
!*/
Object LoggFile $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! Obsolete.
!*/
Object NewVersion $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
......@@ -63,11 +123,21 @@ SObject Remote:Class
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Identity is used to direct the logging to a specific
! LoggConfig object. The first word in the log message should
! correspond to this value.
!
! Identity 90 is used for remote logging.
!*/
Object Identity $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Number of loggings written to file since startup.
!*/
Object LoggCount $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
......@@ -75,6 +145,9 @@ SObject Remote:Class
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Obsolete.
!*/
Object FileOpenCount $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnode3964r_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object Remnode3964R $ClassDef 1
Body SysBody
......
......@@ -52,8 +52,8 @@ SObject Remote:Class
! @image orm_remnodealcm_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeALCM $ClassDef 2
Body SysBody
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnodemodbus_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeModbus $ClassDef 3
Body SysBody
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnodemq_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeMQ $ClassDef 4
Body SysBody
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnoderk512_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeRK512 $ClassDef 9
Body SysBody
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnodeserial_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeSerial $ClassDef 6
Body SysBody
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnodetcp_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeTCP $ClassDef 8
Body SysBody
......
......@@ -46,8 +46,8 @@ SObject Remote:Class
! @image orm_remnodeudp_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeUDP $ClassDef 5
Body SysBody
......
......@@ -54,8 +54,8 @@ SObject Remote:Class
! @image orm_remnodewmq_og.gif
!
! @b See also
! @classlink RemoteConfig pwrp_remoteconfig.html
! @classlink RemTrans ssab_remtrans.html
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeWMQ $ClassDef 33
Body SysBody
......
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