1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Feature plugins framework: REST API and server implementationo

This commit is contained in:
f4exb
2020-09-21 03:13:36 +02:00
parent 20ef49ea84
commit 153429cc7f
27 changed files with 2032 additions and 48 deletions
+35 -3
View File
@@ -20,14 +20,16 @@
#include "util/uid.h"
#include "util/message.h"
#include "SWGDeviceState.h"
#include "feature.h"
Feature::Feature(const QString& name, WebAPIAdapterInterface *webAPIAdapterInterface) :
m_name(name),
m_uid(UidCalculator::getNewObjectId()),
m_webAPIAdapterInterface(webAPIAdapterInterface)
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
{
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
}
void Feature::handleInputMessages()
@@ -40,4 +42,34 @@ void Feature::handleInputMessages()
delete message;
}
}
}
}
int Feature::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage) const
{
getFeatureStateStr(*response.getState());
return 200;
}
void Feature::getFeatureStateStr(QString& stateStr) const
{
switch(m_state)
{
case StNotStarted:
stateStr = "notStarted";
break;
case StIdle:
stateStr = "idle";
break;
case StRunning:
stateStr = "running";
break;
case StError:
stateStr = "error";
break;
default:
stateStr = "notStarted";
break;
}
}