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
235be748
Commit
235be748
authored
Oct 17, 2013
by
Claes Sjöfors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Xtt sevhist export all, and read exported file
parent
c2635224
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
335 additions
and
49 deletions
+335
-49
xtt/lib/xtt/gtk/xtt_sevhist_gtk.cpp
xtt/lib/xtt/gtk/xtt_sevhist_gtk.cpp
+29
-0
xtt/lib/xtt/gtk/xtt_sevhist_gtk.h
xtt/lib/xtt/gtk/xtt_sevhist_gtk.h
+6
-0
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
+5
-2
xtt/lib/xtt/gtk/xtt_xnav_gtk.h
xtt/lib/xtt/gtk/xtt_xnav_gtk.h
+1
-1
xtt/lib/xtt/src/xtt_sevhist.cpp
xtt/lib/xtt/src/xtt_sevhist.cpp
+224
-42
xtt/lib/xtt/src/xtt_sevhist.h
xtt/lib/xtt/src/xtt_sevhist.h
+5
-0
xtt/lib/xtt/src/xtt_trend.cpp
xtt/lib/xtt/src/xtt_trend.cpp
+50
-0
xtt/lib/xtt/src/xtt_xnav.h
xtt/lib/xtt/src/xtt_xnav.h
+1
-1
xtt/lib/xtt/src/xtt_xnav_command.cpp
xtt/lib/xtt/src/xtt_xnav_command.cpp
+14
-3
No files found.
xtt/lib/xtt/gtk/xtt_sevhist_gtk.cpp
View file @
235be748
...
@@ -102,6 +102,35 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
...
@@ -102,6 +102,35 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
timerid
->
add
(
1000
,
sevhist_scan
,
this
);
timerid
->
add
(
1000
,
sevhist_scan
,
this
);
}
}
XttSevHistGtk
::
XttSevHistGtk
(
void
*
parent_ctx
,
GtkWidget
*
parent_wid
,
const
char
*
name
,
GtkWidget
**
w
,
char
*
filename
,
int
*
sts
)
:
XttSevHist
(
parent_ctx
,
name
,
filename
,
sts
),
parent_widget
(
parent_wid
)
{
char
title
[
250
];
strncpy
(
title
,
name
,
sizeof
(
title
));
if
(
EVEN
(
*
sts
))
// Error from XttSevHist
return
;
*
sts
=
XNAV__SUCCESS
;
curve
=
new
GeCurveGtk
(
this
,
parent_widget
,
title
,
NULL
,
gcd
,
1
);
curve
->
close_cb
=
sevhist_close_cb
;
curve
->
help_cb
=
sevhist_help_cb
;
curve
->
enable
(
0
);
wow
=
new
CoWowGtk
(
parent_widget
);
timerid
=
wow
->
timer_new
();
timerid
->
add
(
1000
,
sevhist_scan
,
this
);
}
XttSevHistGtk
::~
XttSevHistGtk
()
XttSevHistGtk
::~
XttSevHistGtk
()
{
{
timerid
->
remove
();
timerid
->
remove
();
...
...
xtt/lib/xtt/gtk/xtt_sevhist_gtk.h
View file @
235be748
...
@@ -57,6 +57,12 @@ class XttSevHistGtk : public XttSevHist {
...
@@ -57,6 +57,12 @@ class XttSevHistGtk : public XttSevHist {
bool
*
sevhistobjectv
,
bool
*
sevhistobjectv
,
sevcli_tCtx
xn_scctx
,
sevcli_tCtx
xn_scctx
,
int
*
sts
);
int
*
sts
);
XttSevHistGtk
(
void
*
parent_ctx
,
GtkWidget
*
parent_wid
,
const
char
*
name
,
GtkWidget
**
w
,
char
*
filename
,
int
*
sts
);
~
XttSevHistGtk
();
~
XttSevHistGtk
();
};
};
...
...
xtt/lib/xtt/gtk/xtt_xnav_gtk.cpp
View file @
235be748
...
@@ -251,11 +251,14 @@ XttTrend *XNavGtk::xtttrend_new( char *name, pwr_tAttrRef *objar, pwr_tAttrRef *
...
@@ -251,11 +251,14 @@ XttTrend *XNavGtk::xtttrend_new( char *name, pwr_tAttrRef *objar, pwr_tAttrRef *
}
}
XttSevHist
*
XNavGtk
::
xttsevhist_new
(
char
*
name
,
pwr_tOid
*
oidv
,
pwr_tOName
*
anamev
,
pwr_tOName
*
onamev
,
XttSevHist
*
XNavGtk
::
xttsevhist_new
(
char
*
name
,
pwr_tOid
*
oidv
,
pwr_tOName
*
anamev
,
pwr_tOName
*
onamev
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
pwr_tStatus
*
sts
)
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
char
*
filename
,
pwr_tStatus
*
sts
)
{
{
GtkWidget
*
w
;
GtkWidget
*
w
;
return
new
XttSevHistGtk
(
this
,
parent_wid
,
name
,
&
w
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
scctx
,
sts
);
if
(
!
filename
)
return
new
XttSevHistGtk
(
this
,
parent_wid
,
name
,
&
w
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
scctx
,
sts
);
else
return
new
XttSevHistGtk
(
this
,
parent_wid
,
name
,
&
w
,
filename
,
sts
);
}
}
XttTCurve
*
XNavGtk
::
xtttcurve_new
(
char
*
name
,
pwr_tAttrRef
*
arefv
,
pwr_tStatus
*
sts
)
XttTCurve
*
XNavGtk
::
xtttcurve_new
(
char
*
name
,
pwr_tAttrRef
*
arefv
,
pwr_tStatus
*
sts
)
...
...
xtt/lib/xtt/gtk/xtt_xnav_gtk.h
View file @
235be748
...
@@ -79,7 +79,7 @@ class XNavGtk : public XNav {
...
@@ -79,7 +79,7 @@ class XNavGtk : public XNav {
pwr_tStatus
*
sts
);
pwr_tStatus
*
sts
);
XttSevHist
*
xttsevhist_new
(
char
*
name
,
pwr_tOid
*
oidv
,
pwr_tOName
*
anamev
,
XttSevHist
*
xttsevhist_new
(
char
*
name
,
pwr_tOid
*
oidv
,
pwr_tOName
*
anamev
,
pwr_tOName
*
onamev
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
pwr_tOName
*
onamev
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
pwr_tStatus
*
sts
);
char
*
filename
,
pwr_tStatus
*
sts
);
XttTCurve
*
xtttcurve_new
(
char
*
name
,
pwr_tAttrRef
*
arefv
,
pwr_tStatus
*
sts
);
XttTCurve
*
xtttcurve_new
(
char
*
name
,
pwr_tAttrRef
*
arefv
,
pwr_tStatus
*
sts
);
XttFast
*
xttfast_new
(
char
*
name
,
pwr_tAttrRef
*
objar
,
pwr_tStatus
*
sts
);
XttFast
*
xttfast_new
(
char
*
name
,
pwr_tAttrRef
*
objar
,
pwr_tStatus
*
sts
);
XAttOne
*
xattone_new
(
pwr_tAttrRef
*
objar
,
char
*
title
,
unsigned
int
priv
,
XAttOne
*
xattone_new
(
pwr_tAttrRef
*
objar
,
char
*
title
,
unsigned
int
priv
,
...
...
xtt/lib/xtt/src/xtt_sevhist.cpp
View file @
235be748
...
@@ -105,6 +105,18 @@ XttSevHist::XttSevHist( void *parent_ctx,
...
@@ -105,6 +105,18 @@ XttSevHist::XttSevHist( void *parent_ctx,
cdh_StrncpyCutOff
(
title
,
name
,
sizeof
(
title
),
1
);
cdh_StrncpyCutOff
(
title
,
name
,
sizeof
(
title
),
1
);
}
}
XttSevHist
::
XttSevHist
(
void
*
parent_ctx
,
const
char
*
name
,
char
*
filename
,
int
*
sts
)
:
xnav
(
parent_ctx
),
gcd
(
0
),
curve
(
0
),
rows
(
0
),
vsize
(
0
),
timerid
(
0
),
close_cb
(
0
),
help_cb
(
0
),
get_select_cb
(
0
),
first_scan
(
1
),
scctx
(
0
),
time_low_old
(
0
),
time_high_old
(
0
)
{
strncpy
(
title
,
filename
,
sizeof
(
title
));
*
sts
=
read_export
(
filename
);
}
XttSevHist
::~
XttSevHist
()
XttSevHist
::~
XttSevHist
()
{
{
}
}
...
@@ -120,8 +132,12 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
...
@@ -120,8 +132,12 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
void
*
vbuf
;
void
*
vbuf
;
pwr_tDeltaTime
trange
;
pwr_tDeltaTime
trange
;
if
(
curve
)
curve
->
set_clock_cursor
();
sevcli_get_itemdata
(
sts
,
scctx
,
oidv
[
0
],
anamev
[
0
],
from
,
to
,
1000
,
&
tbuf
,
&
vbuf
,
sevcli_get_itemdata
(
sts
,
scctx
,
oidv
[
0
],
anamev
[
0
],
from
,
to
,
1000
,
&
tbuf
,
&
vbuf
,
&
rows
,
&
vtype
,
&
vsize
);
&
rows
,
&
vtype
,
&
vsize
);
if
(
curve
)
curve
->
reset_cursor
();
if
(
EVEN
(
*
sts
))
if
(
EVEN
(
*
sts
))
return
0
;
return
0
;
...
@@ -230,8 +246,12 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
...
@@ -230,8 +246,12 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
pwr_tDeltaTime
trange
;
pwr_tDeltaTime
trange
;
if
(
curve
)
curve
->
set_clock_cursor
();
sevcli_get_objectitemdata
(
sts
,
scctx
,
oidv
[
0
],
anamev
[
0
],
from
,
to
,
1000
,
&
tbuf
,
&
vbuf
,
sevcli_get_objectitemdata
(
sts
,
scctx
,
oidv
[
0
],
anamev
[
0
],
from
,
to
,
1000
,
&
tbuf
,
&
vbuf
,
&
rows
,
&
histattrbuf
,
&
numAttributes
);
&
rows
,
&
histattrbuf
,
&
numAttributes
);
if
(
curve
)
curve
->
reset_cursor
();
if
(
EVEN
(
*
sts
))
if
(
EVEN
(
*
sts
))
return
0
;
return
0
;
...
@@ -393,8 +413,12 @@ int XttSevHist::get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
...
@@ -393,8 +413,12 @@ int XttSevHist::get_multidata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
}
}
if
(
!
sevhistobjectv
[
k
])
{
if
(
!
sevhistobjectv
[
k
])
{
if
(
curve
)
curve
->
set_clock_cursor
();
sevcli_get_itemdata
(
sts
,
scctx
,
oidv
[
k
],
anamev
[
k
],
from
,
to
,
1000
,
&
tbuf
,
&
vbuf
,
sevcli_get_itemdata
(
sts
,
scctx
,
oidv
[
k
],
anamev
[
k
],
from
,
to
,
1000
,
&
tbuf
,
&
vbuf
,
&
rows
,
&
vtype
,
&
vsize
);
&
rows
,
&
vtype
,
&
vsize
);
if
(
curve
)
curve
->
reset_cursor
();
if
(
EVEN
(
*
sts
))
if
(
EVEN
(
*
sts
))
return
0
;
return
0
;
...
@@ -864,63 +888,221 @@ int XttSevHist::sevhist_export_cb( void *ctx, pwr_tTime *from, pwr_tTime *to, in
...
@@ -864,63 +888,221 @@ int XttSevHist::sevhist_export_cb( void *ctx, pwr_tTime *from, pwr_tTime *to, in
int
rrows
;
int
rrows
;
char
timestr
[
40
];
char
timestr
[
40
];
FILE
*
fp
;
FILE
*
fp
;
pwr_tOName
oname
;
dcli_translate_filename
(
fname
,
filename
);
dcli_translate_filename
(
fname
,
filename
);
if
(
idx
==
-
1
)
{
// Export all attributes
fp
=
fopen
(
fname
,
"w"
);
if
(
!
fp
)
return
SEV__EXPORTFILE
;
for
(
int
j
=
0
;
j
<
sevhist
->
oid_cnt
;
j
++
)
{
sts
=
gdh_ObjidToName
(
sevhist
->
oidv
[
j
],
oname
,
sizeof
(
oname
),
cdh_mName_volumeStrict
);
if
(
EVEN
(
sts
))
continue
;
fprintf
(
fp
,
"# Attribute %s.%s
\n
"
,
oname
,
sevhist
->
anamev
[
j
]);
sevhist
->
curve
->
set_clock_cursor
();
sevcli_get_itemdata
(
&
sts
,
sevhist
->
scctx
,
sevhist
->
oidv
[
j
],
sevhist
->
anamev
[
j
],
*
from
,
*
to
,
rows
,
&
tbuf
,
&
vbuf
,
&
rrows
,
&
vtype
,
&
vsize
);
sevhist
->
curve
->
reset_cursor
();
if
(
EVEN
(
sts
))
return
sts
;
if
(
rrows
==
0
)
continue
;
fprintf
(
fp
,
"# Rows %d
\n
"
,
rrows
);
for
(
int
i
=
0
;
i
<
rrows
;
i
++
)
{
time_AtoAscii
(
&
tbuf
[
i
],
time_eFormat_DateAndTime
,
timestr
,
sizeof
(
timestr
));
fprintf
(
fp
,
"%s, "
,
timestr
);
switch
(
vtype
)
{
case
pwr_eType_Int32
:
case
pwr_eType_Int64
:
case
pwr_eType_Int16
:
case
pwr_eType_Int8
:
fprintf
(
fp
,
"%d"
,
((
pwr_tInt32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_UInt64
:
case
pwr_eType_UInt32
:
case
pwr_eType_UInt16
:
case
pwr_eType_UInt8
:
fprintf
(
fp
,
"%u"
,
((
pwr_tUInt32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Float32
:
fprintf
(
fp
,
"%g"
,
((
pwr_tFloat32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Float64
:
fprintf
(
fp
,
"%g"
,
((
pwr_tFloat64
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Boolean
:
fprintf
(
fp
,
"%d"
,
((
pwr_tBoolean
*
)
vbuf
)[
i
]);
break
;
default:
sts
=
SEV__CURVETYPE
;
}
fprintf
(
fp
,
"
\n
"
);
}
free
(
tbuf
);
free
(
vbuf
);
}
fclose
(
fp
);
}
else
{
sevhist
->
curve
->
set_clock_cursor
();
sevcli_get_itemdata
(
&
sts
,
sevhist
->
scctx
,
sevhist
->
oidv
[
idx
],
sevhist
->
anamev
[
idx
],
*
from
,
*
to
,
rows
,
&
tbuf
,
&
vbuf
,
&
rrows
,
&
vtype
,
&
vsize
);
sevhist
->
curve
->
reset_cursor
();
if
(
EVEN
(
sts
))
return
sts
;
if
(
rrows
==
0
)
{
return
SEV__NODATATIME
;
}
fp
=
fopen
(
fname
,
"w"
);
if
(
!
fp
)
return
SEV__EXPORTFILE
;
for
(
int
i
=
0
;
i
<
rrows
;
i
++
)
{
time_AtoAscii
(
&
tbuf
[
i
],
time_eFormat_DateAndTime
,
timestr
,
sizeof
(
timestr
));
fprintf
(
fp
,
"%s, "
,
timestr
);
switch
(
vtype
)
{
case
pwr_eType_Int32
:
case
pwr_eType_Int64
:
case
pwr_eType_Int16
:
case
pwr_eType_Int8
:
fprintf
(
fp
,
"%d"
,
((
pwr_tInt32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_UInt64
:
case
pwr_eType_UInt32
:
case
pwr_eType_UInt16
:
case
pwr_eType_UInt8
:
fprintf
(
fp
,
"%u"
,
((
pwr_tUInt32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Float32
:
fprintf
(
fp
,
"%g"
,
((
pwr_tFloat32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Float64
:
fprintf
(
fp
,
"%g"
,
((
pwr_tFloat64
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Boolean
:
fprintf
(
fp
,
"%d"
,
((
pwr_tBoolean
*
)
vbuf
)[
i
]);
break
;
default:
sts
=
SEV__CURVETYPE
;
}
fprintf
(
fp
,
"
\n
"
);
}
free
(
tbuf
);
free
(
vbuf
);
fclose
(
fp
);
sevcli_get_itemdata
(
&
sts
,
sevhist
->
scctx
,
sevhist
->
oidv
[
idx
],
sevhist
->
anamev
[
idx
],
*
from
,
*
to
,
printf
(
"Exported %d rows to file
\"
%s
\"
(%d)
\n
"
,
rrows
,
fname
,
idx
);
rows
,
&
tbuf
,
&
vbuf
,
&
rrows
,
&
vtype
,
&
vsize
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
rrows
==
0
)
{
if
(
EVEN
(
sts
))
return
SEV__NODATATIME
;
return
sts
;
}
}
return
SEV__SUCCESS
;
}
int
XttSevHist
::
read_export
(
char
*
filename
)
{
pwr_tFileName
fname
;
FILE
*
fp
;
char
line
[
200
];
int
idx
=
-
1
;
int
rowcnt
=
0
;
int
rows
;
char
timstr
[
40
];
double
y
;
char
*
s
;
pwr_tStatus
sts
;
pwr_tTime
t
;
fp
=
fopen
(
fname
,
"w"
);
dcli_translate_filename
(
fname
,
filename
);
fp
=
fopen
(
fname
,
"r"
);
if
(
!
fp
)
if
(
!
fp
)
return
SEV__EXPORTFILE
;
return
0
;
for
(
int
i
=
0
;
i
<
rrows
;
i
++
)
{
gcd
=
new
GeCurveData
(
curve_eDataType_DsTrend
);
time_AtoAscii
(
&
tbuf
[
i
],
time_eFormat_DateAndTime
,
timestr
,
sizeof
(
timestr
));
fprintf
(
fp
,
"%s, "
,
timestr
);
while
(
1
)
{
switch
(
vtype
)
{
sts
=
dcli_read_line
(
line
,
sizeof
(
line
),
fp
);
case
pwr_eType_Int32
:
if
(
!
sts
)
case
pwr_eType_Int64
:
case
pwr_eType_Int16
:
case
pwr_eType_Int8
:
fprintf
(
fp
,
"%d"
,
((
pwr_tInt32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_UInt64
:
case
pwr_eType_UInt32
:
case
pwr_eType_UInt16
:
case
pwr_eType_UInt8
:
fprintf
(
fp
,
"%u"
,
((
pwr_tUInt32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Float32
:
fprintf
(
fp
,
"%g"
,
((
pwr_tFloat32
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Float64
:
fprintf
(
fp
,
"%g"
,
((
pwr_tFloat64
*
)
vbuf
)[
i
]);
break
;
case
pwr_eType_Boolean
:
fprintf
(
fp
,
"%d"
,
((
pwr_tBoolean
*
)
vbuf
)[
i
]);
break
;
break
;
default:
sts
=
SEV__CURVETYPE
;
if
(
line
[
0
]
==
'#'
)
{
if
(
strncmp
(
&
line
[
2
],
"Attribute"
,
9
)
==
0
)
{
// New attribute
idx
++
;
strncpy
(
onamev
[
idx
],
&
line
[
12
],
sizeof
(
onamev
[
0
]));
s
=
strchr
(
onamev
[
idx
],
'.'
);
if
(
s
)
{
*
s
=
0
;
strncpy
(
anamev
[
idx
],
s
+
1
,
sizeof
(
anamev
[
0
]));
}
rowcnt
=
0
;
gcd
->
y_axis_type
[
idx
]
=
curve_eAxis_y
;
gcd
->
x_axis_type
[
idx
]
=
curve_eAxis_x
;
strcpy
(
gcd
->
x_format
[
idx
],
"%11t"
);
strcpy
(
gcd
->
y_name
[
idx
],
onamev
[
idx
]);
strcat
(
gcd
->
y_name
[
idx
],
"."
);
strcat
(
gcd
->
y_name
[
idx
],
anamev
[
idx
]);
}
else
if
(
strncmp
(
&
line
[
2
],
"Rows"
,
4
)
==
0
)
{
if
(
idx
<
0
)
continue
;
sscanf
(
&
line
[
7
],
"%d"
,
&
rows
);
gcd
->
rows
[
idx
]
=
rows
;
gcd
->
x_data
[
idx
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
gcd
->
y_data
[
idx
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
}
}
else
{
if
(
idx
<
0
)
continue
;
strncpy
(
timstr
,
line
,
23
);
timstr
[
23
]
=
0
;
sscanf
(
&
line
[
25
],
"%lf"
,
&
y
);
if
(
rowcnt
>
gcd
->
rows
[
idx
])
continue
;
time_AsciiToA
(
timstr
,
&
t
);
gcd
->
x_data
[
idx
][
rowcnt
]
=
(
double
)
t
.
tv_sec
+
(
double
)
1e-9
*
t
.
tv_nsec
;
gcd
->
y_data
[
idx
][
rowcnt
]
=
y
;
rowcnt
++
;
}
}
fprintf
(
fp
,
"
\n
"
);
}
}
free
(
tbuf
);
if
(
idx
>
0
)
free
(
vbuf
)
;
gcd
->
rows
[
idx
-
1
]
=
rowcnt
;
fclose
(
fp
)
;
gcd
->
cols
=
idx
+
1
;
printf
(
"Exported %d rows to file
\"
%s
\"
(%d)
\n
"
,
rrows
,
fname
,
idx
);
fclose
(
fp
);
if
(
EVEN
(
sts
))
gcd
->
get_borders
();
return
sts
;
gcd
->
get_default_axis
();
gcd
->
select_color
(
0
);
strcpy
(
gcd
->
x_format
[
0
],
"%11t"
);
return
SEV__SUCCESS
;
if
(
curve
)
{
curve
->
set_curvedata
(
gcd
);
// This will free the old gcd
curve
->
configure_curves
();
curve
->
configure_axes
();
curve
->
redraw
();
}
return
1
;
}
}
void
XttSevHist
::
sevhist_help_cb
(
void
*
ctx
)
void
XttSevHist
::
sevhist_help_cb
(
void
*
ctx
)
...
...
xtt/lib/xtt/src/xtt_sevhist.h
View file @
235be748
...
@@ -104,6 +104,10 @@ class XttSevHist {
...
@@ -104,6 +104,10 @@ class XttSevHist {
bool
*
sevhistobjectv
,
bool
*
sevhistobjectv
,
sevcli_tCtx
xn_scctx
,
sevcli_tCtx
xn_scctx
,
int
*
sts
);
int
*
sts
);
XttSevHist
(
void
*
parent_ctx
,
const
char
*
name
,
char
*
filename
,
int
*
sts
);
//! Destructor
//! Destructor
virtual
~
XttSevHist
();
virtual
~
XttSevHist
();
...
@@ -115,6 +119,7 @@ class XttSevHist {
...
@@ -115,6 +119,7 @@ class XttSevHist {
int
get_multidata
(
pwr_tStatus
*
sts
,
pwr_tTime
from
,
pwr_tTime
to
);
int
get_multidata
(
pwr_tStatus
*
sts
,
pwr_tTime
from
,
pwr_tTime
to
);
void
curve_add
(
pwr_tOid
oid
,
pwr_tOName
aname
,
pwr_tOName
oname
,
void
curve_add
(
pwr_tOid
oid
,
pwr_tOName
aname
,
pwr_tOName
oname
,
bool
sevhistobject
);
bool
sevhistobject
);
int
read_export
(
char
*
filename
);
static
void
sevhist_close_cb
(
void
*
ctx
);
static
void
sevhist_close_cb
(
void
*
ctx
);
static
void
sevhist_increase_period_cb
(
void
*
ctx
);
static
void
sevhist_increase_period_cb
(
void
*
ctx
);
...
...
xtt/lib/xtt/src/xtt_trend.cpp
View file @
235be748
...
@@ -262,6 +262,31 @@ XttTrend::XttTrend( void *parent_ctx,
...
@@ -262,6 +262,31 @@ XttTrend::XttTrend( void *parent_ctx,
gcd
->
get_default_axis
();
gcd
->
get_default_axis
();
gcd
->
select_color
(
0
);
gcd
->
select_color
(
0
);
// Try to find unit and descripion
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
pwr_tAName
aname
;
char
unit
[
40
];
char
description
[
80
];
pwr_tStatus
lsts
;
char
*
s
;
strcpy
(
aname
,
object_name
[
i
]);
if
(
(
s
=
strrchr
(
aname
,
'.'
)))
*
s
=
0
;
strcat
(
aname
,
".Unit"
);
lsts
=
gdh_GetObjectInfo
(
aname
,
unit
,
sizeof
(
unit
));
if
(
ODD
(
lsts
))
strncpy
(
gcd
->
y_unit
[
i
],
unit
,
sizeof
(
gcd
->
y_unit
[
0
]));
strcpy
(
aname
,
object_name
[
i
]);
if
(
(
s
=
strrchr
(
aname
,
'.'
)))
*
s
=
0
;
strcat
(
aname
,
".Description"
);
lsts
=
gdh_GetObjectInfo
(
aname
,
description
,
sizeof
(
description
));
if
(
ODD
(
lsts
))
strncpy
(
gcd
->
y_description
[
i
],
description
,
sizeof
(
gcd
->
y_description
[
0
]));
}
if
(
!
trend_list
)
{
if
(
!
trend_list
)
{
// Use axis values from plotgroup object
// Use axis values from plotgroup object
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
...
@@ -353,6 +378,31 @@ XttTrend::XttTrend( void *parent_ctx,
...
@@ -353,6 +378,31 @@ XttTrend::XttTrend( void *parent_ctx,
}
}
gcd
->
x_axis_type
[
0
]
=
curve_eAxis_x
;
gcd
->
x_axis_type
[
0
]
=
curve_eAxis_x
;
// Try to find unit
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
pwr_tAName
aname
;
char
unit
[
40
];
char
description
[
80
];
pwr_tStatus
lsts
;
char
*
s
;
strcpy
(
aname
,
object_name
[
i
]);
if
(
(
s
=
strrchr
(
aname
,
'.'
)))
*
s
=
0
;
strcat
(
aname
,
".Unit"
);
lsts
=
gdh_GetObjectInfo
(
aname
,
unit
,
sizeof
(
unit
));
if
(
ODD
(
lsts
))
strncpy
(
gcd
->
y_unit
[
i
],
unit
,
sizeof
(
gcd
->
y_unit
[
0
]));
strcpy
(
aname
,
object_name
[
i
]);
if
(
(
s
=
strrchr
(
aname
,
'.'
)))
*
s
=
0
;
strcat
(
aname
,
".Description"
);
lsts
=
gdh_GetObjectInfo
(
aname
,
description
,
sizeof
(
description
));
if
(
ODD
(
lsts
))
strncpy
(
gcd
->
y_description
[
i
],
description
,
sizeof
(
gcd
->
y_description
[
0
]));
}
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
gcd
->
y_data
[
i
]
=
(
double
*
)
calloc
(
1
,
8
*
max_points
);
gcd
->
y_data
[
i
]
=
(
double
*
)
calloc
(
1
,
8
*
max_points
);
...
...
xtt/lib/xtt/src/xtt_xnav.h
View file @
235be748
...
@@ -350,7 +350,7 @@ class XNav {
...
@@ -350,7 +350,7 @@ class XNav {
pwr_tStatus
*
sts
)
{
return
0
;}
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
XttSevHist
*
xttsevhist_new
(
char
*
name
,
pwr_tOid
*
oidv
,
pwr_tOName
*
aname
,
virtual
XttSevHist
*
xttsevhist_new
(
char
*
name
,
pwr_tOid
*
oidv
,
pwr_tOName
*
aname
,
pwr_tOName
*
oname
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
pwr_tOName
*
oname
,
bool
*
sevhistobjectv
,
sevcli_tCtx
scctx
,
pwr_tStatus
*
sts
)
{
return
0
;}
char
*
filename
,
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
XttTCurve
*
xtttcurve_new
(
char
*
name
,
pwr_tAttrRef
*
arefv
,
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
XttTCurve
*
xtttcurve_new
(
char
*
name
,
pwr_tAttrRef
*
arefv
,
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
XttFast
*
xttfast_new
(
char
*
name
,
pwr_tAttrRef
*
objar
,
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
XttFast
*
xttfast_new
(
char
*
name
,
pwr_tAttrRef
*
objar
,
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
XAttOne
*
xattone_new
(
pwr_tAttrRef
*
objar
,
char
*
title
,
unsigned
int
priv
,
virtual
XAttOne
*
xattone_new
(
pwr_tAttrRef
*
objar
,
char
*
title
,
unsigned
int
priv
,
...
...
xtt/lib/xtt/src/xtt_xnav_command.cpp
View file @
235be748
...
@@ -3689,9 +3689,20 @@ static int xnav_open_func( void *client_data,
...
@@ -3689,9 +3689,20 @@ static int xnav_open_func( void *client_data,
pwr_tAName
aname
;
pwr_tAName
aname
;
char
*
s
;
char
*
s
;
bool
sevHistObjectFound
=
false
;
bool
sevHistObjectFound
=
false
;
pwr_tFileName
file_str
;
// Command is "OPEN HISTORY"
// Command is "OPEN HISTORY"
if
(
ODD
(
dcli_get_qualifier
(
"/FILE"
,
file_str
,
sizeof
(
file_str
))))
{
// Open exported history file
hist
=
xnav
->
xttsevhist_new
(
title_str
,
0
,
0
,
0
,
0
,
0
,
file_str
,
&
sts
);
if
(
ODD
(
sts
))
{
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
}
return
XNAV__SUCCESS
;
}
/* Get the name qualifier */
/* Get the name qualifier */
if
(
ODD
(
dcli_get_qualifier
(
"dcli_arg2"
,
name_str
,
sizeof
(
name_str
))))
{
if
(
ODD
(
dcli_get_qualifier
(
"dcli_arg2"
,
name_str
,
sizeof
(
name_str
))))
{
if
(
name_str
[
0
]
!=
'/'
)
if
(
name_str
[
0
]
!=
'/'
)
...
@@ -3930,21 +3941,21 @@ static int xnav_open_func( void *client_data,
...
@@ -3930,21 +3941,21 @@ static int xnav_open_func( void *client_data,
}
}
if
(
plotgroup_found
)
{
if
(
plotgroup_found
)
{
hist
=
xnav
->
xttsevhist_new
(
title_str
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
xnav
->
scctx
,
&
sts
);
hist
=
xnav
->
xttsevhist_new
(
title_str
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
xnav
->
scctx
,
0
,
&
sts
);
if
(
ODD
(
sts
))
{
if
(
ODD
(
sts
))
{
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
}
}
}
}
else
if
(
sevHistObjectFound
)
{
else
if
(
sevHistObjectFound
)
{
hist
=
xnav
->
xttsevhist_new
(
title_str
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
xnav
->
scctx
,
&
sts
);
hist
=
xnav
->
xttsevhist_new
(
title_str
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
xnav
->
scctx
,
0
,
&
sts
);
if
(
ODD
(
sts
))
{
if
(
ODD
(
sts
))
{
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
}
}
}
}
else
{
else
{
hist
=
xnav
->
xttsevhist_new
(
title_str
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
xnav
->
scctx
,
&
sts
);
hist
=
xnav
->
xttsevhist_new
(
title_str
,
oidv
,
anamev
,
onamev
,
sevhistobjectv
,
xnav
->
scctx
,
0
,
&
sts
);
if
(
ODD
(
sts
))
{
if
(
ODD
(
sts
))
{
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
help_cb
=
xnav_sevhist_help_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
hist
->
get_select_cb
=
xnav_sevhist_get_select_cb
;
...
...
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