SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Member Functions | Static Public Attributes | Private Slots | Private Member Functions | Private Attributes | List of all members
RemoteSource Class Reference

#include <remotesource.h>

+ Inheritance diagram for RemoteSource:
+ Collaboration diagram for RemoteSource:

Classes

class  MsgConfigureRemoteSource
 
class  MsgQueryStreamData
 
class  MsgReportStreamData
 
class  MsgSampleRateNotification
 

Public Member Functions

 RemoteSource (DeviceAPI *deviceAPI)
 
 ~RemoteSource ()
 
virtual void destroy ()
 
virtual void pull (Sample &sample)
 
virtual void pullAudio (int nbSamples)
 
virtual void start ()
 
virtual void stop ()
 
virtual bool handleMessage (const Message &cmd)
 Processing of a message. Returns true if message has actually been processed. More...
 
virtual void getIdentifier (QString &id)
 
virtual void getTitle (QString &title)
 
virtual qint64 getCenterFrequency () const
 Applies to a default stream. More...
 
virtual int getNbSinkStreams () const
 
virtual int getNbSourceStreams () const
 
virtual qint64 getStreamCenterFrequency (int streamIndex, bool sinkElseSource) const
 
virtual QByteArray serialize () const
 
virtual bool deserialize (const QByteArray &data)
 
virtual int webapiSettingsGet (SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
 
virtual int webapiSettingsPutPatch (bool force, const QStringList &channelSettingsKeys, SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
 
virtual int webapiReportGet (SWGSDRangel::SWGChannelReport &response, QString &errorMessage)
 
void setDataLink (const QString &dataAddress, uint16_t dataPort)
 
- Public Member Functions inherited from BasebandSampleSource
 BasebandSampleSource ()
 
virtual ~BasebandSampleSource ()
 
void feed (SampleSourceFifo *sampleFifo, int nbSamples)
 
SampleSourceFifogetSampleSourceFifo ()
 
MessageQueuegetInputMessageQueue ()
 Get the queue for asynchronous inbound communication. More...
 
virtual void setMessageQueueToGUI (MessageQueue *queue)
 
MessageQueuegetMessageQueueToGUI ()
 
void setDeviceSampleSourceFifo (SampleSourceFifo *deviceSampleFifo)
 
- Public Member Functions inherited from ChannelAPI
 ChannelAPI (const QString &name, StreamType streamType)
 
virtual ~ChannelAPI ()
 
virtual void setName (const QString &name)
 
virtual const QString & getName () const
 
int getIndexInDeviceSet () const
 
void setIndexInDeviceSet (int indexInDeviceSet)
 
int getDeviceSetIndex () const
 
void setDeviceSetIndex (int deviceSetIndex)
 
DeviceAPIgetDeviceAPI ()
 
void setDeviceAPI (DeviceAPI *deviceAPI)
 
uint64_t getUID () const
 
StreamType getStreamType () const
 

Static Public Attributes

static const QString m_channelIdURI = "sdrangel.channeltx.remotesource"
 
static const QString m_channelId ="RemoteSource"
 

Private Slots

void networkManagerFinished (QNetworkReply *reply)
 
void handleData ()
 

Private Member Functions

void applySettings (const RemoteSourceSettings &settings, bool force=false)
 
void handleDataBlock (RemoteDataBlock *dataBlock)
 
void printMeta (const QString &header, RemoteMetaDataFEC *metaData)
 
uint32_t calculateDataReadQueueSize (int sampleRate)
 
void webapiFormatChannelSettings (SWGSDRangel::SWGChannelSettings &response, const RemoteSourceSettings &settings)
 
void webapiFormatChannelReport (SWGSDRangel::SWGChannelReport &response)
 
void webapiReverseSendSettings (QList< QString > &channelSettingsKeys, const RemoteSourceSettings &settings, bool force)
 

Private Attributes

DeviceAPIm_deviceAPI
 
ThreadedBasebandSampleSourcem_threadedChannelizer
 
UpChannelizerm_channelizer
 
RemoteDataQueue m_dataQueue
 
RemoteSourceThreadm_sourceThread
 
CM256 m_cm256
 
CM256 * m_cm256p
 
bool m_running
 
RemoteSourceSettings m_settings
 
CM256::cm256_block m_cm256DescriptorBlocks [2 *RemoteNbOrginalBlocks]
 CM256 decoder descriptors (block addresses and block indexes) More...
 
RemoteMetaDataFEC m_currentMeta
 
RemoteDataReadQueue m_dataReadQueue
 
uint32_t m_nbCorrectableErrors
 count of correctable errors in number of blocks More...
 
uint32_t m_nbUncorrectableErrors
 count of uncorrectable errors in number of blocks More...
 
QNetworkAccessManager * m_networkManager
 
QNetworkRequest m_networkRequest
 

Additional Inherited Members

- Public Types inherited from ChannelAPI
enum  StreamType { StreamSingleSink, StreamSingleSource, StreamMIMO }
 < This is the same enum as in PluginInterface More...
 
- Protected Slots inherited from BasebandSampleSource
void handleInputMessages ()
 
void handleWriteToFifo (int nbSamples)
 
void handleWriteToDeviceFifo (int nbSamples)
 
- Protected Member Functions inherited from BasebandSampleSource
void handleWriteToFifo (SampleSourceFifo *sampleFifo, int nbSamples)
 
- Protected Attributes inherited from BasebandSampleSource
MessageQueue m_inputMessageQueue
 Queue for asynchronous inbound communication. More...
 
MessageQueuem_guiMessageQueue
 Input message queue to the GUI. More...
 
SampleSourceFifo m_sampleFifo
 Internal FIFO for multi-channel processing. More...
 
SampleSourceFifom_deviceSampleFifo
 Reference to the device FIFO for single channel processing. More...
 

Detailed Description

Definition at line 44 of file remotesource.h.

Constructor & Destructor Documentation

◆ RemoteSource()

RemoteSource::RemoteSource ( DeviceAPI deviceAPI)

Definition at line 54 of file remotesource.cpp.

References DeviceAPI::addChannelSource(), DeviceAPI::addChannelSourceAPI(), handleData(), RemoteMetaDataFEC::init(), m_channelId, m_channelizer, m_cm256, m_cm256p, m_currentMeta, m_dataQueue, m_deviceAPI, m_networkManager, m_threadedChannelizer, and networkManagerFinished().

Referenced by RemoteSource::MsgReportStreamData::MsgReportStreamData().

54  :
56  m_deviceAPI(deviceAPI),
57  m_sourceThread(0),
58  m_running(false),
61 {
62  setObjectName(m_channelId);
63 
64  connect(&m_dataQueue, SIGNAL(dataBlockEnqueued()), this, SLOT(handleData()), Qt::QueuedConnection);
65  m_cm256p = m_cm256.isInitialized() ? &m_cm256 : 0;
67 
68  m_channelizer = new UpChannelizer(this);
72 
73  m_networkManager = new QNetworkAccessManager();
74  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
75 }
RemoteSourceThread * m_sourceThread
Definition: remotesource.h:236
QNetworkAccessManager * m_networkManager
Definition: remotesource.h:251
uint32_t m_nbCorrectableErrors
count of correctable errors in number of blocks
Definition: remotesource.h:248
Exposes a single source stream (output, Tx)
Definition: channelapi.h:42
void addChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Add a channel source (Tx)
Definition: deviceapi.cpp:138
DeviceAPI * m_deviceAPI
Definition: remotesource.h:232
ChannelAPI(const QString &name, StreamType streamType)
Definition: channelapi.cpp:23
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: remotesource.h:233
RemoteDataQueue m_dataQueue
Definition: remotesource.h:235
CM256 * m_cm256p
Definition: remotesource.h:238
uint32_t m_nbUncorrectableErrors
count of uncorrectable errors in number of blocks
Definition: remotesource.h:249
void networkManagerFinished(QNetworkReply *reply)
RemoteMetaDataFEC m_currentMeta
Definition: remotesource.h:244
static const QString m_channelIdURI
Definition: remotesource.h:228
void addChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:174
UpChannelizer * m_channelizer
Definition: remotesource.h:234
static const QString m_channelId
Definition: remotesource.h:229
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~RemoteSource()

RemoteSource::~RemoteSource ( )

Definition at line 77 of file remotesource.cpp.

References m_channelizer, m_deviceAPI, m_networkManager, m_threadedChannelizer, networkManagerFinished(), DeviceAPI::removeChannelSource(), and DeviceAPI::removeChannelSourceAPI().

Referenced by RemoteSource::MsgReportStreamData::MsgReportStreamData().

78 {
79  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
80  delete m_networkManager;
83  delete m_threadedChannelizer;
84  delete m_channelizer;
85 }
QNetworkAccessManager * m_networkManager
Definition: remotesource.h:251
void removeChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:181
void removeChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Remove a channel source (Tx)
Definition: deviceapi.cpp:147
DeviceAPI * m_deviceAPI
Definition: remotesource.h:232
ThreadedBasebandSampleSource * m_threadedChannelizer
Definition: remotesource.h:233
void networkManagerFinished(QNetworkReply *reply)
UpChannelizer * m_channelizer
Definition: remotesource.h:234
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ applySettings()

void RemoteSource::applySettings ( const RemoteSourceSettings settings,
bool  force = false 
)
private

Definition at line 211 of file remotesource.cpp.

References RemoteSourceThread::dataBind(), RemoteSourceSettings::m_dataAddress, RemoteSourceSettings::m_dataPort, RemoteSourceSettings::m_reverseAPIAddress, RemoteSourceSettings::m_reverseAPIChannelIndex, RemoteSourceSettings::m_reverseAPIDeviceIndex, RemoteSourceSettings::m_reverseAPIPort, m_settings, m_sourceThread, RemoteSourceSettings::m_useReverseAPI, and webapiReverseSendSettings().

Referenced by handleMessage().

212 {
213  qDebug() << "RemoteSource::applySettings:"
214  << " m_dataAddress: " << settings.m_dataAddress
215  << " m_dataPort: " << settings.m_dataPort
216  << " force: " << force;
217 
218  bool change = false;
219  QList<QString> reverseAPIKeys;
220 
221  if ((m_settings.m_dataAddress != settings.m_dataAddress) || force)
222  {
223  reverseAPIKeys.append("dataAddress");
224  change = true;
225  }
226 
227  if ((m_settings.m_dataPort != settings.m_dataPort) || force)
228  {
229  reverseAPIKeys.append("dataPort");
230  change = true;
231  }
232 
233  if (change && m_sourceThread)
234  {
235  reverseAPIKeys.append("sourceThread");
236  m_sourceThread->dataBind(settings.m_dataAddress, settings.m_dataPort);
237  }
238 
239  if (settings.m_useReverseAPI)
240  {
241  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
246  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
247  }
248 
249  m_settings = settings;
250 }
RemoteSourceThread * m_sourceThread
Definition: remotesource.h:236
void webapiReverseSendSettings(QList< QString > &channelSettingsKeys, const RemoteSourceSettings &settings, bool force)
uint16_t m_dataPort
Listening data port.
QString m_dataAddress
Listening (local) data address.
void dataBind(const QString &address, uint16_t port)
RemoteSourceSettings m_settings
Definition: remotesource.h:241
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateDataReadQueueSize()

uint32_t RemoteSource::calculateDataReadQueueSize ( int  sampleRate)
private

Definition at line 379 of file remotesource.cpp.

380 {
381  // scale for 20 blocks at 48 kS/s. Take next even number.
382  uint32_t maxSize = sampleRate / 2400;
383  maxSize = (maxSize % 2 == 0) ? maxSize : maxSize + 1;
384  qDebug("RemoteSource::calculateDataReadQueueSize: set max queue size to %u blocks", maxSize);
385  return maxSize;
386 }
unsigned int uint32_t
Definition: rtptypes_win.h:46

◆ deserialize()

bool RemoteSource::deserialize ( const QByteArray &  data)
virtual

Implements ChannelAPI.

Definition at line 193 of file remotesource.cpp.

References RemoteSource::MsgConfigureRemoteSource::create(), RemoteSourceSettings::deserialize(), BasebandSampleSource::m_inputMessageQueue, m_settings, MessageQueue::push(), and RemoteSourceSettings::resetToDefaults().

Referenced by getStreamCenterFrequency().

194 {
195  (void) data;
196  if (m_settings.deserialize(data))
197  {
198  MsgConfigureRemoteSource *msg = MsgConfigureRemoteSource::create(m_settings, true);
200  return true;
201  }
202  else
203  {
205  MsgConfigureRemoteSource *msg = MsgConfigureRemoteSource::create(m_settings, true);
207  return false;
208  }
209 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
bool deserialize(const QByteArray &data)
static MsgConfigureRemoteSource * create(const RemoteSourceSettings &settings, bool force)
Definition: remotesource.h:55
RemoteSourceSettings m_settings
Definition: remotesource.h:241
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

virtual void RemoteSource::destroy ( )
inlinevirtual

Implements ChannelAPI.

Definition at line 187 of file remotesource.h.

References handleMessage(), pull(), pullAudio(), start(), and stop().

187 { delete this; }
+ Here is the call graph for this function:

◆ getCenterFrequency()

virtual qint64 RemoteSource::getCenterFrequency ( ) const
inlinevirtual

Applies to a default stream.

Implements ChannelAPI.

Definition at line 197 of file remotesource.h.

197 { return 0; }

◆ getIdentifier()

virtual void RemoteSource::getIdentifier ( QString &  id)
inlinevirtual

Implements ChannelAPI.

Definition at line 195 of file remotesource.h.

195 { id = objectName(); }

◆ getNbSinkStreams()

virtual int RemoteSource::getNbSinkStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 199 of file remotesource.h.

199 { return 0; }

◆ getNbSourceStreams()

virtual int RemoteSource::getNbSourceStreams ( ) const
inlinevirtual

Implements ChannelAPI.

Definition at line 200 of file remotesource.h.

200 { return 1; }

◆ getStreamCenterFrequency()

virtual qint64 RemoteSource::getStreamCenterFrequency ( int  streamIndex,
bool  sinkElseSource 
) const
inlinevirtual

Implements ChannelAPI.

Definition at line 202 of file remotesource.h.

References deserialize(), serialize(), setDataLink(), webapiReportGet(), webapiSettingsGet(), and webapiSettingsPutPatch().

203  {
204  (void) streamIndex;
205  (void) sinkElseSource;
206  return 0;
207  }
+ Here is the call graph for this function:

◆ getTitle()

virtual void RemoteSource::getTitle ( QString &  title)
inlinevirtual

Implements ChannelAPI.

Definition at line 196 of file remotesource.h.

References RemoteSource::MsgConfigureRemoteSource::m_settings, and RemoteSourceSettings::m_title.

196 { title = m_settings.m_title; }
RemoteSourceSettings m_settings
Definition: remotesource.h:241

◆ handleData

void RemoteSource::handleData ( )
privateslot

Definition at line 356 of file remotesource.cpp.

References handleDataBlock(), m_dataQueue, m_running, and RemoteDataQueue::pop().

Referenced by RemoteSource().

357 {
358  RemoteDataBlock* dataBlock;
359 
360  while (m_running && ((dataBlock = m_dataQueue.pop()) != 0)) {
361  handleDataBlock(dataBlock);
362  }
363 }
RemoteDataBlock * pop()
Pop message from queue.
void handleDataBlock(RemoteDataBlock *dataBlock)
RemoteDataQueue m_dataQueue
Definition: remotesource.h:235
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleDataBlock()

void RemoteSource::handleDataBlock ( RemoteDataBlock dataBlock)
private

Definition at line 252 of file remotesource.cpp.

References RemoteRxControlBlock::m_blockCount, and RemoteDataBlock::m_rxControlBlock.

Referenced by handleData().

253 {
254  (void) dataBlock;
255  if (dataBlock->m_rxControlBlock.m_blockCount < RemoteNbOrginalBlocks)
256  {
257  qWarning("RemoteSource::handleDataBlock: incomplete data block: not processing");
258  }
259  else
260  {
261  int blockCount = 0;
262 
263  for (int blockIndex = 0; blockIndex < 256; blockIndex++)
264  {
265  if ((blockIndex == 0) && (dataBlock->m_rxControlBlock.m_metaRetrieved))
266  {
267  m_cm256DescriptorBlocks[blockCount].Index = 0;
268  m_cm256DescriptorBlocks[blockCount].Block = (void *) &(dataBlock->m_superBlocks[0].m_protectedBlock);
269  blockCount++;
270  }
271  else if (dataBlock->m_superBlocks[blockIndex].m_header.m_blockIndex != 0)
272  {
273  m_cm256DescriptorBlocks[blockCount].Index = dataBlock->m_superBlocks[blockIndex].m_header.m_blockIndex;
274  m_cm256DescriptorBlocks[blockCount].Block = (void *) &(dataBlock->m_superBlocks[blockIndex].m_protectedBlock);
275  blockCount++;
276  }
277  }
278 
279  //qDebug("RemoteSource::handleDataBlock: frame: %u blocks: %d", dataBlock.m_rxControlBlock.m_frameIndex, blockCount);
280 
281  // Need to use the CM256 recovery
282  if (m_cm256p &&(dataBlock->m_rxControlBlock.m_originalCount < RemoteNbOrginalBlocks))
283  {
284  qDebug("RemoteSource::handleDataBlock: %d recovery blocks", dataBlock->m_rxControlBlock.m_recoveryCount);
285  CM256::cm256_encoder_params paramsCM256;
286  paramsCM256.BlockBytes = sizeof(RemoteProtectedBlock); // never changes
287  paramsCM256.OriginalCount = RemoteNbOrginalBlocks; // never changes
288 
289  if (m_currentMeta.m_tv_sec == 0) {
290  paramsCM256.RecoveryCount = dataBlock->m_rxControlBlock.m_recoveryCount;
291  } else {
292  paramsCM256.RecoveryCount = m_currentMeta.m_nbFECBlocks;
293  }
294 
295  // update counters
296  if (dataBlock->m_rxControlBlock.m_originalCount < RemoteNbOrginalBlocks - paramsCM256.RecoveryCount) {
297  m_nbUncorrectableErrors += RemoteNbOrginalBlocks - paramsCM256.RecoveryCount - dataBlock->m_rxControlBlock.m_originalCount;
298  } else {
300  }
301 
302  if (m_cm256.cm256_decode(paramsCM256, m_cm256DescriptorBlocks)) // CM256 decode
303  {
304  qWarning() << "RemoteSource::handleDataBlock: decode CM256 error:"
305  << " m_originalCount: " << dataBlock->m_rxControlBlock.m_originalCount
306  << " m_recoveryCount: " << dataBlock->m_rxControlBlock.m_recoveryCount;
307  }
308  else
309  {
310  for (int ir = 0; ir < dataBlock->m_rxControlBlock.m_recoveryCount; ir++) // restore missing blocks
311  {
312  int recoveryIndex = RemoteNbOrginalBlocks - dataBlock->m_rxControlBlock.m_recoveryCount + ir;
313  int blockIndex = m_cm256DescriptorBlocks[recoveryIndex].Index;
314  RemoteProtectedBlock *recoveredBlock =
315  (RemoteProtectedBlock *) m_cm256DescriptorBlocks[recoveryIndex].Block;
316  memcpy((void *) &(dataBlock->m_superBlocks[blockIndex].m_protectedBlock), recoveredBlock, sizeof(RemoteProtectedBlock));
317  if ((blockIndex == 0) && !dataBlock->m_rxControlBlock.m_metaRetrieved) {
318  dataBlock->m_rxControlBlock.m_metaRetrieved = true;
319  }
320  }
321  }
322  }
323 
324  // Validate block zero and retrieve its data
325  if (dataBlock->m_rxControlBlock.m_metaRetrieved)
326  {
327  RemoteMetaDataFEC *metaData = (RemoteMetaDataFEC *) &(dataBlock->m_superBlocks[0].m_protectedBlock);
328  boost::crc_32_type crc32;
329  crc32.process_bytes(metaData, sizeof(RemoteMetaDataFEC)-4);
330 
331  if (crc32.checksum() == metaData->m_crc32)
332  {
333  if (!(m_currentMeta == *metaData))
334  {
335  printMeta("RemoteSource::handleDataBlock", metaData);
336 
337  if (m_currentMeta.m_sampleRate != metaData->m_sampleRate)
338  {
341  }
342  }
343 
344  m_currentMeta = *metaData;
345  }
346  else
347  {
348  qWarning() << "RemoteSource::handleDataBlock: recovered meta: invalid CRC32";
349  }
350  }
351 
352  m_dataReadQueue.push(dataBlock); // Push into R/W buffer
353  }
354 }
uint32_t m_sampleRate
12 sample rate in Hz
uint32_t m_nbCorrectableErrors
count of correctable errors in number of blocks
Definition: remotesource.h:248
RemoteSuperBlock * m_superBlocks
RemoteDataReadQueue m_dataReadQueue
Definition: remotesource.h:246
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
RemoteProtectedBlock m_protectedBlock
int m_recoveryCount
number of recovery blocks received
RemoteRxControlBlock m_rxControlBlock
int m_originalCount
number of original blocks received
void setSize(uint32_t size)
Sets the queue size (max length)
uint32_t m_crc32
28 CRC32 of the above
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
uint8_t m_blockIndex
CM256 * m_cm256p
Definition: remotesource.h:238
uint32_t m_nbUncorrectableErrors
count of uncorrectable errors in number of blocks
Definition: remotesource.h:249
uint32_t m_tv_sec
20 seconds of timestamp at start time of super-frame processing
void printMeta(const QString &header, RemoteMetaDataFEC *metaData)
CM256::cm256_block m_cm256DescriptorBlocks[2 *RemoteNbOrginalBlocks]
CM256 decoder descriptors (block addresses and block indexes)
Definition: remotesource.h:243
RemoteHeader m_header
RemoteMetaDataFEC m_currentMeta
Definition: remotesource.h:244
uint32_t crc32(const uint8_t *buf, int len)
Definition: crc.h:58
UpChannelizer * m_channelizer
Definition: remotesource.h:234
void push(RemoteDataBlock *dataBlock)
push block on the queue
uint32_t calculateDataReadQueueSize(int sampleRate)
int m_blockCount
number of blocks received for this frame
bool m_metaRetrieved
true if meta data (block zero) was retrieved
void configure(MessageQueue *messageQueue, int sampleRate, int centerFrequency)
+ Here is the caller graph for this function:

◆ handleMessage()

bool RemoteSource::handleMessage ( const Message cmd)
virtual

Processing of a message. Returns true if message has actually been processed.

Implements BasebandSampleSource.

Definition at line 135 of file remotesource.cpp.

References applySettings(), RemoteSource::MsgSampleRateNotification::create(), RemoteSource::MsgReportStreamData::create(), UpChannelizer::MsgChannelizerNotification::getBasebandSampleRate(), RemoteSource::MsgConfigureRemoteSource::getForce(), UpChannelizer::MsgChannelizerNotification::getFrequencyOffset(), UpChannelizer::MsgChannelizerNotification::getSampleRate(), RemoteSource::MsgConfigureRemoteSource::getSettings(), RemoteDataReadQueue::length(), RemoteMetaDataFEC::m_centerFrequency, m_currentMeta, m_dataReadQueue, BasebandSampleSource::m_guiMessageQueue, m_nbCorrectableErrors, RemoteMetaDataFEC::m_nbFECBlocks, RemoteMetaDataFEC::m_nbOriginalBlocks, m_nbUncorrectableErrors, RemoteMetaDataFEC::m_sampleRate, Message::match(), MessageQueue::push(), RemoteDataReadQueue::readSampleCount(), and RemoteDataReadQueue::size().

Referenced by destroy().

136 {
138  {
140  qDebug() << "RemoteSource::handleMessage: MsgChannelizerNotification:"
141  << " basebandSampleRate: " << notif.getBasebandSampleRate()
142  << " outputSampleRate: " << notif.getSampleRate()
143  << " inputFrequencyOffset: " << notif.getFrequencyOffset();
144 
145  if (m_guiMessageQueue)
146  {
147  MsgSampleRateNotification *msg = MsgSampleRateNotification::create(notif.getBasebandSampleRate());
148  m_guiMessageQueue->push(msg);
149  }
150 
151  return true;
152  }
153  else if (MsgConfigureRemoteSource::match(cmd))
154  {
155  MsgConfigureRemoteSource& cfg = (MsgConfigureRemoteSource&) cmd;
156  qDebug() << "MsgConfigureRemoteSource::handleMessage: MsgConfigureRemoteSource";
157  applySettings(cfg.getSettings(), cfg.getForce());
158 
159  return true;
160  }
161  else if (MsgQueryStreamData::match(cmd))
162  {
163  if (m_guiMessageQueue)
164  {
165  struct timeval tv;
166  gettimeofday(&tv, 0);
167 
168  MsgReportStreamData *msg = MsgReportStreamData::create(
169  tv.tv_sec,
170  tv.tv_usec,
180  m_guiMessageQueue->push(msg);
181  }
182 
183  return true;
184  }
185  return false;
186 }
uint32_t m_sampleRate
12 sample rate in Hz
uint32_t size() const
Returns queue size (max length)
uint32_t m_nbCorrectableErrors
count of correctable errors in number of blocks
Definition: remotesource.h:248
void push(Message *message, bool emitSignal=true)
Push message onto queue.
RemoteDataReadQueue m_dataReadQueue
Definition: remotesource.h:246
void applySettings(const RemoteSourceSettings &settings, bool force=false)
uint32_t readSampleCount() const
Returns the absolute number of samples read.
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
static bool match(const Message *message)
Definition: message.cpp:45
uint32_t m_nbUncorrectableErrors
count of uncorrectable errors in number of blocks
Definition: remotesource.h:249
uint32_t length() const
Returns queue length.
static MsgSampleRateNotification * create(int sampleRate)
Definition: remotesource.h:75
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
uint8_t m_nbOriginalBlocks
15 number of blocks with original (protected) data
static MsgReportStreamData * create(uint32_t tv_sec, uint32_t tv_usec, uint32_t queueSize, uint32_t queueLength, uint32_t readSamplesCount, uint32_t nbCorrectableErrors, uint32_t nbUncorrectableErrors, uint32_t nbOriginalBlocks, uint32_t nbFECBlocks, uint32_t centerFreq, uint32_t sampleRate)
Definition: remotesource.h:117
RemoteMetaDataFEC m_currentMeta
Definition: remotesource.h:244
uint64_t m_centerFrequency
8 center frequency in kHz
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ networkManagerFinished

void RemoteSource::networkManagerFinished ( QNetworkReply *  reply)
privateslot

Definition at line 563 of file remotesource.cpp.

Referenced by RemoteSource(), and ~RemoteSource().

564 {
565  QNetworkReply::NetworkError replyError = reply->error();
566 
567  if (replyError)
568  {
569  qWarning() << "RemoteSource::networkManagerFinished:"
570  << " error(" << (int) replyError
571  << "): " << replyError
572  << ": " << reply->errorString();
573  return;
574  }
575 
576  QString answer = reply->readAll();
577  answer.chop(1); // remove last \n
578  qDebug("RemoteSource::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
579 }
+ Here is the caller graph for this function:

◆ printMeta()

void RemoteSource::printMeta ( const QString &  header,
RemoteMetaDataFEC metaData 
)
private

Definition at line 365 of file remotesource.cpp.

References RemoteMetaDataFEC::m_centerFrequency, RemoteMetaDataFEC::m_nbFECBlocks, RemoteMetaDataFEC::m_nbOriginalBlocks, RemoteMetaDataFEC::m_sampleBits, RemoteMetaDataFEC::m_sampleBytes, RemoteMetaDataFEC::m_sampleRate, RemoteMetaDataFEC::m_tv_sec, and RemoteMetaDataFEC::m_tv_usec.

366 {
367  qDebug().noquote() << header << ": "
368  << "|" << metaData->m_centerFrequency
369  << ":" << metaData->m_sampleRate
370  << ":" << (int) (metaData->m_sampleBytes & 0xF)
371  << ":" << (int) metaData->m_sampleBits
372  << ":" << (int) metaData->m_nbOriginalBlocks
373  << ":" << (int) metaData->m_nbFECBlocks
374  << "|" << metaData->m_tv_sec
375  << ":" << metaData->m_tv_usec
376  << "|";
377 }
uint32_t m_sampleRate
12 sample rate in Hz
uint8_t m_sampleBytes
13 4 LSB: number of bytes per sample (2 or 4)
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
uint32_t m_tv_usec
24 microseconds of timestamp at start time of super-frame processing
uint8_t m_sampleBits
14 number of effective bits per sample (deprecated)
uint32_t m_tv_sec
20 seconds of timestamp at start time of super-frame processing
uint8_t m_nbOriginalBlocks
15 number of blocks with original (protected) data
uint64_t m_centerFrequency
8 center frequency in kHz

◆ pull()

void RemoteSource::pull ( Sample sample)
virtual

Implements BasebandSampleSource.

Definition at line 87 of file remotesource.cpp.

References m_dataReadQueue, and RemoteDataReadQueue::readSample().

Referenced by destroy().

88 {
89  m_dataReadQueue.readSample(sample, true); // true is scale for Tx
90 }
RemoteDataReadQueue m_dataReadQueue
Definition: remotesource.h:246
void readSample(Sample &s, bool scaleForTx=false)
Read sample from queue possibly scaling to Tx size.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAudio()

void RemoteSource::pullAudio ( int  nbSamples)
virtual

Reimplemented from BasebandSampleSource.

Definition at line 92 of file remotesource.cpp.

Referenced by destroy().

93 {
94  (void) nbSamples;
95 }
+ Here is the caller graph for this function:

◆ serialize()

QByteArray RemoteSource::serialize ( ) const
virtual

Implements ChannelAPI.

Definition at line 188 of file remotesource.cpp.

References m_settings, and RemoteSourceSettings::serialize().

Referenced by getStreamCenterFrequency().

189 {
190  return m_settings.serialize();
191 }
QByteArray serialize() const
RemoteSourceSettings m_settings
Definition: remotesource.h:241
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDataLink()

void RemoteSource::setDataLink ( const QString &  dataAddress,
uint16_t  dataPort 
)

Definition at line 125 of file remotesource.cpp.

References RemoteSource::MsgConfigureRemoteSource::create(), RemoteSourceSettings::m_dataAddress, RemoteSourceSettings::m_dataPort, BasebandSampleSource::m_inputMessageQueue, m_settings, and MessageQueue::push().

Referenced by getStreamCenterFrequency().

126 {
127  RemoteSourceSettings settings = m_settings;
128  settings.m_dataAddress = dataAddress;
129  settings.m_dataPort = dataPort;
130 
131  MsgConfigureRemoteSource *msg = MsgConfigureRemoteSource::create(settings, false);
133 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
uint16_t m_dataPort
Listening data port.
static MsgConfigureRemoteSource * create(const RemoteSourceSettings &settings, bool force)
Definition: remotesource.h:55
QString m_dataAddress
Listening (local) data address.
RemoteSourceSettings m_settings
Definition: remotesource.h:241
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void RemoteSource::start ( )
virtual

Implements BasebandSampleSource.

Definition at line 97 of file remotesource.cpp.

References RemoteSourceThread::dataBind(), RemoteSourceSettings::m_dataAddress, RemoteSourceSettings::m_dataPort, m_dataQueue, m_running, m_settings, m_sourceThread, RemoteSourceThread::startStop(), and stop().

Referenced by destroy().

98 {
99  qDebug("RemoteSource::start");
100 
101  if (m_running) {
102  stop();
103  }
104 
106  m_sourceThread->startStop(true);
108  m_running = true;
109 }
RemoteSourceThread * m_sourceThread
Definition: remotesource.h:236
uint16_t m_dataPort
Listening data port.
RemoteDataQueue m_dataQueue
Definition: remotesource.h:235
QString m_dataAddress
Listening (local) data address.
void dataBind(const QString &address, uint16_t port)
RemoteSourceSettings m_settings
Definition: remotesource.h:241
virtual void stop()
void startStop(bool start)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void RemoteSource::stop ( )
virtual

Implements BasebandSampleSource.

Definition at line 111 of file remotesource.cpp.

References m_running, m_sourceThread, and RemoteSourceThread::startStop().

Referenced by destroy(), and start().

112 {
113  qDebug("RemoteSource::stop");
114 
115  if (m_sourceThread != 0)
116  {
117  m_sourceThread->startStop(false);
118  m_sourceThread->deleteLater();
119  m_sourceThread = 0;
120  }
121 
122  m_running = false;
123 }
RemoteSourceThread * m_sourceThread
Definition: remotesource.h:236
void startStop(bool start)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatChannelReport()

void RemoteSource::webapiFormatChannelReport ( SWGSDRangel::SWGChannelReport response)
private

Definition at line 499 of file remotesource.cpp.

References DeviceSampleSink::getCenterFrequency(), SWGSDRangel::SWGChannelReport::getRemoteSourceReport(), DeviceSampleSink::getSampleRate(), DeviceAPI::getSampleSink(), RemoteDataReadQueue::length(), RemoteMetaDataFEC::m_centerFrequency, m_currentMeta, m_dataReadQueue, m_deviceAPI, m_nbCorrectableErrors, RemoteMetaDataFEC::m_nbFECBlocks, RemoteMetaDataFEC::m_nbOriginalBlocks, m_nbUncorrectableErrors, RemoteMetaDataFEC::m_sampleRate, RemoteDataReadQueue::readSampleCount(), SWGSDRangel::SWGRemoteSourceReport::setCenterFreq(), SWGSDRangel::SWGRemoteSourceReport::setCorrectableErrorsCount(), SWGSDRangel::SWGRemoteSourceReport::setDeviceCenterFreq(), SWGSDRangel::SWGRemoteSourceReport::setDeviceSampleRate(), SWGSDRangel::SWGRemoteSourceReport::setNbFecBlocks(), SWGSDRangel::SWGRemoteSourceReport::setNbOriginalBlocks(), SWGSDRangel::SWGRemoteSourceReport::setQueueLength(), SWGSDRangel::SWGRemoteSourceReport::setQueueSize(), SWGSDRangel::SWGRemoteSourceReport::setSampleRate(), SWGSDRangel::SWGRemoteSourceReport::setSamplesCount(), SWGSDRangel::SWGRemoteSourceReport::setTvSec(), SWGSDRangel::SWGRemoteSourceReport::setTvUSec(), SWGSDRangel::SWGRemoteSourceReport::setUncorrectableErrorsCount(), and RemoteDataReadQueue::size().

Referenced by webapiReportGet().

500 {
501  struct timeval tv;
502  gettimeofday(&tv, 0);
503 
504  response.getRemoteSourceReport()->setTvSec(tv.tv_sec);
505  response.getRemoteSourceReport()->setTvUSec(tv.tv_usec);
517 }
void setDeviceCenterFreq(qint32 device_center_freq)
uint32_t m_sampleRate
12 sample rate in Hz
void setSamplesCount(qint32 samples_count)
uint32_t size() const
Returns queue size (max length)
uint32_t m_nbCorrectableErrors
count of correctable errors in number of blocks
Definition: remotesource.h:248
RemoteDataReadQueue m_dataReadQueue
Definition: remotesource.h:246
void setCorrectableErrorsCount(qint32 correctable_errors_count)
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
uint32_t readSampleCount() const
Returns the absolute number of samples read.
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the sink.
DeviceAPI * m_deviceAPI
Definition: remotesource.h:232
void setUncorrectableErrorsCount(qint32 uncorrectable_errors_count)
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
SWGRemoteSourceReport * getRemoteSourceReport()
uint32_t m_nbUncorrectableErrors
count of uncorrectable errors in number of blocks
Definition: remotesource.h:249
uint32_t length() const
Returns queue length.
void setNbOriginalBlocks(qint32 nb_original_blocks)
void setNbFecBlocks(qint32 nb_fec_blocks)
uint8_t m_nbOriginalBlocks
15 number of blocks with original (protected) data
RemoteMetaDataFEC m_currentMeta
Definition: remotesource.h:244
virtual int getSampleRate() const =0
Sample rate exposed by the sink.
uint64_t m_centerFrequency
8 center frequency in kHz
void setDeviceSampleRate(qint32 device_sample_rate)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatChannelSettings()

void RemoteSource::webapiFormatChannelSettings ( SWGSDRangel::SWGChannelSettings response,
const RemoteSourceSettings settings 
)
private

Definition at line 469 of file remotesource.cpp.

References SWGSDRangel::SWGRemoteSourceSettings::getDataAddress(), SWGSDRangel::SWGChannelSettings::getRemoteSourceSettings(), SWGSDRangel::SWGRemoteSourceSettings::getReverseApiAddress(), SWGSDRangel::SWGRemoteSourceSettings::getTitle(), RemoteSourceSettings::m_dataAddress, RemoteSourceSettings::m_dataPort, RemoteSourceSettings::m_reverseAPIAddress, RemoteSourceSettings::m_reverseAPIChannelIndex, RemoteSourceSettings::m_reverseAPIDeviceIndex, RemoteSourceSettings::m_reverseAPIPort, RemoteSourceSettings::m_rgbColor, RemoteSourceSettings::m_title, RemoteSourceSettings::m_useReverseAPI, SWGSDRangel::SWGRemoteSourceSettings::setDataAddress(), SWGSDRangel::SWGRemoteSourceSettings::setDataPort(), SWGSDRangel::SWGRemoteSourceSettings::setReverseApiAddress(), SWGSDRangel::SWGRemoteSourceSettings::setReverseApiChannelIndex(), SWGSDRangel::SWGRemoteSourceSettings::setReverseApiDeviceIndex(), SWGSDRangel::SWGRemoteSourceSettings::setReverseApiPort(), SWGSDRangel::SWGRemoteSourceSettings::setRgbColor(), SWGSDRangel::SWGRemoteSourceSettings::setTitle(), and SWGSDRangel::SWGRemoteSourceSettings::setUseReverseApi().

Referenced by webapiSettingsGet(), and webapiSettingsPutPatch().

470 {
471  if (response.getRemoteSourceSettings()->getDataAddress()) {
472  *response.getRemoteSourceSettings()->getDataAddress() = settings.m_dataAddress;
473  } else {
474  response.getRemoteSourceSettings()->setDataAddress(new QString(settings.m_dataAddress));
475  }
476 
477  response.getRemoteSourceSettings()->setDataPort(settings.m_dataPort);
478  response.getRemoteSourceSettings()->setRgbColor(settings.m_rgbColor);
479 
480  if (response.getRemoteSourceSettings()->getTitle()) {
481  *response.getRemoteSourceSettings()->getTitle() = settings.m_title;
482  } else {
483  response.getRemoteSourceSettings()->setTitle(new QString(settings.m_title));
484  }
485 
486  response.getRemoteSourceSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
487 
488  if (response.getRemoteSourceSettings()->getReverseApiAddress()) {
490  } else {
491  response.getRemoteSourceSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
492  }
493 
497 }
void setReverseApiPort(qint32 reverse_api_port)
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiAddress(QString *reverse_api_address)
uint16_t m_dataPort
Listening data port.
QString m_dataAddress
Listening (local) data address.
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
SWGRemoteSourceSettings * getRemoteSourceSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReportGet()

int RemoteSource::webapiReportGet ( SWGSDRangel::SWGChannelReport response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 458 of file remotesource.cpp.

References SWGSDRangel::SWGChannelReport::getRemoteSourceReport(), SWGSDRangel::SWGRemoteSourceReport::init(), SWGSDRangel::SWGChannelReport::setRemoteSourceReport(), and webapiFormatChannelReport().

Referenced by getStreamCenterFrequency().

461 {
462  (void) errorMessage;
464  response.getRemoteSourceReport()->init();
465  webapiFormatChannelReport(response);
466  return 200;
467 }
void setRemoteSourceReport(SWGRemoteSourceReport *remote_source_report)
SWGRemoteSourceReport * getRemoteSourceReport()
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport &response)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendSettings()

void RemoteSource::webapiReverseSendSettings ( QList< QString > &  channelSettingsKeys,
const RemoteSourceSettings settings,
bool  force 
)
private

Definition at line 519 of file remotesource.cpp.

References SWGSDRangel::SWGChannelSettings::asJson(), ChannelAPI::getDeviceSetIndex(), ChannelAPI::getIndexInDeviceSet(), SWGSDRangel::SWGChannelSettings::getRemoteSourceSettings(), RemoteSourceSettings::m_dataAddress, RemoteSourceSettings::m_dataPort, m_networkManager, m_networkRequest, RemoteSourceSettings::m_reverseAPIAddress, RemoteSourceSettings::m_reverseAPIChannelIndex, RemoteSourceSettings::m_reverseAPIDeviceIndex, RemoteSourceSettings::m_reverseAPIPort, RemoteSourceSettings::m_rgbColor, RemoteSourceSettings::m_title, SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGRemoteSourceSettings::setDataAddress(), SWGSDRangel::SWGRemoteSourceSettings::setDataPort(), SWGSDRangel::SWGChannelSettings::setDirection(), SWGSDRangel::SWGChannelSettings::setOriginatorChannelIndex(), SWGSDRangel::SWGChannelSettings::setOriginatorDeviceSetIndex(), SWGSDRangel::SWGChannelSettings::setRemoteSourceSettings(), SWGSDRangel::SWGRemoteSourceSettings::setRgbColor(), and SWGSDRangel::SWGRemoteSourceSettings::setTitle().

Referenced by applySettings().

520 {
522  swgChannelSettings->setDirection(1); // single source (Tx)
523  swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
524  swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
525  swgChannelSettings->setChannelType(new QString("RemoteSource"));
527  SWGSDRangel::SWGRemoteSourceSettings *swgRemoteSourceSettings = swgChannelSettings->getRemoteSourceSettings();
528 
529  // transfer data that has been modified. When force is on transfer all data except reverse API data
530 
531  if (channelSettingsKeys.contains("dataAddress") || force) {
532  swgRemoteSourceSettings->setDataAddress(new QString(settings.m_dataAddress));
533  }
534  if (channelSettingsKeys.contains("dataPort") || force) {
535  swgRemoteSourceSettings->setDataPort(settings.m_dataPort);
536  }
537  if (channelSettingsKeys.contains("rgbColor") || force) {
538  swgRemoteSourceSettings->setRgbColor(settings.m_rgbColor);
539  }
540  if (channelSettingsKeys.contains("title") || force) {
541  swgRemoteSourceSettings->setTitle(new QString(settings.m_title));
542  }
543 
544  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
545  .arg(settings.m_reverseAPIAddress)
546  .arg(settings.m_reverseAPIPort)
547  .arg(settings.m_reverseAPIDeviceIndex)
548  .arg(settings.m_reverseAPIChannelIndex);
549  m_networkRequest.setUrl(QUrl(channelSettingsURL));
550  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
551 
552  QBuffer *buffer=new QBuffer();
553  buffer->open((QBuffer::ReadWrite));
554  buffer->write(swgChannelSettings->asJson().toUtf8());
555  buffer->seek(0);
556 
557  // Always use PATCH to avoid passing reverse API settings
558  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
559 
560  delete swgChannelSettings;
561 }
void setOriginatorChannelIndex(qint32 originator_channel_index)
QNetworkAccessManager * m_networkManager
Definition: remotesource.h:251
int getDeviceSetIndex() const
Definition: channelapi.h:89
void setChannelType(QString *channel_type)
void setOriginatorDeviceSetIndex(qint32 originator_device_set_index)
void setRemoteSourceSettings(SWGRemoteSourceSettings *remote_source_settings)
uint16_t m_dataPort
Listening data port.
QString m_dataAddress
Listening (local) data address.
virtual QString asJson() override
int getIndexInDeviceSet() const
Definition: channelapi.h:87
SWGRemoteSourceSettings * getRemoteSourceSettings()
QNetworkRequest m_networkRequest
Definition: remotesource.h:252
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsGet()

int RemoteSource::webapiSettingsGet ( SWGSDRangel::SWGChannelSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 388 of file remotesource.cpp.

References SWGSDRangel::SWGChannelSettings::getRemoteSourceSettings(), SWGSDRangel::SWGRemoteSourceSettings::init(), m_settings, SWGSDRangel::SWGChannelSettings::setRemoteSourceSettings(), and webapiFormatChannelSettings().

Referenced by getStreamCenterFrequency().

391 {
392  (void) errorMessage;
394  response.getRemoteSourceSettings()->init();
396  return 200;
397 }
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const RemoteSourceSettings &settings)
void setRemoteSourceSettings(SWGRemoteSourceSettings *remote_source_settings)
RemoteSourceSettings m_settings
Definition: remotesource.h:241
SWGRemoteSourceSettings * getRemoteSourceSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

int RemoteSource::webapiSettingsPutPatch ( bool  force,
const QStringList &  channelSettingsKeys,
SWGSDRangel::SWGChannelSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from ChannelAPI.

Definition at line 399 of file remotesource.cpp.

References RemoteSource::MsgConfigureRemoteSource::create(), SWGSDRangel::SWGRemoteSourceSettings::getDataAddress(), SWGSDRangel::SWGRemoteSourceSettings::getDataPort(), SWGSDRangel::SWGChannelSettings::getRemoteSourceSettings(), SWGSDRangel::SWGRemoteSourceSettings::getReverseApiAddress(), SWGSDRangel::SWGRemoteSourceSettings::getReverseApiChannelIndex(), SWGSDRangel::SWGRemoteSourceSettings::getReverseApiDeviceIndex(), SWGSDRangel::SWGRemoteSourceSettings::getReverseApiPort(), SWGSDRangel::SWGRemoteSourceSettings::getRgbColor(), SWGSDRangel::SWGRemoteSourceSettings::getTitle(), SWGSDRangel::SWGRemoteSourceSettings::getUseReverseApi(), RemoteSourceSettings::m_dataAddress, RemoteSourceSettings::m_dataPort, BasebandSampleSource::m_guiMessageQueue, BasebandSampleSource::m_inputMessageQueue, RemoteSourceSettings::m_reverseAPIAddress, RemoteSourceSettings::m_reverseAPIChannelIndex, RemoteSourceSettings::m_reverseAPIDeviceIndex, RemoteSourceSettings::m_reverseAPIPort, RemoteSourceSettings::m_rgbColor, m_settings, RemoteSourceSettings::m_title, RemoteSourceSettings::m_useReverseAPI, MessageQueue::push(), and webapiFormatChannelSettings().

Referenced by getStreamCenterFrequency().

404 {
405  (void) errorMessage;
406  RemoteSourceSettings settings = m_settings;
407 
408  if (channelSettingsKeys.contains("dataAddress")) {
409  settings.m_dataAddress = *response.getRemoteSourceSettings()->getDataAddress();
410  }
411  if (channelSettingsKeys.contains("dataPort"))
412  {
413  int dataPort = response.getRemoteSourceSettings()->getDataPort();
414 
415  if ((dataPort < 1024) || (dataPort > 65535)) {
416  settings.m_dataPort = 9090;
417  } else {
418  settings.m_dataPort = dataPort;
419  }
420  }
421  if (channelSettingsKeys.contains("rgbColor")) {
422  settings.m_rgbColor = response.getRemoteSourceSettings()->getRgbColor();
423  }
424  if (channelSettingsKeys.contains("title")) {
425  settings.m_title = *response.getRemoteSourceSettings()->getTitle();
426  }
427  if (channelSettingsKeys.contains("useReverseAPI")) {
428  settings.m_useReverseAPI = response.getRemoteSourceSettings()->getUseReverseApi() != 0;
429  }
430  if (channelSettingsKeys.contains("reverseAPIAddress")) {
432  }
433  if (channelSettingsKeys.contains("reverseAPIPort")) {
435  }
436  if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
438  }
439  if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
441  }
442 
443  MsgConfigureRemoteSource *msg = MsgConfigureRemoteSource::create(settings, force);
445 
446  qDebug("RemoteSource::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
447  if (m_guiMessageQueue) // forward to GUI if any
448  {
449  MsgConfigureRemoteSource *msgToGUI = MsgConfigureRemoteSource::create(settings, force);
450  m_guiMessageQueue->push(msgToGUI);
451  }
452 
453  webapiFormatChannelSettings(response, settings);
454 
455  return 200;
456 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings &response, const RemoteSourceSettings &settings)
uint16_t m_dataPort
Listening data port.
static MsgConfigureRemoteSource * create(const RemoteSourceSettings &settings, bool force)
Definition: remotesource.h:55
QString m_dataAddress
Listening (local) data address.
RemoteSourceSettings m_settings
Definition: remotesource.h:241
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
SWGRemoteSourceSettings * getRemoteSourceSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_channelId

const QString RemoteSource::m_channelId ="RemoteSource"
static

Definition at line 229 of file remotesource.h.

Referenced by RemoteSourcePlugin::initPlugin(), and RemoteSource().

◆ m_channelIdURI

const QString RemoteSource::m_channelIdURI = "sdrangel.channeltx.remotesource"
static

◆ m_channelizer

UpChannelizer* RemoteSource::m_channelizer
private

Definition at line 234 of file remotesource.h.

Referenced by RemoteSource(), and ~RemoteSource().

◆ m_cm256

CM256 RemoteSource::m_cm256
private

Definition at line 237 of file remotesource.h.

Referenced by RemoteSource().

◆ m_cm256DescriptorBlocks

CM256::cm256_block RemoteSource::m_cm256DescriptorBlocks[2 *RemoteNbOrginalBlocks]
private

CM256 decoder descriptors (block addresses and block indexes)

Definition at line 243 of file remotesource.h.

◆ m_cm256p

CM256* RemoteSource::m_cm256p
private

Definition at line 238 of file remotesource.h.

Referenced by RemoteSource().

◆ m_currentMeta

RemoteMetaDataFEC RemoteSource::m_currentMeta
private

Definition at line 244 of file remotesource.h.

Referenced by handleMessage(), RemoteSource(), and webapiFormatChannelReport().

◆ m_dataQueue

RemoteDataQueue RemoteSource::m_dataQueue
private

Definition at line 235 of file remotesource.h.

Referenced by handleData(), RemoteSource(), and start().

◆ m_dataReadQueue

RemoteDataReadQueue RemoteSource::m_dataReadQueue
private

Definition at line 246 of file remotesource.h.

Referenced by handleMessage(), pull(), and webapiFormatChannelReport().

◆ m_deviceAPI

DeviceAPI* RemoteSource::m_deviceAPI
private

Definition at line 232 of file remotesource.h.

Referenced by RemoteSource(), webapiFormatChannelReport(), and ~RemoteSource().

◆ m_nbCorrectableErrors

uint32_t RemoteSource::m_nbCorrectableErrors
private

count of correctable errors in number of blocks

Definition at line 248 of file remotesource.h.

Referenced by RemoteSource::MsgReportStreamData::get_nbCorrectableErrors(), handleMessage(), and webapiFormatChannelReport().

◆ m_nbUncorrectableErrors

uint32_t RemoteSource::m_nbUncorrectableErrors
private

count of uncorrectable errors in number of blocks

Definition at line 249 of file remotesource.h.

Referenced by RemoteSource::MsgReportStreamData::get_nbUncorrectableErrors(), handleMessage(), and webapiFormatChannelReport().

◆ m_networkManager

QNetworkAccessManager* RemoteSource::m_networkManager
private

Definition at line 251 of file remotesource.h.

Referenced by RemoteSource(), webapiReverseSendSettings(), and ~RemoteSource().

◆ m_networkRequest

QNetworkRequest RemoteSource::m_networkRequest
private

Definition at line 252 of file remotesource.h.

Referenced by webapiReverseSendSettings().

◆ m_running

bool RemoteSource::m_running
private

Definition at line 239 of file remotesource.h.

Referenced by handleData(), start(), and stop().

◆ m_settings

RemoteSourceSettings RemoteSource::m_settings
private

◆ m_sourceThread

RemoteSourceThread* RemoteSource::m_sourceThread
private

Definition at line 236 of file remotesource.h.

Referenced by applySettings(), start(), and stop().

◆ m_threadedChannelizer

ThreadedBasebandSampleSource* RemoteSource::m_threadedChannelizer
private

Definition at line 233 of file remotesource.h.

Referenced by RemoteSource(), and ~RemoteSource().


The documentation for this class was generated from the following files: