lasp/test/test_smgr.cpp

53 lines
1.1 KiB
C++
Raw Normal View History

#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();
DeviceInfoList devs = mgr.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.get();
}
}
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;
}