Skip to content

Commit

Permalink
#1444 Adds interim Hytera Aloha message support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Sheirer committed Feb 12, 2023
1 parent b51a010 commit cd5a9a4
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2020 Dennis Sheirer
* 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
Expand All @@ -24,6 +24,7 @@
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.hytera.HyteraAdjacentSiteInformation;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAloha;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAnnouncement;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTPreamble;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraXPTSiteState;
Expand Down Expand Up @@ -78,7 +79,6 @@
import io.github.dsheirer.module.decode.dmr.message.data.mbc.UnknownMultiCSBK;
import io.github.dsheirer.module.decode.dmr.message.type.AnnouncementType;
import io.github.dsheirer.module.decode.dmr.message.type.ServiceKind;

import java.util.List;

/**
Expand Down Expand Up @@ -213,6 +213,9 @@ public static CSBKMessage create(DMRSyncPattern pattern, CorrectedBinaryMessage
csbk = new Preamble(pattern, message, cach, slotType, timestamp, timeslot);
break;

case HYTERA_ALOHA:
csbk = new HyteraAloha(pattern, message, cach, slotType, timestamp, timeslot);
break;
case HYTERA_08_ANNOUNCEMENT:
case HYTERA_68_ANNOUNCEMENT:
AnnouncementType announcementType = HyteraAnnouncement.getAnnouncementType(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2020 Dennis Sheirer
* 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
Expand All @@ -20,7 +20,6 @@
package io.github.dsheirer.module.decode.dmr.message.data.csbk;

import io.github.dsheirer.module.decode.dmr.message.type.Vendor;

import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Map;
Expand Down Expand Up @@ -93,6 +92,7 @@ public enum Opcode
HYTERA_XPT_SITE_STATE(Vendor.HYTERA_68, 10, "HYTERA XPT SITE STATE"),
HYTERA_08_ANNOUNCEMENT(Vendor.HYTERA_8, 40, "T-III 08 ANNOUNCEMENT"),
HYTERA_68_ANNOUNCEMENT(Vendor.HYTERA_68, 40, "T-III 68 ANNOUNCEMENT"),
HYTERA_ALOHA(Vendor.HYTERA_68, 25, "HYTERA ALOHA"),

//Opcode 54 and/or 55 - See patent on Hytera call forwarding
HYTERA_XPT_PREAMBLE(Vendor.HYTERA_68, 61, "HYTERA XPT PREAMBLE"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
/*
* *****************************************************************************
* 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.message.data.csbk.hytera;

import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.identifier.radio.RadioIdentifier;
import io.github.dsheirer.module.decode.dmr.DMRSyncPattern;
import io.github.dsheirer.module.decode.dmr.identifier.DMRRadio;
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 io.github.dsheirer.module.decode.dmr.message.type.ServiceFunction;
import io.github.dsheirer.module.decode.dmr.message.type.SystemIdentityCode;
import io.github.dsheirer.module.decode.dmr.message.type.Version;
import java.util.ArrayList;
import java.util.List;

/**
* Hytera DMR Tier III - Aloha Message
*/
public class HyteraAloha extends CSBKMessage
{
//TODO: not sure what bits 16 to 31 are used for ... awaiting documentation.
//TODO: bits 32 to 79 seem to align with the standard aloha.

private static final int[] RESERVED = new int[]{16, 17};
private static final int SITE_TIMESLOT_SYNCHRONIZATION = 18;
private static final int[] VERSION = new int[]{19, 20, 21};
private static final int TIMING_OFFSET = 22;
private static final int ACTIVE_NETWORK_CONNECTION_FLAG = 23;
private static final int[] MASK = new int[]{24, 25, 26, 27, 28};
private static final int[] SERVICE_FUNCTION = new int[]{29, 30};
private static final int[] N_RAND_WAIT = new int[]{31, 32, 33, 34};
private static final int REGISTRATION_REQUIRED_FLAG = 35;
private static final int[] BACKOFF = new int[]{36, 37, 38, 39};
private static final int SYSTEM_IDENTITY_CODE_OFFSET = 40;
private static final int[] RADIO = new int[]{56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79};

private SystemIdentityCode mSystemIdentityCode;
private RadioIdentifier mRadioIdentifier;
private List<Identifier> mIdentifiers;
#14
/**
* 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 HyteraAloha(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());
sb.append(" HYTERA ALOHA");

if(hasRadioIdentifier())
{
sb.append(" TO:").append(getRadioIdentifier());
}

sb.append(" ").append(getSystemIdentityCode().getModel());
sb.append(" NETWORK:").append(getSystemIdentityCode().getNetwork());
sb.append(" SITE:").append(getSystemIdentityCode().getSite());
if(hasActiveNetworkConnection())
{
sb.append(" NET-CONNECTED");
}
else
{
sb.append(" NET-DISCONNECTED");
}

sb.append(" SERVICES:").append(getServiceFunction());

sb.append(" ETSI VER:").append(getVersion());
sb.append(" MASK:").append(getMask());

if(getSystemIdentityCode().getPAR().isMultipleControlChannels())
{
sb.append(" ").append(getSystemIdentityCode().getPAR());
}

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

return sb.toString();
}

/**
* Services provided by the control channel.
*/
public ServiceFunction getServiceFunction()
{
return ServiceFunction.fromValue(getMessage().getInt(SERVICE_FUNCTION));
}

/**
* Mobile subscriber ID masking value. See: 102 361-4 p6.1.3
*/
public int getMask()
{
return getMessage().getInt(MASK);
}

public boolean hasActiveNetworkConnection()
{
return getMessage().get(ACTIVE_NETWORK_CONNECTION_FLAG);
}

/**
* DMR Tier III ETSI 102 361-4 ICD Version Number supported by this system
*/
public Version getVersion()
{
return Version.fromValue(getMessage().getInt(VERSION));
}

/**
* Acknowledged radio identifier
*/
public RadioIdentifier getRadioIdentifier()
{
if(mRadioIdentifier == null)
{
mRadioIdentifier = DMRRadio.createTo(getMessage().getInt(RADIO));
}

return mRadioIdentifier;
}

public boolean hasRadioIdentifier()
{
return getMessage().getInt(RADIO) != 0;
}

/**
* System Identity Code structure
*/
public SystemIdentityCode getSystemIdentityCode()
{
if(mSystemIdentityCode == null)
{
mSystemIdentityCode = new SystemIdentityCode(getMessage(), SYSTEM_IDENTITY_CODE_OFFSET, true);
}

return mSystemIdentityCode;
}

@Override
public List<Identifier> getIdentifiers()
{
if(mIdentifiers == null)
{
mIdentifiers = new ArrayList<>();
if(hasRadioIdentifier())
{
mIdentifiers.add(getRadioIdentifier());
}
mIdentifiers.add(getSystemIdentityCode().getNetwork());
mIdentifiers.add(getSystemIdentityCode().getSite());
}

return mIdentifiers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ else if(message.size() == 96)
//RS(12,9,4) can correct up to floor(4/2) = 1 bit error.
valid = REED_SOLOMON_12_9_4_DMR.correctFullLinkControl(message,
isTerminator ? TERMINATOR_LINK_CONTROL_CRC_MASK : VOICE_LINK_CONTROL_CRC_MASK);
mLog.warn("Doing the reed solomon thing .... valid: " + valid);
}
else
{
Expand Down

0 comments on commit cd5a9a4

Please sign in to comment.