Identifier Framework and Message/Event Processing Overhaul (#455)

* WIP on new P25 message framer.

* WIP on new P25 message framer.

* Adds new 1/2 and 3/4 rate trellis decoders.  Still trying to chase
down why there is a sync pattern mismatch in the NID buffer queue.

* WIP - new p25 message framer works correctly now.  PDU's are dectected
and decoded using the 1/2 and 3/4 rate trellis decoders.  Packet
Sequences are assembled.  Need to add a new packet sequence message
factory that can detect Motorola Auto Registration Service (ARS)
formatted UDP/ID packets and SNDCP command packets.

* WIP - removes nullify on channel results queue.

* WIP - updates message framer for TSBK 1/2/3 processing.

* WIP removing P25 sync pattern and nid bits from all message parsers.

* WIP - merges identifier framework branch changes into this branch.

* WIP on updating link control words to new format and identifier framework.

* WIP - implements rest of link control words for extended formats

* WIP - initial work on ISP/OSP TSBK message restructuring.

* WIP - adds more TSBK ISP and OSP messages

* WIP - finished updating most of the TSBK ISP and OSP messages.  Converted
all messages to no longer include the NID (nac + dataunitID) so that
each message can simply hold the parsed values.  Removed AliasList as
an argument to each message and updated all messges to use the new
IIdentifer and IAPCO25Channel interfaces.

Removed legacy TDU and LDU link control messages and replaced with a
single LinkControlWord class hierarchy.

P25 decoder state is not yet updated for the new message structure.

PDU message parsing is not fully implemented.

* WIP - adds some Multi-Block trunking control messages with Alternate
and Unconfirmed formats.

* WIP - Fully implements AMBTC and UMBTC PDU message parsers.

Some package restructuring.

* WIP - Resolves Link control parsing in LDU1 and 2 messages.

* WIP - finishes updating TSBK and Link Control messages.  Adds support
for moto link control messages for patch groups.

* WIP - finishes updating TSBK and Link Control messages.  Adds support
for moto link control messages for patch groups.  Adds support for moto
ARS service, IPV4 decoding, and UDP/IP packets.

* WIP - finishes SNDCP packet data with header parsing.  Compressed IP or
UDP headers are not yet supported, but are logged as such.

* WIP - converts all talkgroup identifiers to integers and updates
alias list to create a per-protocol map of talkgroup id's to alias.

Inserts a legacy talkgroup (ltr, p25, passport, mpt1327, mdc, etc.)
conversion utility to convert existing legacy (string) talkgroups to
new integer talkgroup format.

Creates an audio packet manager to insert metadata into audio packets
before streaming packets for playback, recording, and/or streaming.

Creates identifier collection to manage current identifiers in each of
the channel and decoder states.

Creates simplified channel metadata to maintain the now playing display.

Moves channel attributes (alias list, system, site, name) as configuration
identifiers in the channel state.

Many other refactoring and updates.

* WIP - numerous updates to push use of identifier collection throughout
the system.  Updates the channel metadata and audio packet processing
logic.  Implements a large portion of the P25 decode state processing.
Updates traffic channel management.  Adds user preferences for timestamp
and identifier formatting, however doesn't add a user interface yet.

* WIP - initial implementation of user preferences editor window.

* WIP - updates preferences editor window to close and dispose window but
retain javafx event thread running.

* WIP - fully updates p25 decoder state and traffic channel processing to
use the new identifier framework.

Cleans up channel event processing and removes channel model as the sole
broadcaster of channel events.  Channel processing manager now listens
for all start/stop events and requestors dispatch event directly to the
channel processing manager.

Resolves issue in airspy that was causing user interface to lock-up.  The
issue appears to occur when the dongle is plugged into a usb port that
can't fully support the data rate.  sdrtrunk now recognizes these errors
and warns the user that they should use another usb port.

* WIP - updates alias action manager and adds new talkgroup range alias identifier.

Updates playlist to incorporate a version number so that the playlist
updater only runs when needed, to update a playlist to the correct
version format.

Updates user preferences to use the google event bus to broadcast
preference update notifications to remove the need for listeners to
register directly on the user preferences instance.

* WIP - updates alias id editors to flag invalid values and moves legacy
alias ids to legacy package.

Updates event logging configuration to add traffic channel decode events
and decoded message logging.  Removes binary message logging since that
is now replaced with demodulated bitstream recording.

* Removes system properties from user preferences.  Preferences are stored
in the OS-dependent settings store (windows - registry)

* Updates MapService to use new PlottableDecodeEvent instead of monitoring
all of the decoded messages.

Updates Fleetsync decoder and related messages to identifier framework.

* Updates LTR-Net, Fleetsync and LJ1200 decoders to new identifier
framework and adds support for user preferences for formatting of
LTR-Net and fleetsync talkgroup identifiers.

Breaks LTR-Net messages into various message types and uses a new
message factory.

Removes alias list from message processing for ltr-net, fleetsync and
lj1200.

* Updates LTR-Standard messages to Identifier framework.

* Removes Plottable and IPlottable from codebase.

* wip

* WIP on MPT-1327 messages.

* Updates MPT1327 decoder to identifier framework and new traffic channel
manager.  This decoder still needs to be updated with a new message
parser factory and a sync detector like what is now used for P25.

* Updates MDC1200 decoder and message to identifier framework.

* Updates Tait1200 and Passport decoders to identifier framework.

* Merges changes from master branch.

* Removes legacy alias support classes.  Updates passport message processor
to only pass valid messages.  Adds support to playlist updater for
converting passport mobile ids to become passport talkgroup values.

* Updates P25 decoder state and channel state to better track allocated
traffic channels.  Resolves issue in timestamp manager for trackig
message timestamps. Resolves issue in airspy tuner that was causing
the tuner to stop sending samples to the application.

* Update P25 Decoder state to process SNDCP management messages and
PDU messages.

Updates P25 activity summary to display network and site details.

Resolves issue with overlay panel that prevented enabled channels from
rendering correctly when zoomed in.

* Creates a new FilePreferences as part of the user preferences to begin
the transition of SystemProperties over to user preferences and consolidate
file preferences in one location.

Updates playlist manager to use the new file preferences and to use
default.xml as the new default playlist name, following conversion of
a playlist_v2.xml format to the new format.

In the near future, the user will be able to edit file locations and to
create/use other playlists.

Resolved an issue with all decoder states where not all identifiers were
being included in decode events.
This commit is contained in:
Denny Sheirer
2018-12-24 09:08:34 -05:00
committed by GitHub
parent 735fca16d6
commit b67d4d92dc
869 changed files with 64776 additions and 45233 deletions

View File

@@ -1,28 +1,30 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.tait;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.edac.CRC;
import io.github.dsheirer.map.Plottable;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.module.decode.tait.identifier.TaitIdentifier;
import io.github.dsheirer.protocol.Protocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,241 +34,133 @@ import java.util.List;
public class Tait1200ANIMessage extends Message
{
private final static Logger mLog = LoggerFactory.getLogger( Tait1200ANIMessage.class );
private final static Logger mLog = LoggerFactory.getLogger(Tait1200ANIMessage.class);
public static int[] REVS_1 = { 0,1,2,3 };
public static int[] SYNC = { 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 };
public static int[] SIZE = { 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 };
public static int[] FROM_DIGIT_1 = { 36,37,38,39,40,41,42,43 };
public static int[] FROM_DIGIT_2 = { 44,45,46,47,48,49,50,51 };
public static int[] FROM_DIGIT_3 = { 52,53,54,55,56,57,58,59 };
public static int[] FROM_DIGIT_4 = { 60,61,62,63,64,65,66,67 };
public static int[] FROM_DIGIT_5 = { 68,69,70,71,72,73,74,75 };
public static int[] FROM_DIGIT_6 = { 76,77,78,79,80,81,82,83 };
public static int[] FROM_DIGIT_7 = { 84,85,86,87,88,89,90,91 };
public static int[] FROM_DIGIT_8 = { 92,93,94,95,96,97,98,99 };
public static int[] CHECKSUM_1 = { 100,101,102,103,104,105,106,107,108,109,
110,111,112,113,114,115 };
public static int[] REVS_1 = {0, 1, 2, 3};
public static int[] SYNC = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
public static int[] SIZE = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35};
public static int[] FROM_DIGIT_1 = {36, 37, 38, 39, 40, 41, 42, 43};
public static int[] FROM_DIGIT_2 = {44, 45, 46, 47, 48, 49, 50, 51};
public static int[] FROM_DIGIT_3 = {52, 53, 54, 55, 56, 57, 58, 59};
public static int[] FROM_DIGIT_4 = {60, 61, 62, 63, 64, 65, 66, 67};
public static int[] FROM_DIGIT_5 = {68, 69, 70, 71, 72, 73, 74, 75};
public static int[] FROM_DIGIT_6 = {76, 77, 78, 79, 80, 81, 82, 83};
public static int[] FROM_DIGIT_7 = {84, 85, 86, 87, 88, 89, 90, 91};
public static int[] FROM_DIGIT_8 = {92, 93, 94, 95, 96, 97, 98, 99};
public static int[] CHECKSUM_1 = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115};
public static int[] REVS_2 = { 116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131 };
public static int[] SIZE_2 = { 188,189,190,191,192,193,194,195,196,197,198,
199,200,201,202,203 };
public static int[] TO_DIGIT_1 = { 204,205,206,207,208,209,210,211 };
public static int[] TO_DIGIT_2 = { 212,213,214,215,216,217,218,219 };
public static int[] TO_DIGIT_3 = { 220,221,222,223,224,225,226,227 };
public static int[] TO_DIGIT_4 = { 228,229,230,231,232,233,234,235 };
public static int[] TO_DIGIT_5 = { 236,237,238,239,240,241,242,243 };
public static int[] TO_DIGIT_6 = { 244,245,246,247,248,249,250,251 };
public static int[] TO_DIGIT_7 = { 252,253,254,255,256,257,258,259 };
public static int[] TO_DIGIT_8 = { 260,261,262,263,264,265,266,267 };
public static int[] UNKNOWN_1 = { 268,269,270,271,272,273,274,275 };
public static int[] CHECKSUM_2 = { 276,277,278,279,280,281,282,283,284,285,
286,287,288,289,290,291 };
public static int[] REVS_2 = {116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131};
public static int[] SIZE_2 = {188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
199, 200, 201, 202, 203};
public static int[] TO_DIGIT_1 = {204, 205, 206, 207, 208, 209, 210, 211};
public static int[] TO_DIGIT_2 = {212, 213, 214, 215, 216, 217, 218, 219};
public static int[] TO_DIGIT_3 = {220, 221, 222, 223, 224, 225, 226, 227};
public static int[] TO_DIGIT_4 = {228, 229, 230, 231, 232, 233, 234, 235};
public static int[] TO_DIGIT_5 = {236, 237, 238, 239, 240, 241, 242, 243};
public static int[] TO_DIGIT_6 = {244, 245, 246, 247, 248, 249, 250, 251};
public static int[] TO_DIGIT_7 = {252, 253, 254, 255, 256, 257, 258, 259};
public static int[] TO_DIGIT_8 = {260, 261, 262, 263, 264, 265, 266, 267};
public static int[] UNKNOWN_1 = {268, 269, 270, 271, 272, 273, 274, 275};
public static int[] CHECKSUM_2 = {276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
286, 287, 288, 289, 290, 291};
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
private static SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd HHmmss");
private BinaryMessage mMessage;
private AliasList mAliasList;
private CorrectedBinaryMessage mMessage;
private CRC mCRC;
public Tait1200ANIMessage( BinaryMessage message, AliasList list )
private TaitIdentifier mFromIdentifier;
private TaitIdentifier mToIdentifier;
private List<Identifier> mIdentifiers;
public Tait1200ANIMessage(CorrectedBinaryMessage message)
{
mMessage = message;
mAliasList = list;
// checkCRC();
//
// switch( mCRC )
// {
// case CORRECTED:
// mLog.debug( "CORR:" + message.toString() );
// break;
// case FAILED_CRC:
// mLog.debug( "FAIL:" + message.toString() );
// break;
// case PASSED:
// mLog.debug( "PASS:" + message.toString() );
// break;
// }
mMessage = message;
}
@Override
public String getFromID()
public TaitIdentifier getFromIdentifier()
{
StringBuilder sb = new StringBuilder();
sb.append( getCharacter( FROM_DIGIT_1 ) );
sb.append( getCharacter( FROM_DIGIT_2 ) );
sb.append( getCharacter( FROM_DIGIT_3 ) );
sb.append( getCharacter( FROM_DIGIT_4 ) );
sb.append( getCharacter( FROM_DIGIT_5 ) );
sb.append( getCharacter( FROM_DIGIT_6 ) );
sb.append( getCharacter( FROM_DIGIT_7 ) );
sb.append( getCharacter( FROM_DIGIT_8 ) );
return sb.toString();
if(mFromIdentifier == null)
{
StringBuilder sb = new StringBuilder();
sb.append(getCharacter(FROM_DIGIT_1));
sb.append(getCharacter(FROM_DIGIT_2));
sb.append(getCharacter(FROM_DIGIT_3));
sb.append(getCharacter(FROM_DIGIT_4));
sb.append(getCharacter(FROM_DIGIT_5));
sb.append(getCharacter(FROM_DIGIT_6));
sb.append(getCharacter(FROM_DIGIT_7));
sb.append(getCharacter(FROM_DIGIT_8));
mFromIdentifier = TaitIdentifier.createFrom(sb.toString().trim());
}
return mFromIdentifier;
}
@Override
public Alias getFromIDAlias()
public TaitIdentifier getToIdentifier()
{
if( mAliasList != null )
{
return mAliasList.getTalkgroupAlias( getFromID() );
}
return null;
if(mToIdentifier == null)
{
StringBuilder sb = new StringBuilder();
sb.append(getCharacter(TO_DIGIT_1));
sb.append(getCharacter(TO_DIGIT_2));
sb.append(getCharacter(TO_DIGIT_3));
sb.append(getCharacter(TO_DIGIT_4));
sb.append(getCharacter(TO_DIGIT_5));
sb.append(getCharacter(TO_DIGIT_6));
sb.append(getCharacter(TO_DIGIT_7));
sb.append(getCharacter(TO_DIGIT_8));
mToIdentifier = TaitIdentifier.createTo(sb.toString().trim());
}
return mToIdentifier;
}
@Override
public String getToID()
public char getCharacter(int[] bits)
{
StringBuilder sb = new StringBuilder();
sb.append( getCharacter( TO_DIGIT_1 ) );
sb.append( getCharacter( TO_DIGIT_2 ) );
sb.append( getCharacter( TO_DIGIT_3 ) );
sb.append( getCharacter( TO_DIGIT_4 ) );
sb.append( getCharacter( TO_DIGIT_5 ) );
sb.append( getCharacter( TO_DIGIT_6 ) );
sb.append( getCharacter( TO_DIGIT_7 ) );
sb.append( getCharacter( TO_DIGIT_8 ) );
return sb.toString();
}
@Override
public Alias getToIDAlias()
{
if( mAliasList != null )
{
return mAliasList.getTalkgroupAlias( getToID() );
}
return null;
}
public char getCharacter( int[] bits )
{
int value = mMessage.getInt( bits );
return (char)value;
int value = mMessage.getInt(bits);
return (char)value;
}
public boolean isValid()
{
// return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
return true;
return true;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
sb.append( "ANI FROM:" );
sb.append( getFromID() );
sb.append( " TO:" );
sb.append( getToID() );
sb.append("ANI FROM:").append(getFromIdentifier());
sb.append(" TO:").append(getToIdentifier());
return sb.toString();
return sb.toString();
}
/**
* Pads spaces onto the end of the value to make it 'places' long
*/
public String pad( String value, int places, String padCharacter )
@Override
public Protocol getProtocol()
{
StringBuilder sb = new StringBuilder();
sb.append( value );
while( sb.length() < places )
{
sb.append( padCharacter );
}
return sb.toString();
}
/**
* Pads an integer value with additional zeroes to make it decimalPlaces long
*/
public String format( int number, int decimalPlaces )
{
StringBuilder sb = new StringBuilder();
int paddingRequired = decimalPlaces - ( String.valueOf( number ).length() );
for( int x = 0; x < paddingRequired; x++)
{
sb.append( "0" );
}
sb.append( number );
return sb.toString();
}
@Override
public String getBinaryMessage()
{
return mMessage.toString();
}
@Override
public String getProtocol()
{
return "Tait-1200";
return Protocol.TAIT1200;
}
@Override
public String getEventType()
@Override
public List<Identifier> getIdentifiers()
{
return "ANI";
}
if(mIdentifiers == null)
{
mIdentifiers = new ArrayList<>();
mIdentifiers.add(getFromIdentifier());
mIdentifiers.add(getToIdentifier());
}
@Override
public String getMessage()
{
return toString();
return mIdentifiers;
}
@Override
public String getErrorStatus()
{
return "UNKNOWN";
// return mCRC.getDisplayText();
}
@Override
public Plottable getPlottable()
{
return null;
}
/**
* Provides a listing of aliases contained in the message.
*/
public List<Alias> getAliases()
{
List<Alias> aliases = new ArrayList<Alias>();
Alias from = getFromIDAlias();
if( from != null )
{
aliases.add( from );
}
Alias to = getToIDAlias();
if( to != null )
{
aliases.add( to );
}
return aliases;
}
}

View File

@@ -1,65 +1,61 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.tait;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.sample.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Tait1200ANIMessageProcessor implements Listener<BinaryMessage>
public class Tait1200ANIMessageProcessor implements Listener<CorrectedBinaryMessage>
{
private final static Logger mLog =
LoggerFactory.getLogger( Tait1200ANIMessageProcessor.class );
private final static Logger mLog = LoggerFactory.getLogger(Tait1200ANIMessageProcessor.class);
private Listener<IMessage> mMessageListener;
private Listener<Message> mMessageListener;
private AliasList mAliasList;
public Tait1200ANIMessageProcessor( AliasList list )
{
mAliasList = list;
}
public void dispose()
{
mMessageListener = null;
mAliasList = null;
}
@Override
public void receive( BinaryMessage buffer )
public Tait1200ANIMessageProcessor()
{
if( mMessageListener != null )
{
mMessageListener.receive( new Tait1200ANIMessage( buffer, mAliasList ) );
}
}
public void setMessageListener( Listener<Message> listener )
{
mMessageListener = listener;
}
public void removeMessageListener( Listener<Message> listener )
public void dispose()
{
mMessageListener = null;
mMessageListener = null;
}
@Override
public void receive(CorrectedBinaryMessage buffer)
{
if(mMessageListener != null)
{
mMessageListener.receive(new Tait1200ANIMessage(buffer));
}
}
public void setMessageListener(Listener<IMessage> listener)
{
mMessageListener = listener;
}
public void removeMessageListener(Listener<Message> listener)
{
mMessageListener = null;
}
}

View File

@@ -1,20 +1,22 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.tait;
import io.github.dsheirer.alias.Alias;
@@ -24,36 +26,31 @@ import io.github.dsheirer.module.decode.event.CallEvent;
public class Tait1200CallEvent extends CallEvent
{
public Tait1200CallEvent( CallEventType callEventType,
AliasList aliasList,
String fromID,
String toID,
String details )
public Tait1200CallEvent(CallEventType callEventType,
AliasList aliasList,
String fromID,
String toID,
String details)
{
super( DecoderType.TAIT_1200, callEventType,
aliasList, fromID, toID, details );
super(DecoderType.TAIT_1200, callEventType,
aliasList, fromID, toID, details);
}
private Alias getAlias( String ident )
private Alias getAlias(String ident)
{
if( hasAliasList() )
{
return getAliasList().getFleetsyncAlias( ident );
}
return null;
}
@Override
public Alias getFromIDAlias()
{
return getAlias( getFromID() );
return getAlias(getFromID());
}
@Override
public Alias getToIDAlias()
{
return getAlias( getToID() );
return getAlias(getToID());
}
@Override
@@ -79,30 +76,30 @@ public class Tait1200CallEvent extends CallEvent
private String mToID;
private String mDetails;
public Builder( CallEventType callEventType )
public Builder(CallEventType callEventType)
{
mCallEventType = callEventType;
}
public Builder aliasList( AliasList aliasList )
public Builder aliasList(AliasList aliasList)
{
mAliasList = aliasList;
return this;
}
public Builder from( String val )
public Builder from(String val)
{
mFromID = val;
return this;
}
}
public Builder details( String details )
public Builder details(String details)
{
mDetails = details;
return this;
}
public Builder to( String toID )
public Builder to(String toID)
{
mToID = toID;
return this;
@@ -110,28 +107,22 @@ public class Tait1200CallEvent extends CallEvent
public Tait1200CallEvent build()
{
return new Tait1200CallEvent( this );
return new Tait1200CallEvent(this);
}
}
/**
* Private constructor for the builder
*/
private Tait1200CallEvent( Builder builder )
private Tait1200CallEvent(Builder builder)
{
this( builder.mCallEventType,
builder.mAliasList,
builder.mFromID,
builder.mToID,
builder.mDetails );
this(builder.mCallEventType, builder.mAliasList, builder.mFromID, builder.mToID, builder.mDetails);
}
public static Tait1200CallEvent getLJ1200Event( Tait1200GPSMessage message )
public static Tait1200CallEvent getLJ1200Event(Tait1200GPSMessage message)
{
CallEventType type = CallEventType.COMMAND;
return new Tait1200CallEvent.Builder( type )
.details( message.getMessage() )
.build();
return new Tait1200CallEvent.Builder(type).details(message.toString()).build();
}
}

View File

@@ -1,21 +1,24 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 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.
* 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/>
*
******************************************************************************/
* 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.tait;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.IBinarySymbolProcessor;
import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern;
@@ -28,7 +31,6 @@ import io.github.dsheirer.module.decode.afsk.AbstractAFSKDecoder;
*/
public class Tait1200Decoder extends AbstractAFSKDecoder implements IBinarySymbolProcessor
{
/* Message length ... */
private static final int MESSAGE_LENGTH = 440;
private MessageFramer mMessageFramerGPS;
@@ -36,27 +38,27 @@ public class Tait1200Decoder extends AbstractAFSKDecoder implements IBinarySymbo
private Tait1200GPSMessageProcessor mMessageAProcessor;
private Tait1200ANIMessageProcessor mMessageBProcessor;
protected Tait1200Decoder(AFSK1200Decoder decoder, AliasList aliasList)
protected Tait1200Decoder(AFSK1200Decoder decoder)
{
super(decoder);
init(aliasList);
init();
}
public Tait1200Decoder(AliasList aliasList)
public Tait1200Decoder()
{
super(AFSK1200Decoder.Output.NORMAL);
init(aliasList);
init();
}
private void init(AliasList aliasList)
private void init()
{
getDecoder().setSymbolProcessor(this);
mMessageFramerGPS = new MessageFramer(SyncPattern.TAIT_CCDI_GPS_MESSAGE.getPattern(), MESSAGE_LENGTH);
mMessageFramerANI = new MessageFramer(SyncPattern.TAIT_SELCAL_MESSAGE.getPattern(), MESSAGE_LENGTH);
mMessageAProcessor = new Tait1200GPSMessageProcessor(aliasList);
mMessageBProcessor = new Tait1200ANIMessageProcessor(aliasList);
mMessageAProcessor = new Tait1200GPSMessageProcessor();
mMessageBProcessor = new Tait1200ANIMessageProcessor();
mMessageFramerGPS.addMessageListener(mMessageAProcessor);
mMessageFramerANI.addMessageListener(mMessageBProcessor);
@@ -81,10 +83,10 @@ public class Tait1200Decoder extends AbstractAFSKDecoder implements IBinarySymbo
}
@Override
public void receive(boolean symbol)
public void process(boolean symbol)
{
mMessageFramerANI.receive(symbol);
mMessageFramerGPS.receive(symbol);
mMessageFramerANI.process(symbol);
mMessageFramerGPS.process(symbol);
}
public MessageFramer getANIMessageFramer()

View File

@@ -1,18 +1,22 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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 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.
* 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/>
*
******************************************************************************/
* 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.tait;
import io.github.dsheirer.dsp.afsk.AFSK1200DecoderInstrumented;
@@ -29,7 +33,7 @@ public class Tait1200DecoderInstrumented extends Tait1200Decoder implements IIns
public Tait1200DecoderInstrumented()
{
super(new AFSK1200DecoderInstrumented(false), null);
super(new AFSK1200DecoderInstrumented(false));
}
@Override

View File

@@ -1,6 +1,7 @@
/*******************************************************************************
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* Copyright (C) 2014-2018 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
@@ -14,48 +15,31 @@
*
* 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.tait;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.alias.id.AliasIDType;
import io.github.dsheirer.channel.metadata.AliasedStringAttributeMonitor;
import io.github.dsheirer.channel.metadata.Attribute;
import io.github.dsheirer.channel.metadata.AttributeChangeRequest;
import io.github.dsheirer.channel.state.DecoderState;
import io.github.dsheirer.channel.state.DecoderStateEvent;
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
import io.github.dsheirer.channel.state.State;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.identifier.IdentifierClass;
import io.github.dsheirer.identifier.MutableIdentifierCollection;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.event.CallEvent;
import io.github.dsheirer.util.StringUtils;
import io.github.dsheirer.module.decode.event.DecodeEvent;
import io.github.dsheirer.module.decode.event.PlottableDecodeEvent;
import io.github.dsheirer.module.decode.tait.identifier.TaitIdentifier;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.TreeSet;
public class Tait1200DecoderState extends DecoderState
{
private TreeSet<String> mIdents = new TreeSet<String>();
private TreeSet<TaitIdentifier> mIdents = new TreeSet<>();
private AliasedStringAttributeMonitor mFromAttribute;
private AliasedStringAttributeMonitor mToAttribute;
private String mMessage;
private String mMessageType;
public Tait1200DecoderState(AliasList aliasList)
public Tait1200DecoderState()
{
super(aliasList);
mFromAttribute = new AliasedStringAttributeMonitor(Attribute.SECONDARY_ADDRESS_FROM,
getAttributeChangeRequestListener(), getAliasList(), AliasIDType.TALKGROUP);
mToAttribute = new AliasedStringAttributeMonitor(Attribute.SECONDARY_ADDRESS_TO,
getAttributeChangeRequestListener(), getAliasList(), AliasIDType.TALKGROUP);
}
@Override
@@ -68,7 +52,6 @@ public class Tait1200DecoderState extends DecoderState
public void reset()
{
mIdents.clear();
resetState();
}
@@ -90,56 +73,51 @@ public class Tait1200DecoderState extends DecoderState
}
private void resetState()
{
mFromAttribute.reset();
mToAttribute.reset();
mMessage = null;
mMessageType = null;
}
@Override
public void receive(Message message)
public void receive(IMessage message)
{
if(message instanceof Tait1200GPSMessage)
{
Tait1200GPSMessage gps = (Tait1200GPSMessage) message;
Tait1200GPSMessage gps = (Tait1200GPSMessage)message;
mFromAttribute.process(gps.getFromID());
mIdents.add(gps.getFromID());
mToAttribute.process(gps.getToID());
mIdents.add(gps.getToID());
mIdents.add(gps.getFromIdentifier());
mIdents.add(gps.getToIdentifier());
GeoPosition position = gps.getGPSLocation();
if(position != null)
{
setMessage(gps.getGPSLocation().toString().replace("[", "")
.replace("]", ""));
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
ic.remove(IdentifierClass.USER);
ic.update(message.getIdentifiers());
PlottableDecodeEvent event = PlottableDecodeEvent.plottableBuilder(gps.getTimestamp())
.eventDescription("GPS")
.identifiers(ic)
.location(position)
.speed(gps.getSpeed())
.build();
broadcast(event);
}
setMessageType("GPS");
broadcast(new Tait1200CallEvent(CallEvent.CallEventType.GPS, getAliasList(),
gps.getFromID(), gps.getToID(), gps.getGPSLocation().toString()));
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
}
else if(message instanceof Tait1200ANIMessage)
{
Tait1200ANIMessage ani = (Tait1200ANIMessage) message;
mFromAttribute.process(ani.getFromID());
mIdents.add(ani.getFromID());
Tait1200ANIMessage ani = (Tait1200ANIMessage)message;
mIdents.add(ani.getFromIdentifier());
mIdents.add(ani.getToIdentifier());
mToAttribute.process(ani.getToID());
mIdents.add(ani.getToID());
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
ic.remove(IdentifierClass.USER);
ic.update(message.getIdentifiers());
setMessage(null);
setMessageType("ANI");
broadcast(new Tait1200CallEvent(CallEvent.CallEventType.ID_ANI, getAliasList(),
ani.getFromID(), ani.getToID(), "ANI"));
broadcast(DecodeEvent.builder(ani.getTimestamp())
.eventDescription("ANI")
.identifiers(ic)
.details("Automatic Number Identification")
.build());
broadcast(new DecoderStateEvent(this, Event.DECODE, State.CALL));
}
@@ -157,26 +135,9 @@ public class Tait1200DecoderState extends DecoderState
{
sb.append("Radio Identifiers:\n");
List<String> idents = new ArrayList<String>(mIdents);
Collections.sort(idents);
for(String ident : idents)
for(TaitIdentifier taitIdentifier : mIdents)
{
sb.append("\t");
sb.append(ident);
if(hasAliasList())
{
Alias alias = getAliasList().getTalkgroupAlias(ident);
if(alias != null)
{
sb.append("\t");
sb.append(alias.getName());
}
}
sb.append("\n");
sb.append("\t").append(taitIdentifier).append("\n");
}
}
@@ -198,32 +159,4 @@ public class Tait1200DecoderState extends DecoderState
break;
}
}
public String getMessage()
{
return mMessage;
}
public void setMessage(String message)
{
if(!StringUtils.isEqual(mMessage, message))
{
mMessage = message;
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, getMessage()));
}
}
public String getMessageType()
{
return mMessageType;
}
public void setMessageType(String type)
{
if(!StringUtils.isEqual(mMessageType, type))
{
mMessageType = type;
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, getMessageType()));
}
}
}

View File

@@ -1,28 +1,30 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.tait;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.edac.CRC;
import io.github.dsheirer.map.Plottable;
import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.module.decode.tait.identifier.TaitIdentifier;
import io.github.dsheirer.protocol.Protocol;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,375 +39,285 @@ import java.util.TimeZone;
public class Tait1200GPSMessage extends Message
{
private final static Logger mLog = LoggerFactory.getLogger( Tait1200GPSMessage.class );
private final static Logger mLog = LoggerFactory.getLogger(Tait1200GPSMessage.class);
public static int[] REVS_1 = { 0,1,2,3 };
public static int[] SYNC = { 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 };
public static int[] SIZE = { 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 };
public static int[] FROM_DIGIT_1 = { 36,37,38,39,40,41,42,43 };
public static int[] FROM_DIGIT_2 = { 44,45,46,47,48,49,50,51 };
public static int[] FROM_DIGIT_3 = { 52,53,54,55,56,57,58,59 };
public static int[] FROM_DIGIT_4 = { 60,61,62,63,64,65,66,67 };
public static int[] FROM_DIGIT_5 = { 68,69,70,71,72,73,74,75 };
public static int[] FROM_DIGIT_6 = { 76,77,78,79,80,81,82,83 };
public static int[] FROM_DIGIT_7 = { 84,85,86,87,88,89,90,91 };
public static int[] FROM_DIGIT_8 = { 92,93,94,95,96,97,98,99 };
public static int[] CHECKSUM_1 = { 100,101,102,103,104,105,106,107,108,109,
110,111,112,113,114,115 };
public static int[] REVS_1 = {0, 1, 2, 3};
public static int[] SYNC = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
public static int[] SIZE = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35};
public static int[] FROM_DIGIT_1 = {36, 37, 38, 39, 40, 41, 42, 43};
public static int[] FROM_DIGIT_2 = {44, 45, 46, 47, 48, 49, 50, 51};
public static int[] FROM_DIGIT_3 = {52, 53, 54, 55, 56, 57, 58, 59};
public static int[] FROM_DIGIT_4 = {60, 61, 62, 63, 64, 65, 66, 67};
public static int[] FROM_DIGIT_5 = {68, 69, 70, 71, 72, 73, 74, 75};
public static int[] FROM_DIGIT_6 = {76, 77, 78, 79, 80, 81, 82, 83};
public static int[] FROM_DIGIT_7 = {84, 85, 86, 87, 88, 89, 90, 91};
public static int[] FROM_DIGIT_8 = {92, 93, 94, 95, 96, 97, 98, 99};
public static int[] CHECKSUM_1 = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115};
public static int[] REVS_2 = { 116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131 };
public static int[] SIZE_2 = { 188,189,190,191,192,193,194,195,196,197,198,
199,200,201,202,203 };
public static int[] TO_DIGIT_1 = { 204,205,206,207,208,209,210,211 };
public static int[] TO_DIGIT_2 = { 212,213,214,215,216,217,218,219 };
public static int[] TO_DIGIT_3 = { 220,221,222,223,224,225,226,227 };
public static int[] TO_DIGIT_4 = { 228,229,230,231,232,233,234,235 };
public static int[] TO_DIGIT_5 = { 236,237,238,239,240,241,242,243 };
public static int[] TO_DIGIT_6 = { 244,245,246,247,248,249,250,251 };
public static int[] TO_DIGIT_7 = { 252,253,254,255,256,257,258,259 };
public static int[] TO_DIGIT_8 = { 260,261,262,263,264,265,266,267 };
public static int[] UNKNOWN_1 = { 268,269,270,271,272,273,274,275 };
public static int[] CHECKSUM_2 = { 276,277,278,279,280,281,282,283,284,285,
286,287,288,289,290,291 };
public static int DIVIDER_1 = 292;
public static int[] HOUR_TENS = { 293,294,295 };
public static int[] HOUR_ONES = { 296,297,298,299 };
public static int DIVIDER_2 = 300;
public static int[] MINUTES_TENS = { 301,302,303 };
public static int[] MINUTES_ONES = { 304,305,306,307 };
public static int DIVIDER_3 = 308;
public static int[] SECONDS_TENS = { 309,310,311 };
public static int[] SECONDS_ONES = { 312,313,314,315 };
public static int DIVIDER_4 = 316;
public static int[] LATITUDE_SIGN = { 317,318 };
public static int DIVIDER_5 = 319;
public static int[] LATITUDE_DEGREES_TENS = { 320,321,322,323 };
public static int[] LATITUDE_DEGREES_ONES = { 324,325,326,327 };
public static int DIVIDER_6 = 328;
public static int[] LATITUDE_MINUTES_TENS = { 329,330,331 };
public static int[] LATITUDE_MINUTES_ONES = { 332,333,334,335 };
public static int[] LATITUDE_SECONDS_HUND = { 336,337,338,339 };
public static int[] LATITUDE_SECONDS_TENS = { 340,341,342,344 };
public static int[] LATITUDE_SECONDS_ONES = { 344,345,346,347 };
public static int DIVIDER_7 = 348;
public static int[] LONGITUDE_SIGN = { 349,350 };
public static int LONGITUDE_DEGREES_HUNDREDS = 351;
public static int[] LONGITUDE_DEGREES_TENS = { 352,353,354,355 };
public static int[] LONGITUDE_DEGREES_ONES = { 356,357,358,359 };
public static int DIVIDER_9 = 360;
public static int[] LONGITUDE_MINUTES_TENS = { 361,362,363 };
public static int[] LONGITUDE_MINUTES_ONES = { 364,365,366,367 };
public static int[] LONGITUDE_SECONDS_HUND = { 368,369,370,371 };
public static int[] LONGITUDE_SECONDS_TENS = { 372,373,374,375 };
public static int[] LONGITUDE_SECONDS_ONES = { 376,377,378,379 };
public static int DIVIDER_10 = 380;
public static int[] DATE_DAY_TENS = { 381,382,383 };
public static int[] DATE_DAY_ONES = { 384,385,386,387 };
public static int[] REVS_2 = {116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131};
public static int[] SIZE_2 = {188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
199, 200, 201, 202, 203};
public static int[] TO_DIGIT_1 = {204, 205, 206, 207, 208, 209, 210, 211};
public static int[] TO_DIGIT_2 = {212, 213, 214, 215, 216, 217, 218, 219};
public static int[] TO_DIGIT_3 = {220, 221, 222, 223, 224, 225, 226, 227};
public static int[] TO_DIGIT_4 = {228, 229, 230, 231, 232, 233, 234, 235};
public static int[] TO_DIGIT_5 = {236, 237, 238, 239, 240, 241, 242, 243};
public static int[] TO_DIGIT_6 = {244, 245, 246, 247, 248, 249, 250, 251};
public static int[] TO_DIGIT_7 = {252, 253, 254, 255, 256, 257, 258, 259};
public static int[] TO_DIGIT_8 = {260, 261, 262, 263, 264, 265, 266, 267};
public static int[] UNKNOWN_1 = {268, 269, 270, 271, 272, 273, 274, 275};
public static int[] CHECKSUM_2 = {276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
286, 287, 288, 289, 290, 291};
public static int DIVIDER_1 = 292;
public static int[] HOUR_TENS = {293, 294, 295};
public static int[] HOUR_ONES = {296, 297, 298, 299};
public static int DIVIDER_2 = 300;
public static int[] MINUTES_TENS = {301, 302, 303};
public static int[] MINUTES_ONES = {304, 305, 306, 307};
public static int DIVIDER_3 = 308;
public static int[] SECONDS_TENS = {309, 310, 311};
public static int[] SECONDS_ONES = {312, 313, 314, 315};
public static int DIVIDER_4 = 316;
public static int[] LATITUDE_SIGN = {317, 318};
public static int DIVIDER_5 = 319;
public static int[] LATITUDE_DEGREES_TENS = {320, 321, 322, 323};
public static int[] LATITUDE_DEGREES_ONES = {324, 325, 326, 327};
public static int DIVIDER_6 = 328;
public static int[] LATITUDE_MINUTES_TENS = {329, 330, 331};
public static int[] LATITUDE_MINUTES_ONES = {332, 333, 334, 335};
public static int[] LATITUDE_SECONDS_HUND = {336, 337, 338, 339};
public static int[] LATITUDE_SECONDS_TENS = {340, 341, 342, 344};
public static int[] LATITUDE_SECONDS_ONES = {344, 345, 346, 347};
public static int DIVIDER_7 = 348;
public static int[] LONGITUDE_SIGN = {349, 350};
public static int LONGITUDE_DEGREES_HUNDREDS = 351;
public static int[] LONGITUDE_DEGREES_TENS = {352, 353, 354, 355};
public static int[] LONGITUDE_DEGREES_ONES = {356, 357, 358, 359};
public static int DIVIDER_9 = 360;
public static int[] LONGITUDE_MINUTES_TENS = {361, 362, 363};
public static int[] LONGITUDE_MINUTES_ONES = {364, 365, 366, 367};
public static int[] LONGITUDE_SECONDS_HUND = {368, 369, 370, 371};
public static int[] LONGITUDE_SECONDS_TENS = {372, 373, 374, 375};
public static int[] LONGITUDE_SECONDS_ONES = {376, 377, 378, 379};
public static int DIVIDER_10 = 380;
public static int[] DATE_DAY_TENS = {381, 382, 383};
public static int[] DATE_DAY_ONES = {384, 385, 386, 387};
//TODO: not sure if this field is the month field or the speed field
public static int[] DATE_MONTH = { 388,389,390,391 };
public static int[] SPEED_HUNDREDS = { 388,389,390,391 };
//TODO: not sure if this field is the month field or the speed field
public static int[] DATE_MONTH = {388, 389, 390, 391};
public static int[] SPEED_HUNDREDS = {388, 389, 390, 391};
public static int[] SPEED_TENS = { 392,393,394,395 };
public static int[] SPEED_ONES = { 396,397,398,399 };
public static int[] SPEED_TENTHS = { 400,401,402,403 };
public static int[] SPEED_TENS = {392, 393, 394, 395};
public static int[] SPEED_ONES = {396, 397, 398, 399};
public static int[] SPEED_TENTHS = {400, 401, 402, 403};
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
private static SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd HHmmss");
private BinaryMessage mMessage;
private AliasList mAliasList;
private CRC mCRC;
public Tait1200GPSMessage( BinaryMessage message, AliasList list )
private TaitIdentifier mFromIdentifier;
private TaitIdentifier mToIdentifier;
private List<Identifier> mIdentifiers;
public Tait1200GPSMessage(BinaryMessage message)
{
mMessage = message;
mAliasList = list;
mMessage = message;
}
public TaitIdentifier getFromIdentifier()
{
if(mFromIdentifier == null)
{
StringBuilder sb = new StringBuilder();
sb.append(getCharacter(FROM_DIGIT_1));
sb.append(getCharacter(FROM_DIGIT_2));
sb.append(getCharacter(FROM_DIGIT_3));
sb.append(getCharacter(FROM_DIGIT_4));
sb.append(getCharacter(FROM_DIGIT_5));
sb.append(getCharacter(FROM_DIGIT_6));
sb.append(getCharacter(FROM_DIGIT_7));
sb.append(getCharacter(FROM_DIGIT_8));
mFromIdentifier = TaitIdentifier.createFrom(sb.toString().trim());
}
return mFromIdentifier;
}
public TaitIdentifier getToIdentifier()
{
if(mToIdentifier == null)
{
StringBuilder sb = new StringBuilder();
sb.append(getCharacter(TO_DIGIT_1));
sb.append(getCharacter(TO_DIGIT_2));
sb.append(getCharacter(TO_DIGIT_3));
sb.append(getCharacter(TO_DIGIT_4));
sb.append(getCharacter(TO_DIGIT_5));
sb.append(getCharacter(TO_DIGIT_6));
sb.append(getCharacter(TO_DIGIT_7));
sb.append(getCharacter(TO_DIGIT_8));
mToIdentifier = TaitIdentifier.createTo(sb.toString().trim());
}
return mToIdentifier;
}
@Override
public List<Identifier> getIdentifiers()
{
if(mIdentifiers == null)
{
mIdentifiers = new ArrayList<>();
mIdentifiers.add(getFromIdentifier());
mIdentifiers.add(getToIdentifier());
}
return mIdentifiers;
}
public boolean isValid()
{
//TODO: Override until we figure out the CRC
return true;
//TODO: Override until we figure out the CRC
return true;
}
public int getMessage1Size()
{
return mMessage.getInt( SIZE );
return mMessage.getInt(SIZE);
}
public int getMessage2Size()
{
return mMessage.getInt( SIZE_2 );
return mMessage.getInt(SIZE_2);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
sb.append( "GPS FROM:" );
sb.append( getFromID() );
sb.append( " TO:" );
sb.append( getToID() );
sb.append( " LOCATION:" );
GeoPosition location = getGPSLocation();
sb.append( location.getLatitude() );
sb.append( " " );
sb.append( location.getLongitude() );
sb.append( " SPEED:" );
sb.append( getSpeed() );
sb.append( "KPH" );
sb.append( " GPS TIME:" );
sb.append( mSDF.format( new Date( getGPSTime() ) ) );
sb.append( " " );
sb.append( mMessage.toString() );
sb.append("GPS FROM:").append(getFromIdentifier());
sb.append(" TO:").append(getToIdentifier());
sb.append(" LOCATION:");
return sb.toString();
GeoPosition location = getGPSLocation();
sb.append(location.getLatitude());
sb.append(" ");
sb.append(location.getLongitude());
sb.append(" SPEED:").append(getSpeed()).append("KPH");
sb.append(" GPS TIME:");
sb.append(mSDF.format(new Date(getGPSTime())));
sb.append(" ");
sb.append(mMessage.toString());
return sb.toString();
}
public GeoPosition getGPSLocation()
{
double latitude = mMessage.getInt( LATITUDE_DEGREES_TENS ) * 10.0d;
latitude += mMessage.getInt( LATITUDE_DEGREES_ONES );
latitude += (double)mMessage.getInt( LATITUDE_MINUTES_TENS ) / 6.0d;
latitude += (double)mMessage.getInt( LATITUDE_MINUTES_ONES ) / 60.0d;
latitude += (double)mMessage.getInt( LATITUDE_SECONDS_HUND ) / 600.0d;
latitude += (double)mMessage.getInt( LATITUDE_SECONDS_TENS ) / 6000.0d;
latitude += (double)mMessage.getInt( LATITUDE_SECONDS_ONES ) / 60000.0d;
double latitude = mMessage.getInt(LATITUDE_DEGREES_TENS) * 10.0d;
latitude += mMessage.getInt(LATITUDE_DEGREES_ONES);
latitude += (double)mMessage.getInt(LATITUDE_MINUTES_TENS) / 6.0d;
latitude += (double)mMessage.getInt(LATITUDE_MINUTES_ONES) / 60.0d;
latitude += (double)mMessage.getInt(LATITUDE_SECONDS_HUND) / 600.0d;
latitude += (double)mMessage.getInt(LATITUDE_SECONDS_TENS) / 6000.0d;
latitude += (double)mMessage.getInt(LATITUDE_SECONDS_ONES) / 60000.0d;
if( mMessage.getInt( LATITUDE_SIGN ) == 0 )
{
latitude *= -1;
}
double longitude = mMessage.get( LONGITUDE_DEGREES_HUNDREDS ) ? 100.0d : 0.0d;
if(mMessage.getInt(LATITUDE_SIGN) == 0)
{
latitude *= -1;
}
longitude += mMessage.getInt( LONGITUDE_DEGREES_TENS ) * 10.0d;
longitude += mMessage.getInt( LONGITUDE_DEGREES_ONES );
longitude += (double)mMessage.getInt( LONGITUDE_MINUTES_TENS ) / 6.0d;
longitude += (double)mMessage.getInt( LONGITUDE_MINUTES_ONES ) / 60.0d;
longitude += (double)mMessage.getInt( LONGITUDE_SECONDS_HUND ) / 600.0d;
longitude += (double)mMessage.getInt( LONGITUDE_SECONDS_TENS ) / 6000.0d;
longitude += (double)mMessage.getInt( LONGITUDE_SECONDS_ONES ) / 60000.0d;
if( mMessage.getInt( LONGITUDE_SIGN ) == 0 )
{
longitude = -1;
}
return new GeoPosition( latitude, longitude );
double longitude = mMessage.get(LONGITUDE_DEGREES_HUNDREDS) ? 100.0d : 0.0d;
longitude += mMessage.getInt(LONGITUDE_DEGREES_TENS) * 10.0d;
longitude += mMessage.getInt(LONGITUDE_DEGREES_ONES);
longitude += (double)mMessage.getInt(LONGITUDE_MINUTES_TENS) / 6.0d;
longitude += (double)mMessage.getInt(LONGITUDE_MINUTES_ONES) / 60.0d;
longitude += (double)mMessage.getInt(LONGITUDE_SECONDS_HUND) / 600.0d;
longitude += (double)mMessage.getInt(LONGITUDE_SECONDS_TENS) / 6000.0d;
longitude += (double)mMessage.getInt(LONGITUDE_SECONDS_ONES) / 60000.0d;
if(mMessage.getInt(LONGITUDE_SIGN) == 0)
{
longitude = -1;
}
return new GeoPosition(latitude, longitude);
}
public long getGPSTime()
{
Calendar cal = new GregorianCalendar( TimeZone.getTimeZone( "UTC" ) );
cal.clear();
/* Use current time to get current year */
cal.setTimeInMillis( System.currentTimeMillis() );
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
//TODO: this field is either the month field, or the speed hundredths field
cal.set( Calendar.MONTH, mMessage.getInt( DATE_MONTH ) );
int day = mMessage.getInt( DATE_DAY_TENS ) * 10 +
mMessage.getInt( DATE_DAY_ONES );
cal.set( Calendar.DAY_OF_MONTH, day );
cal.set( Calendar.HOUR_OF_DAY, ( mMessage.getInt( HOUR_TENS ) * 10 ) +
mMessage.getInt( HOUR_ONES ) );
cal.set( Calendar.MINUTE, ( mMessage.getInt( MINUTES_TENS ) * 10 ) +
mMessage.getInt( MINUTES_ONES ) );
cal.set( Calendar.SECOND, ( mMessage.getInt( SECONDS_TENS ) * 10 ) +
mMessage.getInt( SECONDS_ONES ) );
cal.set( Calendar.MILLISECOND, 0 );
return cal.getTimeInMillis();
}
public String getSpeed()
{
StringBuilder sb = new StringBuilder();
cal.clear();
sb.append( getDigit( SPEED_HUNDREDS ) );
sb.append( getDigit( SPEED_TENS ) );
sb.append( getDigit( SPEED_ONES ) );
sb.append( "." );
sb.append( getDigit( SPEED_TENTHS ) );
return sb.toString();
}
private String getDigit( int[] field )
{
int value = mMessage.getInt( field );
return ( 0 <= value && value <= 9 ) ? String.valueOf( value ) : "?";
}
@Override
public String getFromID()
{
StringBuilder sb = new StringBuilder();
sb.append( getCharacter( FROM_DIGIT_1 ) );
sb.append( getCharacter( FROM_DIGIT_2 ) );
sb.append( getCharacter( FROM_DIGIT_3 ) );
sb.append( getCharacter( FROM_DIGIT_4 ) );
sb.append( getCharacter( FROM_DIGIT_5 ) );
sb.append( getCharacter( FROM_DIGIT_6 ) );
sb.append( getCharacter( FROM_DIGIT_7 ) );
sb.append( getCharacter( FROM_DIGIT_8 ) );
return sb.toString();
}
@Override
public Alias getFromIDAlias()
{
if( mAliasList != null )
{
return mAliasList.getTalkgroupAlias( getFromID() );
}
return null;
}
@Override
public String getToID()
{
StringBuilder sb = new StringBuilder();
sb.append( getCharacter( TO_DIGIT_1 ) );
sb.append( getCharacter( TO_DIGIT_2 ) );
sb.append( getCharacter( TO_DIGIT_3 ) );
sb.append( getCharacter( TO_DIGIT_4 ) );
sb.append( getCharacter( TO_DIGIT_5 ) );
sb.append( getCharacter( TO_DIGIT_6 ) );
sb.append( getCharacter( TO_DIGIT_7 ) );
sb.append( getCharacter( TO_DIGIT_8 ) );
return sb.toString();
}
@Override
public Alias getToIDAlias()
{
if( mAliasList != null )
{
return mAliasList.getTalkgroupAlias( getToID() );
}
return null;
}
public char getCharacter( int[] bits )
{
int value = mMessage.getInt( bits );
return (char)value;
/* Use current time to get current year */
cal.setTimeInMillis(System.currentTimeMillis());
//TODO: this field is either the month field, or the speed hundredths field
cal.set(Calendar.MONTH, mMessage.getInt(DATE_MONTH));
int day = mMessage.getInt(DATE_DAY_TENS) * 10 +
mMessage.getInt(DATE_DAY_ONES);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, (mMessage.getInt(HOUR_TENS) * 10) +
mMessage.getInt(HOUR_ONES));
cal.set(Calendar.MINUTE, (mMessage.getInt(MINUTES_TENS) * 10) +
mMessage.getInt(MINUTES_ONES));
cal.set(Calendar.SECOND, (mMessage.getInt(SECONDS_TENS) * 10) +
mMessage.getInt(SECONDS_ONES));
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
}
/**
* Pads spaces onto the end of the value to make it 'places' long
*/
public String pad( String value, int places, String padCharacter )
public double getSpeed()
{
StringBuilder sb = new StringBuilder();
sb.append( value );
while( sb.length() < places )
{
sb.append( padCharacter );
}
return sb.toString();
}
/**
* Pads an integer value with additional zeroes to make it decimalPlaces long
*/
public String format( int number, int decimalPlaces )
{
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
sb.append(getDigit(SPEED_HUNDREDS));
sb.append(getDigit(SPEED_TENS));
sb.append(getDigit(SPEED_ONES));
sb.append(".");
sb.append(getDigit(SPEED_TENTHS));
int paddingRequired = decimalPlaces - ( String.valueOf( number ).length() );
try
{
return Double.parseDouble(sb.toString());
}
catch(Exception e)
{
//Do nothing, we couldn't parse the value
}
for( int x = 0; x < paddingRequired; x++)
{
sb.append( "0" );
}
sb.append( number );
return sb.toString();
}
@Override
public String getBinaryMessage()
{
return mMessage.toString();
}
@Override
public String getProtocol()
{
return "Tait-1200";
return 0;
}
@Override
public String getEventType()
private String getDigit(int[] field)
{
return "GPS";
int value = mMessage.getInt(field);
return (0 <= value && value <= 9) ? String.valueOf(value) : "?";
}
@Override
public String getMessage()
public char getCharacter(int[] bits)
{
return toString();
}
@Override
public String getErrorStatus()
{
return "UNKNOWN";
// return mCRC.getDisplayText();
int value = mMessage.getInt(bits);
return (char)value;
}
@Override
public Plottable getPlottable()
@Override
public Protocol getProtocol()
{
return new Plottable( getGPSTime(), getGPSLocation(), getFromID(),
getFromIDAlias() );
return Protocol.TAIT1200;
}
/**
* Provides a listing of aliases contained in the message.
*/
public List<Alias> getAliases()
{
List<Alias> aliases = new ArrayList<Alias>();
Alias from = getFromIDAlias();
if( from != null )
{
aliases.add( from );
}
Alias to = getToIDAlias();
if( to != null )
{
aliases.add( to );
}
return aliases;
}
}

View File

@@ -1,65 +1,61 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
******************************************************************************/
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.tait;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.bits.CorrectedBinaryMessage;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.sample.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Tait1200GPSMessageProcessor implements Listener<BinaryMessage>
public class Tait1200GPSMessageProcessor implements Listener<CorrectedBinaryMessage>
{
private final static Logger mLog =
LoggerFactory.getLogger( Tait1200GPSMessageProcessor.class );
private final static Logger mLog = LoggerFactory.getLogger(Tait1200GPSMessageProcessor.class);
private Listener<Message> mMessageListener;
private AliasList mAliasList;
public Tait1200GPSMessageProcessor( AliasList list )
{
mAliasList = list;
}
public void dispose()
{
mMessageListener = null;
mAliasList = null;
}
@Override
public void receive( BinaryMessage buffer )
private Listener<IMessage> mMessageListener;
public Tait1200GPSMessageProcessor()
{
if( mMessageListener != null )
{
mMessageListener.receive( new Tait1200GPSMessage( buffer, mAliasList ) );
}
}
public void setMessageListener( Listener<Message> listener )
public void dispose()
{
mMessageListener = listener;
mMessageListener = null;
}
@Override
public void receive(CorrectedBinaryMessage buffer)
{
if(mMessageListener != null)
{
mMessageListener.receive(new Tait1200GPSMessage(buffer));
}
}
public void setMessageListener(Listener<IMessage> listener)
{
mMessageListener = listener;
}
public void removeMessageListener()
{
mMessageListener = null;
mMessageListener = null;
}
}

View File

@@ -0,0 +1,63 @@
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.tait.identifier;
import io.github.dsheirer.identifier.Form;
import io.github.dsheirer.identifier.IdentifierClass;
import io.github.dsheirer.identifier.Role;
import io.github.dsheirer.identifier.string.StringIdentifier;
import io.github.dsheirer.protocol.Protocol;
/**
* Tait-1200 String (ASCII) Identifier
*/
public class TaitIdentifier extends StringIdentifier
{
/**
* Constructs an identifier with the specified role
*/
public TaitIdentifier(String value, Role role)
{
super(value, IdentifierClass.USER, Form.UNIT_IDENTIFIER, role);
}
@Override
public Protocol getProtocol()
{
return Protocol.TAIT1200;
}
/***
* Creates an identifier with the FROM role
*/
public static TaitIdentifier createFrom(String value)
{
return new TaitIdentifier(value, Role.FROM);
}
/***
* Creates an identifier with the TO role
*/
public static TaitIdentifier createTo(String value)
{
return new TaitIdentifier(value, Role.TO);
}
}