Skip to content

Commit

Permalink
Merge pull request #1759 from DSheirer/1758-l3h-talker-alias-gps
Browse files Browse the repository at this point in the history
#1758 P25 Phase 2 L3Harris Talker Alias and GPS Report.
  • Loading branch information
DSheirer committed Dec 10, 2023
2 parents 9b89e80 + 93c61c4 commit b6c6505
Show file tree
Hide file tree
Showing 8 changed files with 573 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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 <http://www.gnu.org/licenses/>
* ****************************************************************************
*/

package io.github.dsheirer.identifier.alias;

import io.github.dsheirer.protocol.Protocol;

/**
* Talker alias value provided by the network for the current talker (ie FROM).
*/
public class P25TalkerAliasIdentifier extends TalkerAliasIdentifier
{
/**
* Constructs an instance.
* @param value of the talker alias
*/
public P25TalkerAliasIdentifier(String value)
{
super(value);
}

@Override
public boolean isValid()
{
return getValue() != null && !getValue().isEmpty();
}

@Override
public Protocol getProtocol()
{
return Protocol.APCO25;
}

public static P25TalkerAliasIdentifier create(String value)
{
return new P25TalkerAliasIdentifier(value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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 <http://www.gnu.org/licenses/>
* ****************************************************************************
*/

package io.github.dsheirer.module.decode.dmr.identifier;

import io.github.dsheirer.identifier.Role;
import io.github.dsheirer.identifier.location.LocationIdentifier;
import io.github.dsheirer.identifier.location.Point;
import io.github.dsheirer.protocol.Protocol;

/**
* P25 location identifier for user radio reported GPS positions.
*/
public class P25Location extends LocationIdentifier
{
/**
* Constructs an instance
*
* @param value location
* @param role to or from
*/
public P25Location(Point value, Role role)
{
super(value, role);
}

@Override
public Protocol getProtocol()
{
return Protocol.APCO25;
}

/**
* Utility method to create a new DMR location
* @param latitude of the position
* @param longitude of the position
* @return constructed DMR location identifier
*/
public static P25Location createFrom(double latitude, double longitude)
{
Point point = new Point(latitude, longitude);
return new P25Location(point, Role.FROM);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.event.DecodeEvent;
import io.github.dsheirer.module.decode.event.DecodeEventType;
import io.github.dsheirer.module.decode.event.PlottableDecodeEvent;
import io.github.dsheirer.module.decode.p25.P25DecodeEvent;
import io.github.dsheirer.module.decode.p25.identifier.channel.APCO25Channel;
import io.github.dsheirer.module.decode.p25.identifier.radio.APCO25RadioIdentifier;
Expand Down Expand Up @@ -87,8 +88,12 @@
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.UnitToUnitVoiceChannelGrantUpdateExtended;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.UnitToUnitVoiceChannelUserAbbreviated;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.UnitToUnitVoiceChannelUserExtended;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.l3harris.L3HarrisGpsLocation;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.l3harris.L3HarrisRegroupCommand;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.l3harris.L3HarrisTalkerAlias;
import io.github.dsheirer.module.decode.p25.phase2.timeslot.AbstractVoiceTimeslot;
import io.github.dsheirer.protocol.Protocol;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -392,6 +397,15 @@ private void processMacMessage(MacMessage message)
case PHASE1_109_UNIT_REGISTRATION_COMMAND_ABBREVIATED:
broadcast(message, mac, getCurrentChannel(), DecodeEventType.COMMAND, "UNIT REGISTRATION");
break;
case PHASE1_128_L3HARRIS_GPS_LOCATION:
processL3HarrisGps(message, mac);
break;
case PHASE1_168_L3HARRIS_TALKER_ALIAS:
if(mac instanceof L3HarrisTalkerAlias talkerAlias)
{
getIdentifierCollection().update(talkerAlias.getAlias());
}
break;
case PHASE1_176_L3HARRIS_GROUP_REGROUP:
if(mac instanceof L3HarrisRegroupCommand regroup)
{
Expand Down Expand Up @@ -587,6 +601,25 @@ private void processIPMWP(MacMessage message, MacStructure mac) {
}
}

/**
* Broadcasts the L3Harris gps position report as a mappable/plottable event.
*/
private void processL3HarrisGps(MacMessage message, MacStructure structure)
{
if(structure instanceof L3HarrisGpsLocation gps)
{
MutableIdentifierCollection collection = getUpdatedMutableIdentifierCollection(gps);

broadcast(PlottableDecodeEvent.plottableBuilder(DecodeEventType.GPS, message.getTimestamp())
.protocol(Protocol.APCO25)
.location(gps.getGeoPosition())
.channel(getCurrentChannel())
.details(gps.getLocation().toString() + " " + new Date(gps.getTimestampMs()))
.identifiers(collection)
.build());
}
}

private void broadcast(MacMessage message, MacStructure mac, IChannelDescriptor currentChannel, DecodeEventType eventType, String details) {
MutableIdentifierCollection collection = getUpdatedMutableIdentifierCollection(mac);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.UnknownStructure;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.UnknownVendorMessage;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.l3harris.L3HarrisRegroupCommand;
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.l3harris.L3HarrisTalkerAlias;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
Expand Down Expand Up @@ -290,6 +291,8 @@ public static MacStructure createMacStructure(CorrectedBinaryMessage message, in
return new AdjacentStatusBroadcastAbbreviated(message, offset);
case PHASE1_125_IDENTIFIER_UPDATE:
return new FrequencyBandUpdate(message, offset);
case PHASE1_168_L3HARRIS_TALKER_ALIAS:
return new L3HarrisTalkerAlias(message, offset);
case PHASE1_176_L3HARRIS_GROUP_REGROUP:
return new L3HarrisRegroupCommand(message, offset);
case PHASE1_192_GROUP_VOICE_CHANNEL_GRANT_EXTENDED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public enum MacOpcode
PHASE1_123_NETWORK_STATUS_BROADCAST_ABBREVIATED(123, "NETWORK STATUS BROADCAST ABBREVIATED", 11),
PHASE1_124_ADJACENT_STATUS_BROADCAST_ABBREVIATED(124, "ADJACENT STATUS BROADCAST ABBREVIATED", 9),
PHASE1_125_IDENTIFIER_UPDATE(125, "IDENTIFIER UPDATE", 9),
PHASE1_128_L3HARRIS_GPS_LOCATION(128, "GPS LOCATION", -1),
PHASE1_168_L3HARRIS_TALKER_ALIAS(168, "TALKER ALIAS", -1),
PHASE1_176_L3HARRIS_GROUP_REGROUP(176, "REGROUP COMMAND", 17),
PHASE1_PARTITION_1_UNKNOWN_OPCODE(-1, "UNKNOWN PHASE 1 OPCODE", -1),

Expand Down

0 comments on commit b6c6505

Please sign in to comment.