39 m_streamType(streamType),
40 m_deviceTabIndex(deviceTabIndex),
45 m_pluginInterface(nullptr),
46 m_masterTimer(
DSPEngine::instance()->getMasterTimer()),
47 m_samplingDeviceSequence(0),
48 m_samplingDevicePluginInstanceUI(0),
49 m_buddySharedPtr(nullptr),
50 m_isBuddyLeader(false),
51 m_deviceSourceEngine(deviceSourceEngine),
52 m_deviceSinkEngine(deviceSinkEngine),
53 m_deviceMIMOEngine(deviceMIMOEngine)
299 return "Not implemented";
396 state =
"notStarted";
411 state =
"notStarted";
420 state =
"notStarted";
435 state =
"notStarted";
441 state =
"notStarted";
485 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: Loading preset [%s | %s]", qPrintable(preset->
getGroup()), qPrintable(preset->
getDescription()));
489 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: center frequency: %llu Hz", centerFrequency);
491 if (sourceConfig != 0)
493 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: deserializing source %s[%d]: %s",
506 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: deserializing no source");
511 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: source %s[%d]: %s not found",
526 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: no source");
531 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: Loading preset [%s | %s]", qPrintable(preset->
getGroup()), qPrintable(preset->
getDescription()));
535 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: center frequency: %llu Hz", centerFrequency);
539 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: deserializing sink %s[%d]: %s",
554 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: no sink");
559 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: sink %s[%d]: %s not found",
565 qDebug(
"DeviceAPI::loadSamplingDeviceSettings: Loading preset [%s | %s] is not a suitable preset", qPrintable(preset->
getGroup()), qPrintable(preset->
getDescription()));
573 qDebug(
"DeviceAPI::saveSamplingDeviceSettings: serializing source %s[%d]: %s",
588 qDebug(
"DeviceAPI::saveSamplingDeviceSettings: no source");
593 qDebug(
"DeviceAPI::saveSamplingDeviceSettings: serializing sink %s[%d]: %s",
608 qDebug(
"DeviceAPI::saveSamplingDeviceSettings: no sink");
613 qDebug(
"DeviceAPI::saveSamplingDeviceSettings: not a suitable preset");
621 qDebug(
"DeviceAPI::addSourceBuddy: buddy %s(%s) is not of single Rx type",
634 qDebug(
"DeviceAPI::addSourceBuddy: not relevant if this is not a single Rx or Tx");
638 qDebug(
"DeviceAPI::addSourceBuddy: added buddy %s(%s) [%llu] <-> [%llu]",
650 qDebug(
"DeviceAPI::addSinkBuddy: buddy %s(%s) is not of single Tx type",
663 qDebug(
"DeviceAPI::addSinkBuddy: not relevant if this is not a single Rx or Tx");
667 qDebug(
"DeviceAPI::addSinkBuddy: added buddy %s(%s) [%llu] <-> [%llu]",
678 qDebug(
"DeviceAPI::removeSourceBuddy: buddy %s(%s) is not of single Rx type",
690 qDebug(
"DeviceAPI::removeSourceBuddy: buddy %s(%s) [%llu] removed from the list of [%llu]",
700 qDebug(
"DeviceAPI::removeSourceBuddy: buddy %s(%s) [%llu] not found in the list of [%llu]",
711 qDebug(
"DeviceAPI::removeSinkBuddy: buddy %s(%s) is not of single Tx type",
717 std::vector<DeviceAPI*>::iterator it =
m_sinkBuddies.begin();
723 qDebug(
"DeviceAPI::removeSinkBuddy: buddy %s(%s) [%llu] removed from the list of [%llu]",
733 qDebug(
"DeviceAPI::removeSourceBuddy: buddy %s(%s) [%llu] not found in the list of [%llu]",
743 std::vector<DeviceAPI*>::iterator itSink =
m_sinkBuddies.begin();
744 bool leaderElected =
false;
750 (*itSource)->setBuddyLeader(
true);
751 leaderElected =
true;
754 (*itSource)->removeSinkBuddy(
this);
763 (*itSink)->setBuddyLeader(
true);
764 leaderElected =
true;
767 (*itSink)->removeSinkBuddy(
this);
void setSampleMIMO(DeviceSampleMIMO *mimo)
Set the device sample MIMO.
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
void setHardwareId(const QString &id)
void setCenterFrequency(const quint64 centerFrequency)
void setSink(DeviceSampleSink *sink)
Set the sample sink type.
void addSinkStream(bool connect)
DeviceSampleSink * getSink()
engine is before initialization
void setMIMO(DeviceSampleMIMO *mimo)
Set the sample MIMO type.
void setSampleSource(DeviceSampleSource *source)
Set the device sample source (single Rx)
void stopDeviceEngine()
Stop the device engine corresponding to the stream type.
virtual QByteArray serialize() const =0
void removeChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
void removeChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
uint getDeviceUID() const
Return the current device engine unique ID.
void removeSinkBuddy(DeviceAPI *buddy)
engine is before initialization
State state() const
Return DSP engine current state.
void addChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
QString m_samplingDeviceId
The internal plugin ID corresponding to the device (i.e. for HackRF input, for HackRF output ...
void setSamplingDevicePluginInstanceGUI(PluginInstanceGUI *gui)
uint32_t m_deviceNbItems
Number of items in the physical device either Rx or Tx. Can be >1 for NxM devices (i...
QString errorMessage()
Return the current error message.
ChannelAPI * getChanelSinkAPIAt(int index, int streamIndex=0)
bool isBuddyLeader() const
MessageQueue * getInputMessageQueue()
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
void removeChannelSink(ThreadedBasebandSampleSink *sink, int index=0)
Remove a channel sink that runs on its own thread.
const QByteArray * findBestDeviceConfig(const QString &deviceId, const QString &deviceSerial, int deviceSequence) const
QString errorMessage()
Return the current error message.
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
Configure DSP corrections.
quint64 getCenterFrequency() const
DeviceSampleMIMO * getMIMO()
MessageQueue * getInputMessageQueue()
MessageQueue * getDeviceEngineInputMessageQueue()
Device engine message queue.
void removeChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Remove a channel source (Tx)
DeviceSampleSource * getSource()
Exposes a single output stream that can be one of the streams of a physical device.
DSPDeviceSinkEngine * m_deviceSinkEngine
virtual qint64 getCenterFrequency() const =0
void removeSpectrumSink(BasebandSampleSink *spectrumSink)
Add a spectrum vis baseband sample sink.
void removeSink(BasebandSampleSink *sink)
Remove a sample sink.
virtual void setCenterFrequency(qint64 centerFrequency)=0
void setSpectrumSinkInput(bool sourceElseSink=true, unsigned int index=0)
Used in the MIMO case to select which stream is used as input to main spectrum.
void addOrUpdateDeviceConfig(const QString &deviceId, const QString &deviceSerial, int deviceSequence, const QByteArray &config)
int m_deviceTabIndex
This is the tab index in the GUI and also the device set index.
bool isSourcePreset() const
PluginInstanceGUI * m_samplingDevicePluginInstanceUI
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
uint32_t m_deviceItemIndex
The item index inb the Rx or Tx side of the physical device. Can be >0 for NxM devices (i...
void stopProcess()
Stop process sequence.
virtual void setCenterFrequency(qint64 centerFrequency)=0
QString errorMessage()
Last error message from the device engine.
void addChannelSource(ThreadedBasebandSampleSource *sink, int streamIndex=0)
Add a channel source (Tx)
bool initProcess()
Initialize process sequence.
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
PluginInterface * m_pluginInterface
Exposes a single input stream that can be one of the streams of a physical device.
MessageQueue * getMessageQueueToGUI()
bool initGeneration()
Initialize generation sequence.
DSPDeviceSourceEngine * m_deviceSourceEngine
void stopGeneration()
Stop generation sequence.
QList< ChannelAPI * > m_channelSourceAPIs
void addSourceStream(bool connect)
EngineState state() const
Return the state of the device engine corresponding to the stream type.
MessageQueue * getInputMessageQueue()
void setIndexInDeviceSet(int indexInDeviceSet)
void removeSourceBuddy(DeviceAPI *buddy)
MessageQueue * getInputMessageQueue()
void removeThreadedSource(ThreadedBasebandSampleSource *source)
Remove a baseband sample source that runs on its own thread.
void setSource(DeviceSampleSource *source)
Set the sample source type.
void setSpectrumSinkInput(bool sourceElseSink, int index)
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the sink.
void addAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Adds a sink to receive full baseband and that is not a channel (e.g. spectrum)
void addThreadedSource(ThreadedBasebandSampleSource *source)
Add a baseband sample source that will run on its own thread.
virtual bool deserialize(const QByteArray &data)=0
virtual bool deserialize(const QByteArray &data)=0
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int isource)
Configure source DSP corrections.
bool initAcquisition()
Initialize acquisition sequence.
void saveSamplingDeviceSettings(Preset *preset)
QString m_samplingDeviceSerial
The device serial number defined by the vendor or a fake one (SDRplay)
QString m_hardwareId
The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
DeviceAPI(StreamType streamType, int deviceTabIndex, DSPDeviceSourceEngine *deviceSourceEngine, DSPDeviceSinkEngine *deviceSinkEngine, DSPDeviceMIMOEngine *deviceMIMOEngine)
State state() const
Return DSP engine current state.
void removeAncillarySink(BasebandSampleSink *sink, int index=0)
Remove an ancillary sample sink.
void stopAcquistion()
Stop acquisition sequence.
MessageQueue * getSamplingDeviceInputMessageQueue()
Sampling device (ex: single Rx) input message queue.
virtual QByteArray serialize() const =0
void removeAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Removes it.
void addSinkBuddy(DeviceAPI *buddy)
MessageQueue * getInputMessageQueue()
void removeChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Remove a channel sink (Rx)
void addSink(BasebandSampleSink *sink)
Add a sample sink.
ChannelAPI * getChanelSourceAPIAt(int index, int streamIndex=0)
virtual void setCenterFrequency(qint64 centerFrequency)=0
DSPDeviceMIMOEngine * m_deviceMIMOEngine
StreamType
< This is the same enum as in PluginInterface
QString errorMessage()
Return the current error message.
void getDeviceEngineStateStr(QString &state)
const QString & getSamplingDeviceSerial() const
std::vector< DeviceAPI * > m_sourceBuddies
Device source APIs referencing the same physical device.
void addSpectrumSink(BasebandSampleSink *spectrumSink)
Add a spectrum vis baseband sample sink.
void addAncillarySink(BasebandSampleSink *sink, int index=0)
Add an ancillary sink like a I/Q recorder.
void addChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Add a channel sink (Rx)
void removeThreadedSink(ThreadedBasebandSampleSink *sink)
Remove a sample sink that runs on its own thread.
MessageQueue * getMessageQueueToGUI()
State state() const
Return DSP engine current state.
const QString & getHardwareId() const
bool startAcquisition()
Start acquisition sequence.
void addSourceBuddy(DeviceAPI *buddy)
void addChannelSink(ThreadedBasebandSampleSink *sink, int index=0)
Add a channel sink that will run on its own thread.
virtual bool deserialize(const QByteArray &data)=0
void removeLastSourceStream()
void removeLastSinkStream()
void addSourceStream(bool connect)
void setDeviceItemIndex(uint32_t index)
void addChannelSourceAPI(ChannelAPI *channelAPI, int streamIndex=0)
void addThreadedSink(ThreadedBasebandSampleSink *sink)
Add a sample sink that will run on its own thread.
std::vector< DeviceAPI * > m_sinkBuddies
Device sink APIs referencing the same physical device.
void loadSamplingDeviceSettings(const Preset *preset)
virtual QByteArray serialize() const =0
uint32_t m_samplingDeviceSequence
The device sequence. >0 when more than one device of the same type is connected.
const QString & getDescription() const
void setSamplingDevicePluginInterface(PluginInterface *iface)
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the source.
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int streamIndex=0)
Configure current device engine DSP corrections (Rx)
MessageQueue * getMessageQueueToGUI()
void removeLastSourceStream()
DeviceSampleMIMO * getSampleMIMO()
Return pointer to the device sample MIMO or nullptr.
void setDeviceNbItems(uint32_t nbItems)
void setSampleSink(DeviceSampleSink *sink)
Set the device sample sink (single Tx)
bool startGeneration()
Start generation sequence.
const QString & getGroup() const
void removeLastSinkStream()
void renumerateChannels()
QList< ChannelAPI * > m_channelSinkAPIs
MessageQueue * getInputMessageQueue()
void addSinkStream(bool connect)
MessageQueue * getSamplingDeviceGUIMessageQueue()
Sampling device (ex: single Tx) GUI input message queue.
bool startProcess()
Start process sequence.