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
cdeacae0
Commit
cdeacae0
authored
Aug 13, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ge dynamic TimeoutColor added
parent
796de9df
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
472 additions
and
49 deletions
+472
-49
java/jpwr/jopg/src/Dyn.java
java/jpwr/jopg/src/Dyn.java
+132
-47
xtt/lib/ge/src/ge_attrnav.cpp
xtt/lib/ge/src/ge_attrnav.cpp
+1
-0
xtt/lib/ge/src/ge_dyn.cpp
xtt/lib/ge/src/ge_dyn.cpp
+299
-0
xtt/lib/ge/src/ge_dyn.h
xtt/lib/ge/src/ge_dyn.h
+37
-1
xtt/lib/xtt/src/xtt_xnav.cpp
xtt/lib/xtt/src/xtt_xnav.cpp
+3
-1
No files found.
java/jpwr/jopg/src/Dyn.java
View file @
cdeacae0
This diff is collapsed.
Click to expand it.
xtt/lib/ge/src/ge_attrnav.cpp
View file @
cdeacae0
...
...
@@ -110,6 +110,7 @@ static attrnav_sEnumElement elem_dyn_type1[] = {
static
attrnav_sEnumElement
elem_dyn_type2
[]
=
{
{
(
int
)
ge_mDynType2_DigTextColor
,
"DigTextColor"
},
{
(
int
)
ge_mDynType2_TimeoutColor
,
"TimeoutColor"
},
{
0
,
""
}};
static
attrnav_sEnumElement
elem_dyn_type1_tone
[]
=
{
...
...
xtt/lib/ge/src/ge_dyn.cpp
View file @
cdeacae0
...
...
@@ -454,6 +454,8 @@ GeDyn::GeDyn( const GeDyn& x) :
e
=
new
GeAxis
((
const
GeAxis
&
)
*
elem
);
break
;
case
ge_mDynType2_DigTextColor
:
e
=
new
GeDigTextColor
((
const
GeDigTextColor
&
)
*
elem
);
break
;
case
ge_mDynType2_TimeoutColor
:
e
=
new
GeTimeoutColor
((
const
GeTimeoutColor
&
)
*
elem
);
break
;
default:
;
}
switch
(
elem
->
action_type1
)
{
...
...
@@ -593,6 +595,7 @@ void GeDyn::open( ifstream& fp)
case
ge_eSave_BarChart
:
e
=
(
GeDynElem
*
)
new
GeBarChart
(
this
);
break
;
case
ge_eSave_Axis
:
e
=
(
GeDynElem
*
)
new
GeAxis
(
this
);
break
;
case
ge_eSave_DigTextColor
:
e
=
(
GeDynElem
*
)
new
GeDigTextColor
(
this
);
break
;
case
ge_eSave_TimeoutColor
:
e
=
(
GeDynElem
*
)
new
GeTimeoutColor
(
this
);
break
;
case
ge_eSave_HostObject
:
e
=
(
GeDynElem
*
)
new
GeHostObject
(
this
);
break
;
case
ge_eSave_DigSound
:
e
=
(
GeDynElem
*
)
new
GeDigSound
(
this
);
break
;
case
ge_eSave_XY_Curve
:
e
=
(
GeDynElem
*
)
new
GeXY_Curve
(
this
);
break
;
...
...
@@ -1512,6 +1515,9 @@ GeDynElem *GeDyn::create_dyn2_element( int mask, int instance)
case
ge_mDynType2_DigTextColor
:
e
=
(
GeDynElem
*
)
new
GeDigTextColor
(
this
);
break
;
case
ge_mDynType2_TimeoutColor
:
e
=
(
GeDynElem
*
)
new
GeTimeoutColor
(
this
);
break
;
default:
;
}
return
e
;
...
...
@@ -1694,6 +1700,9 @@ GeDynElem *GeDyn::copy_element( GeDynElem& x)
case
ge_mDynType2_DigTextColor
:
e
=
(
GeDynElem
*
)
new
GeDigTextColor
((
GeDigTextColor
&
)
x
);
break
;
case
ge_mDynType2_TimeoutColor
:
e
=
(
GeDynElem
*
)
new
GeTimeoutColor
((
GeTimeoutColor
&
)
x
);
break
;
default:
;
}
}
...
...
@@ -9801,6 +9810,296 @@ int GeAxis::export_java( grow_tObject object, ofstream& fp, bool first, char *va
return
1
;
}
void
GeTimeoutColor
::
get_attributes
(
attr_sItem
*
attrinfo
,
int
*
item_count
)
{
int
i
=
*
item_count
;
strcpy
(
attrinfo
[
i
].
name
,
"TimeoutColor.Time"
);
attrinfo
[
i
].
value
=
&
time
;
attrinfo
[
i
].
type
=
glow_eType_Double
;
attrinfo
[
i
++
].
size
=
sizeof
(
time
);
strcpy
(
attrinfo
[
i
].
name
,
"TimeoutColor.Color"
);
attrinfo
[
i
].
value
=
&
color
;
attrinfo
[
i
].
type
=
glow_eType_Color
;
attrinfo
[
i
++
].
size
=
sizeof
(
color
);
*
item_count
=
i
;
}
void
GeTimeoutColor
::
save
(
ofstream
&
fp
)
{
fp
<<
int
(
ge_eSave_TimeoutColor
)
<<
endl
;
fp
<<
int
(
ge_eSave_TimeoutColor_time
)
<<
FSPACE
<<
time
<<
endl
;
fp
<<
int
(
ge_eSave_TimeoutColor_color
)
<<
FSPACE
<<
int
(
color
)
<<
endl
;
fp
<<
int
(
ge_eSave_End
)
<<
endl
;
}
void
GeTimeoutColor
::
open
(
ifstream
&
fp
)
{
int
type
;
int
end_found
=
0
;
int
tmp
;
char
dummy
[
40
];
for
(;;)
{
if
(
!
fp
.
good
())
{
fp
.
clear
();
fp
.
getline
(
dummy
,
sizeof
(
dummy
));
printf
(
"** Read error GeTimeoutColor:
\"
%d %s
\"\n
"
,
type
,
dummy
);
}
fp
>>
type
;
switch
(
type
)
{
case
ge_eSave_TimeoutColor
:
break
;
case
ge_eSave_TimeoutColor_time
:
fp
>>
time
;
break
;
case
ge_eSave_TimeoutColor_color
:
fp
>>
tmp
;
color
=
(
glow_eDrawType
)
tmp
;
break
;
case
ge_eSave_End
:
end_found
=
1
;
break
;
default:
cout
<<
"GeTimeoutColor:open syntax error"
<<
endl
;
fp
.
getline
(
dummy
,
sizeof
(
dummy
));
}
if
(
end_found
)
break
;
}
}
int
GeTimeoutColor
::
connect
(
grow_tObject
object
,
glow_sTraceData
*
trace_data
)
{
color
=
dyn
->
get_color1
(
object
,
color
);
if
(
color
<
0
||
color
>=
glow_eDrawType__
)
{
printf
(
"** Color out of range, TimeoutColor
\n
"
);
return
0
;
}
time_FloatToD
(
&
dtime
,
time
);
trace_data
->
p
=
&
pdummy
;
first_scan
=
true
;
init_done
=
false
;
double
scan_time
;
switch
(
dyn
->
cycle
)
{
case
glow_eCycle_Slow
:
scan_time
=
dyn
->
graph
->
scan_time
;
break
;
case
glow_eCycle_Fast
:
scan_time
=
dyn
->
graph
->
fast_scan_time
;
break
;
default:
scan_time
=
1
;
}
scan_interval
=
(
int
)(
time
/
scan_time
/
2
);
if
(
scan_interval
<
1
)
scan_interval
=
1
;
interval_cnt
=
0
;
return
1
;
}
int
GeTimeoutColor
::
disconnect
(
grow_tObject
object
)
{
subid
=
pwr_cNSubid
;
return
1
;
}
int
GeTimeoutColor
::
scan
(
grow_tObject
object
)
{
if
(
(
init_done
&&
subid
.
nid
==
0
&&
subid
.
rix
==
0
)
||
dyn
->
ignore_color
)
return
1
;
interval_cnt
++
;
if
(
interval_cnt
<
scan_interval
)
return
1
;
interval_cnt
=
0
;
if
(
!
init_done
)
{
// Get subid from other dyn element
for
(
GeDynElem
*
elem
=
dyn
->
elements
;
elem
;
elem
=
elem
->
next
)
{
if
(
elem
==
this
)
continue
;
switch
(
elem
->
dyn_type1
)
{
case
ge_mDynType1_DigLowColor
:
subid
=
((
GeDigLowColor
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_DigColor
:
subid
=
((
GeDigColor
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_DigError
:
subid
=
((
GeDigError
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_DigWarning
:
subid
=
((
GeDigWarning
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_DigFlash
:
subid
=
((
GeDigFlash
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Invisible
:
subid
=
((
GeInvisible
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_DigBorder
:
subid
=
((
GeDigBorder
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_DigText
:
subid
=
((
GeDigText
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Value
:
subid
=
((
GeValue
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_AnalogColor
:
subid
=
((
GeAnalogColor
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Rotate
:
subid
=
((
GeRotate
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Move
:
if
(
((
GeMove
*
)
elem
)
->
move_x_p
)
subid
=
((
GeMove
*
)
elem
)
->
move_x_subid
;
else
if
(
((
GeMove
*
)
elem
)
->
move_x_p
)
subid
=
((
GeMove
*
)
elem
)
->
move_y_subid
;
else
if
(
((
GeMove
*
)
elem
)
->
scale_x_p
)
subid
=
((
GeMove
*
)
elem
)
->
scale_x_subid
;
else
if
(
((
GeMove
*
)
elem
)
->
scale_y_p
)
subid
=
((
GeMove
*
)
elem
)
->
scale_y_subid
;
break
;
case
ge_mDynType1_DigShift
:
subid
=
((
GeDigShift
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_AnalogShift
:
subid
=
((
GeAnalogShift
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Video
:
break
;
case
ge_mDynType1_Animation
:
subid
=
((
GeAnimation
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Bar
:
subid
=
((
GeBar
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Trend
:
if
(
((
GeTrend
*
)
elem
)
->
p1
)
subid
=
((
GeTrend
*
)
elem
)
->
subid1
;
else
if
(
((
GeTrend
*
)
elem
)
->
p2
)
subid
=
((
GeTrend
*
)
elem
)
->
subid2
;
break
;
case
ge_mDynType1_FillLevel
:
subid
=
((
GeFillLevel
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_FastCurve
:
subid
=
((
GeFastCurve
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_AnalogText
:
subid
=
((
GeAnalogText
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Table
:
break
;
case
ge_mDynType1_StatusColor
:
subid
=
((
GeStatusColor
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_HostObject
:
break
;
case
ge_mDynType1_DigSound
:
subid
=
((
GeDigSound
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_XY_Curve
:
if
(
((
GeXY_Curve
*
)
elem
)
->
update_p
)
subid
=
((
GeXY_Curve
*
)
elem
)
->
update_subid
;
else
if
(
((
GeXY_Curve
*
)
elem
)
->
noofpoints_p
)
subid
=
((
GeXY_Curve
*
)
elem
)
->
noofpoints_subid
;
break
;
case
ge_mDynType1_DigCommand
:
subid
=
((
GeDigCommand
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType1_Pie
:
subid
=
((
GePie
*
)
elem
)
->
subid
[
0
];
break
;
case
ge_mDynType1_BarChart
:
subid
=
((
GeBarChart
*
)
elem
)
->
subid
[
0
];
break
;
default:
;
}
switch
(
elem
->
dyn_type2
)
{
case
ge_mDynType2_Axis
:
if
(
((
GeAxis
*
)
elem
)
->
min_value_p
)
subid
=
((
GeAxis
*
)
elem
)
->
min_value_subid
;
else
if
(
((
GeAxis
*
)
elem
)
->
max_value_p
)
subid
=
((
GeAxis
*
)
elem
)
->
max_value_subid
;
break
;
case
ge_mDynType2_DigTextColor
:
subid
=
((
GeDigTextColor
*
)
elem
)
->
subid
;
break
;
case
ge_mDynType2_TimeoutColor
:
break
;
default:
;
}
if
(
!
(
subid
.
nid
==
0
&&
subid
.
rix
==
0
))
break
;
}
init_done
=
true
;
return
1
;
}
pwr_tBoolean
val
;
pwr_tTime
last_update
,
current_time
,
timeout_time
;
pwr_tStatus
sts
;
sts
=
gdh_GetSubscriptionOldness
(
subid
,
0
,
&
last_update
,
0
);
if
(
EVEN
(
sts
))
return
1
;
time_Aadd
(
&
timeout_time
,
&
last_update
,
&
dtime
);
time_GetTime
(
&
current_time
);
if
(
time_Acomp
(
&
current_time
,
&
timeout_time
)
>=
0
)
val
=
1
;
else
val
=
0
;
if
(
!
first_scan
)
{
if
(
old_value
==
val
)
{
// No change since last time
return
1
;
}
}
else
first_scan
=
false
;
if
(
dyn
->
total_dyn_type1
&
ge_mDynType1_Tone
)
{
if
(
val
)
{
if
(
color
>=
(
glow_eDrawType
)
glow_eDrawTone__
)
{
if
(
dyn
->
reset_color
)
grow_ResetObjectFillColor
(
object
);
// Previous color might be a tone
grow_SetObjectFillColor
(
object
,
color
);
}
else
grow_SetObjectColorTone
(
object
,
(
glow_eDrawTone
)
color
);
dyn
->
ignore_color
=
true
;
}
else
{
if
(
color
>=
(
glow_eDrawType
)
glow_eDrawTone__
)
grow_ResetObjectFillColor
(
object
);
grow_ResetObjectColorTone
(
object
);
dyn
->
reset_color
=
true
;
}
}
else
{
if
(
val
)
{
grow_SetObjectFillColor
(
object
,
color
);
dyn
->
ignore_color
=
true
;
}
else
{
grow_ResetObjectFillColor
(
object
);
dyn
->
reset_color
=
true
;
}
}
old_value
=
val
;
return
1
;
}
void
GeHostObject
::
get_attributes
(
attr_sItem
*
attrinfo
,
int
*
item_count
)
{
int
i
=
*
item_count
;
...
...
xtt/lib/ge/src/ge_dyn.h
View file @
cdeacae0
...
...
@@ -124,6 +124,7 @@
ge_eDynPrio_HostObject
,
ge_eDynPrio_Invisible
,
ge_eDynPrio_DigFlash
,
ge_eDynPrio_TimeoutColor
,
ge_eDynPrio_DigError
,
ge_eDynPrio_DigWarning
,
ge_eDynPrio_AnalogColor
,
...
...
@@ -217,7 +218,8 @@
typedef
enum
{
ge_mDynType2_No
=
0
,
ge_mDynType2_Axis
=
1
<<
0
,
ge_mDynType2_DigTextColor
=
1
<<
1
ge_mDynType2_DigTextColor
=
1
<<
1
,
ge_mDynType2_TimeoutColor
=
1
<<
2
}
ge_mDynType2
;
//! Action types.
...
...
@@ -325,6 +327,7 @@
ge_eSave_BarChart
=
37
,
ge_eSave_Axis
=
38
,
ge_eSave_DigTextColor
=
39
,
ge_eSave_TimeoutColor
=
40
,
ge_eSave_PopupMenu
=
50
,
ge_eSave_SetDig
=
51
,
ge_eSave_ResetDig
=
52
,
...
...
@@ -527,6 +530,8 @@
ge_eSave_Axis_maxvalue_attr
=
3801
,
ge_eSave_DigTextColor_attribute
=
3900
,
ge_eSave_DigTextColor_color
=
3901
,
ge_eSave_TimeoutColor_time
=
4000
,
ge_eSave_TimeoutColor_color
=
4001
,
ge_eSave_PopupMenu_ref_object
=
5000
,
ge_eSave_SetDig_attribute
=
5100
,
ge_eSave_SetDig_instance
=
5101
,
...
...
@@ -2774,6 +2779,37 @@ class GeAxis : public GeDynElem {
};
//! Set the supplied border color when the signal is high.
class
GeTimeoutColor
:
public
GeDynElem
{
public:
double
time
;
//!< Timeout time
glow_eDrawType
color
;
//!< Fill color to set when the subscription is old.
pwr_tBoolean
*
p
;
pwr_tSubid
subid
;
bool
first_scan
;
bool
init_done
;
pwr_tBoolean
old_value
;
pwr_tDeltaTime
dtime
;
int
scan_interval
;
int
interval_cnt
;
GeTimeoutColor
(
GeDyn
*
e_dyn
)
:
GeDynElem
(
e_dyn
,
ge_mDynType1_No
,
ge_mDynType2_TimeoutColor
,
ge_mActionType1_No
,
ge_mActionType2_No
,
ge_eDynPrio_TimeoutColor
),
time
(
5
),
color
(
glow_eDrawType_Inherit
)
{}
GeTimeoutColor
(
const
GeTimeoutColor
&
x
)
:
GeDynElem
(
x
.
dyn
,
x
.
dyn_type1
,
x
.
dyn_type2
,
x
.
action_type1
,
x
.
action_type2
,
x
.
prio
),
time
(
x
.
time
),
color
(
x
.
color
)
{}
void
get_attributes
(
attr_sItem
*
attrinfo
,
int
*
item_count
);
void
save
(
ofstream
&
fp
);
void
open
(
ifstream
&
fp
);
int
connect
(
grow_tObject
object
,
glow_sTraceData
*
trace_data
);
int
disconnect
(
grow_tObject
object
);
int
scan
(
grow_tObject
object
);
};
/*@}*/
#endif
...
...
xtt/lib/xtt/src/xtt_xnav.cpp
View file @
cdeacae0
...
...
@@ -3212,8 +3212,10 @@ int XNavGbl::load_config( XNav *xnav)
{
int
sts
;
if
(
strcmp
(
xnav
->
opplace_name
,
""
)
==
0
)
if
(
strcmp
(
xnav
->
opplace_name
,
""
)
==
0
)
{
xnav
->
opplace_p
=
(
pwr_sClass_OpPlace
*
)
calloc
(
1
,
sizeof
(
pwr_sClass_OpPlace
));
return
0
;
}
strcpy
(
OpPlace
,
xnav
->
opplace_name
);
...
...
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