58 qDebug() <<
"MainCore::MainCore: start";
72 QString applicationDirPath = QCoreApplication::instance()->applicationDirPath();
82 qDebug() <<
"MainCore::MainCore: end";
99 qDebug() <<
"MainCore::~MainCore: end";
142 if (direction == 1) {
144 }
else if (direction == 0) {
194 qDebug(
"MainCore::handleMessages: message: %s", message->
getIdentifier());
202 qDebug() <<
"MainCore::loadSettings";
233 #if QT_VERSION >= 0x050400 234 QString appInfoStr(tr(
"%1 %2 Qt %3 %4b %5 %6 DSP Rx:%7b Tx:%8b PID %9")
235 .
arg(QCoreApplication::applicationName())
236 .
arg(QCoreApplication::applicationVersion())
238 .
arg(QT_POINTER_SIZE*8)
239 .
arg(QSysInfo::currentCpuArchitecture())
240 .
arg(QSysInfo::prettyProductName())
243 .
arg(QCoreApplication::applicationPid()));
245 QString appInfoStr(tr(
"%1 %2 Qt %3 %4b DSP Rx:%5b Tx:%6b PID %7")
246 .
arg(QCoreApplication::applicationName())
247 .
arg(QCoreApplication::applicationVersion())
249 .
arg(QT_POINTER_SIZE*8)
252 .
arg(QCoreApplication::applicationPid());
261 dspDeviceSinkEngine->
start();
263 uint dspDeviceSinkEngineUID = dspDeviceSinkEngine->
getUID();
265 sprintf(uidCStr,
"UID:%d", dspDeviceSinkEngineUID);
272 char tabNameCStr[16];
273 sprintf(tabNameCStr,
"T%d", deviceTabIndex);
278 QList<QString> channelNames;
287 m_deviceSets.back()->m_deviceAPI->setSamplingDeviceId(samplingDevice->
id);
294 if (userArgs.size() > 0) {
295 m_deviceSets.back()->m_deviceAPI->setHardwareUserArguments(userArgs);
306 dspDeviceSourceEngine->
start();
308 uint dspDeviceSourceEngineUID = dspDeviceSourceEngine->
getUID();
310 sprintf(uidCStr,
"UID:%d", dspDeviceSourceEngineUID);
314 m_deviceSets.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
318 char tabNameCStr[16];
319 sprintf(tabNameCStr,
"R%d", deviceTabIndex);
332 m_deviceSets.back()->m_deviceAPI->setSamplingDeviceId(samplingDevice->
id);
339 if (userArgs.size() > 0) {
340 m_deviceSets.back()->m_deviceAPI->setHardwareUserArguments(userArgs);
345 m_deviceSets.back()->m_deviceAPI->setSampleSource(source);
357 m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
358 m_deviceSets.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
365 lastDeviceEngine->
stop();
377 m_deviceSets.back()->m_deviceAPI->resetSamplingDeviceId();
378 m_deviceSets.back()->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
385 lastDeviceEngine->
stop();
396 if (deviceSetIndex >= 0)
398 qDebug(
"MainCore::changeSampleSource: deviceSet at %d", deviceSetIndex);
420 std::vector<DeviceSet*>::iterator it =
m_deviceSets.begin();
425 if (*it != deviceSet)
427 if ((*it)->m_deviceSourceEngine)
432 (*it)->m_deviceAPI->addSourceBuddy(deviceSet->
m_deviceAPI);
437 if ((*it)->m_deviceSinkEngine)
442 (*it)->m_deviceAPI->addSourceBuddy(deviceSet->
m_deviceAPI);
449 if (nbOfBuddies == 0) {
464 if (deviceSetIndex >= 0)
466 qDebug(
"MainCore::changeSampleSink: device set at %d", deviceSetIndex);
488 std::vector<DeviceSet*>::iterator it =
m_deviceSets.begin();
493 if (*it != deviceSet)
495 if ((*it)->m_deviceSourceEngine)
500 (*it)->m_deviceAPI->addSinkBuddy(deviceSet->
m_deviceAPI);
505 if ((*it)->m_deviceSinkEngine)
510 (*it)->m_deviceAPI->addSinkBuddy(deviceSet->
m_deviceAPI);
517 if (nbOfBuddies == 0) {
532 if (deviceSetIndex >= 0)
549 if (deviceSetIndex >= 0)
566 qDebug(
"MainCore::loadPresetSettings: preset [%s | %s]",
589 qDebug(
"MainCore::savePresetSettings: preset [%s | %s]",
void setHardwareId(const QString &id)
void setBuddyLeader(bool isBuddyLeader)
const QString & getLogFileName() const
void setUseFileLogger(bool use)
WebAPIAdapterSrv * m_apiAdapter
int getFileSinkDeviceIndex() const
Get Tx default device.
void loadTxChannelSettings(const Preset *preset, PluginAPI *pluginAPI)
Message * pop()
Pop message from queue.
virtual DeviceSampleSource * createSampleSourcePluginInstance(const QString &sourceId, DeviceAPI *deviceAPI)
int sequence
The device sequence. >0 when more than one device of the same type is connected.
WebAPIServer * m_apiServer
std::vector< DeviceSet * > m_deviceSets
void setSampleSource(DeviceSampleSource *source)
Set the device sample source (single Rx)
void stopDeviceEngine()
Stop the device engine corresponding to the stream type.
QString displayedName
The human readable name.
void savePresetSettings(Preset *preset, int tabIndex)
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
void createOrSetFileLogger(const FileLoggerSettings &settings, const int refreshInterval=10000)
DSPDeviceSourceEngine * addDeviceSourceEngine()
void loadPlugins(const QString &pluginsSubDir)
bool getMIMOSupport() const
bool getUseLogFile() const
Exposes a single output stream that can be one of the streams of a physical device.
MainCore(qtwebapp::LoggerWithFile *logger, const MainParser &parser, QObject *parent=0)
QString hardwareId
The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
void setAdapter(WebAPIAdapterInterface *adapter)
DSPDeviceSourceEngine * m_deviceSourceEngine
void stop()
This thread stop.
const Preset * getPreset() const
DSPDeviceSinkEngine * addDeviceSinkEngine()
Preset * getPreset() const
MessageQueue m_inputMessageQueue
void start()
This thread start.
void setSamplingDeviceSequence(int sequence)
FileLoggerSettings getFileLoggerSettings() const
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Exposes a single input stream that can be one of the streams of a physical device.
bool hasFileLogger() const
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
void setSamplingDeviceId(const QString &id)
void stopGeneration()
Stop generation sequence.
void setSamplingDeviceDisplayName(const QString &name)
void changeSampleSink(int deviceSetIndex, int selectedDeviceIndex)
int getChannelIndex() const
void loadPresetSettings(const Preset *preset, int tabIndex)
void changeSampleSource(int deviceSetIndex, int selectedDeviceIndex)
int getDeviceSetIndex() const
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
void loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI)
AMBEEngine * getAMBEEngine()
const QString & getSamplingDeviceId() const
void addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
void saveRxChannelSettings(Preset *preset)
void removeLastDeviceSinkEngine()
QtMsgType getFileMinLogLevel() const
void saveSamplingDeviceSettings(Preset *preset)
int deviceNbItems
Number of items (or streams) in the device. >1 for composite devices.
Preset * getWorkingPreset()
void setConsoleMinMessageLevel(const QtMsgType &msgLevel)
void removeLastDeviceSourceEngine()
PluginAPI * getPluginAPI()
void stopAcquistion()
Stop acquisition sequence.
void setAMBEEngine(AMBEEngine *ambeEngine)
friend class WebAPIAdapterSrv
static bool match(const Message *message)
PluginManager * m_pluginManager
int getDeviceSetIndex() const
qtwebapp::LoggerWithFile * m_logger
void deletePreset(const Preset *preset)
void setSourcePreset(bool isSourcePreset)
virtual DeviceSampleSink * createSampleSinkPluginInstance(const QString &sinkId, DeviceAPI *deviceAPI)
void setMIMOSupport(bool mimoSupport)
void deleteRxChannel(int channelIndex)
WebAPIRequestMapper * m_requestMapper
QString id
The internal plugin ID corresponding to the device (i.e. for HackRF input, for HackRF output ...
void logToFile(const QtMsgType type, const QString &message, const QString &file="", const QString &function="", const int line=0)
int getDeviceSetIndex() const
int getDeviceIndex() const
QString serial
The device serial number defined by the vendor or a fake one (SDRplay)
void saveTxChannelSettings(Preset *preset)
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink)
const QString & getSamplingDeviceSerial() const
PluginInterface * getPluginInterface()
AudioDeviceManager * getAudioDeviceManager()
bool handleMessage(const Message &cmd)
const PluginInterface::SamplingDevice * getTxSamplingDevice(int deviceIndex) const
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager)
void start()
This thread start.
void addChannel(int deviceSetIndex, int selectedChannelIndex)
const QString & getHardwareId() const
DeviceUserArgs & getDeviceUserArgs()
void setSamplingDeviceSerial(const QString &serial)
virtual const char * getIdentifier() const
int getDeviceType() const
const PluginInterface::SamplingDevice * getRxSamplingDevice(int deviceIndex) const
const Preset * getPreset() const
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source)
void setDeviceItemIndex(uint32_t index)
int getDeviceSetIndex() const
void setFileMinMessageLevel(const QtMsgType &msgLevel)
void resetSamplingDeviceId()
void loadSamplingDeviceSettings(const Preset *preset)
QtMsgType getConsoleMinLogLevel() const
int getFileInputDeviceIndex() const
Get Rx default device.
const QString & getDescription() const
const QString & getServerAddress() const
void setSamplingDevicePluginInterface(PluginInterface *iface)
static DeviceEnumerator * instance()
DSPDeviceSinkEngine * m_deviceSinkEngine
int deviceItemIndex
For composite devices this is the Rx or Tx stream index. -1 if not initialized.
void setDeviceNbItems(uint32_t nbItems)
void setSampleSink(DeviceSampleSink *sink)
Set the device sample sink (single Tx)
uint16_t getServerPort() const
void deleteTxChannel(int channelIndex)
int getDeviceSetIndex() const
const QString & getGroup() const
void addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
static MainCore * m_instance
void stop()
This thread stop.
int getChannelRegistrationIndex() const
QString findUserArgs(const QString &id, int sequence)
void deleteChannel(int deviceSetIndex, int channelIndex)