1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Web API: /sdrangel/location implementation

This commit is contained in:
f4exb
2017-11-25 04:02:11 +01:00
parent 72615b188e
commit aa8b02a225
6 changed files with 106 additions and 2 deletions
+31 -1
View File
@@ -39,6 +39,7 @@
#include "SWGDeviceListItem.h"
#include "SWGAudioDevices.h"
#include "SWGAudioDevicesSelect.h"
#include "SWGLocationInformation.h"
#include "SWGErrorResponse.h"
#include "webapiadaptergui.h"
@@ -287,7 +288,7 @@ int WebAPIAdapterGUI::instanceAudioGet(
int WebAPIAdapterGUI::instanceAudioPatch(
Swagger::SWGAudioDevicesSelect& response,
Swagger::SWGErrorResponse& error)
Swagger::SWGErrorResponse& error __attribute__((unused)))
{
// response input is the query actually
float inputVolume = response.getInputVolume();
@@ -318,6 +319,35 @@ int WebAPIAdapterGUI::instanceAudioPatch(
return 200;
}
int WebAPIAdapterGUI::instanceLocationGet(
Swagger::SWGLocationInformation& response,
Swagger::SWGErrorResponse& error __attribute__((unused)))
{
response.setLatitude(m_mainWindow.m_settings.getLatitude());
response.setLongitude(m_mainWindow.m_settings.getLongitude());
return 200;
}
int WebAPIAdapterGUI::instanceLocationPut(
Swagger::SWGLocationInformation& response,
Swagger::SWGErrorResponse& error __attribute__((unused)))
{
float latitude = response.getLatitude();
float longitude = response.getLongitude();
latitude = latitude < -90.0 ? -90.0 : latitude > 90.0 ? 90.0 : latitude;
longitude = longitude < -180.0 ? -180.0 : longitude > 180.0 ? 180.0 : longitude;
m_mainWindow.m_settings.setLatitude(latitude);
m_mainWindow.m_settings.setLongitude(longitude);
response.setLatitude(m_mainWindow.m_settings.getLatitude());
response.setLongitude(m_mainWindow.m_settings.getLongitude());
return 200;
}
QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString)
{
if (msgTypeString == "debug") {