Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Achim Morschhauser
GeomagLogger
Commits
437f374b
Commit
437f374b
authored
Nov 06, 2018
by
Achim Morschhauser
Browse files
Data parser function
parent
56916fb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/driver_obs_obsdaq.cpp
View file @
437f374b
...
...
@@ -278,6 +278,9 @@ int driver_obs_obsdaq::freerun(double freq) {
data_obs_vector
data
;
// The receive buffer
char
buf
[
200
];
// Data parser function
int
(
driver_obs_obsdaq
::*
parse_data
)(
data_obs_vector
*
data
,
char
*
buf
);
//std::function<int(data_obs_vector* data, char* buf)> &parse_data;
/////////////////////////////////////////////////////////////////////////
//
...
...
@@ -301,10 +304,20 @@ int driver_obs_obsdaq::freerun(double freq) {
send
(
"#PP00000000"
);
usleep
(
2e5
);
// Use ASCII mode
//checked_send("#CS","",0,1);
// Use binary mode
checked_send
(
"#CS"
,
""
,
0
,
1
);
// Flush
usleep
(
1e6
);
flush
();
if
(
freq
<
10.0
){
// Use ASCII mode
checked_send
(
"#CS"
,
""
,
0
,
1
);
parse_data
=
&
driver_obs_obsdaq
::
parse_data_ascii
;
}
else
{
// Use binary mode
checked_send
(
"#CB"
,
""
,
0
,
1
);
parse_data
=
&
driver_obs_obsdaq
::
parse_data_bin
;
}
/////////////////////////////////////////////////////////////////////////
//
...
...
@@ -327,12 +340,10 @@ int driver_obs_obsdaq::freerun(double freq) {
data
.
set_time
(
&
recv_time
);
// Parse data from answer
if
(
(
this
->*
parse_data
)(
&
data
,
buf
)
>=
0
){
if
(
parse_data_ascii
(
&
data
,
buf
)
>=
0
){
//parse_data_ascii(&data, buf);
// Calibrate the measurement/ASCII
driver_obs
::
cal
->
calibrate
(
&
data
);
// Calibrate the measurement/ASCII
driver_obs
::
cal
->
calibrate
(
&
data
);
}
...
...
Write
Preview
Supports
Markdown
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