mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-15 12:12:28 -04:00
New AMBE engine (3)
This commit is contained in:
parent
f04b6eb975
commit
144b0db196
@ -33,7 +33,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
#include "ambeworker.h"
|
#include "ambeworker.h"
|
||||||
#include "ambeengine.h"
|
#include "ambeengine.h"
|
||||||
@ -42,10 +47,12 @@ AMBEEngine::AMBEEngine()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
AMBEEngine::~AMBEEngine()
|
AMBEEngine::~AMBEEngine()
|
||||||
{}
|
{
|
||||||
|
qDebug("AMBEEngine::~AMBEEngine: %lu controllers", m_controllers.size());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
void DVSerialEngine::getComList()
|
void AMBEEngine::getComList()
|
||||||
{
|
{
|
||||||
m_comList.clear();
|
m_comList.clear();
|
||||||
m_comList8250.clear();
|
m_comList8250.clear();
|
||||||
@ -100,8 +107,8 @@ void AMBEEngine::getComList()
|
|||||||
|
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
void AMBEEngine::register_comport(
|
void AMBEEngine::register_comport(
|
||||||
std::list<std::string>& comList,
|
std::vector<std::string>& comList,
|
||||||
std::list<std::string>& comList8250,
|
std::vector<std::string>& comList8250,
|
||||||
const std::string& dir)
|
const std::string& dir)
|
||||||
{
|
{
|
||||||
// Get the driver the device is using
|
// Get the driver the device is using
|
||||||
@ -123,11 +130,11 @@ void AMBEEngine::register_comport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AMBEEngine::probe_serial8250_comports(
|
void AMBEEngine::probe_serial8250_comports(
|
||||||
std::list<std::string>& comList,
|
std::vector<std::string>& comList,
|
||||||
std::list<std::string> comList8250)
|
std::vector<std::string> comList8250)
|
||||||
{
|
{
|
||||||
struct serial_struct serinfo;
|
struct serial_struct serinfo;
|
||||||
std::list<std::string>::iterator it = comList8250.begin();
|
std::vector<std::string>::iterator it = comList8250.begin();
|
||||||
|
|
||||||
// Iterate over all serial8250-devices
|
// Iterate over all serial8250-devices
|
||||||
while (it != comList8250.end())
|
while (it != comList8250.end())
|
||||||
@ -177,16 +184,17 @@ std::string AMBEEngine::get_driver(const std::string& tty)
|
|||||||
}
|
}
|
||||||
#endif // not Windows
|
#endif // not Windows
|
||||||
|
|
||||||
bool AMBEEngine::scan(std::vector<QString>& ambeDevices)
|
void AMBEEngine::scan(std::vector<QString>& ambeDevices)
|
||||||
{
|
{
|
||||||
getComList();
|
getComList();
|
||||||
std::list<std::string>::const_iterator it = m_comList.begin();
|
std::vector<std::string>::const_iterator it = m_comList.begin();
|
||||||
ambeDevices.clear();
|
ambeDevices.clear();
|
||||||
|
|
||||||
while (it != m_comList.end())
|
while (it != m_comList.end())
|
||||||
{
|
{
|
||||||
AMBEWorker *worker = new AMBEWorker();
|
AMBEWorker *worker = new AMBEWorker();
|
||||||
qDebug("AMBEEngine::scan: com: %s", it->c_str());
|
qDebug("AMBEEngine::scan: com: %s", it->c_str());
|
||||||
|
|
||||||
if (worker->open(*it))
|
if (worker->open(*it))
|
||||||
{
|
{
|
||||||
ambeDevices.push_back(QString(it->c_str()));
|
ambeDevices.push_back(QString(it->c_str()));
|
||||||
@ -214,6 +222,7 @@ bool AMBEEngine::registerController(const std::string& deviceRef)
|
|||||||
connect(m_controllers.back().worker, SIGNAL(finished()), m_controllers.back().worker, SLOT(deleteLater()));
|
connect(m_controllers.back().worker, SIGNAL(finished()), m_controllers.back().worker, SLOT(deleteLater()));
|
||||||
connect(m_controllers.back().thread, SIGNAL(finished()), m_controllers.back().thread, SLOT(deleteLater()));
|
connect(m_controllers.back().thread, SIGNAL(finished()), m_controllers.back().thread, SLOT(deleteLater()));
|
||||||
connect(&m_controllers.back().worker->m_inputMessageQueue, SIGNAL(messageEnqueued()), m_controllers.back().worker, SLOT(handleInputMessages()));
|
connect(&m_controllers.back().worker->m_inputMessageQueue, SIGNAL(messageEnqueued()), m_controllers.back().worker, SLOT(handleInputMessages()));
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
m_controllers.back().thread->start();
|
m_controllers.back().thread->start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -224,7 +233,6 @@ bool AMBEEngine::registerController(const std::string& deviceRef)
|
|||||||
|
|
||||||
void AMBEEngine::releaseController(const std::string& deviceRef)
|
void AMBEEngine::releaseController(const std::string& deviceRef)
|
||||||
{
|
{
|
||||||
qDebug("AMBEEngine::releaseController");
|
|
||||||
std::vector<AMBEController>::iterator it = m_controllers.begin();
|
std::vector<AMBEController>::iterator it = m_controllers.begin();
|
||||||
|
|
||||||
while (it != m_controllers.end())
|
while (it != m_controllers.end())
|
||||||
@ -237,7 +245,7 @@ void AMBEEngine::releaseController(const std::string& deviceRef)
|
|||||||
it->worker->m_inputMessageQueue.clear();
|
it->worker->m_inputMessageQueue.clear();
|
||||||
it->worker->close();
|
it->worker->close();
|
||||||
m_controllers.erase(it);
|
m_controllers.erase(it);
|
||||||
qDebug() << "DVSerialEngine::releaseController: closed device at: " << it->device.c_str();
|
qDebug() << "AMBEEngine::releaseController: closed device at: " << it->device.c_str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +255,6 @@ void AMBEEngine::releaseController(const std::string& deviceRef)
|
|||||||
|
|
||||||
void AMBEEngine::releaseAll()
|
void AMBEEngine::releaseAll()
|
||||||
{
|
{
|
||||||
qDebug("AMBEEngine::releaseAll");
|
|
||||||
std::vector<AMBEController>::iterator it = m_controllers.begin();
|
std::vector<AMBEController>::iterator it = m_controllers.begin();
|
||||||
|
|
||||||
while (it != m_controllers.end())
|
while (it != m_controllers.end())
|
||||||
@ -257,7 +264,7 @@ void AMBEEngine::releaseAll()
|
|||||||
it->thread->wait(100);
|
it->thread->wait(100);
|
||||||
it->worker->m_inputMessageQueue.clear();
|
it->worker->m_inputMessageQueue.clear();
|
||||||
it->worker->close();
|
it->worker->close();
|
||||||
qDebug() << "DVSerialEngine::release: closed device at: " << it->device.c_str();
|
qDebug() << "AMBEEngine::release: closed device at: " << it->device.c_str();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,3 +326,47 @@ void AMBEEngine::pushMbeFrame(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray AMBEEngine::serialize() const
|
||||||
|
{
|
||||||
|
QStringList qDeviceList;
|
||||||
|
std::vector<AMBEController>::const_iterator it = m_controllers.begin();
|
||||||
|
|
||||||
|
while (it != m_controllers.end())
|
||||||
|
{
|
||||||
|
qDebug("AMBEEngine::serialize: %s", it->device.c_str());
|
||||||
|
qDeviceList << QString(it->device.c_str());
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray data;
|
||||||
|
QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
|
||||||
|
(*stream) << qDeviceList;
|
||||||
|
delete stream;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AMBEEngine::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
if (data.size() <= 0)
|
||||||
|
{
|
||||||
|
qDebug("AMBEEngine::deserialize: invalid or no data");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList qDeviceList;
|
||||||
|
QDataStream *stream = new QDataStream(data);
|
||||||
|
(*stream) >> qDeviceList;
|
||||||
|
delete stream;
|
||||||
|
|
||||||
|
releaseAll();
|
||||||
|
|
||||||
|
for (int i = 0; i < qDeviceList.size(); ++i)
|
||||||
|
{
|
||||||
|
qDebug(" AMBEEngine::deserialize: %s", qDeviceList.at(i).toStdString().c_str());
|
||||||
|
registerController(qDeviceList.at(i).toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public:
|
|||||||
AMBEEngine();
|
AMBEEngine();
|
||||||
~AMBEEngine();
|
~AMBEEngine();
|
||||||
|
|
||||||
bool scan(std::vector<QString>& ambeDevices);
|
void scan(std::vector<QString>& ambeDevices);
|
||||||
void releaseAll();
|
void releaseAll();
|
||||||
|
|
||||||
int getNbDevices() const { return m_controllers.size(); } //!< number of devices used
|
int getNbDevices() const { return m_controllers.size(); } //!< number of devices used
|
||||||
@ -57,9 +57,17 @@ public:
|
|||||||
int upsampling,
|
int upsampling,
|
||||||
AudioFifo *audioFifo);
|
AudioFifo *audioFifo);
|
||||||
|
|
||||||
|
QByteArray serialize() const;
|
||||||
|
bool deserialize(const QByteArray& data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct AMBEController
|
struct AMBEController
|
||||||
{
|
{
|
||||||
|
AMBEController() :
|
||||||
|
thread(nullptr),
|
||||||
|
worker(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
QThread *thread;
|
QThread *thread;
|
||||||
AMBEWorker *worker;
|
AMBEWorker *worker;
|
||||||
std::string device;
|
std::string device;
|
||||||
@ -67,14 +75,14 @@ private:
|
|||||||
|
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
static std::string get_driver(const std::string& tty);
|
static std::string get_driver(const std::string& tty);
|
||||||
static void register_comport(std::list<std::string>& comList, std::list<std::string>& comList8250, const std::string& dir);
|
static void register_comport(std::vector<std::string>& comList, std::vector<std::string>& comList8250, const std::string& dir);
|
||||||
static void probe_serial8250_comports(std::list<std::string>& comList, std::list<std::string> comList8250);
|
static void probe_serial8250_comports(std::vector<std::string>& comList, std::vector<std::string> comList8250);
|
||||||
#endif
|
#endif
|
||||||
void getComList();
|
void getComList();
|
||||||
|
|
||||||
std::list<std::string> m_comList;
|
|
||||||
std::list<std::string> m_comList8250;
|
|
||||||
std::vector<AMBEController> m_controllers;
|
std::vector<AMBEController> m_controllers;
|
||||||
|
std::vector<std::string> m_comList;
|
||||||
|
std::vector<std::string> m_comList8250;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ void AMBEWorker::noUpsample(short *in, int nbSamplesIn, unsigned char channels)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("DVSerialWorker::noUpsample: audio buffer is full check its size");
|
qDebug("AMBEWorker::noUpsample: audio buffer is full check its size");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,44 +155,25 @@ DSPDeviceMIMOEngine *DSPEngine::getDeviceMIMOEngineByUID(uint uid)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DSD_USE_SERIALDV
|
|
||||||
void DSPEngine::setDVSerialSupport(bool support)
|
|
||||||
{
|
|
||||||
if (support)
|
|
||||||
{
|
|
||||||
m_dvSerialSupport = m_dvSerialEngine.scan();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_dvSerialEngine.release();
|
|
||||||
m_dvSerialSupport = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void DSPEngine::setDVSerialSupport(bool support)
|
|
||||||
{ (void) support; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool DSPEngine::hasDVSerialSupport()
|
bool DSPEngine::hasDVSerialSupport()
|
||||||
{
|
{
|
||||||
#ifdef DSD_USE_SERIALDV
|
return m_ambeEngine.getNbDevices() > 0;
|
||||||
return m_dvSerialSupport;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DSD_USE_SERIALDV
|
void DSPEngine::setDVSerialSupport(bool support)
|
||||||
|
{ (void) support; }
|
||||||
|
|
||||||
void DSPEngine::getDVSerialNames(std::vector<std::string>& deviceNames)
|
void DSPEngine::getDVSerialNames(std::vector<std::string>& deviceNames)
|
||||||
{
|
{
|
||||||
m_dvSerialEngine.getDevicesNames(deviceNames);
|
std::vector<QString> qDeviceRefs;
|
||||||
}
|
m_ambeEngine.getDeviceRefs(qDeviceRefs);
|
||||||
#else
|
deviceNames.clear();
|
||||||
void DSPEngine::getDVSerialNames(std::vector<std::string>& deviceNames)
|
|
||||||
{ (void) deviceNames; }
|
for (std::vector<QString>::const_iterator it = qDeviceRefs.begin(); it != qDeviceRefs.end(); ++it) {
|
||||||
#endif
|
deviceNames.push_back(it->toStdString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DSD_USE_SERIALDV
|
|
||||||
void DSPEngine::pushMbeFrame(
|
void DSPEngine::pushMbeFrame(
|
||||||
const unsigned char *mbeFrame,
|
const unsigned char *mbeFrame,
|
||||||
int mbeRateIndex,
|
int mbeRateIndex,
|
||||||
@ -202,24 +183,5 @@ void DSPEngine::pushMbeFrame(
|
|||||||
int upsampling,
|
int upsampling,
|
||||||
AudioFifo *audioFifo)
|
AudioFifo *audioFifo)
|
||||||
{
|
{
|
||||||
m_dvSerialEngine.pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, useHP, upsampling, audioFifo);
|
m_ambeEngine.pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, useHP, upsampling, audioFifo);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
void DSPEngine::pushMbeFrame(
|
|
||||||
const unsigned char *mbeFrame,
|
|
||||||
int mbeRateIndex,
|
|
||||||
int mbeVolumeIndex,
|
|
||||||
unsigned char channels,
|
|
||||||
bool useHP,
|
|
||||||
int upsampling,
|
|
||||||
AudioFifo *audioFifo)
|
|
||||||
{
|
|
||||||
(void) mbeFrame;
|
|
||||||
(void) mbeRateIndex;
|
|
||||||
(void) mbeVolumeIndex;
|
|
||||||
(void) channels;
|
|
||||||
(void) useHP;
|
|
||||||
(void) upsampling;
|
|
||||||
(void) audioFifo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include "audio/audiooutput.h"
|
#include "audio/audiooutput.h"
|
||||||
#include "audio/audioinput.h"
|
#include "audio/audioinput.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
#ifdef DSD_USE_SERIALDV
|
|
||||||
#include "dsp/dvserialengine.h"
|
|
||||||
#endif
|
|
||||||
#include "ambe/ambeengine.h"
|
#include "ambe/ambeengine.h"
|
||||||
|
|
||||||
class DSPDeviceSourceEngine;
|
class DSPDeviceSourceEngine;
|
||||||
@ -56,6 +53,7 @@ public:
|
|||||||
void removeLastDeviceMIMOEngine();
|
void removeLastDeviceMIMOEngine();
|
||||||
|
|
||||||
AudioDeviceManager *getAudioDeviceManager() { return &m_audioDeviceManager; }
|
AudioDeviceManager *getAudioDeviceManager() { return &m_audioDeviceManager; }
|
||||||
|
AMBEEngine *getAMBEEngine() { return &m_ambeEngine; }
|
||||||
|
|
||||||
uint32_t getDeviceSourceEnginesNumber() const { return m_deviceSourceEngines.size(); }
|
uint32_t getDeviceSourceEnginesNumber() const { return m_deviceSourceEngines.size(); }
|
||||||
DSPDeviceSourceEngine *getDeviceSourceEngineByIndex(uint deviceIndex) { return m_deviceSourceEngines[deviceIndex]; }
|
DSPDeviceSourceEngine *getDeviceSourceEngineByIndex(uint deviceIndex) { return m_deviceSourceEngines[deviceIndex]; }
|
||||||
@ -82,7 +80,6 @@ public:
|
|||||||
bool useHP,
|
bool useHP,
|
||||||
int upsampling,
|
int upsampling,
|
||||||
AudioFifo *audioFifo);
|
AudioFifo *audioFifo);
|
||||||
AMBEEngine& getAMBEEngine() { return m_ambeEngine; }
|
|
||||||
|
|
||||||
const QTimer& getMasterTimer() const { return m_masterTimer; }
|
const QTimer& getMasterTimer() const { return m_masterTimer; }
|
||||||
void setMIMOSupport(bool mimoSupport) { m_mimoSupport = mimoSupport; }
|
void setMIMOSupport(bool mimoSupport) { m_mimoSupport = mimoSupport; }
|
||||||
@ -101,9 +98,6 @@ private:
|
|||||||
QTimer m_masterTimer;
|
QTimer m_masterTimer;
|
||||||
bool m_dvSerialSupport;
|
bool m_dvSerialSupport;
|
||||||
bool m_mimoSupport;
|
bool m_mimoSupport;
|
||||||
#ifdef DSD_USE_SERIALDV
|
|
||||||
DVSerialEngine m_dvSerialEngine;
|
|
||||||
#endif
|
|
||||||
AMBEEngine m_ambeEngine;
|
AMBEEngine m_ambeEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -707,7 +707,7 @@ margin-bottom: 20px;
|
|||||||
"description" : "1 if device is to be removed from active list"
|
"description" : "1 if device is to be removed from active list"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "AMBE devices actibe in the system"
|
"description" : "AMBE devices active in the system"
|
||||||
};
|
};
|
||||||
defs.AMBEDevices = {
|
defs.AMBEDevices = {
|
||||||
"required" : [ "nbDevices" ],
|
"required" : [ "nbDevices" ],
|
||||||
@ -27046,7 +27046,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2019-07-19T18:33:26.198+02:00
|
Generated 2019-07-20T20:43:22.760+02:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1767,7 +1767,7 @@ definitions:
|
|||||||
$ref: "#/definitions/AMBEDevice"
|
$ref: "#/definitions/AMBEDevice"
|
||||||
|
|
||||||
AMBEDevice:
|
AMBEDevice:
|
||||||
description: "AMBE devices actibe in the system"
|
description: "AMBE devices active in the system"
|
||||||
properties:
|
properties:
|
||||||
deviceRef:
|
deviceRef:
|
||||||
description: "Serial device name or server address"
|
description: "Serial device name or server address"
|
||||||
|
@ -3,8 +3,12 @@
|
|||||||
|
|
||||||
#include "settings/mainsettings.h"
|
#include "settings/mainsettings.h"
|
||||||
#include "commands/command.h"
|
#include "commands/command.h"
|
||||||
|
#include "audio/audiodevicemanager.h"
|
||||||
|
#include "ambe/ambeengine.h"
|
||||||
|
|
||||||
MainSettings::MainSettings() : m_audioDeviceManager(0)
|
MainSettings::MainSettings() :
|
||||||
|
m_audioDeviceManager(nullptr),
|
||||||
|
m_ambeEngine(nullptr)
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
qInfo("MainSettings::MainSettings: settings file: format: %d location: %s", getFileFormat(), qPrintable(getFileLocation()));
|
qInfo("MainSettings::MainSettings: settings file: format: %d location: %s", getFileFormat(), qPrintable(getFileLocation()));
|
||||||
@ -42,11 +46,14 @@ void MainSettings::load()
|
|||||||
m_preferences.deserialize(qUncompress(QByteArray::fromBase64(s.value("preferences").toByteArray())));
|
m_preferences.deserialize(qUncompress(QByteArray::fromBase64(s.value("preferences").toByteArray())));
|
||||||
m_workingPreset.deserialize(qUncompress(QByteArray::fromBase64(s.value("current").toByteArray())));
|
m_workingPreset.deserialize(qUncompress(QByteArray::fromBase64(s.value("current").toByteArray())));
|
||||||
|
|
||||||
if (m_audioDeviceManager)
|
if (m_audioDeviceManager) {
|
||||||
{
|
|
||||||
m_audioDeviceManager->deserialize(qUncompress(QByteArray::fromBase64(s.value("audio").toByteArray())));
|
m_audioDeviceManager->deserialize(qUncompress(QByteArray::fromBase64(s.value("audio").toByteArray())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ambeEngine) {
|
||||||
|
m_ambeEngine->deserialize(qUncompress(QByteArray::fromBase64(s.value("ambe").toByteArray())));
|
||||||
|
}
|
||||||
|
|
||||||
QStringList groups = s.childGroups();
|
QStringList groups = s.childGroups();
|
||||||
|
|
||||||
for(int i = 0; i < groups.size(); ++i)
|
for(int i = 0; i < groups.size(); ++i)
|
||||||
@ -95,11 +102,14 @@ void MainSettings::save() const
|
|||||||
s.setValue("preferences", qCompress(m_preferences.serialize()).toBase64());
|
s.setValue("preferences", qCompress(m_preferences.serialize()).toBase64());
|
||||||
s.setValue("current", qCompress(m_workingPreset.serialize()).toBase64());
|
s.setValue("current", qCompress(m_workingPreset.serialize()).toBase64());
|
||||||
|
|
||||||
if (m_audioDeviceManager)
|
if (m_audioDeviceManager) {
|
||||||
{
|
|
||||||
s.setValue("audio", qCompress(m_audioDeviceManager->serialize()).toBase64());
|
s.setValue("audio", qCompress(m_audioDeviceManager->serialize()).toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ambeEngine) {
|
||||||
|
s.setValue("ambe", qCompress(m_ambeEngine->serialize()).toBase64());
|
||||||
|
}
|
||||||
|
|
||||||
QStringList groups = s.childGroups();
|
QStringList groups = s.childGroups();
|
||||||
|
|
||||||
for(int i = 0; i < groups.size(); ++i)
|
for(int i = 0; i < groups.size(); ++i)
|
||||||
|
@ -2,13 +2,14 @@
|
|||||||
#define INCLUDE_SETTINGS_H
|
#define INCLUDE_SETTINGS_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "audio/audiodevicemanager.h"
|
|
||||||
#include "device/deviceuserargs.h"
|
#include "device/deviceuserargs.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "preset.h"
|
#include "preset.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
class Command;
|
class Command;
|
||||||
|
class AudioDeviceManager;
|
||||||
|
class AMBEEngine;
|
||||||
|
|
||||||
class SDRBASE_API MainSettings {
|
class SDRBASE_API MainSettings {
|
||||||
public:
|
public:
|
||||||
@ -63,6 +64,7 @@ public:
|
|||||||
|
|
||||||
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
||||||
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
||||||
|
void setAMBEEngine(AMBEEngine *ambeEngine) { m_ambeEngine = ambeEngine; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Preferences m_preferences;
|
Preferences m_preferences;
|
||||||
@ -73,6 +75,7 @@ protected:
|
|||||||
typedef QList<Command*> Commands;
|
typedef QList<Command*> Commands;
|
||||||
Commands m_commands;
|
Commands m_commands;
|
||||||
DeviceUserArgs m_hardwareDeviceUserArgs;
|
DeviceUserArgs m_hardwareDeviceUserArgs;
|
||||||
|
AMBEEngine *m_ambeEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_SETTINGS_H
|
#endif // INCLUDE_SETTINGS_H
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
ParserBench::ParserBench() :
|
ParserBench::ParserBench() :
|
||||||
m_testOption(QStringList() << "t" << "test",
|
m_testOption(QStringList() << "t" << "test",
|
||||||
"Test type.",
|
"Test type: decimateii, decimatefi, decimateff, decimateif, decimateinfii, decimatesupii, ambe",
|
||||||
"test",
|
"test",
|
||||||
"decimateii"),
|
"decimateii"),
|
||||||
m_nbSamplesOption(QStringList() << "n" << "nb-samples",
|
m_nbSamplesOption(QStringList() << "n" << "nb-samples",
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "ambedevicesdialog.h"
|
#include "ambedevicesdialog.h"
|
||||||
#include "ui_ambedevicesdialog.h"
|
#include "ui_ambedevicesdialog.h"
|
||||||
|
|
||||||
AMBEDevicesDialog::AMBEDevicesDialog(AMBEEngine& ambeEngine, QWidget* parent) :
|
AMBEDevicesDialog::AMBEDevicesDialog(AMBEEngine* ambeEngine, QWidget* parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AMBEDevicesDialog),
|
ui(new Ui::AMBEDevicesDialog),
|
||||||
m_ambeEngine(ambeEngine)
|
m_ambeEngine(ambeEngine)
|
||||||
@ -40,7 +40,7 @@ AMBEDevicesDialog::~AMBEDevicesDialog()
|
|||||||
void AMBEDevicesDialog::populateSerialList()
|
void AMBEDevicesDialog::populateSerialList()
|
||||||
{
|
{
|
||||||
std::vector<QString> ambeSerialDevices;
|
std::vector<QString> ambeSerialDevices;
|
||||||
m_ambeEngine.scan(ambeSerialDevices);
|
m_ambeEngine->scan(ambeSerialDevices);
|
||||||
ui->ambeSerialDevices->clear();
|
ui->ambeSerialDevices->clear();
|
||||||
std::vector<QString>::const_iterator it = ambeSerialDevices.begin();
|
std::vector<QString>::const_iterator it = ambeSerialDevices.begin();
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ void AMBEDevicesDialog::populateSerialList()
|
|||||||
void AMBEDevicesDialog::refreshInUseList()
|
void AMBEDevicesDialog::refreshInUseList()
|
||||||
{
|
{
|
||||||
std::vector<QString> inUseDevices;
|
std::vector<QString> inUseDevices;
|
||||||
m_ambeEngine.getDeviceRefs(inUseDevices);
|
m_ambeEngine->getDeviceRefs(inUseDevices);
|
||||||
ui->ambeDeviceRefs->clear();
|
ui->ambeDeviceRefs->clear();
|
||||||
std::vector<QString>::const_iterator it = inUseDevices.begin();
|
std::vector<QString>::const_iterator it = inUseDevices.begin();
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ void AMBEDevicesDialog::on_importSerial_clicked(bool checked)
|
|||||||
|
|
||||||
if (foundItems.size() == 0)
|
if (foundItems.size() == 0)
|
||||||
{
|
{
|
||||||
if (m_ambeEngine.registerController(serialName.toStdString()))
|
if (m_ambeEngine->registerController(serialName.toStdString()))
|
||||||
{
|
{
|
||||||
ui->ambeDeviceRefs->addItem(serialName);
|
ui->ambeDeviceRefs->addItem(serialName);
|
||||||
ui->statusText->setText(tr("%1 added").arg(serialName));
|
ui->statusText->setText(tr("%1 added").arg(serialName));
|
||||||
@ -109,7 +109,7 @@ void AMBEDevicesDialog::on_importAllSerial_clicked(bool checked)
|
|||||||
|
|
||||||
if (foundItems.size() == 0)
|
if (foundItems.size() == 0)
|
||||||
{
|
{
|
||||||
if (m_ambeEngine.registerController(serialName.toStdString()))
|
if (m_ambeEngine->registerController(serialName.toStdString()))
|
||||||
{
|
{
|
||||||
ui->ambeDeviceRefs->addItem(serialName);
|
ui->ambeDeviceRefs->addItem(serialName);
|
||||||
count++;
|
count++;
|
||||||
@ -132,7 +132,7 @@ void AMBEDevicesDialog::on_removeAmbeDevice_clicked(bool checked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString deviceName = deviceItem->text();
|
QString deviceName = deviceItem->text();
|
||||||
m_ambeEngine.releaseController(deviceName.toStdString());
|
m_ambeEngine->releaseController(deviceName.toStdString());
|
||||||
ui->statusText->setText(tr("%1 removed").arg(deviceName));
|
ui->statusText->setText(tr("%1 removed").arg(deviceName));
|
||||||
refreshInUseList();
|
refreshInUseList();
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ void AMBEDevicesDialog::on_clearAmbeList_clicked(bool checked)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ambeEngine.releaseAll();
|
m_ambeEngine->releaseAll();
|
||||||
ui->ambeDeviceRefs->clear();
|
ui->ambeDeviceRefs->clear();
|
||||||
ui->statusText->setText("All items released");
|
ui->statusText->setText("All items released");
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ void AMBEDevicesDialog::on_importAddress_clicked(bool checked)
|
|||||||
|
|
||||||
if (foundItems.size() == 0)
|
if (foundItems.size() == 0)
|
||||||
{
|
{
|
||||||
if (m_ambeEngine.registerController(addressAndPort.toStdString()))
|
if (m_ambeEngine->registerController(addressAndPort.toStdString()))
|
||||||
{
|
{
|
||||||
ui->ambeDeviceRefs->addItem(addressAndPort);
|
ui->ambeDeviceRefs->addItem(addressAndPort);
|
||||||
ui->statusText->setText(tr("%1 added").arg(addressAndPort));
|
ui->statusText->setText(tr("%1 added").arg(addressAndPort));
|
||||||
|
@ -34,7 +34,7 @@ class SDRGUI_API AMBEDevicesDialog : public QDialog {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AMBEDevicesDialog(AMBEEngine& ambeEngine, QWidget* parent = nullptr);
|
explicit AMBEDevicesDialog(AMBEEngine* ambeEngine, QWidget* parent = nullptr);
|
||||||
~AMBEDevicesDialog();
|
~AMBEDevicesDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -42,7 +42,7 @@ private:
|
|||||||
void refreshInUseList();
|
void refreshInUseList();
|
||||||
|
|
||||||
Ui::AMBEDevicesDialog* ui;
|
Ui::AMBEDevicesDialog* ui;
|
||||||
AMBEEngine& m_ambeEngine;
|
AMBEEngine* m_ambeEngine;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_importSerial_clicked(bool checked);
|
void on_importSerial_clicked(bool checked);
|
||||||
|
@ -123,6 +123,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
|||||||
splash->showStatusMessage("starting...", Qt::white);
|
splash->showStatusMessage("starting...", Qt::white);
|
||||||
|
|
||||||
m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
|
m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
|
||||||
|
m_settings.setAMBEEngine(m_dspEngine->getAMBEEngine());
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
@ -1628,48 +1629,6 @@ void MainWindow::on_action_AMBE_triggered()
|
|||||||
ambeDevicesDialog.exec();
|
ambeDevicesDialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_DV_Serial_triggered(bool checked)
|
|
||||||
{
|
|
||||||
m_dspEngine->setDVSerialSupport(checked);
|
|
||||||
|
|
||||||
if (checked)
|
|
||||||
{
|
|
||||||
if (m_dspEngine->hasDVSerialSupport())
|
|
||||||
{
|
|
||||||
std::vector<std::string> deviceNames;
|
|
||||||
m_dspEngine->getDVSerialNames(deviceNames);
|
|
||||||
|
|
||||||
if (deviceNames.size() == 0)
|
|
||||||
{
|
|
||||||
QMessageBox::information(this, tr("Message"), tr("No DV serial devices found"));
|
|
||||||
qDebug("MainWindow::on_action_DV_Serial_triggered: No DV serial devices found");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::vector<std::string>::iterator it = deviceNames.begin();
|
|
||||||
std::string deviceNamesStr = "DV Serial devices found: ";
|
|
||||||
|
|
||||||
while (it != deviceNames.end())
|
|
||||||
{
|
|
||||||
if (it != deviceNames.begin()) {
|
|
||||||
deviceNamesStr += ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
deviceNamesStr += *it;
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox::information(this, tr("Message"), tr(deviceNamesStr.c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QMessageBox::information(this, tr("Message"), tr("No DV serial support"));
|
|
||||||
qDebug("MainWindow::on_action_DV_Serial_triggered: No DV serial support");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::sampleSourceChanged()
|
void MainWindow::sampleSourceChanged()
|
||||||
{
|
{
|
||||||
// Do it in the currently selected source tab
|
// Do it in the currently selected source tab
|
||||||
|
@ -380,7 +380,6 @@ private slots:
|
|||||||
void on_action_Audio_triggered();
|
void on_action_Audio_triggered();
|
||||||
void on_action_Logging_triggered();
|
void on_action_Logging_triggered();
|
||||||
void on_action_AMBE_triggered();
|
void on_action_AMBE_triggered();
|
||||||
void on_action_DV_Serial_triggered(bool checked);
|
|
||||||
void on_action_My_Position_triggered();
|
void on_action_My_Position_triggered();
|
||||||
void on_action_DeviceUserArguments_triggered();
|
void on_action_DeviceUserArguments_triggered();
|
||||||
void sampleSourceChanged();
|
void sampleSourceChanged();
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1012</width>
|
<width>1012</width>
|
||||||
<height>19</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_File">
|
<widget class="QMenu" name="menu_File">
|
||||||
@ -126,7 +126,6 @@
|
|||||||
<addaction name="action_Audio"/>
|
<addaction name="action_Audio"/>
|
||||||
<addaction name="action_Logging"/>
|
<addaction name="action_Logging"/>
|
||||||
<addaction name="action_AMBE"/>
|
<addaction name="action_AMBE"/>
|
||||||
<addaction name="action_DV_Serial"/>
|
|
||||||
<addaction name="action_My_Position"/>
|
<addaction name="action_My_Position"/>
|
||||||
<addaction name="menuDevices"/>
|
<addaction name="menuDevices"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -59,6 +59,7 @@ MainCore::MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, Q
|
|||||||
|
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
|
m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager());
|
||||||
|
m_settings.setAMBEEngine(m_dspEngine->getAMBEEngine());
|
||||||
|
|
||||||
m_pluginManager = new PluginManager(this);
|
m_pluginManager = new PluginManager(this);
|
||||||
m_pluginManager->loadPlugins(QString("pluginssrv"));
|
m_pluginManager->loadPlugins(QString("pluginssrv"));
|
||||||
|
@ -1767,7 +1767,7 @@ definitions:
|
|||||||
$ref: "#/definitions/AMBEDevice"
|
$ref: "#/definitions/AMBEDevice"
|
||||||
|
|
||||||
AMBEDevice:
|
AMBEDevice:
|
||||||
description: "AMBE devices actibe in the system"
|
description: "AMBE devices active in the system"
|
||||||
properties:
|
properties:
|
||||||
deviceRef:
|
deviceRef:
|
||||||
description: "Serial device name or server address"
|
description: "Serial device name or server address"
|
||||||
|
@ -707,7 +707,7 @@ margin-bottom: 20px;
|
|||||||
"description" : "1 if device is to be removed from active list"
|
"description" : "1 if device is to be removed from active list"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "AMBE devices actibe in the system"
|
"description" : "AMBE devices active in the system"
|
||||||
};
|
};
|
||||||
defs.AMBEDevices = {
|
defs.AMBEDevices = {
|
||||||
"required" : [ "nbDevices" ],
|
"required" : [ "nbDevices" ],
|
||||||
@ -27046,7 +27046,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2019-07-19T18:33:26.198+02:00
|
Generated 2019-07-20T20:43:22.760+02:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/*
|
/*
|
||||||
* SWGAMBEDevice.h
|
* SWGAMBEDevice.h
|
||||||
*
|
*
|
||||||
* AMBE devices actibe in the system
|
* AMBE devices active in the system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SWGAMBEDevice_H_
|
#ifndef SWGAMBEDevice_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user