49 lines
1010 B
C++
49 lines
1010 B
C++
|
#include "lasp_daq.h"
|
||
|
#include "lasp_deviceinfo.h"
|
||
|
#include <memory>
|
||
|
#include <vector>
|
||
|
|
||
|
using namespace std;
|
||
|
bool inCallback(const DaqData& d) {
|
||
|
|
||
|
d.toFloat();
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
int main(int argc, const char **const argv) {
|
||
|
|
||
|
std::vector<DeviceInfo> devs = DeviceInfo::getDeviceInfo();
|
||
|
|
||
|
DeviceInfo *mon_device = nullptr;
|
||
|
for (auto &d : devs) {
|
||
|
|
||
|
string name_lower = d.device_name;
|
||
|
transform(name_lower.begin(), name_lower.end(), name_lower.begin(),
|
||
|
::tolower);
|
||
|
if (name_lower.find("monitor") != string::npos) {
|
||
|
mon_device = &d;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!mon_device) {
|
||
|
cerr << "Could not find monitor device\n";
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
DaqConfiguration config(*mon_device);
|
||
|
config.inchannel_config[0].enabled = true;
|
||
|
config.inchannel_config[1].enabled = true;
|
||
|
|
||
|
unique_ptr<Daq> daq = Daq::createDaq(*mon_device, config);
|
||
|
InDaqCallback icb = inCallback;
|
||
|
OutDaqCallback ocb;
|
||
|
|
||
|
daq->start(icb, ocb);
|
||
|
|
||
|
cout << "Press <enter> to stop" << endl;
|
||
|
cin.get();
|
||
|
|
||
|
return 0;
|
||
|
}
|