lasp/cpp_src/dsp/lasp_rtsignalviewer.h

91 lines
1.7 KiB
C
Raw Permalink Normal View History

2023-01-05 09:35:47 +00:00
// lasp_threadedaps.h
//
// Author: J.A. de Jong - ASCEE
//
// Description: Real Time Signal Viewer.
#pragma once
#include "lasp_mathtypes.h"
#include "lasp_threadedindatahandler.h"
#include "lasp_timebuffer.h"
#include <mutex>
/**
* \addtogroup dsp
* @{
*
* \addtogroup rt
* @{
*/
/**
* @brief Real time signal viewer. Shows envelope of the signal based on amount
* of history shown.
*/
class RtSignalViewer : public ThreadedInDataHandler<RtSignalViewer> {
2023-01-05 09:35:47 +00:00
/**
* @brief Storage for sensitivity values
*/
vd _sens;
/**
* @brief Storage for time samples
*/
TimeBuffer _tb;
/**
* @brief The amount of time history to show
*/
const d _approx_time_hist;
/**
* @brief The number of points to show
*/
const us _resolution;
/**
* @brief The channel to show
*/
const us _channel;
us _nsamples_per_point;
d _fs;
dmat _dat;
/**
* @brief Mutex only for _signalviewer.
*/
mutable std::mutex _sv_mtx;
public:
/**
* @brief
*
* @param mgr Stream manager
* @param approx_time_hist The *approximate* time history to show. The exact
* time history will be calculated such that there fits an integer number of
* samples in a single 'point'.
* @param resolution Number of time points
* @param channel The channel number
*/
RtSignalViewer(SmgrHandle mgr, const d approx_time_hist, const us resolution,
2023-01-05 09:35:47 +00:00
const us channel);
~RtSignalViewer();
/**
* @brief Returns a 2D array, with:
* - first column: time instances.
* - second column: minimum value of signal
* - third column: maximum value of signal
*
*/
dmat getCurrentValue() const;
void inCallback(const DaqData &);
void reset(const Daq *);
2023-01-05 09:35:47 +00:00
};
/** @} */
/** @} */