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.
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
WebAPIAdapterSrv Class Reference

#include <webapiadaptersrv.h>

+ Inheritance diagram for WebAPIAdapterSrv:
+ Collaboration diagram for WebAPIAdapterSrv:

Public Member Functions

 WebAPIAdapterSrv (MainCore &mainCore)
 
virtual ~WebAPIAdapterSrv ()
 
virtual int instanceSummary (SWGSDRangel::SWGInstanceSummaryResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDelete (SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceConfigGet (SWGSDRangel::SWGInstanceConfigResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDevices (int direction, SWGSDRangel::SWGInstanceDevicesResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceChannels (int direction, SWGSDRangel::SWGInstanceChannelsResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceLoggingGet (SWGSDRangel::SWGLoggingInfo &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceLoggingPut (SWGSDRangel::SWGLoggingInfo &query, SWGSDRangel::SWGLoggingInfo &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioGet (SWGSDRangel::SWGAudioDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioInputPatch (SWGSDRangel::SWGAudioInputDevice &response, const QStringList &audioInputKeys, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioOutputPatch (SWGSDRangel::SWGAudioOutputDevice &response, const QStringList &audioOutputKeys, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioInputDelete (SWGSDRangel::SWGAudioInputDevice &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioOutputDelete (SWGSDRangel::SWGAudioOutputDevice &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioInputCleanupPatch (SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAudioOutputCleanupPatch (SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceLocationGet (SWGSDRangel::SWGLocationInformation &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceLocationPut (SWGSDRangel::SWGLocationInformation &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDVSerialGet (SWGSDRangel::SWGDVSerialDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDVSerialPatch (bool dvserial, SWGSDRangel::SWGDVSerialDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAMBESerialGet (SWGSDRangel::SWGDVSerialDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAMBEDevicesGet (SWGSDRangel::SWGAMBEDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAMBEDevicesPut (SWGSDRangel::SWGAMBEDevices &query, SWGSDRangel::SWGAMBEDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAMBEDevicesPatch (SWGSDRangel::SWGAMBEDevices &query, SWGSDRangel::SWGAMBEDevices &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceAMBEDevicesDelete (SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetFilePut (SWGSDRangel::SWGPresetImport &query, SWGSDRangel::SWGPresetIdentifier &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetFilePost (SWGSDRangel::SWGPresetExport &query, SWGSDRangel::SWGPresetIdentifier &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetsGet (SWGSDRangel::SWGPresets &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetPatch (SWGSDRangel::SWGPresetTransfer &query, SWGSDRangel::SWGPresetIdentifier &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetPut (SWGSDRangel::SWGPresetTransfer &query, SWGSDRangel::SWGPresetIdentifier &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetPost (SWGSDRangel::SWGPresetTransfer &query, SWGSDRangel::SWGPresetIdentifier &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instancePresetDelete (SWGSDRangel::SWGPresetIdentifier &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDeviceSetsGet (SWGSDRangel::SWGDeviceSetList &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDeviceSetPost (int direction, SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int instanceDeviceSetDelete (SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetGet (int deviceSetIndex, SWGSDRangel::SWGDeviceSet &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetFocusPatch (int deviceSetIndex, SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDevicePut (int deviceSetIndex, SWGSDRangel::SWGDeviceListItem &query, SWGSDRangel::SWGDeviceListItem &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDeviceSettingsGet (int deviceSetIndex, SWGSDRangel::SWGDeviceSettings &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDeviceSettingsPutPatch (int deviceSetIndex, bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDeviceRunGet (int deviceSetIndex, SWGSDRangel::SWGDeviceState &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDeviceRunPost (int deviceSetIndex, SWGSDRangel::SWGDeviceState &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDeviceRunDelete (int deviceSetIndex, SWGSDRangel::SWGDeviceState &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetDeviceReportGet (int deviceSetIndex, SWGSDRangel::SWGDeviceReport &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetChannelsReportGet (int deviceSetIndex, SWGSDRangel::SWGChannelsDetail &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetChannelPost (int deviceSetIndex, SWGSDRangel::SWGChannelSettings &query, SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetChannelDelete (int deviceSetIndex, int channelIndex, SWGSDRangel::SWGSuccessResponse &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetChannelSettingsGet (int deviceSetIndex, int channelIndex, SWGSDRangel::SWGChannelSettings &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetChannelSettingsPutPatch (int deviceSetIndex, int channelIndex, bool force, const QStringList &channelSettingsKeys, SWGSDRangel::SWGChannelSettings &response, SWGSDRangel::SWGErrorResponse &error)
 
virtual int devicesetChannelReportGet (int deviceSetIndex, int channelIndex, SWGSDRangel::SWGChannelReport &response, SWGSDRangel::SWGErrorResponse &error)
 
- Public Member Functions inherited from WebAPIAdapterInterface
virtual ~WebAPIAdapterInterface ()
 

Private Member Functions

void getDeviceSetList (SWGSDRangel::SWGDeviceSetList *deviceSetList)
 
void getDeviceSet (SWGSDRangel::SWGDeviceSet *swgDeviceSet, const DeviceSet *deviceSet, int deviceUISetIndex)
 
void getChannelsDetail (SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceSet *deviceSet)
 

Static Private Member Functions

static QtMsgType getMsgTypeFromString (const QString &msgTypeString)
 
static void getMsgTypeString (const QtMsgType &msgType, QString &level)
 

Private Attributes

MainCorem_mainCore
 

Additional Inherited Members

- Static Public Attributes inherited from WebAPIAdapterInterface
static QString instanceSummaryURL = "/sdrangel"
 
static QString instanceConfigURL = "/sdrangel/config"
 
static QString instanceDevicesURL = "/sdrangel/devices"
 
static QString instanceChannelsURL = "/sdrangel/channels"
 
static QString instanceLoggingURL = "/sdrangel/logging"
 
static QString instanceAudioURL = "/sdrangel/audio"
 
static QString instanceAudioInputParametersURL = "/sdrangel/audio/input/parameters"
 
static QString instanceAudioOutputParametersURL = "/sdrangel/audio/output/parameters"
 
static QString instanceAudioInputCleanupURL = "/sdrangel/audio/input/cleanup"
 
static QString instanceAudioOutputCleanupURL = "/sdrangel/audio/output/cleanup"
 
static QString instanceLocationURL = "/sdrangel/location"
 
static QString instanceAMBESerialURL = "/sdrangel/ambe/serial"
 
static QString instanceAMBEDevicesURL = "/sdrangel/ambe/devices"
 
static QString instancePresetsURL = "/sdrangel/presets"
 
static QString instancePresetURL = "/sdrangel/preset"
 
static QString instancePresetFileURL = "/sdrangel/preset/file"
 
static QString instanceDeviceSetsURL = "/sdrangel/devicesets"
 
static QString instanceDeviceSetURL = "/sdrangel/deviceset"
 
static std::regex devicesetURLRe
 
static std::regex devicesetFocusURLRe
 
static std::regex devicesetDeviceURLRe
 
static std::regex devicesetDeviceSettingsURLRe
 
static std::regex devicesetDeviceRunURLRe
 
static std::regex devicesetDeviceReportURLRe
 
static std::regex devicesetChannelURLRe
 
static std::regex devicesetChannelIndexURLRe
 
static std::regex devicesetChannelSettingsURLRe
 
static std::regex devicesetChannelReportURLRe
 
static std::regex devicesetChannelsReportURLRe
 

Detailed Description

Definition at line 30 of file webapiadaptersrv.h.

Constructor & Destructor Documentation

◆ WebAPIAdapterSrv()

WebAPIAdapterSrv::WebAPIAdapterSrv ( MainCore mainCore)

Definition at line 63 of file webapiadaptersrv.cpp.

63  :
64  m_mainCore(mainCore)
65 {
66 }

◆ ~WebAPIAdapterSrv()

WebAPIAdapterSrv::~WebAPIAdapterSrv ( )
virtual

Definition at line 68 of file webapiadaptersrv.cpp.

69 {
70 }

Member Function Documentation

◆ devicesetChannelDelete()

int WebAPIAdapterSrv::devicesetChannelDelete ( int  deviceSetIndex,
int  channelIndex,
SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex} (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1667 of file webapiadaptersrv.cpp.

References MainCore::MsgDeleteChannel::create(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGSuccessResponse::init(), MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, MainCore::m_inputMessageQueue, m_mainCore, and MessageQueue::push().

1672 {
1673  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1674  {
1675  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1676 
1677  if (deviceSet->m_deviceSourceEngine) // Rx
1678  {
1679  if (channelIndex < deviceSet->getNumberOfRxChannels())
1680  {
1681  MainCore::MsgDeleteChannel *msg = MainCore::MsgDeleteChannel::create(deviceSetIndex, channelIndex, false);
1683 
1684  response.init();
1685  *response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
1686 
1687  return 202;
1688  }
1689  else
1690  {
1691  error.init();
1692  *error.getMessage() = QString("There is no channel at index %1. There are %2 Rx channels")
1693  .arg(channelIndex)
1694  .arg(channelIndex < deviceSet->getNumberOfRxChannels());
1695  return 400;
1696  }
1697  }
1698  else if (deviceSet->m_deviceSinkEngine) // Tx
1699  {
1700  if (channelIndex < deviceSet->getNumberOfTxChannels())
1701  {
1702  MainCore::MsgDeleteChannel *msg = MainCore::MsgDeleteChannel::create(deviceSetIndex, channelIndex, true);
1704 
1705  response.init();
1706  *response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
1707 
1708  return 202;
1709  }
1710  else
1711  {
1712  error.init();
1713  *error.getMessage() = QString("There is no channel at index %1. There are %2 Tx channels")
1714  .arg(channelIndex)
1715  .arg(channelIndex < deviceSet->getNumberOfRxChannels());
1716  return 400;
1717  }
1718  }
1719  else
1720  {
1721  error.init();
1722  *error.getMessage() = QString("DeviceSet error");
1723  return 500;
1724  }
1725  }
1726  else
1727  {
1728  error.init();
1729  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1730  return 404;
1731  }
1732 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
static MsgDeleteChannel * create(int deviceSetIndex, int channelIndex, bool tx)
Definition: maincore.h:254
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetChannelPost()

int WebAPIAdapterSrv::devicesetChannelPost ( int  deviceSetIndex,
SWGSDRangel::SWGChannelSettings query,
SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{deviceSetIndex}/channel (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1570 of file webapiadaptersrv.cpp.

References MainCore::MsgAddChannel::create(), SWGSDRangel::SWGChannelSettings::getChannelType(), SWGSDRangel::SWGChannelSettings::getDirection(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::getMessage(), PluginManager::getRxChannelRegistrations(), PluginManager::getTxChannelRegistrations(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGSuccessResponse::init(), MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, MainCore::m_inputMessageQueue, m_mainCore, MainCore::m_pluginManager, and MessageQueue::push().

1575 {
1576  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1577  {
1578  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1579 
1580  if (query.getDirection() == 0) // Single Rx
1581  {
1582  if (deviceSet->m_deviceSourceEngine == 0)
1583  {
1584  error.init();
1585  *error.getMessage() = QString("Device set at %1 is not a receive device set").arg(deviceSetIndex);
1586  return 400;
1587  }
1588 
1590  int nbRegistrations = channelRegistrations->size();
1591  int index = 0;
1592  for (; index < nbRegistrations; index++)
1593  {
1594  if (channelRegistrations->at(index).m_channelId == *query.getChannelType()) {
1595  break;
1596  }
1597  }
1598 
1599  if (index < nbRegistrations)
1600  {
1601  MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, false);
1603 
1604  response.init();
1605  *response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully");
1606 
1607  return 202;
1608  }
1609  else
1610  {
1611  error.init();
1612  *error.getMessage() = QString("There is no receive channel with id %1").arg(*query.getChannelType());
1613  return 404;
1614  }
1615  }
1616  else if (query.getDirection() == 1) // single Tx
1617  {
1618  if (deviceSet->m_deviceSinkEngine == 0)
1619  {
1620  error.init();
1621  *error.getMessage() = QString("Device set at %1 is not a transmit device set").arg(deviceSetIndex);
1622  return 400;
1623  }
1624 
1626  int nbRegistrations = channelRegistrations->size();
1627  int index = 0;
1628  for (; index < nbRegistrations; index++)
1629  {
1630  if (channelRegistrations->at(index).m_channelId == *query.getChannelType()) {
1631  break;
1632  }
1633  }
1634 
1635  if (index < nbRegistrations)
1636  {
1637  MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, true);
1639 
1640  response.init();
1641  *response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully");
1642 
1643  return 202;
1644  }
1645  else
1646  {
1647  error.init();
1648  *error.getMessage() = QString("There is no transmit channel with id %1").arg(*query.getChannelType());
1649  return 404;
1650  }
1651  }
1652  else
1653  {
1654  error.init();
1655  *error.getMessage() = QString("This type of device is not implemented yet");
1656  return 400;
1657  }
1658  }
1659  else
1660  {
1661  error.init();
1662  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1663  return 404;
1664  }
1665 }
QList< ChannelRegistration > ChannelRegistrations
Definition: pluginapi.h:44
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
PluginAPI::ChannelRegistrations * getRxChannelRegistrations()
Definition: pluginmanager.h:74
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
PluginAPI::ChannelRegistrations * getTxChannelRegistrations()
Definition: pluginmanager.h:75
static MsgAddChannel * create(int deviceSetIndex, int channelRegistrationIndex, bool tx)
Definition: maincore.h:228
PluginManager * m_pluginManager
Definition: maincore.h:282
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetChannelReportGet()

int WebAPIAdapterSrv::devicesetChannelReportGet ( int  deviceSetIndex,
int  channelIndex,
SWGSDRangel::SWGChannelReport response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1793 of file webapiadaptersrv.cpp.

References DeviceAPI::getChanelSinkAPIAt(), DeviceAPI::getChanelSourceAPIAt(), SWGSDRangel::SWGChannelReport::getChannelType(), ChannelAPI::getIdentifier(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, SWGSDRangel::SWGChannelReport::setChannelType(), SWGSDRangel::SWGChannelReport::setDirection(), and ChannelAPI::webapiReportGet().

1798 {
1799  error.init();
1800 
1801  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1802  {
1803  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1804 
1805  if (deviceSet->m_deviceSourceEngine) // Single Rx
1806  {
1807  ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex);
1808 
1809  if (channelAPI == 0)
1810  {
1811  *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
1812  return 404;
1813  }
1814  else
1815  {
1816  response.setChannelType(new QString());
1817  channelAPI->getIdentifier(*response.getChannelType());
1818  response.setDirection(0);
1819  return channelAPI->webapiReportGet(response, *error.getMessage());
1820  }
1821  }
1822  else if (deviceSet->m_deviceSinkEngine) // Single Tx
1823  {
1824  ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex);
1825 
1826  if (channelAPI == 0)
1827  {
1828  *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
1829  return 404;
1830  }
1831  else
1832  {
1833  response.setChannelType(new QString());
1834  channelAPI->getIdentifier(*response.getChannelType());
1835  response.setDirection(1);
1836  return channelAPI->webapiReportGet(response, *error.getMessage());
1837  }
1838  }
1839  else
1840  {
1841  *error.getMessage() = QString("DeviceSet error");
1842  return 500;
1843  }
1844  }
1845  else
1846  {
1847  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1848  return 404;
1849  }
1850 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
ChannelAPI * getChanelSinkAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:445
virtual void getIdentifier(QString &id)=0
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
virtual int webapiReportGet(SWGSDRangel::SWGChannelReport &response, QString &errorMessage)
Definition: channelapi.h:79
void setChannelType(QString *channel_type)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
ChannelAPI * getChanelSourceAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:463
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
void setDirection(qint32 direction)
+ Here is the call graph for this function:

◆ devicesetChannelSettingsGet()

int WebAPIAdapterSrv::devicesetChannelSettingsGet ( int  deviceSetIndex,
int  channelIndex,
SWGSDRangel::SWGChannelSettings response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1734 of file webapiadaptersrv.cpp.

References DeviceAPI::getChanelSinkAPIAt(), DeviceAPI::getChanelSourceAPIAt(), SWGSDRangel::SWGChannelSettings::getChannelType(), ChannelAPI::getIdentifier(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, SWGSDRangel::SWGChannelSettings::setChannelType(), SWGSDRangel::SWGChannelSettings::setDirection(), and ChannelAPI::webapiSettingsGet().

1739 {
1740  error.init();
1741 
1742  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1743  {
1744  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1745 
1746  if (deviceSet->m_deviceSourceEngine) // Single Rx
1747  {
1748  ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex);
1749 
1750  if (channelAPI == 0)
1751  {
1752  *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
1753  return 404;
1754  }
1755  else
1756  {
1757  response.setChannelType(new QString());
1758  channelAPI->getIdentifier(*response.getChannelType());
1759  response.setDirection(0);
1760  return channelAPI->webapiSettingsGet(response, *error.getMessage());
1761  }
1762  }
1763  else if (deviceSet->m_deviceSinkEngine) // Single Tx
1764  {
1765  ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex);
1766 
1767  if (channelAPI == 0)
1768  {
1769  *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
1770  return 404;
1771  }
1772  else
1773  {
1774  response.setChannelType(new QString());
1775  channelAPI->getIdentifier(*response.getChannelType());
1776  response.setDirection(1);
1777  return channelAPI->webapiSettingsGet(response, *error.getMessage());
1778  }
1779  }
1780  else
1781  {
1782  *error.getMessage() = QString("DeviceSet error");
1783  return 500;
1784  }
1785  }
1786  else
1787  {
1788  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1789  return 404;
1790  }
1791 }
virtual int webapiSettingsGet(SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
Definition: channelapi.h:59
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
ChannelAPI * getChanelSinkAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:445
virtual void getIdentifier(QString &id)=0
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
void setChannelType(QString *channel_type)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
ChannelAPI * getChanelSourceAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:463
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetChannelSettingsPutPatch()

int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch ( int  deviceSetIndex,
int  channelIndex,
bool  force,
const QStringList &  channelSettingsKeys,
SWGSDRangel::SWGChannelSettings response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings (PUT, PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1852 of file webapiadaptersrv.cpp.

References arg(), DeviceAPI::getChanelSinkAPIAt(), DeviceAPI::getChanelSourceAPIAt(), SWGSDRangel::SWGChannelSettings::getChannelType(), ChannelAPI::getIdentifier(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, and ChannelAPI::webapiSettingsPutPatch().

1859 {
1860  error.init();
1861 
1862  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1863  {
1864  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1865 
1866  if (deviceSet->m_deviceSourceEngine) // Rx
1867  {
1868  ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex);
1869 
1870  if (channelAPI == 0)
1871  {
1872  *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
1873  return 404;
1874  }
1875  else
1876  {
1877  QString channelType;
1878  channelAPI->getIdentifier(channelType);
1879 
1880  if (channelType == *response.getChannelType())
1881  {
1882  return channelAPI->webapiSettingsPutPatch(force, channelSettingsKeys, response, *error.getMessage());
1883  }
1884  else
1885  {
1886  *error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
1887  .arg(*response.getChannelType())
1888  .arg(channelIndex)
1889  .arg(channelType);
1890  return 404;
1891  }
1892  }
1893  }
1894  else if (deviceSet->m_deviceSinkEngine) // Tx
1895  {
1896  ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex);
1897 
1898  if (channelAPI == 0)
1899  {
1900  *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
1901  return 404;
1902  }
1903  else
1904  {
1905  QString channelType;
1906  channelAPI->getIdentifier(channelType);
1907 
1908  if (channelType == *response.getChannelType())
1909  {
1910  return channelAPI->webapiSettingsPutPatch(force, channelSettingsKeys, response, *error.getMessage());
1911  }
1912  else
1913  {
1914  *error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
1915  .arg(*response.getChannelType())
1916  .arg(channelIndex)
1917  .arg(channelType);
1918  return 404;
1919  }
1920  }
1921  }
1922  else
1923  {
1924  *error.getMessage() = QString("DeviceSet error");
1925  return 500;
1926  }
1927  }
1928  else
1929  {
1930  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1931  return 404;
1932  }
1933 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
ChannelAPI * getChanelSinkAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:445
virtual void getIdentifier(QString &id)=0
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
virtual int webapiSettingsPutPatch(bool force, const QStringList &channelSettingsKeys, SWGSDRangel::SWGChannelSettings &response, QString &errorMessage)
Definition: channelapi.h:67
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
ChannelAPI * getChanelSourceAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:463
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetChannelsReportGet()

int WebAPIAdapterSrv::devicesetChannelsReportGet ( int  deviceSetIndex,
SWGSDRangel::SWGChannelsDetail response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/channels/report (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1549 of file webapiadaptersrv.cpp.

References getChannelsDetail(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), MainCore::m_deviceSets, and m_mainCore.

1553 {
1554  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1555  {
1556  const DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1557  getChannelsDetail(&response, deviceSet);
1558 
1559  return 200;
1560  }
1561  else
1562  {
1563  error.init();
1564  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1565 
1566  return 404;
1567  }
1568 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceSet *deviceSet)
+ Here is the call graph for this function:

◆ devicesetDevicePut()

int WebAPIAdapterSrv::devicesetDevicePut ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceListItem query,
SWGSDRangel::SWGDeviceListItem response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1199 of file webapiadaptersrv.cpp.

References MainCore::MsgSetDevice::create(), PluginInterface::SamplingDevice::deviceItemIndex, PluginInterface::SamplingDevice::deviceNbItems, PluginInterface::SamplingDevice::displayedName, SWGSDRangel::SWGDeviceListItem::getDeviceStreamIndex(), SWGSDRangel::SWGDeviceListItem::getDirection(), SWGSDRangel::SWGDeviceListItem::getDisplayedName(), SWGSDRangel::SWGDeviceListItem::getHwType(), SWGSDRangel::SWGErrorResponse::getMessage(), DeviceEnumerator::getNbRxSamplingDevices(), DeviceEnumerator::getNbTxSamplingDevices(), DeviceEnumerator::getRxSamplingDevice(), SWGSDRangel::SWGDeviceListItem::getSequence(), SWGSDRangel::SWGDeviceListItem::getSerial(), DeviceEnumerator::getTxSamplingDevice(), PluginInterface::SamplingDevice::hardwareId, i, SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGDeviceListItem::init(), DeviceEnumerator::instance(), MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, MainCore::m_inputMessageQueue, m_mainCore, MessageQueue::push(), PluginInterface::SamplingDevice::sequence, PluginInterface::SamplingDevice::serial, SWGSDRangel::SWGDeviceListItem::setDeviceNbStreams(), SWGSDRangel::SWGDeviceListItem::setDeviceSetIndex(), SWGSDRangel::SWGDeviceListItem::setDeviceStreamIndex(), SWGSDRangel::SWGDeviceListItem::setDirection(), SWGSDRangel::SWGDeviceListItem::setIndex(), and SWGSDRangel::SWGDeviceListItem::setSequence().

1204 {
1205  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1206  {
1207  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1208 
1209  if ((query.getDirection() != 1) && (deviceSet->m_deviceSinkEngine))
1210  {
1211  error.init();
1212  *error.getMessage() = QString("Device type and device set type (Tx) mismatch");
1213  return 404;
1214  }
1215 
1216  if ((query.getDirection() != 0) && (deviceSet->m_deviceSourceEngine))
1217  {
1218  error.init();
1219  *error.getMessage() = QString("Device type and device set type (Rx) mismatch");
1220  return 404;
1221  }
1222 
1223  int nbSamplingDevices;
1224 
1225  if (query.getDirection() == 0) {
1226  nbSamplingDevices = DeviceEnumerator::instance()->getNbRxSamplingDevices();
1227  } else if (query.getDirection() == 1) {
1228  nbSamplingDevices = DeviceEnumerator::instance()->getNbTxSamplingDevices();
1229  } else {
1230  nbSamplingDevices = 0; // TODO: not implemented yet
1231  }
1232 
1233  for (int i = 0; i < nbSamplingDevices; i++)
1234  {
1235  int direction;
1236  const PluginInterface::SamplingDevice *samplingDevice;
1237 
1238  if (query.getDirection() == 0)
1239  {
1240  direction = 0;
1241  samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(i);
1242  }
1243  else if (query.getDirection() == 1)
1244  {
1245  direction = 1;
1246  samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(i);
1247  }
1248  else
1249  {
1250  continue; // TODO: any device (2) not supported yet
1251  }
1252 
1253  if (query.getDisplayedName() && (*query.getDisplayedName() != samplingDevice->displayedName)) {
1254  continue;
1255  }
1256 
1257  if (query.getHwType() && (*query.getHwType() != samplingDevice->hardwareId)) {
1258  continue;
1259  }
1260 
1261  if ((query.getSequence() >= 0) && (query.getSequence() != samplingDevice->sequence)) {
1262  continue;
1263  }
1264 
1265  if (query.getSerial() && (*query.getSerial() != samplingDevice->serial)) {
1266  continue;
1267  }
1268 
1269  if ((query.getDeviceStreamIndex() >= 0) && (query.getDeviceStreamIndex() != samplingDevice->deviceItemIndex)) {
1270  continue;
1271  }
1272 
1273  MainCore::MsgSetDevice *msg = MainCore::MsgSetDevice::create(deviceSetIndex, i, query.getDirection());
1275 
1276  response.init();
1277  *response.getDisplayedName() = samplingDevice->displayedName;
1278  *response.getHwType() = samplingDevice->hardwareId;
1279  *response.getSerial() = samplingDevice->serial;
1280  response.setSequence(samplingDevice->sequence);
1281  response.setDirection(direction);
1282  response.setDeviceNbStreams(samplingDevice->deviceNbItems);
1283  response.setDeviceStreamIndex(samplingDevice->deviceItemIndex);
1284  response.setDeviceSetIndex(deviceSetIndex);
1285  response.setIndex(i);
1286 
1287  return 202;
1288  }
1289 
1290  error.init();
1291  *error.getMessage() = QString("Device not found");
1292  return 404;
1293  }
1294  else
1295  {
1296  error.init();
1297  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1298 
1299  return 404;
1300  }
1301 }
void setDeviceStreamIndex(qint32 device_stream_index)
int sequence
The device sequence. >0 when more than one device of the same type is connected.
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
QString displayedName
The human readable name.
void setDeviceSetIndex(qint32 device_set_index)
QString hardwareId
The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
void setDirection(qint32 direction)
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
int deviceNbItems
Number of items (or streams) in the device. >1 for composite devices.
int32_t i
Definition: decimators.h:244
void setDeviceNbStreams(qint32 device_nb_streams)
QString serial
The device serial number defined by the vendor or a fake one (SDRplay)
int getNbRxSamplingDevices() const
const PluginInterface::SamplingDevice * getTxSamplingDevice(int deviceIndex) const
const PluginInterface::SamplingDevice * getRxSamplingDevice(int deviceIndex) const
static DeviceEnumerator * instance()
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
int deviceItemIndex
For composite devices this is the Rx or Tx stream index. -1 if not initialized.
int getNbTxSamplingDevices() const
static MsgSetDevice * create(int deviceSetIndex, int deviceIndex, int deviceType)
Definition: maincore.h:202
+ Here is the call graph for this function:

◆ devicesetDeviceReportGet()

int WebAPIAdapterSrv::devicesetDeviceReportGet ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceReport response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device/report (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1511 of file webapiadaptersrv.cpp.

References DeviceAPI::getHardwareId(), SWGSDRangel::SWGErrorResponse::getMessage(), DeviceAPI::getSampleSink(), DeviceAPI::getSampleSource(), SWGSDRangel::SWGErrorResponse::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, SWGSDRangel::SWGDeviceReport::setDeviceHwType(), SWGSDRangel::SWGDeviceReport::setDirection(), DeviceSampleSink::webapiReportGet(), and DeviceSampleSource::webapiReportGet().

1515 {
1516  error.init();
1517 
1518  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1519  {
1520  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1521 
1522  if (deviceSet->m_deviceSourceEngine) // Single Rx
1523  {
1524  response.setDeviceHwType(new QString(deviceSet->m_deviceAPI->getHardwareId()));
1525  response.setDirection(0);
1526  DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();
1527  return source->webapiReportGet(response, *error.getMessage());
1528  }
1529  else if (deviceSet->m_deviceSinkEngine) // Single Tx
1530  {
1531  response.setDeviceHwType(new QString(deviceSet->m_deviceAPI->getHardwareId()));
1532  response.setDirection(1);
1533  DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
1534  return sink->webapiReportGet(response, *error.getMessage());
1535  }
1536  else
1537  {
1538  *error.getMessage() = QString("DeviceSet error");
1539  return 500;
1540  }
1541  }
1542  else
1543  {
1544  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1545  return 404;
1546  }
1547 }
void setDeviceHwType(QString *device_hw_type)
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
void setDirection(qint32 direction)
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
virtual int webapiReportGet(SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
const QString & getHardwareId() const
Definition: deviceapi.h:119
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
virtual int webapiReportGet(SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
+ Here is the call graph for this function:

◆ devicesetDeviceRunDelete()

int WebAPIAdapterSrv::devicesetDeviceRunDelete ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceState response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device/run (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1475 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGErrorResponse::getMessage(), DeviceAPI::getSampleSink(), DeviceAPI::getSampleSource(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGDeviceState::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, DeviceSampleSink::webapiRun(), and DeviceSampleSource::webapiRun().

1479 {
1480  error.init();
1481 
1482  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1483  {
1484  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1485 
1486  if (deviceSet->m_deviceSourceEngine) // Rx
1487  {
1488  DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();
1489  response.init();
1490  return source->webapiRun(false, response, *error.getMessage());
1491  }
1492  else if (deviceSet->m_deviceSinkEngine) // Tx
1493  {
1494  DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
1495  response.init();
1496  return sink->webapiRun(false, response, *error.getMessage());
1497  }
1498  else
1499  {
1500  *error.getMessage() = QString("DeviceSet error");
1501  return 500;
1502  }
1503  }
1504  else
1505  {
1506  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1507  return 404;
1508  }
1509 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetDeviceRunGet()

int WebAPIAdapterSrv::devicesetDeviceRunGet ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceState response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device/run (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1403 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGErrorResponse::getMessage(), DeviceAPI::getSampleSink(), DeviceAPI::getSampleSource(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGDeviceState::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, DeviceSampleSink::webapiRunGet(), and DeviceSampleSource::webapiRunGet().

1407 {
1408  error.init();
1409 
1410  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1411  {
1412  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1413 
1414  if (deviceSet->m_deviceSourceEngine) // Rx
1415  {
1416  DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();
1417  response.init();
1418  return source->webapiRunGet(response, *error.getMessage());
1419  }
1420  else if (deviceSet->m_deviceSinkEngine) // Tx
1421  {
1422  DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
1423  response.init();
1424  return sink->webapiRunGet(response, *error.getMessage());
1425  }
1426  else
1427  {
1428  *error.getMessage() = QString("DeviceSet error");
1429  return 500;
1430  }
1431  }
1432  else
1433  {
1434  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1435  return 404;
1436  }
1437 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetDeviceRunPost()

int WebAPIAdapterSrv::devicesetDeviceRunPost ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceState response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device/run (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1439 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGErrorResponse::getMessage(), DeviceAPI::getSampleSink(), DeviceAPI::getSampleSource(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGDeviceState::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, DeviceSampleSink::webapiRun(), and DeviceSampleSource::webapiRun().

1443 {
1444  error.init();
1445 
1446  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1447  {
1448  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1449 
1450  if (deviceSet->m_deviceSourceEngine) // Rx
1451  {
1452  DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();
1453  response.init();
1454  return source->webapiRun(true, response, *error.getMessage());
1455  }
1456  else if (deviceSet->m_deviceSinkEngine) // Tx
1457  {
1458  DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
1459  response.init();
1460  return sink->webapiRun(true, response, *error.getMessage());
1461  }
1462  else
1463  {
1464  *error.getMessage() = QString("DeviceSet error");
1465  return 500;
1466  }
1467  }
1468  else
1469  {
1470  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1471  return 404;
1472  }
1473 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetDeviceSettingsGet()

int WebAPIAdapterSrv::devicesetDeviceSettingsGet ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceSettings response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device/settings (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1303 of file webapiadaptersrv.cpp.

References DeviceAPI::getHardwareId(), SWGSDRangel::SWGErrorResponse::getMessage(), DeviceAPI::getSampleSink(), DeviceAPI::getSampleSource(), SWGSDRangel::SWGErrorResponse::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, SWGSDRangel::SWGDeviceSettings::setDeviceHwType(), SWGSDRangel::SWGDeviceSettings::setDirection(), DeviceSampleSink::webapiSettingsGet(), and DeviceSampleSource::webapiSettingsGet().

1307 {
1308  error.init();
1309 
1310  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1311  {
1312  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1313 
1314  if (deviceSet->m_deviceSourceEngine) // Single Rx
1315  {
1316  response.setDeviceHwType(new QString(deviceSet->m_deviceAPI->getHardwareId()));
1317  response.setDirection(0);
1318  DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();
1319  return source->webapiSettingsGet(response, *error.getMessage());
1320  }
1321  else if (deviceSet->m_deviceSinkEngine) // Single Tx
1322  {
1323  response.setDeviceHwType(new QString(deviceSet->m_deviceAPI->getHardwareId()));
1324  response.setDirection(1);
1325  DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
1326  return sink->webapiSettingsGet(response, *error.getMessage());
1327  }
1328  else
1329  {
1330  *error.getMessage() = QString("DeviceSet error");
1331  return 500;
1332  }
1333  }
1334  else
1335  {
1336  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1337  return 404;
1338  }
1339 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
const QString & getHardwareId() const
Definition: deviceapi.h:119
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
void setDirection(qint32 direction)
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
void setDeviceHwType(QString *device_hw_type)
+ Here is the call graph for this function:

◆ devicesetDeviceSettingsPutPatch()

int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch ( int  deviceSetIndex,
bool  force,
const QStringList &  channelSettingsKeys,
SWGSDRangel::SWGDeviceSettings response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/device/settings (PUT, PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1341 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGDeviceSettings::getDeviceHwType(), SWGSDRangel::SWGDeviceSettings::getDirection(), DeviceAPI::getHardwareId(), SWGSDRangel::SWGErrorResponse::getMessage(), DeviceAPI::getSampleSink(), DeviceAPI::getSampleSource(), SWGSDRangel::SWGErrorResponse::init(), DeviceSet::m_deviceAPI, MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, m_mainCore, DeviceSampleSink::webapiSettingsPutPatch(), and DeviceSampleSource::webapiSettingsPutPatch().

1347 {
1348  error.init();
1349 
1350  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1351  {
1352  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1353 
1354  if (deviceSet->m_deviceSourceEngine) // Single Rx
1355  {
1356  if (response.getDirection() != 0)
1357  {
1358  *error.getMessage() = QString("Single Rx device found but other type of device requested");
1359  return 400;
1360  }
1361  if (deviceSet->m_deviceAPI->getHardwareId() != *response.getDeviceHwType())
1362  {
1363  *error.getMessage() = QString("Device mismatch. Found %1 input").arg(deviceSet->m_deviceAPI->getHardwareId());
1364  return 400;
1365  }
1366  else
1367  {
1368  DeviceSampleSource *source = deviceSet->m_deviceAPI->getSampleSource();
1369  return source->webapiSettingsPutPatch(force, deviceSettingsKeys, response, *error.getMessage());
1370  }
1371  }
1372  else if (deviceSet->m_deviceSinkEngine) // Single Tx
1373  {
1374  if (response.getDirection() != 1)
1375  {
1376  *error.getMessage() = QString("Single Tx device found but other type of device requested");
1377  return 400;
1378  }
1379  else if (deviceSet->m_deviceAPI->getHardwareId() != *response.getDeviceHwType())
1380  {
1381  *error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceAPI->getHardwareId());
1382  return 400;
1383  }
1384  else
1385  {
1386  DeviceSampleSink *sink = deviceSet->m_deviceAPI->getSampleSink();
1387  return sink->webapiSettingsPutPatch(force, deviceSettingsKeys, response, *error.getMessage());
1388  }
1389  }
1390  else
1391  {
1392  *error.getMessage() = QString("DeviceSet error");
1393  return 500;
1394  }
1395  }
1396  else
1397  {
1398  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1399  return 404;
1400  }
1401 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
DeviceSampleSink * getSampleSink()
Return pointer to the device sample sink (single Tx) or nullptr.
Definition: deviceapi.cpp:222
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
const QString & getHardwareId() const
Definition: deviceapi.h:119
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
+ Here is the call graph for this function:

◆ devicesetFocusPatch()

int WebAPIAdapterSrv::devicesetFocusPatch ( int  deviceSetIndex,
SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex}/focus (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1190 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGErrorResponse::getMessage().

1194 {
1195  *error.getMessage() = QString("Not supported in server instance");
1196  return 400;
1197 }
+ Here is the call graph for this function:

◆ devicesetGet()

int WebAPIAdapterSrv::devicesetGet ( int  deviceSetIndex,
SWGSDRangel::SWGDeviceSet response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset/{devicesetIndex} (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1169 of file webapiadaptersrv.cpp.

References getDeviceSet(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), MainCore::m_deviceSets, and m_mainCore.

1173 {
1174  if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
1175  {
1176  const DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1177  getDeviceSet(&response, deviceSet, deviceSetIndex);
1178 
1179  return 200;
1180  }
1181  else
1182  {
1183  error.init();
1184  *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
1185 
1186  return 404;
1187  }
1188 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, const DeviceSet *deviceSet, int deviceUISetIndex)
+ Here is the call graph for this function:

◆ getChannelsDetail()

void WebAPIAdapterSrv::getChannelsDetail ( SWGSDRangel::SWGChannelsDetail channelsDetail,
const DeviceSet deviceSet 
)
private

Definition at line 2023 of file webapiadaptersrv.cpp.

References ChannelAPI::getCenterFrequency(), DeviceAPI::getChanelSinkAPIAt(), DeviceAPI::getChanelSourceAPIAt(), SWGSDRangel::SWGChannelsDetail::getChannelcount(), SWGSDRangel::SWGChannelsDetail::getChannels(), ChannelAPI::getIdentifier(), ChannelAPI::getIndexInDeviceSet(), DeviceAPI::getNbSinkChannels(), DeviceAPI::getNbSourceChannels(), ChannelAPI::getTitle(), ChannelAPI::getUID(), i, SWGSDRangel::SWGChannelsDetail::init(), DeviceSet::m_deviceAPI, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, SWGSDRangel::SWGChannelsDetail::setChannelcount(), and ChannelAPI::webapiReportGet().

Referenced by devicesetChannelsReportGet().

2024 {
2025  channelsDetail->init();
2026  SWGSDRangel::SWGChannelReport *channelReport;
2027  QString channelReportError;
2028 
2029  if (deviceSet->m_deviceSinkEngine) // Tx data
2030  {
2031  channelsDetail->setChannelcount(deviceSet->m_deviceAPI->getNbSourceChannels());
2032  QList<SWGSDRangel::SWGChannel*> *channels = channelsDetail->getChannels();
2033 
2034  for (int i = 0; i < channelsDetail->getChannelcount(); i++)
2035  {
2036  channels->append(new SWGSDRangel::SWGChannel);
2037  channels->back()->init();
2038  ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i);
2039  channels->back()->setDeltaFrequency(channel->getCenterFrequency());
2040  channels->back()->setIndex(channel->getIndexInDeviceSet());
2041  channels->back()->setUid(channel->getUID());
2042  channel->getIdentifier(*channels->back()->getId());
2043  channel->getTitle(*channels->back()->getTitle());
2044 
2045  channelReport = new SWGSDRangel::SWGChannelReport();
2046 
2047  if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
2048  channels->back()->setReport(channelReport);
2049  } else {
2050  delete channelReport;
2051  }
2052  }
2053  }
2054 
2055  if (deviceSet->m_deviceSourceEngine) // Rx data
2056  {
2057  channelsDetail->setChannelcount(deviceSet->m_deviceAPI->getNbSinkChannels());
2058  QList<SWGSDRangel::SWGChannel*> *channels = channelsDetail->getChannels();
2059 
2060  for (int i = 0; i < channelsDetail->getChannelcount(); i++)
2061  {
2062  channels->append(new SWGSDRangel::SWGChannel);
2063  channels->back()->init();
2064  ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i);
2065  channels->back()->setDeltaFrequency(channel->getCenterFrequency());
2066  channels->back()->setIndex(channel->getIndexInDeviceSet());
2067  channels->back()->setUid(channel->getUID());
2068  channel->getIdentifier(*channels->back()->getId());
2069  channel->getTitle(*channels->back()->getTitle());
2070 
2071  channelReport = new SWGSDRangel::SWGChannelReport();
2072 
2073  if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
2074  channels->back()->setReport(channelReport);
2075  } else {
2076  delete channelReport;
2077  }
2078  }
2079  }
2080 }
QList< SWGChannel * > * getChannels()
ChannelAPI * getChanelSinkAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:445
virtual void getIdentifier(QString &id)=0
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
virtual int webapiReportGet(SWGSDRangel::SWGChannelReport &response, QString &errorMessage)
Definition: channelapi.h:79
void setChannelcount(qint32 channelcount)
virtual qint64 getCenterFrequency() const =0
Applies to a default stream.
uint64_t getUID() const
Definition: channelapi.h:93
int32_t i
Definition: decimators.h:244
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
ChannelAPI * getChanelSourceAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:463
virtual void getTitle(QString &title)=0
int getNbSourceChannels() const
Definition: deviceapi.h:143
int getIndexInDeviceSet() const
Definition: channelapi.h:87
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
int getNbSinkChannels() const
Definition: deviceapi.h:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeviceSet()

void WebAPIAdapterSrv::getDeviceSet ( SWGSDRangel::SWGDeviceSet swgDeviceSet,
const DeviceSet deviceSet,
int  deviceUISetIndex 
)
private

Definition at line 1951 of file webapiadaptersrv.cpp.

References ChannelAPI::getCenterFrequency(), DeviceSampleSink::getCenterFrequency(), DeviceSampleSource::getCenterFrequency(), DeviceAPI::getChanelSinkAPIAt(), DeviceAPI::getChanelSourceAPIAt(), SWGSDRangel::SWGDeviceSet::getChannelcount(), SWGSDRangel::SWGDeviceSet::getChannels(), DeviceAPI::getDeviceEngineStateStr(), DeviceAPI::getDeviceItemIndex(), DeviceAPI::getDeviceNbItems(), DeviceAPI::getHardwareId(), SWGSDRangel::SWGSamplingDevice::getHwType(), ChannelAPI::getIdentifier(), ChannelAPI::getIndexInDeviceSet(), DeviceAPI::getNbSinkChannels(), DeviceAPI::getNbSourceChannels(), DeviceSampleSink::getSampleRate(), DeviceSampleSource::getSampleRate(), SWGSDRangel::SWGDeviceSet::getSamplingDevice(), DeviceAPI::getSamplingDeviceSequence(), DeviceAPI::getSamplingDeviceSerial(), SWGSDRangel::SWGSamplingDevice::getSerial(), DSPDeviceSinkEngine::getSink(), DSPDeviceSourceEngine::getSource(), SWGSDRangel::SWGSamplingDevice::getState(), ChannelAPI::getTitle(), ChannelAPI::getUID(), i, SWGSDRangel::SWGSamplingDevice::init(), SWGSDRangel::SWGDeviceSet::init(), DeviceSet::m_deviceAPI, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, SWGSDRangel::SWGSamplingDevice::setBandwidth(), SWGSDRangel::SWGSamplingDevice::setCenterFrequency(), SWGSDRangel::SWGDeviceSet::setChannelcount(), SWGSDRangel::SWGSamplingDevice::setDeviceNbStreams(), SWGSDRangel::SWGSamplingDevice::setDeviceStreamIndex(), SWGSDRangel::SWGSamplingDevice::setDirection(), SWGSDRangel::SWGSamplingDevice::setIndex(), and SWGSDRangel::SWGSamplingDevice::setSequence().

Referenced by devicesetGet(), and getDeviceSetList().

1952 {
1953  swgDeviceSet->init();
1954  SWGSDRangel::SWGSamplingDevice *samplingDevice = swgDeviceSet->getSamplingDevice();
1955  samplingDevice->init();
1956  samplingDevice->setIndex(deviceUISetIndex);
1957 
1958  if (deviceSet->m_deviceSinkEngine) // Single Tx data
1959  {
1960  samplingDevice->setDirection(1);
1961  *samplingDevice->getHwType() = deviceSet->m_deviceAPI->getHardwareId();
1962  *samplingDevice->getSerial() = deviceSet->m_deviceAPI->getSamplingDeviceSerial();
1963  samplingDevice->setSequence(deviceSet->m_deviceAPI->getSamplingDeviceSequence());
1964  samplingDevice->setDeviceNbStreams(deviceSet->m_deviceAPI->getDeviceNbItems());
1965  samplingDevice->setDeviceStreamIndex(deviceSet->m_deviceAPI->getDeviceItemIndex());
1966  deviceSet->m_deviceAPI->getDeviceEngineStateStr(*samplingDevice->getState());
1967  DeviceSampleSink *sampleSink = deviceSet->m_deviceSinkEngine->getSink();
1968 
1969  if (sampleSink) {
1970  samplingDevice->setCenterFrequency(sampleSink->getCenterFrequency());
1971  samplingDevice->setBandwidth(sampleSink->getSampleRate());
1972  }
1973 
1974  swgDeviceSet->setChannelcount(deviceSet->m_deviceAPI->getNbSourceChannels());
1975  QList<SWGSDRangel::SWGChannel*> *channels = swgDeviceSet->getChannels();
1976 
1977  for (int i = 0; i < swgDeviceSet->getChannelcount(); i++)
1978  {
1979  channels->append(new SWGSDRangel::SWGChannel);
1980  channels->back()->init();
1981  ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i);
1982  channels->back()->setDeltaFrequency(channel->getCenterFrequency());
1983  channels->back()->setIndex(channel->getIndexInDeviceSet());
1984  channels->back()->setUid(channel->getUID());
1985  channel->getIdentifier(*channels->back()->getId());
1986  channel->getTitle(*channels->back()->getTitle());
1987  }
1988  }
1989 
1990  if (deviceSet->m_deviceSourceEngine) // Single Rx data
1991  {
1992  samplingDevice->setDirection(0);
1993  *samplingDevice->getHwType() = deviceSet->m_deviceAPI->getHardwareId();
1994  *samplingDevice->getSerial() = deviceSet->m_deviceAPI->getSamplingDeviceSerial();
1995  samplingDevice->setSequence(deviceSet->m_deviceAPI->getSamplingDeviceSequence());
1996  samplingDevice->setDeviceNbStreams(deviceSet->m_deviceAPI->getDeviceNbItems());
1997  samplingDevice->setDeviceStreamIndex(deviceSet->m_deviceAPI->getDeviceItemIndex());
1998  deviceSet->m_deviceAPI->getDeviceEngineStateStr(*samplingDevice->getState());
1999  DeviceSampleSource *sampleSource = deviceSet->m_deviceSourceEngine->getSource();
2000 
2001  if (sampleSource) {
2002  samplingDevice->setCenterFrequency(sampleSource->getCenterFrequency());
2003  samplingDevice->setBandwidth(sampleSource->getSampleRate());
2004  }
2005 
2006  swgDeviceSet->setChannelcount(deviceSet->m_deviceAPI->getNbSinkChannels());
2007  QList<SWGSDRangel::SWGChannel*> *channels = swgDeviceSet->getChannels();
2008 
2009  for (int i = 0; i < swgDeviceSet->getChannelcount(); i++)
2010  {
2011  channels->append(new SWGSDRangel::SWGChannel);
2012  channels->back()->init();
2013  ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i);
2014  channels->back()->setDeltaFrequency(channel->getCenterFrequency());
2015  channels->back()->setIndex(channel->getIndexInDeviceSet());
2016  channels->back()->setUid(channel->getUID());
2017  channel->getIdentifier(*channels->back()->getId());
2018  channel->getTitle(*channels->back()->getTitle());
2019  }
2020  }
2021 }
DeviceSampleSink * getSink()
ChannelAPI * getChanelSinkAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:445
virtual void getIdentifier(QString &id)=0
DeviceSampleSource * getSource()
uint32_t getDeviceItemIndex() const
Definition: deviceapi.h:129
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
uint32_t getDeviceNbItems() const
Definition: deviceapi.h:128
void setCenterFrequency(qint64 center_frequency)
virtual qint64 getCenterFrequency() const =0
Applies to a default stream.
virtual int getSampleRate() const =0
Sample rate exposed by the source.
QList< SWGChannel * > * getChannels()
SWGSamplingDevice * getSamplingDevice()
uint64_t getUID() const
Definition: channelapi.h:93
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the sink.
void setChannelcount(qint32 channelcount)
void setDirection(qint32 direction)
int32_t i
Definition: decimators.h:244
void setDeviceStreamIndex(qint32 device_stream_index)
DeviceAPI * m_deviceAPI
Definition: deviceset.h:34
ChannelAPI * getChanelSourceAPIAt(int index, int streamIndex=0)
Definition: deviceapi.cpp:463
void setDeviceNbStreams(qint32 device_nb_streams)
void getDeviceEngineStateStr(QString &state)
Definition: deviceapi.cpp:389
virtual void getTitle(QString &title)=0
const QString & getSamplingDeviceSerial() const
Definition: deviceapi.h:121
const QString & getHardwareId() const
Definition: deviceapi.h:119
int getNbSourceChannels() const
Definition: deviceapi.h:143
virtual int getSampleRate() const =0
Sample rate exposed by the sink.
int getIndexInDeviceSet() const
Definition: channelapi.h:87
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the source.
void setBandwidth(qint32 bandwidth)
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
uint32_t getSamplingDeviceSequence() const
Definition: deviceapi.h:123
int getNbSinkChannels() const
Definition: deviceapi.h:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeviceSetList()

void WebAPIAdapterSrv::getDeviceSetList ( SWGSDRangel::SWGDeviceSetList deviceSetList)
private

Definition at line 1935 of file webapiadaptersrv.cpp.

References getDeviceSet(), SWGSDRangel::SWGDeviceSetList::getDeviceSets(), i, SWGSDRangel::SWGDeviceSetList::init(), MainCore::m_deviceSets, m_mainCore, and SWGSDRangel::SWGDeviceSetList::setDevicesetcount().

Referenced by instanceDeviceSetsGet(), and instanceSummary().

1936 {
1937  deviceSetList->init();
1938  deviceSetList->setDevicesetcount((int) m_mainCore.m_deviceSets.size());
1939 
1940  std::vector<DeviceSet*>::const_iterator it = m_mainCore.m_deviceSets.begin();
1941 
1942  for (int i = 0; it != m_mainCore.m_deviceSets.end(); ++it, i++)
1943  {
1944  QList<SWGSDRangel::SWGDeviceSet*> *deviceSets = deviceSetList->getDeviceSets();
1945  deviceSets->append(new SWGSDRangel::SWGDeviceSet());
1946 
1947  getDeviceSet(deviceSets->back(), *it, i);
1948  }
1949 }
QList< SWGDeviceSet * > * getDeviceSets()
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, const DeviceSet *deviceSet, int deviceUISetIndex)
int32_t i
Definition: decimators.h:244
void setDevicesetcount(qint32 devicesetcount)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMsgTypeFromString()

QtMsgType WebAPIAdapterSrv::getMsgTypeFromString ( const QString &  msgTypeString)
staticprivate

Definition at line 2082 of file webapiadaptersrv.cpp.

Referenced by instanceLoggingPut().

2083 {
2084  if (msgTypeString == "debug") {
2085  return QtDebugMsg;
2086  } else if (msgTypeString == "info") {
2087  return QtInfoMsg;
2088  } else if (msgTypeString == "warning") {
2089  return QtWarningMsg;
2090  } else if (msgTypeString == "error") {
2091  return QtCriticalMsg;
2092  } else {
2093  return QtDebugMsg;
2094  }
2095 }
+ Here is the caller graph for this function:

◆ getMsgTypeString()

void WebAPIAdapterSrv::getMsgTypeString ( const QtMsgType &  msgType,
QString &  level 
)
staticprivate

Definition at line 2097 of file webapiadaptersrv.cpp.

Referenced by instanceLoggingPut().

2098 {
2099  switch (msgType)
2100  {
2101  case QtDebugMsg:
2102  levelStr = "debug";
2103  break;
2104  case QtInfoMsg:
2105  levelStr = "info";
2106  break;
2107  case QtWarningMsg:
2108  levelStr = "warning";
2109  break;
2110  case QtCriticalMsg:
2111  case QtFatalMsg:
2112  levelStr = "error";
2113  break;
2114  default:
2115  levelStr = "debug";
2116  break;
2117  }
2118 }
+ Here is the caller graph for this function:

◆ instanceAMBEDevicesDelete()

int WebAPIAdapterSrv::instanceAMBEDevicesDelete ( SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/ambe/devices (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 695 of file webapiadaptersrv.cpp.

References DSPEngine::getAMBEEngine(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::init(), MainCore::m_dspEngine, m_mainCore, and AMBEEngine::releaseAll().

698 {
699  (void) error;
701 
702  response.init();
703  *response.getMessage() = QString("All AMBE devices released");
704 
705  return 200;
706 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
AMBEEngine * getAMBEEngine()
Definition: dspengine.h:56
void releaseAll()
Definition: ambeengine.cpp:261
+ Here is the call graph for this function:

◆ instanceAMBEDevicesGet()

int WebAPIAdapterSrv::instanceAMBEDevicesGet ( SWGSDRangel::SWGAMBEDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/ambe/devices (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 669 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGAMBEDevices::getAmbeDevices(), DSPEngine::getDVSerialNames(), SWGSDRangel::SWGAMBEDevices::init(), MainCore::m_dspEngine, m_mainCore, and SWGSDRangel::SWGAMBEDevices::setNbDevices().

Referenced by instanceAMBEDevicesPatch(), and instanceAMBEDevicesPut().

672 {
673  (void) error;
674  response.init();
675 
676  std::vector<std::string> deviceNames;
678  response.setNbDevices((int) deviceNames.size());
679  QList<SWGSDRangel::SWGAMBEDevice*> *deviceNamesList = response.getAmbeDevices();
680 
681  std::vector<std::string>::iterator it = deviceNames.begin();
682 
683  while (it != deviceNames.end())
684  {
685  deviceNamesList->append(new SWGSDRangel::SWGAMBEDevice);
686  deviceNamesList->back()->init();
687  *deviceNamesList->back()->getDeviceRef() = QString::fromStdString(*it);
688  deviceNamesList->back()->setDelete(0);
689  ++it;
690  }
691 
692  return 200;
693 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
void getDVSerialNames(std::vector< std::string > &deviceNames)
Definition: dspengine.cpp:166
void setNbDevices(qint32 nb_devices)
QList< SWGAMBEDevice * > * getAmbeDevices()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ instanceAMBEDevicesPatch()

int WebAPIAdapterSrv::instanceAMBEDevicesPatch ( SWGSDRangel::SWGAMBEDevices query,
SWGSDRangel::SWGAMBEDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/ambe/devices (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 725 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGAMBEDevices::getAmbeDevices(), DSPEngine::getAMBEEngine(), instanceAMBEDevicesGet(), MainCore::m_dspEngine, m_mainCore, AMBEEngine::registerController(), and AMBEEngine::releaseController().

729 {
730  QList<SWGSDRangel::SWGAMBEDevice *> *ambeList = query.getAmbeDevices();
731 
732  for (QList<SWGSDRangel::SWGAMBEDevice *>::const_iterator it = ambeList->begin(); it != ambeList->end(); ++it)
733  {
734  if ((*it)->getDelete()) {
735  m_mainCore.m_dspEngine->getAMBEEngine()->releaseController((*it)->getDeviceRef()->toStdString());
736  } else {
737  m_mainCore.m_dspEngine->getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString());
738  }
739  }
740 
741  instanceAMBEDevicesGet(response, error);
742  return 200;
743 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
virtual int instanceAMBEDevicesGet(SWGSDRangel::SWGAMBEDevices &response, SWGSDRangel::SWGErrorResponse &error)
bool registerController(const std::string &deviceRef)
create a new controller for the device in reference
Definition: ambeengine.cpp:214
AMBEEngine * getAMBEEngine()
Definition: dspengine.h:56
QList< SWGAMBEDevice * > * getAmbeDevices()
void releaseController(const std::string &deviceRef)
release controller resources for the device in reference
Definition: ambeengine.cpp:239
+ Here is the call graph for this function:

◆ instanceAMBEDevicesPut()

int WebAPIAdapterSrv::instanceAMBEDevicesPut ( SWGSDRangel::SWGAMBEDevices query,
SWGSDRangel::SWGAMBEDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/ambe/devices (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 708 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGAMBEDevices::getAmbeDevices(), DSPEngine::getAMBEEngine(), instanceAMBEDevicesGet(), MainCore::m_dspEngine, m_mainCore, AMBEEngine::registerController(), and AMBEEngine::releaseAll().

712 {
714 
715  QList<SWGSDRangel::SWGAMBEDevice *> *ambeList = query.getAmbeDevices();
716 
717  for (QList<SWGSDRangel::SWGAMBEDevice *>::const_iterator it = ambeList->begin(); it != ambeList->end(); ++it) {
718  m_mainCore.m_dspEngine->getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString());
719  }
720 
721  instanceAMBEDevicesGet(response, error);
722  return 200;
723 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
virtual int instanceAMBEDevicesGet(SWGSDRangel::SWGAMBEDevices &response, SWGSDRangel::SWGErrorResponse &error)
bool registerController(const std::string &deviceRef)
create a new controller for the device in reference
Definition: ambeengine.cpp:214
AMBEEngine * getAMBEEngine()
Definition: dspengine.h:56
void releaseAll()
Definition: ambeengine.cpp:261
QList< SWGAMBEDevice * > * getAmbeDevices()
+ Here is the call graph for this function:

◆ instanceAMBESerialGet()

int WebAPIAdapterSrv::instanceAMBESerialGet ( SWGSDRangel::SWGDVSerialDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/ambe/serial (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 638 of file webapiadaptersrv.cpp.

References DSPEngine::getAMBEEngine(), SWGSDRangel::SWGDVSerialDevices::getDvSerialDevices(), SWGSDRangel::SWGDVSerialDevices::init(), MainCore::m_dspEngine, m_mainCore, AMBEEngine::scan(), and SWGSDRangel::SWGDVSerialDevices::setNbDevices().

641 {
642  (void) error;
643  response.init();
644 
645  std::vector<std::string> deviceNames;
646  std::vector<QString> qDeviceNames;
647  m_mainCore.m_dspEngine->getAMBEEngine()->scan(qDeviceNames);
648 
649  for (std::vector<QString>::const_iterator it = qDeviceNames.begin(); it != qDeviceNames.end(); ++it) {
650  deviceNames.push_back(it->toStdString());
651  }
652 
653  response.setNbDevices((int) deviceNames.size());
654  QList<SWGSDRangel::SWGDVSerialDevice*> *deviceNamesList = response.getDvSerialDevices();
655 
656  std::vector<std::string>::iterator it = deviceNames.begin();
657 
658  while (it != deviceNames.end())
659  {
660  deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice);
661  deviceNamesList->back()->init();
662  *deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
663  ++it;
664  }
665 
666  return 200;
667 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
void scan(std::vector< QString > &ambeDevices)
Definition: ambeengine.cpp:191
AMBEEngine * getAMBEEngine()
Definition: dspengine.h:56
QList< SWGDVSerialDevice * > * getDvSerialDevices()
void setNbDevices(qint32 nb_devices)
+ Here is the call graph for this function:

◆ instanceAudioGet()

int WebAPIAdapterSrv::instanceAudioGet ( SWGSDRangel::SWGAudioDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 289 of file webapiadaptersrv.cpp.

References AudioDeviceManager::OutputDeviceInfo::copyToUDP, DSPEngine::getAudioDeviceManager(), AudioDeviceManager::getInputDeviceInfo(), SWGSDRangel::SWGAudioDevices::getInputDevices(), AudioDeviceManager::getInputDevices(), AudioDeviceManager::getOutputDeviceInfo(), SWGSDRangel::SWGAudioDevices::getOutputDevices(), AudioDeviceManager::getOutputDevices(), i, SWGSDRangel::SWGAudioDevices::init(), AudioDeviceManager::m_defaultDeviceName, MainCore::m_dspEngine, m_mainCore, AudioDeviceManager::InputDeviceInfo::resetToDefaults(), AudioDeviceManager::OutputDeviceInfo::resetToDefaults(), AudioDeviceManager::InputDeviceInfo::sampleRate, AudioDeviceManager::OutputDeviceInfo::sampleRate, SWGSDRangel::SWGAudioDevices::setNbInputDevices(), SWGSDRangel::SWGAudioDevices::setNbOutputDevices(), AudioDeviceManager::OutputDeviceInfo::udpAddress, AudioDeviceManager::OutputDeviceInfo::udpChannelCodec, AudioDeviceManager::OutputDeviceInfo::udpChannelMode, AudioDeviceManager::OutputDeviceInfo::udpDecimationFactor, AudioDeviceManager::OutputDeviceInfo::udpPort, AudioDeviceManager::OutputDeviceInfo::udpUseRTP, and AudioDeviceManager::InputDeviceInfo::volume.

292 {
293  const QList<QAudioDeviceInfo>& audioInputDevices = m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDevices();
294  const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDevices();
295  int nbInputDevices = audioInputDevices.size();
296  int nbOutputDevices = audioOutputDevices.size();
297 
298  response.init();
299  response.setNbInputDevices(nbInputDevices);
300  response.setNbOutputDevices(nbOutputDevices);
301  QList<SWGSDRangel::SWGAudioInputDevice*> *inputDevices = response.getInputDevices();
302  QList<SWGSDRangel::SWGAudioOutputDevice*> *outputDevices = response.getOutputDevices();
303  AudioDeviceManager::InputDeviceInfo inputDeviceInfo;
304  AudioDeviceManager::OutputDeviceInfo outputDeviceInfo;
305 
306  // system default input device
307  inputDevices->append(new SWGSDRangel::SWGAudioInputDevice);
308  inputDevices->back()->init();
310  *inputDevices->back()->getName() = AudioDeviceManager::m_defaultDeviceName;
311  inputDevices->back()->setIndex(-1);
312  inputDevices->back()->setSampleRate(inputDeviceInfo.sampleRate);
313  inputDevices->back()->setIsSystemDefault(0);
314  inputDevices->back()->setDefaultUnregistered(found ? 0 : 1);
315  inputDevices->back()->setVolume(inputDeviceInfo.volume);
316 
317  // real input devices
318  for (int i = 0; i < nbInputDevices; i++)
319  {
320  inputDevices->append(new SWGSDRangel::SWGAudioInputDevice);
321  inputDevices->back()->init();
322  inputDeviceInfo.resetToDefaults();
323  found = m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(audioInputDevices.at(i).deviceName(), inputDeviceInfo);
324  *inputDevices->back()->getName() = audioInputDevices.at(i).deviceName();
325  inputDevices->back()->setIndex(i);
326  inputDevices->back()->setSampleRate(inputDeviceInfo.sampleRate);
327  inputDevices->back()->setIsSystemDefault(audioInputDevices.at(i).deviceName() == QAudioDeviceInfo::defaultInputDevice().deviceName() ? 1 : 0);
328  inputDevices->back()->setDefaultUnregistered(found ? 0 : 1);
329  inputDevices->back()->setVolume(inputDeviceInfo.volume);
330  }
331 
332  // system default output device
333  outputDevices->append(new SWGSDRangel::SWGAudioOutputDevice);
334  outputDevices->back()->init();
336  *outputDevices->back()->getName() = AudioDeviceManager::m_defaultDeviceName;
337  outputDevices->back()->setIndex(-1);
338  outputDevices->back()->setSampleRate(outputDeviceInfo.sampleRate);
339  inputDevices->back()->setIsSystemDefault(0);
340  outputDevices->back()->setDefaultUnregistered(found ? 0 : 1);
341  outputDevices->back()->setCopyToUdp(outputDeviceInfo.copyToUDP ? 1 : 0);
342  outputDevices->back()->setUdpUsesRtp(outputDeviceInfo.udpUseRTP ? 1 : 0);
343  outputDevices->back()->setUdpChannelMode((int) outputDeviceInfo.udpChannelMode);
344  outputDevices->back()->setUdpChannelCodec((int) outputDeviceInfo.udpChannelCodec);
345  outputDevices->back()->setUdpDecimationFactor(outputDeviceInfo.udpDecimationFactor);
346  *outputDevices->back()->getUdpAddress() = outputDeviceInfo.udpAddress;
347  outputDevices->back()->setUdpPort(outputDeviceInfo.udpPort);
348 
349  // real output devices
350  for (int i = 0; i < nbOutputDevices; i++)
351  {
352  outputDevices->append(new SWGSDRangel::SWGAudioOutputDevice);
353  outputDevices->back()->init();
354  outputDeviceInfo.resetToDefaults();
355  found = m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(audioOutputDevices.at(i).deviceName(), outputDeviceInfo);
356  *outputDevices->back()->getName() = audioOutputDevices.at(i).deviceName();
357  outputDevices->back()->setIndex(i);
358  outputDevices->back()->setSampleRate(outputDeviceInfo.sampleRate);
359  outputDevices->back()->setIsSystemDefault(audioOutputDevices.at(i).deviceName() == QAudioDeviceInfo::defaultOutputDevice().deviceName() ? 1 : 0);
360  outputDevices->back()->setDefaultUnregistered(found ? 0 : 1);
361  outputDevices->back()->setCopyToUdp(outputDeviceInfo.copyToUDP ? 1 : 0);
362  outputDevices->back()->setUdpUsesRtp(outputDeviceInfo.udpUseRTP ? 1 : 0);
363  outputDevices->back()->setUdpChannelMode((int) outputDeviceInfo.udpChannelMode);
364  outputDevices->back()->setUdpChannelCodec((int) outputDeviceInfo.udpChannelCodec);
365  outputDevices->back()->setUdpDecimationFactor(outputDeviceInfo.udpDecimationFactor);
366  *outputDevices->back()->getUdpAddress() = outputDeviceInfo.udpAddress;
367  outputDevices->back()->setUdpPort(outputDeviceInfo.udpPort);
368  }
369 
370  return 200;
371 }
static const QString m_defaultDeviceName
const QList< QAudioDeviceInfo > & getInputDevices() const
DSPEngine * m_dspEngine
Definition: maincore.h:275
void setNbOutputDevices(qint32 nb_output_devices)
QList< SWGAudioInputDevice * > * getInputDevices()
AudioOutput::UDPChannelCodec udpChannelCodec
bool getInputDeviceInfo(const QString &deviceName, InputDeviceInfo &deviceInfo) const
int32_t i
Definition: decimators.h:244
bool getOutputDeviceInfo(const QString &deviceName, OutputDeviceInfo &deviceInfo) const
void setNbInputDevices(qint32 nb_input_devices)
const QList< QAudioDeviceInfo > & getOutputDevices() const
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
AudioOutput::UDPChannelMode udpChannelMode
QList< SWGAudioOutputDevice * > * getOutputDevices()
+ Here is the call graph for this function:

◆ instanceAudioInputCleanupPatch()

int WebAPIAdapterSrv::instanceAudioInputCleanupPatch ( SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio/input/cleanup (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 526 of file webapiadaptersrv.cpp.

References DSPEngine::getAudioDeviceManager(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::init(), AudioDeviceManager::inputInfosCleanup(), MainCore::m_dspEngine, and m_mainCore.

529 {
531 
532  response.init();
533  *response.getMessage() = QString("Unregistered parameters for devices not in list of available input devices for this instance");
534 
535  return 200;
536 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
void inputInfosCleanup()
Remove input info from map for input devices not present.
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
+ Here is the call graph for this function:

◆ instanceAudioInputDelete()

int WebAPIAdapterSrv::instanceAudioInputDelete ( SWGSDRangel::SWGAudioInputDevice response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio/input/parameters (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 466 of file webapiadaptersrv.cpp.

References DSPEngine::getAudioDeviceManager(), SWGSDRangel::SWGAudioInputDevice::getIndex(), AudioDeviceManager::getInputDeviceInfo(), AudioDeviceManager::getInputDeviceName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), MainCore::m_dspEngine, m_mainCore, AudioDeviceManager::InputDeviceInfo::sampleRate, SWGSDRangel::SWGAudioInputDevice::setSampleRate(), SWGSDRangel::SWGAudioInputDevice::setVolume(), AudioDeviceManager::unsetInputDeviceInfo(), and AudioDeviceManager::InputDeviceInfo::volume.

469 {
470  AudioDeviceManager::InputDeviceInfo inputDeviceInfo;
471  QString deviceName;
472  int deviceIndex = response.getIndex();
473 
474  if (!m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceName(deviceIndex, deviceName))
475  {
476  error.init();
477  *error.getMessage() = QString("There is no audio input device at index %1").arg(deviceIndex);
478  return 404;
479  }
480 
482  m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo);
483 
484  response.setSampleRate(inputDeviceInfo.sampleRate);
485  response.setVolume(inputDeviceInfo.volume);
486 
487  return 200;
488 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
bool getInputDeviceName(int inputDeviceIndex, QString &deviceName) const
void setSampleRate(qint32 sample_rate)
bool getInputDeviceInfo(const QString &deviceName, InputDeviceInfo &deviceInfo) const
void unsetInputDeviceInfo(int inputDeviceIndex)
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
+ Here is the call graph for this function:

◆ instanceAudioInputPatch()

int WebAPIAdapterSrv::instanceAudioInputPatch ( SWGSDRangel::SWGAudioInputDevice response,
const QStringList &  audioInputKeys,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio/input/parameters (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 373 of file webapiadaptersrv.cpp.

References DSPEngine::getAudioDeviceManager(), SWGSDRangel::SWGAudioInputDevice::getIndex(), AudioDeviceManager::getInputDeviceInfo(), AudioDeviceManager::getInputDeviceName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGAudioInputDevice::getSampleRate(), SWGSDRangel::SWGAudioInputDevice::getVolume(), SWGSDRangel::SWGErrorResponse::init(), MainCore::m_dspEngine, m_mainCore, AudioDeviceManager::InputDeviceInfo::sampleRate, AudioDeviceManager::setInputDeviceInfo(), SWGSDRangel::SWGAudioInputDevice::setSampleRate(), SWGSDRangel::SWGAudioInputDevice::setVolume(), and AudioDeviceManager::InputDeviceInfo::volume.

377 {
378  // TODO
379  AudioDeviceManager::InputDeviceInfo inputDeviceInfo;
380  QString deviceName;
381  int deviceIndex = response.getIndex();
382 
383  if (!m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceName(deviceIndex, deviceName))
384  {
385  error.init();
386  *error.getMessage() = QString("There is no input audio device at index %1").arg(deviceIndex);
387  return 404;
388  }
389 
390  m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo);
391 
392  if (audioInputKeys.contains("sampleRate")) {
393  inputDeviceInfo.sampleRate = response.getSampleRate();
394  }
395  if (audioInputKeys.contains("volume")) {
396  inputDeviceInfo.volume = response.getVolume();
397  }
398 
399  m_mainCore.m_dspEngine->getAudioDeviceManager()->setInputDeviceInfo(deviceIndex, inputDeviceInfo);
400  m_mainCore.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo);
401 
402  response.setSampleRate(inputDeviceInfo.sampleRate);
403  response.setVolume(inputDeviceInfo.volume);
404 
405  return 200;
406 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
bool getInputDeviceName(int inputDeviceIndex, QString &deviceName) const
void setSampleRate(qint32 sample_rate)
bool getInputDeviceInfo(const QString &deviceName, InputDeviceInfo &deviceInfo) const
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
void setInputDeviceInfo(int inputDeviceIndex, const InputDeviceInfo &deviceInfo)
+ Here is the call graph for this function:

◆ instanceAudioOutputCleanupPatch()

int WebAPIAdapterSrv::instanceAudioOutputCleanupPatch ( SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio/output/cleanup (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 538 of file webapiadaptersrv.cpp.

References DSPEngine::getAudioDeviceManager(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::init(), MainCore::m_dspEngine, m_mainCore, and AudioDeviceManager::outputInfosCleanup().

541 {
543 
544  response.init();
545  *response.getMessage() = QString("Unregistered parameters for devices not in list of available output devices for this instance");
546 
547  return 200;
548 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
void outputInfosCleanup()
Remove output info from map for output devices not present.
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
+ Here is the call graph for this function:

◆ instanceAudioOutputDelete()

int WebAPIAdapterSrv::instanceAudioOutputDelete ( SWGSDRangel::SWGAudioOutputDevice response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio/output/paramaters (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 490 of file webapiadaptersrv.cpp.

References AudioDeviceManager::OutputDeviceInfo::copyToUDP, DSPEngine::getAudioDeviceManager(), SWGSDRangel::SWGAudioOutputDevice::getIndex(), SWGSDRangel::SWGErrorResponse::getMessage(), AudioDeviceManager::getOutputDeviceInfo(), AudioDeviceManager::getOutputDeviceName(), SWGSDRangel::SWGAudioOutputDevice::getUdpAddress(), SWGSDRangel::SWGErrorResponse::init(), MainCore::m_dspEngine, m_mainCore, AudioDeviceManager::OutputDeviceInfo::sampleRate, SWGSDRangel::SWGAudioOutputDevice::setCopyToUdp(), SWGSDRangel::SWGAudioOutputDevice::setSampleRate(), SWGSDRangel::SWGAudioOutputDevice::setUdpAddress(), SWGSDRangel::SWGAudioOutputDevice::setUdpChannelCodec(), SWGSDRangel::SWGAudioOutputDevice::setUdpChannelMode(), SWGSDRangel::SWGAudioOutputDevice::setUdpDecimationFactor(), SWGSDRangel::SWGAudioOutputDevice::setUdpPort(), SWGSDRangel::SWGAudioOutputDevice::setUdpUsesRtp(), AudioDeviceManager::OutputDeviceInfo::udpAddress, AudioDeviceManager::OutputDeviceInfo::udpChannelCodec, AudioDeviceManager::OutputDeviceInfo::udpChannelMode, AudioDeviceManager::OutputDeviceInfo::udpDecimationFactor, AudioDeviceManager::OutputDeviceInfo::udpPort, AudioDeviceManager::OutputDeviceInfo::udpUseRTP, and AudioDeviceManager::unsetInputDeviceInfo().

493 {
494  AudioDeviceManager::OutputDeviceInfo outputDeviceInfo;
495  QString deviceName;
496  int deviceIndex = response.getIndex();
497 
498  if (!m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceName(deviceIndex, deviceName))
499  {
500  error.init();
501  *error.getMessage() = QString("There is no audio output device at index %1").arg(deviceIndex);
502  return 404;
503  }
504 
506  m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo);
507 
508  response.setSampleRate(outputDeviceInfo.sampleRate);
509  response.setCopyToUdp(outputDeviceInfo.copyToUDP == 0 ? 0 : 1);
510  response.setUdpUsesRtp(outputDeviceInfo.udpUseRTP == 0 ? 0 : 1);
511  response.setUdpChannelMode(outputDeviceInfo.udpChannelMode);
512  response.setUdpChannelCodec(outputDeviceInfo.udpChannelCodec);
513  response.setUdpDecimationFactor(outputDeviceInfo.udpDecimationFactor);
514 
515  if (response.getUdpAddress()) {
516  *response.getUdpAddress() = outputDeviceInfo.udpAddress;
517  } else {
518  response.setUdpAddress(new QString(outputDeviceInfo.udpAddress));
519  }
520 
521  response.setUdpPort(outputDeviceInfo.udpPort % (1<<16));
522 
523  return 200;
524 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
AudioOutput::UDPChannelCodec udpChannelCodec
void setUdpAddress(QString *udp_address)
void setUdpDecimationFactor(qint32 udp_decimation_factor)
bool getOutputDeviceInfo(const QString &deviceName, OutputDeviceInfo &deviceInfo) const
bool getOutputDeviceName(int outputDeviceIndex, QString &deviceName) const
void unsetInputDeviceInfo(int inputDeviceIndex)
void setUdpChannelCodec(qint32 udp_channel_codec)
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
AudioOutput::UDPChannelMode udpChannelMode
void setUdpUsesRtp(qint32 udp_uses_rtp)
void setUdpChannelMode(qint32 udp_channel_mode)
+ Here is the call graph for this function:

◆ instanceAudioOutputPatch()

int WebAPIAdapterSrv::instanceAudioOutputPatch ( SWGSDRangel::SWGAudioOutputDevice response,
const QStringList &  audioOutputKeys,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/audio/output/parameters (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 408 of file webapiadaptersrv.cpp.

References AudioDeviceManager::OutputDeviceInfo::copyToUDP, DSPEngine::getAudioDeviceManager(), SWGSDRangel::SWGAudioOutputDevice::getCopyToUdp(), SWGSDRangel::SWGAudioOutputDevice::getIndex(), SWGSDRangel::SWGErrorResponse::getMessage(), AudioDeviceManager::getOutputDeviceInfo(), AudioDeviceManager::getOutputDeviceName(), SWGSDRangel::SWGAudioOutputDevice::getSampleRate(), SWGSDRangel::SWGAudioOutputDevice::getUdpAddress(), SWGSDRangel::SWGAudioOutputDevice::getUdpChannelMode(), SWGSDRangel::SWGAudioOutputDevice::getUdpPort(), SWGSDRangel::SWGAudioOutputDevice::getUdpUsesRtp(), SWGSDRangel::SWGErrorResponse::init(), MainCore::m_dspEngine, m_mainCore, AudioDeviceManager::OutputDeviceInfo::sampleRate, SWGSDRangel::SWGAudioOutputDevice::setCopyToUdp(), AudioDeviceManager::setOutputDeviceInfo(), SWGSDRangel::SWGAudioOutputDevice::setSampleRate(), SWGSDRangel::SWGAudioOutputDevice::setUdpAddress(), SWGSDRangel::SWGAudioOutputDevice::setUdpChannelCodec(), SWGSDRangel::SWGAudioOutputDevice::setUdpChannelMode(), SWGSDRangel::SWGAudioOutputDevice::setUdpDecimationFactor(), SWGSDRangel::SWGAudioOutputDevice::setUdpPort(), SWGSDRangel::SWGAudioOutputDevice::setUdpUsesRtp(), AudioDeviceManager::OutputDeviceInfo::udpAddress, AudioDeviceManager::OutputDeviceInfo::udpChannelCodec, AudioDeviceManager::OutputDeviceInfo::udpChannelMode, AudioDeviceManager::OutputDeviceInfo::udpDecimationFactor, AudioDeviceManager::OutputDeviceInfo::udpPort, and AudioDeviceManager::OutputDeviceInfo::udpUseRTP.

412 {
413  AudioDeviceManager::OutputDeviceInfo outputDeviceInfo;
414  QString deviceName;
415  int deviceIndex = response.getIndex();
416 
417  if (!m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceName(deviceIndex, deviceName))
418  {
419  error.init();
420  *error.getMessage() = QString("There is no output audio device at index %1").arg(deviceIndex);
421  return 404;
422  }
423 
424  m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo);
425 
426  if (audioOutputKeys.contains("sampleRate")) {
427  outputDeviceInfo.sampleRate = response.getSampleRate();
428  }
429  if (audioOutputKeys.contains("copyToUDP")) {
430  outputDeviceInfo.copyToUDP = response.getCopyToUdp() == 0 ? 0 : 1;
431  }
432  if (audioOutputKeys.contains("udpUsesRTP")) {
433  outputDeviceInfo.udpUseRTP = response.getUdpUsesRtp() == 0 ? 0 : 1;
434  }
435  if (audioOutputKeys.contains("udpChannelMode")) {
436  outputDeviceInfo.udpChannelMode = static_cast<AudioOutput::UDPChannelMode>(response.getUdpChannelMode() % 4);
437  }
438  if (audioOutputKeys.contains("udpAddress")) {
439  outputDeviceInfo.udpAddress = *response.getUdpAddress();
440  }
441  if (audioOutputKeys.contains("udpPort")) {
442  outputDeviceInfo.udpPort = response.getUdpPort() % (1<<16);
443  }
444 
445  m_mainCore.m_dspEngine->getAudioDeviceManager()->setOutputDeviceInfo(deviceIndex, outputDeviceInfo);
446  m_mainCore.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo);
447 
448  response.setSampleRate(outputDeviceInfo.sampleRate);
449  response.setCopyToUdp(outputDeviceInfo.copyToUDP == 0 ? 0 : 1);
450  response.setUdpUsesRtp(outputDeviceInfo.udpUseRTP == 0 ? 0 : 1);
451  response.setUdpChannelMode(outputDeviceInfo.udpChannelMode);
452  response.setUdpChannelCodec(outputDeviceInfo.udpChannelCodec);
453  response.setUdpDecimationFactor(outputDeviceInfo.udpDecimationFactor);
454 
455  if (response.getUdpAddress()) {
456  *response.getUdpAddress() = outputDeviceInfo.udpAddress;
457  } else {
458  response.setUdpAddress(new QString(outputDeviceInfo.udpAddress));
459  }
460 
461  response.setUdpPort(outputDeviceInfo.udpPort % (1<<16));
462 
463  return 200;
464 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
AudioOutput::UDPChannelCodec udpChannelCodec
void setUdpAddress(QString *udp_address)
void setOutputDeviceInfo(int outputDeviceIndex, const OutputDeviceInfo &deviceInfo)
void setUdpDecimationFactor(qint32 udp_decimation_factor)
bool getOutputDeviceInfo(const QString &deviceName, OutputDeviceInfo &deviceInfo) const
bool getOutputDeviceName(int outputDeviceIndex, QString &deviceName) const
void setUdpChannelCodec(qint32 udp_channel_codec)
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
AudioOutput::UDPChannelMode udpChannelMode
void setUdpUsesRtp(qint32 udp_uses_rtp)
void setUdpChannelMode(qint32 udp_channel_mode)
+ Here is the call graph for this function:

◆ instanceChannels()

int WebAPIAdapterSrv::instanceChannels ( int  direction,
SWGSDRangel::SWGInstanceChannelsResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/channels (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 189 of file webapiadaptersrv.cpp.

References PluginDescriptor::displayedName, SWGSDRangel::SWGInstanceChannelsResponse::getChannels(), PluginInterface::getPluginDescriptor(), PluginManager::getRxChannelRegistrations(), PluginManager::getTxChannelRegistrations(), i, SWGSDRangel::SWGInstanceChannelsResponse::init(), m_mainCore, MainCore::m_pluginManager, SWGSDRangel::SWGInstanceChannelsResponse::setChannelcount(), and PluginDescriptor::version.

193 {
194  response.init();
195  PluginAPI::ChannelRegistrations *channelRegistrations;
196  int nbChannelDevices;
197 
198  if (direction == 0) // Single sink (Rx) channel
199  {
200  channelRegistrations = m_mainCore.m_pluginManager->getRxChannelRegistrations();
201  nbChannelDevices = channelRegistrations->size();
202  }
203  else if (direction == 1) // Single source (Tx) channel
204  {
205  channelRegistrations = m_mainCore.m_pluginManager->getTxChannelRegistrations();
206  nbChannelDevices = channelRegistrations->size();
207  }
208  else // not supported
209  {
210  channelRegistrations = nullptr;
211  nbChannelDevices = 0;
212  }
213 
214  response.setChannelcount(nbChannelDevices);
215  QList<SWGSDRangel::SWGChannelListItem*> *channels = response.getChannels();
216 
217  for (int i = 0; i < nbChannelDevices; i++)
218  {
219  channels->append(new SWGSDRangel::SWGChannelListItem);
220  channels->back()->init();
221  PluginInterface *channelInterface = channelRegistrations->at(i).m_plugin;
222  const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor();
223  *channels->back()->getVersion() = pluginDescriptor.version;
224  *channels->back()->getName() = pluginDescriptor.displayedName;
225  channels->back()->setDirection(direction);
226  *channels->back()->getIdUri() = channelRegistrations->at(i).m_channelIdURI;
227  *channels->back()->getId() = channelRegistrations->at(i).m_channelId;
228  channels->back()->setIndex(i);
229  }
230 
231  return 200;
232 }
const QString version
QList< ChannelRegistration > ChannelRegistrations
Definition: pluginapi.h:44
const QString displayedName
PluginAPI::ChannelRegistrations * getRxChannelRegistrations()
Definition: pluginmanager.h:74
virtual const PluginDescriptor & getPluginDescriptor() const =0
PluginAPI::ChannelRegistrations * getTxChannelRegistrations()
Definition: pluginmanager.h:75
int32_t i
Definition: decimators.h:244
PluginManager * m_pluginManager
Definition: maincore.h:282
+ Here is the call graph for this function:

◆ instanceConfigGet()

int WebAPIAdapterSrv::instanceConfigGet ( SWGSDRangel::SWGInstanceConfigResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/config (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceSummary returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 118 of file webapiadaptersrv.cpp.

References MainCore::getMainSettings(), MainSettings::getPreferences(), SWGSDRangel::SWGInstanceConfigResponse::getPreferences(), MainSettings::getPreset(), MainSettings::getPresetCount(), SWGSDRangel::SWGInstanceConfigResponse::getPresets(), SWGSDRangel::SWGInstanceConfigResponse::getWorkingPreset(), MainSettings::getWorkingPresetConst(), i, SWGSDRangel::SWGInstanceConfigResponse::init(), m_mainCore, MainCore::m_settings, WebAPIAdapterBase::webapiFormatPreferences(), and WebAPIAdapterBase::webapiFormatPreset().

121 {
122  response.init();
123  SWGSDRangel::SWGPreferences *preferences = response.getPreferences();
125  SWGSDRangel::SWGPreset *workingPreset = response.getWorkingPreset();
127 
128  int nbPresets = m_mainCore.m_settings.getPresetCount();
129  QList<SWGSDRangel::SWGPreset*> *swgPresets = response.getPresets();
130 
131  for (int i = 0; i < nbPresets; i++)
132  {
133  const Preset *preset = m_mainCore.m_settings.getPreset(i);
134  swgPresets->append(new SWGSDRangel::SWGPreset);
135  WebAPIAdapterBase::webapiFormatPreset(swgPresets->back(), *preset);
136  }
137 
138  return 200;
139 }
MainSettings m_settings
Definition: maincore.h:273
int getPresetCount() const
Definition: mainsettings.h:30
Definition: preset.h:28
int32_t i
Definition: decimators.h:244
static void webapiFormatPreferences(SWGSDRangel::SWGPreferences *apiPreferences, const Preferences &preferences)
const MainSettings & getMainSettings() const
Definition: maincore.h:59
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
const Preferences & getPreferences() const
Definition: mainsettings.h:26
static void webapiFormatPreset(SWGSDRangel::SWGPreset *apiPreset, const Preset &preset)
const Preset & getWorkingPresetConst() const
Definition: mainsettings.h:46
+ Here is the call graph for this function:

◆ instanceDelete()

int WebAPIAdapterSrv::instanceDelete ( SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceSummary returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 105 of file webapiadaptersrv.cpp.

References MainCore::MsgDeleteInstance::create(), MainCore::getInputMessageQueue(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::init(), m_mainCore, and MessageQueue::push().

108 {
111 
112  response.init();
113  *response.getMessage() = QString("Message to stop the SDRangel instance (MsgDeleteInstance) was submitted successfully");
114 
115  return 202;
116 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
Definition: maincore.h:56
static MsgDeleteInstance * create()
Definition: maincore.h:148
+ Here is the call graph for this function:

◆ instanceDevices()

int WebAPIAdapterSrv::instanceDevices ( int  direction,
SWGSDRangel::SWGInstanceDevicesResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/devices (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceDevices returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 141 of file webapiadaptersrv.cpp.

References PluginInterface::SamplingDevice::claimed, PluginInterface::SamplingDevice::deviceNbItems, PluginInterface::SamplingDevice::displayedName, SWGSDRangel::SWGInstanceDevicesResponse::getDevices(), DeviceEnumerator::getNbRxSamplingDevices(), DeviceEnumerator::getNbTxSamplingDevices(), DeviceEnumerator::getRxSamplingDevice(), DeviceEnumerator::getTxSamplingDevice(), PluginInterface::SamplingDevice::hardwareId, i, SWGSDRangel::SWGInstanceDevicesResponse::init(), DeviceEnumerator::instance(), PluginInterface::SamplingDevice::sequence, PluginInterface::SamplingDevice::serial, SWGSDRangel::SWGInstanceDevicesResponse::setDevicecount(), and PluginInterface::SamplingDevice::streamType.

145 {
146  response.init();
147 
148  int nbSamplingDevices;
149 
150  if (direction == 0) { // Single Rx stream device
151  nbSamplingDevices = DeviceEnumerator::instance()->getNbRxSamplingDevices();
152  } else if (direction == 1) { // Single Tx stream device
153  nbSamplingDevices = DeviceEnumerator::instance()->getNbTxSamplingDevices();
154  } else { // not supported
155  nbSamplingDevices = 0;
156  }
157 
158 
159  response.setDevicecount(nbSamplingDevices);
160  QList<SWGSDRangel::SWGDeviceListItem*> *devices = response.getDevices();
161 
162  for (int i = 0; i < nbSamplingDevices; i++)
163  {
164  const PluginInterface::SamplingDevice *samplingDevice = nullptr;
165 
166  if (direction == 0) {
167  samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(i);
168  } else if (direction == 1) {
169  samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(i);
170  } else {
171  continue;
172  }
173 
174  devices->append(new SWGSDRangel::SWGDeviceListItem);
175  devices->back()->init();
176  *devices->back()->getDisplayedName() = samplingDevice->displayedName;
177  *devices->back()->getHwType() = samplingDevice->hardwareId;
178  *devices->back()->getSerial() = samplingDevice->serial;
179  devices->back()->setSequence(samplingDevice->sequence);
180  devices->back()->setDirection((int) samplingDevice->streamType);
181  devices->back()->setDeviceNbStreams(samplingDevice->deviceNbItems);
182  devices->back()->setDeviceSetIndex(samplingDevice->claimed);
183  devices->back()->setIndex(i);
184  }
185 
186  return 200;
187 }
int sequence
The device sequence. >0 when more than one device of the same type is connected.
QString displayedName
The human readable name.
QString hardwareId
The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
int deviceNbItems
Number of items (or streams) in the device. >1 for composite devices.
int32_t i
Definition: decimators.h:244
int claimed
This is the device set index if claimed else -1.
QString serial
The device serial number defined by the vendor or a fake one (SDRplay)
int getNbRxSamplingDevices() const
const PluginInterface::SamplingDevice * getTxSamplingDevice(int deviceIndex) const
const PluginInterface::SamplingDevice * getRxSamplingDevice(int deviceIndex) const
StreamType streamType
This is the type of stream supported.
static DeviceEnumerator * instance()
int getNbTxSamplingDevices() const
+ Here is the call graph for this function:

◆ instanceDeviceSetDelete()

int WebAPIAdapterSrv::instanceDeviceSetDelete ( SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1146 of file webapiadaptersrv.cpp.

References MainCore::MsgRemoveLastDeviceSet::create(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGSuccessResponse::init(), MainCore::m_deviceSets, MainCore::m_inputMessageQueue, m_mainCore, and MessageQueue::push().

1149 {
1150  if (m_mainCore.m_deviceSets.size() > 0)
1151  {
1154 
1155  response.init();
1156  *response.getMessage() = QString("Message to remove last device set (MsgRemoveLastDeviceSet) was submitted successfully");
1157 
1158  return 202;
1159  }
1160  else
1161  {
1162  error.init();
1163  *error.getMessage() = "No more device sets to be removed";
1164 
1165  return 404;
1166  }
1167 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
static MsgRemoveLastDeviceSet * create()
Definition: maincore.h:183
+ Here is the call graph for this function:

◆ instanceDeviceSetPost()

int WebAPIAdapterSrv::instanceDeviceSetPost ( int  direction,
SWGSDRangel::SWGSuccessResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/deviceset (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1132 of file webapiadaptersrv.cpp.

References MainCore::MsgAddDeviceSet::create(), SWGSDRangel::SWGSuccessResponse::getMessage(), SWGSDRangel::SWGSuccessResponse::init(), MainCore::m_inputMessageQueue, m_mainCore, and MessageQueue::push().

1136 {
1139 
1140  response.init();
1141  *response.getMessage() = QString("Message to add a new device set (MsgAddDeviceSet) was submitted successfully");
1142 
1143  return 202;
1144 }
static MsgAddDeviceSet * create(int direction)
Definition: maincore.h:165
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
+ Here is the call graph for this function:

◆ instanceDeviceSetsGet()

int WebAPIAdapterSrv::instanceDeviceSetsGet ( SWGSDRangel::SWGDeviceSetList response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/devicesets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1124 of file webapiadaptersrv.cpp.

References getDeviceSetList().

1127 {
1128  getDeviceSetList(&response);
1129  return 200;
1130 }
void getDeviceSetList(SWGSDRangel::SWGDeviceSetList *deviceSetList)
+ Here is the call graph for this function:

◆ instanceDVSerialGet()

int WebAPIAdapterSrv::instanceDVSerialGet ( SWGSDRangel::SWGDVSerialDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Definition at line 580 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGDVSerialDevices::getDvSerialDevices(), DSPEngine::getDVSerialNames(), SWGSDRangel::SWGDVSerialDevices::init(), MainCore::m_dspEngine, m_mainCore, and SWGSDRangel::SWGDVSerialDevices::setNbDevices().

583 {
584  response.init();
585 
586  std::vector<std::string> deviceNames;
588  response.setNbDevices((int) deviceNames.size());
589  QList<SWGSDRangel::SWGDVSerialDevice*> *deviceNamesList = response.getDvSerialDevices();
590 
591  std::vector<std::string>::iterator it = deviceNames.begin();
592 
593  while (it != deviceNames.end())
594  {
595  deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice);
596  deviceNamesList->back()->init();
597  *deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
598  ++it;
599  }
600 
601  return 200;
602 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
void getDVSerialNames(std::vector< std::string > &deviceNames)
Definition: dspengine.cpp:166
QList< SWGDVSerialDevice * > * getDvSerialDevices()
void setNbDevices(qint32 nb_devices)
+ Here is the call graph for this function:

◆ instanceDVSerialPatch()

int WebAPIAdapterSrv::instanceDVSerialPatch ( bool  dvserial,
SWGSDRangel::SWGDVSerialDevices response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Definition at line 604 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGDVSerialDevices::getDvSerialDevices(), DSPEngine::getDVSerialNames(), SWGSDRangel::SWGDVSerialDevices::init(), MainCore::m_dspEngine, m_mainCore, DSPEngine::setDVSerialSupport(), and SWGSDRangel::SWGDVSerialDevices::setNbDevices().

608 {
610  response.init();
611 
612  if (dvserial)
613  {
614  std::vector<std::string> deviceNames;
616  response.setNbDevices((int) deviceNames.size());
617  QList<SWGSDRangel::SWGDVSerialDevice*> *deviceNamesList = response.getDvSerialDevices();
618 
619  std::vector<std::string>::iterator it = deviceNames.begin();
620  std::string deviceNamesStr = "DV Serial devices found: ";
621 
622  while (it != deviceNames.end())
623  {
624  deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice);
625  deviceNamesList->back()->init();
626  *deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
627  ++it;
628  }
629  }
630  else
631  {
632  response.setNbDevices(0);
633  }
634 
635  return 200;
636 }
DSPEngine * m_dspEngine
Definition: maincore.h:275
void getDVSerialNames(std::vector< std::string > &deviceNames)
Definition: dspengine.cpp:166
QList< SWGDVSerialDevice * > * getDvSerialDevices()
void setNbDevices(qint32 nb_devices)
void setDVSerialSupport(bool support)
Definition: dspengine.cpp:163
+ Here is the call graph for this function:

◆ instanceLocationGet()

int WebAPIAdapterSrv::instanceLocationGet ( SWGSDRangel::SWGLocationInformation response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/location (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 550 of file webapiadaptersrv.cpp.

References MainSettings::getLatitude(), MainSettings::getLongitude(), SWGSDRangel::SWGLocationInformation::init(), m_mainCore, MainCore::m_settings, SWGSDRangel::SWGLocationInformation::setLatitude(), and SWGSDRangel::SWGLocationInformation::setLongitude().

553 {
554  response.init();
557 
558  return 200;
559 }
float getLatitude() const
Definition: mainsettings.h:55
MainSettings m_settings
Definition: maincore.h:273
float getLongitude() const
Definition: mainsettings.h:56
+ Here is the call graph for this function:

◆ instanceLocationPut()

int WebAPIAdapterSrv::instanceLocationPut ( SWGSDRangel::SWGLocationInformation response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/location (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 561 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGLocationInformation::getLatitude(), MainSettings::getLatitude(), SWGSDRangel::SWGLocationInformation::getLongitude(), MainSettings::getLongitude(), m_mainCore, MainCore::m_settings, SWGSDRangel::SWGLocationInformation::setLatitude(), MainSettings::setLatitude(), SWGSDRangel::SWGLocationInformation::setLongitude(), and MainSettings::setLongitude().

564 {
565  float latitude = response.getLatitude();
566  float longitude = response.getLongitude();
567 
568  latitude = latitude < -90.0 ? -90.0 : latitude > 90.0 ? 90.0 : latitude;
569  longitude = longitude < -180.0 ? -180.0 : longitude > 180.0 ? 180.0 : longitude;
570 
573 
576 
577  return 200;
578 }
float getLatitude() const
Definition: mainsettings.h:55
MainSettings m_settings
Definition: maincore.h:273
void setLongitude(float longitude)
Definition: mainsettings.h:54
float getLongitude() const
Definition: mainsettings.h:56
void setLatitude(float latitude)
Definition: mainsettings.h:53
+ Here is the call graph for this function:

◆ instanceLoggingGet()

int WebAPIAdapterSrv::instanceLoggingGet ( SWGSDRangel::SWGLoggingInfo response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/logging (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 234 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGLoggingInfo::getConsoleLevel(), qtwebapp::LoggerWithFile::getConsoleMinMessageLevelStr(), SWGSDRangel::SWGLoggingInfo::getDumpToFile(), SWGSDRangel::SWGLoggingInfo::getFileLevel(), qtwebapp::LoggerWithFile::getFileMinMessageLevelStr(), SWGSDRangel::SWGLoggingInfo::getFileName(), qtwebapp::LoggerWithFile::getLogFileName(), qtwebapp::LoggerWithFile::getUseFileLogger(), SWGSDRangel::SWGLoggingInfo::init(), MainCore::m_logger, m_mainCore, and SWGSDRangel::SWGLoggingInfo::setDumpToFile().

237 {
238  response.init();
239  response.setDumpToFile(m_mainCore.m_logger->getUseFileLogger() ? 1 : 0);
240 
241  if (response.getDumpToFile()) {
244  }
245 
247 
248  return 200;
249 }
bool getUseFileLogger() const
qtwebapp::LoggerWithFile * m_logger
Definition: maincore.h:277
void getFileMinMessageLevelStr(QString &levelStr)
void getConsoleMinMessageLevelStr(QString &levelStr)
void getLogFileName(QString &fileName)
void setDumpToFile(qint32 dump_to_file)
+ Here is the call graph for this function:

◆ instanceLoggingPut()

int WebAPIAdapterSrv::instanceLoggingPut ( SWGSDRangel::SWGLoggingInfo query,
SWGSDRangel::SWGLoggingInfo response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/logging (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 251 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGLoggingInfo::getConsoleLevel(), MainSettings::getConsoleMinLogLevel(), SWGSDRangel::SWGLoggingInfo::getDumpToFile(), SWGSDRangel::SWGLoggingInfo::getFileLevel(), MainSettings::getFileMinLogLevel(), SWGSDRangel::SWGLoggingInfo::getFileName(), MainSettings::getLogFileName(), getMsgTypeFromString(), getMsgTypeString(), MainSettings::getUseLogFile(), SWGSDRangel::SWGLoggingInfo::init(), m_mainCore, MainCore::m_settings, MainSettings::setConsoleMinLogLevel(), SWGSDRangel::SWGLoggingInfo::setDumpToFile(), MainSettings::setFileMinLogLevel(), MainSettings::setLogFileName(), MainCore::setLoggingOptions(), and MainSettings::setUseLogFile().

255 {
256  // response input is the query actually
257  bool dumpToFile = (query.getDumpToFile() != 0);
258  QString* consoleLevel = query.getConsoleLevel();
259  QString* fileLevel = query.getFileLevel();
260  QString* fileName = query.getFileName();
261 
262  // perform actions
263  if (consoleLevel) {
265  }
266 
267  if (fileLevel) {
269  }
270 
271  m_mainCore.m_settings.setUseLogFile(dumpToFile);
272 
273  if (fileName) {
275  }
276 
278 
279  // build response
280  response.init();
282  response.setDumpToFile(m_mainCore.m_settings.getUseLogFile() ? 1 : 0);
285 
286  return 200;
287 }
void setLoggingOptions()
Definition: maincore.cpp:209
const QString & getLogFileName() const
Definition: mainsettings.h:65
static void getMsgTypeString(const QtMsgType &msgType, QString &level)
bool getUseLogFile() const
Definition: mainsettings.h:64
void setConsoleMinLogLevel(const QtMsgType &minLogLevel)
Definition: mainsettings.h:58
MainSettings m_settings
Definition: maincore.h:273
QtMsgType getFileMinLogLevel() const
Definition: mainsettings.h:63
void setFileMinLogLevel(const QtMsgType &minLogLevel)
Definition: mainsettings.h:59
static QtMsgType getMsgTypeFromString(const QString &msgTypeString)
void setUseLogFile(bool useLogFile)
Definition: mainsettings.h:60
QtMsgType getConsoleMinLogLevel() const
Definition: mainsettings.h:62
void setLogFileName(const QString &value)
Definition: mainsettings.h:61
void setDumpToFile(qint32 dump_to_file)
+ Here is the call graph for this function:

◆ instancePresetDelete()

int WebAPIAdapterSrv::instancePresetDelete ( SWGSDRangel::SWGPresetIdentifier response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/preset (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1093 of file webapiadaptersrv.cpp.

References arg(), MainCore::MsgDeletePreset::create(), SWGSDRangel::SWGPresetIdentifier::getCenterFrequency(), Preset::getCenterFrequency(), Preset::getDescription(), Preset::getGroup(), SWGSDRangel::SWGPresetIdentifier::getGroupName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGPresetIdentifier::getName(), MainSettings::getPreset(), SWGSDRangel::SWGPresetIdentifier::getType(), SWGSDRangel::SWGErrorResponse::init(), Preset::isSourcePreset(), MainCore::m_inputMessageQueue, m_mainCore, MainCore::m_settings, MessageQueue::push(), and SWGSDRangel::SWGPresetIdentifier::setCenterFrequency().

1096 {
1097  const Preset *selectedPreset = m_mainCore.m_settings.getPreset(*response.getGroupName(),
1098  response.getCenterFrequency(),
1099  *response.getName(),
1100  *response.getType());
1101 
1102  if (selectedPreset == 0)
1103  {
1104  error.init();
1105  *error.getMessage() = QString("There is no preset [%1, %2, %3 %4]")
1106  .arg(*response.getGroupName())
1107  .arg(response.getCenterFrequency())
1108  .arg(*response.getName())
1109  .arg(*response.getType());
1110  return 404;
1111  }
1112 
1113  response.setCenterFrequency(selectedPreset->getCenterFrequency());
1114  *response.getGroupName() = selectedPreset->getGroup();
1115  *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
1116  *response.getName() = selectedPreset->getDescription();
1117 
1118  MainCore::MsgDeletePreset *msg = MainCore::MsgDeletePreset::create(const_cast<Preset*>(selectedPreset));
1120 
1121  return 202;
1122 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
quint64 getCenterFrequency() const
Definition: preset.h:76
bool isSourcePreset() const
Definition: preset.h:66
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
MainSettings m_settings
Definition: maincore.h:273
Definition: preset.h:28
static MsgDeletePreset * create(const Preset *preset)
Definition: maincore.h:130
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
void setCenterFrequency(qint64 center_frequency)
const QString & getDescription() const
Definition: preset.h:74
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instancePresetFilePost()

int WebAPIAdapterSrv::instancePresetFilePost ( SWGSDRangel::SWGPresetExport query,
SWGSDRangel::SWGPresetIdentifier response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/preset/file (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 797 of file webapiadaptersrv.cpp.

References arg(), SWGSDRangel::SWGPresetIdentifier::getCenterFrequency(), Preset::getCenterFrequency(), Preset::getDescription(), SWGSDRangel::SWGPresetExport::getFilePath(), Preset::getGroup(), SWGSDRangel::SWGPresetIdentifier::getGroupName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGPresetIdentifier::getName(), MainSettings::getPreset(), SWGSDRangel::SWGPresetExport::getPreset(), SWGSDRangel::SWGPresetIdentifier::getType(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGPresetIdentifier::init(), Preset::isSourcePreset(), m_mainCore, MainCore::m_settings, Preset::serialize(), and SWGSDRangel::SWGPresetIdentifier::setCenterFrequency().

801 {
802  QString filePath = *query.getFilePath();
803  SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset();
804 
805  const Preset *selectedPreset = m_mainCore.m_settings.getPreset(*presetIdentifier->getGroupName(),
806  presetIdentifier->getCenterFrequency(),
807  *presetIdentifier->getName(),
808  *presetIdentifier->getType());
809 
810  if (selectedPreset == 0)
811  {
812  error.init();
813  *error.getMessage() = QString("There is no preset [%1, %2, %3, %4]")
814  .arg(*presetIdentifier->getGroupName())
815  .arg(presetIdentifier->getCenterFrequency())
816  .arg(*presetIdentifier->getName())
817  .arg(*presetIdentifier->getType());
818  return 404;
819  }
820 
821  QString base64Str = selectedPreset->serialize().toBase64();
822 
823  if (filePath != "")
824  {
825  QFileInfo fileInfo(filePath);
826 
827  if (fileInfo.suffix() != "prex") {
828  filePath += ".prex";
829  }
830 
831  QFile exportFile(filePath);
832 
833  if (exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
834  {
835  QTextStream outstream(&exportFile);
836  outstream << base64Str;
837  exportFile.close();
838 
839  response.init();
840  response.setCenterFrequency(selectedPreset->getCenterFrequency());
841  *response.getGroupName() = selectedPreset->getGroup();
842  *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
843  *response.getName() = selectedPreset->getDescription();
844 
845  return 200;
846  }
847  else
848  {
849  error.init();
850  *error.getMessage() = QString("File %1 cannot be written").arg(filePath);
851  return 404;
852  }
853  }
854  else
855  {
856  error.init();
857  *error.getMessage() = QString("Empty file path");
858  return 404;
859  }
860 }
quint64 getCenterFrequency() const
Definition: preset.h:76
bool isSourcePreset() const
Definition: preset.h:66
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
SWGPresetIdentifier * getPreset()
MainSettings m_settings
Definition: maincore.h:273
QByteArray serialize() const
Definition: preset.cpp:43
Definition: preset.h:28
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
void setCenterFrequency(qint64 center_frequency)
const QString & getDescription() const
Definition: preset.h:74
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instancePresetFilePut()

int WebAPIAdapterSrv::instancePresetFilePut ( SWGSDRangel::SWGPresetImport query,
SWGSDRangel::SWGPresetIdentifier response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/preset/file (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 745 of file webapiadaptersrv.cpp.

References Preset::deserialize(), Preset::getCenterFrequency(), SWGSDRangel::SWGPresetImport::getDescription(), Preset::getDescription(), SWGSDRangel::SWGPresetImport::getFilePath(), Preset::getGroup(), SWGSDRangel::SWGPresetImport::getGroupName(), SWGSDRangel::SWGPresetIdentifier::getGroupName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGPresetIdentifier::getName(), SWGSDRangel::SWGPresetIdentifier::getType(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGPresetIdentifier::init(), Preset::isSourcePreset(), m_mainCore, MainCore::m_settings, MainSettings::newPreset(), SWGSDRangel::SWGPresetIdentifier::setCenterFrequency(), Preset::setDescription(), and Preset::setGroup().

749 {
750  const QString& fileName = *query.getFilePath();
751 
752  if (fileName != "")
753  {
754  QFile exportFile(fileName);
755 
756  if (exportFile.open(QIODevice::ReadOnly | QIODevice::Text))
757  {
758  QByteArray base64Str;
759  QTextStream instream(&exportFile);
760  instream >> base64Str;
761  exportFile.close();
762 
763  Preset* preset = m_mainCore.m_settings.newPreset("", "");
764  preset->deserialize(QByteArray::fromBase64(base64Str));
765 
766  if (query.getGroupName() && (query.getGroupName()->size() > 0)) {
767  preset->setGroup(*query.getGroupName());
768  }
769 
770  if (query.getDescription() && (query.getDescription()->size() > 0)) {
771  preset->setDescription(*query.getDescription());
772  }
773 
774  response.init();
775  response.setCenterFrequency(preset->getCenterFrequency());
776  *response.getGroupName() = preset->getGroup();
777  *response.getType() = preset->isSourcePreset() ? "R" : "T";
778  *response.getName() = preset->getDescription();
779 
780  return 200;
781  }
782  else
783  {
784  error.init();
785  *error.getMessage() = QString("File %1 not found or not readable").arg(fileName);
786  return 404;
787  }
788  }
789  else
790  {
791  error.init();
792  *error.getMessage() = QString("Empty file path");
793  return 404;
794  }
795 }
quint64 getCenterFrequency() const
Definition: preset.h:76
bool isSourcePreset() const
Definition: preset.h:66
Preset * newPreset(const QString &group, const QString &description)
MainSettings m_settings
Definition: maincore.h:273
Definition: preset.h:28
void setDescription(const QString &description)
Definition: preset.h:73
void setGroup(const QString &group)
Definition: preset.h:71
bool deserialize(const QByteArray &data)
Definition: preset.cpp:94
void setCenterFrequency(qint64 center_frequency)
const QString & getDescription() const
Definition: preset.h:74
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instancePresetPatch()

int WebAPIAdapterSrv::instancePresetPatch ( SWGSDRangel::SWGPresetTransfer query,
SWGSDRangel::SWGPresetIdentifier response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/preset (PATCH) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 907 of file webapiadaptersrv.cpp.

References arg(), MainCore::MsgLoadPreset::create(), SWGSDRangel::SWGPresetIdentifier::getCenterFrequency(), Preset::getCenterFrequency(), Preset::getDescription(), SWGSDRangel::SWGPresetTransfer::getDeviceSetIndex(), Preset::getGroup(), SWGSDRangel::SWGPresetIdentifier::getGroupName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGPresetIdentifier::getName(), MainSettings::getPreset(), SWGSDRangel::SWGPresetTransfer::getPreset(), SWGSDRangel::SWGPresetIdentifier::getType(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGPresetIdentifier::init(), Preset::isSourcePreset(), MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, MainCore::m_inputMessageQueue, m_mainCore, MainCore::m_settings, MessageQueue::push(), and SWGSDRangel::SWGPresetIdentifier::setCenterFrequency().

911 {
912  int deviceSetIndex = query.getDeviceSetIndex();
913  SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset();
914  int nbDeviceSets = m_mainCore.m_deviceSets.size();
915 
916  if (deviceSetIndex >= nbDeviceSets)
917  {
918  error.init();
919  *error.getMessage() = QString("There is no device set at index %1. Number of device sets is %2").arg(deviceSetIndex).arg(nbDeviceSets);
920  return 404;
921  }
922 
923  const Preset *selectedPreset = m_mainCore.m_settings.getPreset(*presetIdentifier->getGroupName(),
924  presetIdentifier->getCenterFrequency(),
925  *presetIdentifier->getName(),
926  *presetIdentifier->getType());
927 
928  if (selectedPreset == 0)
929  {
930  error.init();
931  *error.getMessage() = QString("There is no preset [%1, %2, %3 %4]")
932  .arg(*presetIdentifier->getGroupName())
933  .arg(presetIdentifier->getCenterFrequency())
934  .arg(*presetIdentifier->getName())
935  .arg(*presetIdentifier->getType());
936  return 404;
937  }
938 
939  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
940 
941  if (deviceSet->m_deviceSourceEngine && !selectedPreset->isSourcePreset())
942  {
943  error.init();
944  *error.getMessage() = QString("Preset type (T) and device set type (Rx) mismatch");
945  return 404;
946  }
947 
948  if (deviceSet->m_deviceSinkEngine && selectedPreset->isSourcePreset())
949  {
950  error.init();
951  *error.getMessage() = QString("Preset type (R) and device set type (Tx) mismatch");
952  return 404;
953  }
954 
955  MainCore::MsgLoadPreset *msg = MainCore::MsgLoadPreset::create(selectedPreset, deviceSetIndex);
957 
958  response.init();
959  response.setCenterFrequency(selectedPreset->getCenterFrequency());
960  *response.getGroupName() = selectedPreset->getGroup();
961  *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
962  *response.getName() = selectedPreset->getDescription();
963 
964  return 202;
965 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
quint64 getCenterFrequency() const
Definition: preset.h:76
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
bool isSourcePreset() const
Definition: preset.h:66
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
SWGPresetIdentifier * getPreset()
MainSettings m_settings
Definition: maincore.h:273
Definition: preset.h:28
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
static MsgLoadPreset * create(const Preset *preset, int deviceSetIndex)
Definition: maincore.h:82
void setCenterFrequency(qint64 center_frequency)
const QString & getDescription() const
Definition: preset.h:74
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instancePresetPost()

int WebAPIAdapterSrv::instancePresetPost ( SWGSDRangel::SWGPresetTransfer query,
SWGSDRangel::SWGPresetIdentifier response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/preset (POST) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 1029 of file webapiadaptersrv.cpp.

References arg(), MainCore::MsgSavePreset::create(), DeviceSampleSink::getCenterFrequency(), DeviceSampleSource::getCenterFrequency(), Preset::getDescription(), SWGSDRangel::SWGPresetTransfer::getDeviceSetIndex(), Preset::getGroup(), SWGSDRangel::SWGPresetIdentifier::getGroupName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGPresetIdentifier::getName(), MainSettings::getPreset(), SWGSDRangel::SWGPresetTransfer::getPreset(), DSPDeviceSinkEngine::getSink(), DSPDeviceSourceEngine::getSource(), SWGSDRangel::SWGPresetIdentifier::getType(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGPresetIdentifier::init(), MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, MainCore::m_inputMessageQueue, m_mainCore, MainCore::m_settings, MainSettings::newPreset(), MessageQueue::push(), and SWGSDRangel::SWGPresetIdentifier::setCenterFrequency().

1033 {
1034  int deviceSetIndex = query.getDeviceSetIndex();
1035  SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset();
1036  int nbDeviceSets = m_mainCore.m_deviceSets.size();
1037 
1038  if (deviceSetIndex >= nbDeviceSets)
1039  {
1040  error.init();
1041  *error.getMessage() = QString("There is no device set at index %1. Number of device sets is %2").arg(deviceSetIndex).arg(nbDeviceSets);
1042  return 404;
1043  }
1044 
1045  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1046  int deviceCenterFrequency = 0;
1047  bool isSourcePreset;
1048 
1049  if (deviceSet->m_deviceSourceEngine) { // Rx
1050  deviceCenterFrequency = deviceSet->m_deviceSourceEngine->getSource()->getCenterFrequency();
1051  isSourcePreset = true;
1052  } else if (deviceSet->m_deviceSinkEngine) { // Tx
1053  deviceCenterFrequency = deviceSet->m_deviceSinkEngine->getSink()->getCenterFrequency();
1054  isSourcePreset = false;
1055  } else {
1056  error.init();
1057  *error.getMessage() = QString("Device set error");
1058  return 500;
1059  }
1060 
1061  const Preset *selectedPreset = m_mainCore.m_settings.getPreset(*presetIdentifier->getGroupName(),
1062  deviceCenterFrequency,
1063  *presetIdentifier->getName(),
1064  *presetIdentifier->getType());
1065 
1066  if (selectedPreset == 0) // save on a new preset
1067  {
1068  selectedPreset = m_mainCore.m_settings.newPreset(*presetIdentifier->getGroupName(), *presetIdentifier->getName());
1069  }
1070  else
1071  {
1072  error.init();
1073  *error.getMessage() = QString("Preset already exists [%1, %2, %3 %4]")
1074  .arg(*presetIdentifier->getGroupName())
1075  .arg(deviceCenterFrequency)
1076  .arg(*presetIdentifier->getName())
1077  .arg(*presetIdentifier->getType());
1078  return 409;
1079  }
1080 
1081  MainCore::MsgSavePreset *msg = MainCore::MsgSavePreset::create(const_cast<Preset*>(selectedPreset), deviceSetIndex, true);
1083 
1084  response.init();
1085  response.setCenterFrequency(deviceCenterFrequency);
1086  *response.getGroupName() = selectedPreset->getGroup();
1087  *response.getType() = isSourcePreset ? "R" : "T";
1088  *response.getName() = selectedPreset->getDescription();
1089 
1090  return 202;
1091 }
DeviceSampleSink * getSink()
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgSavePreset * create(Preset *preset, int deviceSetIndex, bool newPreset)
Definition: maincore.h:106
DeviceSampleSource * getSource()
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
Preset * newPreset(const QString &group, const QString &description)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
SWGPresetIdentifier * getPreset()
MainSettings m_settings
Definition: maincore.h:273
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the sink.
Definition: preset.h:28
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
void setCenterFrequency(qint64 center_frequency)
const QString & getDescription() const
Definition: preset.h:74
virtual quint64 getCenterFrequency() const =0
Center frequency exposed by the source.
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instancePresetPut()

int WebAPIAdapterSrv::instancePresetPut ( SWGSDRangel::SWGPresetTransfer query,
SWGSDRangel::SWGPresetIdentifier response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/preset (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 967 of file webapiadaptersrv.cpp.

References arg(), MainCore::MsgSavePreset::create(), SWGSDRangel::SWGPresetIdentifier::getCenterFrequency(), Preset::getCenterFrequency(), Preset::getDescription(), SWGSDRangel::SWGPresetTransfer::getDeviceSetIndex(), Preset::getGroup(), SWGSDRangel::SWGPresetIdentifier::getGroupName(), SWGSDRangel::SWGErrorResponse::getMessage(), SWGSDRangel::SWGPresetIdentifier::getName(), MainSettings::getPreset(), SWGSDRangel::SWGPresetTransfer::getPreset(), SWGSDRangel::SWGPresetIdentifier::getType(), SWGSDRangel::SWGErrorResponse::init(), SWGSDRangel::SWGPresetIdentifier::init(), Preset::isSourcePreset(), MainCore::m_deviceSets, DeviceSet::m_deviceSinkEngine, DeviceSet::m_deviceSourceEngine, MainCore::m_inputMessageQueue, m_mainCore, MainCore::m_settings, MessageQueue::push(), and SWGSDRangel::SWGPresetIdentifier::setCenterFrequency().

971 {
972  int deviceSetIndex = query.getDeviceSetIndex();
973  SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset();
974  int nbDeviceSets = m_mainCore.m_deviceSets.size();
975 
976  if (deviceSetIndex >= nbDeviceSets)
977  {
978  error.init();
979  *error.getMessage() = QString("There is no device set at index %1. Number of device sets is %2").arg(deviceSetIndex).arg(nbDeviceSets);
980  return 404;
981  }
982 
983  const Preset *selectedPreset = m_mainCore.m_settings.getPreset(*presetIdentifier->getGroupName(),
984  presetIdentifier->getCenterFrequency(),
985  *presetIdentifier->getName(),
986  *presetIdentifier->getType());
987 
988  if (selectedPreset == 0)
989  {
990  error.init();
991  *error.getMessage() = QString("There is no preset [%1, %2, %3 %4]")
992  .arg(*presetIdentifier->getGroupName())
993  .arg(presetIdentifier->getCenterFrequency())
994  .arg(*presetIdentifier->getName())
995  .arg(*presetIdentifier->getType());
996  return 404;
997  }
998  else // update existing preset
999  {
1000  DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
1001 
1002  if (deviceSet->m_deviceSourceEngine && !selectedPreset->isSourcePreset())
1003  {
1004  error.init();
1005  *error.getMessage() = QString("Preset type (T) and device set type (Rx) mismatch");
1006  return 404;
1007  }
1008 
1009  if (deviceSet->m_deviceSinkEngine && selectedPreset->isSourcePreset())
1010  {
1011  error.init();
1012  *error.getMessage() = QString("Preset type (R) and device set type (Tx) mismatch");
1013  return 404;
1014  }
1015  }
1016 
1017  MainCore::MsgSavePreset *msg = MainCore::MsgSavePreset::create(const_cast<Preset*>(selectedPreset), deviceSetIndex, false);
1019 
1020  response.init();
1021  response.setCenterFrequency(selectedPreset->getCenterFrequency());
1022  *response.getGroupName() = selectedPreset->getGroup();
1023  *response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
1024  *response.getName() = selectedPreset->getDescription();
1025 
1026  return 202;
1027 }
std::vector< DeviceSet * > m_deviceSets
Definition: maincore.h:281
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgSavePreset * create(Preset *preset, int deviceSetIndex, bool newPreset)
Definition: maincore.h:106
quint64 getCenterFrequency() const
Definition: preset.h:76
DSPDeviceSourceEngine * m_deviceSourceEngine
Definition: deviceset.h:35
bool isSourcePreset() const
Definition: preset.h:66
MessageQueue m_inputMessageQueue
Definition: maincore.h:279
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
SWGPresetIdentifier * getPreset()
MainSettings m_settings
Definition: maincore.h:273
Definition: preset.h:28
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
void setCenterFrequency(qint64 center_frequency)
const QString & getDescription() const
Definition: preset.h:74
DSPDeviceSinkEngine * m_deviceSinkEngine
Definition: deviceset.h:36
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instancePresetsGet()

int WebAPIAdapterSrv::instancePresetsGet ( SWGSDRangel::SWGPresets response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel/presets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 862 of file webapiadaptersrv.cpp.

References Preset::getCenterFrequency(), Preset::getDescription(), Preset::getGroup(), SWGSDRangel::SWGPresets::getGroups(), MainSettings::getPreset(), MainSettings::getPresetCount(), i, SWGSDRangel::SWGPresets::init(), Preset::isSourcePreset(), m_mainCore, MainCore::m_settings, and SWGSDRangel::SWGPresets::setNbGroups().

865 {
866  int nbPresets = m_mainCore.m_settings.getPresetCount();
867  int nbGroups = 0;
868  int nbPresetsThisGroup = 0;
869  QString groupName;
870  response.init();
871  QList<SWGSDRangel::SWGPresetGroup*> *groups = response.getGroups();
872  QList<SWGSDRangel::SWGPresetItem*> *swgPresets = 0;
873  int i = 0;
874 
875  // Presets are sorted by group first
876 
877  for (; i < nbPresets; i++)
878  {
879  const Preset *preset = m_mainCore.m_settings.getPreset(i);
880 
881  if ((i == 0) || (groupName != preset->getGroup())) // new group
882  {
883  if (i > 0) { groups->back()->setNbPresets(nbPresetsThisGroup); }
884  groups->append(new SWGSDRangel::SWGPresetGroup);
885  groups->back()->init();
886  groupName = preset->getGroup();
887  *groups->back()->getGroupName() = groupName;
888  swgPresets = groups->back()->getPresets();
889  nbGroups++;
890  nbPresetsThisGroup = 0;
891  }
892 
893  swgPresets->append(new SWGSDRangel::SWGPresetItem);
894  swgPresets->back()->init();
895  swgPresets->back()->setCenterFrequency(preset->getCenterFrequency());
896  *swgPresets->back()->getType() = preset->isSourcePreset() ? "R" : "T";
897  *swgPresets->back()->getName() = preset->getDescription();
898  nbPresetsThisGroup++;
899  }
900 
901  if (i > 0) { groups->back()->setNbPresets(nbPresetsThisGroup); }
902  response.setNbGroups(nbGroups);
903 
904  return 200;
905 }
quint64 getCenterFrequency() const
Definition: preset.h:76
bool isSourcePreset() const
Definition: preset.h:66
QList< SWGPresetGroup * > * getGroups()
Definition: SWGPresets.cpp:113
MainSettings m_settings
Definition: maincore.h:273
int getPresetCount() const
Definition: mainsettings.h:30
Definition: preset.h:28
int32_t i
Definition: decimators.h:244
void setNbGroups(qint32 nb_groups)
Definition: SWGPresets.cpp:107
const Preset * getPreset(int index) const
Definition: mainsettings.h:31
const QString & getDescription() const
Definition: preset.h:74
const QString & getGroup() const
Definition: preset.h:72
+ Here is the call graph for this function:

◆ instanceSummary()

int WebAPIAdapterSrv::instanceSummary ( SWGSDRangel::SWGInstanceSummaryResponse response,
SWGSDRangel::SWGErrorResponse error 
)
virtual

Handler of /sdrangel (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceSummary returns the Http status code (default 501: not implemented)

Reimplemented from WebAPIAdapterInterface.

Definition at line 72 of file webapiadaptersrv.cpp.

References SWGSDRangel::SWGInstanceSummaryResponse::getAppname(), SWGSDRangel::SWGInstanceSummaryResponse::getArchitecture(), SWGSDRangel::SWGLoggingInfo::getConsoleLevel(), qtwebapp::LoggerWithFile::getConsoleMinMessageLevelStr(), SWGSDRangel::SWGInstanceSummaryResponse::getDevicesetlist(), getDeviceSetList(), SWGSDRangel::SWGLoggingInfo::getDumpToFile(), SWGSDRangel::SWGLoggingInfo::getFileLevel(), qtwebapp::LoggerWithFile::getFileMinMessageLevelStr(), SWGSDRangel::SWGLoggingInfo::getFileName(), qtwebapp::LoggerWithFile::getLogFileName(), SWGSDRangel::SWGInstanceSummaryResponse::getLogging(), SWGSDRangel::SWGInstanceSummaryResponse::getOs(), SWGSDRangel::SWGInstanceSummaryResponse::getQtVersion(), qtwebapp::LoggerWithFile::getUseFileLogger(), SWGSDRangel::SWGInstanceSummaryResponse::getVersion(), SWGSDRangel::SWGLoggingInfo::init(), SWGSDRangel::SWGInstanceSummaryResponse::init(), MainCore::m_logger, m_mainCore, SDR_RX_SAMP_SZ, SDR_TX_SAMP_SZ, SWGSDRangel::SWGInstanceSummaryResponse::setDspRxBits(), SWGSDRangel::SWGInstanceSummaryResponse::setDspTxBits(), SWGSDRangel::SWGLoggingInfo::setDumpToFile(), and SWGSDRangel::SWGInstanceSummaryResponse::setPid().

75 {
76  response.init();
77  *response.getAppname() = QCoreApplication::applicationName();
78  *response.getVersion() = QCoreApplication::applicationVersion();
79  *response.getQtVersion() = QString(QT_VERSION_STR);
80  response.setDspRxBits(SDR_RX_SAMP_SZ);
81  response.setDspTxBits(SDR_TX_SAMP_SZ);
82  response.setPid(QCoreApplication::applicationPid());
83 #if QT_VERSION >= 0x050400
84  *response.getArchitecture() = QString(QSysInfo::currentCpuArchitecture());
85  *response.getOs() = QString(QSysInfo::prettyProductName());
86 #endif
87 
88  SWGSDRangel::SWGLoggingInfo *logging = response.getLogging();
89  logging->init();
91 
92  if (logging->getDumpToFile()) {
95  }
96 
98 
99  SWGSDRangel::SWGDeviceSetList *deviceSetList = response.getDevicesetlist();
100  getDeviceSetList(deviceSetList);
101 
102  return 200;
103 }
bool getUseFileLogger() const
void getDeviceSetList(SWGSDRangel::SWGDeviceSetList *deviceSetList)
#define SDR_RX_SAMP_SZ
Definition: dsptypes.h:32
qtwebapp::LoggerWithFile * m_logger
Definition: maincore.h:277
#define SDR_TX_SAMP_SZ
Definition: dsptypes.h:38
void getFileMinMessageLevelStr(QString &levelStr)
void getConsoleMinMessageLevelStr(QString &levelStr)
void getLogFileName(QString &fileName)
void setDumpToFile(qint32 dump_to_file)
+ Here is the call graph for this function:

Member Data Documentation

◆ m_mainCore

MainCore& WebAPIAdapterSrv::m_mainCore
private

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