summaryrefslogtreecommitdiff
path: root/plugins/feature/rigctlserver
diff options
context:
space:
mode:
authorf4exb <f4exb06@gmail.com>2021-10-22 02:01:33 +0200
committerf4exb <f4exb06@gmail.com>2021-10-22 02:01:33 +0200
commit920fa820221692f6483e351b8d378233389dd2e1 (patch)
tree72e3cdd51e3890f130716e7a70b2ded73aa38db7 /plugins/feature/rigctlserver
parent9f42957585759a4ecf9de834b75a1fb619223dc1 (diff)
Implemented run action API in relevant feature plugins
Diffstat (limited to 'plugins/feature/rigctlserver')
-rw-r--r--plugins/feature/rigctlserver/rigctlserver.cpp29
-rw-r--r--plugins/feature/rigctlserver/rigctlserver.h5
2 files changed, 34 insertions, 0 deletions
diff --git a/plugins/feature/rigctlserver/rigctlserver.cpp b/plugins/feature/rigctlserver/rigctlserver.cpp
index 3214ebb24..d38b3cee5 100644
--- a/plugins/feature/rigctlserver/rigctlserver.cpp
+++ b/plugins/feature/rigctlserver/rigctlserver.cpp
@@ -257,6 +257,35 @@ int RigCtlServer::webapiSettingsPutPatch(
return 200;
}
+int RigCtlServer::webapiActionsPost(
+ const QStringList& featureActionsKeys,
+ SWGSDRangel::SWGFeatureActions& query,
+ QString& errorMessage)
+{
+ SWGSDRangel::SWGRigCtlServerActions *swgRigCtlServerActions = query.getRigCtlServerActions();
+
+ if (swgRigCtlServerActions)
+ {
+ if (featureActionsKeys.contains("run"))
+ {
+ bool featureRun = swgRigCtlServerActions->getRun() != 0;
+ MsgStartStop *msg = MsgStartStop::create(featureRun);
+ getInputMessageQueue()->push(msg);
+ return 202;
+ }
+ else
+ {
+ errorMessage = "Unknown action";
+ return 400;
+ }
+ }
+ else
+ {
+ errorMessage = "Missing RigCtlServerActions in query";
+ return 400;
+ }
+}
+
void RigCtlServer::webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response,
const RigCtlServerSettings& settings)
diff --git a/plugins/feature/rigctlserver/rigctlserver.h b/plugins/feature/rigctlserver/rigctlserver.h
index 335846d3f..f802fb4b3 100644
--- a/plugins/feature/rigctlserver/rigctlserver.h
+++ b/plugins/feature/rigctlserver/rigctlserver.h
@@ -106,6 +106,11 @@ public:
SWGSDRangel::SWGFeatureSettings& response,
QString& errorMessage);
+ virtual int webapiActionsPost(
+ const QStringList& featureActionsKeys,
+ SWGSDRangel::SWGFeatureActions& query,
+ QString& errorMessage);
+
static void webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response,
const RigCtlServerSettings& settings);