Skip to content

Commit 024a624

Browse files
DSheirerDennis Sheirer
andauthored
#2018 P25 Phase 1 resolves issue where NowPlaying identifiers were flickering as they are removed and readded with each TDULC terminator message. (#2019)
Co-authored-by: Dennis Sheirer <[email protected]>
1 parent 9a02416 commit 024a624

File tree

3 files changed

+82
-157
lines changed

3 files changed

+82
-157
lines changed

src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoderState.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import io.github.dsheirer.identifier.talkgroup.TalkgroupIdentifier;
3939
import io.github.dsheirer.log.LoggingSuppressor;
4040
import io.github.dsheirer.message.IMessage;
41+
import io.github.dsheirer.message.TimeslotMessage;
4142
import io.github.dsheirer.module.decode.DecoderType;
4243
import io.github.dsheirer.module.decode.dmr.channel.DMRAbsoluteChannel;
4344
import io.github.dsheirer.module.decode.dmr.channel.DMRChannel;
@@ -1459,14 +1460,22 @@ public String getActivitySummary()
14591460
{
14601461
StringBuilder sb = new StringBuilder();
14611462

1463+
boolean networkAdded = false;
1464+
14621465
if(mNetworkConfigurationMonitor != null)
14631466
{
14641467
sb.append(mNetworkConfigurationMonitor.getActivitySummary());
1465-
sb.append("\n\n");
1466-
sb.append(mTrafficChannelManager.getTalkerAliasManager().getAliasSummary());
1468+
networkAdded = true;
14671469
}
1468-
else
1470+
1471+
//Only add the talker alias summary to timeslot 1 activity summary since we aggregate across both timeslots.
1472+
if(getTimeslot() == TimeslotMessage.TIMESLOT_1)
14691473
{
1474+
if(networkAdded)
1475+
{
1476+
sb.append("\n\n");
1477+
}
1478+
14701479
sb.append(mTrafficChannelManager.getTalkerAliasManager().getAliasSummary());
14711480
}
14721481

src/main/java/io/github/dsheirer/module/decode/p25/P25TrafficChannelManager.java

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import io.github.dsheirer.module.decode.p25.phase2.enumeration.ScrambleParameters;
6060
import io.github.dsheirer.module.decode.p25.phase2.message.mac.MacOpcode;
6161
import io.github.dsheirer.module.decode.p25.reference.ServiceOptions;
62+
import io.github.dsheirer.module.decode.p25.reference.VoiceServiceOptions;
6263
import io.github.dsheirer.module.decode.traffic.TrafficChannelManager;
6364
import io.github.dsheirer.sample.Listener;
6465
import io.github.dsheirer.source.config.SourceConfigTuner;
@@ -729,27 +730,36 @@ public void processP1TrafficCallStart(long frequency, Identifier<?> talkgroup, I
729730
{
730731
P25TrafficChannelEventTracker tracker = getTracker(frequency, P25P1Message.TIMESLOT_1);
731732

732-
if(tracker != null)
733+
//If the tracker is already started, it was for another call. Close it and recreate the event.
734+
if(tracker != null && tracker.isStarted())
733735
{
734736
removeTracker(frequency, P25P1Message.TIMESLOT_1);
737+
tracker = null;
735738
}
736739

737-
DecodeEventType decodeEventType = getDecodeEventType(talkgroup, eki);
738-
739-
MutableIdentifierCollection mic = new MutableIdentifierCollection();
740-
mic.update(talkgroup);
741-
mic.update(radio);
742-
mic.update(eki);
743-
744-
//Create a new event for the current call.
745-
P25ChannelGrantEvent callEvent = P25ChannelGrantEvent.builder(decodeEventType, timestamp, serviceOptions)
746-
.channelDescriptor(channelDescriptor)
747-
.details("PHASE 1 CALL " + (serviceOptions != null ? serviceOptions : ""))
748-
.identifiers(mic)
749-
.build();
740+
if(tracker != null)
741+
{
742+
tracker.addIdentifierIfMissing(talkgroup);
743+
}
744+
else
745+
{
746+
DecodeEventType decodeEventType = getDecodeEventType(talkgroup, eki);
747+
MutableIdentifierCollection mic = new MutableIdentifierCollection();
748+
mic.update(talkgroup);
749+
mic.update(radio);
750+
mic.update(eki);
751+
752+
//Create a new event for the current call.
753+
P25ChannelGrantEvent callEvent = P25ChannelGrantEvent.builder(decodeEventType, timestamp, serviceOptions)
754+
.channelDescriptor(channelDescriptor)
755+
.details("PHASE 1 CALL " + (serviceOptions != null ? serviceOptions : ""))
756+
.identifiers(mic)
757+
.build();
758+
759+
tracker = new P25TrafficChannelEventTracker(callEvent);
760+
addTracker(tracker, frequency, P25P1Message.TIMESLOT_1);
761+
}
750762

751-
tracker = new P25TrafficChannelEventTracker(callEvent);
752-
addTracker(tracker, frequency, P25P1Message.TIMESLOT_1);
753763
broadcast(tracker);
754764
}
755765
finally
@@ -838,19 +848,22 @@ public void processP1TrafficCurrentUser(long frequency, Identifier identifier, l
838848
* This is used primarily to add encryption, GPS, talker alias, etc. but can be used for any identifier update.
839849
*
840850
* @param frequency for the call event
841-
* @param identifier to update within the event.
851+
* @param identifiers to update within the event.
842852
* @param timestamp for the update
843853
*/
844-
public void processP1TrafficCurrentUserIdentifiers(long frequency, List<Identifier> identifiers, long timestamp, String context)
854+
public void processP1TrafficLDU1(long frequency, List<Identifier> identifiers, long timestamp, String context)
845855
{
846856
mLock.lock();
847857

848858
try
849859
{
860+
IChannelDescriptor channelDescriptor = null;
861+
850862
P25TrafficChannelEventTracker tracker = getTracker(frequency, P25P1Message.TIMESLOT_1);
851863

852864
if(tracker != null && tracker.isComplete())
853865
{
866+
channelDescriptor = tracker.getEvent().getChannelDescriptor();;
854867
removeTracker(frequency, P25P1Message.TIMESLOT_1);
855868
tracker = null;
856869
}
@@ -871,6 +884,29 @@ public void processP1TrafficCurrentUserIdentifiers(long frequency, List<Identifi
871884
tracker.updateDurationTraffic(timestamp);
872885
broadcast(tracker);
873886
}
887+
else
888+
{
889+
MutableIdentifierCollection mic = new MutableIdentifierCollection(identifiers);
890+
Identifier talkgroup = mic.getToIdentifier();
891+
Identifier encryption = mic.getEncryptionIdentifier();
892+
893+
if(talkgroup != null && encryption instanceof EncryptionKeyIdentifier eki)
894+
{
895+
DecodeEventType decodeEventType = getDecodeEventType(talkgroup, eki);
896+
//Create a new event for the current call.
897+
ServiceOptions serviceOptions = (eki.isEncrypted() ? VoiceServiceOptions.createEncrypted() :
898+
VoiceServiceOptions.createUnencrypted());
899+
P25ChannelGrantEvent callEvent = P25ChannelGrantEvent.builder(decodeEventType, timestamp, serviceOptions)
900+
.channelDescriptor(channelDescriptor)
901+
.details("PHASE 1 CALL " + (eki.isEncrypted() ? eki.toString() : ""))
902+
.identifiers(mic)
903+
.build();
904+
905+
tracker = new P25TrafficChannelEventTracker(callEvent);
906+
addTracker(tracker, frequency, P25P1Message.TIMESLOT_1);
907+
broadcast(tracker);
908+
}
909+
}
874910
}
875911
finally
876912
{

0 commit comments

Comments
 (0)