mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Server: web API: implemented /sdrangel/location
This commit is contained in:
parent
4884a0d13c
commit
8aeb28f637
@ -27,6 +27,7 @@
|
|||||||
#include "SWGLoggingInfo.h"
|
#include "SWGLoggingInfo.h"
|
||||||
#include "SWGAudioDevices.h"
|
#include "SWGAudioDevices.h"
|
||||||
#include "SWGAudioDevicesSelect.h"
|
#include "SWGAudioDevicesSelect.h"
|
||||||
|
#include "SWGLocationInformation.h"
|
||||||
#include "SWGErrorResponse.h"
|
#include "SWGErrorResponse.h"
|
||||||
|
|
||||||
#include "maincore.h"
|
#include "maincore.h"
|
||||||
@ -261,6 +262,35 @@ int WebAPIAdapterSrv::instanceAudioPatch(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WebAPIAdapterSrv::instanceLocationGet(
|
||||||
|
SWGSDRangel::SWGLocationInformation& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
|
||||||
|
{
|
||||||
|
response.setLatitude(m_mainCore.m_settings.getLatitude());
|
||||||
|
response.setLongitude(m_mainCore.m_settings.getLongitude());
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WebAPIAdapterSrv::instanceLocationPut(
|
||||||
|
SWGSDRangel::SWGLocationInformation& response,
|
||||||
|
SWGSDRangel::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_mainCore.m_settings.setLatitude(latitude);
|
||||||
|
m_mainCore.m_settings.setLongitude(longitude);
|
||||||
|
|
||||||
|
response.setLatitude(m_mainCore.m_settings.getLatitude());
|
||||||
|
response.setLongitude(m_mainCore.m_settings.getLongitude());
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
|
void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
|
||||||
{
|
{
|
||||||
deviceSetList->init();
|
deviceSetList->init();
|
||||||
|
@ -66,6 +66,14 @@ public:
|
|||||||
SWGSDRangel::SWGAudioDevicesSelect& response,
|
SWGSDRangel::SWGAudioDevicesSelect& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error);
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
|
virtual int instanceLocationGet(
|
||||||
|
SWGSDRangel::SWGLocationInformation& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
|
virtual int instanceLocationPut(
|
||||||
|
SWGSDRangel::SWGLocationInformation& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainCore& m_mainCore;
|
MainCore& m_mainCore;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user