From 2d018f7968366aff99da76b3715cb14a33a90d74 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 21 Feb 2016 11:01:43 +0100 Subject: [PATCH] SDRdaemon plugin: reactivate address setting in GUI. Put in place a stram locked status. --- plugins/samplesource/sdrdaemon/sdrdaemonbuffer.cpp | 13 +++++++++++++ plugins/samplesource/sdrdaemon/sdrdaemonbuffer.h | 4 +++- plugins/samplesource/sdrdaemon/sdrdaemongui.ui | 8 ++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.cpp b/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.cpp index 12a0791cf..3b2d80735 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.cpp +++ b/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.cpp @@ -27,6 +27,7 @@ const int SDRdaemonBuffer::m_iqSampleSize = 2 * m_sampleSize; SDRdaemonBuffer::SDRdaemonBuffer(uint32_t rateDivider) : m_rateDivider(rateDivider), m_sync(false), + m_syncLock(false), m_lz4(false), m_inCount(0), m_lz4InBuffer(0), @@ -74,6 +75,18 @@ bool SDRdaemonBuffer::readMeta(char *array, uint32_t length) if (m_crc64.calculate_crc((uint8_t *)array, sizeof(MetaData) - 8) == metaData->m_crc) { + // sync condition: + if (m_currentMeta.m_blockSize > 0) + { + uint32_t nbBlocks = m_currentMeta.m_nbBytes / m_currentMeta.m_blockSize; + m_syncLock = nbBlocks + (m_lz4 ? 2 : 1) == m_nbBlocks; + //qDebug("SDRdaemonBuffer::readMeta: m_nbBlocks: %d:%d %s", nbBlocks, m_nbBlocks, (m_syncLock ? "locked" : "unlocked")); + } + else + { + m_syncLock = false; + } + memcpy((void *) &m_dataCRC, (const void *) &array[sizeof(MetaData)], 8); m_nbBlocks = 0; m_inCount = 0; diff --git a/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.h b/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.h index 89aa0660b..8e48aaf9d 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.h +++ b/plugins/samplesource/sdrdaemon/sdrdaemonbuffer.h @@ -69,6 +69,7 @@ public: const MetaData& getCurrentMeta() const { return m_currentMeta; } void updateBlockCounts(uint32_t nbBytesReceived); bool isSync() const { return m_sync; } + bool isSyncLocked() const { return m_syncLock; } static const int m_udpPayloadSize; static const int m_sampleSize; @@ -83,7 +84,8 @@ private: void printMeta(MetaData *metaData); uint32_t m_rateDivider; //!< Number of times per seconds the samples are fetched - bool m_sync; //!< Meta data acquired (Stream synchronized) + bool m_sync; //!< Meta data acquired + bool m_syncLock; //!< Meta data expected (Stream synchronized) bool m_lz4; //!< Stream is compressed with LZ4 MetaData m_currentMeta; //!< Stored current meta data CRC64 m_crc64; //!< CRC64 calculator diff --git a/plugins/samplesource/sdrdaemon/sdrdaemongui.ui b/plugins/samplesource/sdrdaemon/sdrdaemongui.ui index 4c8745541..d4e5132d0 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemongui.ui +++ b/plugins/samplesource/sdrdaemon/sdrdaemongui.ui @@ -235,7 +235,7 @@ - false + true @@ -261,7 +261,7 @@ - false + true @@ -280,7 +280,7 @@ - false + true @@ -289,7 +289,7 @@ - OK + Set