22 #include <QNetworkReply> 48 m_deviceAPI(deviceAPI),
50 m_remoteInputUDPHandler(0),
51 m_deviceDescription(),
52 m_startingTimeStamp(0)
54 m_sampleFifo.setSize(96000 * 4);
57 m_fileSink =
new FileRecord(QString(
"test_%1.sdriq").
arg(m_deviceAPI->getDeviceUID()));
58 m_deviceAPI->setNbSourceStreams(1);
59 m_deviceAPI->addAncillarySink(m_fileSink);
61 m_networkManager =
new QNetworkAccessManager();
62 connect(m_networkManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(networkManagerFinished(QNetworkReply*)));
87 qDebug() <<
"RemoteInput::start";
94 qDebug() <<
"RemoteInput::stop";
148 (void) centerFrequency;
171 qDebug() <<
"RemoteInput::handleMessage: MsgFileRecord: " << conf.
getStartStop();
193 qDebug() <<
"RemoteInput::handleMessage: MsgStartStop: " << (cmd.
getStartStop() ?
"start" :
"stop");
215 qDebug() <<
"RemoteInput::handleMessage:" << message.
getIdentifier();
228 QMutexLocker mutexLocker(&
m_mutex);
229 std::ostringstream os;
230 QString remoteAddress;
232 QList<QString> reverseAPIKeys;
235 reverseAPIKeys.append(
"dcBlock");
238 reverseAPIKeys.append(
"iqCorrection");
241 reverseAPIKeys.append(
"dataAddress");
244 reverseAPIKeys.append(
"dataPort");
247 reverseAPIKeys.append(
"apiAddress");
250 reverseAPIKeys.append(
"apiPort");
253 reverseAPIKeys.append(
"fileRecordName");
259 qDebug(
"RemoteInput::applySettings: corrections: DC block: %s IQ imbalance: %s",
267 mutexLocker.unlock();
281 qDebug() <<
"RemoteInput::applySettings: " 291 QString& errorMessage)
301 QString& errorMessage)
319 QString& errorMessage)
330 const QStringList& deviceSettingsKeys,
332 QString& errorMessage)
337 if (deviceSettingsKeys.contains(
"apiAddress")) {
340 if (deviceSettingsKeys.contains(
"apiPort")) {
343 if (deviceSettingsKeys.contains(
"dataAddress")) {
346 if (deviceSettingsKeys.contains(
"dataPort")) {
349 if (deviceSettingsKeys.contains(
"dcBlock")) {
352 if (deviceSettingsKeys.contains(
"iqCorrection")) {
355 if (deviceSettingsKeys.contains(
"fileRecordName")) {
358 if (deviceSettingsKeys.contains(
"useReverseAPI")) {
361 if (deviceSettingsKeys.contains(
"reverseAPIAddress")) {
364 if (deviceSettingsKeys.contains(
"reverseAPIPort")) {
367 if (deviceSettingsKeys.contains(
"reverseAPIDeviceIndex")) {
413 QString& errorMessage)
446 if (deviceSettingsKeys.contains(
"apiAddress") || force) {
449 if (deviceSettingsKeys.contains(
"apiPort") || force) {
452 if (deviceSettingsKeys.contains(
"dataAddress") || force) {
455 if (deviceSettingsKeys.contains(
"dataPort") || force) {
458 if (deviceSettingsKeys.contains(
"dcBlock") || force) {
461 if (deviceSettingsKeys.contains(
"iqCorrection") || force) {
464 if (deviceSettingsKeys.contains(
"fileRecordName") || force) {
468 QString deviceSettingsURL = QString(
"http://%1:%2/sdrangel/deviceset/%3/device/settings")
473 m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,
"application/json");
475 QBuffer *buffer=
new QBuffer();
476 buffer->open((QBuffer::ReadWrite));
477 buffer->write(swgDeviceSettings->
asJson().toUtf8());
483 delete swgDeviceSettings;
493 QString deviceSettingsURL = QString(
"http://%1:%2/sdrangel/deviceset/%3/device/run")
498 m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,
"application/json");
500 QBuffer *buffer=
new QBuffer();
501 buffer->open((QBuffer::ReadWrite));
502 buffer->write(swgDeviceSettings->
asJson().toUtf8());
511 delete swgDeviceSettings;
516 QNetworkReply::NetworkError replyError = reply->error();
520 qWarning() <<
"RemoteInput::networkManagerFinished:" 521 <<
" error(" << (int) replyError
522 <<
"): " << replyError
523 <<
": " << reply->errorString();
527 QString answer = reply->readAll();
529 qDebug(
"RemoteInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
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.
void setRemoteInputReport(SWGRemoteInputReport *remote_input_report)
MessageQueue m_inputMessageQueue
Input queue to the source.
virtual QString asJson() override
SWGRemoteInputReport * getRemoteInputReport()
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
void setOriginatorIndex(qint32 originator_index)
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 setRemoteInputSettings(SWGRemoteInputSettings *remote_input_settings)
virtual const char * getIdentifier() const
SWGRemoteInputSettings * getRemoteInputSettings()
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)