REST API: config: PUT (4): mapper work and rework

pull/422/head
f4exb 2019-08-07 00:27:34 +02:00
rodzic 4157f64297
commit d4dacaf84d
9 zmienionych plików z 440 dodań i 758 usunięć

Wyświetl plik

@ -23,7 +23,7 @@
class PluginAPI;
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1output"
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.bladerf1output"
class Bladerf1OutputPlugin : public QObject, public PluginInterface {
Q_OBJECT

Wyświetl plik

@ -21,7 +21,7 @@
#include <QObject>
#include "plugin/plugininterface.h"
#define HACKRFOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.hackrfoutput"
#define HACKRFOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.hackrf"
class PluginAPI;

Wyświetl plik

@ -21,7 +21,7 @@
#include <QObject>
#include "plugin/plugininterface.h"
#define LOCALOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.localoutput"
#define LOCALOUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.localoutput"
class PluginAPI;

Wyświetl plik

@ -26,8 +26,14 @@ QString DeviceUtils::getRegisteredDeviceURI(const QString& xDeviceURI)
{
if (xDeviceURI == "sdrangel.samplesource.bladerf") {
return "sdrangel.samplesource.bladerf1input";
} else if (xDeviceURI == "sdrangel.samplesource.bladerf1output") {
return "sdrangel.samplesink.bladerf1output";
} else if (xDeviceURI == "sdrangel.samplesource.filesource") {
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 {
return xDeviceURI;
}

Wyświetl plik

@ -101,7 +101,7 @@ private:
bool appendPresetChannelKeys(
SWGSDRangel::SWGChannelConfig *channel,
const QJsonObject& channelJson,
const QJsonObject& channelSettngsJson,
WebAPIAdapterInterface::ChannelKeys& channelKeys
);
@ -114,8 +114,15 @@ private:
bool appendPresetDeviceKeys(
SWGSDRangel::SWGDeviceConfig *device,
const QJsonObject& deviceJson,
WebAPIAdapterInterface::DeviceKeys& deviceKeys
const QJsonObject& deviceSettngsJson,
WebAPIAdapterInterface::DeviceKeys& devicelKeys
);
bool getDevice(
const QString& deviceSettingsKey,
SWGSDRangel::SWGDeviceSettings *deviceSettings,
const QJsonObject& deviceSettingsJson,
QStringList& deviceSettingsKeys
);
void appendSettingsSubKeys(
@ -139,6 +146,11 @@ private:
void resetAudioOutputDevice(SWGSDRangel::SWGAudioOutputDevice& audioOutputDevice);
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_ */

Wyświetl plik

@ -164,6 +164,8 @@ int WebAPIAdapterGUI::instanceConfigPutPatch(
if (force) {
webAPIAdapterBase.webapiInitConfig(m_mainWindow.m_settings);
}
// TODO
}
int WebAPIAdapterGUI::instanceDevices(

Wyświetl plik

@ -150,6 +150,23 @@ int WebAPIAdapterSrv::instanceConfigGet(
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 direction,
SWGSDRangel::SWGInstanceDevicesResponse& response,

Wyświetl plik

@ -45,6 +45,13 @@ public:
SWGSDRangel::SWGInstanceConfigResponse& response,
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(
int direction,
SWGSDRangel::SWGInstanceDevicesResponse& response,