Skip to content

Commit

Permalink
#1914 adds phase 2 assembly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Sheirer committed May 11, 2024
1 parent c0c8368 commit f030107
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 456 deletions.
25 changes: 25 additions & 0 deletions src/main/java/io/github/dsheirer/message/AbstractMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@
*/
public abstract class AbstractMessage
{
public static final int OCTET_0_BIT_0 = 0;
public static final int OCTET_1_BIT_8 = 8;
public static final int OCTET_2_BIT_16 = 16;
public static final int OCTET_3_BIT_24 = 24;
public static final int OCTET_4_BIT_32 = 32;
public static final int OCTET_5_BIT_40 = 40;
public static final int OCTET_6_BIT_48 = 48;
public static final int OCTET_7_BIT_56 = 56;
public static final int OCTET_8_BIT_64 = 64;
public static final int OCTET_9_BIT_72 = 72;
public static final int OCTET_10_BIT_80 = 80;
public static final int OCTET_11_BIT_88 = 88;
public static final int OCTET_12_BIT_96 = 96;

private CorrectedBinaryMessage mMessage;
private int mOffset = 0;

Expand Down Expand Up @@ -130,6 +144,17 @@ public int getInt(IntField field)
}
}

/**
* Access the integer value for the specified field at the specified offset.
* @param field description
* @param offset to the start of the field.
* @return integer value.
*/
public int getInt(IntField field, int offset)
{
return getMessage().getInt(field, offset);
}

/**
* Indicates if the field has a non-zero value, meaning that any of the bits for the field are set to a one.
* @param field to inspect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola.LCMotorolaGroupRegroupVoiceChannelUpdate;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola.LCMotorolaTalkComplete;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola.LCMotorolaUnitGPS;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola.MotorolaTalkerAliasComplete;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.standard.LCCallTermination;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.standard.LCExtendedFunctionCommand;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.standard.LCExtendedFunctionCommandExtended;
Expand Down Expand Up @@ -317,12 +318,9 @@ public void receive(IMessage iMessage)
break;
}
}
else if(iMessage instanceof LinkControlWord lcw)
else if(iMessage instanceof MotorolaTalkerAliasComplete tac)
{
//Process Motorola talker alias complete LCW that is created by the P25P1MessageProcessor where it is not
//carried in a data unit and was reassembled from a header and data blocks. Since the header and data
// blocks are only carried in TDULC data units, we set isTerminator to true here.
processLC(lcw, iMessage.getTimestamp(), true);
//TODO: handle this message
}
}

Expand Down Expand Up @@ -2014,9 +2012,6 @@ private void processLC(LinkControlWord lcw, long timestamp, boolean isTerminator
closeCurrentCallEvent(timestamp);
}
break;
case MOTOROLA_TALKER_ALIAS_COMPLETE:
//TODO: handle alias once decoding is complete
break;

//Other events
case CALL_ALERT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@
*/
public abstract class P25P1Message extends TimeslotMessage implements IMessage
{
//P25 Phase 1 ICD defines octets starting at zero.
public static final int OCTET_0_BIT_0 = 0;
public static final int OCTET_1_BIT_8 = 8;
public static final int OCTET_2_BIT_16 = 16;
public static final int OCTET_3_BIT_24 = 24;
public static final int OCTET_4_BIT_32 = 32;
public static final int OCTET_5_BIT_40 = 40;
public static final int OCTET_6_BIT_48 = 48;
public static final int OCTET_7_BIT_56 = 56;
public static final int OCTET_8_BIT_64 = 64;
public static final int OCTET_9_BIT_72 = 72;
public static final int OCTET_10_BIT_80 = 80;
public static final int OCTET_11_BIT_88 = 88;
public static final int OCTET_12_BIT_96 = 96;

private Identifier mNAC;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ public enum LinkControlOpcode
MOTOROLA_TALK_COMPLETE("MOTOROLA TALK_COMPLETE", 15),
MOTOROLA_TALKER_ALIAS_HEADER("MOTOROLA TALKER ALIAS HEADER", 21),
MOTOROLA_TALKER_ALIAS_DATA_BLOCK("MOTOROLA TALKER ALIAS DATA BLOCK", 23),
//Note: this is not a true LCW opcode ... it is a talker alias reassembled from header and data blocks
MOTOROLA_TALKER_ALIAS_COMPLETE("MOTOROLA TALKER ALIAS COMPLETE", -1),
MOTOROLA_UNKNOWN("MOTOROLA UNKNOWN", -1),

L3HARRIS_RETURN_TO_CONTROL_CHANNEL("UNKNOWN OPCODE 10", 10),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,9 @@ public abstract class LinkControlWord extends AbstractMessage
public static final int OCTET_7_BIT_56 = 56;
public static final int OCTET_8_BIT_64 = 64;
public static final int OCTET_9_BIT_72 = 72;
public static final int OCTET_10_BIT_80 = 80;
public static final int OCTET_11_BIT_88 = 88;
public static final int OCTET_13_BIT_104 = 104;
public static final int OCTET_15_BIT_120 = 120;
public static final int OCTET_17_BIT_136 = 136;
public static final int OCTET_19_BIT_152 = 152;
public static final int OCTET_21_BIT_168 = 168;
public static final int OCTET_23_BIT_184 = 184;
public static final int OCTET_25_BIT_200 = 200;
public static final int OCTET_27_BIT_216 = 216;
public static final int OCTET_29_BIT_232 = 232;
public static final int OCTET_31_BIT_248 = 248;
public static final int OCTET_33_BIT_264 = 264;
public static final int OCTET_35_BIT_280 = 280;
public static final int OCTET_37_BIT_296 = 296;
public static final int OCTET_12_BIT_96 = 96;

private static final int ENCRYPTION_FLAG = 0;
private static final int STANDARD_VENDOR_ID_FLAG = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
package io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola;

import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.message.TimeslotMessage;
import io.github.dsheirer.module.decode.p25.phase1.message.lc.LinkControlWord;
import io.github.dsheirer.protocol.Protocol;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -116,7 +118,7 @@ private boolean isComplete()
* @return assembled talker alias
* @throws IllegalStateException if the assembler can't assemble the alias.
*/
public LCMotorolaTalkerAliasComplete assemble() throws IllegalStateException
public MotorolaTalkerAliasComplete assemble() throws IllegalStateException
{
if(!isComplete())
{
Expand All @@ -135,8 +137,8 @@ public LCMotorolaTalkerAliasComplete assemble() throws IllegalStateException
offset += DATA_BLOCK_FRAGMENT_LENGTH;
}

LCMotorolaTalkerAliasComplete complete = new LCMotorolaTalkerAliasComplete(reassembled, mHeader.getTalkgroup(),
dataBlockCount, mHeader.getSequence(), mMostRecentTimestamp);
MotorolaTalkerAliasComplete complete = new MotorolaTalkerAliasComplete(reassembled, mHeader.getTalkgroup(),
mHeader.getSequence(), TimeslotMessage.TIMESLOT_0, mMostRecentTimestamp, Protocol.APCO25);

mHeader = null;
mDataBlocks.clear();
Expand Down
Loading

0 comments on commit f030107

Please sign in to comment.