LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_uldaq_impl.h
Go to the documentation of this file.
1#pragma once
2#include "debugtrace.hpp"
3#include "lasp_uldaq_common.h"
4#include <algorithm>
5#include <cassert>
6#include <chrono>
7#include <iostream>
8#include <stdexcept>
9#include <thread>
10#include <vector>
11#include "lasp_daq.h"
12
13using std::atomic;
14using std::cerr;
15using std::endl;
16using rte = std::runtime_error;
17
18class InBufHandler;
19class OutBufHandler;
20
29class DT9837A : public Daq {
30
31 DaqDeviceHandle _handle = 0;
32 std::mutex _daqmutex;
33
37 std::thread _thread;
38
39
43 atomic<bool> _stopThread{false};
47 atomic<StreamStatus> _streamStatus;
48
49 const us _nFramesPerBlock;
50
57 void threadFcn(InDaqCallback inCallback, OutDaqCallback outcallback);
58
64 DaqDeviceHandle getHandle() const { return _handle; }
68 void sanityChecks() const;
69public:
70
77 DT9837A(const UlDaqDeviceInfo &devinfo, const DaqConfiguration &config);
78
79 virtual ~DT9837A();
80
86 bool isRunning() const;
87
91 void stop() override final;
92
93 friend class InBufHandler;
94 friend class OutBufHandler;
95
96 virtual void start(InDaqCallback inCallback,
97 OutDaqCallback outCallback) override final;
98
104 virtual StreamStatus getStreamStatus() const override {
105 return _streamStatus;
106 }
107};
108
Data translation DT9837A Daq device.
virtual void start(InDaqCallback inCallback, OutDaqCallback outCallback) override final
Start the Daq.
virtual StreamStatus getStreamStatus() const override
Obtain copy of stream status (thread-safe function)
void stop() override final
Stop the data-acquisition.
DT9837A(const UlDaqDeviceInfo &devinfo, const DaqConfiguration &config)
Create a DT9837A instance.
bool isRunning() const
Returns true when the stream is running.
virtual ~DT9837A()
Information regarding a stream.
Definition lasp_daq.h:39
Configuration of a DAQ device.
Base cass for all DAQ (Data Acquisition) interfaces. A DAQ can be a custom device,...
Definition lasp_daq.h:29
Specific helper for the input buffer.
UlDaq-specific device information. Adds a copy of the underlying DaqDeDaqDeviceDescriptor.
std::runtime_error rte
Definition lasp_daq.cpp:16
std::function< void(DaqData &)> OutDaqCallback
Definition lasp_daq.h:23
std::function< void(const DaqData &)> InDaqCallback
Definition lasp_daq.h:18
size_t us
We often use boolean values.
Definition lasp_types.h:29