Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
5347a161
Commit
5347a161
authored
Feb 17, 2005
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlcConnect method added
parent
7b34241a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
167 additions
and
0 deletions
+167
-0
wb/lib/wb/src/wb_c_classdef.c
wb/lib/wb/src/wb_c_classdef.c
+167
-0
No files found.
wb/lib/wb/src/wb_c_classdef.c
View file @
5347a161
...
...
@@ -9,7 +9,9 @@
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
#include "pwr_baseclasses.h"
#include "ge.h"
#include "co_wow.h"
static
pwr_tStatus
AnteCreate
(
ldh_tSesContext
Session
,
...
...
@@ -46,9 +48,174 @@ static pwr_tStatus OpenClassGraph (
return
PWRS__SUCCESS
;
}
static
pwr_tStatus
ConfigFc
(
ldh_sMenuCall
*
ip
)
{
int
sts
;
pwr_tOName
name
;
pwr_tOName
pname
;
pwr_tObjName
oname
;
int
size
;
pwr_tCid
cid
;
pwr_tTid
tid
;
pwr_tInt32
int_val
;
pwr_tObjid
oid
;
int
plcconnect
=
0
;
char
str
[
80
];
pwr_sMenuButton
mb
;
sts
=
ldh_GetChild
(
ip
->
PointedSession
,
ip
->
Pointed
.
Objid
,
&
oid
);
if
(
ODD
(
sts
))
{
wow_DisplayError
(
ip
->
WindowContext
,
"Error"
,
"ClassDef is already configured
\n
Object has child"
);
return
0
;
}
/* If argument is PlcConnect, configure a connected function object
i.e. an $Intern named PlcConnnect, a PlcConnect MenuRef, and
connectmethod 10 */
sts
=
ldh_ReadObjectBody
(
ip
->
PointedSession
,
ip
->
ItemList
[
ip
->
ChosenItem
].
MenuObject
,
"SysBody"
,
&
mb
,
sizeof
(
pwr_sMenuButton
));
if
(
strcmp
(
mb
.
MethodArguments
[
0
],
"PlcConnect"
)
==
0
)
plcconnect
=
1
;
sts
=
ldh_ObjidToName
(
ip
->
PointedSession
,
ip
->
Pointed
.
Objid
,
ldh_eName_Hierarchy
,
pname
,
sizeof
(
pname
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_ObjidToName
(
ip
->
PointedSession
,
ip
->
Pointed
.
Objid
,
ldh_eName_Object
,
oname
,
sizeof
(
oname
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"RtBody"
,
pwr_eClass_ObjBodyDef
,
ip
->
Pointed
.
Objid
,
ldh_eDest_IntoFirst
);
if
(
plcconnect
)
{
strcpy
(
name
,
pname
);
strcat
(
name
,
"-"
);
strcat
(
name
,
"RtBody"
);
sts
=
ldh_NameToObjid
(
ip
->
PointedSession
,
&
oid
,
name
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"PlcConnect"
,
pwr_eClass_Intern
,
oid
,
ldh_eDest_IntoLast
);
if
(
ODD
(
sts
))
{
tid
=
pwr_eType_AttrRef
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"TypeRef"
,
(
char
*
)
&
tid
,
sizeof
(
tid
));
if
(
EVEN
(
sts
))
return
sts
;
}
}
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"DevBody"
,
pwr_eClass_ObjBodyDef
,
ip
->
Pointed
.
Objid
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
sts
))
{
// The object already exist
}
strcpy
(
name
,
pname
);
strcat
(
name
,
"-"
);
strcat
(
name
,
"DevBody"
);
sts
=
ldh_NameToObjid
(
ip
->
PointedSession
,
&
oid
,
name
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"PlcNode"
,
pwr_eClass_Buffer
,
oid
,
ldh_eDest_IntoLast
);
if
(
ODD
(
sts
))
{
cid
=
pwr_eClass_PlcNode
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"Class"
,
(
char
*
)
&
cid
,
sizeof
(
cid
));
if
(
EVEN
(
sts
))
return
sts
;
}
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"GraphPlcNode"
,
pwr_eClass_GraphPlcNode
,
ip
->
Pointed
.
Objid
,
ldh_eDest_IntoLast
);
if
(
ODD
(
sts
))
{
cid
=
pwr_cClass_windowplc
;
int_val
=
1
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"subwindows"
,
(
char
*
)
&
int_val
,
sizeof
(
int_val
));
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"subwindow_class[0]"
,
(
char
*
)
&
cid
,
sizeof
(
cid
));
if
(
EVEN
(
sts
))
return
sts
;
int_val
=
1
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"segname_annotation"
,
(
char
*
)
&
int_val
,
sizeof
(
int_val
));
if
(
EVEN
(
sts
))
return
sts
;
int_val
=
58
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"compmethod"
,
(
char
*
)
&
int_val
,
sizeof
(
int_val
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
plcconnect
)
{
int_val
=
10
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"connectmethod"
,
(
char
*
)
&
int_val
,
sizeof
(
int_val
));
if
(
EVEN
(
sts
))
return
sts
;
}
int_val
=
2
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"executeordermethod"
,
(
char
*
)
&
int_val
,
sizeof
(
int_val
));
if
(
EVEN
(
sts
))
return
sts
;
oname
[
15
]
=
0
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"objname"
,
oname
,
sizeof
(
pwr_tString16
));
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"graphname"
,
oname
,
sizeof
(
pwr_tString16
));
if
(
EVEN
(
sts
))
return
sts
;
}
if
(
plcconnect
)
{
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"RtXtt"
,
pwr_eClass_RtMenu
,
ip
->
Pointed
.
Objid
,
ldh_eDest_IntoLast
);
strcpy
(
name
,
pname
);
strcat
(
name
,
"-"
);
strcat
(
name
,
"RtXtt"
);
sts
=
ldh_NameToObjid
(
ip
->
PointedSession
,
&
oid
,
name
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"PlcConnect"
,
pwr_eClass_MenuRef
,
oid
,
ldh_eDest_IntoLast
);
if
(
ODD
(
sts
))
{
strcpy
(
str
,
"PlcConnect"
);
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"ButtonName"
,
str
,
sizeof
(
pwr_tString40
));
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_SetObjectPar
(
ip
->
PointedSession
,
oid
,
"SysBody"
,
"RefAttribute"
,
str
,
sizeof
(
pwr_tString40
));
if
(
EVEN
(
sts
))
return
sts
;
}
}
sts
=
ldh_CreateObject
(
ip
->
PointedSession
,
&
oid
,
"Code"
,
pwr_cClass_PlcTemplate
,
ip
->
Pointed
.
Objid
,
ldh_eDest_IntoLast
);
return
PWRS__SUCCESS
;
}
pwr_dExport
pwr_BindMethods
(
$
ClassDef
)
=
{
pwr_BindMethod
(
AnteCreate
),
pwr_BindMethod
(
OpenClassGraph
),
pwr_BindMethod
(
ConfigFc
),
pwr_NullMethod
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment