LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_uldaq_common.cpp
Go to the documentation of this file.
1/* #define DEBUGTRACE_ENABLED */
2#include "debugtrace.hpp"
3#include "lasp_config.h"
4
5#if LASP_HAS_ULDAQ == 1
6#include "lasp_uldaq_common.h"
7#include "lasp_daq.h"
8
9string getErrMsg(UlError err) {
10 string errstr;
11 errstr.reserve(ERR_MSG_LEN);
12 char errmsg[ERR_MSG_LEN];
13 errstr = "UlDaq API Error: ";
14 ulGetErrMsg(err, errmsg);
15 errstr += errmsg;
16 return errstr;
17}
18void showErr(string errstr) {
19 std::cerr << "\b\n**************** UlDAQ backend error **********\n";
20 std::cerr << errstr << std::endl;
21 std::cerr << "***********************************************\n\n";
22}
23void showErr(UlError err) {
24 if (err != ERR_NO_ERROR)
25 showErr(getErrMsg(err));
26}
27
28
29void throwOnPossibleUlException(UlError err) {
30 if (err == ERR_NO_ERROR) {
31 return;
32 }
33 string errstr = getErrMsg(err);
34 showErr(errstr);
36 if ((int)err == 18) {
38 } else if ((int)err == 19) {
40 } else {
42 }
43
44 throw Daq::StreamException(serr, errstr);
45}
46#endif
Used for internal throwing of exceptions.
Definition lasp_daq.h:90
void throwOnPossibleUlException(UlError err)
Throws an appropriate stream exception based on the UlError number. The mapping is based on the error...
void showErr(UlError err)
Print error message to stderr.
string getErrMsg(UlError err)
Return a string corresponding to the UlDaq API error.