LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_streammgr.cpp
Go to the documentation of this file.
1#include "lasp_streammgr.h"
3#include <pybind11/numpy.h>
4#include <pybind11/pybind11.h>
5#include <pybind11/stl.h>
6#include <functional>
7#include <stdint.h>
8
9using std::cerr;
10namespace py = pybind11;
11
12void init_streammgr(py::module &m) {
13
15 // It should not be deleted.
16 py::class_<StreamMgr, std::shared_ptr<StreamMgr>> smgr(
17 m, "StreamMgr");
18
19 py::enum_<StreamMgr::StreamType>(smgr, "StreamType")
20 .value("input", StreamMgr::StreamType::input)
21 .value("output", StreamMgr::StreamType::output);
22
23 smgr.def("startStream", &StreamMgr::startStream);
24 smgr.def("stopStream", &StreamMgr::stopStream);
25 smgr.def_static("getInstance", []() {
27 });
28 smgr.def("stopAllStreams", &StreamMgr::stopAllStreams);
29
30 smgr.def("setSiggen", &StreamMgr::setSiggen);
31 smgr.def("getDeviceInfo", &StreamMgr::getDeviceInfo);
32 smgr.def("getStreamStatus", &StreamMgr::getStreamStatus);
33 smgr.def("isStreamRunningOK", &StreamMgr::isStreamRunningOK);
34 smgr.def("isStreamRunning", &StreamMgr::isStreamRunning);
35 smgr.def("getDaq", &StreamMgr::getDaq, py::return_value_policy::reference);
36 smgr.def(
37 "rescanDAQDevices",
38 [](StreamMgr &smgr, bool background) {
39 // A pure C++ callback is the second argument to rescanDAQDevices, which
40 // cannot be wrapped to Pybind11. Only the one without callback is
41 // forwarded here to Python code.
42 smgr.rescanDAQDevices(background);
43 },
44 py::arg("background") = false);
45}
Stream manager. Used to manage the input and output streams. Implemented as a singleton: only one str...
static std::shared_ptr< StreamMgr > getInstance()
Get access to stream manager instance.
Daq::StreamStatus getStreamStatus(const StreamType type) const
Get the streamstatus object corresponding to a given stream.
DeviceInfoList getDeviceInfo() const
Obtain a list of devices currently available. When the StreamMgr is first created,...
void startStream(const DaqConfiguration &config)
Start a stream based on given configuration.
const Daq * getDaq(StreamType type) const
Get DAQ pointer for a given stream. Gives a nullptr if stream is not running.
bool isStreamRunning(const StreamType type) const
void setSiggen(std::shared_ptr< Siggen > s)
Set active signal generator for output streams. Only one ‘Siggen’ is active at the same time....
void stopAllStreams()
Stop and delete all streams. Also called on destruction of the StreamMgr.
@ output
Output stream.
@ input
Input stream.
void stopStream(const StreamType stype)
Stop stream of given type (input / output/ duplex);.
bool isStreamRunningOK(const StreamType type) const
Check if a certain stream is running. If running with no errors, it returns true. If an error occured...
void init_streammgr(py::module &m)