mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-12-04 10:03:36 -05:00
Test MI: removed IQ record feature
This commit is contained in:
parent
cda483ba69
commit
32dde97fbf
@ -38,7 +38,6 @@
|
||||
#include "testmi.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(TestMI::MsgConfigureTestSource, Message)
|
||||
MESSAGE_CLASS_DEFINITION(TestMI::MsgFileRecord, Message)
|
||||
MESSAGE_CLASS_DEFINITION(TestMI::MsgStartStop, Message)
|
||||
|
||||
|
||||
@ -51,13 +50,6 @@ TestMI::TestMI(DeviceAPI *deviceAPI) :
|
||||
{
|
||||
m_mimoType = MIMOAsynchronous;
|
||||
m_sampleMIFifo.init(2, 96000 * 4);
|
||||
|
||||
std::vector<FileRecord*>::iterator it = m_fileSinks.begin();
|
||||
|
||||
for (; it != m_fileSinks.end(); ++it) {
|
||||
*it = nullptr;
|
||||
}
|
||||
|
||||
m_deviceAPI->setNbSourceStreams(2);
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
@ -71,18 +63,6 @@ TestMI::~TestMI()
|
||||
if (m_running) {
|
||||
stopRx();
|
||||
}
|
||||
|
||||
std::vector<FileRecord*>::iterator it = m_fileSinks.begin();
|
||||
int istream = 0;
|
||||
|
||||
for (; it != m_fileSinks.end(); ++it, istream++)
|
||||
{
|
||||
if (*it)
|
||||
{
|
||||
m_deviceAPI->removeAncillarySink(*it, istream);
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestMI::destroy()
|
||||
@ -233,38 +213,6 @@ bool TestMI::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgFileRecord::match(message))
|
||||
{
|
||||
MsgFileRecord& conf = (MsgFileRecord&) message;
|
||||
qDebug() << "TestMI::handleMessage: MsgFileRecord: " << conf.getStartStop();
|
||||
int istream = conf.getStreamIndex();
|
||||
|
||||
if (conf.getStartStop())
|
||||
{
|
||||
if (m_fileSinks[istream])
|
||||
{
|
||||
m_deviceAPI->removeAncillarySink(m_fileSinks[istream], istream);
|
||||
delete m_fileSinks[istream];
|
||||
}
|
||||
|
||||
if (m_settings.m_fileRecordName.size() != 0) {
|
||||
m_fileSinks[istream] = new FileRecord(QString("%1_%2.sdriq"). arg(m_settings.m_fileRecordName).arg(istream));
|
||||
} else {
|
||||
m_fileSinks[istream] = new FileRecord(QString("%1.sdriq").arg(FileRecordInterface::genUniqueFileName(m_deviceAPI->getDeviceUID(), istream)));
|
||||
}
|
||||
|
||||
m_deviceAPI->addAncillarySink(m_fileSinks[istream], istream);
|
||||
m_fileSinks[istream]->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileSinks[istream]->stopRecording();
|
||||
delete m_fileSinks[istream];
|
||||
m_fileSinks[istream] = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgStartStop::match(message))
|
||||
{
|
||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
||||
@ -299,7 +247,6 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
||||
DeviceSettingsKeys deviceSettingsKeys;
|
||||
|
||||
qDebug() << "TestMI::applySettings: common: "
|
||||
<< " m_fileRecordName: " << settings.m_fileRecordName
|
||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
|
||||
@ -476,12 +423,6 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|
||||
|| (m_settings.m_streams[istream].m_fcPos != settings.m_streams[istream].m_fcPos) || force)
|
||||
{
|
||||
int sampleRate = settings.m_streams[istream].m_sampleRate/(1<<settings.m_streams[istream].m_log2Decim);
|
||||
DSPSignalNotification notif(sampleRate, settings.m_streams[istream].m_centerFrequency);
|
||||
|
||||
if (m_fileSinks[istream]) {
|
||||
m_fileSinks[istream]->handleMessage(notif); // forward to file sink
|
||||
}
|
||||
|
||||
DSPMIMOSignalNotification *engineNotif = new DSPMIMOSignalNotification(
|
||||
sampleRate, settings.m_streams[istream].m_centerFrequency, true, istream);
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif);
|
||||
@ -700,9 +641,6 @@ void TestMI::webapiUpdateDeviceSettings(
|
||||
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.contains("fileRecordName")) {
|
||||
settings.m_fileRecordName = *response.getTestMiSettings()->getFileRecordName();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("useReverseAPI")) {
|
||||
settings.m_useReverseAPI = response.getTestMiSettings()->getUseReverseApi() != 0;
|
||||
}
|
||||
@ -746,12 +684,6 @@ void TestMI::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response
|
||||
streams->back()->setPhaseImbalance(it->m_phaseImbalance);
|
||||
}
|
||||
|
||||
if (response.getTestMiSettings()->getFileRecordName()) {
|
||||
*response.getTestMiSettings()->getFileRecordName() = settings.m_fileRecordName;
|
||||
} else {
|
||||
response.getTestMiSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
|
||||
response.getTestMiSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getTestMiSettings()->getReverseApiAddress()) {
|
||||
@ -839,10 +771,6 @@ void TestMI::webapiReverseSendSettings(const DeviceSettingsKeys& deviceSettingsK
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceSettingsKeys.m_commonSettingsKeys.contains("fileRecordName") || force) {
|
||||
swgTestMISettings->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
|
||||
.arg(settings.m_reverseAPIAddress)
|
||||
.arg(settings.m_reverseAPIPort)
|
||||
@ -912,12 +840,3 @@ void TestMI::networkManagerFinished(QNetworkReply *reply)
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
bool TestMI::isRecording(unsigned int istream) const
|
||||
{
|
||||
if (istream < m_fileSinks.size()) {
|
||||
return m_fileSinks[istream]->isRecording();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -58,28 +58,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgFileRecord : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
bool getStartStop() const { return m_startStop; }
|
||||
int getStreamIndex() const { return m_streamIndex; }
|
||||
|
||||
static MsgFileRecord* create(bool startStop, int streamIndex) {
|
||||
return new MsgFileRecord(startStop, streamIndex);
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_startStop;
|
||||
int m_streamIndex;
|
||||
|
||||
MsgFileRecord(bool startStop, int streamIndex) :
|
||||
Message(),
|
||||
m_startStop(startStop),
|
||||
m_streamIndex(streamIndex)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgStartStop : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -160,8 +138,6 @@ public:
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
bool isRecording(unsigned int istream) const;
|
||||
|
||||
private:
|
||||
struct DeviceSettingsKeys
|
||||
{
|
||||
@ -170,7 +146,6 @@ private:
|
||||
};
|
||||
|
||||
DeviceAPI *m_deviceAPI;
|
||||
std::vector<FileRecord *> m_fileSinks; //!< File sinks to record device I/Q output
|
||||
QMutex m_mutex;
|
||||
TestMISettings m_settings;
|
||||
std::vector<TestMIThread*> m_testSourceThreads;
|
||||
|
||||
@ -81,9 +81,6 @@ TestMIGui::TestMIGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
|
||||
CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
|
||||
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
|
||||
|
||||
CRightClickEnabler *fileRecordRightClickEnabler = new CRightClickEnabler(ui->record);
|
||||
connect(fileRecordRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openFileRecordDialog(const QPoint &)));
|
||||
}
|
||||
|
||||
TestMIGui::~TestMIGui()
|
||||
@ -165,7 +162,6 @@ void TestMIGui::on_streamIndex_currentIndexChanged(int index)
|
||||
}
|
||||
|
||||
m_streamIndex = index;
|
||||
updateFileRecordStatus();
|
||||
updateSampleRateAndFrequency();
|
||||
displaySettings();
|
||||
}
|
||||
@ -183,7 +179,6 @@ void TestMIGui::on_spectrumSource_currentIndexChanged(int index)
|
||||
ui->streamIndex->setCurrentIndex(index);
|
||||
ui->streamIndex->blockSignals(false);
|
||||
m_streamIndex = index;
|
||||
updateFileRecordStatus();
|
||||
displaySettings();
|
||||
}
|
||||
}
|
||||
@ -335,18 +330,6 @@ void TestMIGui::on_phaseImbalance_valueChanged(int value)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void TestMIGui::on_record_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||
} else {
|
||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
|
||||
TestMI::MsgFileRecord* message = TestMI::MsgFileRecord::create(checked, m_streamIndex);
|
||||
m_sampleMIMO->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
void TestMIGui::displayAmplitude()
|
||||
{
|
||||
int amplitudeInt = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value();
|
||||
@ -424,15 +407,6 @@ void TestMIGui::updateFrequencyShiftLimit()
|
||||
ui->frequencyShift->setValue(m_settings.m_streams[m_streamIndex].m_frequencyShift);
|
||||
}
|
||||
|
||||
void TestMIGui::updateFileRecordStatus()
|
||||
{
|
||||
if (((TestMI*) m_sampleMIMO)->isRecording(m_streamIndex)) {
|
||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||
} else {
|
||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
}
|
||||
}
|
||||
|
||||
void TestMIGui::displaySettings()
|
||||
{
|
||||
blockApplySettings(true);
|
||||
@ -607,29 +581,3 @@ void TestMIGui::openDeviceSettingsDialog(const QPoint& p)
|
||||
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void TestMIGui::openFileRecordDialog(const QPoint& p)
|
||||
{
|
||||
QFileDialog fileDialog(
|
||||
this,
|
||||
tr("Save I/Q record file"),
|
||||
m_settings.m_fileRecordName,
|
||||
tr("SDR I/Q Files (*.sdriq)")
|
||||
);
|
||||
|
||||
fileDialog.setOptions(QFileDialog::DontUseNativeDialog);
|
||||
fileDialog.setFileMode(QFileDialog::AnyFile);
|
||||
fileDialog.move(p);
|
||||
QStringList fileNames;
|
||||
|
||||
if (fileDialog.exec())
|
||||
{
|
||||
fileNames = fileDialog.selectedFiles();
|
||||
|
||||
if (fileNames.size() > 0)
|
||||
{
|
||||
m_settings.m_fileRecordName = fileNames.at(0);
|
||||
sendSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,6 @@ private:
|
||||
void updateAmpCoarseLimit();
|
||||
void updateAmpFineLimit();
|
||||
void updateFrequencyShiftLimit();
|
||||
void updateFileRecordStatus();
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
@ -103,9 +102,7 @@ private slots:
|
||||
void on_iBias_valueChanged(int value);
|
||||
void on_qBias_valueChanged(int value);
|
||||
void on_phaseImbalance_valueChanged(int value);
|
||||
void on_record_toggled(bool checked);
|
||||
void openDeviceSettingsDialog(const QPoint& p);
|
||||
void openFileRecordDialog(const QPoint& p);
|
||||
void updateStatus();
|
||||
void updateHardware();
|
||||
};
|
||||
|
||||
@ -166,20 +166,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="record">
|
||||
<property name="toolTip">
|
||||
<string>Left: toggle record I/Q samples from device - Right: select output file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/record_off.png</normaloff>:/record_off.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -46,7 +46,6 @@ void TestMIStreamSettings::resetToDefaults()
|
||||
|
||||
TestMISettings::TestMISettings()
|
||||
{
|
||||
m_fileRecordName = "";
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
@ -58,7 +57,6 @@ TestMISettings::TestMISettings()
|
||||
TestMISettings::TestMISettings(const TestMISettings& other) :
|
||||
m_streams(other.m_streams)
|
||||
{
|
||||
m_fileRecordName = other.m_fileRecordName;
|
||||
m_useReverseAPI = other.m_useReverseAPI;
|
||||
m_reverseAPIAddress = other.m_reverseAPIAddress;
|
||||
m_reverseAPIPort = other.m_reverseAPIPort;
|
||||
|
||||
@ -66,7 +66,6 @@ struct TestMIStreamSettings {
|
||||
};
|
||||
|
||||
struct TestMISettings {
|
||||
QString m_fileRecordName;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user