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
2c0c533d
Commit
2c0c533d
authored
Aug 31, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Profinet configurator, submodule selection implemented
parent
207e02cb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
457 additions
and
16 deletions
+457
-16
profibus/lib/cow/src/cow_pn_gsdml.cpp
profibus/lib/cow/src/cow_pn_gsdml.cpp
+23
-0
profibus/lib/cow/src/cow_pn_gsdml.h
profibus/lib/cow/src/cow_pn_gsdml.h
+2
-1
profibus/lib/cow/src/cow_pn_gsdml_attrnav.cpp
profibus/lib/cow/src/cow_pn_gsdml_attrnav.cpp
+388
-13
profibus/lib/cow/src/cow_pn_gsdml_attrnav.h
profibus/lib/cow/src/cow_pn_gsdml_attrnav.h
+38
-0
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
+3
-0
profibus/lib/rt/src/rt_pn_gsdml_data.h
profibus/lib/rt/src/rt_pn_gsdml_data.h
+3
-2
No files found.
profibus/lib/cow/src/cow_pn_gsdml.cpp
View file @
2c0c533d
...
...
@@ -117,6 +117,7 @@ static gsdml_sTag taglist[] = {
{
"ModuleItemRef"
,
gsdml_eTag_ModuleItemRef
,
gsdml_eType_
,
0
,
0
,
1
},
{
"VirtualSubmoduleList"
,
gsdml_eTag_VirtualSubmoduleList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"VirtualSubmoduleItem"
,
gsdml_eTag_VirtualSubmoduleItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"SubmoduleItem"
,
gsdml_eTag_VirtualSubmoduleItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"IOData"
,
gsdml_eTag_IOData
,
gsdml_eType_
,
0
,
0
,
1
},
{
"Input"
,
gsdml_eTag_Input
,
gsdml_eType_
,
0
,
0
,
1
},
{
"Output"
,
gsdml_eTag_Output
,
gsdml_eType_
,
0
,
0
,
1
},
...
...
@@ -2167,6 +2168,20 @@ void *pn_gsdml::object_factory( gsdml_eTag id)
ro
=
o
;
break
;
}
case
gsdml_eTag_SubmoduleList
:
{
gsdml_SubmoduleList
*
o
=
new
gsdml_SubmoduleList
(
this
);
void
*
p
;
if
(
(
p
=
get_object_stack
(
gsdml_eTag_ApplicationProcess
)))
((
gsdml_ApplicationProcess
*
)
p
)
->
SubmoduleList
=
o
;
else
{
error_message_line
(
"Misplaced SubmoduleList"
);
return
0
;
}
ro
=
o
;
break
;
}
case
gsdml_eTag_VirtualSubmoduleItem
:
{
gsdml_VirtualSubmoduleItem
*
o
=
new
gsdml_VirtualSubmoduleItem
(
this
);
current_body
=
&
o
->
Body
;
...
...
@@ -4968,6 +4983,12 @@ gsdml_ModuleList::~gsdml_ModuleList()
delete
ModuleItem
[
i
];
}
void
gsdml_SubmoduleList
::
build
()
{
for
(
unsigned
int
i
=
0
;
i
<
SubmoduleItem
.
size
();
i
++
)
SubmoduleItem
[
i
]
->
build
();
}
gsdml_SubmoduleList
::~
gsdml_SubmoduleList
()
{
for
(
unsigned
int
i
=
0
;
i
<
SubmoduleItem
.
size
();
i
++
)
...
...
@@ -5121,6 +5142,8 @@ void gsdml_ApplicationProcess::build()
DeviceAccessPointList
->
build
();
if
(
ModuleList
)
ModuleList
->
build
();
if
(
SubmoduleList
)
SubmoduleList
->
build
();
if
(
ValueList
)
ValueList
->
build
();
if
(
ChannelDiagList
)
...
...
profibus/lib/cow/src/cow_pn_gsdml.h
View file @
2c0c533d
...
...
@@ -850,7 +850,7 @@ typedef struct {
gsdml_tUnsigned16
NumberOfAdditionalOutputCR
;
gsdml_tUnsigned16
NumberOfAdditionalMulticastProviderCR
;
gsdml_tUnsigned16
NumberOfMulticastConsumerCR
;
gsdml_t
Unsigned16
PullModuleAlarmSupported
;
gsdml_t
Boolean
PullModuleAlarmSupported
;
}
gsdml_sInterfaceSubmoduleItem_ApplicationRelations
;
class
gsdml_InterfaceSubmoduleItem_ApplicationRelations
{
...
...
@@ -1143,6 +1143,7 @@ class gsdml_SubmoduleList {
vector
<
gsdml_VirtualSubmoduleItem
*>
SubmoduleItem
;
pn_gsdml
*
gsdml
;
~
gsdml_SubmoduleList
();
void
build
();
void
print
(
int
ind
);
};
...
...
profibus/lib/cow/src/cow_pn_gsdml_attrnav.cpp
View file @
2c0c533d
...
...
@@ -558,6 +558,7 @@ void GsdmlAttrNav::expand_all()
if
(
!
(
item
->
type
==
attrnav_eItemType_PnParEnum
||
item
->
type
==
attrnav_eItemType_PnDevice
||
item
->
type
==
attrnav_eItemType_PnModuleType
||
item
->
type
==
attrnav_eItemType_PnSubmoduleType
||
item
->
type
==
attrnav_eItemType_PnDataItem
||
item
->
type
==
attrnav_eItemType_PnModuleClass
||
item
->
type
==
attrnav_eItemType_PnEnumByteOrder
||
...
...
@@ -1105,6 +1106,12 @@ int GsdmlAttrNav::trace_connect_bc( brow_tObject object, char *name, char *attr,
*
p
=
&
attrnav
->
dev_data
.
slot_data
[
item
->
slot_idx
]
->
module_enum_number
;
break
;
}
case
attrnav_eItemType_PnSubmoduleType
:
{
ItemPnSubmoduleType
*
item
=
(
ItemPnSubmoduleType
*
)
base_item
;
*
p
=
&
attrnav
->
dev_data
.
slot_data
[
item
->
slot_idx
]
->
subslot_data
[
item
->
subslot_idx
]
->
submodule_enum_number
;
break
;
}
case
attrnav_eItemType_PnModuleClass
:
{
ItemPnModuleClass
*
item
=
(
ItemPnModuleClass
*
)
base_item
;
...
...
@@ -1623,18 +1630,24 @@ int GsdmlAttrNav::save( const char *filename)
ssd
->
io_input_length
=
0
;
ssd
->
io_output_length
=
0
;
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
0
)
continue
;
gsdml_VirtualSubmoduleItem
*
vsd
=
0
;
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
1
)
vsd
=
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
0
];
if
(
ssd
->
submodule_enum_number
)
{
// Physical subslot
vsd
=
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
[
ssd
->
submodule_enum_number
-
1
];
}
else
{
for
(
unsigned
int
k
=
0
;
k
<
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
();
k
++
)
{
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
k
]
->
Body
.
SubmoduleIdentNumber
==
ssd
->
submodule_ident_number
)
{
vsd
=
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
k
];
break
;
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
0
)
continue
;
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
1
)
vsd
=
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
0
];
else
{
for
(
unsigned
int
k
=
0
;
k
<
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
();
k
++
)
{
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
k
]
->
Body
.
SubmoduleIdentNumber
==
ssd
->
submodule_ident_number
)
{
vsd
=
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
k
];
break
;
}
}
}
}
...
...
@@ -1684,10 +1697,12 @@ int GsdmlAttrNav::save( const char *filename)
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
0
);
return
dev_data
.
print
(
filename
);
sts
=
dev_data
.
print
(
filename
);
// Unload channel diag
dev_data
.
channel_diag_reset
();
return
sts
;
}
int
GsdmlAttrNav
::
open
(
const
char
*
filename
)
...
...
@@ -1921,6 +1936,7 @@ int ItemPn::close( GsdmlAttrNav *attrnav, double x, double y)
case
attrnav_eItemType_PnEnumTimeRatio
:
case
attrnav_eItemType_PnEnumSendClock
:
case
attrnav_eItemType_PnModuleType
:
case
attrnav_eItemType_PnSubmoduleType
:
case
attrnav_eItemType_PnModuleClass
:
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
break
;
...
...
@@ -2232,11 +2248,12 @@ int ItemPnSlot::open_children( GsdmlAttrNav *attrnav, double x, double y)
else
{
// FixedInSubslots supplied, create all fixed subslots
gsdml_Valuelist
*
vl
=
new
gsdml_Valuelist
(
mi
->
VirtualSubmoduleList
->
gsdml_Valuelist
*
vl
=
new
gsdml_Valuelist
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
i
]
->
Body
.
FixedInSubslots
.
str
);
gsdml_ValuelistIterator
iter
(
vl
);
for
(
unsigned
int
j
=
iter
.
begin
();
j
!=
iter
.
end
();
j
=
iter
.
next
())
{
subslot_number
=
j
;
sprintf
(
subslot_name
,
"Subslot %d"
,
subslot_number
);
...
...
@@ -2269,6 +2286,127 @@ int ItemPnSlot::open_children( GsdmlAttrNav *attrnav, double x, double y)
}
}
}
if
(
mi
->
UseableSubmodules
&&
strcmp
(
mi
->
Body
.
PhysicalSubslots
.
str
,
""
)
!=
0
)
{
gsdml_Valuelist
*
vl
=
new
gsdml_Valuelist
(
mi
->
Body
.
PhysicalSubslots
.
str
);
gsdml_ValuelistIterator
iter
(
vl
);
char
subslot_name
[
80
];
for
(
unsigned
int
j
=
iter
.
begin
();
j
!=
iter
.
end
();
j
=
iter
.
next
())
{
// Check that there is an useable module for this slot
int
fixed_found
=
0
;
int
fixed_enum
=
0
;
gsdml_VirtualSubmoduleItem
*
fixed_si
=
0
;
int
used_found
=
0
;
int
used_enum
=
0
;
gsdml_VirtualSubmoduleItem
*
used_si
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
mi
->
UseableSubmodules
->
SubmoduleItemRef
.
size
();
i
++
)
{
gsdml_Valuelist
*
vl_allowed
=
new
gsdml_Valuelist
(
mi
->
UseableSubmodules
->
SubmoduleItemRef
[
i
]
->
Body
.
AllowedInSubslots
.
str
);
gsdml_Valuelist
*
vl_fixed
=
new
gsdml_Valuelist
(
mi
->
UseableSubmodules
->
SubmoduleItemRef
[
i
]
->
Body
.
FixedInSubslots
.
str
);
gsdml_Valuelist
*
vl_used
=
new
gsdml_Valuelist
(
mi
->
UseableSubmodules
->
SubmoduleItemRef
[
i
]
->
Body
.
UsedInSubslots
.
str
);
if
(
vl_allowed
->
in_list
(
j
))
{
// Check if fixed
if
(
vl_fixed
->
in_list
(
j
))
{
// Fixed in subslot, insert the submodule directly
fixed_found
=
1
;
fixed_si
=
(
gsdml_VirtualSubmoduleItem
*
)
mi
->
UseableSubmodules
->
SubmoduleItemRef
[
i
]
->
Body
.
SubmoduleItemTarget
.
p
;
for
(
unsigned
int
k
=
0
;
k
<
attrnav
->
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
.
size
();
k
++
)
{
if
(
attrnav
->
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
[
k
]
==
fixed_si
)
{
fixed_enum
=
k
+
1
;
break
;
}
}
}
// Check if used
if
(
vl_used
->
in_list
(
j
))
{
used_found
=
1
;
used_si
=
(
gsdml_VirtualSubmoduleItem
*
)
mi
->
UseableSubmodules
->
SubmoduleItemRef
[
i
]
->
Body
.
SubmoduleItemTarget
.
p
;
for
(
unsigned
int
k
=
0
;
k
<
attrnav
->
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
.
size
();
k
++
)
{
if
(
attrnav
->
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
[
k
]
==
used_si
)
{
used_enum
=
k
+
1
;
break
;
}
}
}
}
delete
vl_allowed
;
delete
vl_used
;
delete
vl_fixed
;
}
subslot_number
=
j
;
sprintf
(
subslot_name
,
"Subslot %d"
,
subslot_number
);
if
(
fixed_found
)
{
GsdmlSubslotData
*
ssd
;
if
(
slotdata
->
subslot_data
.
size
()
<=
subslot_index
)
{
ssd
=
new
GsdmlSubslotData
();
ssd
->
subslot_number
=
subslot_number
;
ssd
->
subslot_idx
=
subslot_index
;
ssd
->
submodule_ident_number
=
fixed_si
->
Body
.
SubmoduleIdentNumber
;
ssd
->
submodule_enum_number
=
fixed_enum
;
slotdata
->
subslot_data
.
push_back
(
ssd
);
}
else
{
ssd
=
slotdata
->
subslot_data
[
subslot_index
];
ssd
->
subslot_idx
=
subslot_index
;
ssd
->
submodule_ident_number
=
fixed_si
->
Body
.
SubmoduleIdentNumber
;
ssd
->
submodule_enum_number
=
fixed_enum
;
if
(
ssd
->
subslot_number
!=
subslot_number
)
{
ssd
->
subslot_number
=
subslot_number
;
printf
(
"GSML-Error, datafile corrupt, unexpected subslot number
\n
"
);
}
}
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
fixed_si
,
node
,
flow_eDest_IntoLast
);
subslot_index
++
;
}
else
{
// Add selectable subslot
GsdmlSubslotData
*
ssd
;
if
(
slotdata
->
subslot_data
.
size
()
<=
subslot_index
)
{
ssd
=
new
GsdmlSubslotData
();
ssd
->
subslot_number
=
subslot_number
;
ssd
->
subslot_idx
=
subslot_index
;
if
(
used_found
)
{
ssd
->
submodule_ident_number
=
used_si
->
Body
.
SubmoduleIdentNumber
;
ssd
->
submodule_enum_number
=
used_enum
;
}
slotdata
->
subslot_data
.
push_back
(
ssd
);
}
else
{
ssd
=
slotdata
->
subslot_data
[
subslot_index
];
ssd
->
subslot_idx
=
subslot_index
;
if
(
ssd
->
subslot_number
!=
subslot_number
)
{
ssd
->
subslot_number
=
subslot_number
;
printf
(
"GSML-Error, datafile corrupt, unexpected subslot number
\n
"
);
}
else
if
(
used_found
)
{
ssd
->
submodule_ident_number
=
used_si
->
Body
.
SubmoduleIdentNumber
;
ssd
->
submodule_enum_number
=
used_enum
;
}
}
new
ItemPnSubslotPhys
(
attrnav
,
subslot_name
,
ssd
,
used_si
,
slotdata
->
slot_idx
,
mi
->
UseableSubmodules
,
node
,
flow_eDest_IntoLast
);
subslot_index
++
;
}
}
delete
vl
;
}
}
}
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
...
...
@@ -2394,6 +2532,105 @@ int ItemPnSubslot::open_children( GsdmlAttrNav *attrnav, double x, double y)
return
1
;
}
ItemPnSubslotPhys
::
ItemPnSubslotPhys
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
GsdmlSubslotData
*
item_subslotdata
,
gsdml_VirtualSubmoduleItem
*
item_virtualsubmodule
,
int
item_slot_idx
,
gsdml_UseableSubmodules
*
item_us
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
subslotdata
(
item_subslotdata
),
virtualsubmodule
(
item_virtualsubmodule
),
us
(
item_us
),
slot_idx
(
item_slot_idx
)
{
type
=
attrnav_eItemType_PnSubslotPhys
;
strcpy
(
name
,
item_name
);
parent
=
1
;
brow_CreateNode
(
attrnav
->
brow
->
ctx
,
item_name
,
attrnav
->
brow
->
nc_attr
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
if
(
parent
)
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_map
);
else
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_leaf
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
}
int
ItemPnSubslotPhys
::
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_CloseNode
(
attrnav
->
brow
->
ctx
,
node
);
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Children
)
{
if
(
parent
)
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_map
);
else
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_leaf
);
}
brow_ResetOpen
(
node
,
attrnav_mOpen_All
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
else
{
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
new
ItemPnSubmoduleType
(
attrnav
,
"SubmoduleType"
,
subslotdata
->
subslot_number
,
slot_idx
,
subslotdata
->
subslot_idx
,
us
,
node
,
flow_eDest_IntoLast
);
gsdml_VirtualSubmoduleItem
*
subm
=
0
;
if
(
subslotdata
->
submodule_enum_number
)
{
subm
=
attrnav
->
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
[
subslotdata
->
submodule_enum_number
-
1
];
}
if
(
subm
&&
subm
->
ModuleInfo
)
{
new
ItemPnModuleInfo
(
attrnav
,
"SubmoduleInfo"
,
subm
->
ModuleInfo
,
node
,
flow_eDest_IntoLast
);
}
unsigned
int
record_index
=
0
;
if
(
subm
)
{
gsdml_RecordDataList
*
rl
=
subm
->
RecordDataList
;
if
(
rl
)
{
GsdmlDataRecord
*
dr
;
for
(
unsigned
int
j
=
0
;
j
<
rl
->
ParameterRecordDataItem
.
size
();
j
++
)
{
if
(
subslotdata
->
data_record
.
size
()
<=
record_index
)
{
dr
=
new
GsdmlDataRecord
();
dr
->
record_idx
=
record_index
;
subslotdata
->
data_record
.
push_back
(
dr
);
}
else
{
dr
=
subslotdata
->
data_record
[
record_index
];
dr
->
record_idx
=
record_index
;
}
new
ItemPnParRecord
(
attrnav
,
""
,
rl
->
ParameterRecordDataItem
[
j
],
dr
,
node
,
flow_eDest_IntoLast
);
record_index
++
;
}
}
}
if
(
attrnav
->
viewio
&&
subm
&&
subm
->
IOData
)
{
new
ItemPnIOData
(
attrnav
,
"IOData"
,
subm
->
IOData
,
node
,
flow_eDest_IntoLast
);
}
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
return
1
;
}
ItemPnDAP
::
ItemPnDAP
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
GsdmlSlotData
*
item_slotdata
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
slotdata
(
item_slotdata
)
{
...
...
@@ -3155,7 +3392,7 @@ int ItemPnModuleType::scan( GsdmlAttrNav *attrnav, void *p)
return
1
;
gsdml_ModuleItem
*
mi
=
(
gsdml_ModuleItem
*
)
um
->
ModuleItemRef
[
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
module_enum_number
-
1
]
->
Body
.
ModuleItemTarget
.
p
;
if
(
!
mi
||
!
mi
->
ModuleInfo
->
Body
.
Name
.
p
)
if
(
!
mi
||
!
mi
->
ModuleInfo
||
!
mi
->
ModuleInfo
->
Body
.
Name
.
p
)
return
1
;
strncpy
(
buf
,
(
char
*
)
mi
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
buf
));
}
...
...
@@ -3225,6 +3462,144 @@ int ItemPnModuleType::scan( GsdmlAttrNav *attrnav, void *p)
return
1
;
}
ItemPnSubmoduleType
::
ItemPnSubmoduleType
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
int
item_subslot_number
,
int
item_slot_idx
,
int
item_subslot_idx
,
gsdml_UseableSubmodules
*
item_us
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
subslot_number
(
item_subslot_number
),
slot_idx
(
item_slot_idx
),
subslot_idx
(
item_subslot_idx
),
us
(
item_us
),
old_value
(
0
),
first_scan
(
1
)
{
type
=
attrnav_eItemType_PnSubmoduleType
;
strcpy
(
name
,
item_name
);
brow_CreateNode
(
attrnav
->
brow
->
ctx
,
item_name
,
attrnav
->
brow
->
nc_attr
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
brow_SetTraceAttr
(
node
,
name
,
""
,
flow_eTraceType_User
);
}
int
ItemPnSubmoduleType
::
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
)
{
double
node_x
,
node_y
;
brow_GetNodePosition
(
node
,
&
node_x
,
&
node_y
);
if
(
brow_IsOpen
(
node
))
{
// Close
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_CloseNode
(
attrnav
->
brow
->
ctx
,
node
);
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Attributes
)
brow_RemoveAnnotPixmap
(
node
,
1
);
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Children
)
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
brow_ResetOpen
(
node
,
attrnav_mOpen_All
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
else
{
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
int
idx
=
0
;
new
ItemPnEnumValueMType
(
attrnav
,
"No"
,
""
,
idx
++
,
pwr_eType_UInt32
,
&
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
subslot_data
[
subslot_idx
]
->
submodule_enum_number
,
node
,
flow_eDest_IntoLast
);
if
(
!
us
)
return
1
;
for
(
unsigned
int
i
=
0
;
i
<
us
->
SubmoduleItemRef
.
size
();
i
++
)
{
gsdml_Valuelist
*
vl_allowed
=
new
gsdml_Valuelist
(
us
->
SubmoduleItemRef
[
i
]
->
Body
.
AllowedInSubslots
.
str
);
gsdml_Valuelist
*
vl_fixed
=
new
gsdml_Valuelist
(
us
->
SubmoduleItemRef
[
i
]
->
Body
.
FixedInSubslots
.
str
);
if
(
vl_allowed
->
in_list
(
subslot_number
))
{
if
(
vl_fixed
->
in_list
(
subslot_number
))
{
delete
vl_allowed
;
delete
vl_fixed
;
continue
;
}
char
mname
[
160
]
=
"ModuleName"
;
gsdml_VirtualSubmoduleItem
*
mi
=
(
gsdml_VirtualSubmoduleItem
*
)
us
->
SubmoduleItemRef
[
i
]
->
Body
.
SubmoduleItemTarget
.
p
;
if
(
!
mi
||
!
mi
->
ModuleInfo
||
!
mi
->
ModuleInfo
->
Body
.
Name
.
p
)
continue
;
strncpy
(
mname
,
(
char
*
)
mi
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
mname
));
new
ItemPnEnumValueMType
(
attrnav
,
mname
,
mi
->
ModuleInfo
->
Body
.
OrderNumber
,
idx
,
pwr_eType_UInt32
,
&
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
subslot_data
[
subslot_idx
]
->
submodule_enum_number
,
node
,
flow_eDest_IntoLast
);
}
delete
vl_allowed
;
delete
vl_fixed
;
idx
++
;
}
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
return
1
;
}
int
ItemPnSubmoduleType
::
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
)
{
char
buf
[
200
];
if
(
!
first_scan
)
{
if
(
old_value
==
*
(
int
*
)
p
)
// No change since last time
return
1
;
}
if
(
*
(
int
*
)
p
==
0
)
strcpy
(
buf
,
"No"
);
else
{
if
(
!
us
)
return
1
;
gsdml_VirtualSubmoduleItem
*
si
=
(
gsdml_VirtualSubmoduleItem
*
)
attrnav
->
gsdml
->
ApplicationProcess
->
SubmoduleList
->
SubmoduleItem
[
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
subslot_data
[
subslot_idx
]
->
submodule_enum_number
-
1
];
if
(
!
si
||
!
si
->
ModuleInfo
->
Body
.
Name
.
p
)
return
1
;
strncpy
(
buf
,
(
char
*
)
si
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
buf
));
}
brow_SetAnnotation
(
node
,
1
,
buf
,
strlen
(
buf
));
old_value
=
*
(
int
*
)
p
;
if
(
!
first_scan
)
{
int
sts
;
brow_tObject
parentnode
;
sts
=
brow_GetParent
(
attrnav
->
brow
->
ctx
,
node
,
&
parentnode
);
if
(
EVEN
(
sts
))
return
1
;
ItemPnSubslot
*
parentitem
;
brow_GetUserData
(
parentnode
,
(
void
**
)
&
parentitem
);
// Note, this object is deleted here !
parentitem
->
close
(
attrnav
,
0
,
0
);
// Remove old subslot data
// if ( parentitem->slotdata)
// parentitem->slotdata->slot_reset();
parentitem
->
open_children
(
attrnav
,
0
,
0
);
brow_SelectClear
(
attrnav
->
brow
->
ctx
);
brow_SetInverse
(
parentnode
,
1
);
brow_SelectInsert
(
attrnav
->
brow
->
ctx
,
parentnode
);
brow_CenterObject
(
attrnav
->
brow
->
ctx
,
parentnode
,
0.25
);
}
else
first_scan
=
0
;
return
1
;
}
ItemPnParRecord
::
ItemPnParRecord
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_ParameterRecordDataItem
*
item_par_record
,
GsdmlDataRecord
*
item_datarecord
,
brow_tNode
dest
,
...
...
profibus/lib/cow/src/cow_pn_gsdml_attrnav.h
View file @
2c0c533d
...
...
@@ -88,8 +88,10 @@ typedef enum {
attrnav_eItemType_PnPortSubmodule
,
attrnav_eItemType_PnSlot
,
attrnav_eItemType_PnSubslot
,
attrnav_eItemType_PnSubslotPhys
,
attrnav_eItemType_PnModuleInfo
,
attrnav_eItemType_PnModuleType
,
attrnav_eItemType_PnSubmoduleType
,
attrnav_eItemType_PnParRecord
,
attrnav_eItemType_PnParValue
,
attrnav_eItemType_PnParEnum
,
...
...
@@ -332,6 +334,23 @@ class ItemPnSubslot : public ItemPn {
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for a physical subslot.
class
ItemPnSubslotPhys
:
public
ItemPn
{
public:
ItemPnSubslotPhys
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
GsdmlSubslotData
*
item_subslotdata
,
gsdml_VirtualSubmoduleItem
*
item_virtualsubmodule
,
int
item_slot_idx
,
gsdml_UseableSubmodules
*
item_us
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnSubslotPhys
()
{}
GsdmlSubslotData
*
subslotdata
;
gsdml_VirtualSubmoduleItem
*
virtualsubmodule
;
gsdml_UseableSubmodules
*
us
;
int
slot_idx
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for the DeviceAccessPoint, slot 0
class
ItemPnDAP
:
public
ItemPn
{
public:
...
...
@@ -419,6 +438,25 @@ class ItemPnModuleType : public ItemPn {
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
};
//! Item for module type selection.
class
ItemPnSubmoduleType
:
public
ItemPn
{
public:
ItemPnSubmoduleType
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
int
item_subslot_number
,
int
item_slot_idx
,
int
item_subslot_idx
,
gsdml_UseableSubmodules
*
item_us
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnSubmoduleType
()
{}
int
subslot_number
;
int
slot_idx
;
int
subslot_idx
;
gsdml_UseableSubmodules
*
us
;
int
old_value
;
int
first_scan
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
};
//! Item for module type selection.
class
ItemPnParRecord
:
public
ItemPn
{
public:
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
View file @
2c0c533d
...
...
@@ -92,6 +92,7 @@ int GsdmlSubslotData::print( ofstream& fp)
{
fp
<<
" <Subslot SubslotNumber=
\"
"
<<
subslot_number
<<
"
\"
"
<<
endl
<<
" SubmoduleEnumNumber=
\"
"
<<
submodule_enum_number
<<
"
\"
"
<<
endl
<<
" SubmoduleIdentNumber=
\"
"
<<
submodule_ident_number
<<
"
\"
"
<<
endl
<<
" IOInputLength=
\"
"
<<
io_input_length
<<
"
\"
"
<<
endl
<<
" IOOutputLength=
\"
"
<<
io_output_length
<<
"
\"
>"
<<
endl
;
...
...
@@ -554,6 +555,8 @@ int GsdmlDataReader::tag_attribute( const char *name, const char *value)
sscanf
(
value
,
"%u"
,
&
sd
->
subslot_number
);
else
if
(
strcmp
(
name
,
"SubmoduleIdentNumber"
)
==
0
)
sscanf
(
value
,
"%u"
,
&
sd
->
submodule_ident_number
);
else
if
(
strcmp
(
name
,
"SubmoduleEnumNumber"
)
==
0
)
sscanf
(
value
,
"%d"
,
&
sd
->
submodule_enum_number
);
else
if
(
strcmp
(
name
,
"IOInputLength"
)
==
0
)
sscanf
(
value
,
"%u"
,
&
sd
->
io_input_length
);
else
if
(
strcmp
(
name
,
"IOOutputLength"
)
==
0
)
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.h
View file @
2c0c533d
...
...
@@ -82,12 +82,13 @@ class GsdmlIOCRData {
class
GsdmlSubslotData
{
public:
GsdmlSubslotData
()
:
subslot_number
(
0
),
subslot_idx
(
0
),
submodule_
ident
_number
(
0
),
io_input_length
(
0
),
io_output_length
(
0
)
{}
GsdmlSubslotData
()
:
subslot_number
(
0
),
subslot_idx
(
0
),
submodule_
enum
_number
(
0
),
submodule_ident_number
(
0
),
io_input_length
(
0
),
io_output_length
(
0
)
{}
vector
<
GsdmlDataRecord
*>
data_record
;
unsigned
int
subslot_number
;
unsigned
int
subslot_idx
;
unsigned
int
submodule_enum_number
;
unsigned
int
submodule_ident_number
;
unsigned
int
io_input_length
;
unsigned
int
io_output_length
;
...
...
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