1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -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
+30
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)
{