2015-07-28 21:54:17 +00:00
|
|
|
#ifndef INCLUDE_FILESINK_H
|
|
|
|
#define INCLUDE_FILESINK_H
|
|
|
|
|
2016-10-02 20:29:04 +00:00
|
|
|
#include <dsp/basebandsamplesink.h>
|
2015-07-28 21:54:17 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include <ctime>
|
2018-03-20 12:49:21 +00:00
|
|
|
#include "export.h"
|
2016-05-12 08:31:57 +00:00
|
|
|
|
|
|
|
class Message;
|
2015-07-28 21:54:17 +00:00
|
|
|
|
2018-03-03 19:23:38 +00:00
|
|
|
class SDRBASE_API FileRecord : public BasebandSampleSink {
|
2015-07-28 21:54:17 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
struct Header
|
|
|
|
{
|
2018-01-25 17:39:54 +00:00
|
|
|
qint32 sampleRate;
|
2015-07-28 21:54:17 +00:00
|
|
|
quint64 centerFrequency;
|
|
|
|
std::time_t startTimeStamp;
|
2018-01-25 17:39:54 +00:00
|
|
|
quint32 sampleSize;
|
2015-07-28 21:54:17 +00:00
|
|
|
};
|
|
|
|
|
2016-10-02 08:30:58 +00:00
|
|
|
FileRecord();
|
2018-05-08 09:03:09 +00:00
|
|
|
FileRecord(const QString& filename);
|
2016-10-02 08:30:58 +00:00
|
|
|
virtual ~FileRecord();
|
2016-05-12 08:31:57 +00:00
|
|
|
|
2015-07-28 21:54:17 +00:00
|
|
|
quint64 getByteCount() const { return m_byteCount; }
|
|
|
|
|
2018-05-08 09:03:09 +00:00
|
|
|
void setFileName(const QString& filename);
|
2018-05-11 07:08:20 +00:00
|
|
|
void genUniqueFileName(uint deviceUID);
|
2015-07-28 21:54:17 +00:00
|
|
|
|
2015-08-25 06:24:23 +00:00
|
|
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
2015-08-13 06:51:33 +00:00
|
|
|
virtual void start();
|
|
|
|
virtual void stop();
|
2015-08-14 03:00:28 +00:00
|
|
|
virtual bool handleMessage(const Message& message);
|
2015-07-28 21:54:17 +00:00
|
|
|
void startRecording();
|
|
|
|
void stopRecording();
|
|
|
|
static void readHeader(std::ifstream& samplefile, Header& header);
|
|
|
|
|
|
|
|
private:
|
2018-05-08 09:03:09 +00:00
|
|
|
QString m_fileName;
|
2018-01-25 17:39:54 +00:00
|
|
|
qint32 m_sampleRate;
|
2015-07-28 21:54:17 +00:00
|
|
|
quint64 m_centerFrequency;
|
|
|
|
bool m_recordOn;
|
|
|
|
bool m_recordStart;
|
|
|
|
std::ofstream m_sampleFile;
|
|
|
|
quint64 m_byteCount;
|
|
|
|
|
2018-05-08 09:03:09 +00:00
|
|
|
void handleConfigure(const QString& fileName);
|
2015-07-28 21:54:17 +00:00
|
|
|
void writeHeader();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_FILESINK_H
|