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
6d66e64a
Commit
6d66e64a
authored
Apr 12, 2006
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on Profbus configurator
parent
8493264f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
37 deletions
+102
-37
profibus/lib/rt/src/rt_pb_gsd.cpp
profibus/lib/rt/src/rt_pb_gsd.cpp
+16
-14
profibus/lib/rt/src/rt_pb_gsd.h
profibus/lib/rt/src/rt_pb_gsd.h
+2
-1
profibus/lib/rt/src/rt_pb_gsd_attr.cpp
profibus/lib/rt/src/rt_pb_gsd_attr.cpp
+7
-3
profibus/lib/rt/src/rt_pb_gsd_attr.h
profibus/lib/rt/src/rt_pb_gsd_attr.h
+2
-1
profibus/lib/rt/src/rt_pb_gsd_attrnav.cpp
profibus/lib/rt/src/rt_pb_gsd_attrnav.cpp
+7
-1
profibus/lib/wb/src/wb_c_pb_dp_slave.cpp
profibus/lib/wb/src/wb_c_pb_dp_slave.cpp
+43
-12
profibus/lib/xtt/src/xtt_c_pb_dp_slave.cpp
profibus/lib/xtt/src/xtt_c_pb_dp_slave.cpp
+25
-5
No files found.
profibus/lib/rt/src/rt_pb_gsd.cpp
View file @
6d66e64a
/*
* Proview $Id: rt_pb_gsd.cpp,v 1.
2 2006-04-05 08:36:31
claes Exp $
* Proview $Id: rt_pb_gsd.cpp,v 1.
3 2006-04-12 12:17:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -313,7 +313,7 @@ static void *t_malloc( int a1) {
pb_gsd
::
pb_gsd
()
:
dptype
(
0
),
modular_station
(
0
),
max_module
(
0
),
user_prm_data_len
(
0
),
max_user_prm_data_len
(
0
),
status
(
0
),
datalist
(
0
),
user_prm_data_len
(
0
),
max_user_prm_data_len
(
0
),
status
(
0
),
address
(
0
),
datalist
(
0
),
modulelist
(
0
),
prm_textlist
(
0
),
extuserprmdatalist
(
0
),
extuserprmdatareflist
(
0
),
current_module
(
0
),
current_area
(
0
),
current_prm_text
(
0
),
current_extuserprmdata
(
0
),
extuserprmdataconst
(
0
),
prm_dataitems
(
0
),
module_conf
(
0
),
module_conf_cnt
(
0
),
...
...
@@ -934,10 +934,12 @@ int pb_gsd::read( char *filename)
case
gsd_DiagAreaEnd
:
case
gsd_DiagType
:
case
gsd_Value
:
if
(
part_cnt
>=
2
)
printf
(
"Line %s %s
\n
"
,
keyp
->
name
,
line_part
[
1
]);
else
printf
(
"Line %s
\n
"
,
keyp
->
name
);
if
(
part_cnt
>=
2
)
{
// printf( "Line %s %s\n", keyp->name, line_part[1]);
}
else
{
// printf( "Line %s\n", keyp->name);
}
break
;
default:
printf
(
"Unknown type, line %d
\n
"
,
line_cnt
);
...
...
@@ -1189,10 +1191,10 @@ int pb_gsd::prm_items_to_data( gsd_sPrmDataItem *item, int item_size,
}
}
printf
(
"To Data: "
);
for
(
int
i
=
0
;
i
<
data_size
;
i
++
)
printf
(
"0x%x,"
,
data
[
i
]);
printf
(
"
\n
"
);
//
printf( "To Data: ");
//
for ( int i = 0; i < data_size; i++)
//
printf( "0x%x,", data[i]);
//
printf("\n");
return
1
;
}
...
...
@@ -1296,10 +1298,10 @@ int pb_gsd::prm_data_to_items( gsd_sPrmDataItem *item, int item_size,
default:
;
}
}
printf
(
"From Data: "
);
for
(
int
i
=
0
;
i
<
data_size
;
i
++
)
printf
(
"0x%x,"
,
data
[
i
]);
printf
(
"
\n
"
);
//
printf( "From Data: ");
//
for ( int i = 0; i < data_size; i++)
//
printf( "0x%x,", data[i]);
//
printf("\n");
return
1
;
}
...
...
profibus/lib/rt/src/rt_pb_gsd.h
View file @
6d66e64a
/*
* Proview $Id: rt_pb_gsd.h,v 1.
2 2006-04-05 08:36:31
claes Exp $
* Proview $Id: rt_pb_gsd.h,v 1.
3 2006-04-12 12:17:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -188,6 +188,7 @@ class pb_gsd {
int
max_user_prm_data_len
;
int
line_cnt
;
int
status
;
int
address
;
gsd_sData
*
datalist
;
gsd_sModule
*
modulelist
;
gsd_sPrmText
*
prm_textlist
;
...
...
profibus/lib/rt/src/rt_pb_gsd_attr.cpp
View file @
6d66e64a
/*
* Proview $Id: rt_pb_gsd_attr.cpp,v 1.
2 2006-04-05 08:36:31
claes Exp $
* Proview $Id: rt_pb_gsd_attr.cpp,v 1.
3 2006-04-12 12:17:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -170,7 +170,11 @@ static void gsdattr_activate_exit( Widget w, GsdAttr *attr, XmAnyCallbackStruct
static
void
gsdattr_activate_help
(
Widget
w
,
GsdAttr
*
attr
,
XmAnyCallbackStruct
*
data
)
{
// Not yet implemented
int
sts
;
if
(
attr
->
help_cb
)
sts
=
(
attr
->
help_cb
)(
attr
->
parent_ctx
,
"pb_slave_editor /helpfile=
\"
$pwr_exe/profibus_xtthelp.dat
\"
"
);
}
static
void
gsdattr_activate_copy
(
Widget
w
,
GsdAttr
*
attr
,
XmAnyCallbackStruct
*
data
)
...
...
@@ -445,7 +449,7 @@ GsdAttr::GsdAttr( Widget a_parent_wid,
pb_gsd
*
a_gsd
,
int
a_edit_mode
)
:
parent_ctx
(
a_parent_ctx
),
gsd
(
a_gsd
),
edit_mode
(
a_edit_mode
),
input_open
(
0
),
object
(
a_object
),
close_cb
(
0
),
save_cb
(
0
),
client_data
(
0
),
recall_idx
(
-
1
),
close_cb
(
0
),
save_cb
(
0
),
help_cb
(
0
),
client_data
(
0
),
recall_idx
(
-
1
),
value_current_recall
(
0
)
{
char
uid_filename
[
120
]
=
{
"pwr_exe:pb_gsd_attr.uid"
};
...
...
profibus/lib/rt/src/rt_pb_gsd_attr.h
View file @
6d66e64a
/*
* Proview $Id: rt_pb_gsd_attr.h,v 1.
2 2006-04-05 08:36:31
claes Exp $
* Proview $Id: rt_pb_gsd_attr.h,v 1.
3 2006-04-12 12:17:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -75,6 +75,7 @@ class GsdAttr {
void
*
object
;
void
(
*
close_cb
)
(
void
*
);
int
(
*
save_cb
)
(
void
*
);
int
(
*
help_cb
)
(
void
*
,
char
*
);
void
*
client_data
;
int
recall_idx
;
static
char
value_recall
[
30
][
160
];
...
...
profibus/lib/rt/src/rt_pb_gsd_attrnav.cpp
View file @
6d66e64a
/*
* Proview $Id: rt_pb_gsd_attrnav.cpp,v 1.
1 2006-03-31 08:46:37
claes Exp $
* Proview $Id: rt_pb_gsd_attrnav.cpp,v 1.
2 2006-04-12 12:17:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -1383,6 +1383,12 @@ int GsdAttrNav::object_attr()
}
}
p
=
(
void
*
)
&
gsd
->
address
;
new
ItemPbBase
(
this
,
"Address"
,
"LocalGsdAttr"
,
pwr_eType_Int32
,
sizeof
(
pwr_tInt32
),
0
,
0
,
p
,
0
,
0
,
NULL
,
flow_eDest_IntoLast
);
new
ItemPbMoreData
(
this
,
"SlaveGsdData"
,
NULL
,
flow_eDest_IntoLast
);
new
ItemPbPrmData
(
this
,
"UserPrmData"
,
NULL
,
flow_eDest_IntoLast
);
...
...
profibus/lib/wb/src/wb_c_pb_dp_slave.cpp
View file @
6d66e64a
/*
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.
3 2006-03-31 08:53:5
5 claes Exp $
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.
4 2006-04-12 12:17:4
5 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -57,6 +57,8 @@ extern "C" {
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_pwrb_msg.h"
#include "rt_pb_msg.h"
#include "wb_wnav.h"
using
namespace
std
;
...
...
@@ -73,6 +75,7 @@ typedef struct {
ldh_tSession
ldhses
;
pwr_tAttrRef
aref
;
gsd_sModuleClass
*
mc
;
void
*
editor_ctx
;
}
slave_sCtx
;
...
...
@@ -89,9 +92,18 @@ static void get_subcid( ldh_tSession ldhses, pwr_tCid cid, vector<pwr_tCid>& v)
}
}
static
int
attr_help_cb
(
void
*
sctx
,
char
*
text
)
{
pwr_tCmd
cmd
;
slave_sCtx
*
ctx
=
(
slave_sCtx
*
)
sctx
;
strcpy
(
cmd
,
"help "
);
strcat
(
cmd
,
text
);
return
((
WNav
*
)
ctx
->
editor_ctx
)
->
command
(
cmd
);
}
static
void
attr_close_cb
(
void
*
sctx
)
{
printf
(
"Close gsd
\n
"
);
slave_sCtx
*
ctx
=
(
slave_sCtx
*
)
sctx
;
delete
ctx
->
attr
;
delete
ctx
->
gsd
;
...
...
@@ -114,7 +126,14 @@ static int attr_save_cb( void *sctx)
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
ldh_eName_Hierarchy
,
name
,
sizeof
(
name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
printf
(
"Objid: %s
\n
"
,
name
);
// SlaveAddress
pwr_tUInt16
address
=
ctx
->
gsd
->
address
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
ctx
->
aref
,
"SlaveAddress"
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
address
,
sizeof
(
address
));
if
(
EVEN
(
sts
))
return
sts
;
// VendorName
sts
=
ctx
->
gsd
->
get_svalue
(
"Vendor_Name"
,
svalue
,
sizeof
(
svalue
));
...
...
@@ -404,6 +423,17 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
ctx
->
gsd
->
add_module_conf
(
cid
,
oid
,
name
,
module_name
);
}
// Set address
pwr_tUInt16
address
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
ctx
->
aref
,
"SlaveAddress"
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_ReadAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
address
,
sizeof
(
address
));
if
(
EVEN
(
sts
))
return
sts
;
ctx
->
gsd
->
address
=
address
;
// Set Ext_User_Prm_Data
pwr_tUInt8
prm_user_data
[
256
];
pwr_tUInt16
prm_user_data_len
;
...
...
@@ -433,12 +463,11 @@ static pwr_tStatus Configure (
ldh_sMenuCall
*
ip
)
{
printf
(
"Here in SlaveConfigure
\n
"
);
pwr_tOName
name
;
char
*
gsdfile
;
int
size
;
int
sts
;
int
lsts
;
int
edit_mode
;
pwr_tFileName
fname
;
ldh_sSessInfo
Info
;
...
...
@@ -464,6 +493,7 @@ static pwr_tStatus Configure (
slave_sCtx
*
ctx
=
(
slave_sCtx
*
)
calloc
(
1
,
sizeof
(
slave_sCtx
));
ctx
->
ldhses
=
ip
->
PointedSession
;
ctx
->
aref
=
ip
->
Pointed
;
ctx
->
editor_ctx
=
ip
->
EditorContext
;
get_subcid
(
ctx
->
ldhses
,
pwr_cClass_Pb_Module
,
mcv
);
ctx
->
mc
=
(
gsd_sModuleClass
*
)
calloc
(
mcv
.
size
()
+
2
,
sizeof
(
gsd_sModuleClass
));
...
...
@@ -494,20 +524,21 @@ static pwr_tStatus Configure (
ctx
->
gsd
->
set_classes
(
ctx
->
mc
);
sts
=
load_modules
(
ctx
);
if
(
EVEN
(
sts
))
return
sts
;
l
sts
=
load_modules
(
ctx
);
if
(
lsts
!=
PB__USERPRMDATALEN
&&
EVEN
(
lsts
))
return
l
sts
;
ctx
->
attr
=
new
GsdAttr
(
(
Widget
)
ip
->
WindowContext
,
ctx
,
0
,
ctx
->
gsd
,
edit_mode
);
ctx
->
attr
->
close_cb
=
attr_close_cb
;
ctx
->
attr
->
save_cb
=
attr_save_cb
;
ctx
->
attr
->
help_cb
=
attr_help_cb
;
free
(
gsdfile
);
if
(
EVEN
(
lsts
))
{
wow_DisplayError
(
ctx
->
attr
->
toplevel
,
"Configuration load error"
,
"Configuration load error
\n
Check configuration data"
);
}
#if 0
sprintf( cmd, "@$pwr_exe/pb_slave_config %s", name);
free
(
gsdfile
);
wtt_command( ip->EditorContext, cmd);
#endif
return
1
;
}
...
...
profibus/lib/xtt/src/xtt_c_pb_dp_slave.cpp
View file @
6d66e64a
/*
* Proview $Id: xtt_c_pb_dp_slave.cpp,v 1.
1 2006-04-05 08:36:32
claes Exp $
* Proview $Id: xtt_c_pb_dp_slave.cpp,v 1.
2 2006-04-12 12:17:45
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -44,11 +44,21 @@ typedef struct {
GsdAttr
*
attr
;
pwr_tAttrRef
aref
;
gsd_sModuleClass
*
mc
;
void
*
editor_ctx
;
}
slave_sCtx
;
static
int
attr_help_cb
(
void
*
sctx
,
char
*
text
)
{
pwr_tCmd
cmd
;
slave_sCtx
*
ctx
=
(
slave_sCtx
*
)
sctx
;
strcpy
(
cmd
,
"help "
);
strcat
(
cmd
,
text
);
return
((
XNav
*
)
ctx
->
editor_ctx
)
->
command
(
cmd
);
}
static
void
attr_close_cb
(
void
*
sctx
)
{
printf
(
"Close gsd
\n
"
);
slave_sCtx
*
ctx
=
(
slave_sCtx
*
)
sctx
;
delete
ctx
->
attr
;
delete
ctx
->
gsd
;
...
...
@@ -57,7 +67,6 @@ static void attr_close_cb( void *sctx)
static
int
attr_save_cb
(
void
*
sctx
)
{
printf
(
"Save gsd
\n
"
);
return
1
;
}
...
...
@@ -108,6 +117,17 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
ctx
->
gsd
->
add_module_conf
(
cid
,
oid
,
name
,
module_name
);
}
// Set address
pwr_tUInt16
address
;
sts
=
gdh_ArefANameToAref
(
&
ctx
->
aref
,
"SlaveAddress"
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetObjectInfoAttrref
(
&
aaref
,
&
address
,
sizeof
(
address
));
if
(
EVEN
(
sts
))
return
sts
;
ctx
->
gsd
->
address
=
address
;
// Set Ext_User_Prm_Data
pwr_tUInt8
prm_user_data
[
256
];
pwr_tUInt16
prm_user_data_len
;
...
...
@@ -136,8 +156,6 @@ static pwr_tStatus load_modules( slave_sCtx *ctx)
// Show Configuration
static
pwr_tStatus
ShowConfiguration
(
xmenu_sMenuCall
*
ip
)
{
printf
(
"ShowConfiguration method called
\n
"
);
pwr_tAName
name
;
pwr_tString80
gsdfile
;
int
sts
;
...
...
@@ -176,6 +194,7 @@ static pwr_tStatus ShowConfiguration( xmenu_sMenuCall *ip)
ctx
->
mc
=
(
gsd_sModuleClass
*
)
calloc
(
module_cnt
+
2
,
sizeof
(
gsd_sModuleClass
));
mc_cnt
=
0
;
ctx
->
editor_ctx
=
ip
->
EditorContext
;
ctx
->
mc
[
0
].
cid
=
pwr_cClass_Pb_Module
;
sts
=
gdh_ObjidToName
(
cdh_ClassIdToObjid
(
ctx
->
mc
[
0
].
cid
),
...
...
@@ -226,6 +245,7 @@ static pwr_tStatus ShowConfiguration( xmenu_sMenuCall *ip)
ctx
->
attr
=
new
GsdAttr
(
(
Widget
)
ip
->
WindowContext
,
ctx
,
0
,
ctx
->
gsd
,
edit_mode
);
ctx
->
attr
->
close_cb
=
attr_close_cb
;
ctx
->
attr
->
save_cb
=
attr_save_cb
;
ctx
->
attr
->
help_cb
=
attr_help_cb
;
return
1
;
}
...
...
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