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.
|
|
|
|
*/
|
2023-06-09 08:43:04 +00:00
|
|
|
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
|
|
|
|
*/
|
2023-06-07 19:49:07 +00:00
|
|
|
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;
|
|
|
|
|
2023-06-09 08:43:04 +00:00
|
|
|
void inCallback(const DaqData &);
|
|
|
|
void reset(const Daq *);
|
2023-01-05 09:35:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
/** @} */
|