Skip to content

Commit

Permalink
#1974 P25 Fully Qualified Talkgroup/Radio values shouldn't replace lo…
Browse files Browse the repository at this point in the history
…cal ID/address, when the value is zero, with the fully qualified ID, which causes incorrect aliasing. (#1975)

Co-authored-by: Dennis Sheirer <[email protected]>
  • Loading branch information
DSheirer and Dennis Sheirer authored Sep 9, 2024
1 parent e6a8048 commit 9f3f7e6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,4 +92,23 @@ public String toString()
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,4 +91,23 @@ public String toString()
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);
}
}

0 comments on commit 9f3f7e6

Please sign in to comment.