diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/phase1/message/ldu/LDUMessage.java b/src/main/java/io/github/dsheirer/module/decode/p25/phase1/message/ldu/LDUMessage.java
index 1ff5d7039..b1168be97 100644
--- a/src/main/java/io/github/dsheirer/module/decode/p25/phase1/message/ldu/LDUMessage.java
+++ b/src/main/java/io/github/dsheirer/module/decode/p25/phase1/message/ldu/LDUMessage.java
@@ -1,7 +1,6 @@
/*
- * ******************************************************************************
- * sdrtrunk
- * Copyright (C) 2014-2019 Dennis Sheirer
+ * *****************************************************************************
+ * Copyright (C) 2014-2024 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,23 +14,21 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
- * *****************************************************************************
+ * ****************************************************************************
*/
package io.github.dsheirer.module.decode.p25.phase1.message.ldu;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.module.decode.p25.phase1.message.P25Message;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.ArrayList;
import java.util.List;
+/**
+ * LDU voice frame
+ */
public abstract class LDUMessage extends P25Message
{
- private final static Logger mLog = LoggerFactory.getLogger(LDUMessage.class);
-
public static final int IMBE_FRAME_1 = 0;
public static final int IMBE_FRAME_2 = 144;
public static final int IMBE_FRAME_3 = 328;
@@ -41,10 +38,16 @@ public abstract class LDUMessage extends P25Message
public static final int IMBE_FRAME_7 = 1064;
public static final int IMBE_FRAME_8 = 1248;
public static final int IMBE_FRAME_9 = 1424;
+ public static final int[] LOW_SPEED_DATA = {1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1408, 1409, 1410, 1411,
+ 1412, 1413, 1414, 1415};
+ private List mIMBIFrames;
- public static final int[] LOW_SPEED_DATA = {1392, 1393, 1394, 1395, 1396, 1397,
- 1398, 1399, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415};
-
+ /**
+ * Constructs an instance
+ * @param message with data
+ * @param nac code
+ * @param timestamp for the message
+ */
public LDUMessage(CorrectedBinaryMessage message, int nac, long timestamp)
{
super(message, nac, timestamp);
@@ -58,6 +61,10 @@ public String getLowSpeedData()
return getMessage().getHex(LOW_SPEED_DATA, 4);
}
+ /**
+ * Base message used by subclass implementations.
+ * @return base message
+ */
public String getMessageStub()
{
StringBuilder sb = new StringBuilder();
@@ -70,24 +77,25 @@ public String getMessageStub()
}
/**
- * Returns a 162 byte array containing 9 IMBE voice frames of 18-bytes
- * (144-bits) each. Each frame is intact as transmitted and requires
- * deinterleaving, error correction, derandomizing, etc.
+ * Returns a 162 byte array containing 9 IMBE voice frames of 18-bytes* (144-bits) each. Each frame is intact as
+ * transmitted and requires deinterleaving, error correction, derandomizing, etc.
*/
- public List getIMBEFrames()
+ public synchronized List getIMBEFrames()
{
- List frames = new ArrayList();
-
- frames.add(getMessage().get(IMBE_FRAME_1, IMBE_FRAME_1 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_2, IMBE_FRAME_2 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_3, IMBE_FRAME_3 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_4, IMBE_FRAME_4 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_5, IMBE_FRAME_5 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_6, IMBE_FRAME_6 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_7, IMBE_FRAME_7 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_8, IMBE_FRAME_8 + 144).toByteArray());
- frames.add(getMessage().get(IMBE_FRAME_9, IMBE_FRAME_9 + 144).toByteArray());
+ if(mIMBIFrames == null)
+ {
+ mIMBIFrames = new ArrayList<>();
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_1, IMBE_FRAME_1 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_2, IMBE_FRAME_2 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_3, IMBE_FRAME_3 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_4, IMBE_FRAME_4 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_5, IMBE_FRAME_5 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_6, IMBE_FRAME_6 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_7, IMBE_FRAME_7 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_8, IMBE_FRAME_8 + 144).toByteArray());
+ mIMBIFrames.add(getMessage().get(IMBE_FRAME_9, IMBE_FRAME_9 + 144).toByteArray());
+ }
- return frames;
+ return mIMBIFrames;
}
}
diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice2Timeslot.java b/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice2Timeslot.java
index 350505940..941a14811 100644
--- a/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice2Timeslot.java
+++ b/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice2Timeslot.java
@@ -1,23 +1,20 @@
/*
+ * *****************************************************************************
+ * Copyright (C) 2014-2024 Dennis Sheirer
*
- * * ******************************************************************************
- * * Copyright (C) 2014-2019 Dennis Sheirer
- * *
- * * This program is free software: you can redistribute it and/or modify
- * * it under the terms of the GNU General Public License as published by
- * * the Free Software Foundation, either version 3 of the License, or
- * * (at your option) any later version.
- * *
- * * This program is distributed in the hope that it will be useful,
- * * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * * GNU General Public License for more details.
- * *
- * * You should have received a copy of the GNU General Public License
- * * along with this program. If not, see
- * * *****************************************************************************
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * ****************************************************************************
*/
package io.github.dsheirer.module.decode.p25.phase2.timeslot;
@@ -25,7 +22,6 @@
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.module.decode.p25.phase2.enumeration.DataUnitID;
-
import java.util.ArrayList;
import java.util.List;
@@ -61,7 +57,7 @@ public Voice2Timeslot(CorrectedBinaryMessage message, BinaryMessage scramblingSe
/**
* Voice frames contained in this timeslot
*/
- public List getVoiceFrames()
+ public synchronized List getVoiceFrames()
{
if(mVoiceFrames == null)
{
diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice4Timeslot.java b/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice4Timeslot.java
index bd2f88425..12a4fb8cb 100644
--- a/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice4Timeslot.java
+++ b/src/main/java/io/github/dsheirer/module/decode/p25/phase2/timeslot/Voice4Timeslot.java
@@ -1,23 +1,20 @@
/*
+ * *****************************************************************************
+ * Copyright (C) 2014-2024 Dennis Sheirer
*
- * * ******************************************************************************
- * * Copyright (C) 2014-2019 Dennis Sheirer
- * *
- * * This program is free software: you can redistribute it and/or modify
- * * it under the terms of the GNU General Public License as published by
- * * the Free Software Foundation, either version 3 of the License, or
- * * (at your option) any later version.
- * *
- * * This program is distributed in the hope that it will be useful,
- * * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * * GNU General Public License for more details.
- * *
- * * You should have received a copy of the GNU General Public License
- * * along with this program. If not, see
- * * *****************************************************************************
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * ****************************************************************************
*/
package io.github.dsheirer.module.decode.p25.phase2.timeslot;
@@ -25,7 +22,6 @@
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.module.decode.p25.phase2.enumeration.DataUnitID;
-
import java.util.ArrayList;
import java.util.List;
@@ -62,7 +58,7 @@ public Voice4Timeslot(CorrectedBinaryMessage message, BinaryMessage scramblingSe
/**
* Voice frames contained in this timeslot
*/
- public List getVoiceFrames()
+ public synchronized List getVoiceFrames()
{
if(mVoiceFrames == null)
{
@@ -71,7 +67,6 @@ public List getVoiceFrames()
mVoiceFrames.add(getMessage().getSubMessage(FRAME_2_START, FRAME_2_START + FRAME_LENGTH));
mVoiceFrames.add(getMessage().getSubMessage(FRAME_3_START, FRAME_3_START + FRAME_LENGTH));
mVoiceFrames.add(getMessage().getSubMessage(FRAME_4_START, FRAME_4_START + FRAME_LENGTH));
- return mVoiceFrames;
}
return mVoiceFrames;