1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-27 07:16:48 -04:00

FeatureWebAPIUtils: Add skyMapFind()

This commit is contained in:
srcejon 2024-03-18 14:16:41 +00:00
parent 3c8f1abaee
commit c4e2bf2a38
2 changed files with 31 additions and 0 deletions

View File

@ -86,6 +86,36 @@ bool FeatureWebAPIUtils::mapSetDateTime(const QDateTime& dateTime, int featureSe
}
}
// Find the specified target on the sky map
bool FeatureWebAPIUtils::skyMapFind(const QString& target, int featureSetIndex, int featureIndex)
{
Feature *feature = FeatureWebAPIUtils::getFeature(featureSetIndex, featureIndex, "sdrangel.feature.skymap");
if (feature != nullptr)
{
QString errorMessage;
QStringList featureActionKeys = {"find"};
SWGSDRangel::SWGFeatureActions query;
SWGSDRangel::SWGSkyMapActions *skyMapActions = new SWGSDRangel::SWGSkyMapActions();
skyMapActions->setFind(new QString(target));
query.setSkyMapActions(skyMapActions);
int httpRC = feature->webapiActionsPost(featureActionKeys, query, errorMessage);
if (httpRC/100 != 2)
{
qWarning() << "FeatureWebAPIUtils::skyMapFind: error " << httpRC << ":" << errorMessage;
return false;
}
return true;
}
else
{
qWarning("FeatureWebAPIUtils::skyMapFind: no Sky Map feature");
return false;
}
}
// Get first feature with the given URI
Feature* FeatureWebAPIUtils::getFeature(int& featureSetIndex, int& featureIndex, const QString& uri)
{

View File

@ -32,6 +32,7 @@ class SDRBASE_API FeatureWebAPIUtils
public:
static bool mapFind(const QString& target, int featureSetIndex=-1, int featureIndex=-1);
static bool mapSetDateTime(const QDateTime& dateTime, int featureSetIndex=-1, int featureIndex=-1);
static bool skyMapFind(const QString& target, int featureSetIndex=-1, int featureIndex=-1);
static Feature *getFeature(int& featureSetIndex, int& featureIndex, const QString& uri);
static bool satelliteAOS(const QString name, const QDateTime aos, const QDateTime los);
static bool satelliteLOS(const QString name);