#7 NXDN Decoder support. Redesigns tuner and channel frequency error management. (#2431)

Closes #7 

NXDN Decoder

* Implements: NXDN4800, NXDN9600, Type-C and Type-D decoding and trunk tracking.
* Redesigns tuner and channel frequency error management.
This commit is contained in:
Denny Sheirer
2026-07-08 03:44:08 -04:00
committed by GitHub
parent a053315675
commit 7945f0ce63
445 changed files with 30854 additions and 2053 deletions

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2025 Dennis Sheirer
* Copyright (C) 2014-2026 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
@@ -306,6 +306,15 @@ public class BinaryMessage extends BitSet
}
public String toString()
{
return toHexString();
}
/**
* Binary representation of the message
* @return message in binary 0/1 format
*/
public String toBinaryString()
{
StringBuilder sb = new StringBuilder();
@@ -317,6 +326,10 @@ public class BinaryMessage extends BitSet
return sb.toString();
}
/**
* Hex string representation of the message
* @return message in hex
*/
public String toHexString()
{
StringBuilder sb = new StringBuilder();
@@ -997,6 +1010,18 @@ public class BinaryMessage extends BitSet
return String.format("%0" + width + "X", getInt(field));
}
/**
* Returns the long field formatted as a hex value using zero prefixes to pad the hex character count to fully
* represent the size (width) of the field.
* @param field to parse as hex
* @return hex value.
*/
public String getHex(LongField field)
{
int width = Math.ceilDiv(field.width(), 4);
return String.format("%0" + width + "X", getLong(field));
}
/**
* Format the byte value that starts at the specified index as hexadecimal. If the length of the message is less
* than the start index plus 7 bits, then the value represents those bits as high-order bits with zero padding in
@@ -1315,37 +1340,15 @@ public class BinaryMessage extends BitSet
throw new IllegalArgumentException("Message must contain only 0-9 and A-F hexadecimal characters");
}
int length = hex.length() / 2;
BinaryMessage message = new BinaryMessage(hex.length() * 4);
if(length * 2 < hex.length())
for(int x = 0; x < hex.length(); x++)
{
length++;
String rawHex = hex.substring(x, x + 1);
message.setInt(Integer.parseInt(rawHex, 16), IntField.length4(x * 4));
}
BinaryMessage buffer = new BinaryMessage(length * 8);
int bufferOffset = 0;
for(int x = 0; x < hex.length(); x += 2)
{
int endIndex = x + 2;
if(endIndex > hex.length())
{
endIndex--;
}
String rawHex = hex.substring(x, endIndex);
if(rawHex.length() == 1)
{
rawHex = rawHex + "0";
}
int value = Integer.parseInt(rawHex, 16);
buffer.setByte(bufferOffset, (byte)(value & 0xFF));
bufferOffset += 8;
}
return buffer;
return message;
}
/**