mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 09:07:27 -05:00
-Separates USB timeout event processing to a dedicated thread -Updates USB transfer buffer processor to better detect errors and auto-restart on error (max 3 times) -Updates Tuner to add an error state and SourceManager to not select tuners with an error state -Updates ChannelProcessingManager to auto-shutdown channels sourced from tuners set with error state -Improves logging of USB related errors.
This commit is contained in:
@@ -1,18 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* sdr-trunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
/*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
* * ******************************************************************************
|
||||
* * Copyright (C) 2014-2020 Dennis Sheirer
|
||||
* *
|
||||
* * This program is free software: you can redistribute it and/or modify
|
||||
* * it under the terms of the GNU General Public License as published by
|
||||
* * the Free Software Foundation, either version 3 of the License, or
|
||||
* * (at your option) any later version.
|
||||
* *
|
||||
* * This program is distributed in the hope that it will be useful,
|
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* * GNU General Public License for more details.
|
||||
* *
|
||||
* * You should have received a copy of the GNU General Public License
|
||||
* * along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* * *****************************************************************************
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
*/
|
||||
package io.github.dsheirer.source.tuner.manager;
|
||||
|
||||
import io.github.dsheirer.sample.Broadcaster;
|
||||
@@ -56,6 +62,13 @@ public abstract class ChannelSourceManager implements ISourceEventProcessor
|
||||
*/
|
||||
public abstract TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification);
|
||||
|
||||
/**
|
||||
* Signals that the complex buffer provider has an error and can no long provider buffers. The subclass should
|
||||
* implement procedures to gracefully shutdown any tuner channel sources that have been provisioned.
|
||||
* @param errorMessage describing the error state
|
||||
*/
|
||||
public abstract void setErrorMessage(String errorMessage);
|
||||
|
||||
/**
|
||||
* Adds a listener to receive source events
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* sdr-trunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
/*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
* * ******************************************************************************
|
||||
* * Copyright (C) 2014-2020 Dennis Sheirer
|
||||
* *
|
||||
* * This program is free software: you can redistribute it and/or modify
|
||||
* * it under the terms of the GNU General Public License as published by
|
||||
* * the Free Software Foundation, either version 3 of the License, or
|
||||
* * (at your option) any later version.
|
||||
* *
|
||||
* * This program is distributed in the hope that it will be useful,
|
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* * GNU General Public License for more details.
|
||||
* *
|
||||
* * You should have received a copy of the GNU General Public License
|
||||
* * along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* * *****************************************************************************
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
*/
|
||||
package io.github.dsheirer.source.tuner.manager;
|
||||
|
||||
import io.github.dsheirer.dsp.filter.design.FilterDesignException;
|
||||
@@ -103,6 +109,15 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorMessage(String errorMessage)
|
||||
{
|
||||
for(TunerChannelSource tunerChannelSource: mChannelSources)
|
||||
{
|
||||
tunerChannelSource.setError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates a new center frequency and updates the tuner center frequency
|
||||
*/
|
||||
|
||||
@@ -33,17 +33,21 @@ import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* Pass through source manager for relatively small bandwidth complex streams that don't warrant the overhead of
|
||||
* a polyphase or heterodyne channelizer.
|
||||
*/
|
||||
public class PassThroughSourceManager extends ChannelSourceManager
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(PassThroughSourceManager.class);
|
||||
private TunerController mTunerController;
|
||||
private SortedSet<TunerChannel> mTunerChannels = new TreeSet<>();
|
||||
private List<TunerChannelSource> mTunerChannelSources = new CopyOnWriteArrayList<>();
|
||||
|
||||
public PassThroughSourceManager(TunerController tunerController)
|
||||
{
|
||||
@@ -69,6 +73,7 @@ public class PassThroughSourceManager extends ChannelSourceManager
|
||||
mTunerController, tunerChannel);
|
||||
|
||||
mTunerChannels.add(tunerChannel);
|
||||
mTunerChannelSources.add(channelSource);
|
||||
|
||||
return channelSource;
|
||||
}
|
||||
@@ -91,12 +96,22 @@ public class PassThroughSourceManager extends ChannelSourceManager
|
||||
PassThroughChannelSource source = (PassThroughChannelSource)event.getSource();
|
||||
mTunerController.removeBufferListener(source);
|
||||
mTunerChannels.remove(source.getTunerChannel());
|
||||
mTunerChannelSources.remove(source);
|
||||
broadcast(SourceEvent.channelCountChange(mTunerChannels.size()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorMessage(String errorMessage)
|
||||
{
|
||||
for(TunerChannelSource tunerChannelSource: mTunerChannelSources)
|
||||
{
|
||||
tunerChannelSource.setError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public class SourceEventProxy implements Listener<SourceEvent>
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* sdr-trunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
/*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
* * ******************************************************************************
|
||||
* * Copyright (C) 2014-2020 Dennis Sheirer
|
||||
* *
|
||||
* * This program is free software: you can redistribute it and/or modify
|
||||
* * it under the terms of the GNU General Public License as published by
|
||||
* * the Free Software Foundation, either version 3 of the License, or
|
||||
* * (at your option) any later version.
|
||||
* *
|
||||
* * This program is distributed in the hope that it will be useful,
|
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* * GNU General Public License for more details.
|
||||
* *
|
||||
* * You should have received a copy of the GNU General Public License
|
||||
* * along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* * *****************************************************************************
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
*/
|
||||
package io.github.dsheirer.source.tuner.manager;
|
||||
|
||||
import io.github.dsheirer.dsp.filter.channelizer.PolyphaseChannelManager;
|
||||
@@ -259,6 +265,16 @@ public class PolyphaseChannelSourceManager extends ChannelSourceManager
|
||||
throw new IllegalArgumentException("Can't calculate valid center frequency for the channel set");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorMessage(String errorMessage)
|
||||
{
|
||||
if(mPolyphaseChannelManager != null)
|
||||
{
|
||||
mPolyphaseChannelManager.setErrorMessage(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private long getChannelSetBandwidth(SortedSet<TunerChannel> channels)
|
||||
{
|
||||
return channels.last().getMaxFrequency() - channels.first().getMinFrequency();
|
||||
|
||||
Reference in New Issue
Block a user