mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
REST API: config: PUT (4): mapper work and rework
This commit is contained in:
parent
4157f64297
commit
d4dacaf84d
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
|
|
||||||
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1output"
|
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.bladerf1output"
|
||||||
|
|
||||||
class Bladerf1OutputPlugin : public QObject, public PluginInterface {
|
class Bladerf1OutputPlugin : public QObject, public PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "plugin/plugininterface.h"
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
#define HACKRFOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.hackrfoutput"
|
#define HACKRFOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.hackrf"
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "plugin/plugininterface.h"
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
#define LOCALOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.localoutput"
|
#define LOCALOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.localoutput"
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
|
|
||||||
|
@ -26,8 +26,14 @@ QString DeviceUtils::getRegisteredDeviceURI(const QString& xDeviceURI)
|
|||||||
{
|
{
|
||||||
if (xDeviceURI == "sdrangel.samplesource.bladerf") {
|
if (xDeviceURI == "sdrangel.samplesource.bladerf") {
|
||||||
return "sdrangel.samplesource.bladerf1input";
|
return "sdrangel.samplesource.bladerf1input";
|
||||||
|
} else if (xDeviceURI == "sdrangel.samplesource.bladerf1output") {
|
||||||
|
return "sdrangel.samplesink.bladerf1output";
|
||||||
} else if (xDeviceURI == "sdrangel.samplesource.filesource") {
|
} else if (xDeviceURI == "sdrangel.samplesource.filesource") {
|
||||||
return "sdrangel.samplesource.fileinput";
|
return "sdrangel.samplesource.fileinput";
|
||||||
|
} else if (xDeviceURI == "sdrangel.samplesource.hackrfoutput") {
|
||||||
|
return "sdrangel.samplesink.hackrf";
|
||||||
|
} else if (xDeviceURI == "sdrangel.samplesource.localoutput") {
|
||||||
|
return "sdrangel.samplesink.localoutput";
|
||||||
} else {
|
} else {
|
||||||
return xDeviceURI;
|
return xDeviceURI;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -101,7 +101,7 @@ private:
|
|||||||
|
|
||||||
bool appendPresetChannelKeys(
|
bool appendPresetChannelKeys(
|
||||||
SWGSDRangel::SWGChannelConfig *channel,
|
SWGSDRangel::SWGChannelConfig *channel,
|
||||||
const QJsonObject& channelJson,
|
const QJsonObject& channelSettngsJson,
|
||||||
WebAPIAdapterInterface::ChannelKeys& channelKeys
|
WebAPIAdapterInterface::ChannelKeys& channelKeys
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -114,8 +114,15 @@ private:
|
|||||||
|
|
||||||
bool appendPresetDeviceKeys(
|
bool appendPresetDeviceKeys(
|
||||||
SWGSDRangel::SWGDeviceConfig *device,
|
SWGSDRangel::SWGDeviceConfig *device,
|
||||||
const QJsonObject& deviceJson,
|
const QJsonObject& deviceSettngsJson,
|
||||||
WebAPIAdapterInterface::DeviceKeys& deviceKeys
|
WebAPIAdapterInterface::DeviceKeys& devicelKeys
|
||||||
|
);
|
||||||
|
|
||||||
|
bool getDevice(
|
||||||
|
const QString& deviceSettingsKey,
|
||||||
|
SWGSDRangel::SWGDeviceSettings *deviceSettings,
|
||||||
|
const QJsonObject& deviceSettingsJson,
|
||||||
|
QStringList& deviceSettingsKeys
|
||||||
);
|
);
|
||||||
|
|
||||||
void appendSettingsSubKeys(
|
void appendSettingsSubKeys(
|
||||||
@ -139,6 +146,11 @@ private:
|
|||||||
void resetAudioOutputDevice(SWGSDRangel::SWGAudioOutputDevice& audioOutputDevice);
|
void resetAudioOutputDevice(SWGSDRangel::SWGAudioOutputDevice& audioOutputDevice);
|
||||||
|
|
||||||
static const QMap<QString, QString> m_channelURIToSettingsKey;
|
static const QMap<QString, QString> m_channelURIToSettingsKey;
|
||||||
|
static const QMap<QString, QString> m_deviceIdToSettingsKey;
|
||||||
|
static const QMap<QString, QString> m_channelTypeToSettingsKey;
|
||||||
|
static const QMap<QString, QString> m_sourceDeviceHwIdToSettingsKey;
|
||||||
|
static const QMap<QString, QString> m_sinkDeviceHwIdToSettingsKey;
|
||||||
|
static const QMap<QString, QString> m_mimoDeviceHwIdToSettingsKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDRBASE_WEBAPI_WEBAPIREQUESTMAPPER_H_ */
|
#endif /* SDRBASE_WEBAPI_WEBAPIREQUESTMAPPER_H_ */
|
||||||
|
@ -164,6 +164,8 @@ int WebAPIAdapterGUI::instanceConfigPutPatch(
|
|||||||
if (force) {
|
if (force) {
|
||||||
webAPIAdapterBase.webapiInitConfig(m_mainWindow.m_settings);
|
webAPIAdapterBase.webapiInitConfig(m_mainWindow.m_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebAPIAdapterGUI::instanceDevices(
|
int WebAPIAdapterGUI::instanceDevices(
|
||||||
|
@ -150,6 +150,23 @@ int WebAPIAdapterSrv::instanceConfigGet(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WebAPIAdapterSrv::instanceConfigPutPatch(
|
||||||
|
bool force, // PUT else PATCH
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse& query,
|
||||||
|
const ConfigKeys& configKeys,
|
||||||
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
|
{
|
||||||
|
WebAPIAdapterBase webAPIAdapterBase;
|
||||||
|
webAPIAdapterBase.setPluginManager(m_mainCore.getPluginManager());
|
||||||
|
|
||||||
|
if (force) {
|
||||||
|
webAPIAdapterBase.webapiInitConfig(m_mainCore.m_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
int WebAPIAdapterSrv::instanceDevices(
|
int WebAPIAdapterSrv::instanceDevices(
|
||||||
int direction,
|
int direction,
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||||
|
@ -45,6 +45,13 @@ public:
|
|||||||
SWGSDRangel::SWGInstanceConfigResponse& response,
|
SWGSDRangel::SWGInstanceConfigResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error);
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
|
virtual int instanceConfigPutPatch(
|
||||||
|
bool force, // PUT else PATCH
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse& query,
|
||||||
|
const ConfigKeys& configKeys,
|
||||||
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
virtual int instanceDevices(
|
virtual int instanceDevices(
|
||||||
int direction,
|
int direction,
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||||
|
Loading…
Reference in New Issue
Block a user