#2680 Alias List optionally auto-adds/upates radio ID to talker alias value. Enable the feature in the playlist editor in the channel config for protocols that produce talker alias (P25, NXDN, DMR). (#2682)

Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
Denny Sheirer
2026-11-17 03:52:59 -05:00
committed by GitHub
parent 2213544eec
commit 7a7364839b
12 changed files with 882 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer;
/**
* Talker alias cache manager. Collects observed talker aliases and inserts them into an identifier collection when
@@ -41,6 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class TalkerAliasManager
{
private Map<Integer,TalkerAliasIdentifier> mAliasMap = new ConcurrentHashMap<>();
private volatile BiConsumer<RadioIdentifier,TalkerAliasIdentifier> mTalkerAliasListener;
/**
* Constructs an instance
@@ -49,6 +51,16 @@ public class TalkerAliasManager
{
}
/**
* Sets an optional listener to receive each talker alias that is assigned to a radio, e.g. to automatically add
* talker aliases to an alias list. The listener is invoked on the calling decoder thread.
* @param listener to receive radio and talker alias updates, or null to clear the listener.
*/
public void setTalkerAliasListener(BiConsumer<RadioIdentifier,TalkerAliasIdentifier> listener)
{
mTalkerAliasListener = listener;
}
/**
* Updates the alias for the radio identifier
*
@@ -60,6 +72,13 @@ public class TalkerAliasManager
if(identifier.getRole() == Role.FROM)
{
mAliasMap.put(identifier.getValue(), alias);
BiConsumer<RadioIdentifier,TalkerAliasIdentifier> listener = mTalkerAliasListener;
if(listener != null && alias != null)
{
listener.accept(identifier, alias);
}
}
}