18 #include <boost/crc.hpp> 19 #include <boost/cstdint.hpp> 32 m_fileName(
"test.sdriq"),
39 setObjectName(
"FileSink");
51 setObjectName(
"FileRecord");
70 setFileName(QString(
"rec%1_%2.sdriq").
arg(deviceUID).
arg(QDateTime::currentDateTimeUtc().toString(
"yyyy-MM-ddTHH_mm_ss_zzz")));
72 setFileName(QString(
"rec%1_%2_%3.sdriq").
arg(deviceUID).
arg(istream).
arg(QDateTime::currentDateTimeUtc().toString(
"yyyy-MM-ddTHH_mm_ss_zzz")));
76 void FileRecord::feed(
const SampleVector::const_iterator& begin,
const SampleVector::const_iterator& end,
bool positiveOnly)
91 m_sampleFile.write(reinterpret_cast<const char*>(&*(begin)), (end - begin)*
sizeof(
Sample));
109 qDebug() <<
"FileRecord::startRecording";
121 qDebug() <<
"FileRecord::stopRecording";
135 qDebug() <<
"FileRecord::handleMessage: DSPSignalNotification: m_inputSampleRate: " <<
m_sampleRate 160 std::time_t ts = time(0);
170 sampleFile.read((
char *) &header,
sizeof(
Header));
171 boost::crc_32_type
crc32;
172 crc32.process_bytes(&header, 28);
173 return header.crc32 == crc32.checksum();
178 boost::crc_32_type
crc32;
179 crc32.process_bytes(&header, 28);
180 header.
crc32 = crc32.checksum();
181 sampleFile.write((
const char *) &header,
sizeof(
Header));
void setFileName(const QString &filename)
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool positiveOnly)
void handleConfigure(const QString &fileName)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
virtual bool handleMessage(const Message &message)
Processing of a message. Returns true if message has actually been processed.
qint64 getCenterFrequency() const
void genUniqueFileName(uint deviceUID, int istream=-1)
quint64 m_centerFrequency
static bool match(const Message *message)
std::ofstream m_sampleFile
int getSampleRate() const
uint32_t crc32(const uint8_t *buf, int len)
static bool readHeader(std::ifstream &samplefile, Header &header)
returns true if CRC checksum is correct else false