Commit 437f374b authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Data parser function

parent 56916fb4
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment