mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-04 14:17:50 -04:00
Websocket spectrum: pass timestamp in payload meta
This commit is contained in:
parent
8e291df439
commit
50cf4e7372
@ -19,6 +19,7 @@
|
|||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "util/timeutil.h"
|
||||||
#include "wsspectrum.h"
|
#include "wsspectrum.h"
|
||||||
|
|
||||||
WSSpectrum::WSSpectrum(QObject *parent) :
|
WSSpectrum::WSSpectrum(QObject *parent) :
|
||||||
@ -124,6 +125,7 @@ void WSSpectrum::newSpectrum(
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 elapsed = m_timer.restart();
|
qint64 elapsed = m_timer.restart();
|
||||||
|
uint64_t nowMs = TimeUtil::nowms();
|
||||||
QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
|
QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
|
||||||
QByteArray payload;
|
QByteArray payload;
|
||||||
|
|
||||||
@ -132,6 +134,7 @@ void WSSpectrum::newSpectrum(
|
|||||||
spectrum,
|
spectrum,
|
||||||
fftSize,
|
fftSize,
|
||||||
elapsed,
|
elapsed,
|
||||||
|
nowMs,
|
||||||
centerFrequency,
|
centerFrequency,
|
||||||
bandwidth,
|
bandwidth,
|
||||||
linear
|
linear
|
||||||
@ -153,20 +156,18 @@ void WSSpectrum::buildPayload(
|
|||||||
const std::vector<Real>& spectrum,
|
const std::vector<Real>& spectrum,
|
||||||
int fftSize,
|
int fftSize,
|
||||||
int64_t fftTimeMs,
|
int64_t fftTimeMs,
|
||||||
|
uint64_t timestampMs,
|
||||||
uint64_t centerFrequency,
|
uint64_t centerFrequency,
|
||||||
int bandwidth,
|
int bandwidth,
|
||||||
bool linear
|
bool linear
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
float refLevel = -30.0;
|
|
||||||
float powerRange = 70.0;
|
|
||||||
QBuffer buffer(&bytes);
|
QBuffer buffer(&bytes);
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
buffer.write((char*) ¢erFrequency, sizeof(uint64_t)); // 0
|
buffer.write((char*) ¢erFrequency, sizeof(uint64_t)); // 0
|
||||||
buffer.write((char*) &fftTimeMs, sizeof(int64_t)); // 8
|
buffer.write((char*) &fftTimeMs, sizeof(int64_t)); // 8
|
||||||
buffer.write((char*) &fftSize, sizeof(int)); // 16
|
buffer.write((char*) ×tampMs, sizeof(uint64_t)); // 16
|
||||||
buffer.write((char*) &refLevel, sizeof(float)); // 20
|
buffer.write((char*) &fftSize, sizeof(int)); // 24
|
||||||
buffer.write((char*) &powerRange, sizeof(float)); // 24
|
|
||||||
buffer.write((char*) &bandwidth, sizeof(int)); // 28
|
buffer.write((char*) &bandwidth, sizeof(int)); // 28
|
||||||
int linearInt = linear ? 1 : 0;
|
int linearInt = linear ? 1 : 0;
|
||||||
buffer.write((char*) &linearInt, sizeof(int)); // 32
|
buffer.write((char*) &linearInt, sizeof(int)); // 32
|
||||||
|
@ -74,6 +74,7 @@ private:
|
|||||||
const std::vector<Real>& spectrum,
|
const std::vector<Real>& spectrum,
|
||||||
int fftSize,
|
int fftSize,
|
||||||
int64_t fftTimeMs,
|
int64_t fftTimeMs,
|
||||||
|
uint64_t timestampMs,
|
||||||
uint64_t centerFrequency,
|
uint64_t centerFrequency,
|
||||||
int bandwidth,
|
int bandwidth,
|
||||||
bool linear
|
bool linear
|
||||||
|
Loading…
x
Reference in New Issue
Block a user