mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-03-18 14:09:37 -04:00
REST API: updates in MIMO classes (2)
This commit is contained in:
parent
99eee92d08
commit
a08b0ec31a
@ -1164,44 +1164,61 @@ void BladeRF2MIMO::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
|
||||
response.getBladeRf2MimoSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||
}
|
||||
|
||||
response.getBladeRf2OutputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
response.getBladeRf2MimoSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getBladeRf2OutputSettings()->getReverseApiAddress()) {
|
||||
*response.getBladeRf2OutputSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
||||
if (response.getBladeRf2MimoSettings()->getReverseApiAddress()) {
|
||||
*response.getBladeRf2MimoSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
||||
} else {
|
||||
response.getBladeRf2OutputSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
||||
response.getBladeRf2MimoSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
||||
}
|
||||
|
||||
response.getBladeRf2OutputSettings()->setReverseApiPort(settings.m_reverseAPIPort);
|
||||
response.getBladeRf2OutputSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||
response.getBladeRf2MimoSettings()->setReverseApiPort(settings.m_reverseAPIPort);
|
||||
response.getBladeRf2MimoSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||
}
|
||||
|
||||
int BladeRF2MIMO::webapiRunGet(
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
return 200;
|
||||
if ((subsystemIndex == 0) || (subsystemIndex == 1))
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState(), subsystemIndex);
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = QString("Subsystem invalid: must be 0 (Rx) or 1 (Tx)");
|
||||
return 404;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int BladeRF2MIMO::webapiRun(
|
||||
bool run,
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
MsgStartStop *message = MsgStartStop::create(run, true); // TODO: Tx support
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
if ((subsystemIndex == 0) || (subsystemIndex == 1))
|
||||
{
|
||||
MsgStartStop *msgToGUI = MsgStartStop::create(run, true); // TODO: Tx support
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState(), subsystemIndex);
|
||||
MsgStartStop *message = MsgStartStop::create(run, subsystemIndex == 0);
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
return 200;
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgStartStop *msgToGUI = MsgStartStop::create(run, subsystemIndex == 0);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = QString("Subsystem invalid: must be 0 (Rx) or 1 (Tx)");
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
void BladeRF2MIMO::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const BladeRF2MIMOSettings& settings, bool force)
|
||||
|
||||
@ -185,11 +185,13 @@ public:
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRun(
|
||||
bool run,
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
|
||||
@ -302,29 +302,49 @@ bool TestMOSync::applySettings(const TestMOSyncSettings& settings, bool force)
|
||||
}
|
||||
|
||||
int TestMOSync::webapiRunGet(
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
if (subsystemIndex == 1)
|
||||
{
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState(), 1); // Tx only
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = QString("Subsystem index invalid: expect 1 (Tx) only");
|
||||
return 404;
|
||||
}
|
||||
|
||||
response.setState(new QString("N/A"));
|
||||
return 200;
|
||||
}
|
||||
|
||||
int TestMOSync::webapiRun(
|
||||
bool run,
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
MsgStartStop *message = MsgStartStop::create(run, true); // TODO: Tx support
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
if (subsystemIndex == 1)
|
||||
{
|
||||
MsgStartStop *msgToGUI = MsgStartStop::create(run, true); // TODO: Tx support
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
|
||||
MsgStartStop *message = MsgStartStop::create(run, true); // Tx only
|
||||
m_inputMessageQueue.push(message);
|
||||
|
||||
return 200;
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgStartStop *msgToGUI = MsgStartStop::create(run, true); // Tx only
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = QString("Subsystem index invalid: expect 1 (Tx) only");
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,11 +112,13 @@ public:
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
virtual int webapiRunGet(
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiRun(
|
||||
bool run,
|
||||
int subsystemIndex,
|
||||
SWGSDRangel::SWGDeviceState& response,
|
||||
QString& errorMessage);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user