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
a302eef9
Commit
a302eef9
authored
Oct 06, 2017
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Xtt, commands and menu methods to set signal invert, conversion test and testvalue
parent
f45d78f7
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1003 additions
and
41 deletions
+1003
-41
src/msg/rt/src/rt_xnav_msg.msg
src/msg/rt/src/rt_xnav_msg.msg
+1
-0
src/wbl/pwrb/src/pwrb_c_di.wb_load
src/wbl/pwrb/src/pwrb_c_di.wb_load
+43
-0
src/wbl/pwrb/src/pwrb_c_do.wb_load
src/wbl/pwrb/src/pwrb_c_do.wb_load
+62
-0
xtt/lib/ge/src/ge_graph_object.cpp
xtt/lib/ge/src/ge_graph_object.cpp
+2
-1
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
+59
-26
xtt/lib/xtt/src/xtt_c_di.cpp
xtt/lib/xtt/src/xtt_c_di.cpp
+131
-0
xtt/lib/xtt/src/xtt_c_do.cpp
xtt/lib/xtt/src/xtt_c_do.cpp
+166
-0
xtt/lib/xtt/src/xtt_ssaboxclasses.h
xtt/lib/xtt/src/xtt_ssaboxclasses.h
+4
-7
xtt/lib/xtt/src/xtt_xnav.cpp
xtt/lib/xtt/src/xtt_xnav.cpp
+181
-1
xtt/lib/xtt/src/xtt_xnav.h
xtt/lib/xtt/src/xtt_xnav.h
+10
-2
xtt/lib/xtt/src/xtt_xnav_command.cpp
xtt/lib/xtt/src/xtt_xnav_command.cpp
+342
-3
xtt/lib/xtt/src/xtt_xtt.meth
xtt/lib/xtt/src/xtt_xtt.meth
+2
-1
No files found.
src/msg/rt/src/rt_xnav_msg.msg
View file @
a302eef9
...
...
@@ -75,3 +75,4 @@ noclassgraph <No classgraph found> /error
notauthorized <Not authorized for this operation> /error
novalidcurve <No valid curve found> /error
nosuchvolume <No such volume> /error
invalidobject <Invalid object for this operation> /error
src/wbl/pwrb/src/pwrb_c_di.wb_load
View file @
a302eef9
...
...
@@ -331,6 +331,49 @@ SObject pwrb:Class
EndObject
EndObject
Object RtXtt $RtMenu
Object Set $MenuCascade
Body SysBody
Attr ButtonName = "Set"
EndBody
Object Invert $MenuCascade
Body SysBody
Attr ButtonName = "Invert"
EndBody
Object On $MenuButton
Body SysBody
Attr ButtonName = "On"
Attr MethodName = "Di-InvertOn"
Attr FilterName = "Di-SetFilter"
EndBody
EndObject
Object Off $MenuButton
Body SysBody
Attr ButtonName = "Off"
Attr MethodName = "Di-InvertOff"
Attr FilterName = "Di-SetFilter"
EndBody
EndObject
EndObject
Object Conversion $MenuCascade
Body SysBody
Attr ButtonName = "Conversion"
EndBody
Object On $MenuButton
Body SysBody
Attr ButtonName = "On"
Attr MethodName = "Di-ConversionOn"
Attr FilterName = "Di-SetFilter"
EndBody
EndObject
Object Off $MenuButton
Body SysBody
Attr ButtonName = "Off"
Attr MethodName = "Di-ConversionOff"
Attr FilterName = "Di-SetFilter"
EndBody
EndObject
EndObject
EndObject
Object Channel $MenuRef
Body SysBody
Attr ButtonName = "Channel"
...
...
src/wbl/pwrb/src/pwrb_c_do.wb_load
View file @
a302eef9
...
...
@@ -287,6 +287,68 @@ SObject pwrb:Class
EndObject
EndObject
Object RtXtt $RtMenu
Object Set $MenuCascade
Body SysBody
Attr ButtonName = "Set"
EndBody
Object Invert $MenuCascade
Body SysBody
Attr ButtonName = "Invert"
EndBody
Object On $MenuButton
Body SysBody
Attr ButtonName = "On"
Attr MethodName = "Do-InvertOn"
Attr FilterName = "Do-SetFilter"
EndBody
EndObject
Object Off $MenuButton
Body SysBody
Attr ButtonName = "Off"
Attr MethodName = "Do-InvertOff"
Attr FilterName = "Do-SetFilter"
EndBody
EndObject
EndObject
Object Test $MenuCascade
Body SysBody
Attr ButtonName = "Test"
EndBody
Object On $MenuButton
Body SysBody
Attr ButtonName = "On"
Attr MethodName = "Do-TestOn"
Attr FilterName = "Do-SetFilter"
EndBody
EndObject
Object Off $MenuButton
Body SysBody
Attr ButtonName = "Off"
Attr MethodName = "Do-TestOff"
Attr FilterName = "Do-SetFilter"
EndBody
EndObject
EndObject
Object TestValue $MenuCascade
Body SysBody
Attr ButtonName = "TestValue"
EndBody
Object True $MenuButton
Body SysBody
Attr ButtonName = "True"
Attr MethodName = "Do-TestValueTrue"
Attr FilterName = "Do-SetFilter"
EndBody
EndObject
Object False $MenuButton
Body SysBody
Attr ButtonName = "False"
Attr MethodName = "Do-TestValueFalse"
Attr FilterName = "Do-SetFilter"
EndBody
EndObject
EndObject
EndObject
Object Channel $MenuRef
Body SysBody
Attr ButtonName = "Channel"
...
...
xtt/lib/ge/src/ge_graph_object.cpp
View file @
a302eef9
...
...
@@ -325,6 +325,7 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
switch
(
card_cid
)
{
case
pwr_cClass_Ssab_DI32D
:
{
pwr_tAName
card_name
;
unsigned
int
chan_idx
=
(
chanaref
.
Offset
-
pwr_AlignLW
(
sizeof
(
pwr_sClass_Ssab_BaseDiCard
)))
/
pwr_AlignLW
(
sizeof
(
pwr_sClass_ChanDi
));
sts
=
gdh_ObjidToName
(
chanaref
.
Objid
,
card_name
,
sizeof
(
card_name
),
cdh_mNName
);
...
...
@@ -1046,4 +1047,4 @@ static int graph_object_PlcThread( Graph *graph, pwr_sAttrRef *arp)
graph
->
graph_object_scan
=
graph_object_PlcThread_scan
;
return
1
;
}
\ No newline at end of file
}
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
View file @
a302eef9
...
...
@@ -458,43 +458,76 @@ GtkWidget *XNavGtk::build_menu( GtkWidget *Parent,
Level
=
Items
[
*
idx
].
Level
;
for
(;
Items
[
*
idx
].
Level
!=
0
&&
Items
[
*
idx
].
Level
>=
Level
;
(
*
idx
)
++
)
{
if
(
Items
[
*
idx
].
Item
==
xmenu_eMenuItem_Cascade
||
Items
[
*
idx
].
Item
==
xmenu_eMenuItem_Ref
)
{
switch
(
Items
[
*
idx
].
Item
)
{
case
xmenu_eMenuItem_Ref
:
{
if
(
MenuType
==
MENU_OPTION
)
{
printf
(
"You can't have submenus from option menu items."
);
return
NULL
;
}
else
{
i
=
*
idx
;
i
=
*
idx
;
GtkWidget
*
sub
=
gtk_menu_item_new_with_label
(
CoWowGtk
::
translate_utf8
(
Items
[
*
idx
].
Name
));
(
*
idx
)
++
;
W
=
build_menu
(
Menu
,
MENU_PULLDOWN
,
Lng
::
translate
(
Items
[
i
].
Name
),
MenuUserData
,
Callback
,
CallbackData
,
Items
,
idx
);
(
*
idx
)
--
;
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
sub
),
GTK_WIDGET
(
W
));
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
sub
);
gtk_widget_show
(
sub
);
break
;
}
case
xmenu_eMenuItem_Cascade
:
{
if
(
MenuType
==
MENU_OPTION
)
{
printf
(
"You can't have submenus from option menu items."
);
return
NULL
;
}
// Check that the Cascade contains any pushbuttons
int
found
=
0
;
unsigned
int
cascade_level
=
Items
[
*
idx
].
Level
;
int
cidx
;
for
(
cidx
=
*
idx
+
1
;
Items
[
cidx
].
Level
!=
0
&&
Items
[
cidx
].
Level
>
cascade_level
;
cidx
++
)
{
if
(
Items
[
cidx
].
Item
==
xmenu_eMenuItem_Ref
||
Items
[
cidx
].
Item
==
xmenu_eMenuItem_Button
)
{
found
=
1
;
break
;
}
}
if
(
found
)
{
i
=
*
idx
;
GtkWidget
*
sub
=
gtk_menu_item_new_with_label
(
CoWowGtk
::
translate_utf8
(
Items
[
*
idx
].
Name
));
(
*
idx
)
++
;
W
=
build_menu
(
Menu
,
MENU_PULLDOWN
,
(
*
idx
)
++
;
W
=
build_menu
(
Menu
,
MENU_PULLDOWN
,
Lng
::
translate
(
Items
[
i
].
Name
),
MenuUserData
,
Callback
,
CallbackData
,
Items
,
idx
);
(
*
idx
)
--
;
(
*
idx
)
--
;
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
sub
),
GTK_WIDGET
(
W
));
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
sub
);
gtk_widget_show
(
sub
);
}
}
else
{
if
(
Items
[
*
idx
].
Item
==
xmenu_eMenuItem_Separator
)
{
// Separator
W
=
gtk_separator_menu_item_new
();
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
W
);
gtk_widget_show
(
W
);
}
else
{
// Pushbutton
W
=
gtk_menu_item_new_with_label
(
CoWowGtk
::
translate_utf8
(
Items
[
*
idx
].
Name
));
gtk_widget_set_sensitive
(
W
,
Items
[
*
idx
].
Flags
.
f
.
Sensitive
?
TRUE
:
FALSE
);
g_object_set_data
(
(
GObject
*
)
W
,
"userdata"
,
(
gpointer
)((
long
int
)
*
idx
));
if
(
Callback
)
g_signal_connect
(
W
,
"activate"
,
G_CALLBACK
(
Callback
),
CallbackData
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
W
);
gtk_widget_show
(
W
);
}
*
idx
=
cidx
-
1
;
}
break
;
}
case
xmenu_eMenuItem_Separator
:
// Separator
W
=
gtk_separator_menu_item_new
();
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
W
);
gtk_widget_show
(
W
);
break
;
case
xmenu_eMenuItem_Button
:
// Pushbutton
W
=
gtk_menu_item_new_with_label
(
CoWowGtk
::
translate_utf8
(
Items
[
*
idx
].
Name
));
gtk_widget_set_sensitive
(
W
,
Items
[
*
idx
].
Flags
.
f
.
Sensitive
?
TRUE
:
FALSE
);
g_object_set_data
(
(
GObject
*
)
W
,
"userdata"
,
(
gpointer
)((
long
int
)
*
idx
));
if
(
Callback
)
g_signal_connect
(
W
,
"activate"
,
G_CALLBACK
(
Callback
),
CallbackData
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
Menu
),
W
);
gtk_widget_show
(
W
);
break
;
default:
;
}
}
...
...
@@ -545,4 +578,4 @@ int XNavGtk::confirm_dialog( char *title, char *text)
return
0
;
}
return
0
;
}
\ No newline at end of file
}
xtt/lib/xtt/src/xtt_c_di.cpp
0 → 100644
View file @
a302eef9
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* wb_c_di.cpp -- xtt methods of the Di class. */
#include "pwr_baseclasses.h"
#include "co_cdh.h"
#include "flow_std.h"
#include "xtt_menu.h"
#include "xtt_xnav.h"
#include "rt_xnav_msg.h"
#include "pwr_privilege.h"
static
pwr_tStatus
SetFilter
(
xmenu_sMenuCall
*
ip
)
{
if
(
!
((
XNav
*
)
ip
->
EditorContext
)
->
is_authorized
(
pwr_mAccess_System
,
0
))
return
XNAV__INVISIBLE
;
return
XNAV__SUCCESS
;
}
// Conversion
static
pwr_tStatus
ConversionOn
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig conv/on/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
static
pwr_tStatus
ConversionOff
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig conv/off/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
static
pwr_tStatus
InvertOn
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig inv/on/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
static
pwr_tStatus
InvertOff
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig inv/off/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to xtt should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindXttMethods
(
Di
)
=
{
pwr_BindXttMethod
(
InvertOn
),
pwr_BindXttMethod
(
InvertOff
),
pwr_BindXttMethod
(
ConversionOn
),
pwr_BindXttMethod
(
ConversionOff
),
pwr_BindXttMethod
(
SetFilter
),
pwr_NullMethod
};
xtt/lib/xtt/src/xtt_c_do.cpp
0 → 100644
View file @
a302eef9
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* wb_c_do.cpp -- xtt methods of the Do class. */
#include "pwr_baseclasses.h"
#include "co_cdh.h"
#include "flow_std.h"
#include "xtt_menu.h"
#include "xtt_xnav.h"
#include "rt_xnav_msg.h"
#include "pwr_privilege.h"
static
pwr_tStatus
SetFilter
(
xmenu_sMenuCall
*
ip
)
{
if
(
!
((
XNav
*
)
ip
->
EditorContext
)
->
is_authorized
(
pwr_mAccess_System
,
0
))
return
XNAV__INVISIBLE
;
return
XNAV__SUCCESS
;
}
static
pwr_tStatus
InvertOn
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig inv/on/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
static
pwr_tStatus
InvertOff
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig inv/off/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
// Test
static
pwr_tStatus
TestOn
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig test/on/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
static
pwr_tStatus
TestOff
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig test/off/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
// Testvalue
static
pwr_tStatus
TestValueTrue
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig testvalue/on/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
static
pwr_tStatus
TestValueFalse
(
xmenu_sMenuCall
*
ip
)
{
pwr_tAName
name
;
pwr_tStatus
sts
;
pwr_tCmd
cmd
;
sts
=
gdh_AttrrefToName
(
&
ip
->
Pointed
,
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
EVEN
(
sts
))
return
sts
;
snprintf
(
cmd
,
sizeof
(
cmd
),
"set sig testvalue/off/name=%s"
,
name
);
((
XNav
*
)
ip
->
EditorContext
)
->
command
(
cmd
);
((
XNav
*
)
ip
->
EditorContext
)
->
refresh
();
return
1
;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to xtt should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindXttMethods
(
Do
)
=
{
pwr_BindXttMethod
(
InvertOn
),
pwr_BindXttMethod
(
InvertOff
),
pwr_BindXttMethod
(
TestOn
),
pwr_BindXttMethod
(
TestOff
),
pwr_BindXttMethod
(
TestValueTrue
),
pwr_BindXttMethod
(
TestValueFalse
),
pwr_BindXttMethod
(
SetFilter
),
pwr_NullMethod
};
xtt/lib/xtt/src/xtt_ssaboxclasses.h
View file @
a302eef9
...
...
@@ -22,13 +22,12 @@
typedef
struct
{
pwr_tString80
Description
pwr_dAlignLW
;
pwr_tString40
DevName
pwr_dAlignW
;
pwr_tUInt32
ErrorCount
pwr_dAlignW
;
pwr_tUInt32
ErrorSoftLimit
pwr_dAlignW
;
pwr_tUInt32
ErrorHardLimit
pwr_dAlignW
;
pwr_tUInt16
MaxNoOfChannels
pwr_dAlignW
;
pwr_tUInt32
RegAddress
pwr_dAlignW
;
pwr_tUInt32
VectAddres
s
pwr_dAlignW
;
pwr_tUInt32
SwitchSetting
s
pwr_dAlignW
;
pwr_tIoProcessMask
Process
pwr_dAlignW
;
pwr_tObjid
ThreadObject
pwr_dAlignW
;
pwr_tURL
DataSheet
pwr_dAlignW
;
...
...
@@ -46,13 +45,12 @@ typedef struct {
typedef
struct
{
pwr_tString80
Description
pwr_dAlignLW
;
pwr_tString40
DevName
pwr_dAlignW
;
pwr_tUInt32
ErrorCount
pwr_dAlignW
;
pwr_tUInt32
ErrorSoftLimit
pwr_dAlignW
;
pwr_tUInt32
ErrorHardLimit
pwr_dAlignW
;
pwr_tUInt16
MaxNoOfChannels
pwr_dAlignW
;
pwr_tUInt32
RegAddress
pwr_dAlignW
;
pwr_tUInt32
VectAddres
s
pwr_dAlignW
;
pwr_tUInt32
SwitchSetting
s
pwr_dAlignW
;
pwr_tIoProcessMask
Process
pwr_dAlignW
;
pwr_tObjid
ThreadObject
pwr_dAlignW
;
pwr_tURL
DataSheet
pwr_dAlignW
;
...
...
@@ -73,7 +71,6 @@ typedef struct {
typedef
struct
{
pwr_tString80
Description
pwr_dAlignLW
;
pwr_tString40
DevName
pwr_dAlignW
;
pwr_tUInt32
ErrorCount
pwr_dAlignW
;
pwr_tUInt32
ErrorSoftLimit
pwr_dAlignW
;
pwr_tUInt32
ErrorHardLimit
pwr_dAlignW
;
...
...
@@ -91,7 +88,7 @@ typedef struct {
pwr_tBoolean
SpeedMeasurement
[
4
]
pwr_dAlignW
;
pwr_tUInt32
SyncRawValue
[
4
]
pwr_dAlignW
;
pwr_tUInt32
RegAddress
pwr_dAlignW
;
pwr_tUInt32
VectAddres
s
pwr_dAlignW
;
pwr_tUInt32
SwitchSetting
s
pwr_dAlignW
;
pwr_tIoProcessMask
Process
pwr_dAlignW
;
pwr_tObjid
ThreadObject
pwr_dAlignW
;
pwr_tURL
DataSheet
pwr_dAlignW
;
...
...
@@ -103,4 +100,4 @@ typedef struct {
#endif
#endif
\ No newline at end of file
#endif
xtt/lib/xtt/src/xtt_xnav.cpp
View file @
a302eef9
...
...
@@ -4402,4 +4402,184 @@ void XNav::autoack_scan( void *data)
xnav
->
ev
->
ack_all
();
xnav
->
autoack_timerid
->
add
(
time
,
autoack_scan
,
xnav
);
}
\ No newline at end of file
}
void
XNav
::
refresh
()
{
pwr_tObjid
open_objid
[
100
];
int
open_cnt
;
brow_tObject
*
object_list
;
int
object_cnt
;
Item
*
object_item
;
int
i
,
j
;
int
open_type
[
100
];
char
open_attr
[
100
][
80
];
int
open
;
int
found
;
brow_tNode
*
node_list
;
int
sel_node_count
;
Item
*
item_sel
;
pwr_tObjid
*
sel_objid
;
int
*
sel_type
;
char
*
sel_attr
;
// Store all open objects
open_cnt
=
0
;
brow_GetObjectList
(
brow
->
ctx
,
&
object_list
,
&
object_cnt
);
for
(
i
=
0
;
i
<
object_cnt
;
i
++
)
{
if
(
(
open
=
brow_IsOpen
(
object_list
[
i
])))
{
brow_GetUserData
(
object_list
[
i
],
(
void
**
)
&
object_item
);
open_objid
[
open_cnt
]
=
object_item
->
objid
;
open_type
[
open_cnt
]
=
open
;
switch
(
object_item
->
type
)
{
case
xnav_eItemType_AttrArray
:
strcpy
(
open_attr
[
open_cnt
],
object_item
->
name
);
break
;
case
xnav_eItemType_Attr
:
strcpy
(
open_attr
[
open_cnt
],
object_item
->
name
);
break
;
case
xnav_eItemType_AttrArrayElem
:
strcpy
(
open_attr
[
open_cnt
],
object_item
->
name
);
break
;
case
xnav_eItemType_AttrObject
:
strcpy
(
open_attr
[
open_cnt
],
object_item
->
name
);
break
;
default:
;
}
open_type
[
open_cnt
]
=
open
;
open_cnt
++
;
if
(
open_cnt
==
100
)
break
;
}
}
// Store selected object
brow_GetSelectedNodes
(
brow
->
ctx
,
&
node_list
,
&
sel_node_count
);
if
(
sel_node_count
>
0
)
{
sel_objid
=
(
pwr_tObjid
*
)
calloc
(
sel_node_count
,
sizeof
(
pwr_tObjid
));
sel_type
=
(
int
*
)
calloc
(
sel_node_count
,
sizeof
(
int
));
sel_attr
=
(
char
*
)
calloc
(
sel_node_count
,
80
);
for
(
i
=
0
;
i
<
sel_node_count
;
i
++
)
{
brow_GetUserData
(
node_list
[
i
],
(
void
**
)
&
item_sel
);
sel_objid
[
i
]
=
item_sel
->
objid
;
sel_type
[
i
]
=
item_sel
->
type
;
switch
(
item_sel
->
type
)
{
case
xnav_eItemType_Attr
:
case
xnav_eItemType_AttrArray
:
case
xnav_eItemType_AttrObject
:
case
xnav_eItemType_AttrArrayElem
:
case
xnav_eItemType_Enum
:
case
xnav_eItemType_Mask
:
strcpy
(
&
sel_attr
[
i
*
80
],
item_sel
->
name
);
break
;
default:
;
}
}
free
(
node_list
);
}
brow_SetNodraw
(
brow
->
ctx
);
brow_DeleteAll
(
brow
->
ctx
);
show_database
(
1
);
// Open all previously open objects
for
(
i
=
0
;
i
<
open_cnt
;
i
++
)
{
brow_GetObjectList
(
brow
->
ctx
,
&
object_list
,
&
object_cnt
);
found
=
0
;
for
(
j
=
object_cnt
-
1
;
j
>=
0
;
j
--
)
{
brow_GetUserData
(
object_list
[
j
],
(
void
**
)
&
object_item
);
switch
(
object_item
->
type
)
{
case
xnav_eItemType_Object
:
if
(
cdh_ObjidIsEqual
(
open_objid
[
i
],
object_item
->
objid
))
{
if
(
open_type
[
i
]
&
xnav_mOpen_Children
)
((
ItemObject
*
)
object_item
)
->
open_children
(
brow
,
0
,
0
);
else
if
(
open_type
[
i
]
&
xnav_mOpen_Attributes
)
((
ItemObject
*
)
object_item
)
->
open_attributes
(
brow
,
0
,
0
);
found
=
1
;
}
break
;
case
xnav_eItemType_AttrArray
:
if
(
cdh_ObjidIsEqual
(
open_objid
[
i
],
object_item
->
objid
)
&&
strcmp
(
object_item
->
name
,
open_attr
[
i
])
==
0
)
{
if
(
open_type
[
i
]
&
xnav_mOpen_Attributes
)
((
ItemAttrArray
*
)
object_item
)
->
open_attributes
(
brow
,
0
,
0
);
found
=
1
;
}
break
;
case
xnav_eItemType_Attr
:
if
(
cdh_ObjidIsEqual
(
open_objid
[
i
],
object_item
->
objid
)
&&
strcmp
(
object_item
->
name
,
open_attr
[
i
])
==
0
)
{
if
(
open_type
[
i
]
&
xnav_mOpen_Children
)
((
ItemAttr
*
)
object_item
)
->
open_children
(
brow
,
0
,
0
);
found
=
1
;
}
break
;
case
xnav_eItemType_AttrArrayElem
:
if
(
cdh_ObjidIsEqual
(
open_objid
[
i
],
object_item
->
objid
)
&&
strcmp
(
object_item
->
name
,
open_attr
[
i
])
==
0
)
{
if
(
open_type
[
i
]
&
xnav_mOpen_Children
)
((
ItemAttrArrayElem
*
)
object_item
)
->
open_children
(
brow
,
0
,
0
);
found
=
1
;
}
break
;
case
xnav_eItemType_AttrObject
:
if
(
cdh_ObjidIsEqual
(
open_objid
[
i
],
object_item
->
objid
)
&&
strcmp
(
object_item
->
name
,
open_attr
[
i
])
==
0
)
{
if
(
open_type
[
i
]
&
xnav_mOpen_Attributes
)
((
ItemAttrObject
*
)
object_item
)
->
open_attributes
(
brow
,
0
,
0
);
found
=
1
;
}
break
;
default:
;
}
if
(
found
)
break
;
}
}
// Select previously selected
if
(
sel_node_count
>
0
)
{
brow_GetObjectList
(
brow
->
ctx
,
&
object_list
,
&
object_cnt
);
for
(
i
=
0
;
i
<
sel_node_count
;
i
++
)
{
for
(
j
=
object_cnt
-
1
;
j
>=
0
;
j
--
)
{
brow_GetUserData
(
object_list
[
j
],
(
void
**
)
&
object_item
);
found
=
0
;
if
(
cdh_ObjidIsEqual
(
sel_objid
[
i
],
object_item
->
objid
)
&&
sel_type
[
i
]
==
object_item
->
type
)
{
switch
(
object_item
->
type
)
{
case
xnav_eItemType_Attr
:
case
xnav_eItemType_AttrArray
:
case
xnav_eItemType_AttrObject
:
case
xnav_eItemType_AttrArrayElem
:
case
xnav_eItemType_Enum
:
case
xnav_eItemType_Mask
:
if
(
strcmp
(
&
sel_attr
[
i
*
80
],
object_item
->
name
)
==
0
)
found
=
1
;
break
;
default:
found
=
1
;
}
}
if
(
found
)
{
brow_SetInverse
(
object_item
->
node
,
1
);
brow_SelectInsert
(
brow
->
ctx
,
object_item
->
node
);
break
;
}
}
}
free
(
(
char
*
)
sel_objid
);
free
(
(
char
*
)
sel_type
);
free
(
(
char
*
)
sel_attr
);
}
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
0
);
}
xtt/lib/xtt/src/xtt_xnav.h
View file @
a302eef9
...
...
@@ -232,6 +232,13 @@ typedef enum {
ge_mOptions_Dialog
=
1
<<
9
}
ge_mOptions
;
typedef
enum
{
xnav_eSetSignal_Conversion
,
xnav_eSetSignal_Invert
,
xnav_eSetSignal_Test
,
xnav_eSetSignal_TestValue
}
xnav_eSetSignal
;
class
XNav
;
class
XNavGbl
{
...
...
@@ -491,7 +498,7 @@ class XNav {
int
sound_attached
();
int
eventlog_enabled
();
void
appl_startup
();
void
refresh
();
static
int
init_brow_base_cb
(
FlowCtx
*
fctx
,
void
*
client_data
);
static
int
get_trace_attr
(
pwr_sAttrRef
*
arp
,
char
*
attr
);
...
...
@@ -522,7 +529,7 @@ class XNav {
int
script
(
char
*
buffer
);
pwr_tStatus
get_command_sts
();
int
readcmdfile
(
char
*
incommand
,
char
*
buffer
);
int
show_database
();
int
show_database
(
int
nopop
=
0
);
int
get_current_object
(
pwr_tObjid
*
objid
,
char
*
objectname
,
...
...
@@ -573,6 +580,7 @@ class XNav {
int
delete_object
(
char
*
name
);
void
open_keyboard
(
void
*
owner
,
keyboard_eKeymap
keymap
,
int
type
);
void
close_keyboard
(
int
action
);
int
set_signal
(
pwr_tAttrRef
*
arp
,
xnav_eSetSignal
type
,
int
on
);
static
void
print_methods
();
static
pwr_tStatus
get_instance_classgraph
(
char
*
instance_str
,
pwr_tFileName
filename
);
...
...
xtt/lib/xtt/src/xtt_xnav_command.cpp
View file @
a302eef9
...
...
@@ -101,6 +101,7 @@
#include "xtt_log.h"
#include "xtt_stream.h"
#include "xtt_otree.h"
#include "xtt_ssaboxclasses.h"
class
xnav_file
{
public:
...
...
@@ -375,7 +376,7 @@ dcli_tCmdTable xnav_command_table[] = {
{
"dcli_arg1"
,
"dcli_arg2"
,
"/NAME"
,
"/VALUE"
,
"/BYPASS"
,
"/PUBLICWRITE"
,
"/INDEX"
,
"/SOURCE"
,
"/OBJECT"
,
"/CONTINUE"
,
"/X0"
,
"/Y0"
,
"/X1"
,
"/Y1"
,
"/INSTANCE"
,
"/ESCAPESTORE"
,
"/FOCUS"
,
"/INPUTEMPTY"
,
"/ICONIFY"
,
"/BELOW"
,
"/ICONIFY"
,
"/BELOW"
,
"/ON"
,
"/OFF"
,
""
}
},
{
...
...
@@ -1287,6 +1288,202 @@ static int xnav_set_func( void *client_data,
return
XNAV__SUCCESS
;
}
}
else
if
(
cdh_NoCaseStrncmp
(
arg1_str
,
"SIGNAL"
,
strlen
(
arg1_str
))
==
0
)
{
char
arg2_str
[
80
];
if
(
EVEN
(
dcli_get_qualifier
(
"dcli_arg2"
,
arg2_str
,
sizeof
(
arg2_str
))))
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__SUCCESS
;
}
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"INVERT"
,
strlen
(
arg2_str
))
==
0
)
{
// Check authorization
if
(
!
(
xnav
->
priv
&
pwr_mPrv_System
))
{
xnav
->
message
(
'E'
,
"Not authorized for this operation"
);
return
XNAV__SUCCESS
;
}
pwr_tAName
name_str
;
pwr_tAttrRef
aref
;
pwr_tStatus
sts
;
int
is_attr
;
int
selected
=
0
;
int
on
=
ODD
(
dcli_get_qualifier
(
"/ON"
,
0
,
0
));
int
off
=
ODD
(
dcli_get_qualifier
(
"/OFF"
,
0
,
0
));
if
(
(
on
&&
off
)
||
(
!
on
&&
!
off
))
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
ODD
(
dcli_get_qualifier
(
"/NAME"
,
name_str
,
sizeof
(
name_str
))))
{
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
name_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"No such object"
);
return
XNAV__SUCCESS
;
}
}
else
{
/* Get the selected object */
sts
=
xnav
->
get_select
(
&
aref
,
&
is_attr
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Enter name or select an object"
);
return
XNAV__SUCCESS
;
}
selected
=
1
;
}
sts
=
xnav
->
set_signal
(
&
aref
,
xnav_eSetSignal_Invert
,
on
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
' '
,
XNav
::
get_message
(
sts
));
return
XNAV__SUCCESS
;
}
if
(
selected
)
xnav
->
refresh
();
}
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"CONVERSION"
,
strlen
(
arg2_str
))
==
0
)
{
// Check authorization
if
(
!
(
xnav
->
priv
&
pwr_mPrv_System
))
{
xnav
->
message
(
'E'
,
"Not authorized for this operation"
);
return
XNAV__SUCCESS
;
}
pwr_tAName
name_str
;
pwr_tAttrRef
aref
;
pwr_tStatus
sts
;
int
is_attr
;
int
selected
=
0
;
int
on
=
ODD
(
dcli_get_qualifier
(
"/ON"
,
0
,
0
));
int
off
=
ODD
(
dcli_get_qualifier
(
"/OFF"
,
0
,
0
));
if
(
(
on
&&
off
)
||
(
!
on
&&
!
off
))
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
ODD
(
dcli_get_qualifier
(
"/NAME"
,
name_str
,
sizeof
(
name_str
))))
{
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
name_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"No such object"
);
return
XNAV__SUCCESS
;
}
}
else
{
/* Get the selected object */
sts
=
xnav
->
get_select
(
&
aref
,
&
is_attr
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Enter name or select an object"
);
return
XNAV__SUCCESS
;
}
selected
=
1
;
}
sts
=
xnav
->
set_signal
(
&
aref
,
xnav_eSetSignal_Conversion
,
on
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
' '
,
XNav
::
get_message
(
sts
));
return
XNAV__SUCCESS
;
}
if
(
selected
)
xnav
->
refresh
();
}
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"TEST"
,
strlen
(
arg2_str
))
==
0
)
{
// Check authorization
if
(
!
(
xnav
->
priv
&
pwr_mPrv_System
))
{
xnav
->
message
(
'E'
,
"Not authorized for this operation"
);
return
XNAV__SUCCESS
;
}
pwr_tAName
name_str
;
pwr_tAttrRef
aref
;
pwr_tStatus
sts
;
int
is_attr
;
int
selected
=
0
;
int
on
=
ODD
(
dcli_get_qualifier
(
"/ON"
,
0
,
0
));
int
off
=
ODD
(
dcli_get_qualifier
(
"/OFF"
,
0
,
0
));
if
(
(
on
&&
off
)
||
(
!
on
&&
!
off
))
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
ODD
(
dcli_get_qualifier
(
"/NAME"
,
name_str
,
sizeof
(
name_str
))))
{
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
name_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"No such object"
);
return
XNAV__SUCCESS
;
}
}
else
{
/* Get the selected object */
sts
=
xnav
->
get_select
(
&
aref
,
&
is_attr
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Enter name or select an object"
);
return
XNAV__SUCCESS
;
}
selected
=
1
;
}
sts
=
xnav
->
set_signal
(
&
aref
,
xnav_eSetSignal_Test
,
on
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
' '
,
XNav
::
get_message
(
sts
));
return
XNAV__SUCCESS
;
}
if
(
selected
)
xnav
->
refresh
();
}
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"TESTVALUE"
,
strlen
(
arg2_str
))
==
0
)
{
// Check authorization
if
(
!
(
xnav
->
priv
&
pwr_mPrv_System
))
{
xnav
->
message
(
'E'
,
"Not authorized for this operation"
);
return
XNAV__SUCCESS
;
}
pwr_tAName
name_str
;
pwr_tAttrRef
aref
;
pwr_tStatus
sts
;
int
is_attr
;
int
selected
=
0
;
int
on
=
ODD
(
dcli_get_qualifier
(
"/ON"
,
0
,
0
));
int
off
=
ODD
(
dcli_get_qualifier
(
"/OFF"
,
0
,
0
));
if
(
(
on
&&
off
)
||
(
!
on
&&
!
off
))
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
ODD
(
dcli_get_qualifier
(
"/NAME"
,
name_str
,
sizeof
(
name_str
))))
{
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
name_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"No such object"
);
return
XNAV__SUCCESS
;
}
}
else
{
/* Get the selected object */
sts
=
xnav
->
get_select
(
&
aref
,
&
is_attr
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Enter name or select an object"
);
return
XNAV__SUCCESS
;
}
selected
=
1
;
}
sts
=
xnav
->
set_signal
(
&
aref
,
xnav_eSetSignal_TestValue
,
on
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
' '
,
XNav
::
get_message
(
sts
));
return
XNAV__SUCCESS
;
}
if
(
selected
)
xnav
->
refresh
();
}
else
xnav
->
message
(
'E'
,
"Syntax error"
);
}
else
xnav
->
message
(
'E'
,
"Syntax error"
);
return
1
;
...
...
@@ -7886,7 +8083,7 @@ static int xnav_emit_func( void *client_data,
return
XNAV__SUCCESS
;
}
int
XNav
::
show_database
()
int
XNav
::
show_database
(
int
nopop
)
{
int
sts
;
pwr_tObjid
root
;
...
...
@@ -7910,7 +8107,8 @@ int XNav::show_database()
{
if
(
!
toplevel_cnt
)
{
brow_pop
();
if
(
!
nopop
)
brow_pop
();
brow_SetNodraw
(
brow
->
ctx
);
}
sts
=
create_object_item
(
root
,
NULL
,
...
...
@@ -10732,3 +10930,144 @@ static int xnav_replace_node_str( char *out, char *object_str)
strcpy
(
out
,
object_str
);
return
0
;
}
int
XNav
::
set_signal
(
pwr_tAttrRef
*
arp
,
xnav_eSetSignal
type
,
int
on
)
{
int
sts
;
pwr_tCid
sig_cid
,
chan_cid
,
card_cid
,
cid
;
pwr_tAttrRef
aref
,
chan_aref
,
card_aref
,
value_aref
;
pwr_tOid
card_oid
;
pwr_tMask
valuemask
;
pwr_tBoolean
value_on
;
static
char
card_mask1
[][
32
]
=
{
"ConvMask1"
,
"InvMask1"
,
"TestMask1"
,
"TestValue1"
};
static
char
card_mask2
[][
32
]
=
{
"ConvMask2"
,
"InvMask2"
,
"TestMask2"
,
"TestValue2"
};
static
char
chan_attr
[][
32
]
=
{
"ConversionOn"
,
"InvertOn"
,
"TestOn"
,
"TestValue"
};
sts
=
gdh_GetAttrRefTid
(
arp
,
&
sig_cid
);
if
(
EVEN
(
sts
))
return
sts
;
switch
(
sig_cid
)
{
case
pwr_cClass_Di
:
case
pwr_cClass_Do
:
case
pwr_cClass_Po
:
case
pwr_cClass_Ai
:
case
pwr_cClass_Ao
:
sts
=
gdh_ArefANameToAref
(
arp
,
"SigChanCon"
,
&
aref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetObjectInfoAttrref
(
&
aref
,
&
chan_aref
,
sizeof
(
chan_aref
));
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetAttrRefTid
(
&
chan_aref
,
&
chan_cid
);
if
(
EVEN
(
sts
))
return
sts
;
break
;
case
pwr_cClass_ChanDi
:
case
pwr_cClass_ChanDo
:
case
pwr_cClass_ChanAi
:
case
pwr_cClass_ChanAo
:
case
pwr_cClass_ChanIi
:
case
pwr_cClass_ChanIo
:
chan_aref
=
*
arp
;
chan_cid
=
sig_cid
;
break
;
default:
return
XNAV__INVALIDOBJECT
;
}
switch
(
chan_cid
)
{
case
pwr_cClass_ChanDi
:
if
(
!
(
type
==
xnav_eSetSignal_Conversion
||
type
==
xnav_eSetSignal_Invert
))
return
XNAV__INVALIDOBJECT
;
break
;
case
pwr_cClass_ChanDo
:
if
(
!
(
type
==
xnav_eSetSignal_Invert
||
type
==
xnav_eSetSignal_Test
||
type
==
xnav_eSetSignal_TestValue
))
return
XNAV__INVALIDOBJECT
;
break
;
case
pwr_cClass_ChanAi
:
case
pwr_cClass_ChanIi
:
if
(
!
(
type
==
xnav_eSetSignal_Conversion
))
return
XNAV__INVALIDOBJECT
;
break
;
case
pwr_cClass_ChanAo
:
case
pwr_cClass_ChanIo
:
if
(
!
(
type
==
xnav_eSetSignal_Test
))
return
XNAV__INVALIDOBJECT
;
break
;
default:
return
XNAV__INVALIDOBJECT
;
}
// Get the card object
if
(
chan_aref
.
Flags
.
b
.
Object
)
{
sts
=
gdh_GetParent
(
chan_aref
.
Objid
,
&
card_oid
);
if
(
EVEN
(
sts
))
return
sts
;
}
else
card_oid
=
chan_aref
.
Objid
;
sts
=
gdh_GetObjectClass
(
card_oid
,
&
card_cid
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetSuperClass
(
card_cid
,
&
cid
,
card_oid
);
while
(
ODD
(
sts
))
{
card_cid
=
cid
;
sts
=
gdh_GetSuperClass
(
card_cid
,
&
cid
,
card_oid
);
}
switch
(
card_cid
)
{
case
pwr_cClass_Ssab_BaseDiCard
:
case
pwr_cClass_Ssab_BaseDoCard
:
{
pwr_tUInt32
number
;
card_aref
=
cdh_ObjidToAref
(
card_oid
);
sts
=
gdh_ArefANameToAref
(
&
chan_aref
,
"Number"
,
&
aref
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
gdh_GetObjectInfoAttrref
(
&
aref
,
&
number
,
sizeof
(
number
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
number
<
16
)
{
sts
=
gdh_ArefANameToAref
(
&
card_aref
,
card_mask1
[
type
],
&
value_aref
);
if
(
EVEN
(
sts
))
return
sts
;
}
else
if
(
number
>=
16
&&
number
<
32
)
{
sts
=
gdh_ArefANameToAref
(
&
card_aref
,
card_mask2
[
type
],
&
value_aref
);
if
(
EVEN
(
sts
))
return
sts
;
number
-=
16
;
}
else
return
XNAV__INVALIDOBJECT
;
sts
=
gdh_GetObjectInfoAttrref
(
&
value_aref
,
&
valuemask
,
sizeof
(
valuemask
));
if
(
EVEN
(
sts
))
return
sts
;
if
(
on
)
valuemask
|=
1
<<
number
;
else
valuemask
&=
~
(
1
<<
number
);
sts
=
gdh_SetObjectInfoAttrref
(
&
value_aref
,
&
valuemask
,
sizeof
(
valuemask
));
if
(
EVEN
(
sts
))
return
sts
;
break
;
}
default:
;
}
// Set the flag in the channelobject
sts
=
gdh_ArefANameToAref
(
&
chan_aref
,
chan_attr
[
type
],
&
value_aref
);
if
(
EVEN
(
sts
))
return
sts
;
value_on
=
on
;
sts
=
gdh_SetObjectInfoAttrref
(
&
value_aref
,
&
value_on
,
sizeof
(
value_on
));
if
(
EVEN
(
sts
))
return
sts
;
return
XNAV__SUCCESS
;
}
xtt/lib/xtt/src/xtt_xtt.meth
View file @
a302eef9
$Object
PlcPgm
Sound
Di
Do
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