You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
5.3 KiB
111 lines
5.3 KiB
/////////////////////////////////////////////////////////////////////////////////// |
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany // |
|
// written by Christian Daniel // |
|
// Copyright (C) 2015-2020, 2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> // |
|
// Copyright (C) 2015 John Greb <hexameron@spam.no> // |
|
// // |
|
// This program is free software; you can redistribute it and/or modify // |
|
// it under the terms of the GNU General Public License as published by // |
|
// the Free Software Foundation as version 3 of the License, or // |
|
// (at your option) any later version. // |
|
// // |
|
// This program is distributed in the hope that it will be useful, // |
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
// GNU General Public License V3 for more details. // |
|
// // |
|
// You should have received a copy of the GNU General Public License // |
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. // |
|
/////////////////////////////////////////////////////////////////////////////////// |
|
|
|
#ifndef SDRSRV_DEVICE_DEVICESET_H_ |
|
#define SDRSRV_DEVICE_DEVICESET_H_ |
|
|
|
#include <QTimer> |
|
#include <QJsonObject> |
|
|
|
#include "export.h" |
|
|
|
class DeviceAPI; |
|
class DSPDeviceSourceEngine; |
|
class DSPDeviceSinkEngine; |
|
class DSPDeviceMIMOEngine; |
|
class PluginAPI; |
|
class ChannelAPI; |
|
class Preset; |
|
class SpectrumVis; |
|
|
|
namespace SWGSDRangel { |
|
class SWGGLSpectrum; |
|
class SWGGLSpectrumReport; |
|
class SWGSpectrumActions; |
|
class SWGGLSpectrumData; |
|
class SWGGLSpectrumHistory; |
|
class SWGSpectrumServer; |
|
class SWGSuccessResponse; |
|
}; |
|
|
|
class SDRBASE_API DeviceSet |
|
{ |
|
public: |
|
DeviceAPI *m_deviceAPI; |
|
DSPDeviceSourceEngine *m_deviceSourceEngine; |
|
DSPDeviceSinkEngine *m_deviceSinkEngine; |
|
DSPDeviceMIMOEngine *m_deviceMIMOEngine; |
|
SpectrumVis *m_spectrumVis; |
|
|
|
DeviceSet(int tabIndex, int deviceType); |
|
~DeviceSet(); |
|
DeviceSet(const DeviceSet&) = delete; |
|
DeviceSet& operator=(const DeviceSet&) = delete; |
|
|
|
int getNumberOfChannels() const { return m_channelInstanceRegistrations.size(); } |
|
int getIndex() const { return m_deviceTabIndex; } |
|
void setIndex(int index) { m_deviceTabIndex = index; } |
|
void freeChannels(); |
|
const ChannelAPI *getChannelAt(int channelIndex) const; |
|
ChannelAPI *getChannelAt(int channelIndex); |
|
void deleteChannel(int channelIndex); |
|
void loadRxChannelSettings(const Preset* preset, PluginAPI *pluginAPI); |
|
void saveRxChannelSettings(Preset* preset); |
|
void loadTxChannelSettings(const Preset* preset, PluginAPI *pluginAPI); |
|
void saveTxChannelSettings(Preset* preset); |
|
void loadMIMOChannelSettings(const Preset* preset, PluginAPI *pluginAPI); |
|
void saveMIMOChannelSettings(Preset* preset); |
|
ChannelAPI *addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI); |
|
ChannelAPI *addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI); |
|
ChannelAPI *addMIMOChannel(int selectedChannelIndex, PluginAPI *pluginAPI); |
|
// slave mode |
|
void addChannelInstance(ChannelAPI *channelAPI); |
|
void removeChannelInstanceAt(int index); |
|
void removeChannelInstance(ChannelAPI *channelAPI); |
|
void clearChannels(); |
|
|
|
// REST API |
|
int webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const; |
|
int webapiSpectrumReportGet(SWGSDRangel::SWGGLSpectrumReport& response, QString& errorMessage) const; |
|
int webapiSpectrumDataGet(int bins, qint64 startFrequency, qint64 stopFrequency, const QString& reduce, |
|
SWGSDRangel::SWGGLSpectrumData& response, QString& errorMessage) const; |
|
int webapiSpectrumHistoryGet(double seconds, int bins, qint64 startFrequency, qint64 stopFrequency, double thresholdDb, |
|
SWGSDRangel::SWGGLSpectrumHistory& response, QString& errorMessage) const; |
|
int webapiSpectrumHistoryImageGet(double seconds, int bins, qint64 startFrequency, qint64 stopFrequency, int maxRows, |
|
QByteArray& png, QJsonObject& description, QString& errorMessage) const; |
|
int webapiSpectrumActionsPost(const QStringList& spectrumActionsKeys, SWGSDRangel::SWGSpectrumActions& query, QString& errorMessage); |
|
int webapiSpectrumSettingsPutPatch( |
|
bool force, |
|
const QStringList& spectrumSettingsKeys, |
|
SWGSDRangel::SWGGLSpectrum& response, // query + response |
|
QString& errorMessage); |
|
int webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& response, QString& errorMessage) const; |
|
int webapiSpectrumServerPost(SWGSDRangel::SWGSuccessResponse& response, QString& errorMessage); |
|
int webapiSpectrumServerDelete(SWGSDRangel::SWGSuccessResponse& response, QString& errorMessage); |
|
|
|
private: |
|
QList<ChannelAPI*> m_channelInstanceRegistrations; |
|
int m_deviceTabIndex; |
|
|
|
void renameChannelInstances(); |
|
static bool compareChannels(const ChannelAPI *channelA, const ChannelAPI *channelB); |
|
}; |
|
|
|
#endif /* SDRSRV_DEVICE_DEVICESET_H_ */
|
|
|