#1974 P25 Fully Qualified Talkgroup/Radio values shouldn't replace local ID/address, when the value is zero, with the fully qualified ID, which causes incorrect aliasing. (#1975)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2024-09-09 09:24:05 -04:00
committed by GitHub
parent e6a804836b
commit 9f3f7e65a4
2 changed files with 40 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ public abstract class FullyQualifiedRadioIdentifier extends RadioIdentifier
*/
public FullyQualifiedRadioIdentifier(int localAddress, int wacn, int system, int id, Role role)
{
super(localAddress > 0 ? localAddress : id, role);
super(localAddress, role);
mWacn = wacn;
mSystem = system;
mRadio = id;
@@ -92,4 +92,23 @@ public abstract class FullyQualifiedRadioIdentifier extends RadioIdentifier
return getFullyQualifiedRadioAddress();
}
}
@Override
public boolean equals(Object o)
{
//Attempt to match as a fully qualified radio match first
if(o instanceof FullyQualifiedRadioIdentifier fqri)
{
return getWacn() == fqri.getWacn() &&
getSystem() == fqri.getSystem() &&
getRadio() == fqri.getRadio();
}
//Attempt to match the local address against a simple radio version
else if(o instanceof RadioIdentifier ri)
{
return getValue() != 0 && ri.getValue() != 0 && getValue().equals(ri.getValue());
}
return super.equals(o);
}
}

View File

@@ -40,7 +40,7 @@ public abstract class FullyQualifiedTalkgroupIdentifier extends TalkgroupIdentif
*/
public FullyQualifiedTalkgroupIdentifier(int localAddress, int wacn, int system, int id, Role role)
{
super(localAddress > 0 ? localAddress : id, role);
super(localAddress, role);
mWacn = wacn;
mSystem = system;
mTalkgroup = id;
@@ -91,4 +91,23 @@ public abstract class FullyQualifiedTalkgroupIdentifier extends TalkgroupIdentif
return getFullyQualifiedTalkgroupAddress();
}
}
@Override
public boolean equals(Object o)
{
//Attempt to match as a fully qualified talkgroup match first
if(o instanceof FullyQualifiedTalkgroupIdentifier fqti)
{
return getWacn() == fqti.getWacn() &&
getSystem() == fqti.getSystem() &&
getTalkgroup() == fqti.getTalkgroup();
}
//Attempt to match the local address against a simple talkgroup version
else if(o instanceof TalkgroupIdentifier ti)
{
return getValue() != 0 && ti.getValue() != 0 && getValue().equals(ti.getValue());
}
return super.equals(o);
}
}