Commit f97ec8a9 authored by claes's avatar claes

Config methods

parent 9b36da9f
! !
! Proview $Id: pwrs_c_classdef.wb_load,v 1.6 2005-09-01 14:58:03 claes Exp $ ! Proview $Id: pwrs_c_classdef.wb_load,v 1.7 2006-05-31 08:09:07 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB. ! Copyright (C) 2005 SSAB Oxelsund AB.
! !
! This program is free software; you can redistribute it and/or ! This program is free software; you can redistribute it and/or
...@@ -193,35 +193,73 @@ SObject pwrs:Class ...@@ -193,35 +193,73 @@ SObject pwrs:Class
EndObject EndObject
Object ConfiguratorPosnn $Menu Object ConfiguratorPosnn $Menu
Object Pointed $Menu Object Pointed $Menu
Object ConfigFo $MenuButton Object Configure $MenuCascade
Body SysBody Body SysBody
Attr ButtonName = "ConfigFo" Attr ButtonName = "Configure"
Attr MethodName = "$ClassDef-ConfigFc"
EndBody
EndObject
Object ConfigConnectedFo $MenuButton
Body SysBody
Attr ButtonName = "ConfigConnectedFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "PlcConnect"
EndBody EndBody
Object Fo $MenuButton
Body SysBody
Attr ButtonName = "Fo"
Attr MethodName = "$ClassDef-ConfigFc"
EndBody
EndObject
Object ConnectedFo $MenuButton
Body SysBody
Attr ButtonName = "ConnectedFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "PlcConnect"
EndBody
EndObject
Object CCodeFo $MenuButton
Body SysBody
Attr ButtonName = "CCodeFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "CCode"
EndBody
EndObject
Object ConnectedCCodeFo $MenuButton
Body SysBody
Attr ButtonName = "ConnectedCCodeFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "PlcConnectCCode"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
EndObject EndObject
Object ConfiguratorPosos $Menu Object ConfiguratorPosos $Menu
Object Pointed $Menu Object Pointed $Menu
Object ConfigFo $MenuButton Object Configure $MenuCascade
Body SysBody
Attr ButtonName = "ConfigFo"
Attr MethodName = "$ClassDef-ConfigFc"
EndBody
EndObject
Object ConfigConnectedFo $MenuButton
Body SysBody Body SysBody
Attr ButtonName = "ConfigConnectedFo" Attr ButtonName = "Configure"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "PlcConnect"
EndBody EndBody
Object Fo $MenuButton
Body SysBody
Attr ButtonName = "Fo"
Attr MethodName = "$ClassDef-ConfigFc"
EndBody
EndObject
Object ConnectedFo $MenuButton
Body SysBody
Attr ButtonName = "ConnectedFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "PlcConnect"
EndBody
EndObject
Object CCodeFo $MenuButton
Body SysBody
Attr ButtonName = "CCodeFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "CCode"
EndBody
EndObject
Object ConnectedCCodeFo $MenuButton
Body SysBody
Attr ButtonName = "ConnectedCCodeFo"
Attr MethodName = "$ClassDef-ConfigFc"
Attr MethodArguments[0] = "PlcConnectCCode"
EndBody
EndObject
EndObject EndObject
EndObject EndObject
EndObject EndObject
......
/* /*
* Proview $Id: wb_c_classdef.c,v 1.5 2005-09-06 10:43:30 claes Exp $ * Proview $Id: wb_c_classdef.c,v 1.6 2006-05-31 08:10:28 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -75,9 +75,12 @@ static pwr_tStatus ConfigFc ( ...@@ -75,9 +75,12 @@ static pwr_tStatus ConfigFc (
int size; int size;
pwr_tCid cid; pwr_tCid cid;
pwr_tTid tid; pwr_tTid tid;
unsigned int flags;
pwr_tInt32 int_val; pwr_tInt32 int_val;
pwr_tObjid oid; pwr_tObjid oid;
pwr_tObjid coid;
int plcconnect = 0; int plcconnect = 0;
int plctemplate = 0;
char str[80]; char str[80];
pwr_sMenuButton mb; pwr_sMenuButton mb;
...@@ -95,9 +98,22 @@ static pwr_tStatus ConfigFc ( ...@@ -95,9 +98,22 @@ static pwr_tStatus ConfigFc (
ip->ItemList[ip->ChosenItem].MenuObject, ip->ItemList[ip->ChosenItem].MenuObject,
"SysBody", &mb, sizeof(pwr_sMenuButton)); "SysBody", &mb, sizeof(pwr_sMenuButton));
if ( strcmp(mb.MethodArguments[0], "PlcConnect") == 0) if ( strcmp(mb.MethodArguments[0], "PlcConnect") == 0) {
plcconnect = 1; plcconnect = 1;
plctemplate = 1;
}
else if ( strcmp(mb.MethodArguments[0], "CCode") == 0) {
plcconnect = 0;
plctemplate = 0;
}
else if ( strcmp(mb.MethodArguments[0], "PlcConnectCCode") == 0) {
plcconnect = 1;
plctemplate = 0;
}
else {
plcconnect = 0;
plctemplate = 1;
}
sts = ldh_ObjidToName( ip->PointedSession, ip->Pointed.Objid, ldh_eName_Hierarchy, sts = ldh_ObjidToName( ip->PointedSession, ip->Pointed.Objid, ldh_eName_Hierarchy,
pname, sizeof(pname), &size); pname, sizeof(pname), &size);
...@@ -111,21 +127,40 @@ static pwr_tStatus ConfigFc ( ...@@ -111,21 +127,40 @@ static pwr_tStatus ConfigFc (
ip->Pointed.Objid, ldh_eDest_IntoFirst); ip->Pointed.Objid, ldh_eDest_IntoFirst);
if ( plcconnect) { if ( plcconnect) {
// Create PlcConnect attribute
strcpy( name, pname); strcpy( name, pname);
strcat( name, "-"); strcat( name, "-");
strcat( name, "RtBody"); strcat( name, "RtBody");
sts = ldh_NameToObjid( ip->PointedSession, &oid, name); sts = ldh_NameToObjid( ip->PointedSession, &oid, name);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = ldh_CreateObject( ip->PointedSession, &oid, "PlcConnect", pwr_eClass_Intern, sts = ldh_CreateObject( ip->PointedSession, &coid, "PlcConnect", pwr_eClass_Intern,
oid, ldh_eDest_IntoLast); oid, ldh_eDest_IntoLast);
if ( ODD(sts)) { if ( ODD(sts)) {
tid = pwr_eType_AttrRef; tid = pwr_eType_AttrRef;
sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "TypeRef", (char *)&tid, sts = ldh_SetObjectPar(ip->PointedSession, coid, "SysBody", "TypeRef", (char *)&tid,
sizeof(tid)); sizeof(tid));
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
if ( !plctemplate) {
// Create PlcConnectP attribute
sts = ldh_CreateObject( ip->PointedSession, &coid, "PlcConnectP", pwr_eClass_Intern,
oid, ldh_eDest_IntoLast);
if ( ODD(sts)) {
tid = pwr_eType_Char;
sts = ldh_SetObjectPar(ip->PointedSession, coid, "SysBody", "TypeRef", (char *)&tid,
sizeof(tid));
if ( EVEN(sts)) return sts;
flags = PWR_MASK_INVISIBLE | PWR_MASK_POINTER | PWR_MASK_PRIVATE;
sts = ldh_SetObjectPar(ip->PointedSession, coid, "SysBody", "Flags", (char *)&flags,
sizeof(flags));
if ( EVEN(sts)) return sts;
}
}
} }
sts = ldh_CreateObject( ip->PointedSession, &oid, "DevBody", pwr_eClass_ObjBodyDef, sts = ldh_CreateObject( ip->PointedSession, &oid, "DevBody", pwr_eClass_ObjBodyDef,
...@@ -154,23 +189,31 @@ static pwr_tStatus ConfigFc ( ...@@ -154,23 +189,31 @@ static pwr_tStatus ConfigFc (
pwr_eClass_GraphPlcNode, pwr_eClass_GraphPlcNode,
ip->Pointed.Objid, ldh_eDest_IntoLast); ip->Pointed.Objid, ldh_eDest_IntoLast);
if ( ODD(sts)) { if ( ODD(sts)) {
cid = pwr_cClass_windowplc; if ( plctemplate) {
int_val = 1; cid = pwr_cClass_windowplc;
int_val = 1;
sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "subwindows", sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "subwindows",
(char *)&int_val, sizeof(int_val)); (char *)&int_val, sizeof(int_val));
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "subwindow_class[0]", sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "subwindow_class[0]",
(char *)&cid, sizeof(cid)); (char *)&cid, sizeof(cid));
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
}
int_val = 1; int_val = 1;
sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "segname_annotation", sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "segname_annotation",
(char *)&int_val, sizeof(int_val)); (char *)&int_val, sizeof(int_val));
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
int_val = 58; if ( plctemplate)
int_val = 58;
else if ( plcconnect)
int_val = 35;
else
int_val = 4;
sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "compmethod", sts = ldh_SetObjectPar(ip->PointedSession, oid, "SysBody", "compmethod",
(char *)&int_val, sizeof(int_val)); (char *)&int_val, sizeof(int_val));
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -222,9 +265,11 @@ static pwr_tStatus ConfigFc ( ...@@ -222,9 +265,11 @@ static pwr_tStatus ConfigFc (
} }
} }
sts = ldh_CreateObject( ip->PointedSession, &oid, "Code", if ( plctemplate) {
pwr_cClass_PlcTemplate, sts = ldh_CreateObject( ip->PointedSession, &oid, "Code",
ip->Pointed.Objid, ldh_eDest_IntoLast); pwr_cClass_PlcTemplate,
ip->Pointed.Objid, ldh_eDest_IntoLast);
}
return PWRS__SUCCESS; return PWRS__SUCCESS;
} }
......
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