Commit 8bb6cc02 authored by Claes Sjofors's avatar Claes Sjofors

wb syntax method for DsTrendCurve added

parent 5b5d88dd
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 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.
**/
/* wb_c_dstrendcurve.c -- work bench methods of the DsTrendCurve class. */
#include <string.h>
#include "wb_pwrs.h"
#include "wb_ldh_msg.h"
#include "wb_pwrb_msg.h"
#include "pwr_baseclasses.h"
#include "wb_ldh.h"
#include "wb_session.h"
#include "wb_wsx.h"
#include "wb_pwrb_msg.h"
//
// Syntax check.
//
static pwr_tStatus SyntaxCheck (
ldh_tSesContext Session,
pwr_tAttrRef Object, /* current object */
int *ErrorCount, /* accumulated error count */
int *WarningCount /* accumulated waring count */
) {
// Check DataName
wb_session *sp = (wb_session *)Session;
pwr_tAttrRef attribute_vect[10];
pwr_tAttrRef buffers_vect[10];
wb_attribute a = sp->attribute( &Object);
if ( !a) return a.sts();
wb_attribute attribute_a( a, 0, "Attribute");
if (!attribute_a) return attribute_a.sts();
attribute_a.value( &attribute_vect);
if ( !attribute_a) return attribute_a.sts();
wb_attribute attribute_b( a, 0, "Buffers");
if (!attribute_b) return attribute_b.sts();
attribute_b.value( &buffers_vect);
if ( !attribute_a) return attribute_a.sts();
for ( unsigned int i = 0; i < sizeof(attribute_vect)/sizeof(attribute_vect[0]); i++) {
if ( cdh_ObjidIsNotNull( attribute_vect[i].Objid)) {
if ( attribute_vect[i].Flags.b.Object ||
attribute_vect[i].Flags.b.ObjectAttr) {
wsx_error_msg_str( Session, "Bad Attribute reference, invalid type", Object, 'E', ErrorCount, WarningCount);
return PWRB__SUCCESS;
}
if ( cdh_ObjidIsNull( buffers_vect[i].Objid))
wsx_error_msg_str( Session, "Buffer object not specified", Object, 'E', ErrorCount, WarningCount);
wb_attribute data_a = sp->attribute( &attribute_vect[i]);
if ( !data_a) {
wsx_error_msg_str( Session, "Bad Attribute reference", Object, 'E', ErrorCount, WarningCount);
}
else {
// Check DataName type
switch ( data_a.tid()) {
case pwr_eType_Boolean:
case pwr_eType_Float32:
case pwr_eType_Float64:
case pwr_eType_Int8:
case pwr_eType_Int16:
case pwr_eType_Int32:
case pwr_eType_UInt8:
case pwr_eType_UInt16:
case pwr_eType_UInt32:
break;
default:
wsx_error_msg_str( Session, "Attribute type not supported", Object, 'E', ErrorCount, WarningCount);
}
}
}
}
return PWRB__SUCCESS;
}
// Every method to be exported to the workbench should be registred here.
pwr_dExport pwr_BindMethods(DsTrendCurve) = {
pwr_BindMethod(SyntaxCheck),
pwr_NullMethod
};
......@@ -42,6 +42,7 @@ pwr_dImport pwr_BindMethods(ASup);
pwr_dImport pwr_BindMethods(DsFast);
pwr_dImport pwr_BindMethods(SevHist);
pwr_dImport pwr_BindMethods(DsTrend);
pwr_dImport pwr_BindMethods(DsTrendCurve);
pwr_dImport pwr_BindMethods(DSup);
pwr_dImport pwr_BindMethods(PlcPgm);
pwr_dImport pwr_BindMethods(PlcEmbed);
......@@ -121,4 +122,4 @@ pwr_dExport pwr_BindClasses(Base) = {
pwr_BindClass(SevHistThread),
pwr_BindClass(SevHistObject),
pwr_NullClass
};
\ No newline at end of file
};
......@@ -2,6 +2,7 @@ ASup
DsFast
SevHist
DsTrend
DsTrendCurve
DSup
PlcPgm
PlcEmbed
......
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