Skip to content

Commit

Permalink
#1607 WIP Harris P25 Regrouping Action Messages and Patch Group manag…
Browse files Browse the repository at this point in the history
…ement updates.
  • Loading branch information
sheirerd committed Oct 18, 2023
1 parent 51f32bb commit bdfa716
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public enum Opcode
HARRIS_ISP_UNKNOWN(-1, "HARRIS ISP UNKNOWN OPCODE", "HARRIS ISP UNKNOWN OPCODE"),

//Vendor: harris, Outbound Service Packet (OSP)
HARRIS_OSP_GRG_EXENC_CMD(48, "HARRIS GROUP REGROUP EXPLICIT ENCRYPTION COMMAND", "HARRIS GROUP REGROUP ENC"),
HARRIS_OSP_GRG_EXENC_CMD(48, "HARRIS REGROUP", "HARRIS GROUP REGROUP COMMAND WITH EXPLICIT ENCRYPTION"),
HARRIS_OSP_UNKNOWN(-1, "HARRIS OSP UNKNOWN OPCODE", "HARRIS OSP UNKNOWN OPCODE"),

//Vendor: unknown, Inbound Service Packet (ISP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class HarrisGroupRegroupExplicitEncryptionCommand extends OSPMessage
private static final int[] TARGET_ADDRESS = new int[]{48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71};

private TalkgroupIdentifier mPatchGroupIdentifier;
private TalkgroupIdentifier mSuperGroupIdentifier;
private APCO25PatchGroup mPatchGroup;
private Identifier mPatchedIdentifier;
private List<Identifier> mIdentifiers;
Expand Down Expand Up @@ -82,6 +82,15 @@ public int getEncryptionKeyId()
return getMessage().getInt(ENCRYPTION_KEY_ID);
}

/**
* Indicates if there is a specified encryption key to use for the patch or simulselect communications.
* @return true if key is specified.
*/
public boolean hasEncryptionKeyId()
{
return getEncryptionKeyId() > 0;
}

/**
* APCO25 Patch Group or Simul-Select (e.g. Harris) loaded with the target address specified in this message.
* @return patch group
Expand All @@ -90,7 +99,7 @@ public APCO25PatchGroup getPatchGroup()
{
if(mPatchGroup == null)
{
PatchGroup patchGroup = new PatchGroup(getPatchGroupIdentifier());
PatchGroup patchGroup = new PatchGroup(getSuperGroup());

if(getTargetAddress() instanceof APCO25Talkgroup talkgroup)
{
Expand Down Expand Up @@ -133,28 +142,33 @@ public Identifier getTargetAddress()
*
* @return patch group identifier
*/
public TalkgroupIdentifier getPatchGroupIdentifier()
public TalkgroupIdentifier getSuperGroup()
{
if(mPatchGroupIdentifier == null)
if(mSuperGroupIdentifier == null)
{
mPatchGroupIdentifier = APCO25Talkgroup.create(getMessage().getInt(SUPERGROUP_ADDRESS));
mSuperGroupIdentifier = APCO25Talkgroup.create(getMessage().getInt(SUPERGROUP_ADDRESS));
}

return mPatchGroupIdentifier;
return mSuperGroupIdentifier;
}

public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append(getMessageStub());
sb.append(" HARRIS PATCH GROUP:");
sb.append(getPatchGroupIdentifier());
sb.append(" ");
sb.append(getRegroupOptions());
sb.append(" TARGET:").append(getTargetAddress());
if(getRegroupOptions().isTalkgroupAddress())
sb.append(getRegroupOptions().isActivate() ? " ACTIVATE" : " DEACTIVATE");
sb.append(getRegroupOptions().isPatch() ? " TWO-WAY PATCH" : " ONE-WAY SIMUL-SELECT");
sb.append(" SUPERGROUP:").append(getSuperGroup());

if(getRegroupOptions().isActivate())
{
sb.append(" ENCRYPTION KEY:").append(getEncryptionKeyId());
sb.append(" INCLUDE");
sb.append(getRegroupOptions().isTalkgroupAddress() ? " TALKGROUP:" : " RADIO:");
sb.append(getTargetAddress());
if(hasEncryptionKeyId())
{
sb.append(" USE ENCRYPTION KEY:").append(getEncryptionKeyId());
}
}

return sb.toString();
Expand Down

0 comments on commit bdfa716

Please sign in to comment.