mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
Web API: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex} DELETE implemented in GUI also
This commit is contained in:
@@ -987,6 +987,73 @@ int WebAPIAdapterGUI::devicesetChannelPost(
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::devicesetChannelDelete(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
SWGSDRangel::SWGSuccessResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
|
||||
{
|
||||
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
|
||||
|
||||
if (deviceSet->m_deviceSourceEngine) // Rx
|
||||
{
|
||||
if (channelIndex < deviceSet->getNumberOfRxChannels())
|
||||
{
|
||||
MainWindow::MsgDeleteChannel *msg = MainWindow::MsgDeleteChannel::create(deviceSetIndex, channelIndex, false);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel at index %1. There are %2 Rx channels")
|
||||
.arg(channelIndex)
|
||||
.arg(channelIndex < deviceSet->getNumberOfRxChannels());
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkEngine) // Tx
|
||||
{
|
||||
if (channelIndex < deviceSet->getNumberOfTxChannels())
|
||||
{
|
||||
MainWindow::MsgDeleteChannel *msg = MainWindow::MsgDeleteChannel::create(deviceSetIndex, channelIndex, true);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel at index %1. There are %2 Tx channels")
|
||||
.arg(channelIndex)
|
||||
.arg(channelIndex < deviceSet->getNumberOfRxChannels());
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
|
||||
Reference in New Issue
Block a user