mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Merge pull request #116 from DSheirer/#115_patch_group_alias_no_wildcard_alias
#115 patch group alias - resolves issue where wildcard aliases were b…
This commit is contained in:
@@ -579,8 +579,12 @@ public class AliasList implements Listener<AliasEvent>
|
||||
|
||||
/**
|
||||
* Lookup alias by talkgroup
|
||||
*
|
||||
* @param tgid to use when searching for an alias
|
||||
* @param includeWildcards true if you want to additionally search for a matching alias that contains wildcard(s)
|
||||
* when there is not a direct match to the TGID.
|
||||
*/
|
||||
public Alias getTalkgroupAlias(String tgid)
|
||||
public Alias getTalkgroupAlias(String tgid, boolean includeWildcards)
|
||||
{
|
||||
Alias alias = null;
|
||||
|
||||
@@ -588,7 +592,7 @@ public class AliasList implements Listener<AliasEvent>
|
||||
{
|
||||
alias = mTalkgroup.get(tgid);
|
||||
|
||||
if (alias == null)
|
||||
if (alias == null && includeWildcards)
|
||||
{
|
||||
String wildcard = getWildcardMatch(tgid, mTalkgroupWildcards);
|
||||
|
||||
@@ -603,8 +607,16 @@ public class AliasList implements Listener<AliasEvent>
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias list name
|
||||
* Lookup alias by talkgroup. Defaults to matching to wildcard talkgroups.
|
||||
*/
|
||||
public Alias getTalkgroupAlias(String tgid)
|
||||
{
|
||||
return getTalkgroupAlias(tgid, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias list name
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return mName;
|
||||
|
||||
@@ -133,19 +133,16 @@ public class PatchGroupAlias extends Alias
|
||||
}
|
||||
else
|
||||
{
|
||||
if(getId().size() > 0)
|
||||
for(AliasID id: getId())
|
||||
{
|
||||
for(AliasID id: getId())
|
||||
if(id.getType() == AliasIDType.TALKGROUP)
|
||||
{
|
||||
if(id.getType() == AliasIDType.TALKGROUP)
|
||||
{
|
||||
return "PATCH:" + ((TalkgroupID)id).getTalkgroup();
|
||||
}
|
||||
return "PATCH:" + ((TalkgroupID)id).getTalkgroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "PATCH";
|
||||
return "PATCH:****";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,16 +150,22 @@ public class PatchGroupAlias extends Alias
|
||||
{
|
||||
List<AliasAction> aliasActions = new ArrayList<>();
|
||||
|
||||
for(Alias alias: mPatchedAliases)
|
||||
{
|
||||
aliasActions.addAll(alias.getAction());
|
||||
}
|
||||
|
||||
if(hasPatchGroupAlias())
|
||||
{
|
||||
aliasActions.addAll(getPatchGroupAlias().getAction());
|
||||
}
|
||||
|
||||
for(Alias alias: mPatchedAliases)
|
||||
{
|
||||
for(AliasAction action: alias.getAction())
|
||||
{
|
||||
if(!aliasActions.contains(action))
|
||||
{
|
||||
aliasActions.add(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aliasActions;
|
||||
}
|
||||
|
||||
@@ -187,7 +190,7 @@ public class PatchGroupAlias extends Alias
|
||||
|
||||
for(Alias alias: mPatchedAliases)
|
||||
{
|
||||
if(alias.getCallPriority() < highestPriority)
|
||||
if(alias.hasCallPriority() && alias.getCallPriority() < highestPriority)
|
||||
{
|
||||
highestPriority = alias.getCallPriority();
|
||||
}
|
||||
|
||||
@@ -2924,8 +2924,8 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
PatchGroupAlias patchGroupAlias = null;
|
||||
|
||||
//Check for an existing alias for the patch talkgroup
|
||||
Alias existingAlias = getAliasList().getTalkgroupAlias(patchGroupID);
|
||||
//Check for an existing alias for the patch talkgroup - do not include wildcard aliases
|
||||
Alias existingAlias = getAliasList().getTalkgroupAlias(patchGroupID, false);
|
||||
|
||||
if(existingAlias instanceof PatchGroupAlias)
|
||||
{
|
||||
@@ -2935,6 +2935,8 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
patchGroupAlias = new PatchGroupAlias();
|
||||
|
||||
patchGroupAlias.addAliasID(new TalkgroupID(patchGroupID));
|
||||
|
||||
if(existingAlias != null)
|
||||
{
|
||||
getAliasList().removeAlias(existingAlias);
|
||||
@@ -2942,8 +2944,6 @@ public class P25DecoderState extends DecoderState
|
||||
patchGroupAlias.setPatchGroupAlias(existingAlias);
|
||||
}
|
||||
|
||||
patchGroupAlias.addAliasID(new TalkgroupID(patchGroupID));
|
||||
|
||||
getAliasList().addAlias(patchGroupAlias);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user