P25 work in progress - final check-in of channel state and activity summary processing of TSBK and PDU messages and event generation.

This commit is contained in:
dennis.sheirer
2014-12-21 14:30:06 +00:00
parent ba053457bd
commit 1d77f28958
36 changed files with 1952 additions and 438 deletions

View File

@@ -13,6 +13,7 @@ public enum Encryption
TRIPLE_DES_2_KEY( 0x82 ),
TRIPLE_DES_3_KEY( 0x83 ),
AES( 0x84 ),
ADP( 0xAA ),
UNKNOWN( -1 );
private int mValue;

View File

@@ -0,0 +1,71 @@
package decode.p25.reference;
public enum ExtendedFunction
{
RADIO_CHECK( 0x0000, "RADIO CHECK" ),
RADIO_DETACH( 0x007D, "RADIO DETACH" ),
RADIO_UNINHIBIT( 0x007E, "RADIO UNINHIBIT" ),
RADIO_INHIBIT( 0x007F, "RADIO INHIBIT" ),
RADIO_CHECK_ACK( 0x0080, "RADIO CHECK ACK" ),
RADIO_DETACH_ACK( 0x00FD, "RADIO DETACH ACK" ),
RADIO_UNINHIBIT_ACK( 0x00FE, "RADIO UNINHIBIT ACK" ),
RADIO_INHIBIT_ACK( 0x00FF, "RADIO INHIBIT ACK" ),
GROUP_CONTROL_COMMAND( 0x0100, "GROUP CONTROL COMMAND" ),
UNIT_DYNAMIC_COMMAND( 0x0200, "UNIT DYNAMIC COMMAND" ),
GROUP_DYNAMIC_COMMAND( 0x0300, "GROUP DYNAMIC COMMAND" ),
UNKNOWN( -1, "UNKNOWN" );
private int mFunction;
private String mLabel;
private ExtendedFunction( int function, String label )
{
mFunction = function;
mLabel = label;
}
public String getLabel()
{
return mLabel;
}
public static ExtendedFunction fromValue( int function )
{
switch( function )
{
case 0x0000:
return RADIO_CHECK;
case 0x007D:
return RADIO_DETACH;
case 0x007E:
return RADIO_UNINHIBIT;
case 0x007F:
return RADIO_INHIBIT;
case 0x0080:
return RADIO_CHECK_ACK;
case 0x00FD:
return RADIO_DETACH_ACK;
case 0x00FE:
return RADIO_UNINHIBIT_ACK;
case 0x00FF:
return RADIO_INHIBIT_ACK;
}
if( ( function & 0x0100 ) == 0x0100 )
{
return GROUP_CONTROL_COMMAND;
}
if( ( function & 0x0200 ) == 0x0200 )
{
return UNIT_DYNAMIC_COMMAND;
}
if( ( function & 0x0300 ) == 0x0300 )
{
return GROUP_DYNAMIC_COMMAND;
}
return UNKNOWN;
}
}

View File

@@ -0,0 +1,48 @@
package decode.p25.reference;
public class P25NetworkCallsign
{
public static final String[] RADIX_50 = new String[]
{ " ", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O",
"P", "Q", "R", "S", "T", "U", "V", "W",
"X", "Y", "Z", "$", ".", "?", "0", "1",
"2", "3", "4", "5", "6", "7", "8", "9" };
/**
* Decodes the string callsign from which the WACN and System identifiers
* were derived.
*
* Based on code by Eric Carlson at:
* http://www.ericcarlson.net/project-25-callsign.html
*
* @param wacn
* @param systemID
* @return
*/
public static String getCallsign( int wacn, int systemID )
{
int n1 = wacn / 16;
int n2 = 4096 * ( wacn % 16 ) + systemID;
StringBuilder sb = new StringBuilder();
sb.append( getLetter( (int)( n1 / 1600 ) ) );
sb.append( getLetter( (int)( ( n1 / 40 ) % 40 ) ) );
sb.append( getLetter( (int)( n1 % 40 ) ) );
sb.append( getLetter( (int)( n2 / 1600 ) ) );
sb.append( getLetter( (int)( ( n2 / 40 ) % 40 ) ) );
sb.append( getLetter( (int)( n2 % 40 ) ) );
return sb.toString();
}
private static String getLetter( int value )
{
if( 0 <= value && value < 40 )
{
return RADIX_50[ value ];
}
return " ";
}
}