mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
FeatureWebAPIUtils: Add skyMapFind()
This commit is contained in:
parent
3c8f1abaee
commit
c4e2bf2a38
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user