mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-19 20:17:25 -05:00
Merge pull request #97 from DSheirer/#78_p25_patch_group_management
#78 p25 patch group management
This commit is contained in:
@@ -9,9 +9,12 @@
|
|||||||
- Updated alias list management of alias id values and wildcards. Weighting is now
|
- Updated alias list management of alias id values and wildcards. Weighting is now
|
||||||
applied to each wildcard so that they can be ordered from most specific to least
|
applied to each wildcard so that they can be ordered from most specific to least
|
||||||
specific for lookup value matching purposes.
|
specific for lookup value matching purposes.
|
||||||
- Added handling for Motorola-specific P25 patch messages
|
- Added handling for Motorola-specific P25 patch messages and auto-generation of
|
||||||
|
patch group aliases that roll-up aliases from each patched talkgroup to support
|
||||||
|
audio recording and streaming of patch calls according to the identifiers and
|
||||||
|
actions defined for each of the patched talkgroups.
|
||||||
- Updated airspy controller for airspy-mini specific sample rate handling.
|
- Updated airspy controller for airspy-mini specific sample rate handling.
|
||||||
- New remez filter designer tool and internal usage
|
- New developer remez filter designer tool and internal usage
|
||||||
|
|
||||||
0.2.0 20160329
|
0.2.0 20160329
|
||||||
- Major overhaul of underlying processing chain and extensive updates to all
|
- Major overhaul of underlying processing chain and extensive updates to all
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Alias
|
|||||||
public Alias()
|
public Alias()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias( String name )
|
public Alias( String name )
|
||||||
{
|
{
|
||||||
mName = name;
|
mName = name;
|
||||||
|
|||||||
214
src/alias/PatchGroupAlias.java
Normal file
214
src/alias/PatchGroupAlias.java
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 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 alias;
|
||||||
|
|
||||||
|
import alias.action.AliasAction;
|
||||||
|
import alias.id.AliasID;
|
||||||
|
import alias.id.AliasIDType;
|
||||||
|
import alias.id.broadcast.BroadcastChannel;
|
||||||
|
import alias.id.priority.Priority;
|
||||||
|
import alias.id.talkgroup.TalkgroupID;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PatchGroupAlias extends Alias
|
||||||
|
{
|
||||||
|
private List<Alias> mPatchedAliases = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch group alias is a single alias for a group of aliases that are temporarily patched together. This will
|
||||||
|
* normally be used for patched talkgroups, but could be used with any type of alias identifiers that can be
|
||||||
|
* temporarily joined to form a patch group.
|
||||||
|
*
|
||||||
|
* Alias properties such as recordable, streamable and call priority are an aggregation from the set of patched
|
||||||
|
* aliases contained in this patch group alias and where applicable, return the highest value/priority from the
|
||||||
|
* group of patched aliases.
|
||||||
|
*/
|
||||||
|
public PatchGroupAlias()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of patched aliases contained in this patch group
|
||||||
|
*/
|
||||||
|
public List<Alias> getPatchedAliases()
|
||||||
|
{
|
||||||
|
return mPatchedAliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes/clears all patched aliases from this patch alias group
|
||||||
|
*/
|
||||||
|
public void clearPatchedAliases()
|
||||||
|
{
|
||||||
|
mPatchedAliases.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the patched alias to this patch alias group
|
||||||
|
*/
|
||||||
|
public void addPatchedAlias(Alias alias)
|
||||||
|
{
|
||||||
|
mPatchedAliases.add(alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the patched alias from this patch alias group
|
||||||
|
*/
|
||||||
|
public void removePatchedAlias(Alias alias)
|
||||||
|
{
|
||||||
|
mPatchedAliases.remove(alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
if(getId().size() > 0)
|
||||||
|
{
|
||||||
|
for(AliasID id: getId())
|
||||||
|
{
|
||||||
|
if(id.getType() == AliasIDType.TALKGROUP)
|
||||||
|
{
|
||||||
|
return "PATCH:" + ((TalkgroupID)id).getTalkgroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "PATCH";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AliasAction> getAction()
|
||||||
|
{
|
||||||
|
List<AliasAction> aliasActions = new ArrayList<>();
|
||||||
|
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
aliasActions.addAll(alias.getAction());
|
||||||
|
}
|
||||||
|
|
||||||
|
return aliasActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasActions()
|
||||||
|
{
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
if(alias.hasActions())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCallPriority()
|
||||||
|
{
|
||||||
|
int highestPriority = Priority.DEFAULT_PRIORITY;
|
||||||
|
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
if(alias.getCallPriority() < highestPriority)
|
||||||
|
{
|
||||||
|
highestPriority = alias.getCallPriority();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return highestPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCallPriority()
|
||||||
|
{
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
if(alias.hasCallPriority())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRecordable()
|
||||||
|
{
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
if(alias.isRecordable())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStreamable()
|
||||||
|
{
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
if(alias.isStreamable())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BroadcastChannel> getBroadcastChannels()
|
||||||
|
{
|
||||||
|
List<BroadcastChannel> broadcastChannels = new ArrayList<>();
|
||||||
|
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
for(BroadcastChannel broadcastChannel: alias.getBroadcastChannels())
|
||||||
|
{
|
||||||
|
if(!broadcastChannels.contains(broadcastChannel))
|
||||||
|
{
|
||||||
|
broadcastChannels.add(broadcastChannel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return broadcastChannels;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasBroadcastChannel(String channel)
|
||||||
|
{
|
||||||
|
for(Alias alias: mPatchedAliases)
|
||||||
|
{
|
||||||
|
if(alias.hasBroadcastChannel(channel))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,83 +1,89 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* SDR Trunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package alias.id.talkgroup;
|
package alias.id.talkgroup;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
import alias.id.AliasID;
|
import alias.id.AliasID;
|
||||||
import alias.id.AliasIDType;
|
import alias.id.AliasIDType;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
|
||||||
|
|
||||||
public class TalkgroupID extends AliasID
|
public class TalkgroupID extends AliasID
|
||||||
{
|
{
|
||||||
private String mTalkgroup;
|
private String mTalkgroup;
|
||||||
|
|
||||||
public TalkgroupID()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
public TalkgroupID()
|
||||||
public String getTalkgroup()
|
|
||||||
{
|
|
||||||
return mTalkgroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTalkgroup( String talkgroup )
|
|
||||||
{
|
|
||||||
mTalkgroup = talkgroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid()
|
|
||||||
{
|
|
||||||
return mTalkgroup != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( "Talkgroup: " + mTalkgroup );
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches( AliasID id )
|
|
||||||
{
|
{
|
||||||
boolean retVal = false;
|
//No arg JAXB constructor
|
||||||
|
|
||||||
if( id instanceof TalkgroupID )
|
|
||||||
{
|
|
||||||
TalkgroupID tgid = (TalkgroupID)id;
|
|
||||||
|
|
||||||
//Create a pattern - replace * wildcards with regex single-char wildcard
|
|
||||||
String pattern = mTalkgroup.replace( "*", ".?" );
|
|
||||||
|
|
||||||
retVal = tgid.getTalkgroup().matches( pattern );
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public TalkgroupID(String talkgroup)
|
||||||
|
{
|
||||||
|
mTalkgroup = talkgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute
|
||||||
|
public String getTalkgroup()
|
||||||
|
{
|
||||||
|
return mTalkgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTalkgroup(String talkgroup)
|
||||||
|
{
|
||||||
|
mTalkgroup = talkgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid()
|
||||||
|
{
|
||||||
|
return mTalkgroup != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.append("Talkgroup: " + mTalkgroup);
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(AliasID id)
|
||||||
|
{
|
||||||
|
boolean retVal = false;
|
||||||
|
|
||||||
|
if(id instanceof TalkgroupID)
|
||||||
|
{
|
||||||
|
TalkgroupID tgid = (TalkgroupID) id;
|
||||||
|
|
||||||
|
//Create a pattern - replace * wildcards with regex single-char wildcard
|
||||||
|
String pattern = mTalkgroup.replace("*", ".?");
|
||||||
|
|
||||||
|
retVal = tgid.getTalkgroup().matches(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public AliasIDType getType()
|
public AliasIDType getType()
|
||||||
{
|
{
|
||||||
return AliasIDType.TALKGROUP;
|
return AliasIDType.TALKGROUP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,10 @@ import module.decode.p25.reference.DataUnitID;
|
|||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import bits.BinaryMessage;
|
import bits.BinaryMessage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class PatchGroup extends MotorolaTSBKMessage
|
public abstract class PatchGroup extends MotorolaTSBKMessage
|
||||||
{
|
{
|
||||||
public static final int[] PATCH_GROUP_ADDRESS = { 80,81,82,83,84,85,86,87,
|
public static final int[] PATCH_GROUP_ADDRESS = { 80,81,82,83,84,85,86,87,
|
||||||
@@ -15,6 +19,8 @@ public abstract class PatchGroup extends MotorolaTSBKMessage
|
|||||||
public static final int[] GROUP_ADDRESS_3 = { 128,129,130,131,132,133,134,
|
public static final int[] GROUP_ADDRESS_3 = { 128,129,130,131,132,133,134,
|
||||||
135,136,137,138,139,140,141,142,143 };
|
135,136,137,138,139,140,141,142,143 };
|
||||||
|
|
||||||
|
private List<String> mPatchedTalkgroups;
|
||||||
|
|
||||||
public PatchGroup( BinaryMessage message, DataUnitID duid,
|
public PatchGroup( BinaryMessage message, DataUnitID duid,
|
||||||
AliasList aliasList )
|
AliasList aliasList )
|
||||||
{
|
{
|
||||||
@@ -28,15 +34,11 @@ public abstract class PatchGroup extends MotorolaTSBKMessage
|
|||||||
|
|
||||||
sb.append( getMessageStub() );
|
sb.append( getMessageStub() );
|
||||||
|
|
||||||
sb.append( " PATCH GROUP:" );
|
sb.append( " " );
|
||||||
sb.append( getPatchGroupAddress() );
|
sb.append( getPatchGroupAddress() );
|
||||||
sb.append( " GRP1:" );
|
sb.append(" ");
|
||||||
sb.append( getGroupAddress1() );
|
sb.append(getPatchedTalkgroups());
|
||||||
sb.append( " GRP2:" );
|
|
||||||
sb.append( getGroupAddress2() );
|
|
||||||
sb.append( " GRP3:" );
|
|
||||||
sb.append( getGroupAddress3() );
|
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +46,35 @@ public abstract class PatchGroup extends MotorolaTSBKMessage
|
|||||||
{
|
{
|
||||||
return mMessage.getHex( PATCH_GROUP_ADDRESS, 4 );
|
return mMessage.getHex( PATCH_GROUP_ADDRESS, 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of de-deplicated patched talkgroups contained in this message
|
||||||
|
*/
|
||||||
|
public List<String> getPatchedTalkgroups()
|
||||||
|
{
|
||||||
|
if(mPatchedTalkgroups == null)
|
||||||
|
{
|
||||||
|
mPatchedTalkgroups = new ArrayList<>();
|
||||||
|
|
||||||
|
mPatchedTalkgroups.add(getGroupAddress1());
|
||||||
|
|
||||||
|
String group2 = getGroupAddress2();
|
||||||
|
|
||||||
|
if(!mPatchedTalkgroups.contains(group2))
|
||||||
|
{
|
||||||
|
mPatchedTalkgroups.add(group2);
|
||||||
|
}
|
||||||
|
|
||||||
|
String group3 = getGroupAddress3();
|
||||||
|
|
||||||
|
if(!mPatchedTalkgroups.contains(group3))
|
||||||
|
{
|
||||||
|
mPatchedTalkgroups.add(group3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mPatchedTalkgroups;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGroupAddress1()
|
public String getGroupAddress1()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user