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
01cc1f42
Commit
01cc1f42
authored
May 06, 2009
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Profinet lev 2
parent
3d2cc0be
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1666 additions
and
388 deletions
+1666
-388
profibus/lib/rt/gtk/rt_pn_gsdml_attr_gtk.cpp
profibus/lib/rt/gtk/rt_pn_gsdml_attr_gtk.cpp
+14
-0
profibus/lib/rt/gtk/rt_pn_gsdml_attr_gtk.h
profibus/lib/rt/gtk/rt_pn_gsdml_attr_gtk.h
+2
-0
profibus/lib/rt/src/rt_pn_gsdml.cpp
profibus/lib/rt/src/rt_pn_gsdml.cpp
+131
-0
profibus/lib/rt/src/rt_pn_gsdml.h
profibus/lib/rt/src/rt_pn_gsdml.h
+6
-0
profibus/lib/rt/src/rt_pn_gsdml_attr.cpp
profibus/lib/rt/src/rt_pn_gsdml_attr.cpp
+17
-42
profibus/lib/rt/src/rt_pn_gsdml_attr.h
profibus/lib/rt/src/rt_pn_gsdml_attr.h
+1
-0
profibus/lib/rt/src/rt_pn_gsdml_attrnav.cpp
profibus/lib/rt/src/rt_pn_gsdml_attrnav.cpp
+744
-200
profibus/lib/rt/src/rt_pn_gsdml_attrnav.h
profibus/lib/rt/src/rt_pn_gsdml_attrnav.h
+99
-32
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
+57
-7
profibus/lib/rt/src/rt_pn_gsdml_data.h
profibus/lib/rt/src/rt_pn_gsdml_data.h
+27
-2
profibus/lib/wb/src/wb_c_pndevice.cpp
profibus/lib/wb/src/wb_c_pndevice.cpp
+491
-91
src/lib/co/src/co_xml_parser.cpp
src/lib/co/src/co_xml_parser.cpp
+67
-13
src/msg/rt/src/rt_pb_msg.msg
src/msg/rt/src/rt_pb_msg.msg
+3
-0
wb/lib/wb/src/wb_wnav.cpp
wb/lib/wb/src/wb_wnav.cpp
+4
-1
wb/lib/wb/src/wb_wnav.h
wb/lib/wb/src/wb_wnav.h
+3
-0
No files found.
profibus/lib/rt/gtk/rt_pn_gsdml_attr_gtk.cpp
View file @
01cc1f42
...
@@ -153,6 +153,15 @@ void GsdmlAttrGtk::activate_paste( GtkWidget *w, gpointer data)
...
@@ -153,6 +153,15 @@ void GsdmlAttrGtk::activate_paste( GtkWidget *w, gpointer data)
attr
->
activate_paste
();
attr
->
activate_paste
();
}
}
void
GsdmlAttrGtk
::
activate_viewio
(
GtkWidget
*
w
,
gpointer
data
)
{
GsdmlAttr
*
attr
=
(
GsdmlAttr
*
)
data
;
int
set
=
(
int
)
gtk_check_menu_item_get_active
(
GTK_CHECK_MENU_ITEM
(
w
));
attr
->
activate_viewio
(
set
);
}
void
GsdmlAttrGtk
::
activate_zoom_in
(
GtkWidget
*
w
,
gpointer
data
)
void
GsdmlAttrGtk
::
activate_zoom_in
(
GtkWidget
*
w
,
gpointer
data
)
{
{
GsdmlAttr
*
attr
=
(
GsdmlAttr
*
)
data
;
GsdmlAttr
*
attr
=
(
GsdmlAttr
*
)
data
;
...
@@ -359,6 +368,10 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
...
@@ -359,6 +368,10 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
// View Entry
// View Entry
// Edit entry
menubutton_viewio
=
gtk_check_menu_item_new_with_mnemonic
(
"_View I/O"
);
g_signal_connect
(
menubutton_viewio
,
"activate"
,
G_CALLBACK
(
activate_viewio
),
this
);
GtkWidget
*
view_zoom_in
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_ZOOM_IN
,
NULL
);
GtkWidget
*
view_zoom_in
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_ZOOM_IN
,
NULL
);
g_signal_connect
(
view_zoom_in
,
"activate"
,
g_signal_connect
(
view_zoom_in
,
"activate"
,
G_CALLBACK
(
activate_zoom_in
),
this
);
G_CALLBACK
(
activate_zoom_in
),
this
);
...
@@ -381,6 +394,7 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
...
@@ -381,6 +394,7 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
GTK_ACCEL_VISIBLE
);
GTK_ACCEL_VISIBLE
);
GtkMenu
*
view_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
GtkMenu
*
view_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
menubutton_viewio
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_in
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_in
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_out
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_out
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_reset
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
view_menu
),
view_zoom_reset
);
...
...
profibus/lib/rt/gtk/rt_pn_gsdml_attr_gtk.h
View file @
01cc1f42
...
@@ -41,6 +41,7 @@ class GsdmlAttrGtk : public GsdmlAttr {
...
@@ -41,6 +41,7 @@ class GsdmlAttrGtk : public GsdmlAttr {
GtkWidget
*
menubutton_cut
;
GtkWidget
*
menubutton_cut
;
GtkWidget
*
menubutton_paste
;
GtkWidget
*
menubutton_paste
;
GtkWidget
*
menubutton_changevalue
;
GtkWidget
*
menubutton_changevalue
;
GtkWidget
*
menubutton_viewio
;
CoWowFocusTimerGtk
focustimer
;
CoWowFocusTimerGtk
focustimer
;
GsdmlAttrGtk
(
GtkWidget
*
a_parent_wid
,
GsdmlAttrGtk
(
GtkWidget
*
a_parent_wid
,
...
@@ -63,6 +64,7 @@ class GsdmlAttrGtk : public GsdmlAttr {
...
@@ -63,6 +64,7 @@ class GsdmlAttrGtk : public GsdmlAttr {
static
void
activate_copy
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_copy
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_cut
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_cut
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_paste
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_paste
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_viewio
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_zoom_in
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_zoom_in
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_zoom_out
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_zoom_out
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_zoom_reset
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_zoom_reset
(
GtkWidget
*
w
,
gpointer
data
);
...
...
profibus/lib/rt/src/rt_pn_gsdml.cpp
View file @
01cc1f42
...
@@ -153,8 +153,12 @@ static gsdml_sTag taglist[] = {
...
@@ -153,8 +153,12 @@ static gsdml_sTag taglist[] = {
{
"ExtChannelDiagList"
,
gsdml_eTag_ExtChannelDiagList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ExtChannelDiagList"
,
gsdml_eTag_ExtChannelDiagList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ExtChannelDiagItem"
,
gsdml_eTag_ExtChannelDiagItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ExtChannelDiagItem"
,
gsdml_eTag_ExtChannelDiagItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ExtChannelAddValue"
,
gsdml_eTag_ExtChannelAddValue
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ExtChannelAddValue"
,
gsdml_eTag_ExtChannelAddValue
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ProfileChannelDiagItem"
,
gsdml_eTag_ChannelDiagItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ProfileExtChannelDiagList"
,
gsdml_eTag_ExtChannelDiagList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ProfileExtChannelDiagItem"
,
gsdml_eTag_ExtChannelDiagItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"UnitDiagTypeList"
,
gsdml_eTag_UnitDiagTypeList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"UnitDiagTypeList"
,
gsdml_eTag_UnitDiagTypeList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"UnitDiagTypeItem"
,
gsdml_eTag_UnitDiagTypeItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"UnitDiagTypeItem"
,
gsdml_eTag_UnitDiagTypeItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"ProfileUnitDiagTypeItem"
,
gsdml_eTag_UnitDiagTypeItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"GraphicsList"
,
gsdml_eTag_GraphicsList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"GraphicsList"
,
gsdml_eTag_GraphicsList
,
gsdml_eType_
,
0
,
0
,
1
},
{
"GraphicItem"
,
gsdml_eTag_GraphicItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"GraphicItem"
,
gsdml_eTag_GraphicItem
,
gsdml_eType_
,
0
,
0
,
1
},
{
"Embedded"
,
gsdml_eTag_Embedded
,
gsdml_eType_String
,
sizeof
(
gsdml_tString80
),
offsetof
(
gsdml_sGraphicItem
,
Embedded
),
0
},
{
"Embedded"
,
gsdml_eTag_Embedded
,
gsdml_eType_String
,
sizeof
(
gsdml_tString80
),
offsetof
(
gsdml_sGraphicItem
,
Embedded
),
0
},
...
@@ -570,6 +574,7 @@ pn_gsdml::pn_gsdml() : logglevel(0), first_token(true), state( gsdml_eState_Init
...
@@ -570,6 +574,7 @@ pn_gsdml::pn_gsdml() : logglevel(0), first_token(true), state( gsdml_eState_Init
byte_order
(
0
),
module_classlist
(
0
),
xml
(
0
),
ProfileHeader
(
0
),
byte_order
(
0
),
module_classlist
(
0
),
xml
(
0
),
ProfileHeader
(
0
),
DeviceIdentity
(
0
),
DeviceFunction
(
0
),
ApplicationProcess
(
0
)
DeviceIdentity
(
0
),
DeviceFunction
(
0
),
ApplicationProcess
(
0
)
{
{
strcpy
(
gsdmlfile
,
""
);
}
}
pn_gsdml
::~
pn_gsdml
()
pn_gsdml
::~
pn_gsdml
()
...
@@ -652,6 +657,8 @@ int pn_gsdml::read( const char *filename)
...
@@ -652,6 +657,8 @@ int pn_gsdml::read( const char *filename)
{
{
pwr_tFileName
fname
;
pwr_tFileName
fname
;
strncpy
(
gsdmlfile
,
filename
,
sizeof
(
gsdmlfile
));
dcli_translate_filename
(
fname
,
filename
);
dcli_translate_filename
(
fname
,
filename
);
fp
.
open
(
fname
);
fp
.
open
(
fname
);
if
(
!
fp
)
if
(
!
fp
)
...
@@ -3040,6 +3047,99 @@ int pn_gsdml::ostring_to_data( unsigned char **data, const char *str, int size,
...
@@ -3040,6 +3047,99 @@ int pn_gsdml::ostring_to_data( unsigned char **data, const char *str, int size,
return
1
;
return
1
;
}
}
int
pn_gsdml
::
set_par_record_default
(
unsigned
char
*
data
,
int
size
,
gsdml_ParameterRecordDataItem
*
par_record
)
{
gsdml_eValueDataType
type
;
int
sts
;
int
datasize
;
for
(
unsigned
int
i
=
0
;
i
<
par_record
->
Ref
.
size
();
i
++
)
{
if
(
strcmp
(
par_record
->
Ref
[
i
]
->
Body
.
DefaultValue
,
""
)
==
0
)
continue
;
sts
=
string_to_value_datatype
(
par_record
->
Ref
[
i
]
->
Body
.
DataType
,
&
type
);
if
(
EVEN
(
sts
))
continue
;
switch
(
type
)
{
case
gsdml_eValueDataType_Integer8
:
case
gsdml_eValueDataType_Unsigned8
:
case
gsdml_eValueDataType_Bit
:
case
gsdml_eValueDataType_BitArea
:
datasize
=
1
;
break
;
case
gsdml_eValueDataType_Integer16
:
case
gsdml_eValueDataType_Unsigned16
:
datasize
=
2
;
break
;
case
gsdml_eValueDataType_Integer32
:
case
gsdml_eValueDataType_Unsigned32
:
case
gsdml_eValueDataType_Float32
:
datasize
=
4
;
break
;
case
gsdml_eValueDataType_Integer64
:
case
gsdml_eValueDataType_Unsigned64
:
case
gsdml_eValueDataType_Float64
:
datasize
=
8
;
break
;
case
gsdml_eValueDataType_OctetString
:
case
gsdml_eValueDataType_VisibleString
:
datasize
=
par_record
->
Ref
[
i
]
->
Body
.
Length
;
break
;
default:
datasize
=
0
;
}
switch
(
type
)
{
case
gsdml_eValueDataType_Bit
:
{
if
(
datasize
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
>
(
unsigned
int
)
size
)
{
printf
(
"GSDML-Parser error, Default value exceeds data size"
);
return
0
;
}
unsigned
char
mask
=
1
<<
par_record
->
Ref
[
i
]
->
Body
.
BitOffset
;
if
(
strcmp
(
par_record
->
Ref
[
i
]
->
Body
.
DefaultValue
,
"0"
)
==
0
)
*
(
data
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
)
&=
~
mask
;
else
if
(
strcmp
(
par_record
->
Ref
[
i
]
->
Body
.
DefaultValue
,
"1"
)
==
0
)
*
(
data
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
)
|=
mask
;
break
;
}
case
gsdml_eValueDataType_BitArea
:
{
unsigned
short
mask
=
0
;
unsigned
short
value
;
if
(
datasize
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
>
(
unsigned
int
)
size
)
{
printf
(
"GSDML-Parser error, Default value exceeds data size"
);
return
0
;
}
for
(
int
j
=
0
;
j
<
par_record
->
Ref
[
i
]
->
Body
.
BitLength
;
j
++
)
mask
|=
(
mask
<<
1
)
|
1
;
mask
<<=
par_record
->
Ref
[
i
]
->
Body
.
BitOffset
;
sts
=
sscanf
(
par_record
->
Ref
[
i
]
->
Body
.
DefaultValue
,
"%hu"
,
&
value
);
if
(
sts
!=
1
)
break
;
value
<<=
par_record
->
Ref
[
i
]
->
Body
.
BitOffset
;
*
(
data
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
)
&=
~
mask
;
*
(
data
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
)
|=
value
;
break
;
}
default:
if
(
datasize
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
>
(
unsigned
int
)
size
)
{
printf
(
"GSDML-Parser error, Default value exceeds data size"
);
return
0
;
}
string_to_datavalue
(
type
,
data
+
par_record
->
Ref
[
i
]
->
Body
.
ByteOffset
,
par_record
->
Ref
[
i
]
->
Body
.
Length
,
par_record
->
Ref
[
i
]
->
Body
.
DefaultValue
);
}
}
return
1
;
}
void
gsdml_ProfileHeader
::
print
(
int
ind
)
{
void
gsdml_ProfileHeader
::
print
(
int
ind
)
{
char
is
[]
=
" "
;
char
is
[]
=
" "
;
is
[
ind
]
=
0
;
is
[
ind
]
=
0
;
...
@@ -4876,12 +4976,32 @@ gsdml_ChannelDiagItem::~gsdml_ChannelDiagItem()
...
@@ -4876,12 +4976,32 @@ gsdml_ChannelDiagItem::~gsdml_ChannelDiagItem()
delete
ExtChannelDiagList
;
delete
ExtChannelDiagList
;
}
}
void
gsdml_ChannelDiagItem
::
build
()
{
if
(
strcmp
(
Body
.
Name
.
ref
,
""
)
!=
0
)
{
Body
.
Name
.
p
=
gsdml
->
find_text_ref
(
Body
.
Name
.
ref
);
if
(
Body
.
Name
.
p
==
noref
)
gsdml
->
error_message
(
"Name not found:
\"
%s
\"
"
,
Body
.
Name
.
ref
);
}
if
(
strcmp
(
Body
.
Help
.
ref
,
""
)
!=
0
)
{
Body
.
Help
.
p
=
gsdml
->
find_text_ref
(
Body
.
Help
.
ref
);
if
(
Body
.
Help
.
p
==
noref
)
gsdml
->
error_message
(
"Help not found:
\"
%s
\"
"
,
Body
.
Help
.
ref
);
}
}
gsdml_ChannelDiagList
::~
gsdml_ChannelDiagList
()
gsdml_ChannelDiagList
::~
gsdml_ChannelDiagList
()
{
{
for
(
unsigned
int
i
=
0
;
i
<
ChannelDiagItem
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
ChannelDiagItem
.
size
();
i
++
)
delete
ChannelDiagItem
[
i
];
delete
ChannelDiagItem
[
i
];
}
}
void
gsdml_ChannelDiagList
::
build
()
{
for
(
unsigned
int
i
=
0
;
i
<
ChannelDiagItem
.
size
();
i
++
)
ChannelDiagItem
[
i
]
->
build
();
}
gsdml_UnitDiagTypeItem
::~
gsdml_UnitDiagTypeItem
()
gsdml_UnitDiagTypeItem
::~
gsdml_UnitDiagTypeItem
()
{
{
for
(
unsigned
int
i
=
0
;
i
<
Ref
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
Ref
.
size
();
i
++
)
...
@@ -4940,6 +5060,8 @@ void gsdml_ApplicationProcess::build()
...
@@ -4940,6 +5060,8 @@ void gsdml_ApplicationProcess::build()
ModuleList
->
build
();
ModuleList
->
build
();
if
(
ValueList
)
if
(
ValueList
)
ValueList
->
build
();
ValueList
->
build
();
if
(
ChannelDiagList
)
ChannelDiagList
->
build
();
}
}
gsdml_ApplicationProcess
::~
gsdml_ApplicationProcess
()
gsdml_ApplicationProcess
::~
gsdml_ApplicationProcess
()
...
@@ -5026,6 +5148,9 @@ gsdml_Valuelist::gsdml_Valuelist( char *str) : status(PB__SUCCESS)
...
@@ -5026,6 +5148,9 @@ gsdml_Valuelist::gsdml_Valuelist( char *str) : status(PB__SUCCESS)
void
gsdml_Valuelist
::
sort
()
void
gsdml_Valuelist
::
sort
()
{
{
if
(
value
.
size
()
==
0
)
return
;
for
(
unsigned
int
i
=
value
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
unsigned
int
i
=
value
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
unsigned
int
j
=
0
;
j
<
i
;
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
i
;
j
++
)
{
if
(
value
[
i
].
value1
<
value
[
j
].
value1
)
{
if
(
value
[
i
].
value1
<
value
[
j
].
value1
)
{
...
@@ -5183,6 +5308,9 @@ gsdml_SValuelist::gsdml_SValuelist( char *str) : status(PB__SUCCESS)
...
@@ -5183,6 +5308,9 @@ gsdml_SValuelist::gsdml_SValuelist( char *str) : status(PB__SUCCESS)
void
gsdml_SValuelist
::
sort
()
void
gsdml_SValuelist
::
sort
()
{
{
if
(
value
.
size
()
==
0
)
return
;
for
(
unsigned
int
i
=
value
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
unsigned
int
i
=
value
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
unsigned
int
j
=
0
;
j
<
i
;
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
i
;
j
++
)
{
if
(
value
[
i
].
value1
<
value
[
j
].
value1
)
{
if
(
value
[
i
].
value1
<
value
[
j
].
value1
)
{
...
@@ -5307,6 +5435,9 @@ gsdml_FValuelist::gsdml_FValuelist( char *str) : status(PB__SUCCESS)
...
@@ -5307,6 +5435,9 @@ gsdml_FValuelist::gsdml_FValuelist( char *str) : status(PB__SUCCESS)
void
gsdml_FValuelist
::
sort
()
void
gsdml_FValuelist
::
sort
()
{
{
if
(
value
.
size
()
==
0
)
return
;
for
(
unsigned
int
i
=
value
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
unsigned
int
i
=
value
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
unsigned
int
j
=
0
;
j
<
i
;
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
i
;
j
++
)
{
if
(
value
[
i
].
value1
<
value
[
j
].
value1
)
{
if
(
value
[
i
].
value1
<
value
[
j
].
value1
)
{
...
...
profibus/lib/rt/src/rt_pn_gsdml.h
View file @
01cc1f42
...
@@ -201,6 +201,7 @@ typedef enum {
...
@@ -201,6 +201,7 @@ typedef enum {
gsdml_eTag_Assign
,
gsdml_eTag_Assign
,
gsdml_eTag_ChannelDiagList
,
gsdml_eTag_ChannelDiagList
,
gsdml_eTag_ChannelDiagItem
,
gsdml_eTag_ChannelDiagItem
,
gsdml_eTag_ProfileChannelDiagItem
,
gsdml_eTag_ExtChannelDiagList
,
gsdml_eTag_ExtChannelDiagList
,
gsdml_eTag_ExtChannelDiagItem
,
gsdml_eTag_ExtChannelDiagItem
,
gsdml_eTag_ExtChannelAddValue
,
gsdml_eTag_ExtChannelAddValue
,
...
@@ -1247,6 +1248,7 @@ class gsdml_ChannelDiagItem {
...
@@ -1247,6 +1248,7 @@ class gsdml_ChannelDiagItem {
gsdml_ExtChannelDiagList
*
ExtChannelDiagList
;
gsdml_ExtChannelDiagList
*
ExtChannelDiagList
;
pn_gsdml
*
gsdml
;
pn_gsdml
*
gsdml
;
~
gsdml_ChannelDiagItem
();
~
gsdml_ChannelDiagItem
();
void
build
();
void
print
(
int
ind
);
void
print
(
int
ind
);
};
};
...
@@ -1256,6 +1258,7 @@ class gsdml_ChannelDiagList {
...
@@ -1256,6 +1258,7 @@ class gsdml_ChannelDiagList {
vector
<
gsdml_ChannelDiagItem
*>
ChannelDiagItem
;
vector
<
gsdml_ChannelDiagItem
*>
ChannelDiagItem
;
pn_gsdml
*
gsdml
;
pn_gsdml
*
gsdml
;
~
gsdml_ChannelDiagList
();
~
gsdml_ChannelDiagList
();
void
build
();
void
print
(
int
ind
);
void
print
(
int
ind
);
};
};
...
@@ -1437,6 +1440,7 @@ class pn_gsdml {
...
@@ -1437,6 +1440,7 @@ class pn_gsdml {
char
current_lang
[
10
];
char
current_lang
[
10
];
int
byte_order
;
int
byte_order
;
gsdml_sModuleClass
*
module_classlist
;
gsdml_sModuleClass
*
module_classlist
;
pwr_tFileName
gsdmlfile
;
gsdml_Xml
*
xml
;
gsdml_Xml
*
xml
;
gsdml_ProfileHeader
*
ProfileHeader
;
gsdml_ProfileHeader
*
ProfileHeader
;
gsdml_DeviceIdentity
*
DeviceIdentity
;
gsdml_DeviceIdentity
*
DeviceIdentity
;
...
@@ -1463,6 +1467,8 @@ class pn_gsdml {
...
@@ -1463,6 +1467,8 @@ class pn_gsdml {
int
string_to_datavalue
(
gsdml_eValueDataType
datatype
,
void
*
value
,
int
string_to_datavalue
(
gsdml_eValueDataType
datatype
,
void
*
value
,
unsigned
int
size
,
char
*
str
);
unsigned
int
size
,
char
*
str
);
void
set_classes
(
gsdml_sModuleClass
*
mclist
)
{
module_classlist
=
mclist
;}
void
set_classes
(
gsdml_sModuleClass
*
mclist
)
{
module_classlist
=
mclist
;}
int
set_par_record_default
(
unsigned
char
*
data
,
int
size
,
gsdml_ParameterRecordDataItem
*
par_record
);
void
*
next_token
();
void
*
next_token
();
bool
is_space
(
const
char
c
);
bool
is_space
(
const
char
c
);
...
...
profibus/lib/rt/src/rt_pn_gsdml_attr.cpp
View file @
01cc1f42
...
@@ -61,15 +61,13 @@ void GsdmlAttr::gsdmlattr_change_value_cb( void *attr_ctx)
...
@@ -61,15 +61,13 @@ void GsdmlAttr::gsdmlattr_change_value_cb( void *attr_ctx)
void
GsdmlAttr
::
activate_exit
()
void
GsdmlAttr
::
activate_exit
()
{
{
if
(
close_cb
)
{
if
(
close_cb
)
{
#if 0
if
(
attrnav
->
is_modified
())
{
if ( gsdml->is_modified()) {
wow
->
DisplayQuestion
(
(
void
*
)
this
,
"Apply"
,
wow
->
DisplayQuestion
(
(
void
*
)
this
,
"Apply"
,
"Do you want to apply changes"
,
"Do you want to apply changes"
,
cmd_close_apply_cb
,
cmd_close_no_cb
,
0
);
cmd_close_apply_cb
,
cmd_close_no_cb
,
0
);
}
}
else
else
#endif
(
close_cb
)(
parent_ctx
);
(
close_cb
)(
parent_ctx
);
}
}
else
else
...
@@ -146,6 +144,11 @@ void GsdmlAttr::activate_paste()
...
@@ -146,6 +144,11 @@ void GsdmlAttr::activate_paste()
attrnav
->
redraw
();
attrnav
->
redraw
();
}
}
void
GsdmlAttr
::
activate_viewio
(
int
set
)
{
attrnav
->
set_viewio
(
set
);
}
void
GsdmlAttr
::
activate_zoom_in
()
void
GsdmlAttr
::
activate_zoom_in
()
{
{
double
zoom_factor
;
double
zoom_factor
;
...
@@ -199,49 +202,22 @@ void GsdmlAttr::activate_cmd_ok()
...
@@ -199,49 +202,22 @@ void GsdmlAttr::activate_cmd_ok()
else
else
attrnav
->
set_modified
(
0
);
attrnav
->
set_modified
(
0
);
}
}
#if 0
int idx;
char msg[80];
if ( save_cb) {
// Check syntax
sts = gsdml->syntax_check( &idx);
if ( EVEN(sts)) {
switch ( sts) {
case PB__NOMODULENAME:
sprintf( msg, "Syntax error in module %d, No module name", idx + 1);
break;
case PB__DUPLMODULENAME:
sprintf( msg, "Syntax error in module %s, Duplicate module name",
gsdml->module_conf[idx].name);
break;
case PB__NOMODULECLASS:
sprintf( msg, "Syntax error in module %s, Module class is missing",
gsdml->module_conf[idx].name);
break;
default:
sprintf( msg, "Syntax error in module %d", idx + 1);
}
message( 'E', msg);
return;
}
#endif
}
}
void
GsdmlAttr
::
cmd_close_apply_cb
(
void
*
ctx
,
void
*
data
)
void
GsdmlAttr
::
cmd_close_apply_cb
(
void
*
ctx
,
void
*
data
)
{
{
#if 0
GsdmlAttr
*
attr
=
(
GsdmlAttr
*
)
ctx
;
GsdmlAttr
*
attr
=
(
GsdmlAttr
*
)
ctx
;
int
sts
;
int
sts
;
attr
->
attrnav
->
save
(
attr
->
data_filename
);
if
(
attr
->
save_cb
)
{
sts
=
(
attr
->
save_cb
)(
attr
->
parent_ctx
);
sts
=
(
attr
->
save_cb
)(
attr
->
parent_ctx
);
if
(
EVEN
(
sts
))
if
(
EVEN
(
sts
))
attr
->
message
(
'E'
,
"Error saving profibus data"
);
attr
->
message
(
'E'
,
"Error saving profibus data"
);
else {
else
attr->gsdml->set_modified(0);
(
attr
->
close_cb
)(
attr
->
parent_ctx
);
(
attr
->
close_cb
)(
attr
->
parent_ctx
);
}
}
#endif
}
}
void
GsdmlAttr
::
cmd_close_no_cb
(
void
*
ctx
,
void
*
data
)
void
GsdmlAttr
::
cmd_close_no_cb
(
void
*
ctx
,
void
*
data
)
...
@@ -253,16 +229,15 @@ void GsdmlAttr::cmd_close_no_cb( void *ctx, void *data)
...
@@ -253,16 +229,15 @@ void GsdmlAttr::cmd_close_no_cb( void *ctx, void *data)
void
GsdmlAttr
::
activate_cmd_ca
()
void
GsdmlAttr
::
activate_cmd_ca
()
{
{
if
(
close_cb
)
{
if
(
close_cb
)
{
#if 0
if
(
edit_mode
&&
attrnav
->
is_modified
())
{
if ( gsdml->is_modified()) {
wow
->
DisplayQuestion
(
(
void
*
)
this
,
"Apply"
,
wow
->
DisplayQuestion
(
(
void
*
)
this
,
"Apply"
,
"Do you want to apply changes"
,
"Do you want to apply changes"
,
cmd_close_apply_cb
,
cmd_close_no_cb
,
0
);
cmd_close_apply_cb
,
cmd_close_no_cb
,
0
);
}
}
else
else
#endif
(
close_cb
)(
parent_ctx
);
(
close_cb
)(
parent_ctx
);
}
}
}
}
...
...
profibus/lib/rt/src/rt_pn_gsdml_attr.h
View file @
01cc1f42
...
@@ -76,6 +76,7 @@ class GsdmlAttr {
...
@@ -76,6 +76,7 @@ class GsdmlAttr {
void
activate_cut
();
void
activate_cut
();
void
activate_paste
();
void
activate_paste
();
void
activate_print
();
void
activate_print
();
void
activate_viewio
(
int
set
);
void
activate_zoom_in
();
void
activate_zoom_in
();
void
activate_zoom_out
();
void
activate_zoom_out
();
void
activate_zoom_reset
();
void
activate_zoom_reset
();
...
...
profibus/lib/rt/src/rt_pn_gsdml_attrnav.cpp
View file @
01cc1f42
/*
/*
* Proview $Id
: rt_pn_gsdml_attrnav.cpp,v 1.7 2008-12-03 12:00:38 claes Exp
$
* Proview $Id$
* 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
...
@@ -171,6 +171,13 @@ void GsdmlAttrNav::attrvalue_to_string( int type_id, void *value_ptr,
...
@@ -171,6 +171,13 @@ void GsdmlAttrNav::attrvalue_to_string( int type_id, void *value_ptr,
*
len
=
sprintf
(
str
,
format
,
*
(
float
*
)
value_ptr
);
*
len
=
sprintf
(
str
,
format
,
*
(
float
*
)
value_ptr
);
break
;
break
;
}
}
case
pwr_eType_UInt8
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%hhu"
,
*
(
pwr_tUInt8
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
pwr_tUInt8
*
)
value_ptr
);
break
;
}
case
pwr_eType_UInt16
:
{
case
pwr_eType_UInt16
:
{
if
(
!
format
)
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%hu"
,
*
(
pwr_tUInt16
*
)
value_ptr
);
*
len
=
sprintf
(
str
,
"%hu"
,
*
(
pwr_tUInt16
*
)
value_ptr
);
...
@@ -185,6 +192,13 @@ void GsdmlAttrNav::attrvalue_to_string( int type_id, void *value_ptr,
...
@@ -185,6 +192,13 @@ void GsdmlAttrNav::attrvalue_to_string( int type_id, void *value_ptr,
*
len
=
sprintf
(
str
,
format
,
*
(
int
*
)
value_ptr
);
*
len
=
sprintf
(
str
,
format
,
*
(
int
*
)
value_ptr
);
break
;
break
;
}
}
case
pwr_eType_Int8
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%hhd"
,
*
(
pwr_tInt8
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
pwr_tInt8
*
)
value_ptr
);
break
;
}
case
pwr_eType_Int16
:
{
case
pwr_eType_Int16
:
{
if
(
!
format
)
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%hd"
,
*
(
pwr_tInt16
*
)
value_ptr
);
*
len
=
sprintf
(
str
,
"%hd"
,
*
(
pwr_tInt16
*
)
value_ptr
);
...
@@ -205,6 +219,9 @@ void GsdmlAttrNav::attrvalue_to_string( int type_id, void *value_ptr,
...
@@ -205,6 +219,9 @@ void GsdmlAttrNav::attrvalue_to_string( int type_id, void *value_ptr,
*
len
=
strlen
(
str
);
*
len
=
strlen
(
str
);
break
;
break
;
}
}
default:
*
len
=
0
;
str
[
0
]
=
0
;
}
}
}
}
...
@@ -434,7 +451,7 @@ GsdmlAttrNav::GsdmlAttrNav(
...
@@ -434,7 +451,7 @@ GsdmlAttrNav::GsdmlAttrNav(
parent_ctx
(
xn_parent_ctx
),
parent_ctx
(
xn_parent_ctx
),
gsdml
(
xn_gsdml
),
edit_mode
(
xn_edit_mode
),
trace_started
(
0
),
gsdml
(
xn_gsdml
),
edit_mode
(
xn_edit_mode
),
trace_started
(
0
),
message_cb
(
0
),
change_value_cb
(
0
),
device_num
(
0
),
device_item
(
0
),
message_cb
(
0
),
change_value_cb
(
0
),
device_num
(
0
),
device_item
(
0
),
device_confirm_active
(
0
),
device_read
(
0
)
device_confirm_active
(
0
),
device_read
(
0
)
,
viewio
(
0
),
time_ratio
(
0
)
{
{
strcpy
(
name
,
xn_name
);
strcpy
(
name
,
xn_name
);
...
@@ -503,8 +520,6 @@ int GsdmlAttrNav::set_attr_value( char *value_str)
...
@@ -503,8 +520,6 @@ int GsdmlAttrNav::set_attr_value( char *value_str)
brow_tNode
*
node_list
;
brow_tNode
*
node_list
;
int
node_count
;
int
node_count
;
ItemPn
*
base_item
;
ItemPn
*
base_item
;
int
sts
;
char
buffer
[
1024
];
brow_GetSelectedNodes
(
brow
->
ctx
,
&
node_list
,
&
node_count
);
brow_GetSelectedNodes
(
brow
->
ctx
,
&
node_list
,
&
node_count
);
if
(
!
node_count
)
if
(
!
node_count
)
...
@@ -513,35 +528,8 @@ int GsdmlAttrNav::set_attr_value( char *value_str)
...
@@ -513,35 +528,8 @@ int GsdmlAttrNav::set_attr_value( char *value_str)
brow_GetUserData
(
node_list
[
0
],
(
void
**
)
&
base_item
);
brow_GetUserData
(
node_list
[
0
],
(
void
**
)
&
base_item
);
free
(
node_list
);
free
(
node_list
);
switch
(
base_item
->
type
)
{
case
attrnav_eItemType_PnBase
:
{
ItemPnBase
*
item
=
(
ItemPnBase
*
)
base_item
;
sts
=
attr_string_to_value
(
item
->
type_id
,
value_str
,
buffer
,
sizeof
(
buffer
),
item
->
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
item
->
max_limit
!=
0
||
item
->
min_limit
!=
0
)
{
switch
(
item
->
type_id
)
{
case
pwr_eType_Int32
:
case
pwr_eType_UInt32
:
if
(
*
(
int
*
)
&
buffer
<
item
->
min_limit
||
*
(
int
*
)
&
buffer
>
item
->
max_limit
)
{
message
(
'E'
,
"Min or maxvalue exceeded"
);
return
0
;
}
break
;
default:
;
}
}
memcpy
(
item
->
value_p
,
buffer
,
item
->
size
);
set_modified
(
1
);
break
;
}
default:
base_item
->
value_changed
(
this
,
value_str
);
base_item
->
value_changed
(
this
,
value_str
);
}
return
1
;
return
1
;
}
}
...
@@ -577,8 +565,15 @@ int GsdmlAttrNav::check_attr_value( char **value)
...
@@ -577,8 +565,15 @@ int GsdmlAttrNav::check_attr_value( char **value)
return
PB__SUCCESS
;
return
PB__SUCCESS
;
}
}
case
attrnav_eItemType_PnParValue
:
{
case
attrnav_eItemType_PnParValue
:
{
if
(
((
ItemPnParValue
*
)
base_item
)
->
noedit
)
ItemPnParValue
*
item
=
(
ItemPnParValue
*
)
base_item
;
int
sts
;
if
(
item
->
noedit
)
return
PB__ATTRNOEDIT
;
return
PB__ATTRNOEDIT
;
sts
=
gsdml
->
datavalue_to_string
(
item
->
datatype
,
&
item
->
data
[
item
->
byte_offset
],
item
->
size
,
buf
,
sizeof
(
buf
));
if
(
EVEN
(
sts
))
strcpy
(
buf
,
""
);
strcpy
(
buf
,
""
);
*
value
=
buf
;
*
value
=
buf
;
return
PB__SUCCESS
;
return
PB__SUCCESS
;
...
@@ -726,25 +721,25 @@ int GsdmlAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
...
@@ -726,25 +721,25 @@ int GsdmlAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
case
flow_eObjectType_Node
:
case
flow_eObjectType_Node
:
brow_GetSelectedNodes
(
attrnav
->
brow
->
ctx
,
&
node_list
,
&
node_count
);
brow_GetSelectedNodes
(
attrnav
->
brow
->
ctx
,
&
node_list
,
&
node_count
);
if
(
!
node_count
)
{
if
(
!
node_count
)
{
attrnav
->
message
(
'E'
,
"Select a
module
"
);
attrnav
->
message
(
'E'
,
"Select a
slot
"
);
break
;
break
;
}
}
else
if
(
node_count
>
1
)
{
else
if
(
node_count
>
1
)
{
attrnav
->
message
(
'E'
,
"Select one
module
"
);
attrnav
->
message
(
'E'
,
"Select one
slot
"
);
free
(
node_list
);
free
(
node_list
);
break
;
break
;
}
}
ItemPn
Module
*
item_dest
,
*
item_src
;
ItemPn
Slot
*
item_dest
,
*
item_src
;
brow_GetUserData
(
node_list
[
0
],
(
void
**
)
&
item_src
);
brow_GetUserData
(
node_list
[
0
],
(
void
**
)
&
item_src
);
brow_GetUserData
(
event
->
object
.
object
,
(
void
**
)
&
item_dest
);
brow_GetUserData
(
event
->
object
.
object
,
(
void
**
)
&
item_dest
);
if
(
item_src
->
type
!=
attrnav_eItemType_Pn
Module
)
{
if
(
item_src
->
type
!=
attrnav_eItemType_Pn
Slot
)
{
attrnav
->
message
(
'E'
,
"Unable to move this object"
);
attrnav
->
message
(
'E'
,
"Unable to move this object"
);
free
(
node_list
);
free
(
node_list
);
break
;
break
;
}
}
if
(
item_dest
->
type
!=
attrnav_eItemType_Pn
Module
)
{
if
(
item_dest
->
type
!=
attrnav_eItemType_Pn
Slot
)
{
attrnav
->
message
(
'E'
,
"Invalid destination"
);
attrnav
->
message
(
'E'
,
"Invalid destination"
);
free
(
node_list
);
free
(
node_list
);
break
;
break
;
...
@@ -932,12 +927,15 @@ void GsdmlAttrNav::device_changed_ok( void *ctx, void *data)
...
@@ -932,12 +927,15 @@ void GsdmlAttrNav::device_changed_ok( void *ctx, void *data)
GsdmlAttrNav
*
attrnav
=
(
GsdmlAttrNav
*
)
ctx
;
GsdmlAttrNav
*
attrnav
=
(
GsdmlAttrNav
*
)
ctx
;
brow_DeleteAll
(
attrnav
->
brow
->
ctx
);
brow_DeleteAll
(
attrnav
->
brow
->
ctx
);
if
(
attrnav
->
device_read
)
if
(
!
attrnav
->
device_read
)
attrnav
->
device_read
=
0
;
else
attrnav
->
dev_data
.
device_reset
();
attrnav
->
dev_data
.
device_reset
();
attrnav
->
object_attr
();
attrnav
->
object_attr
();
attrnav
->
device_confirm_active
=
0
;
attrnav
->
device_confirm_active
=
0
;
if
(
attrnav
->
device_read
)
attrnav
->
device_read
=
0
;
else
attrnav
->
set_modified
(
1
);
}
}
void
GsdmlAttrNav
::
device_changed_cancel
(
void
*
ctx
,
void
*
data
)
void
GsdmlAttrNav
::
device_changed_cancel
(
void
*
ctx
,
void
*
data
)
...
@@ -1007,26 +1005,18 @@ int GsdmlAttrNav::trace_connect_bc( brow_tObject object, char *name, char *attr,
...
@@ -1007,26 +1005,18 @@ int GsdmlAttrNav::trace_connect_bc( brow_tObject object, char *name, char *attr,
*
p
=
&
attrnav
->
dev_data
.
slot_data
[
item
->
slot_idx
]
->
module_enum_number
;
*
p
=
&
attrnav
->
dev_data
.
slot_data
[
item
->
slot_idx
]
->
module_enum_number
;
break
;
break
;
}
}
case
attrnav_eItemType_PnModule
:
{
#if 0
ItemPnModule *item = (ItemPnModule *) base_item;
*p = &item->mconf->name;
#endif
break
;
}
case
attrnav_eItemType_PnModuleClass
:
{
case
attrnav_eItemType_PnModuleClass
:
{
ItemPnModuleClass
*
item
=
(
ItemPnModuleClass
*
)
base_item
;
ItemPnModuleClass
*
item
=
(
ItemPnModuleClass
*
)
base_item
;
*
p
=
&
item
->
slotdata
->
module_class
;
*
p
=
&
item
->
slotdata
->
module_class
;
break
;
break
;
}
}
case
attrnav_eItemType_PnEnumValue
:
{
case
attrnav_eItemType_PnEnumValue
:
ItemPnEnumValue
*
item
=
(
ItemPnEnumValue
*
)
base_item
;
*
p
=
((
ItemPnEnumValue
*
)
base_item
)
->
value_p
;
break
;
*
p
=
item
->
value_p
;
case
attrnav_eItemType_PnEnumTimeRatio
:
*
p
=
((
ItemPnEnumTimeRatio
*
)
base_item
)
->
value_p
;
break
;
break
;
}
case
attrnav_eItemType_PnParEnum
:
case
attrnav_eItemType_PnParEnum
:
case
attrnav_eItemType_PnParEnumBit
:
case
attrnav_eItemType_PnParEnumBit
:
case
attrnav_eItemType_PnParValue
:
case
attrnav_eItemType_PnParValue
:
...
@@ -1355,7 +1345,12 @@ int GsdmlAttrNav::init_brow_cb( FlowCtx *fctx, void *client_data)
...
@@ -1355,7 +1345,12 @@ int GsdmlAttrNav::init_brow_cb( FlowCtx *fctx, void *client_data)
int
GsdmlAttrNav
::
save
(
const
char
*
filename
)
int
GsdmlAttrNav
::
save
(
const
char
*
filename
)
{
{
dev_data
.
device_num
=
device_num
;
dev_data
.
device_num
=
device_num
;
if
(
device_num
==
0
)
return
PB__NODEVICE
;
strncpy
(
dev_data
.
device_text
,
(
char
*
)
device_item
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
dev_data
.
device_text
));
strncpy
(
dev_data
.
device_text
,
(
char
*
)
device_item
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
dev_data
.
device_text
));
dev_data
.
vendor_id
=
gsdml
->
DeviceIdentity
->
Body
.
VendorID
;
dev_data
.
vendor_id
=
gsdml
->
DeviceIdentity
->
Body
.
VendorID
;
dev_data
.
device_id
=
gsdml
->
DeviceIdentity
->
Body
.
DeviceID
;
dev_data
.
device_id
=
gsdml
->
DeviceIdentity
->
Body
.
DeviceID
;
...
@@ -1376,7 +1371,7 @@ int GsdmlAttrNav::save( const char *filename)
...
@@ -1376,7 +1371,7 @@ int GsdmlAttrNav::save( const char *filename)
dev_data
.
iocr_data
[
0
]
->
type
=
1
;
// Input ?
dev_data
.
iocr_data
[
0
]
->
type
=
1
;
// Input ?
dev_data
.
iocr_data
[
0
]
->
properties
=
1
;
// Class 1
dev_data
.
iocr_data
[
0
]
->
properties
=
1
;
// Class 1
dev_data
.
iocr_data
[
0
]
->
send_clock_factor
=
32
;
// 1 ms
dev_data
.
iocr_data
[
0
]
->
send_clock_factor
=
32
;
// 1 ms
dev_data
.
iocr_data
[
0
]
->
reduction_ratio
=
8
;
// send_time = 8 * 31.2 us * send_clock_factor
dev_data
.
iocr_data
[
0
]
->
reduction_ratio
=
time_ratio
;
// send_time = 8 * 31.2 us * send_clock_factor
dev_data
.
iocr_data
[
0
]
->
api
=
0
;
dev_data
.
iocr_data
[
0
]
->
api
=
0
;
dev_data
.
iocr_data
[
1
]
->
type
=
2
;
// Output ?
dev_data
.
iocr_data
[
1
]
->
type
=
2
;
// Output ?
...
@@ -1385,18 +1380,41 @@ int GsdmlAttrNav::save( const char *filename)
...
@@ -1385,18 +1380,41 @@ int GsdmlAttrNav::save( const char *filename)
dev_data
.
iocr_data
[
1
]
->
reduction_ratio
=
dev_data
.
iocr_data
[
0
]
->
reduction_ratio
;
dev_data
.
iocr_data
[
1
]
->
reduction_ratio
=
dev_data
.
iocr_data
[
0
]
->
reduction_ratio
;
dev_data
.
iocr_data
[
1
]
->
api
=
dev_data
.
iocr_data
[
0
]
->
api
;
dev_data
.
iocr_data
[
1
]
->
api
=
dev_data
.
iocr_data
[
0
]
->
api
;
// Load channel diag
dev_data
.
channel_diag_reset
();
if
(
gsdml
->
ApplicationProcess
->
ChannelDiagList
)
{
for
(
unsigned
int
i
=
0
;
i
<
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
.
size
();
i
++
)
{
GsdmlChannelDiag
*
cd
=
new
GsdmlChannelDiag
();
cd
->
error_type
=
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
ErrorType
;
strncpy
(
cd
->
name
,
(
char
*
)
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
Name
.
p
,
sizeof
(
cd
->
name
));
strncpy
(
cd
->
help
,
(
char
*
)
gsdml
->
ApplicationProcess
->
ChannelDiagList
->
ChannelDiagItem
[
i
]
->
Body
.
Help
.
p
,
sizeof
(
cd
->
help
));
dev_data
.
channel_diag
.
push_back
(
cd
);
}
}
return
dev_data
.
print
(
filename
);
return
dev_data
.
print
(
filename
);
// Unload channel diag
dev_data
.
channel_diag_reset
();
}
}
int
GsdmlAttrNav
::
open
(
const
char
*
filename
)
int
GsdmlAttrNav
::
open
(
const
char
*
filename
)
{
{
int
sts
;
int
sts
;
strncpy
(
dev_data
.
gsdmlfile
,
gsdml
->
gsdmlfile
,
sizeof
(
dev_data
.
gsdmlfile
));
sts
=
dev_data
.
read
(
filename
);
sts
=
dev_data
.
read
(
filename
);
if
(
sts
==
PB__GSDMLFILEMISMATCH
)
printf
(
"GSDML-Error, Gsdmlfile doesn't match original filename
\n
"
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
return
sts
;
device_num
=
dev_data
.
device_num
;
device_num
=
dev_data
.
device_num
;
gsdml
->
byte_order
=
dev_data
.
byte_order
;
gsdml
->
byte_order
=
dev_data
.
byte_order
;
time_ratio
=
dev_data
.
iocr_data
[
0
]
->
reduction_ratio
;
if
(
device_num
>
0
)
{
if
(
device_num
>
0
)
{
if
(
device_num
>
gsdml
->
ApplicationProcess
->
DeviceAccessPointList
->
if
(
device_num
>
gsdml
->
ApplicationProcess
->
DeviceAccessPointList
->
DeviceAccessPointItem
.
size
())
{
DeviceAccessPointItem
.
size
())
{
...
@@ -1417,14 +1435,12 @@ int GsdmlAttrNav::open( const char *filename)
...
@@ -1417,14 +1435,12 @@ int GsdmlAttrNav::open( const char *filename)
ItemPnBase
::
ItemPnBase
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
const
char
*
attr
,
ItemPnBase
::
ItemPnBase
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
const
char
*
attr
,
int
attr_type
,
int
attr_size
,
double
attr_min_limit
,
int
attr_type
,
int
attr_size
,
double
attr_min_limit
,
double
attr_max_limit
,
void
*
attr_value_p
,
double
attr_max_limit
,
void
*
attr_value_p
,
int
attr_noedit
,
int
attr_noedit
,
gsd_sPrmText
*
attr_enumtext
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
brow_tNode
dest
,
flow_eDest
dest_code
)
:
value_p
(
attr_value_p
),
first_scan
(
1
),
value_p
(
attr_value_p
),
first_scan
(
1
),
type_id
(
attr_type
),
size
(
attr_size
),
type_id
(
attr_type
),
size
(
attr_size
),
min_limit
(
attr_min_limit
),
max_limit
(
attr_max_limit
),
min_limit
(
attr_min_limit
),
max_limit
(
attr_max_limit
),
noedit
(
attr_noedit
),
enumtext
(
attr_enumtext
),
noedit
(
attr_noedit
),
subgraph
(
0
)
subgraph
(
0
)
{
{
type
=
attrnav_eItemType_PnBase
;
type
=
attrnav_eItemType_PnBase
;
...
@@ -1432,8 +1448,6 @@ ItemPnBase::ItemPnBase( GsdmlAttrNav *attrnav, const char *item_name, const char
...
@@ -1432,8 +1448,6 @@ ItemPnBase::ItemPnBase( GsdmlAttrNav *attrnav, const char *item_name, const char
strcpy
(
name
,
item_name
);
strcpy
(
name
,
item_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));
memset
(
old_value
,
0
,
sizeof
(
old_value
));
if
(
enumtext
)
parent
=
1
;
brow_CreateNode
(
attrnav
->
brow
->
ctx
,
item_name
,
attrnav
->
brow
->
nc_attr
,
brow_CreateNode
(
attrnav
->
brow
->
ctx
,
item_name
,
attrnav
->
brow
->
nc_attr
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
...
@@ -1475,6 +1489,35 @@ int ItemPnBase::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -1475,6 +1489,35 @@ int ItemPnBase::scan( GsdmlAttrNav *attrnav, void *p)
return
1
;
return
1
;
}
}
void
ItemPnBase
::
value_changed
(
GsdmlAttrNav
*
attrnav
,
char
*
value_str
)
{
char
buffer
[
1024
];
int
sts
;
sts
=
attrnav
->
attr_string_to_value
(
type_id
,
value_str
,
buffer
,
sizeof
(
buffer
),
size
);
if
(
EVEN
(
sts
))
{
attrnav
->
message
(
'E'
,
"Syntax error"
);
return
;
}
if
(
max_limit
!=
0
||
min_limit
!=
0
)
{
switch
(
type_id
)
{
case
pwr_eType_Int32
:
case
pwr_eType_UInt32
:
if
(
*
(
int
*
)
&
buffer
<
min_limit
||
*
(
int
*
)
&
buffer
>
max_limit
)
{
attrnav
->
message
(
'E'
,
"Min or maxvalue exceeded"
);
return
;
}
break
;
default:
;
}
}
memcpy
(
value_p
,
buffer
,
size
);
attrnav
->
set_modified
(
1
);
}
int
ItemPn
::
close
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
)
int
ItemPn
::
close
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
)
{
{
double
node_x
,
node_y
;
double
node_x
,
node_y
;
...
@@ -1555,7 +1598,7 @@ int ItemPnEnumValue::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -1555,7 +1598,7 @@ int ItemPnEnumValue::scan( GsdmlAttrNav *attrnav, void *p)
ItemPnDevice
::
ItemPnDevice
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
ItemPnDevice
::
ItemPnDevice
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
brow_tNode
dest
,
flow_eDest
dest_code
)
:
first_scan
(
1
)
old_value
(
0
),
first_scan
(
1
)
{
{
type
=
attrnav_eItemType_PnDevice
;
type
=
attrnav_eItemType_PnDevice
;
...
@@ -1615,6 +1658,7 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -1615,6 +1658,7 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
{
{
char
buf
[
200
];
char
buf
[
200
];
// Note, first scan is set the two first scans to detect load from data file
if
(
!
first_scan
)
{
if
(
!
first_scan
)
{
if
(
old_value
==
*
(
int
*
)
p
)
if
(
old_value
==
*
(
int
*
)
p
)
// No change since last time
// No change since last time
...
@@ -1624,6 +1668,7 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -1624,6 +1668,7 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
if
(
attrnav
->
device_confirm_active
)
if
(
attrnav
->
device_confirm_active
)
return
1
;
return
1
;
if
(
!
first_scan
)
{
if
(
!
first_scan
)
{
if
(
old_value
==
0
)
{
if
(
old_value
==
0
)
{
GsdmlAttrNav
::
device_changed_ok
(
attrnav
,
(
void
*
)
old_value
);
GsdmlAttrNav
::
device_changed_ok
(
attrnav
,
(
void
*
)
old_value
);
...
@@ -1662,7 +1707,7 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -1662,7 +1707,7 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
ItemPnSlot
::
ItemPnSlot
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
ItemPnSlot
::
ItemPnSlot
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
GsdmlSlotData
*
item_slotdata
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
GsdmlSlotData
*
item_slotdata
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
slotdata
(
item_slotdata
),
first_scan
(
1
)
slotdata
(
item_slotdata
),
old_value
(
0
),
first_scan
(
1
)
{
{
type
=
attrnav_eItemType_PnSlot
;
type
=
attrnav_eItemType_PnSlot
;
...
@@ -1706,25 +1751,59 @@ int ItemPnSlot::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -1706,25 +1751,59 @@ int ItemPnSlot::open_children( GsdmlAttrNav *attrnav, double x, double y)
gsdml_UseableModules
*
um
=
attrnav
->
gsdml
->
ApplicationProcess
->
DeviceAccessPointList
->
gsdml_UseableModules
*
um
=
attrnav
->
gsdml
->
ApplicationProcess
->
DeviceAccessPointList
->
DeviceAccessPointItem
[
attrnav
->
device_num
-
1
]
->
UseableModules
;
DeviceAccessPointItem
[
attrnav
->
device_num
-
1
]
->
UseableModules
;
if
(
um
)
{
if
(
um
)
{
unsigned
int
subslot_number
=
0
;
unsigned
int
subslot_index
=
0
;
gsdml_ModuleItem
*
mi
=
(
gsdml_ModuleItem
*
)
um
->
gsdml_ModuleItem
*
mi
=
(
gsdml_ModuleItem
*
)
um
->
ModuleItemRef
[
slotdata
->
module_enum_number
-
1
]
->
Body
.
ModuleItemTarget
.
p
;
ModuleItemRef
[
slotdata
->
module_enum_number
-
1
]
->
Body
.
ModuleItemTarget
.
p
;
if
(
mi
&&
mi
->
ModuleInfo
)
{
if
(
mi
&&
mi
->
ModuleInfo
)
{
new
ItemPnModuleInfo
(
attrnav
,
"ModuleInfo"
,
mi
->
ModuleInfo
,
new
ItemPnModuleInfo
(
attrnav
,
"ModuleInfo"
,
mi
->
ModuleInfo
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
}
}
if
(
mi
->
VirtualSubmoduleList
)
{
if
(
mi
->
VirtualSubmoduleList
)
{
char
subslot_name
[
80
];
char
subslot_name
[
80
];
unsigned
int
subslot_number
;
unsigned
int
subslot_index
=
0
;
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
1
)
{
for
(
unsigned
int
i
=
0
;
i
<
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
();
if
(
strcmp
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
0
]
->
Body
.
FixedInSubslots
.
str
,
i
++
)
{
""
)
==
0
)
if
(
strcmp
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
i
]
->
Body
.
FixedInSubslots
.
str
,
""
)
==
0
)
{
// FixedInSubslots not supplied, default subslot number is 1
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
1
)
subslot_number
=
1
;
subslot_number
=
1
;
else
subslot_number
++
;
sprintf
(
subslot_name
,
"Subslot %d"
,
subslot_number
);
GsdmlSubslotData
*
ssd
;
if
(
slotdata
->
subslot_data
.
size
()
<=
subslot_index
)
{
ssd
=
new
GsdmlSubslotData
();
ssd
->
subslot_number
=
subslot_number
;
ssd
->
subslot_idx
=
subslot_index
;
slotdata
->
subslot_data
.
push_back
(
ssd
);
}
else
{
else
{
// TODO...
ssd
=
slotdata
->
subslot_data
[
subslot_index
];
subslot_number
=
1
;
ssd
->
subslot_idx
=
subslot_index
;
if
(
ssd
->
subslot_number
!=
subslot_number
)
{
printf
(
"GSML-Error, datafile corrupt, unexpected subslot number
\n
"
);
}
}
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
0
],
node
,
flow_eDest_IntoLast
);
}
}
else
{
// FixedInSubslots supplied, create all fixed subslots
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
);
sprintf
(
subslot_name
,
"Subslot %d"
,
subslot_number
);
GsdmlSubslotData
*
ssd
;
GsdmlSubslotData
*
ssd
;
...
@@ -1743,8 +1822,12 @@ int ItemPnSlot::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -1743,8 +1822,12 @@ int ItemPnSlot::open_children( GsdmlAttrNav *attrnav, double x, double y)
}
}
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
0
],
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
i
],
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
subslot_index
++
;
}
delete
vl
;
}
}
}
}
}
}
}
...
@@ -1860,6 +1943,10 @@ int ItemPnSubslot::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -1860,6 +1943,10 @@ int ItemPnSubslot::open_children( GsdmlAttrNav *attrnav, double x, double y)
}
}
}
}
if
(
attrnav
->
viewio
&&
virtualsubmodule
->
IOData
)
{
new
ItemPnIOData
(
attrnav
,
"IOData"
,
virtualsubmodule
->
IOData
,
node
,
flow_eDest_IntoLast
);
}
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
...
@@ -1904,40 +1991,85 @@ int ItemPnDAP::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -1904,40 +1991,85 @@ int ItemPnDAP::open_children( GsdmlAttrNav *attrnav, double x, double y)
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
if
(
attrnav
->
device_num
)
{
if
(
attrnav
->
device_num
)
{
gsdml_DeviceAccessPointItem
*
mi
=
attrnav
->
device_item
;
unsigned
int
subslot_index
=
0
;
unsigned
int
subslot_index
=
0
;
unsigned
int
subslot_number
=
0
;
if
(
attrnav
->
device_item
->
ModuleInfo
)
{
if
(
attrnav
->
device_item
->
ModuleInfo
)
{
new
ItemPnModuleInfo
(
attrnav
,
"ModuleInfo"
,
attrnav
->
device_item
->
ModuleInfo
,
new
ItemPnModuleInfo
(
attrnav
,
"ModuleInfo"
,
attrnav
->
device_item
->
ModuleInfo
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
}
}
if
(
attrnav
->
device_item
->
VirtualSubmoduleList
)
{
if
(
mi
->
VirtualSubmoduleList
)
{
for
(
unsigned
int
i
=
0
;
i
<
attrnav
->
device_item
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
();
i
++
)
{
char
subslot_name
[
80
];
char
subslot_name
[
80
];
for
(
unsigned
int
i
=
0
;
i
<
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
();
i
++
)
{
if
(
strcmp
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
i
]
->
Body
.
FixedInSubslots
.
str
,
""
)
==
0
)
{
// FixedInSubslots not supplied, default subslot number is 1
if
(
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
.
size
()
==
1
)
subslot_number
=
1
;
else
subslot_number
++
;
sprintf
(
subslot_name
,
"Subslot %d"
,
subslot_number
);
GsdmlSubslotData
*
ssd
;
GsdmlSubslotData
*
ssd
;
if
(
slotdata
->
subslot_data
.
size
()
<=
subslot_index
)
{
if
(
slotdata
->
subslot_data
.
size
()
<=
subslot_index
)
{
ssd
=
new
GsdmlSubslotData
();
ssd
=
new
GsdmlSubslotData
();
ssd
->
subslot_number
=
i
+
1
;
ssd
->
subslot_number
=
subslot_number
;
ssd
->
subslot_idx
=
subslot_index
;
ssd
->
subslot_idx
=
subslot_index
;
slotdata
->
subslot_data
.
push_back
(
ssd
);
slotdata
->
subslot_data
.
push_back
(
ssd
);
}
}
else
{
else
{
ssd
=
slotdata
->
subslot_data
[
subslot_index
];
ssd
=
slotdata
->
subslot_data
[
subslot_index
];
ssd
->
subslot_idx
=
subslot_index
;
ssd
->
subslot_idx
=
subslot_index
;
if
(
ssd
->
subslot_number
!=
1
)
{
if
(
ssd
->
subslot_number
!=
subslot_number
)
{
printf
(
"GSML-Error, datafile corrupt, unexpected subslot number
\n
"
);
printf
(
"GSML-Error, datafile corrupt, unexpected subslot number
\n
"
);
}
}
}
}
sprintf
(
subslot_name
,
"Subslot %d"
,
ssd
->
subslot_number
);
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
attrnav
->
device_item
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
i
],
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
0
],
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
subslot_index
++
;
subslot_index
++
;
}
}
else
{
// FixedInSubslots supplied, create all fixed subslots
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
);
GsdmlSubslotData
*
ssd
;
if
(
slotdata
->
subslot_data
.
size
()
<=
subslot_index
)
{
ssd
=
new
GsdmlSubslotData
();
ssd
->
subslot_number
=
subslot_number
;
ssd
->
subslot_idx
=
subslot_index
;
slotdata
->
subslot_data
.
push_back
(
ssd
);
}
else
{
ssd
=
slotdata
->
subslot_data
[
subslot_index
];
ssd
->
subslot_idx
=
subslot_index
;
if
(
ssd
->
subslot_number
!=
subslot_number
)
{
printf
(
"GSML-Error, datafile corrupt, unexpected subslot number
\n
"
);
}
}
new
ItemPnSubslot
(
attrnav
,
subslot_name
,
ssd
,
mi
->
VirtualSubmoduleList
->
VirtualSubmoduleItem
[
i
],
node
,
flow_eDest_IntoLast
);
subslot_index
++
;
}
delete
vl
;
}
}
}
}
if
(
attrnav
->
device_item
->
SystemDefinedSubmoduleList
)
{
if
(
attrnav
->
device_item
->
SystemDefinedSubmoduleList
)
{
if
(
attrnav
->
device_item
->
SystemDefinedSubmoduleList
->
InterfaceSubmoduleItem
)
{
if
(
attrnav
->
device_item
->
SystemDefinedSubmoduleList
->
InterfaceSubmoduleItem
)
{
...
@@ -2056,23 +2188,33 @@ int ItemPnNetwork::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -2056,23 +2188,33 @@ int ItemPnNetwork::open_children( GsdmlAttrNav *attrnav, double x, double y)
void
*
p
=
(
void
*
)
attrnav
->
dev_data
.
device_name
;
void
*
p
=
(
void
*
)
attrnav
->
dev_data
.
device_name
;
new
ItemPnBase
(
attrnav
,
"DeviceName"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"DeviceName"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
device_name
),
0
,
0
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
device_name
),
0
,
0
,
p
,
0
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
0
,
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
attrnav
->
dev_data
.
ip_address
;
p
=
(
void
*
)
attrnav
->
dev_data
.
ip_address
;
new
ItemPnBase
(
attrnav
,
"IP Address"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"IP Address"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
ip_address
),
0
,
0
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
ip_address
),
0
,
0
,
p
,
0
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
0
,
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
attrnav
->
dev_data
.
subnet_mask
;
p
=
(
void
*
)
attrnav
->
dev_data
.
subnet_mask
;
new
ItemPnBase
(
attrnav
,
"Subnet Mask"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"Subnet Mask"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
subnet_mask
),
0
,
0
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
subnet_mask
),
0
,
0
,
p
,
0
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
0
,
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
attrnav
->
dev_data
.
mac_address
;
p
=
(
void
*
)
attrnav
->
dev_data
.
mac_address
;
new
ItemPnBase
(
attrnav
,
"MAC Address"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"MAC Address"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
mac_address
),
0
,
0
,
pwr_eType_String
,
sizeof
(
attrnav
->
dev_data
.
mac_address
),
0
,
0
,
p
,
0
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
0
,
node
,
flow_eDest_IntoLast
);
if
(
attrnav
->
device_item
&&
attrnav
->
device_item
->
SystemDefinedSubmoduleList
&&
attrnav
->
device_item
->
SystemDefinedSubmoduleList
->
InterfaceSubmoduleItem
&&
attrnav
->
device_item
->
SystemDefinedSubmoduleList
->
InterfaceSubmoduleItem
->
ApplicationRelations
&&
attrnav
->
device_item
->
SystemDefinedSubmoduleList
->
InterfaceSubmoduleItem
->
ApplicationRelations
->
TimingProperties
)
{
p
=
(
void
*
)
&
attrnav
->
time_ratio
;
new
ItemPnEnumTimeRatio
(
attrnav
,
"TimeRatio"
,
attrnav
->
device_item
->
SystemDefinedSubmoduleList
->
InterfaceSubmoduleItem
,
p
,
node
,
flow_eDest_IntoLast
);
}
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
...
@@ -2119,25 +2261,25 @@ int ItemPnDeviceInfo::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -2119,25 +2261,25 @@ int ItemPnDeviceInfo::open_children( GsdmlAttrNav *attrnav, double x, double y)
void
*
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceIdentity
->
Body
.
VendorName
;
void
*
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceIdentity
->
Body
.
VendorName
;
new
ItemPnBase
(
attrnav
,
"Vendor"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"Vendor"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceIdentity
->
Body
.
InfoText
.
p
;
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceIdentity
->
Body
.
InfoText
.
p
;
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceFunction
->
Body
.
MainFamily
;
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceFunction
->
Body
.
MainFamily
;
new
ItemPnBase
(
attrnav
,
"MainFamily"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"MainFamily"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceFunction
->
Body
.
ProductFamily
;
p
=
(
void
*
)
attrnav
->
gsdml
->
DeviceFunction
->
Body
.
ProductFamily
;
new
ItemPnBase
(
attrnav
,
"ProductFamily"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"ProductFamily"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
...
@@ -2189,44 +2331,44 @@ int ItemPnInterfaceSubmodule::open_children( GsdmlAttrNav *attrnav, double x, do
...
@@ -2189,44 +2331,44 @@ int ItemPnInterfaceSubmodule::open_children( GsdmlAttrNav *attrnav, double x, do
char
*
p
=
(
char
*
)
ii
->
Body
.
TextId
.
p
;
char
*
p
=
(
char
*
)
ii
->
Body
.
TextId
.
p
;
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
ii
->
Body
.
SupportedRT_Class
;
p
=
ii
->
Body
.
SupportedRT_Class
;
new
ItemPnBase
(
attrnav
,
"SupportedRT_Class"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"SupportedRT_Class"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
ii
->
Body
.
SupportedRT_Classes
;
p
=
ii
->
Body
.
SupportedRT_Classes
;
new
ItemPnBase
(
attrnav
,
"SupportedRT_Classes"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"SupportedRT_Classes"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
ii
->
Body
.
IsochroneModeSupported
;
p
=
(
char
*
)
&
ii
->
Body
.
IsochroneModeSupported
;
new
ItemPnBase
(
attrnav
,
"IsochroneModeSupported"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"IsochroneModeSupported"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
if
(
*
(
pwr_tBoolean
*
)
p
)
{
if
(
*
(
pwr_tBoolean
*
)
p
)
{
p
=
ii
->
Body
.
IsochroneModeInRT_Classes
;
p
=
ii
->
Body
.
IsochroneModeInRT_Classes
;
new
ItemPnBase
(
attrnav
,
"IsochroneModeSupported"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"IsochroneModeSupported"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
}
}
p
=
ii
->
Body
.
SupportedProtocols
;
p
=
ii
->
Body
.
SupportedProtocols
;
new
ItemPnBase
(
attrnav
,
"SupportedProtocols"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"SupportedProtocols"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
ii
->
Body
.
SupportedMibs
;
p
=
ii
->
Body
.
SupportedMibs
;
new
ItemPnBase
(
attrnav
,
"SupportedMibs"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"SupportedMibs"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
ii
->
Body
.
NetworkComponentDiagnosisSupported
;
p
=
(
char
*
)
&
ii
->
Body
.
NetworkComponentDiagnosisSupported
;
new
ItemPnBase
(
attrnav
,
"NetworkComponentDiagnosisSupported"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"NetworkComponentDiagnosisSupported"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
gsdml_RecordDataList
*
rl
=
ii
->
RecordDataList
;
gsdml_RecordDataList
*
rl
=
ii
->
RecordDataList
;
if
(
rl
)
{
if
(
rl
)
{
...
@@ -2300,48 +2442,48 @@ int ItemPnPortSubmodule::open_children( GsdmlAttrNav *attrnav, double x, double
...
@@ -2300,48 +2442,48 @@ int ItemPnPortSubmodule::open_children( GsdmlAttrNav *attrnav, double x, double
char
*
p
=
(
char
*
)
pi
->
Body
.
TextId
.
p
;
char
*
p
=
(
char
*
)
pi
->
Body
.
TextId
.
p
;
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
pi
->
Body
.
MAUType
;
p
=
pi
->
Body
.
MAUType
;
new
ItemPnBase
(
attrnav
,
"MAUType"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"MAUType"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
pi
->
Body
.
MaxPortTxDelay
;
p
=
(
char
*
)
&
pi
->
Body
.
MaxPortTxDelay
;
new
ItemPnBase
(
attrnav
,
"MaxPortTxDelay"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"MaxPortTxDelay"
,
"LocalGsdmlAttr"
,
pwr_eType_UInt16
,
sizeof
(
pwr_tUInt16
),
0
,
0
,
pwr_eType_UInt16
,
sizeof
(
pwr_tUInt16
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
pi
->
Body
.
MaxPortRxDelay
;
p
=
(
char
*
)
&
pi
->
Body
.
MaxPortRxDelay
;
new
ItemPnBase
(
attrnav
,
"MaxPortRxDelay"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"MaxPortRxDelay"
,
"LocalGsdmlAttr"
,
pwr_eType_UInt16
,
sizeof
(
pwr_tUInt16
),
0
,
0
,
pwr_eType_UInt16
,
sizeof
(
pwr_tUInt16
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
pi
->
Body
.
PortDeactivationSupported
;
p
=
(
char
*
)
&
pi
->
Body
.
PortDeactivationSupported
;
new
ItemPnBase
(
attrnav
,
"PortDeactivationSupported"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"PortDeactivationSupported"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
pi
->
Body
.
LinkStateDiagnosisCapability
;
p
=
pi
->
Body
.
LinkStateDiagnosisCapability
;
new
ItemPnBase
(
attrnav
,
"LinkStateDiagnosisCapability"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"LinkStateDiagnosisCapability"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
pwr_eType_String
,
sizeof
(
pwr_tString80
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
pi
->
Body
.
PowerBudgetControlSupported
;
p
=
(
char
*
)
&
pi
->
Body
.
PowerBudgetControlSupported
;
new
ItemPnBase
(
attrnav
,
"PowerBudgetControlSupported"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"PowerBudgetControlSupported"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
pi
->
Body
.
SupportsRingportConfig
;
p
=
(
char
*
)
&
pi
->
Body
.
SupportsRingportConfig
;
new
ItemPnBase
(
attrnav
,
"SupportsRingportConfig"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"SupportsRingportConfig"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
char
*
)
&
pi
->
Body
.
IsDefaultRingport
;
p
=
(
char
*
)
&
pi
->
Body
.
IsDefaultRingport
;
new
ItemPnBase
(
attrnav
,
"IsDefaultRingport"
,
"LocalGsdmlAttr"
,
new
ItemPnBase
(
attrnav
,
"IsDefaultRingport"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
pwr_eType_Boolean
,
sizeof
(
pwr_tBoolean
),
0
,
0
,
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
p
,
1
,
node
,
flow_eDest_IntoLast
);
gsdml_RecordDataList
*
rl
=
pi
->
RecordDataList
;
gsdml_RecordDataList
*
rl
=
pi
->
RecordDataList
;
if
(
rl
)
{
if
(
rl
)
{
...
@@ -2373,53 +2515,6 @@ int ItemPnPortSubmodule::open_children( GsdmlAttrNav *attrnav, double x, double
...
@@ -2373,53 +2515,6 @@ int ItemPnPortSubmodule::open_children( GsdmlAttrNav *attrnav, double x, double
return
1
;
return
1
;
}
}
ItemPnModule
::
ItemPnModule
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsd_sModuleConf
*
item_mconf
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
mconf
(
item_mconf
),
first_scan
(
1
)
{
type
=
attrnav_eItemType_PnModule
;
strcpy
(
name
,
item_name
);
parent
=
1
;
brow_CreateNode
(
attrnav
->
brow
->
ctx
,
item_name
,
attrnav
->
brow
->
nc_object
,
dest
,
dest_code
,
(
void
*
)
this
,
1
,
&
node
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_map
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
brow_SetTraceAttr
(
node
,
name
,
""
,
flow_eTraceType_User
);
}
int
ItemPnModule
::
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_map
);
brow_ResetOpen
(
node
,
attrnav_mOpen_All
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
else
{
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
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
;
}
ItemPnModuleInfo
::
ItemPnModuleInfo
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
ItemPnModuleInfo
::
ItemPnModuleInfo
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_ModuleInfo
*
item_info
,
gsdml_ModuleInfo
*
item_info
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
brow_tNode
dest
,
flow_eDest
dest_code
)
:
...
@@ -2460,21 +2555,21 @@ int ItemPnModuleInfo::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -2460,21 +2555,21 @@ int ItemPnModuleInfo::open_children( GsdmlAttrNav *attrnav, double x, double y)
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
new
ItemPnBase
(
attrnav
,
"Name"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
new
ItemPnBase
(
attrnav
,
"Name"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
info
->
Body
.
Name
.
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
info
->
Body
.
Name
.
p
,
1
,
node
,
flow_eDest_IntoLast
);
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
new
ItemPnBase
(
attrnav
,
"Text"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
info
->
Body
.
InfoText
.
p
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
info
->
Body
.
InfoText
.
p
,
1
,
node
,
flow_eDest_IntoLast
);
if
(
strcmp
(
info
->
Body
.
VendorName
,
""
)
!=
0
)
if
(
strcmp
(
info
->
Body
.
VendorName
,
""
)
!=
0
)
new
ItemPnBase
(
attrnav
,
"VendorName"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
new
ItemPnBase
(
attrnav
,
"VendorName"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
info
->
Body
.
VendorName
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
info
->
Body
.
VendorName
,
1
,
node
,
flow_eDest_IntoLast
);
if
(
strcmp
(
info
->
Body
.
OrderNumber
,
""
)
!=
0
)
if
(
strcmp
(
info
->
Body
.
OrderNumber
,
""
)
!=
0
)
new
ItemPnBase
(
attrnav
,
"OrderNumber"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
new
ItemPnBase
(
attrnav
,
"OrderNumber"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
info
->
Body
.
OrderNumber
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
info
->
Body
.
OrderNumber
,
1
,
node
,
flow_eDest_IntoLast
);
if
(
strcmp
(
info
->
Body
.
HardwareRelease
,
""
)
!=
0
)
if
(
strcmp
(
info
->
Body
.
HardwareRelease
,
""
)
!=
0
)
new
ItemPnBase
(
attrnav
,
"HardwareRelease"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
new
ItemPnBase
(
attrnav
,
"HardwareRelease"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
info
->
Body
.
HardwareRelease
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
info
->
Body
.
HardwareRelease
,
1
,
node
,
flow_eDest_IntoLast
);
if
(
strcmp
(
info
->
Body
.
SoftwareRelease
,
""
)
!=
0
)
if
(
strcmp
(
info
->
Body
.
SoftwareRelease
,
""
)
!=
0
)
new
ItemPnBase
(
attrnav
,
"SoftwareRelease"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
new
ItemPnBase
(
attrnav
,
"SoftwareRelease"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
32
,
0
,
0
,
info
->
Body
.
SoftwareRelease
,
1
,
0
,
node
,
flow_eDest_IntoLast
);
info
->
Body
.
SoftwareRelease
,
1
,
node
,
flow_eDest_IntoLast
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
...
@@ -2486,7 +2581,7 @@ int ItemPnModuleInfo::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -2486,7 +2581,7 @@ int ItemPnModuleInfo::open_children( GsdmlAttrNav *attrnav, double x, double y)
ItemPnModuleType
::
ItemPnModuleType
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
ItemPnModuleType
::
ItemPnModuleType
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
int
item_slot_number
,
int
item_slot_idx
,
int
item_slot_number
,
int
item_slot_idx
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
brow_tNode
dest
,
flow_eDest
dest_code
)
:
slot_number
(
item_slot_number
),
slot_idx
(
item_slot_idx
),
first_scan
(
1
)
slot_number
(
item_slot_number
),
slot_idx
(
item_slot_idx
),
old_value
(
0
),
first_scan
(
1
)
{
{
type
=
attrnav_eItemType_PnModuleType
;
type
=
attrnav_eItemType_PnModuleType
;
...
@@ -2538,10 +2633,22 @@ int ItemPnModuleType::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -2538,10 +2633,22 @@ int ItemPnModuleType::open_children( GsdmlAttrNav *attrnav, double x, double y)
if
(
!
mi
||
!
mi
->
ModuleInfo
->
Body
.
Name
.
p
)
if
(
!
mi
||
!
mi
->
ModuleInfo
->
Body
.
Name
.
p
)
continue
;
continue
;
strncpy
(
mname
,
(
char
*
)
mi
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
mname
));
strncpy
(
mname
,
(
char
*
)
mi
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
mname
));
new
ItemPnEnumValue
(
attrnav
,
mname
,
idx
++
,
pwr_eType_UInt32
,
new
ItemPnEnumValue
(
attrnav
,
mname
,
idx
,
pwr_eType_UInt32
,
&
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
module_enum_number
,
node
,
flow_eDest_IntoLast
);
}
else
if
(
um
->
ModuleItemRef
[
i
]
->
Body
.
FixedInSlots
.
list
&&
um
->
ModuleItemRef
[
i
]
->
Body
.
FixedInSlots
.
list
->
in_list
(
slot_number
))
{
char
mname
[
160
]
=
"ModuleName"
;
gsdml_ModuleItem
*
mi
=
(
gsdml_ModuleItem
*
)
um
->
ModuleItemRef
[
i
]
->
Body
.
ModuleItemTarget
.
p
;
if
(
!
mi
||
!
mi
->
ModuleInfo
->
Body
.
Name
.
p
)
continue
;
strncpy
(
mname
,
(
char
*
)
mi
->
ModuleInfo
->
Body
.
Name
.
p
,
sizeof
(
mname
));
new
ItemPnEnumValue
(
attrnav
,
mname
,
idx
,
pwr_eType_UInt32
,
&
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
module_enum_number
,
&
attrnav
->
dev_data
.
slot_data
[
slot_idx
]
->
module_enum_number
,
node
,
flow_eDest_IntoLast
);
node
,
flow_eDest_IntoLast
);
}
}
idx
++
;
}
}
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetOpen
(
node
,
attrnav_mOpen_Children
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_openmap
);
...
@@ -2585,14 +2692,21 @@ int ItemPnModuleType::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -2585,14 +2692,21 @@ int ItemPnModuleType::scan( GsdmlAttrNav *attrnav, void *p)
ItemPnSlot
*
parentitem
;
ItemPnSlot
*
parentitem
;
brow_GetUserData
(
parentnode
,
(
void
**
)
&
parentitem
);
brow_GetUserData
(
parentnode
,
(
void
**
)
&
parentitem
);
// Note, this object is deleted here !
parentitem
->
close
(
attrnav
,
0
,
0
);
parentitem
->
close
(
attrnav
,
0
,
0
);
// Remove old subslot data
if
(
parentitem
->
slotdata
)
parentitem
->
slotdata
->
slot_reset
();
parentitem
->
open_children
(
attrnav
,
0
,
0
);
parentitem
->
open_children
(
attrnav
,
0
,
0
);
brow_SelectClear
(
attrnav
->
brow
->
ctx
);
brow_SelectClear
(
attrnav
->
brow
->
ctx
);
brow_SetInverse
(
parentnode
,
1
);
brow_SetInverse
(
parentnode
,
1
);
brow_SelectInsert
(
attrnav
->
brow
->
ctx
,
parentnode
);
brow_SelectInsert
(
attrnav
->
brow
->
ctx
,
parentnode
);
}
}
if
(
first_scan
)
else
first_scan
=
0
;
first_scan
=
0
;
return
1
;
return
1
;
...
@@ -2621,11 +2735,16 @@ ItemPnParRecord::ItemPnParRecord( GsdmlAttrNav *attrnav, const char *item_name,
...
@@ -2621,11 +2735,16 @@ ItemPnParRecord::ItemPnParRecord( GsdmlAttrNav *attrnav, const char *item_name,
brow_SetAnnotation
(
node
,
0
,
name
,
strlen
(
name
));
brow_SetAnnotation
(
node
,
0
,
name
,
strlen
(
name
));
if
(
!
datarecord
->
data
)
{
if
(
!
datarecord
->
data
)
{
datarecord
->
data
=
(
unsigned
char
*
)
calloc
(
1
,
par_record
->
Body
.
Length
);
datarecord
->
data
=
(
unsigned
char
*
)
calloc
(
1
,
par_record
->
Body
.
Length
);
datarecord
->
data_length
=
par_record
->
Body
.
Length
;
datarecord
->
data_length
=
par_record
->
Body
.
Length
;
datarecord
->
index
=
par_record
->
Body
.
Index
;
datarecord
->
index
=
par_record
->
Body
.
Index
;
datarecord
->
transfer_sequence
=
par_record
->
Body
.
TransferSequence
;
datarecord
->
transfer_sequence
=
par_record
->
Body
.
TransferSequence
;
attrnav
->
gsdml
->
set_par_record_default
(
datarecord
->
data
,
par_record
->
Body
.
Length
,
par_record
);
for
(
unsigned
int
i
=
0
;
i
<
par_record
->
Const
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
par_record
->
Const
.
size
();
i
++
)
{
void
*
const_data
;
void
*
const_data
;
int
len
;
int
len
;
...
@@ -2666,8 +2785,8 @@ int ItemPnParRecord::open_children( GsdmlAttrNav *attrnav, double x, double y)
...
@@ -2666,8 +2785,8 @@ int ItemPnParRecord::open_children( GsdmlAttrNav *attrnav, double x, double y)
for
(
unsigned
int
i
=
0
;
i
<
par_record
->
Ref
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
par_record
->
Ref
.
size
();
i
++
)
{
gsdml_eValueDataType
datatype
;
gsdml_eValueDataType
datatype
;
//
if ( !par_record->Ref[i]->Body.Visible)
if
(
!
par_record
->
Ref
[
i
]
->
Body
.
Visible
)
//
continue;
continue
;
attrnav
->
gsdml
->
string_to_value_datatype
(
par_record
->
Ref
[
i
]
->
Body
.
DataType
,
&
datatype
);
attrnav
->
gsdml
->
string_to_value_datatype
(
par_record
->
Ref
[
i
]
->
Body
.
DataType
,
&
datatype
);
switch
(
datatype
)
{
switch
(
datatype
)
{
...
@@ -2945,10 +3064,10 @@ void ItemPnParValue::value_changed( GsdmlAttrNav *attrnav, char *value_str)
...
@@ -2945,10 +3064,10 @@ void ItemPnParValue::value_changed( GsdmlAttrNav *attrnav, char *value_str)
default:
;
default:
;
}
}
// endian_swap() TODO
memcpy
(
&
data
[
byte_offset
],
buf
,
size
);
memcpy
(
&
data
[
byte_offset
],
buf
,
size
);
free
(
buf
);
free
(
buf
);
attrnav
->
set_modified
(
1
);
}
}
ItemPnParEnum
::
ItemPnParEnum
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
ItemPnParEnum
::
ItemPnParEnum
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
...
@@ -3213,19 +3332,30 @@ int ItemPnModuleClass::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -3213,19 +3332,30 @@ int ItemPnModuleClass::scan( GsdmlAttrNav *attrnav, void *p)
return
1
;
return
1
;
}
}
ItemPnEnumByteOrder
::
ItemPnEnumByteOrder
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
ItemPnIOData
::
ItemPnIOData
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
const
char
*
attr
,
int
attr_type
,
int
attr_size
,
gsdml_IOData
*
item_iodata
,
void
*
attr_value_p
,
int
attr_noedit
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemPnBase
(
attrnav
,
item_name
,
attr
,
attr_type
,
attr_size
,
0
,
iodata
(
item_iodata
)
0
,
attr_value_p
,
attr_noedit
,
0
,
dest
,
dest_code
)
{
{
type
=
attrnav_eItemType_PnEnumByteOrder
;
type
=
attrnav_eItemType_PnIOData
;
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
strcpy
(
name
,
item_name
);
if
(
iodata
->
Input
||
iodata
->
Output
)
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
ItemPn
EnumByteOrder
::
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
)
int
ItemPn
IOData
::
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
)
{
{
double
node_x
,
node_y
;
double
node_x
,
node_y
;
...
@@ -3235,15 +3365,330 @@ int ItemPnEnumByteOrder::open_children( GsdmlAttrNav *attrnav, double x, double
...
@@ -3235,15 +3365,330 @@ int ItemPnEnumByteOrder::open_children( GsdmlAttrNav *attrnav, double x, double
// Close
// Close
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
brow_CloseNode
(
attrnav
->
brow
->
ctx
,
node
);
brow_CloseNode
(
attrnav
->
brow
->
ctx
,
node
);
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Attributes
)
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Children
)
{
brow_RemoveAnnotPixmap
(
node
,
1
);
if
(
parent
)
if
(
brow_IsOpen
(
node
)
&
attrnav_mOpen_Children
)
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_map
);
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
else
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_leaf
);
}
brow_ResetOpen
(
node
,
attrnav_mOpen_All
);
brow_ResetOpen
(
node
,
attrnav_mOpen_All
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_ResetNodraw
(
attrnav
->
brow
->
ctx
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
brow_Redraw
(
attrnav
->
brow
->
ctx
,
node_y
);
}
}
else
if
(
!
noedit
)
{
else
{
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
#if 0
// These are always 1 in this release
void *p = (void *) &iodata->Body.IOPS_Length;
new ItemPnBase( attrnav, "IOPS_Length", "LocalGsdmlAttr",
pwr_eType_UInt8, sizeof(iodata->Body.IOPS_Length), 0, 0,
p, 1, node, flow_eDest_IntoLast);
p = (void *) &iodata->Body.IOCS_Length;
new ItemPnBase( attrnav, "IOCS_Length", "LocalGsdmlAttr",
pwr_eType_UInt8, sizeof(iodata->Body.IOCS_Length), 0, 0,
p, 1, node, flow_eDest_IntoLast);
#endif
if
(
iodata
->
Input
)
{
new
ItemPnInput
(
attrnav
,
"Input"
,
iodata
->
Input
,
node
,
flow_eDest_IntoLast
);
}
if
(
iodata
->
Output
)
{
new
ItemPnOutput
(
attrnav
,
"Output"
,
iodata
->
Output
,
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
;
}
ItemPnInput
::
ItemPnInput
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_Input
*
item_input
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
input
(
item_input
)
{
type
=
attrnav_eItemType_PnInput
;
strcpy
(
name
,
item_name
);
if
(
input
->
DataItem
.
size
())
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
ItemPnInput
::
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
);
for
(
unsigned
int
i
=
0
;
i
<
input
->
DataItem
.
size
();
i
++
)
{
new
ItemPnDataItem
(
attrnav
,
(
char
*
)
input
->
DataItem
[
i
]
->
Body
.
TextId
.
p
,
input
->
DataItem
[
i
],
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
;
}
ItemPnOutput
::
ItemPnOutput
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_Output
*
item_output
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
output
(
item_output
)
{
type
=
attrnav_eItemType_PnOutput
;
strcpy
(
name
,
item_name
);
if
(
output
->
DataItem
.
size
())
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
ItemPnOutput
::
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
);
for
(
unsigned
int
i
=
0
;
i
<
output
->
DataItem
.
size
();
i
++
)
{
new
ItemPnDataItem
(
attrnav
,
(
char
*
)
output
->
DataItem
[
i
]
->
Body
.
TextId
.
p
,
output
->
DataItem
[
i
],
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
;
}
ItemPnDataItem
::
ItemPnDataItem
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_DataItem
*
item_dataitem
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
dataitem
(
item_dataitem
)
{
type
=
attrnav_eItemType_PnDataItem
;
strcpy
(
name
,
item_name
);
if
(
dataitem
->
BitDataItem
.
size
())
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
));
brow_SetAnnotation
(
node
,
1
,
dataitem
->
Body
.
DataType
,
strlen
(
dataitem
->
Body
.
DataType
));
}
int
ItemPnDataItem
::
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
);
void
*
p
;
if
(
strcmp
(
dataitem
->
Body
.
DataType
,
"OctetString"
)
==
0
||
strcmp
(
dataitem
->
Body
.
DataType
,
"VisibleString"
)
==
0
)
{
p
=
(
void
*
)
&
dataitem
->
Body
.
Length
;
new
ItemPnBase
(
attrnav
,
"Length"
,
"LocalGsdmlAttr"
,
pwr_eType_UInt16
,
sizeof
(
dataitem
->
Body
.
Length
),
0
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
}
p
=
(
void
*
)
dataitem
->
Body
.
DataType
;
new
ItemPnBase
(
attrnav
,
"Type"
,
"LocalGsdmlAttr"
,
pwr_eType_String
,
sizeof
(
dataitem
->
Body
.
DataType
),
0
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
p
=
(
void
*
)
&
dataitem
->
Body
.
UseAsBits
;
new
ItemPnBase
(
attrnav
,
"UseAsBits"
,
"LocalGsdmlAttr"
,
pwr_eType_Boolean
,
sizeof
(
dataitem
->
Body
.
UseAsBits
),
0
,
0
,
p
,
1
,
node
,
flow_eDest_IntoLast
);
for
(
unsigned
int
i
=
0
;
i
<
dataitem
->
BitDataItem
.
size
();
i
++
)
{
new
ItemPnBitDataItem
(
attrnav
,
(
char
*
)
dataitem
->
BitDataItem
[
i
]
->
Body
.
TextId
.
p
,
dataitem
->
BitDataItem
[
i
],
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
;
}
ItemPnBitDataItem
::
ItemPnBitDataItem
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_BitDataItem
*
item_bitdataitem
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
bitdataitem
(
item_bitdataitem
)
{
type
=
attrnav_eItemType_PnBitDataItem
;
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_leaf
);
brow_SetAnnotation
(
node
,
0
,
item_name
,
strlen
(
item_name
));
}
int
ItemPnBitDataItem
::
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
);
void
*
p
=
(
void
*
)
&
bitdataitem
->
Body
.
BitOffset
;
new
ItemPnBase
(
attrnav
,
"BitOffset"
,
"LocalGsdmlAttr"
,
pwr_eType_UInt8
,
sizeof
(
bitdataitem
->
Body
.
BitOffset
),
0
,
0
,
p
,
1
,
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
;
}
ItemPnEnumByteOrder
::
ItemPnEnumByteOrder
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
const
char
*
attr
,
int
attr_type
,
int
attr_size
,
void
*
attr_value_p
,
int
attr_noedit
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
ItemPnBase
(
attrnav
,
item_name
,
attr
,
attr_type
,
attr_size
,
0
,
0
,
attr_value_p
,
attr_noedit
,
dest
,
dest_code
)
{
type
=
attrnav_eItemType_PnEnumByteOrder
;
brow_SetAnnotPixmap
(
node
,
0
,
attrnav
->
brow
->
pixmap_attrenum
);
}
int
ItemPnEnumByteOrder
::
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
if
(
!
noedit
)
{
int
found
;
int
found
;
found
=
0
;
found
=
0
;
...
@@ -3282,3 +3727,102 @@ int ItemPnEnumByteOrder::scan( GsdmlAttrNav *attrnav, void *p)
...
@@ -3282,3 +3727,102 @@ int ItemPnEnumByteOrder::scan( GsdmlAttrNav *attrnav, void *p)
return
1
;
return
1
;
}
}
ItemPnEnumTimeRatio
::
ItemPnEnumTimeRatio
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_InterfaceSubmoduleItem
*
item_interfacesubmodule
,
void
*
attr_value_p
,
brow_tNode
dest
,
flow_eDest
dest_code
)
:
interfacesubmodule
(
item_interfacesubmodule
),
value_p
(
attr_value_p
),
first_scan
(
1
),
old_value
(
0
)
{
type
=
attrnav_eItemType_PnEnumTimeRatio
;
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
ItemPnEnumTimeRatio
::
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
{
int
found
;
found
=
0
;
if
(
strcmp
(
interfacesubmodule
->
ApplicationRelations
->
TimingProperties
->
Body
.
ReductionRatio
.
str
,
""
)
==
0
)
return
1
;
brow_SetNodraw
(
attrnav
->
brow
->
ctx
);
gsdml_Valuelist
*
vl
=
new
gsdml_Valuelist
(
interfacesubmodule
->
ApplicationRelations
->
TimingProperties
->
Body
.
ReductionRatio
.
str
);
gsdml_ValuelistIterator
iter
(
vl
);
for
(
unsigned
int
j
=
iter
.
begin
();
j
!=
iter
.
end
();
j
=
iter
.
next
())
{
char
enumtext
[
20
];
sprintf
(
enumtext
,
"%d"
,
j
);
new
ItemPnEnumValue
(
attrnav
,
enumtext
,
j
,
pwr_eType_UInt32
,
this
->
value_p
,
node
,
flow_eDest_IntoLast
);
}
delete
vl
;
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
ItemPnEnumTimeRatio
::
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
)
{
char
buf
[
80
];
if
(
!
first_scan
)
{
if
(
old_value
==
*
(
int
*
)
p
)
// No change since last time
return
1
;
}
else
{
if
(
*
(
int
*
)
p
==
0
)
{
// Set initial value
if
(
strcmp
(
interfacesubmodule
->
ApplicationRelations
->
TimingProperties
->
Body
.
ReductionRatio
.
str
,
""
)
!=
0
)
{
gsdml_Valuelist
*
vl
=
new
gsdml_Valuelist
(
interfacesubmodule
->
ApplicationRelations
->
TimingProperties
->
Body
.
ReductionRatio
.
str
);
gsdml_ValuelistIterator
iter
(
vl
);
*
(
int
*
)
p
=
iter
.
begin
();
delete
vl
;
}
}
first_scan
=
0
;
}
sprintf
(
buf
,
"%d"
,
*
(
int
*
)
p
);
brow_SetAnnotation
(
node
,
1
,
buf
,
strlen
(
buf
));
old_value
=
*
(
int
*
)
p
;
return
1
;
}
profibus/lib/rt/src/rt_pn_gsdml_attrnav.h
View file @
01cc1f42
...
@@ -69,7 +69,6 @@ typedef enum {
...
@@ -69,7 +69,6 @@ typedef enum {
attrnav_eItemType_PnPortSubmodule
,
attrnav_eItemType_PnPortSubmodule
,
attrnav_eItemType_PnSlot
,
attrnav_eItemType_PnSlot
,
attrnav_eItemType_PnSubslot
,
attrnav_eItemType_PnSubslot
,
attrnav_eItemType_PnModule
,
attrnav_eItemType_PnModuleInfo
,
attrnav_eItemType_PnModuleInfo
,
attrnav_eItemType_PnModuleType
,
attrnav_eItemType_PnModuleType
,
attrnav_eItemType_PnParRecord
,
attrnav_eItemType_PnParRecord
,
...
@@ -77,7 +76,13 @@ typedef enum {
...
@@ -77,7 +76,13 @@ typedef enum {
attrnav_eItemType_PnParEnum
,
attrnav_eItemType_PnParEnum
,
attrnav_eItemType_PnParEnumBit
,
attrnav_eItemType_PnParEnumBit
,
attrnav_eItemType_PnModuleClass
,
attrnav_eItemType_PnModuleClass
,
attrnav_eItemType_PnEnumByteOrder
attrnav_eItemType_PnIOData
,
attrnav_eItemType_PnInput
,
attrnav_eItemType_PnOutput
,
attrnav_eItemType_PnDataItem
,
attrnav_eItemType_PnBitDataItem
,
attrnav_eItemType_PnEnumByteOrder
,
attrnav_eItemType_PnEnumTimeRatio
}
attrnav_eItemType
;
}
attrnav_eItemType
;
typedef
enum
{
typedef
enum
{
...
@@ -140,6 +145,8 @@ class GsdmlAttrNav {
...
@@ -140,6 +145,8 @@ class GsdmlAttrNav {
int
modified
;
int
modified
;
GsdmlDeviceData
dev_data
;
GsdmlDeviceData
dev_data
;
int
device_read
;
int
device_read
;
int
viewio
;
unsigned
int
time_ratio
;
GsdmlAttrNav
(
GsdmlAttrNav
(
void
*
xn_parent_ctx
,
void
*
xn_parent_ctx
,
...
@@ -164,9 +171,11 @@ class GsdmlAttrNav {
...
@@ -164,9 +171,11 @@ class GsdmlAttrNav {
void
unzoom
();
void
unzoom
();
void
get_zoom
(
double
*
zoom_factor
);
void
get_zoom
(
double
*
zoom_factor
);
void
set_modified
(
int
value
)
{
modified
=
value
;}
void
set_modified
(
int
value
)
{
modified
=
value
;}
int
is_modified
()
{
return
modified
;}
int
save
(
const
char
*
filename
);
int
save
(
const
char
*
filename
);
int
open
(
const
char
*
filename
);
int
open
(
const
char
*
filename
);
void
redraw
();
void
redraw
();
void
set_viewio
(
int
set
)
{
viewio
=
set
;}
static
void
trace_scan
(
void
*
data
);
static
void
trace_scan
(
void
*
data
);
static
int
trace_scan_bc
(
brow_tObject
object
,
void
*
p
);
static
int
trace_scan_bc
(
brow_tObject
object
,
void
*
p
);
...
@@ -200,16 +209,12 @@ class ItemPn {
...
@@ -200,16 +209,12 @@ class ItemPn {
virtual
void
value_changed
(
GsdmlAttrNav
*
attrnav
,
char
*
value_str
)
{}
virtual
void
value_changed
(
GsdmlAttrNav
*
attrnav
,
char
*
value_str
)
{}
};
};
typedef
void
gsd_sPrmText
;
typedef
void
gsd_sModuleConf
;
//! Item for a normal attribute.
//! Item for a normal attribute.
class
ItemPnBase
:
public
ItemPn
{
class
ItemPnBase
:
public
ItemPn
{
public:
public:
ItemPnBase
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
const
char
*
attr
,
ItemPnBase
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
const
char
*
attr
,
int
attr_type
,
int
attr_size
,
double
attr_min_limit
,
int
attr_type
,
int
attr_size
,
double
attr_min_limit
,
double
attr_max_limit
,
void
*
attr_value_p
,
double
attr_max_limit
,
void
*
attr_value_p
,
int
attr_noedit
,
int
attr_noedit
,
gsd_sPrmText
*
attr_enumtext
,
brow_tNode
dest
,
flow_eDest
dest_code
);
brow_tNode
dest
,
flow_eDest
dest_code
);
void
*
value_p
;
void
*
value_p
;
char
old_value
[
80
];
char
old_value
[
80
];
...
@@ -219,10 +224,10 @@ class ItemPnBase : public ItemPn {
...
@@ -219,10 +224,10 @@ class ItemPnBase : public ItemPn {
double
min_limit
;
double
min_limit
;
double
max_limit
;
double
max_limit
;
int
noedit
;
int
noedit
;
gsd_sPrmText
*
enumtext
;
int
subgraph
;
int
subgraph
;
virtual
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
virtual
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
virtual
void
value_changed
(
GsdmlAttrNav
*
attrnav
,
char
*
value_str
);
};
};
//! Item for an enum attribute.
//! Item for an enum attribute.
...
@@ -283,21 +288,6 @@ class ItemPnSubslot : public ItemPn {
...
@@ -283,21 +288,6 @@ class ItemPnSubslot : public ItemPn {
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
};
//! Item for a module.
class
ItemPnModule
:
public
ItemPn
{
public:
ItemPnModule
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsd_sModuleConf
*
item_mconf
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnModule
()
{}
gsd_sModuleConf
*
mconf
;
char
old_value
[
80
];
char
old_type
[
80
];
int
first_scan
;
virtual
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for the DeviceAccessPoint, slot 0
//! Item for the DeviceAccessPoint, slot 0
class
ItemPnDAP
:
public
ItemPn
{
class
ItemPnDAP
:
public
ItemPn
{
public:
public:
...
@@ -475,6 +465,66 @@ class ItemPnParEnumBit : public ItemPn {
...
@@ -475,6 +465,66 @@ class ItemPnParEnumBit : public ItemPn {
void
update
(
GsdmlAttrNav
*
attrnav
);
void
update
(
GsdmlAttrNav
*
attrnav
);
};
};
//! Item for a IOData.
class
ItemPnIOData
:
public
ItemPn
{
public:
ItemPnIOData
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_IOData
*
item_iodata
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnIOData
()
{}
gsdml_IOData
*
iodata
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for a Input.
class
ItemPnInput
:
public
ItemPn
{
public:
ItemPnInput
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_Input
*
item_input
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnInput
()
{}
gsdml_Input
*
input
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for a Output.
class
ItemPnOutput
:
public
ItemPn
{
public:
ItemPnOutput
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_Output
*
item_output
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnOutput
()
{}
gsdml_Output
*
output
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for a DataItem.
class
ItemPnDataItem
:
public
ItemPn
{
public:
ItemPnDataItem
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_DataItem
*
item_dataitem
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnDataItem
()
{}
gsdml_DataItem
*
dataitem
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for a BitDataItem.
class
ItemPnBitDataItem
:
public
ItemPn
{
public:
ItemPnBitDataItem
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_BitDataItem
*
item_bitdataitem
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnBitDataItem
()
{}
gsdml_BitDataItem
*
bitdataitem
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
};
//! Item for module class selection.
//! Item for module class selection.
class
ItemPnModuleClass
:
public
ItemPn
{
class
ItemPnModuleClass
:
public
ItemPn
{
public:
public:
...
@@ -504,6 +554,23 @@ class ItemPnEnumByteOrder : public ItemPnBase {
...
@@ -504,6 +554,23 @@ class ItemPnEnumByteOrder : public ItemPnBase {
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
};
};
//! Item for time ratio.
class
ItemPnEnumTimeRatio
:
public
ItemPn
{
public:
ItemPnEnumTimeRatio
(
GsdmlAttrNav
*
attrnav
,
const
char
*
item_name
,
gsdml_InterfaceSubmoduleItem
*
item_interfacesubmodule
,
void
*
attr_value_p
,
brow_tNode
dest
,
flow_eDest
dest_code
);
virtual
~
ItemPnEnumTimeRatio
()
{}
gsdml_InterfaceSubmoduleItem
*
interfacesubmodule
;
void
*
value_p
;
int
first_scan
;
int
old_value
;
int
open_children
(
GsdmlAttrNav
*
attrnav
,
double
x
,
double
y
);
int
scan
(
GsdmlAttrNav
*
attrnav
,
void
*
p
);
};
/*@}*/
/*@}*/
#if defined __cplusplus
#if defined __cplusplus
}
}
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.cpp
View file @
01cc1f42
...
@@ -40,11 +40,22 @@ typedef enum {
...
@@ -40,11 +40,22 @@ typedef enum {
gsdmldata_eTag_Subslot
,
gsdmldata_eTag_Subslot
,
gsdmldata_eTag_DataRecord
,
gsdmldata_eTag_DataRecord
,
gsdmldata_eTag_IOCR
,
gsdmldata_eTag_IOCR
,
gsdmldata_eTag_ChannelDiag
,
gsdmldata_eTag__
gsdmldata_eTag__
}
gsdmldata_eTag
;
}
gsdmldata_eTag
;
GsdmlSlotData
*
GsdmlDeviceData
::
paste_slotdata
=
0
;
GsdmlSlotData
*
GsdmlDeviceData
::
paste_slotdata
=
0
;
int
GsdmlChannelDiag
::
print
(
ofstream
&
fp
)
{
fp
<<
" <ChannelDiag ErrorType=
\"
"
<<
error_type
<<
"
\"
"
<<
endl
<<
" Name=
\"
"
<<
name
<<
"
\"
"
<<
endl
<<
" Help=
\"
"
<<
help
<<
"
\"
/>"
<<
endl
;
return
1
;
}
int
GsdmlDataRecord
::
print
(
ofstream
&
fp
)
int
GsdmlDataRecord
::
print
(
ofstream
&
fp
)
{
{
char
str
[
1024
];
char
str
[
1024
];
...
@@ -107,13 +118,21 @@ int GsdmlDeviceData::print( const char *filename)
...
@@ -107,13 +118,21 @@ int GsdmlDeviceData::print( const char *filename)
{
{
pwr_tFileName
fname
;
pwr_tFileName
fname
;
ofstream
fp
;
ofstream
fp
;
char
*
gsdmlfile_p
;
// Print name of gsdmlfile, not path
if
(
(
gsdmlfile_p
=
strrchr
(
gsdmlfile
,
'/'
)))
gsdmlfile_p
++
;
else
gsdmlfile_p
=
gsdmlfile
;
dcli_translate_filename
(
fname
,
filename
);
dcli_translate_filename
(
fname
,
filename
);
fp
.
open
(
fname
);
fp
.
open
(
fname
);
fp
<<
fp
<<
"<PnDevice DeviceNumber=
\"
"
<<
device_num
<<
"
\"
"
<<
endl
<<
"<PnDevice GsdmlFile=
\"
"
<<
gsdmlfile_p
<<
"
\"
"
<<
endl
<<
" DeviceNumber=
\"
"
<<
device_num
<<
"
\"
"
<<
endl
<<
" DeviceText=
\"
"
<<
device_text
<<
"
\"
"
<<
endl
<<
" DeviceText=
\"
"
<<
device_text
<<
"
\"
"
<<
endl
<<
" VendorId=
\"
"
<<
vendor_id
<<
"
\"
"
<<
endl
<<
" VendorId=
\"
"
<<
vendor_id
<<
"
\"
"
<<
endl
<<
" DeviceId=
\"
"
<<
device_id
<<
"
\"
"
<<
endl
<<
" DeviceId=
\"
"
<<
device_id
<<
"
\"
"
<<
endl
<<
...
@@ -131,6 +150,9 @@ int GsdmlDeviceData::print( const char *filename)
...
@@ -131,6 +150,9 @@ int GsdmlDeviceData::print( const char *filename)
for
(
unsigned
int
i
=
0
;
i
<
iocr_data
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
iocr_data
.
size
();
i
++
)
{
iocr_data
[
i
]
->
print
(
fp
);
iocr_data
[
i
]
->
print
(
fp
);
}
}
for
(
unsigned
int
i
=
0
;
i
<
channel_diag
.
size
();
i
++
)
{
channel_diag
[
i
]
->
print
(
fp
);
}
fp
<<
fp
<<
"</PnDevice>"
<<
endl
;
"</PnDevice>"
<<
endl
;
...
@@ -240,6 +262,8 @@ int GsdmlDataReader::tag_name_to_id( const char *name, unsigned int *id)
...
@@ -240,6 +262,8 @@ int GsdmlDataReader::tag_name_to_id( const char *name, unsigned int *id)
*
id
=
gsdmldata_eTag_DataRecord
;
*
id
=
gsdmldata_eTag_DataRecord
;
else
if
(
strcmp
(
name
,
"IOCR"
)
==
0
)
else
if
(
strcmp
(
name
,
"IOCR"
)
==
0
)
*
id
=
gsdmldata_eTag_IOCR
;
*
id
=
gsdmldata_eTag_IOCR
;
else
if
(
strcmp
(
name
,
"ChannelDiag"
)
==
0
)
*
id
=
gsdmldata_eTag_ChannelDiag
;
else
else
return
0
;
return
0
;
...
@@ -248,8 +272,6 @@ int GsdmlDataReader::tag_name_to_id( const char *name, unsigned int *id)
...
@@ -248,8 +272,6 @@ int GsdmlDataReader::tag_name_to_id( const char *name, unsigned int *id)
int
GsdmlDataReader
::
tag
(
const
char
*
name
)
int
GsdmlDataReader
::
tag
(
const
char
*
name
)
{
{
printf
(
"Tag: %s
\n
"
,
name
);
if
(
tag_name_to_id
(
name
,
&
current_tag
))
if
(
tag_name_to_id
(
name
,
&
current_tag
))
tag_stack_push
(
current_tag
);
tag_stack_push
(
current_tag
);
else
{
else
{
...
@@ -298,6 +320,13 @@ int GsdmlDataReader::tag( const char *name)
...
@@ -298,6 +320,13 @@ int GsdmlDataReader::tag( const char *name)
object_stack_push
(
iod
,
current_tag
);
object_stack_push
(
iod
,
current_tag
);
break
;
break
;
}
}
case
gsdmldata_eTag_ChannelDiag
:
{
GsdmlChannelDiag
*
cd
=
new
GsdmlChannelDiag
();
data
->
channel_diag
.
push_back
(
cd
);
object_stack_push
(
cd
,
current_tag
);
break
;
}
default:
;
default:
;
}
}
...
@@ -311,7 +340,6 @@ int GsdmlDataReader::tag_end( const char *name)
...
@@ -311,7 +340,6 @@ int GsdmlDataReader::tag_end( const char *name)
{
{
unsigned
int
id
;
unsigned
int
id
;
printf
(
"TagEnd: %s
\n
"
,
name
);
if
(
tag_name_to_id
(
name
,
&
id
))
if
(
tag_name_to_id
(
name
,
&
id
))
tag_stack_pull
(
id
);
tag_stack_pull
(
id
);
else
{
else
{
...
@@ -342,16 +370,27 @@ int GsdmlDataReader::metatag_end( const char *name)
...
@@ -342,16 +370,27 @@ int GsdmlDataReader::metatag_end( const char *name)
}
}
int
GsdmlDataReader
::
tag_value
(
const
char
*
name
)
int
GsdmlDataReader
::
tag_value
(
const
char
*
name
)
{
{
printf
(
"TagValue: %s
\n
"
,
name
);
return
1
;
return
1
;
}
}
int
GsdmlDataReader
::
tag_attribute
(
const
char
*
name
,
const
char
*
value
)
int
GsdmlDataReader
::
tag_attribute
(
const
char
*
name
,
const
char
*
value
)
{
{
printf
(
"Attr: %s=%s
\n
"
,
name
,
value
);
switch
(
current_tag
)
{
switch
(
current_tag
)
{
case
gsdmldata_eTag_PnDevice
:
case
gsdmldata_eTag_PnDevice
:
if
(
strcmp
(
name
,
"DeviceText"
)
==
0
)
if
(
strcmp
(
name
,
"GsdmlFile"
)
==
0
)
{
// Check that the GSDML file is not changed
char
*
gsdmlfile_p
;
// Print name of gsdmlfile, not path
if
(
(
gsdmlfile_p
=
strrchr
(
data
->
gsdmlfile
,
'/'
)))
gsdmlfile_p
++
;
else
gsdmlfile_p
=
data
->
gsdmlfile
;
if
(
strcmp
(
value
,
gsdmlfile_p
)
!=
0
)
return
PB__GSDMLFILEMISMATCH
;
}
else
if
(
strcmp
(
name
,
"DeviceText"
)
==
0
)
strncpy
(
data
->
device_text
,
value
,
sizeof
(
data
->
device_text
));
strncpy
(
data
->
device_text
,
value
,
sizeof
(
data
->
device_text
));
else
if
(
strcmp
(
name
,
"DeviceNumber"
)
==
0
)
else
if
(
strcmp
(
name
,
"DeviceNumber"
)
==
0
)
sscanf
(
value
,
"%d"
,
&
data
->
device_num
);
sscanf
(
value
,
"%d"
,
&
data
->
device_num
);
...
@@ -424,6 +463,17 @@ int GsdmlDataReader::tag_attribute( const char *name, const char *value)
...
@@ -424,6 +463,17 @@ int GsdmlDataReader::tag_attribute( const char *name, const char *value)
sscanf
(
value
,
"%u"
,
&
iod
->
api
);
sscanf
(
value
,
"%u"
,
&
iod
->
api
);
break
;
break
;
}
}
case
gsdmldata_eTag_ChannelDiag
:
{
GsdmlChannelDiag
*
cd
=
(
GsdmlChannelDiag
*
)
get_object_stack
(
current_tag
);
if
(
strcmp
(
name
,
"ErrorType"
)
==
0
)
sscanf
(
value
,
"%hu"
,
&
cd
->
error_type
);
else
if
(
strcmp
(
name
,
"Name"
)
==
0
)
strncpy
(
cd
->
name
,
value
,
sizeof
(
cd
->
name
));
else
if
(
strcmp
(
name
,
"Help"
)
==
0
)
strncpy
(
cd
->
help
,
value
,
sizeof
(
cd
->
help
));
break
;
}
default:
;
default:
;
}
}
return
1
;
return
1
;
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.h
View file @
01cc1f42
...
@@ -100,6 +100,11 @@ class GsdmlSlotData {
...
@@ -100,6 +100,11 @@ class GsdmlSlotData {
for
(
unsigned
int
i
=
0
;
i
<
subslot_data
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
subslot_data
.
size
();
i
++
)
delete
subslot_data
[
i
];
delete
subslot_data
[
i
];
}
}
void
slot_reset
()
{
for
(
unsigned
int
i
=
0
;
i
<
subslot_data
.
size
();
i
++
)
delete
subslot_data
[
i
];
subslot_data
.
clear
();
}
GsdmlSlotData
(
const
GsdmlSlotData
&
x
)
:
module_enum_number
(
x
.
module_enum_number
),
GsdmlSlotData
(
const
GsdmlSlotData
&
x
)
:
module_enum_number
(
x
.
module_enum_number
),
module_class
(
x
.
module_class
),
module_oid
(
pwr_cNObjid
),
slot_number
(
x
.
slot_number
),
module_class
(
x
.
module_class
),
module_oid
(
pwr_cNObjid
),
slot_number
(
x
.
slot_number
),
slot_idx
(
x
.
slot_idx
)
{
slot_idx
(
x
.
slot_idx
)
{
...
@@ -110,10 +115,23 @@ class GsdmlSlotData {
...
@@ -110,10 +115,23 @@ class GsdmlSlotData {
int
print
(
ofstream
&
fp
);
int
print
(
ofstream
&
fp
);
};
};
class
GsdmlChannelDiag
{
public:
GsdmlChannelDiag
()
:
error_type
(
0
)
{
strcpy
(
name
,
""
);
strcpy
(
help
,
""
);
}
unsigned
short
error_type
;
char
name
[
200
];
char
help
[
256
];
int
print
(
ofstream
&
fp
);
};
class
GsdmlDeviceData
{
class
GsdmlDeviceData
{
public:
public:
GsdmlDeviceData
()
{
device_name
[
0
]
=
0
;
ip_address
[
0
]
=
0
;
subnet_mask
[
0
]
=
0
;
mac_address
[
0
]
=
0
;
GsdmlDeviceData
()
device_text
[
0
]
=
0
;
version
[
0
]
=
0
;}
{
device_name
[
0
]
=
0
;
ip_address
[
0
]
=
0
;
subnet_mask
[
0
]
=
0
;
mac_address
[
0
]
=
0
;
device_text
[
0
]
=
0
;
version
[
0
]
=
0
;
gsdmlfile
[
0
]
=
0
;}
char
device_name
[
80
];
char
device_name
[
80
];
char
ip_address
[
20
];
char
ip_address
[
20
];
char
subnet_mask
[
20
];
char
subnet_mask
[
20
];
...
@@ -124,9 +142,11 @@ class GsdmlDeviceData {
...
@@ -124,9 +142,11 @@ class GsdmlDeviceData {
unsigned
short
device_id
;
unsigned
short
device_id
;
char
version
[
20
];
char
version
[
20
];
int
byte_order
;
int
byte_order
;
pwr_tFileName
gsdmlfile
;
vector
<
GsdmlSlotData
*>
slot_data
;
vector
<
GsdmlSlotData
*>
slot_data
;
vector
<
GsdmlIOCRData
*>
iocr_data
;
vector
<
GsdmlIOCRData
*>
iocr_data
;
static
GsdmlSlotData
*
paste_slotdata
;
static
GsdmlSlotData
*
paste_slotdata
;
vector
<
GsdmlChannelDiag
*>
channel_diag
;
~
GsdmlDeviceData
()
{
device_reset
();}
~
GsdmlDeviceData
()
{
device_reset
();}
void
device_reset
()
{
void
device_reset
()
{
...
@@ -137,6 +157,11 @@ class GsdmlDeviceData {
...
@@ -137,6 +157,11 @@ class GsdmlDeviceData {
delete
iocr_data
[
i
];
delete
iocr_data
[
i
];
iocr_data
.
clear
();
iocr_data
.
clear
();
}
}
void
channel_diag_reset
()
{
for
(
unsigned
int
i
=
0
;
i
<
channel_diag
.
size
();
i
++
)
delete
channel_diag
[
i
];
channel_diag
.
clear
();
}
int
print
(
const
char
*
filename
);
int
print
(
const
char
*
filename
);
int
read
(
const
char
*
filename
);
int
read
(
const
char
*
filename
);
int
copy_slot
(
unsigned
int
slot_idx
);
int
copy_slot
(
unsigned
int
slot_idx
);
...
...
profibus/lib/wb/src/wb_c_pndevice.cpp
View file @
01cc1f42
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "co_cdh.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_dcli.h"
#include "co_wow.h"
#include "co_wow.h"
#include "co_msgwindow.h"
#include "co_xhelp.h"
#include "co_xhelp.h"
#include "rt_pn_gsdml.h"
#include "rt_pn_gsdml.h"
#include "rt_pn_gsdml_attr.h"
#include "rt_pn_gsdml_attr.h"
...
@@ -55,6 +56,22 @@
...
@@ -55,6 +56,22 @@
using
namespace
std
;
using
namespace
std
;
class
ChanItem
{
public:
ChanItem
()
:
subslot_number
(
0
),
representation
(
0
),
number
(
0
),
use_as_bit
(
0
),
cid
(
0
)
{}
unsigned
int
subslot_number
;
unsigned
int
representation
;
unsigned
int
number
;
unsigned
int
use_as_bit
;
pwr_tCid
cid
;
char
description
[
80
];
};
static
int
pndevice_add_channels
(
device_sCtx
*
ctx
,
gsdml_VirtualSubmoduleItem
*
vi
,
int
subslot_number
,
vector
<
ChanItem
>&
input_vect
,
vector
<
ChanItem
>&
output_vect
);
static
int
pndevice_check_io
(
device_sCtx
*
ctx
,
gsdml_VirtualSubmoduleList
*
vsl
,
vector
<
ChanItem
>&
input_vect
,
vector
<
ChanItem
>&
output_vect
);
/*----------------------------------------------------------------------------*\
/*----------------------------------------------------------------------------*\
Configure the slave from gsd file.
Configure the slave from gsd file.
...
@@ -99,9 +116,37 @@ int pndevice_save_cb( void *sctx)
...
@@ -99,9 +116,37 @@ int pndevice_save_cb( void *sctx)
int
size
;
int
size
;
pwr_tOid
oid
;
pwr_tOid
oid
;
// Syntax check
if
(
ctx
->
attr
->
attrnav
->
device_num
==
0
)
{
MsgWindow
::
message
(
'E'
,
"Device type not selected"
);
return
PB__SYNTAX
;
}
for
(
unsigned
int
i
=
1
;
i
<
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
.
size
();
i
++
)
{
if
(
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
[
i
]
->
module_enum_number
==
0
&&
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
[
i
]
->
module_class
!=
0
)
{
// Module class selected but not module type
char
msg
[
20
];
sprintf
(
msg
,
"Slot %d"
,
i
);
MsgWindow
::
message
(
'E'
,
"Module type not selected, "
,
msg
);
}
if
(
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
[
i
]
->
module_class
==
0
&&
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
[
i
]
->
module_enum_number
!=
0
)
{
// Module type selected but not module class
char
msg
[
20
];
sprintf
(
msg
,
"Slot %d"
,
i
);
MsgWindow
::
message
(
'E'
,
"Module class not selected, "
,
msg
);
}
}
// Save configuration
((
WNav
*
)
ctx
->
editor_ctx
)
->
set_nodraw
();
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
ldh_eName_Hierarchy
,
name
,
sizeof
(
name
),
&
size
);
ldh_eName_Hierarchy
,
name
,
sizeof
(
name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
goto
return_now
;
// Do a temporary rename all module object to avoid name collisions
// Do a temporary rename all module object to avoid name collisions
for
(
sts
=
ldh_GetChild
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
&
oid
);
for
(
sts
=
ldh_GetChild
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
&
oid
);
...
@@ -109,10 +154,11 @@ int pndevice_save_cb( void *sctx)
...
@@ -109,10 +154,11 @@ int pndevice_save_cb( void *sctx)
sts
=
ldh_GetNextSibling
(
ctx
->
ldhses
,
oid
,
&
oid
))
{
sts
=
ldh_GetNextSibling
(
ctx
->
ldhses
,
oid
,
&
oid
))
{
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
oid
,
cdh_mName_object
,
name
,
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
oid
,
cdh_mName_object
,
name
,
sizeof
(
name
),
&
size
);
sizeof
(
name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
goto
return_now
;
strcat
(
name
,
"__tmp"
);
strcat
(
name
,
"__tmp"
);
sts
=
ldh_ChangeObjectName
(
ctx
->
ldhses
,
oid
,
name
);
sts
=
ldh_ChangeObjectName
(
ctx
->
ldhses
,
oid
,
name
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
goto
return_now
;
}
}
for
(
unsigned
int
i
=
1
;
i
<
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
1
;
i
<
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
.
size
();
i
++
)
{
...
@@ -136,12 +182,12 @@ int pndevice_save_cb( void *sctx)
...
@@ -136,12 +182,12 @@ int pndevice_save_cb( void *sctx)
// Check if name is changed
// Check if name is changed
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
slot
->
module_oid
,
cdh_mName_object
,
name
,
sts
=
ldh_ObjidToName
(
ctx
->
ldhses
,
slot
->
module_oid
,
cdh_mName_object
,
name
,
sizeof
(
name
),
&
size
);
sizeof
(
name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
goto
return_now
;
if
(
strcmp
(
name
,
mname
)
!=
0
)
{
if
(
strcmp
(
name
,
mname
)
!=
0
)
{
// Change name
// Change name
sts
=
ldh_ChangeObjectName
(
ctx
->
ldhses
,
slot
->
module_oid
,
mname
);
sts
=
ldh_ChangeObjectName
(
ctx
->
ldhses
,
slot
->
module_oid
,
mname
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
goto
return_now
;
}
}
// Check that sibling position is right
// Check that sibling position is right
...
@@ -181,15 +227,17 @@ int pndevice_save_cb( void *sctx)
...
@@ -181,15 +227,17 @@ int pndevice_save_cb( void *sctx)
ldh_eDest_After
);
ldh_eDest_After
);
if
(
EVEN
(
sts
))
{
if
(
EVEN
(
sts
))
{
printf
(
"Error creating module object, %d
\n
"
,
sts
);
printf
(
"Error creating module object, %d
\n
"
,
sts
);
return
0
;
sts
=
0
;
goto
return_now
;
}
}
}
}
}
}
// Remove modules that wasn't configured any more
// Remove modules that wasn't configured any more
pwr_tOid
moid
[
100
];
pwr_tOid
moid
[
100
];
int
mcnt
=
0
;
int
mcnt
;
int
found
;
int
found
;
mcnt
=
0
;
for
(
sts
=
ldh_GetChild
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
&
oid
);
for
(
sts
=
ldh_GetChild
(
ctx
->
ldhses
,
ctx
->
aref
.
Objid
,
&
oid
);
ODD
(
sts
);
ODD
(
sts
);
sts
=
ldh_GetNextSibling
(
ctx
->
ldhses
,
oid
,
&
oid
))
{
sts
=
ldh_GetNextSibling
(
ctx
->
ldhses
,
oid
,
&
oid
))
{
...
@@ -210,105 +258,457 @@ int pndevice_save_cb( void *sctx)
...
@@ -210,105 +258,457 @@ int pndevice_save_cb( void *sctx)
for
(
int
i
=
0
;
i
<
mcnt
;
i
++
)
for
(
int
i
=
0
;
i
<
mcnt
;
i
++
)
sts
=
ldh_DeleteObjectTree
(
ctx
->
ldhses
,
moid
[
i
],
0
);
sts
=
ldh_DeleteObjectTree
(
ctx
->
ldhses
,
moid
[
i
],
0
);
return
PWRB__SUCCESS
;
for
(
unsigned
int
i
=
0
;
i
<
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
.
size
();
i
++
)
{
}
GsdmlSlotData
*
slot
=
ctx
->
attr
->
attrnav
->
dev_data
.
slot_data
[
i
];
static
pwr_tStatus
load_modules
(
device_sCtx
*
ctx
)
if
(
i
==
0
)
{
{
vector
<
ChanItem
>
input_vect
;
#if 0
vector
<
ChanItem
>
output_vect
;
pwr_tOid oid;
sts
=
pndevice_check_io
(
ctx
,
ctx
->
attr
->
attrnav
->
device_item
->
VirtualSubmoduleList
,
input_vect
,
output_vect
);
if
(
sts
==
PB__CREATECHAN
)
{
char
msg
[
20
];
sprintf
(
msg
,
"Slot %d"
,
i
);
MsgWindow
::
message
(
'W'
,
"Unexpected datatype, channel not created, "
,
msg
);
}
}
else
{
if
(
slot
->
module_class
==
pwr_cClass_PnModule
)
{
vector
<
ChanItem
>
input_vect
;
vector
<
ChanItem
>
output_vect
;
gsdml_UseableModules
*
um
=
ctx
->
gsdml
->
ApplicationProcess
->
DeviceAccessPointList
->
DeviceAccessPointItem
[
ctx
->
attr
->
attrnav
->
device_num
-
1
]
->
UseableModules
;
if
(
!
um
)
continue
;
gsdml_ModuleItem
*
mi
=
(
gsdml_ModuleItem
*
)
um
->
ModuleItemRef
[
slot
->
module_enum_number
-
1
]
->
Body
.
ModuleItemTarget
.
p
;
sts
=
pndevice_check_io
(
ctx
,
mi
->
VirtualSubmoduleList
,
input_vect
,
output_vect
);
if
(
sts
==
PB__CREATECHAN
)
{
char
msg
[
20
];
sprintf
(
msg
,
"Slot %d"
,
i
);
MsgWindow
::
message
(
'W'
,
"Unexpected datatype, channel not created, "
,
msg
);
}
// Create the channels
if
(
EVEN
(
ldh_GetChild
(
ctx
->
ldhses
,
slot
->
module_oid
,
&
oid
)))
{
unsigned
int
chan_cnt
=
0
;
for
(
unsigned
int
j
=
0
;
j
<
input_vect
.
size
();
j
++
)
{
char
name
[
80
];
sprintf
(
name
,
"Ch%02u"
,
chan_cnt
++
);
sts
=
ldh_CreateObject
(
ctx
->
ldhses
,
&
oid
,
name
,
input_vect
[
j
].
cid
,
slot
->
module_oid
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
sts
))
goto
return_now
;
pwr_tAttrRef
aaref
;
pwr_tAttrRef
chanaref
=
cdh_ObjidToAref
(
oid
);
// Set Representation
pwr_tEnum
representation
=
input_vect
[
j
].
representation
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
chanaref
,
"Representation"
,
&
aaref
);
if
(
EVEN
(
sts
))
goto
return_now
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
representation
,
sizeof
(
representation
));
if
(
EVEN
(
sts
))
goto
return_now
;
// Set Number
pwr_tUInt16
number
=
input_vect
[
j
].
number
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
chanaref
,
"Number"
,
&
aaref
);
if
(
EVEN
(
sts
))
goto
return_now
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
number
,
sizeof
(
number
));
if
(
EVEN
(
sts
))
goto
return_now
;
// Set Description
pwr_tString80
description
;
strncpy
(
description
,
input_vect
[
j
].
description
,
sizeof
(
description
));
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
chanaref
,
"Description"
,
&
aaref
);
if
(
EVEN
(
sts
))
goto
return_now
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
description
,
sizeof
(
description
));
if
(
EVEN
(
sts
))
goto
return_now
;
}
for
(
unsigned
int
j
=
0
;
j
<
output_vect
.
size
();
j
++
)
{
char
name
[
80
];
sprintf
(
name
,
"Ch%02u"
,
chan_cnt
++
);
sts
=
ldh_CreateObject
(
ctx
->
ldhses
,
&
oid
,
name
,
output_vect
[
j
].
cid
,
slot
->
module_oid
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
sts
))
goto
return_now
;
pwr_tAttrRef
aaref
;
pwr_tAttrRef
chanaref
=
cdh_ObjidToAref
(
oid
);
// Set Representation
pwr_tEnum
representation
=
output_vect
[
j
].
representation
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
chanaref
,
"Representation"
,
&
aaref
);
if
(
EVEN
(
sts
))
goto
return_now
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
representation
,
sizeof
(
representation
));
if
(
EVEN
(
sts
))
goto
return_now
;
// Set Number
pwr_tUInt16
number
=
output_vect
[
j
].
number
;
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
chanaref
,
"Number"
,
&
aaref
);
if
(
EVEN
(
sts
))
goto
return_now
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
&
number
,
sizeof
(
number
));
if
(
EVEN
(
sts
))
goto
return_now
;
// Set Description
pwr_tString80
description
;
strncpy
(
description
,
output_vect
[
j
].
description
,
sizeof
(
description
));
sts
=
ldh_ArefANameToAref
(
ctx
->
ldhses
,
&
chanaref
,
"Description"
,
&
aaref
);
if
(
EVEN
(
sts
))
goto
return_now
;
sts
=
ldh_WriteAttribute
(
ctx
->
ldhses
,
&
aaref
,
description
,
sizeof
(
description
));
if
(
EVEN
(
sts
))
goto
return_now
;
}
}
}
else
{
// Remove existing channels
vector
<
pwr_tOid
>
chanvect
;
pwr_tCid
cid
;
pwr_tCid
cid
;
int found;
pwr_tObjName name;
pwr_tString40 module_name;
int sts;
int size;
pwr_tAttrRef maref, aaref;
for ( sts = ldh_GetChild( ctx->ldhses, ctx->aref.Obj
id, &oid);
for
(
sts
=
ldh_GetChild
(
ctx
->
ldhses
,
slot
->
module_o
id
,
&
oid
);
ODD
(
sts
);
ODD
(
sts
);
sts
=
ldh_GetNextSibling
(
ctx
->
ldhses
,
oid
,
&
oid
))
{
sts
=
ldh_GetNextSibling
(
ctx
->
ldhses
,
oid
,
&
oid
))
{
// Check that this is a module
sts
=
ldh_GetObjectClass
(
ctx
->
ldhses
,
oid
,
&
cid
);
sts
=
ldh_GetObjectClass
(
ctx
->
ldhses
,
oid
,
&
cid
);
if ( EVEN(sts)) return sts;
if
(
EVEN
(
sts
))
goto
return_now
;
found = 0;
switch
(
cid
)
{
for ( int i = 0; ; i++) {
case
pwr_cClass_ChanDi
:
if ( ctx->gsd->module_classlist[i].cid == 0)
case
pwr_cClass_ChanDo
:
break;
case
pwr_cClass_ChanAi
:
if ( ctx->gsd->module_classlist[i].cid == cid) {
case
pwr_cClass_ChanAo
:
found = 1;
case
pwr_cClass_ChanIi
:
case
pwr_cClass_ChanIo
:
chanvect
.
push_back
(
oid
);
break
;
break
;
default:
;
}
}
}
}
if ( !found)
for
(
unsigned
int
i
=
0
;
i
<
chanvect
.
size
();
i
++
)
{
// This is not a known module object
sts
=
ldh_DeleteObject
(
ctx
->
ldhses
,
chanvect
[
i
]);
continue;
if
(
EVEN
(
sts
))
goto
return_now
;
}
}
}
}
sts
=
PWRB__SUCCESS
;
// Get name
return_now:
sts = ldh_ObjidToName( ctx->ldhses, oid, cdh_mName_object, name,
((
WNav
*
)
ctx
->
editor_ctx
)
->
reset_nodraw
();
sizeof(name), &size)
;
return
sts
;
if ( EVEN(sts)) return sts;
}
maref = cdh_ObjidToAref( oid);
static
int
pndevice_check_io
(
device_sCtx
*
ctx
,
gsdml_VirtualSubmoduleList
*
vsl
,
vector
<
ChanItem
>&
input_vect
,
vector
<
ChanItem
>&
output_vect
)
{
int
sts
;
// Get ModuleName attribute
if
(
vsl
)
{
sts = ldh_ArefANameToAref( ctx->ldhses, &maref, "ModuleName", &aaref);
unsigned
int
subslot_number
=
0
;
if ( EVEN(sts)) return sts;
for
(
unsigned
int
i
=
0
;
i
<
vsl
->
VirtualSubmoduleItem
.
size
();
i
++
)
{
if
(
strcmp
(
vsl
->
VirtualSubmoduleItem
[
i
]
->
Body
.
FixedInSubslots
.
str
,
""
)
==
0
)
{
// FixedInSubslots not supplied, default subslot number is 1
sts = ldh_ReadAttribute( ctx->ldhses, &aaref, module_name, sizeof(module_name));
if
(
vsl
->
VirtualSubmoduleItem
.
size
()
==
1
)
subslot_number
=
1
;
else
subslot_number
++
;
sts
=
pndevice_add_channels
(
ctx
,
vsl
->
VirtualSubmoduleItem
[
i
],
subslot_number
,
input_vect
,
output_vect
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
return
sts
;
}
else
{
// FixedInSubslots supplied, create channels for all fixed subslots
ctx->gsd->add_module_conf( cid, oid, name, module_name);
gsdml_Valuelist
*
vl
=
new
gsdml_Valuelist
(
vsl
->
VirtualSubmoduleItem
[
i
]
->
Body
.
FixedInSubslots
.
str
);
gsdml_ValuelistIterator
iter
(
vl
);
for
(
unsigned
int
j
=
iter
.
begin
();
j
!=
iter
.
end
();
j
=
iter
.
next
())
{
subslot_number
=
j
;
sts
=
pndevice_add_channels
(
ctx
,
vsl
->
VirtualSubmoduleItem
[
i
],
subslot_number
,
input_vect
,
output_vect
);
if
(
EVEN
(
sts
))
{
delete
vl
;
return
sts
;
}
}
}
delete
vl
;
}
}
}
return
PB__SUCCESS
;
}
// Set address
static
int
pndevice_add_channels
(
device_sCtx
*
ctx
,
gsdml_VirtualSubmoduleItem
*
vi
,
int
subslot_number
,
pwr_tUInt16 address;
vector
<
ChanItem
>&
input_vect
,
vector
<
ChanItem
>&
output_vect
)
{
sts = ldh_ArefANameToAref( ctx->ldhses, &ctx->aref, "SlaveAddress", &aaref);
// Find input data
if ( EVEN(sts)) return sts;
if
(
vi
->
IOData
&&
vi
->
IOData
->
Input
)
{
for
(
unsigned
int
i
=
0
;
i
<
vi
->
IOData
->
Input
->
DataItem
.
size
();
i
++
)
{
gsdml_DataItem
*
di
=
vi
->
IOData
->
Input
->
DataItem
[
i
];
gsdml_eValueDataType
datatype
;
sts = ldh_ReadAttribute( ctx->ldhses, &aaref, &address, sizeof(address));
ctx
->
attr
->
attrnav
->
gsdml
->
string_to_value_datatype
(
di
->
Body
.
DataType
,
&
datatype
);
if ( EVEN(sts)) return sts;
ctx->gsd->address = address;
if
(
!
di
->
Body
.
UseAsBits
)
{
unsigned
int
representation
;
int
invalid_type
=
0
;
// Set byte order
switch
(
datatype
)
{
pwr_tByteOrderingEnum byte_order;
case
gsdml_eValueDataType_Integer8
:
representation
=
pwr_eDataRepEnum_Int8
;
break
;
case
gsdml_eValueDataType_Unsigned8
:
representation
=
pwr_eDataRepEnum_UInt8
;
break
;
case
gsdml_eValueDataType_Integer16
:
representation
=
pwr_eDataRepEnum_Int16
;
break
;
case
gsdml_eValueDataType_Unsigned16
:
representation
=
pwr_eDataRepEnum_UInt16
;
break
;
case
gsdml_eValueDataType_Integer32
:
representation
=
pwr_eDataRepEnum_Int32
;
break
;
case
gsdml_eValueDataType_Unsigned32
:
representation
=
pwr_eDataRepEnum_UInt32
;
break
;
case
gsdml_eValueDataType_Integer64
:
representation
=
pwr_eDataRepEnum_Int64
;
break
;
case
gsdml_eValueDataType_Unsigned64
:
representation
=
pwr_eDataRepEnum_UInt64
;
break
;
case
gsdml_eValueDataType_Float32
:
representation
=
pwr_eDataRepEnum_Float32
;
break
;
case
gsdml_eValueDataType_Float64
:
representation
=
pwr_eDataRepEnum_Float64
;
break
;
default:
invalid_type
=
1
;
}
sts = ldh_ArefANameToAref( ctx->ldhses, &ctx->aref, "ByteOrdering", &aaref);
if
(
invalid_type
)
if ( EVEN(sts)) return sts
;
return
PB__CREATECHAN
;
sts = ldh_ReadAttribute( ctx->ldhses, &aaref, &byte_order, sizeof(byte_order));
ChanItem
ci
;
if ( EVEN(sts)) return sts;
ci
.
subslot_number
=
subslot_number
;
ci
.
number
=
0
;
ci
.
representation
=
representation
;
ci
.
use_as_bit
=
0
;
ci
.
cid
=
pwr_cClass_ChanAi
;
strncpy
(
ci
.
description
,
(
char
*
)
di
->
Body
.
TextId
.
p
,
sizeof
(
ci
.
description
));
ci
.
description
[
sizeof
(
ci
.
description
)
-
1
]
=
0
;
ctx->gsd->byte_order = byte_order;
input_vect
.
push_back
(
ci
);
}
else
{
// Use as bits
unsigned
int
bits
;
unsigned
int
representation
;
switch
(
datatype
)
{
case
gsdml_eValueDataType_Integer8
:
case
gsdml_eValueDataType_Unsigned8
:
representation
=
pwr_eDataRepEnum_Bit8
;
bits
=
8
;
break
;
case
gsdml_eValueDataType_Integer16
:
case
gsdml_eValueDataType_Unsigned16
:
representation
=
pwr_eDataRepEnum_Bit16
;
bits
=
16
;
break
;
case
gsdml_eValueDataType_Integer32
:
case
gsdml_eValueDataType_Unsigned32
:
representation
=
pwr_eDataRepEnum_Bit32
;
bits
=
32
;
break
;
case
gsdml_eValueDataType_Integer64
:
case
gsdml_eValueDataType_Unsigned64
:
representation
=
pwr_eDataRepEnum_Bit64
;
bits
=
64
;
break
;
default:
bits
=
0
;
}
if
(
di
->
BitDataItem
.
size
()
==
0
)
{
// Add all bits
for
(
unsigned
int
j
=
0
;
j
<
bits
;
j
++
)
{
// Add Channel
ChanItem
ci
;
ci
.
subslot_number
=
subslot_number
;
ci
.
number
=
j
;
ci
.
representation
=
representation
;
ci
.
use_as_bit
=
1
;
ci
.
cid
=
pwr_cClass_ChanDi
;
strncpy
(
ci
.
description
,
(
char
*
)
di
->
Body
.
TextId
.
p
,
sizeof
(
ci
.
description
));
ci
.
description
[
sizeof
(
ci
.
description
)
-
2
]
=
0
;
input_vect
.
push_back
(
ci
);
}
}
else
{
for
(
unsigned
int
j
=
0
;
j
<
di
->
BitDataItem
.
size
();
j
++
)
{
// Add channel
ChanItem
ci
;
ci
.
subslot_number
=
subslot_number
;
ci
.
number
=
di
->
BitDataItem
[
j
]
->
Body
.
BitOffset
;
ci
.
representation
=
representation
;
ci
.
use_as_bit
=
1
;
ci
.
cid
=
pwr_cClass_ChanDi
;
strncpy
(
ci
.
description
,
(
char
*
)
di
->
BitDataItem
[
j
]
->
Body
.
TextId
.
p
,
sizeof
(
ci
.
description
));
ci
.
description
[
sizeof
(
ci
.
description
)
-
2
]
=
0
;
input_vect
.
push_back
(
ci
);
}
}
}
}
}
// Set Ext_User_Prm_Data
// Find output data
pwr_tUInt8 prm_user_data[256];
if
(
vi
->
IOData
&&
vi
->
IOData
->
Output
)
{
pwr_tUInt16 prm_user_data_len;
for
(
unsigned
int
i
=
0
;
int len;
i
<
vi
->
IOData
->
Output
->
DataItem
.
size
();
i
++
)
{
gsdml_DataItem
*
di
=
vi
->
IOData
->
Output
->
DataItem
[
i
];
gsdml_eValueDataType
datatype
;
sts = ldh_ArefANameToAref( ctx->ldhses, &ctx->aref, "PrmUserData", &aaref);
ctx
->
attr
->
attrnav
->
gsdml
->
string_to_value_datatype
(
di
->
Body
.
DataType
,
&
datatype
);
if ( EVEN(sts)) return sts;
sts = ldh_ReadAttribute( ctx->ldhses, &aaref, prm_user_data, sizeof(prm_user_data));
if
(
!
di
->
Body
.
UseAsBits
)
{
if ( EVEN(sts)) return sts;
unsigned
int
representation
;
int
invalid_type
=
0
;
sts = ldh_ArefANameToAref( ctx->ldhses, &ctx->aref, "PrmUserDataLen", &aaref);
switch
(
datatype
)
{
if ( EVEN(sts)) return sts;
case
gsdml_eValueDataType_Integer8
:
representation
=
pwr_eDataRepEnum_Int8
;
break
;
case
gsdml_eValueDataType_Unsigned8
:
representation
=
pwr_eDataRepEnum_UInt8
;
break
;
case
gsdml_eValueDataType_Integer16
:
representation
=
pwr_eDataRepEnum_Int16
;
break
;
case
gsdml_eValueDataType_Unsigned16
:
representation
=
pwr_eDataRepEnum_UInt16
;
break
;
case
gsdml_eValueDataType_Integer32
:
representation
=
pwr_eDataRepEnum_Int32
;
break
;
case
gsdml_eValueDataType_Unsigned32
:
representation
=
pwr_eDataRepEnum_UInt32
;
break
;
case
gsdml_eValueDataType_Integer64
:
representation
=
pwr_eDataRepEnum_Int64
;
break
;
case
gsdml_eValueDataType_Unsigned64
:
representation
=
pwr_eDataRepEnum_UInt64
;
break
;
case
gsdml_eValueDataType_Float32
:
representation
=
pwr_eDataRepEnum_Float32
;
break
;
case
gsdml_eValueDataType_Float64
:
representation
=
pwr_eDataRepEnum_Float64
;
break
;
default:
invalid_type
=
1
;
}
sts = ldh_ReadAttribute( ctx->ldhses, &aaref, &prm_user_data_len, sizeof(prm_user_data_len));
if
(
invalid_type
)
{
if ( EVEN(sts)) return sts;
printf
(
"GSDML-Error, Invalid type, unable to create channel
\n
"
);
return
0
;
}
len = prm_user_data_len;
ChanItem
ci
;
if ( len != 0) {
ci
.
subslot_number
=
subslot_number
;
sts = ctx->gsd->unpack_ext_user_prm_data( (char *)prm_user_data, len);
ci
.
number
=
0
;
if ( EVEN(sts)) return sts;
ci
.
representation
=
representation
;
ci
.
use_as_bit
=
0
;
ci
.
cid
=
pwr_cClass_ChanAo
;
strncpy
(
ci
.
description
,
(
char
*
)
di
->
Body
.
TextId
.
p
,
sizeof
(
ci
.
description
));
ci
.
description
[
sizeof
(
ci
.
description
)
-
2
]
=
0
;
output_vect
.
push_back
(
ci
);
}
}
#endif
else
{
return
1
;
// Use as bits
unsigned
int
bits
;
unsigned
int
representation
;
switch
(
datatype
)
{
case
gsdml_eValueDataType_Integer8
:
case
gsdml_eValueDataType_Unsigned8
:
representation
=
pwr_eDataRepEnum_Bit8
;
bits
=
8
;
break
;
case
gsdml_eValueDataType_Integer16
:
case
gsdml_eValueDataType_Unsigned16
:
representation
=
pwr_eDataRepEnum_Bit16
;
bits
=
16
;
break
;
case
gsdml_eValueDataType_Integer32
:
case
gsdml_eValueDataType_Unsigned32
:
representation
=
pwr_eDataRepEnum_Bit32
;
bits
=
32
;
break
;
case
gsdml_eValueDataType_Integer64
:
case
gsdml_eValueDataType_Unsigned64
:
representation
=
pwr_eDataRepEnum_Bit64
;
bits
=
64
;
break
;
default:
bits
=
0
;
}
if
(
di
->
BitDataItem
.
size
()
==
0
)
{
// Add all bits
for
(
unsigned
int
j
=
0
;
j
<
bits
;
j
++
)
{
// Add Channel
ChanItem
ci
;
ci
.
subslot_number
=
subslot_number
;
ci
.
number
=
j
;
ci
.
representation
=
representation
;
ci
.
use_as_bit
=
1
;
ci
.
cid
=
pwr_cClass_ChanDo
;
strncpy
(
ci
.
description
,
(
char
*
)
di
->
Body
.
TextId
.
p
,
sizeof
(
ci
.
description
));
ci
.
description
[
sizeof
(
ci
.
description
)
-
2
]
=
0
;
output_vect
.
push_back
(
ci
);
}
}
else
{
for
(
unsigned
int
j
=
0
;
j
<
di
->
BitDataItem
.
size
();
j
++
)
{
// Add channel
ChanItem
ci
;
ci
.
subslot_number
=
subslot_number
;
ci
.
number
=
di
->
BitDataItem
[
j
]
->
Body
.
BitOffset
;
ci
.
representation
=
representation
;
ci
.
use_as_bit
=
1
;
ci
.
cid
=
pwr_cClass_ChanDo
;
strncpy
(
ci
.
description
,
(
char
*
)
di
->
BitDataItem
[
j
]
->
Body
.
TextId
.
p
,
sizeof
(
ci
.
description
));
ci
.
description
[
sizeof
(
ci
.
description
)
-
2
]
=
0
;
output_vect
.
push_back
(
ci
);
}
}
}
}
}
return
PB__SUCCESS
;
}
}
pwr_tStatus
pndevice_create_ctx
(
ldh_tSession
ldhses
,
pwr_tAttrRef
aref
,
pwr_tStatus
pndevice_create_ctx
(
ldh_tSession
ldhses
,
pwr_tAttrRef
aref
,
...
...
src/lib/co/src/co_xml_parser.cpp
View file @
01cc1f42
...
@@ -111,6 +111,8 @@ bool co_xml_parser::is_space( const char c)
...
@@ -111,6 +111,8 @@ bool co_xml_parser::is_space( const char c)
int
co_xml_parser
::
read
(
const
char
*
filename
)
int
co_xml_parser
::
read
(
const
char
*
filename
)
{
{
int
sts
;
fp
.
open
(
filename
);
fp
.
open
(
filename
);
if
(
!
fp
)
if
(
!
fp
)
return
DCLI__NOFILE
;
return
DCLI__NOFILE
;
...
@@ -148,7 +150,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -148,7 +150,11 @@ int co_xml_parser::read( const char *filename)
// End of tag name
// End of tag name
current_tag
[
current_tag_idx
]
=
0
;
current_tag
[
current_tag_idx
]
=
0
;
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagName
;
interpreter
->
metatag
(
current_tag
);
sts
=
interpreter
->
metatag
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
if
(
c
==
'?'
&&
c_f
==
'>'
)
{
else
if
(
c
==
'?'
&&
c_f
==
'>'
)
{
// End of meta tag
// End of meta tag
...
@@ -160,7 +166,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -160,7 +166,11 @@ int co_xml_parser::read( const char *filename)
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_MetaTag
;
state
&=
~
xml_eState_MetaTag
;
interpreter
->
metatag
(
current_tag
);
sts
=
interpreter
->
metatag
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
{
else
{
// Next tag character
// Next tag character
...
@@ -183,7 +193,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -183,7 +193,11 @@ int co_xml_parser::read( const char *filename)
state
&=
~
xml_eState_AttributeValueFound
;
state
&=
~
xml_eState_AttributeValueFound
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_MetaTag
;
state
&=
~
xml_eState_MetaTag
;
interpreter
->
metatag_end
(
current_tag
);
sts
=
interpreter
->
metatag_end
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
{
else
{
if
(
!
(
state
&
xml_eState_AttributeNameFound
))
{
if
(
!
(
state
&
xml_eState_AttributeNameFound
))
{
...
@@ -240,7 +254,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -240,7 +254,11 @@ int co_xml_parser::read( const char *filename)
state
&=
~
xml_eState_Attribute
;
state
&=
~
xml_eState_Attribute
;
state
&=
~
xml_eState_AttributeNameFound
;
state
&=
~
xml_eState_AttributeNameFound
;
state
&=
~
xml_eState_AttributeValueFound
;
state
&=
~
xml_eState_AttributeValueFound
;
interpreter
->
tag_attribute
(
current_attribute_name
,
current_attribute_value
);
sts
=
interpreter
->
tag_attribute
(
current_attribute_name
,
current_attribute_value
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
{
else
{
// Next char in attribute value
// Next char in attribute value
...
@@ -276,14 +294,26 @@ int co_xml_parser::read( const char *filename)
...
@@ -276,14 +294,26 @@ int co_xml_parser::read( const char *filename)
// End of tag name
// End of tag name
current_tag
[
current_tag_idx
]
=
0
;
current_tag
[
current_tag_idx
]
=
0
;
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagName
;
interpreter
->
tag
(
current_tag
);
sts
=
interpreter
->
tag
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
if
(
c
==
'/'
&&
c_f
==
'>'
)
{
else
if
(
c
==
'/'
&&
c_f
==
'>'
)
{
// End of tag
// End of tag
next_token
();
next_token
();
current_tag
[
current_tag_idx
]
=
0
;
current_tag
[
current_tag_idx
]
=
0
;
interpreter
->
tag
(
current_tag
);
sts
=
interpreter
->
tag
(
current_tag
);
interpreter
->
tag_end
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
sts
=
interpreter
->
tag_end
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
if
(
state
&
xml_eState_AttributeName
||
if
(
state
&
xml_eState_AttributeName
||
state
&
xml_eState_AttributeValue
)
state
&
xml_eState_AttributeValue
)
error_message_line
(
"Syntax error"
);
error_message_line
(
"Syntax error"
);
...
@@ -302,7 +332,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -302,7 +332,11 @@ int co_xml_parser::read( const char *filename)
state
&=
~
xml_eState_Tag
;
state
&=
~
xml_eState_Tag
;
state
|=
xml_eState_TagValue
;
state
|=
xml_eState_TagValue
;
current_tag_value_idx
=
0
;
current_tag_value_idx
=
0
;
interpreter
->
tag
(
current_tag
);
sts
=
interpreter
->
tag
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
{
else
{
// Next tag character
// Next tag character
...
@@ -328,7 +362,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -328,7 +362,11 @@ int co_xml_parser::read( const char *filename)
current_attribute_value
[
current_attribute_value_idx
++
]
=
c
;
current_attribute_value
[
current_attribute_value_idx
++
]
=
c
;
continue
;
continue
;
}
}
interpreter
->
tag_end
(
current_tag
);
sts
=
interpreter
->
tag_end
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
state
&=
~
xml_eState_AttributeNameFound
;
state
&=
~
xml_eState_AttributeNameFound
;
state
&=
~
xml_eState_AttributeValueFound
;
state
&=
~
xml_eState_AttributeValueFound
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_TagNameFound
;
...
@@ -417,7 +455,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -417,7 +455,11 @@ int co_xml_parser::read( const char *filename)
state
&=
~
xml_eState_AttributeNameFound
;
state
&=
~
xml_eState_AttributeNameFound
;
state
&=
~
xml_eState_AttributeValueFound
;
state
&=
~
xml_eState_AttributeValueFound
;
suppress_msg
=
0
;
suppress_msg
=
0
;
interpreter
->
tag_attribute
(
current_attribute_name
,
current_attribute_value
);
sts
=
interpreter
->
tag_attribute
(
current_attribute_name
,
current_attribute_value
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
{
else
{
// Next char in attribute value
// Next char in attribute value
...
@@ -450,7 +492,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -450,7 +492,11 @@ int co_xml_parser::read( const char *filename)
next_token
();
next_token
();
current_tag_value
[
current_tag_value_idx
]
=
0
;
current_tag_value
[
current_tag_value_idx
]
=
0
;
if
(
state
&
xml_eState_TagValueFound
)
{
if
(
state
&
xml_eState_TagValueFound
)
{
interpreter
->
tag_value
(
current_tag_value
);
sts
=
interpreter
->
tag_value
(
current_tag_value
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
state
&=
~
xml_eState_TagValueFound
;
state
&=
~
xml_eState_TagValueFound
;
}
}
state
&=
~
xml_eState_TagValue
;
state
&=
~
xml_eState_TagValue
;
...
@@ -493,7 +539,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -493,7 +539,11 @@ int co_xml_parser::read( const char *filename)
// End of tag name
// End of tag name
current_tag
[
current_tag_idx
]
=
0
;
current_tag
[
current_tag_idx
]
=
0
;
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagName
;
interpreter
->
tag_end
(
current_tag
);
sts
=
interpreter
->
tag_end
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
if
(
c
==
'>'
)
{
else
if
(
c
==
'>'
)
{
// End of tag
// End of tag
...
@@ -501,7 +551,11 @@ int co_xml_parser::read( const char *filename)
...
@@ -501,7 +551,11 @@ int co_xml_parser::read( const char *filename)
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagName
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_TagNameFound
;
state
&=
~
xml_eState_EndTag
;
state
&=
~
xml_eState_EndTag
;
interpreter
->
tag_end
(
current_tag
);
sts
=
interpreter
->
tag_end
(
current_tag
);
if
(
EVEN
(
sts
))
{
fp
.
close
();
return
sts
;
}
}
}
else
{
else
{
// Next tag character
// Next tag character
...
...
src/msg/rt/src/rt_pb_msg.msg
View file @
01cc1f42
...
@@ -44,6 +44,9 @@ gsdattr <Gsdfile attibute is empty> /error
...
@@ -44,6 +44,9 @@ gsdattr <Gsdfile attibute is empty> /error
nyi <Not yet implemented> /error
nyi <Not yet implemented> /error
syntax <Conversion syntax error> /error
syntax <Conversion syntax error> /error
gsdmlfile <Unable to open GSDML file> /error
gsdmlfile <Unable to open GSDML file> /error
nodevice <No device selected> /error
createchan <Unable to create channel> /error
gsdmlfilemismatch <Gsdmlfile doesn't match original filename> /error
.end
.end
wb/lib/wb/src/wb_wnav.cpp
View file @
01cc1f42
...
@@ -585,7 +585,7 @@ WNav::WNav(
...
@@ -585,7 +585,7 @@ WNav::WNav(
layout_objid
(
pwr_cNObjid
),
search_last
(
pwr_cNObjid
),
search_compiled
(
0
),
layout_objid
(
pwr_cNObjid
),
search_last
(
pwr_cNObjid
),
search_compiled
(
0
),
search_type
(
wnav_eSearchType_No
),
selection_owner
(
0
),
last_selected
(
0
),
search_type
(
wnav_eSearchType_No
),
selection_owner
(
0
),
last_selected
(
0
),
displayed
(
0
),
scriptmode
(
0
),
dialog_width
(
0
),
dialog_height
(
0
),
displayed
(
0
),
scriptmode
(
0
),
dialog_width
(
0
),
dialog_height
(
0
),
dialog_x
(
0
),
dialog_y
(
0
),
menu
(
0
),
admin_login
(
0
)
dialog_x
(
0
),
dialog_y
(
0
),
menu
(
0
),
admin_login
(
0
)
,
nodraw
(
0
)
{
{
strcpy
(
name
,
xn_name
);
strcpy
(
name
,
xn_name
);
...
@@ -2749,6 +2749,9 @@ void WNav::ldh_refresh( pwr_tObjid new_open)
...
@@ -2749,6 +2749,9 @@ void WNav::ldh_refresh( pwr_tObjid new_open)
if
(
brow
->
type
!=
wnav_eBrowType_Volume
)
if
(
brow
->
type
!=
wnav_eBrowType_Volume
)
return
;
return
;
if
(
nodraw
)
return
;
// Store all open objects
// Store all open objects
open_cnt
=
0
;
open_cnt
=
0
;
...
...
wb/lib/wb/src/wb_wnav.h
View file @
01cc1f42
...
@@ -287,6 +287,7 @@ class WNav : public WUtility{
...
@@ -287,6 +287,7 @@ class WNav : public WUtility{
int
init_help
;
int
init_help
;
CoWow
*
wow
;
CoWow
*
wow
;
int
admin_login
;
int
admin_login
;
int
nodraw
;
virtual
void
pop
()
{}
virtual
void
pop
()
{}
virtual
void
set_inputfocus
(
int
focus
)
{}
virtual
void
set_inputfocus
(
int
focus
)
{}
...
@@ -416,6 +417,8 @@ class WNav : public WUtility{
...
@@ -416,6 +417,8 @@ class WNav : public WUtility{
int
case_sensitive
);
int
case_sensitive
);
int
display_objects
(
pwr_tCid
*
cidp
,
char
*
name
,
pwr_tObjid
root
,
int
display_objects
(
pwr_tCid
*
cidp
,
char
*
name
,
pwr_tObjid
root
,
int
depth
);
int
depth
);
void
set_nodraw
()
{
nodraw
=
1
;}
void
reset_nodraw
()
{
nodraw
=
0
;
refresh
();}
};
};
int
wnav_cut_segments
(
int
wnav_cut_segments
(
...
...
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