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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user