2022-10-12 13:02:42 +00:00
|
|
|
#include "lasp_daq.h"
|
|
|
|
#include "lasp_deviceinfo.h"
|
|
|
|
#include "lasp_streammgr.h"
|
|
|
|
#include "lasp_ppm.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) {
|
|
|
|
|
|
|
|
StreamMgr& mgr = StreamMgr::getInstance();
|
2023-05-25 18:41:16 +00:00
|
|
|
DeviceInfoList devs = mgr.getDeviceInfo();
|
2022-10-12 13:02:42 +00:00
|
|
|
|
|
|
|
DeviceInfo *mon_device = nullptr;
|
|
|
|
for (auto &d : devs) {
|
2023-05-25 18:41:16 +00:00
|
|
|
|
|
|
|
string name_lower = d->device_name;
|
2022-10-12 13:02:42 +00:00
|
|
|
transform(name_lower.begin(), name_lower.end(), name_lower.begin(),
|
|
|
|
::tolower);
|
|
|
|
if (name_lower.find("monitor") != string::npos) {
|
2023-05-25 18:41:16 +00:00
|
|
|
mon_device = d.get();
|
2022-10-12 13:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mon_device) {
|
|
|
|
cerr << "Could not find monitor device\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
cout << "Found device. Name: " << mon_device->device_name << endl;
|
|
|
|
|
|
|
|
DaqConfiguration config(*mon_device);
|
|
|
|
config.inchannel_config.at(0).enabled = true;
|
|
|
|
config.inchannel_config.at(1).enabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
mgr.startStream(config);
|
|
|
|
|
|
|
|
PPMHandler ppm(mgr);
|
|
|
|
ppm.start();
|
|
|
|
|
|
|
|
cout << "Press <enter> to stop" << endl;
|
|
|
|
cin.get();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|