1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

File record default file name fix (1)

This commit is contained in:
f4exb 2018-05-08 11:03:09 +02:00
parent 4bb63bbf1b
commit 0981d04904
17 changed files with 37 additions and 57 deletions

View File

@ -48,10 +48,7 @@ AirspyInput::AirspyInput(DeviceSourceAPI *deviceAPI) :
m_running(false)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -50,10 +50,7 @@ AirspyHFInput::AirspyHFInput(DeviceSourceAPI *deviceAPI) :
m_running(false)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -45,10 +45,7 @@ BladerfInput::BladerfInput(DeviceSourceAPI *deviceAPI) :
m_running(false)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);

View File

@ -49,10 +49,7 @@ FCDProInput::FCDProInput(DeviceSourceAPI *deviceAPI) :
m_running(false)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -48,10 +48,7 @@ FCDProPlusInput::FCDProPlusInput(DeviceSourceAPI *deviceAPI) :
m_running(false)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -49,9 +49,7 @@ HackRFInput::HackRFInput(DeviceSourceAPI *deviceAPI) :
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
@ -260,9 +258,18 @@ bool HackRFInput::handleMessage(const Message& message)
MsgFileRecord& conf = (MsgFileRecord&) message;
qDebug() << "HackRFInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
if (conf.getStartStop()) {
if (conf.getStartStop())
{
if (m_settings.m_fileRecordName.size() != 0) {
m_fileSink->setFileName(m_settings.m_fileRecordName);
} else {
m_fileSink->setFileName(QString("rec_%1_%2.sdriq").arg(m_deviceAPI->getDeviceUID()).arg(QDateTime::currentDateTimeUtc().toString("yyyy-MM-ddThh:mm:ss")));
}
m_fileSink->startRecording();
} else {
}
else
{
m_fileSink->stopRecording();
}

View File

@ -40,6 +40,7 @@ void HackRFInputSettings::resetToDefaults()
m_iqCorrection = false;
m_devSampleRate = 2400000;
m_linkTxFrequency = false;
m_fileRecordName = "";
}
QByteArray HackRFInputSettings::serialize() const

View File

@ -18,6 +18,7 @@
#define _HACKRF_HACKRFINPUTSETTINGS_H_
#include <QtGlobal>
#include <QString>
struct HackRFInputSettings {
typedef enum {
@ -39,6 +40,7 @@ struct HackRFInputSettings {
bool m_dcBlock;
bool m_iqCorrection;
bool m_linkTxFrequency;
QString m_fileRecordName;
HackRFInputSettings();
void resetToDefaults();

View File

@ -57,9 +57,7 @@ LimeSDRInput::LimeSDRInput(DeviceSourceAPI *deviceAPI) :
resumeTxBuddies();
resumeRxBuddies();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -41,9 +41,7 @@ PerseusInput::PerseusInput(DeviceSourceAPI *deviceAPI) :
m_perseusDescriptor(0)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -55,9 +55,7 @@ PlutoSDRInput::PlutoSDRInput(DeviceSourceAPI *deviceAPI) :
openDevice();
resumeBuddies();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -53,9 +53,7 @@ RTLSDRInput::RTLSDRInput(DeviceSourceAPI *deviceAPI) :
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -63,9 +63,7 @@ SDRdaemonSourceInput::SDRdaemonSourceInput(DeviceSourceAPI *deviceAPI) :
m_sampleFifo.setSize(96000 * 4);
m_SDRdaemonUDPHandler = new SDRdaemonSourceUDPHandler(&m_sampleFifo, m_deviceAPI);
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -48,10 +48,7 @@ SDRPlayInput::SDRPlayInput(DeviceSourceAPI *deviceAPI) :
m_running(false)
{
openDevice();
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
}

View File

@ -41,9 +41,7 @@ TestSourceInput::TestSourceInput(DeviceSourceAPI *deviceAPI) :
m_running(false),
m_masterTimer(deviceAPI->getMasterTimer())
{
char recFileNameCStr[30];
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
m_fileSink = new FileRecord(std::string(recFileNameCStr));
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
if (!m_sampleFifo.setSize(96000 * 4)) {

View File

@ -7,7 +7,7 @@
FileRecord::FileRecord() :
BasebandSampleSink(),
m_fileName(std::string("test.sdriq")),
m_fileName("test.sdriq"),
m_sampleRate(0),
m_centerFrequency(0),
m_recordOn(false),
@ -17,9 +17,9 @@ FileRecord::FileRecord() :
setObjectName("FileSink");
}
FileRecord::FileRecord(const std::string& filename) :
FileRecord::FileRecord(const QString& filename) :
BasebandSampleSink(),
m_fileName(std::string(filename)),
m_fileName(filename),
m_sampleRate(0),
m_centerFrequency(0),
m_recordOn(false),
@ -34,7 +34,7 @@ FileRecord::~FileRecord()
stopRecording();
}
void FileRecord::setFileName(const std::string& filename)
void FileRecord::setFileName(const QString& filename)
{
if (!m_recordOn)
{
@ -75,7 +75,7 @@ void FileRecord::startRecording()
if (!m_sampleFile.is_open())
{
qDebug() << "FileRecord::startRecording";
m_sampleFile.open(m_fileName.c_str(), std::ios::binary);
m_sampleFile.open(m_fileName.toStdString().c_str(), std::ios::binary);
m_recordOn = true;
m_recordStart = true;
m_byteCount = 0;
@ -110,7 +110,7 @@ bool FileRecord::handleMessage(const Message& message)
}
}
void FileRecord::handleConfigure(const std::string& fileName)
void FileRecord::handleConfigure(const QString& fileName)
{
if (fileName != m_fileName)
{

View File

@ -23,12 +23,12 @@ public:
};
FileRecord();
FileRecord(const std::string& filename);
FileRecord(const QString& filename);
virtual ~FileRecord();
quint64 getByteCount() const { return m_byteCount; }
void setFileName(const std::string& filename);
void setFileName(const QString& filename);
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
virtual void start();
@ -39,7 +39,7 @@ public:
static void readHeader(std::ifstream& samplefile, Header& header);
private:
std::string m_fileName;
QString m_fileName;
qint32 m_sampleRate;
quint64 m_centerFrequency;
bool m_recordOn;
@ -47,7 +47,7 @@ private:
std::ofstream m_sampleFile;
quint64 m_byteCount;
void handleConfigure(const std::string& fileName);
void handleConfigure(const QString& fileName);
void writeHeader();
};