Skip to content

Commit

Permalink
#1907 Hytera GPS positions, XPT Adjacent site, and Hytera Talker Alia…
Browse files Browse the repository at this point in the history
…ses. (#1908)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
  • Loading branch information
DSheirer and Dennis Sheirer committed May 4, 2024
1 parent 5f08297 commit c50a914
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/main/java/io/github/dsheirer/bits/BinaryMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public boolean hasInt(IntField intField)

/**
* Indicates if the message field contains a non-zero value indicated by any bits set in the int field indices.
* @param intField to inspect
* @param fragmentedField to inspect
* @return true if any of the bits are set, indicating a non-zero value.
*/
public boolean hasInt(FragmentedIntField fragmentedField)
Expand Down Expand Up @@ -1057,14 +1057,14 @@ public int getTwosComplement(int start, int end)
if(get(start))
{
//Negative value - flip and add one
BinaryMessage fragment = getSubMessage(start, end);
BinaryMessage fragment = getSubMessage(start, end + 1);
fragment.flip(0, fragment.size());
return fragment.getInt(1, fragment.size()) + 1;
return -(fragment.getInt(0, fragment.size() - 1) + 1);
}
else
{
//Positive value - return the contents.
return getInt(start + 1, end);
return getInt(start, end);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1329,14 +1329,15 @@ private void processLinkControl(LCMessage message, boolean isTerminator)
}
break;
case FULL_STANDARD_GPS_INFO:
if(message instanceof GPSInformation gpsInformation)
case FULL_HYTERA_GPS_INFO:
if(message instanceof GPSInformation gps)
{
PlottableDecodeEvent plottableGPS = PlottableDecodeEvent.plottableBuilder(DecodeEventType.GPS, message.getTimestamp())
.channel(getCurrentChannel())
.details("LOCATION:" + gpsInformation.getGPSLocation())
.details("LOCATION:" + gps.getGPSLocation())
.identifiers(new IdentifierCollection(getIdentifierCollection().getIdentifiers()))
.protocol(Protocol.DMR)
.location(gpsInformation.getPosition())
.location(gps.getPosition())
.build();

broadcast(plottableGPS);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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
Expand Down Expand Up @@ -31,11 +31,12 @@
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraCsbko44;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraSmsAvailableNotification;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraTrafficChannelTalkerStatus;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTAdjacentSites;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTPreamble;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTSiteState;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxAdvantageModeVoiceChannelUpdate;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxAloha;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxOpenModeVoiceChannelUpdate;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxAdvantageModeVoiceChannelUpdate;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusCSBKO_60;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusDataRevertWindowAnnouncement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusDataRevertWindowGrant;
Expand Down Expand Up @@ -246,6 +247,9 @@ public static CSBKMessage create(DMRSyncPattern pattern, CorrectedBinaryMessage
case HYTERA_68_XPT_SITE_STATE:
csbk = new HyteraXPTSiteState(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_68_XPT_ADJACENT_SITE:
csbk = new HyteraXPTAdjacentSites(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_08_ACKNOWLEDGE:
csbk = new Hytera08Acknowledge(pattern, message, cach, slotType, timestamp, timeslot);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public enum Opcode
HYTERA_08_TRAFFIC_CHANNEL_TALKER_STATUS(Vendor.HYTERA_8, 47, "HYTERA 08 CSBKO 47"),

HYTERA_68_XPT_SITE_STATE(Vendor.HYTERA_68, 10, "HYTERA 68 XPT SITE STATE"),
HYTERA_68_XPT_ADJACENT_SITE(Vendor.HYTERA_68, 11, "HYTERA 68 XPT ADJACENT SITE"),

HYTERA_68_ALOHA(Vendor.HYTERA_68, 25, "HYTERA 68 ALOHA"),
HYTERA_68_ACKNOWLEDGE(Vendor.HYTERA_68, 32, "HYTERA 68 ACKNOWLEDGE"),
HYTERA_68_ANNOUNCEMENT(Vendor.HYTERA_68, 40, "HYTERA 68 ANNOUNCEMENT"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
/*
* *****************************************************************************
* 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
* 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.message.data.csbk.hytera;

import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.module.decode.dmr.DMRSyncPattern;
import io.github.dsheirer.module.decode.dmr.message.CACH;
import io.github.dsheirer.module.decode.dmr.message.data.SlotType;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.CSBKMessage;
import java.util.Collections;
import java.util.List;

/**
* Hytera XPT - Adjacent Site State
*/
public class HyteraXPTAdjacentSites extends CSBKMessage
{
private static final int[] SEQUENCE_NUMBER = new int[]{0, 1};
private static final int[] SITE_1 = new int[]{16, 17, 18, 19, 20}; //Unknown: 21-23
private static final int[] FREE_1 = new int[]{24, 25, 26, 27}; //Unknown: 28-31
private static final int[] SITE_2 = new int[]{32, 33, 34, 35, 36}; //Unknown: 37-39
private static final int[] FREE_2 = new int[]{40, 41, 42, 43}; //Unknown: 44-47
private static final int[] SITE_3 = new int[]{48, 49, 50, 51, 52}; //Unknown: 53-55
private static final int[] FREE_3 = new int[]{56, 57, 58, 59}; //Unknown: 60-63
private static final int[] SITE_4 = new int[]{64, 65, 66, 67, 68}; //Unknown: 69-71
private static final int[] FREE_4 = new int[]{72, 73, 74, 75}; //Unknown: 76-79

/**
* Constructs an instance
*
* @param syncPattern for the CSBK
* @param message bits
* @param cach for the DMR burst
* @param slotType for this message
* @param timestamp
* @param timeslot
*/
public HyteraXPTAdjacentSites(DMRSyncPattern syncPattern, CorrectedBinaryMessage message, CACH cach, SlotType slotType, long timestamp, int timeslot)
{
super(syncPattern, message, cach, slotType, timestamp, timeslot);
}

@Override
public String toString()
{
StringBuilder sb = new StringBuilder();

if(!isValid())
{
sb.append("[CRC-ERROR] ");
}

sb.append("CC:").append(getSlotType().getColorCode());
if(hasRAS())
{
sb.append(" RAS:").append(getBPTCReservedBits());
}

sb.append(" HYTERA XPT NEIGHBORS");

if(hasSite1())
{
sb.append(" SITE:").append(getSite1());
sb.append(" FREE:").append(getFree1());
}

if(hasSite2())
{
sb.append(" SITE:").append(getSite2());
sb.append(" FREE:").append(getFree2());
}

if(hasSite3())
{
sb.append(" SITE:").append(getSite3());
sb.append(" FREE:").append(getFree3());
}

if(hasSite4())
{
sb.append(" SITE:").append(getSite4());
sb.append(" FREE:").append(getFree4());
}

sb.append(" MSG:").append(getMessage().toHexString());

return sb.toString();
}

/**
* Site ID for site number 1.
*/
public int getSite1()
{
return getMessage().getInt(SITE_1);
}

/**
* Indicates if site number 1 is valid (ie non-zero).
*/
public boolean hasSite1()
{
return getSite1() > 0;
}

/**
* Free repeater for site 1.
*/
public int getFree1()
{
return getMessage().getInt(FREE_1);
}

/**
* Site ID for site number 2.
*/
public int getSite2()
{
return getMessage().getInt(SITE_2);
}

/**
* Indicates if site number 2 is valid (ie non-zero).
*/
public boolean hasSite2()
{
return getSite2() > 0;
}

/**
* Free repeater for site 2.
*/
public int getFree2()
{
return getMessage().getInt(FREE_2);
}

/**
* Site ID for site number 3.
*/
public int getSite3()
{
return getMessage().getInt(SITE_3);
}

/**
* Indicates if site number 3 is valid (ie non-zero).
*/
public boolean hasSite3()
{
return getSite3() > 0;
}

/**
* Free repeater for site 3.
*/
public int getFree3()
{
return getMessage().getInt(FREE_3);
}

/**
* Site ID for site number 4.
*/
public int getSite4()
{
return getMessage().getInt(SITE_4);
}

/**
* Indicates if site number 4 is valid (ie non-zero).
*/
public boolean hasSite4()
{
return getSite4() > 0;
}

/**
* Free repeater for site 4.
*/
public int getFree4()
{
return getMessage().getInt(FREE_4);
}

@Override
public List<Identifier> getIdentifiers()
{
return Collections.emptyList();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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
Expand Down Expand Up @@ -237,7 +237,7 @@ public String toString()
{
sb.append(" RAS:").append(getBPTCReservedBits());
}
sb.append(" HYTERA XPT SITE ");
sb.append(" HYTERA XPT SITE");

if(isAllChannelsBusy())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 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
Expand Down Expand Up @@ -37,6 +37,7 @@
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.hytera.HyteraGroupVoiceChannelUser;
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.hytera.HyteraTerminator;
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.hytera.HyteraUnitToUnitVoiceChannelUser;
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.hytera.HyteraXptChannelGrant;
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.motorola.CapacityMaxTalkerAlias;
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.motorola.CapacityMaxTalkerAliasContinuation;
import io.github.dsheirer.module.decode.dmr.message.data.lc.full.motorola.CapacityMaxVoiceChannelUser;
Expand Down Expand Up @@ -132,6 +133,7 @@ else if(message.size() == 96)
flc = new UnitToUnitVoiceChannelUser(message, timestamp, timeslot);
break;
case FULL_STANDARD_GPS_INFO:
case FULL_HYTERA_GPS_INFO:
flc = new GPSInformation(message, timestamp, timeslot);
break;
case FULL_STANDARD_TERMINATOR_DATA:
Expand Down Expand Up @@ -169,17 +171,24 @@ else if(message.size() == 96)
flc = new HyteraTerminator(message, timestamp, timeslot);
break;
case FULL_STANDARD_TALKER_ALIAS_HEADER:
case FULL_HYTERA_TALKER_ALIAS_HEADER:
flc = new TalkerAliasHeader(message, timestamp, timeslot);
break;
case FULL_STANDARD_TALKER_ALIAS_BLOCK_1:
case FULL_HYTERA_TALKER_ALIAS_BLOCK_1:
flc = new TalkerAliasBlock1(message, timestamp, timeslot);
break;
case FULL_STANDARD_TALKER_ALIAS_BLOCK_2:
case FULL_HYTERA_TALKER_ALIAS_BLOCK_2:
flc = new TalkerAliasBlock2(message, timestamp, timeslot);
break;
case FULL_STANDARD_TALKER_ALIAS_BLOCK_3:
case FULL_HYTERA_TALKER_ALIAS_BLOCK_3:
flc = new TalkerAliasBlock3(message, timestamp, timeslot);
break;
case FULL_HYTERA_XPT_CHANNEL_GRANT:
flc = new HyteraXptChannelGrant(message, timestamp, timeslot);
break;
default:
flc = new UnknownFullLCMessage(message, timestamp, timeslot);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public enum LCOpcode

FULL_HYTERA_GROUP_VOICE_CHANNEL_USER(Vendor.HYTERA_68, true, 0, "HYTERA GROUP VOICE CHANNEL USER"),
FULL_HYTERA_UNIT_TO_UNIT_VOICE_CHANNEL_USER(Vendor.HYTERA_68, true, 3, "HYTERA UNIT-TO-UNIT VOICE CHANNEL USER"),
FULL_HYTERA_TALKER_ALIAS_HEADER(Vendor.HYTERA_68,true, 4, "HYTERA TALKER ALIAS HEADER"),
FULL_HYTERA_TALKER_ALIAS_BLOCK_1(Vendor.HYTERA_68,true, 5, "HYTERA TALKER ALIAS BLOCK 1"),
FULL_HYTERA_TALKER_ALIAS_BLOCK_2(Vendor.HYTERA_68,true, 6, "HYTERA TALKER ALIAS BLOCK 2"),
FULL_HYTERA_TALKER_ALIAS_BLOCK_3(Vendor.HYTERA_68,true, 7, "HYTERA TALKER ALIAS BLOCK 3"),
FULL_HYTERA_GPS_INFO(Vendor.HYTERA_68,true, 8, "HYTERA GPS INFO"),
FULL_HYTERA_XPT_CHANNEL_GRANT(Vendor.HYTERA_68, true, 9, "HYTERA XPT CHANNEL GRANT"),
FULL_HYTERA_TERMINATOR(Vendor.HYTERA_68, true, 48, "HYTERA TERMINATOR"),

SHORT_STANDARD_NULL_MESSAGE(Vendor.STANDARD,false,0, "NULL MESSAGE"),
Expand All @@ -82,7 +88,9 @@ public enum LCOpcode
SHORT_STANDARD_UNKNOWN(Vendor.STANDARD,false,-1, "UNKNOWN");

private static final EnumSet<LCOpcode> TALKER_ALIAS_OPCODES = EnumSet.of(FULL_STANDARD_TALKER_ALIAS_HEADER,
FULL_STANDARD_TALKER_ALIAS_BLOCK_1, FULL_STANDARD_TALKER_ALIAS_BLOCK_2, FULL_STANDARD_TALKER_ALIAS_BLOCK_3);
FULL_STANDARD_TALKER_ALIAS_BLOCK_1, FULL_STANDARD_TALKER_ALIAS_BLOCK_2, FULL_STANDARD_TALKER_ALIAS_BLOCK_3,
FULL_HYTERA_TALKER_ALIAS_HEADER, FULL_HYTERA_TALKER_ALIAS_BLOCK_1, FULL_HYTERA_TALKER_ALIAS_BLOCK_2,
FULL_HYTERA_TALKER_ALIAS_BLOCK_3);

private final Vendor mVendor;
private final boolean mFull;
Expand Down

0 comments on commit c50a914

Please sign in to comment.