22 #include <QNetworkReply> 44 m_deviceAPI(deviceAPI),
49 m_sampleFifo.setSize(96000 * 4);
51 m_fileSink =
new FileRecord(QString(
"test_%1.sdriq").
arg(m_deviceAPI->getDeviceUID()));
52 m_deviceAPI->setNbSourceStreams(1);
53 m_deviceAPI->addAncillarySink(m_fileSink);
55 m_networkManager =
new QNetworkAccessManager();
56 connect(m_networkManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(networkManagerFinished(QNetworkReply*)));
80 qDebug() <<
"LocalInput::start";
86 qDebug() <<
"LocalInput::stop";
174 qDebug() <<
"LocalInput::handleMessage: MsgFileRecord: " << conf.
getStartStop();
196 qDebug() <<
"LocalInput::handleMessage: MsgStartStop: " << (cmd.
getStartStop() ?
"start" :
"stop");
218 qDebug() <<
"LocalInput::handleMessage:" << message.
getIdentifier();
231 QMutexLocker mutexLocker(&
m_mutex);
232 std::ostringstream os;
233 QString remoteAddress;
234 QList<QString> reverseAPIKeys;
237 reverseAPIKeys.append(
"dcBlock");
240 reverseAPIKeys.append(
"iqCorrection");
243 reverseAPIKeys.append(
"fileRecordName");
249 qDebug(
"LocalInput::applySettings: corrections: DC block: %s IQ imbalance: %s",
254 mutexLocker.unlock();
268 qDebug() <<
"LocalInput::applySettings: " 277 QString& errorMessage)
287 QString& errorMessage)
305 QString& errorMessage)
316 const QStringList& deviceSettingsKeys,
318 QString& errorMessage)
323 if (deviceSettingsKeys.contains(
"dcBlock")) {
326 if (deviceSettingsKeys.contains(
"iqCorrection")) {
329 if (deviceSettingsKeys.contains(
"fileRecordName")) {
332 if (deviceSettingsKeys.contains(
"useReverseAPI")) {
335 if (deviceSettingsKeys.contains(
"reverseAPIAddress")) {
338 if (deviceSettingsKeys.contains(
"reverseAPIPort")) {
341 if (deviceSettingsKeys.contains(
"reverseAPIDeviceIndex")) {
383 QString& errorMessage)
409 if (deviceSettingsKeys.contains(
"dcBlock") || force) {
412 if (deviceSettingsKeys.contains(
"iqCorrection") || force) {
415 if (deviceSettingsKeys.contains(
"fileRecordName") || force) {
419 QString deviceSettingsURL = QString(
"http://%1:%2/sdrangel/deviceset/%3/device/settings")
424 m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,
"application/json");
426 QBuffer *buffer=
new QBuffer();
427 buffer->open((QBuffer::ReadWrite));
428 buffer->write(swgDeviceSettings->
asJson().toUtf8());
434 delete swgDeviceSettings;
444 QString deviceSettingsURL = QString(
"http://%1:%2/sdrangel/deviceset/%3/device/run")
449 m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,
"application/json");
451 QBuffer *buffer=
new QBuffer();
452 buffer->open((QBuffer::ReadWrite));
453 buffer->write(swgDeviceSettings->
asJson().toUtf8());
462 delete swgDeviceSettings;
467 QNetworkReply::NetworkError replyError = reply->error();
471 qWarning() <<
"LocalInput::networkManagerFinished:" 472 <<
" error(" << (int) replyError
473 <<
"): " << replyError
474 <<
": " << reply->errorString();
478 QString answer = reply->readAll();
480 qDebug(
"LocalInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
void setLocalInputSettings(SWGLocalInputSettings *local_input_settings)
SWGLocalInputSettings * getLocalInputSettings()
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void stopDeviceEngine()
Stop the device engine corresponding to the stream type.
void setFileName(const QString &filename)
uint getDeviceUID() const
Return the current device engine unique ID.
SWGLocalInputReport * getLocalInputReport()
MessageQueue m_inputMessageQueue
Input queue to the source.
virtual QString asJson() override
MessageQueue * getDeviceEngineInputMessageQueue()
Device engine message queue.
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
void setOriginatorIndex(qint32 originator_index)
MessageQueue * getMessageQueueToGUI()
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.
int getDeviceSetIndex() const
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
void genUniqueFileName(uint deviceUID, int istream=-1)
static bool match(const Message *message)
void removeAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Removes it.
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
void getDeviceEngineStateStr(QString &state)
void setLocalInputReport(SWGLocalInputReport *local_input_report)
virtual const char * getIdentifier() const
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int streamIndex=0)
Configure current device engine DSP corrections (Rx)
void setDirection(qint32 direction)
void setDeviceHwType(QString *device_hw_type)