mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04: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; | ||||
| 
 | ||||
| #define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1output" | ||||
| #define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesink.bladerf1output" | ||||
| 
 | ||||
| class Bladerf1OutputPlugin : public QObject, public PluginInterface { | ||||
| 	Q_OBJECT | ||||
|  | ||||
| @ -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; | ||||
| 
 | ||||
|  | ||||
| @ -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; | ||||
| 
 | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -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_ */ | ||||
|  | ||||
| @ -164,6 +164,8 @@ int WebAPIAdapterGUI::instanceConfigPutPatch( | ||||
|     if (force) { | ||||
|         webAPIAdapterBase.webapiInitConfig(m_mainWindow.m_settings); | ||||
|     } | ||||
| 
 | ||||
|     // TODO
 | ||||
| } | ||||
| 
 | ||||
| int WebAPIAdapterGUI::instanceDevices( | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user