2023-06-07 19:49:07 +00:00
|
|
|
/* #define DEBUGTRACE_ENABLED */
|
|
|
|
#include "debugtrace.hpp"
|
|
|
|
#include "lasp_config.h"
|
|
|
|
|
|
|
|
#if LASP_HAS_ULDAQ == 1
|
|
|
|
#include "lasp_uldaq_common.h"
|
|
|
|
#include "lasp_daq.h"
|
|
|
|
|
|
|
|
string getErrMsg(UlError err) {
|
|
|
|
string errstr;
|
|
|
|
errstr.reserve(ERR_MSG_LEN);
|
|
|
|
char errmsg[ERR_MSG_LEN];
|
|
|
|
errstr = "UlDaq API Error: ";
|
|
|
|
ulGetErrMsg(err, errmsg);
|
|
|
|
errstr += errmsg;
|
|
|
|
return errstr;
|
|
|
|
}
|
|
|
|
void showErr(string errstr) {
|
|
|
|
std::cerr << "\b\n**************** UlDAQ backend error **********\n";
|
|
|
|
std::cerr << errstr << std::endl;
|
|
|
|
std::cerr << "***********************************************\n\n";
|
|
|
|
}
|
|
|
|
void showErr(UlError err) {
|
|
|
|
if (err != ERR_NO_ERROR)
|
|
|
|
showErr(getErrMsg(err));
|
|
|
|
}
|
2023-06-11 12:45:28 +00:00
|
|
|
|
2023-06-07 19:49:07 +00:00
|
|
|
|
|
|
|
void throwOnPossibleUlException(UlError err) {
|
|
|
|
if (err == ERR_NO_ERROR) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
string errstr = getErrMsg(err);
|
|
|
|
showErr(errstr);
|
|
|
|
Daq::StreamStatus::StreamError serr;
|
|
|
|
if ((int)err == 18) {
|
|
|
|
serr = Daq::StreamStatus::StreamError::inputXRun;
|
|
|
|
} else if ((int)err == 19) {
|
|
|
|
serr = Daq::StreamStatus::StreamError::outputXRun;
|
|
|
|
} else {
|
|
|
|
serr = Daq::StreamStatus::StreamError::driverError;
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Daq::StreamException(serr, errstr);
|
|
|
|
}
|
2023-06-11 12:45:28 +00:00
|
|
|
#endif
|