mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
61 Rotating Control Channel Support - P25 Decoder (#475)
* Initial work on add support for rotating control channels. * Creates multiple frequency editor control. * Updates channel source editor to allow user to select multi-frequency configuration and add multiple frequencies. * Adds full support for rotating control channels to the P25 channelizer. Users define multiple frequencies in the channel source configuration. The decoder monitors the state of the channel for a CONTROL state. If the state does not stay in the CONTROL state for a user-specified delay value, then the decoder rotates to the next frequency in the list. This behavior continues until the decoder state once again changes to CONTROL. This is NOT a 'scanner' feature.
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2019 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/>
|
||||
* *****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.preference.source;
|
||||
|
||||
import io.github.dsheirer.preference.Preference;
|
||||
import io.github.dsheirer.preference.PreferenceType;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Preferences for multiple frequency tuner channel sources.
|
||||
*/
|
||||
public class ChannelMultiFrequencyPreference extends Preference
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(ChannelMultiFrequencyPreference.class);
|
||||
private Preferences mPreferences = Preferences.userNodeForPackage(ChannelMultiFrequencyPreference.class);
|
||||
private static final String PREFERENCE_KEY_ROTATION_DELAY = "rotation.delay";
|
||||
private static final long DEFAULT_ROTATION_DELAY = 5000; //5 seconds
|
||||
private Long mRotationDelay = DEFAULT_ROTATION_DELAY;
|
||||
|
||||
/**
|
||||
* Constructs a tuner preference with the update listener
|
||||
*
|
||||
* @param updateListener
|
||||
*/
|
||||
public ChannelMultiFrequencyPreference(Listener<PreferenceType> updateListener)
|
||||
{
|
||||
super(updateListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreferenceType getPreferenceType()
|
||||
{
|
||||
return PreferenceType.MULTI_FREQUENCY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotation delay value in milliseconds. This value is used for channel configurations where there source
|
||||
* defines multiple frequencies for a system that employs rotating control channels.
|
||||
*/
|
||||
public long getRotationDelay()
|
||||
{
|
||||
if(mRotationDelay == null)
|
||||
{
|
||||
mRotationDelay = mPreferences.getLong(PREFERENCE_KEY_ROTATION_DELAY, DEFAULT_ROTATION_DELAY);
|
||||
}
|
||||
|
||||
return mRotationDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rotation delay value in milliseconds.
|
||||
* @param rotationDelay in milliseconds (1,000 - 60,000)
|
||||
*/
|
||||
public void setRotationDelay(long rotationDelay)
|
||||
{
|
||||
if(1000 <= rotationDelay && rotationDelay <= 60000)
|
||||
{
|
||||
mRotationDelay = rotationDelay;
|
||||
mPreferences.putLong(PREFERENCE_KEY_ROTATION_DELAY, mRotationDelay);
|
||||
notifyPreferenceUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the rotation delay and removes it from the preferences store, so that it can be recreated with
|
||||
* a default value.
|
||||
*/
|
||||
public void resetRotationDelay()
|
||||
{
|
||||
mPreferences.remove(PREFERENCE_KEY_ROTATION_DELAY);
|
||||
mRotationDelay = null;
|
||||
notifyPreferenceUpdated();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2019 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/>
|
||||
* *****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.preference.source;
|
||||
|
||||
/**
|
||||
* Channelizer Type - identifies the type of channelizer that the tuner will use to provide DDR channels
|
||||
*/
|
||||
public enum ChannelizerType
|
||||
{
|
||||
POLYPHASE("Polyphase"),
|
||||
HETERODYNE(" Heterodyne");
|
||||
|
||||
private String mLabel;
|
||||
|
||||
ChannelizerType(String label)
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2019 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/>
|
||||
* *****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.preference.source;
|
||||
|
||||
import io.github.dsheirer.preference.Preference;
|
||||
import io.github.dsheirer.preference.PreferenceType;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Tuner preferences
|
||||
*/
|
||||
public class TunerPreference extends Preference
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(TunerPreference.class);
|
||||
private Preferences mPreferences = Preferences.userNodeForPackage(TunerPreference.class);
|
||||
private static final String PREFERENCE_KEY_CHANNELIZER_TYPE = "channelizer.type";
|
||||
|
||||
private ChannelizerType mChannelizerType;
|
||||
|
||||
/**
|
||||
* Constructs a tuner preference with the update listener
|
||||
*
|
||||
* @param updateListener
|
||||
*/
|
||||
public TunerPreference(Listener<PreferenceType> updateListener)
|
||||
{
|
||||
super(updateListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreferenceType getPreferenceType()
|
||||
{
|
||||
return PreferenceType.TUNER;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Channelizer type used by the tuners
|
||||
*/
|
||||
public ChannelizerType getChannelizerType()
|
||||
{
|
||||
if(mChannelizerType == null)
|
||||
{
|
||||
String type = mPreferences.get(PREFERENCE_KEY_CHANNELIZER_TYPE, ChannelizerType.POLYPHASE.name());
|
||||
|
||||
if(type != null)
|
||||
{
|
||||
if(type.equalsIgnoreCase(ChannelizerType.POLYPHASE.name()))
|
||||
{
|
||||
mChannelizerType = ChannelizerType.POLYPHASE;
|
||||
}
|
||||
else if(type.equalsIgnoreCase(ChannelizerType.HETERODYNE.name()))
|
||||
{
|
||||
mChannelizerType = ChannelizerType.HETERODYNE;
|
||||
}
|
||||
}
|
||||
|
||||
if(type == null)
|
||||
{
|
||||
mChannelizerType = ChannelizerType.POLYPHASE;
|
||||
}
|
||||
}
|
||||
|
||||
return mChannelizerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the channelizer type use by tuners
|
||||
*/
|
||||
public void setChannelizerType(ChannelizerType type)
|
||||
{
|
||||
mChannelizerType = type;
|
||||
mPreferences.put(PREFERENCE_KEY_CHANNELIZER_TYPE, mChannelizerType.name());
|
||||
notifyPreferenceUpdated();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user