mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
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:
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* 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.lj1200;
|
||||
|
||||
/**
|
||||
* LoJack Function and Reply Code
|
||||
*/
|
||||
public class FunctionAndReplyCode
|
||||
{
|
||||
private LJ1200Message.Function mFunction;
|
||||
private String mReplyCode;
|
||||
|
||||
public FunctionAndReplyCode(LJ1200Message.Function function, String replyCode)
|
||||
{
|
||||
mFunction = function;
|
||||
mReplyCode = replyCode;
|
||||
}
|
||||
|
||||
public LJ1200Message.Function getFunction()
|
||||
{
|
||||
return mFunction;
|
||||
}
|
||||
|
||||
public String getReplyCode()
|
||||
{
|
||||
return mReplyCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "FUNCTION:" + mFunction + " REPLY CODE:" + mReplyCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* 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.lj1200;
|
||||
|
||||
import io.github.dsheirer.identifier.Form;
|
||||
import io.github.dsheirer.identifier.Identifier;
|
||||
import io.github.dsheirer.identifier.IdentifierClass;
|
||||
import io.github.dsheirer.identifier.Role;
|
||||
import io.github.dsheirer.protocol.Protocol;
|
||||
|
||||
public class FunctionAndReplyCodeIdentifier extends Identifier<FunctionAndReplyCode>
|
||||
{
|
||||
public FunctionAndReplyCodeIdentifier(FunctionAndReplyCode functionAndReplyCode)
|
||||
{
|
||||
super(functionAndReplyCode, IdentifierClass.NETWORK, Form.LOJACK, Role.TO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Protocol getProtocol()
|
||||
{
|
||||
return Protocol.LOJACK;
|
||||
}
|
||||
|
||||
public static FunctionAndReplyCodeIdentifier create(LJ1200Message.Function function, String replyCode)
|
||||
{
|
||||
return new FunctionAndReplyCodeIdentifier(new FunctionAndReplyCode(function, replyCode));
|
||||
}
|
||||
}
|
||||
@@ -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.lj1200;
|
||||
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
@@ -24,36 +26,26 @@ import io.github.dsheirer.module.decode.event.CallEvent;
|
||||
|
||||
public class LJ1200CallEvent extends CallEvent
|
||||
{
|
||||
public LJ1200CallEvent( CallEventType callEventType,
|
||||
AliasList aliasList,
|
||||
String fromID,
|
||||
String toID,
|
||||
String details )
|
||||
public LJ1200CallEvent(CallEventType callEventType, AliasList aliasList, String fromID, String toID, String details)
|
||||
{
|
||||
super( DecoderType.LJ_1200, callEventType,
|
||||
aliasList, fromID, toID, details );
|
||||
super(DecoderType.LJ_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 +71,30 @@ public class LJ1200CallEvent 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,29 +102,25 @@ public class LJ1200CallEvent extends CallEvent
|
||||
|
||||
public LJ1200CallEvent build()
|
||||
{
|
||||
return new LJ1200CallEvent( this );
|
||||
return new LJ1200CallEvent(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor for the builder
|
||||
*/
|
||||
private LJ1200CallEvent( Builder builder )
|
||||
private LJ1200CallEvent(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 LJ1200CallEvent getLJ1200Event( LJ1200Message message )
|
||||
|
||||
public static LJ1200CallEvent getLJ1200Event(LJ1200Message message)
|
||||
{
|
||||
CallEventType type = CallEventType.COMMAND;
|
||||
|
||||
return new LJ1200CallEvent.Builder( type )
|
||||
.to( message.getAddress() )
|
||||
.details( message.getMessage() )
|
||||
.build();
|
||||
return new LJ1200CallEvent.Builder(type).to(message.getAddress()).details(message.toString()).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.lj1200;
|
||||
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
import io.github.dsheirer.bits.IBinarySymbolProcessor;
|
||||
import io.github.dsheirer.bits.MessageFramer;
|
||||
import io.github.dsheirer.bits.SyncPattern;
|
||||
@@ -35,26 +38,26 @@ public class LJ1200Decoder extends AbstractAFSKDecoder implements IBinarySymbolP
|
||||
private MessageFramer mTransponderMessageFramer;
|
||||
private LJ1200MessageProcessor mMessageProcessor;
|
||||
|
||||
protected LJ1200Decoder(AFSK1200Decoder decoder, AliasList aliasList)
|
||||
protected LJ1200Decoder(AFSK1200Decoder decoder)
|
||||
{
|
||||
super(decoder);
|
||||
init(aliasList);
|
||||
init();
|
||||
}
|
||||
|
||||
public LJ1200Decoder(AliasList aliasList)
|
||||
public LJ1200Decoder()
|
||||
{
|
||||
super(AFSK1200Decoder.Output.NORMAL);
|
||||
init(aliasList);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
private void init(AliasList aliasList)
|
||||
private void init()
|
||||
{
|
||||
getDecoder().setSymbolProcessor(this);
|
||||
|
||||
mTowerMessageFramer = new MessageFramer(SyncPattern.LJ1200.getPattern(), MESSAGE_LENGTH);
|
||||
mTransponderMessageFramer = new MessageFramer(SyncPattern.LJ1200_TRANSPONDER.getPattern(), MESSAGE_LENGTH);
|
||||
mMessageProcessor = new LJ1200MessageProcessor(aliasList);
|
||||
mMessageProcessor = new LJ1200MessageProcessor();
|
||||
mTowerMessageFramer.addMessageListener(mMessageProcessor);
|
||||
mTransponderMessageFramer.addMessageListener(mMessageProcessor);
|
||||
mMessageProcessor.setMessageListener(getMessageListener());
|
||||
@@ -74,10 +77,10 @@ public class LJ1200Decoder extends AbstractAFSKDecoder implements IBinarySymbolP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(boolean symbol)
|
||||
public void process(boolean symbol)
|
||||
{
|
||||
mTowerMessageFramer.receive(symbol);
|
||||
mTransponderMessageFramer.receive(symbol);
|
||||
mTowerMessageFramer.process(symbol);
|
||||
mTransponderMessageFramer.process(symbol);
|
||||
}
|
||||
|
||||
public MessageFramer getTowerMessageFramer()
|
||||
|
||||
@@ -29,7 +29,7 @@ public class LJ1200DecoderInstrumented extends LJ1200Decoder implements IInstrum
|
||||
|
||||
public LJ1200DecoderInstrumented()
|
||||
{
|
||||
super(new AFSK1200DecoderInstrumented(false), null);
|
||||
super(new AFSK1200DecoderInstrumented(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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,20 +15,19 @@
|
||||
*
|
||||
* 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.lj1200;
|
||||
|
||||
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.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.DecodeEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -43,14 +43,8 @@ public class LJ1200DecoderState extends DecoderState
|
||||
|
||||
private Set<String> mAddresses = new TreeSet<String>();
|
||||
|
||||
private AliasedStringAttributeMonitor mAddressAttribute;
|
||||
|
||||
public LJ1200DecoderState(AliasList aliasList)
|
||||
public LJ1200DecoderState()
|
||||
{
|
||||
super(aliasList);
|
||||
|
||||
mAddressAttribute = new AliasedStringAttributeMonitor(Attribute.SECONDARY_ADDRESS_TO,
|
||||
getAttributeChangeRequestListener(), getAliasList(), AliasIDType.SITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,27 +54,49 @@ public class LJ1200DecoderState extends DecoderState
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
public void receive(IMessage message)
|
||||
{
|
||||
if(message instanceof LJ1200Message)
|
||||
{
|
||||
LJ1200Message lj = (LJ1200Message) message;
|
||||
LJ1200Message lj = (LJ1200Message)message;
|
||||
|
||||
if(lj.isValid())
|
||||
{
|
||||
String address = lj.getAddress();
|
||||
|
||||
mAddressAttribute.process(address);
|
||||
mAddresses.add(address);
|
||||
|
||||
broadcast(LJ1200CallEvent.getLJ1200Event(lj));
|
||||
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
|
||||
ic.remove(IdentifierClass.USER);
|
||||
ic.update(lj.getIdentifiers());
|
||||
|
||||
DecodeEvent event = DecodeEvent.builder(System.currentTimeMillis())
|
||||
.identifiers(ic)
|
||||
.channel(getCurrentChannel())
|
||||
.details("LOJACK")
|
||||
.eventDescription(lj.toString())
|
||||
.build();
|
||||
|
||||
broadcast(event);
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
}
|
||||
}
|
||||
else if(message instanceof LJ1200TransponderMessage)
|
||||
{
|
||||
LJ1200TransponderMessage transponder = (LJ1200TransponderMessage)message;
|
||||
|
||||
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
|
||||
ic.remove(IdentifierClass.USER);
|
||||
ic.update(transponder.getIdentifiers());
|
||||
|
||||
DecodeEvent transponderEvent = DecodeEvent.builder(System.currentTimeMillis())
|
||||
.identifiers(ic)
|
||||
.channel(getCurrentChannel())
|
||||
.details("LOJACK TRANSPONDER")
|
||||
.eventDescription(transponder.toString())
|
||||
.build();
|
||||
|
||||
broadcast(transponderEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +136,9 @@ public class LJ1200DecoderState extends DecoderState
|
||||
}
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
protected void resetState()
|
||||
{
|
||||
mAddressAttribute.reset();
|
||||
super.resetState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,29 +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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
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.edac.CRCLJ;
|
||||
import io.github.dsheirer.map.Plottable;
|
||||
import io.github.dsheirer.identifier.Identifier;
|
||||
import io.github.dsheirer.identifier.Role;
|
||||
import io.github.dsheirer.identifier.esn.ESNIdentifier;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import io.github.dsheirer.protocol.Protocol;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -32,388 +33,305 @@ import java.util.List;
|
||||
|
||||
public class LJ1200Message extends Message
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( LJ1200Message.class );
|
||||
|
||||
public static final String[] REPLY_CODE = { "0","1","2","3","4","5","6","7",
|
||||
"8","9","A","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S",
|
||||
"T","U","V","W","X","Y" };
|
||||
private final static Logger mLog = LoggerFactory.getLogger(LJ1200Message.class);
|
||||
|
||||
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
public static final String[] REPLY_CODE = {"0", "1", "2", "3", "4", "5", "6", "7",
|
||||
"8", "9", "A", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S",
|
||||
"T", "U", "V", "W", "X", "Y"};
|
||||
|
||||
public static int[] VRC = { 23,22,21,20,19,18,17,16 };
|
||||
|
||||
public static int[] LRC = { 31,30,29,28,27,26,25,24 };
|
||||
public static int[] SYNC = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
public static int[] VRC = {23, 22, 21, 20, 19, 18, 17, 16};
|
||||
public static int[] LRC = {31, 30, 29, 28, 27, 26, 25, 24};
|
||||
public static int[] FUNCTION = {35, 34, 33, 32};
|
||||
public static int[] ADDRESS = {63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43,
|
||||
42, 41, 40, 39, 38, 37, 36};
|
||||
public static int[] REPLY_1 = {39, 38, 37, 36, 43};
|
||||
public static int[] REPLY_2 = {42, 41, 40, 47, 46};
|
||||
public static int[] REPLY_3 = {45, 44, 51, 50, 49};
|
||||
public static int[] REPLY_4 = {48, 55, 54, 53, 52};
|
||||
public static int[] REPLY_5 = {59, 58, 57, 56, 63};
|
||||
|
||||
public static int[] FUNCTION = { 35,34,33,32 };
|
||||
public static int[] MESSAGE_CRC = {79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64};
|
||||
|
||||
public static int[] ADDRESS = { 63,62,61,60,59,58,57,56,55,54,53,52,51,50,
|
||||
49,48,47,46,45,44,43,42,41,40,39,38,37,36 };
|
||||
|
||||
public static int[] REPLY_1 = { 39,38,37,36,43 };
|
||||
public static int[] REPLY_2 = { 42,41,40,47,46 };
|
||||
public static int[] REPLY_3 = { 45,44,51,50,49 };
|
||||
public static int[] REPLY_4 = { 48,55,54,53,52 };
|
||||
public static int[] REPLY_5 = { 59,58,57,56,63 };
|
||||
|
||||
public static int[] MESSAGE_CRC = { 79,78,77,76,75,74,73,72,71,70,69,68,67,
|
||||
66,65,64 };
|
||||
|
||||
private BinaryMessage mMessage;
|
||||
private AliasList mAliasList;
|
||||
private CRC mCRC;
|
||||
|
||||
public LJ1200Message( BinaryMessage message, AliasList list )
|
||||
private FunctionAndReplyCodeIdentifier mFunctionAndReplyCodeIdentifier;
|
||||
private ESNIdentifier mTransponderIdentifier;
|
||||
private List<Identifier> mIdentifiers;
|
||||
|
||||
public LJ1200Message(BinaryMessage message)
|
||||
{
|
||||
mMessage = message;
|
||||
mAliasList = list;
|
||||
|
||||
mMessage = message;
|
||||
|
||||
checkCRC();
|
||||
|
||||
switch( mCRC )
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkCRC()
|
||||
{
|
||||
mCRC = CRCLJ.checkAndCorrect( mMessage );
|
||||
mCRC = CRCLJ.checkAndCorrect(mMessage);
|
||||
}
|
||||
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
|
||||
return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
|
||||
}
|
||||
|
||||
|
||||
public FunctionAndReplyCodeIdentifier getFunctionAndReplyCodeIdentifier()
|
||||
{
|
||||
if(mFunctionAndReplyCodeIdentifier == null)
|
||||
{
|
||||
mFunctionAndReplyCodeIdentifier = FunctionAndReplyCodeIdentifier.create(getFunction(), getReplyCode());
|
||||
}
|
||||
|
||||
return mFunctionAndReplyCodeIdentifier;
|
||||
}
|
||||
|
||||
public ESNIdentifier getTransponder()
|
||||
{
|
||||
if(mTransponderIdentifier == null)
|
||||
{
|
||||
mTransponderIdentifier = ESNIdentifier.create(getAddress(), Protocol.LOJACK, Role.TO);
|
||||
}
|
||||
|
||||
return mTransponderIdentifier;
|
||||
}
|
||||
|
||||
public String getVRC()
|
||||
{
|
||||
return mMessage.getHex( VRC, 2 );
|
||||
return mMessage.getHex(VRC, 2);
|
||||
}
|
||||
|
||||
|
||||
public String getLRC()
|
||||
{
|
||||
return mMessage.getHex( LRC, 2 );
|
||||
return mMessage.getHex(LRC, 2);
|
||||
}
|
||||
|
||||
|
||||
public String getCRC()
|
||||
{
|
||||
return mMessage.getHex( MESSAGE_CRC, 4 );
|
||||
return mMessage.getHex(MESSAGE_CRC, 4);
|
||||
}
|
||||
|
||||
|
||||
public Function getFunction()
|
||||
{
|
||||
return Function.fromValue( mMessage.getInt( FUNCTION ),
|
||||
mMessage.getInt( REPLY_3 ) );
|
||||
return Function.fromValue(mMessage.getInt(FUNCTION), mMessage.getInt(REPLY_3));
|
||||
}
|
||||
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return mMessage.getHex( ADDRESS, 7 );
|
||||
}
|
||||
|
||||
public Alias getTransponderAlias()
|
||||
{
|
||||
if( mAliasList != null )
|
||||
{
|
||||
return mAliasList.getESNAlias( getAddress() );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getFunctionAndIDAlias()
|
||||
{
|
||||
if( mAliasList != null )
|
||||
{
|
||||
return mAliasList.getLoJackAlias( getFunction(), getReplyCode() );
|
||||
}
|
||||
|
||||
return null;
|
||||
return mMessage.getHex(ADDRESS, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5 character reply code for function E and F, transponder activation.
|
||||
*
|
||||
* @return - reply code
|
||||
*/
|
||||
public String getReplyCode()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_1 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_2 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_3 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_4 ) ] );
|
||||
sb.append( REPLY_CODE[ mMessage.getInt( REPLY_5 ) ] );
|
||||
|
||||
return sb.toString();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(REPLY_CODE[mMessage.getInt(REPLY_1)]);
|
||||
sb.append(REPLY_CODE[mMessage.getInt(REPLY_2)]);
|
||||
sb.append(REPLY_CODE[mMessage.getInt(REPLY_3)]);
|
||||
sb.append(REPLY_CODE[mMessage.getInt(REPLY_4)]);
|
||||
sb.append(REPLY_CODE[mMessage.getInt(REPLY_5)]);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Function function = getFunction();
|
||||
|
||||
sb.append( "FUNCTION: " );
|
||||
sb.append( function.toString() );
|
||||
Function function = getFunction();
|
||||
|
||||
switch( function )
|
||||
{
|
||||
case F1_SITE_ID:
|
||||
sb.append( " SITE [" );
|
||||
break;
|
||||
case F1_SPEED_UP:
|
||||
case F2_TEST:
|
||||
case F3_DEACTIVATE:
|
||||
case F4_ACTIVATE:
|
||||
case FF_TRACK_PULSE:
|
||||
default:
|
||||
sb.append( " REPLY CODE [" );
|
||||
break;
|
||||
}
|
||||
|
||||
sb.append( getReplyCode() );
|
||||
sb.append("FUNCTION: ");
|
||||
sb.append(function.toString());
|
||||
|
||||
Alias site = getFunctionAndIDAlias();
|
||||
|
||||
if( site != null )
|
||||
{
|
||||
sb.append( "/" );
|
||||
sb.append( site.getName() );
|
||||
}
|
||||
|
||||
sb.append( "] ADDRESS [" );
|
||||
sb.append( getAddress() );
|
||||
sb.append( "] VRC [" + getVRC() );
|
||||
sb.append( "] LRC [" + getLRC() );
|
||||
sb.append( "] CRC [" + getCRC() );
|
||||
sb.append( "]" );
|
||||
switch(function)
|
||||
{
|
||||
case F1_SITE_ID:
|
||||
sb.append(" SITE [");
|
||||
break;
|
||||
case F1_SPEED_UP:
|
||||
case F2_TEST:
|
||||
case F3_DEACTIVATE:
|
||||
case F4_ACTIVATE:
|
||||
case FF_TRACK_PULSE:
|
||||
default:
|
||||
sb.append(" REPLY CODE [");
|
||||
break;
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
sb.append(getReplyCode());
|
||||
|
||||
sb.append("] ADDRESS [");
|
||||
sb.append(getAddress());
|
||||
sb.append("] VRC [" + getVRC());
|
||||
sb.append("] LRC [" + getLRC());
|
||||
sb.append("] CRC [" + getCRC());
|
||||
sb.append("]");
|
||||
|
||||
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 )
|
||||
public String pad(String value, int places, String padCharacter)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( value );
|
||||
|
||||
while( sb.length() < places )
|
||||
{
|
||||
sb.append( padCharacter );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
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 )
|
||||
public String format(int number, int decimalPlaces)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int paddingRequired = decimalPlaces - ( String.valueOf( number ).length() );
|
||||
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();
|
||||
}
|
||||
for(int x = 0; x < paddingRequired; x++)
|
||||
{
|
||||
sb.append("0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol()
|
||||
{
|
||||
return "LJ-1200";
|
||||
sb.append(number);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType()
|
||||
@Override
|
||||
public Protocol getProtocol()
|
||||
{
|
||||
if( getFunction() == Function.F1_SPEED_UP )
|
||||
{
|
||||
return "TRANSPONDER";
|
||||
}
|
||||
|
||||
return "TOWER";
|
||||
return Protocol.LOJACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFromID()
|
||||
public enum Function
|
||||
{
|
||||
return getReplyCode();
|
||||
/* Big Endian Format */
|
||||
F0_UNKNOWN("0-UNKNOWN"),
|
||||
F1_SITE_ID("1Y-SITE ID"),
|
||||
F1_SPEED_UP("1-SPEED UP"),
|
||||
F2_TEST("2-TOWER TEST"),
|
||||
F3_DEACTIVATE("3-DEACTIVATE"),
|
||||
F4_ACTIVATE("4-ACTIVATE"),
|
||||
F5_TRANSPONDER_TEST_REPLY("5-TRANSPONDER TEST REPLY"),
|
||||
F6_TRANSPONDER_TEST_COMMAND("6-TRANSPONDER TEST COMMAND"),
|
||||
F7_QUIET_COMMAND("7-QUIET COMMAND"),
|
||||
F8_UNKNOWN("8-UNKNOWN"),
|
||||
F9_UNKNOWN("9-UNKNOWN"),
|
||||
FA_UNKNOWN("A-UNKNOWN"),
|
||||
FB_UNKNOWN("B-UNKNOWN"),
|
||||
FC_ALT_DEACTIVATE("C-ALT-DEACTIVATE"),
|
||||
FD_UNKNOWN("D-UNKNOWN"),
|
||||
FE_UNKNOWN("E-UNKNOWN"),
|
||||
FF_TRACK_PULSE("F-TRACK PULSE"),
|
||||
|
||||
UNKNOWN("UNKNOWN");
|
||||
|
||||
private String mLabel;
|
||||
|
||||
private Function(String label)
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
public static Function fromValue(int value, int replyCodeDigit3)
|
||||
{
|
||||
switch(value)
|
||||
{
|
||||
case 0:
|
||||
return Function.F0_UNKNOWN;
|
||||
case 1:
|
||||
if(replyCodeDigit3 == 31) /* 'Y' middle character */
|
||||
{
|
||||
return Function.F1_SITE_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Function.F1_SPEED_UP;
|
||||
}
|
||||
case 2:
|
||||
return Function.F2_TEST;
|
||||
case 3:
|
||||
return Function.F3_DEACTIVATE;
|
||||
case 4:
|
||||
return Function.F4_ACTIVATE;
|
||||
case 5:
|
||||
return Function.F5_TRANSPONDER_TEST_REPLY;
|
||||
case 6:
|
||||
return Function.F6_TRANSPONDER_TEST_COMMAND;
|
||||
case 7:
|
||||
return Function.F7_QUIET_COMMAND;
|
||||
case 8:
|
||||
return Function.F8_UNKNOWN;
|
||||
case 9:
|
||||
return Function.F9_UNKNOWN;
|
||||
case 10:
|
||||
return Function.FA_UNKNOWN;
|
||||
case 11:
|
||||
return Function.FB_UNKNOWN;
|
||||
case 12:
|
||||
return Function.FC_ALT_DEACTIVATE;
|
||||
case 13:
|
||||
return Function.FD_UNKNOWN;
|
||||
case 14:
|
||||
return Function.FE_UNKNOWN;
|
||||
case 15:
|
||||
return Function.FF_TRACK_PULSE;
|
||||
default:
|
||||
return Function.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getFromIDAlias()
|
||||
@Override
|
||||
public List<Identifier> getIdentifiers()
|
||||
{
|
||||
return getFunctionAndIDAlias();
|
||||
}
|
||||
if(mIdentifiers == null)
|
||||
{
|
||||
mIdentifiers = new ArrayList<>();
|
||||
mIdentifiers.add(getFunctionAndReplyCodeIdentifier());
|
||||
mIdentifiers.add(getTransponder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToID()
|
||||
{
|
||||
return getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return null;
|
||||
return mIdentifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorStatus()
|
||||
{
|
||||
return mCRC.getDisplayText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plottable getPlottable()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum Function
|
||||
{
|
||||
/* Big Endian Format */
|
||||
F0_UNKNOWN( "0-UNKNOWN" ),
|
||||
F1_SITE_ID( "1Y-SITE ID" ),
|
||||
F1_SPEED_UP( "1-SPEED UP" ),
|
||||
F2_TEST( "2-TOWER TEST" ),
|
||||
F3_DEACTIVATE( "3-DEACTIVATE" ),
|
||||
F4_ACTIVATE( "4-ACTIVATE" ),
|
||||
F5_TRANSPONDER_TEST_REPLY( "5-TRANSPONDER TEST REPLY" ),
|
||||
F6_TRANSPONDER_TEST_COMMAND( "6-TRANSPONDER TEST COMMAND" ),
|
||||
F7_QUIET_COMMAND( "7-QUIET COMMAND" ),
|
||||
F8_UNKNOWN( "8-UNKNOWN" ),
|
||||
F9_UNKNOWN( "9-UNKNOWN" ),
|
||||
FA_UNKNOWN( "A-UNKNOWN" ),
|
||||
FB_UNKNOWN( "B-UNKNOWN" ),
|
||||
FC_ALT_DEACTIVATE( "C-ALT-DEACTIVATE" ),
|
||||
FD_UNKNOWN( "D-UNKNOWN" ),
|
||||
FE_UNKNOWN( "E-UNKNOWN" ),
|
||||
FF_TRACK_PULSE( "F-TRACK PULSE" ),
|
||||
|
||||
UNKNOWN( "UNKNOWN" );
|
||||
|
||||
private String mLabel;
|
||||
|
||||
private Function( String label )
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
public static Function fromValue( int value, int replyCodeDigit3 )
|
||||
{
|
||||
switch( value )
|
||||
{
|
||||
case 0:
|
||||
return Function.F0_UNKNOWN;
|
||||
case 1:
|
||||
if( replyCodeDigit3 == 31 ) /* 'Y' middle character */
|
||||
{
|
||||
return Function.F1_SITE_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Function.F1_SPEED_UP;
|
||||
}
|
||||
case 2:
|
||||
return Function.F2_TEST;
|
||||
case 3:
|
||||
return Function.F3_DEACTIVATE;
|
||||
case 4:
|
||||
return Function.F4_ACTIVATE;
|
||||
case 5:
|
||||
return Function.F5_TRANSPONDER_TEST_REPLY;
|
||||
case 6:
|
||||
return Function.F6_TRANSPONDER_TEST_COMMAND;
|
||||
case 7:
|
||||
return Function.F7_QUIET_COMMAND;
|
||||
case 8:
|
||||
return Function.F8_UNKNOWN;
|
||||
case 9:
|
||||
return Function.F9_UNKNOWN;
|
||||
case 10:
|
||||
return Function.FA_UNKNOWN;
|
||||
case 11:
|
||||
return Function.FB_UNKNOWN;
|
||||
case 12:
|
||||
return Function.FC_ALT_DEACTIVATE;
|
||||
case 13:
|
||||
return Function.FD_UNKNOWN;
|
||||
case 14:
|
||||
return Function.FE_UNKNOWN;
|
||||
case 15:
|
||||
return Function.FF_TRACK_PULSE;
|
||||
default:
|
||||
return Function.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a listing of aliases contained in the message.
|
||||
*/
|
||||
public List<Alias> getAliases()
|
||||
{
|
||||
List<Alias> aliases = new ArrayList<Alias>();
|
||||
|
||||
Alias functionAndID = getFunctionAndIDAlias();
|
||||
|
||||
if( functionAndID != null )
|
||||
{
|
||||
aliases.add( functionAndID );
|
||||
}
|
||||
|
||||
Alias transponder = getTransponderAlias();
|
||||
|
||||
if( transponder != null )
|
||||
{
|
||||
aliases.add( transponder );
|
||||
}
|
||||
|
||||
return aliases;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* 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/>
|
||||
******************************************************************************/
|
||||
@@ -19,35 +19,34 @@ package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
import io.github.dsheirer.filter.Filter;
|
||||
import io.github.dsheirer.filter.FilterElement;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import io.github.dsheirer.message.IMessage;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LJ1200MessageFilter extends Filter<Message>
|
||||
public class LJ1200MessageFilter extends Filter<IMessage>
|
||||
{
|
||||
|
||||
public LJ1200MessageFilter()
|
||||
{
|
||||
super( "LJ-1200 Message Filter" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean passes( Message message )
|
||||
|
||||
public LJ1200MessageFilter()
|
||||
{
|
||||
return mEnabled && canProcess( message );
|
||||
super("LJ-1200 Message Filter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProcess( Message message )
|
||||
@Override
|
||||
public boolean passes(IMessage message)
|
||||
{
|
||||
return message instanceof LJ1200Message ||
|
||||
message instanceof LJ1200TransponderMessage;
|
||||
return mEnabled && canProcess(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean canProcess(IMessage message)
|
||||
{
|
||||
return message instanceof LJ1200Message || message instanceof LJ1200TransponderMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilterElement<?>> getFilterElements()
|
||||
{
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,82 +1,78 @@
|
||||
/*******************************************************************************
|
||||
* 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.lj1200;
|
||||
|
||||
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 LJ1200MessageProcessor implements Listener<BinaryMessage>
|
||||
public class LJ1200MessageProcessor implements Listener<CorrectedBinaryMessage>
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( LJ1200MessageProcessor.class );
|
||||
private final static Logger mLog = LoggerFactory.getLogger(LJ1200MessageProcessor.class);
|
||||
|
||||
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
public static int[] SYNC = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
|
||||
public static int SYNC_TOWER = 0x550F;
|
||||
public static int SYNC_TRANSPONDER = 0x2AD5;
|
||||
public static int SYNC_TOWER = 0x550F;
|
||||
public static int SYNC_TRANSPONDER = 0x2AD5;
|
||||
|
||||
private Listener<Message> mMessageListener;
|
||||
|
||||
private AliasList mAliasList;
|
||||
|
||||
public LJ1200MessageProcessor( AliasList list )
|
||||
{
|
||||
mAliasList = list;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
mAliasList = null;
|
||||
mMessageListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( BinaryMessage buffer )
|
||||
private Listener<IMessage> mMessageListener;
|
||||
|
||||
public LJ1200MessageProcessor()
|
||||
{
|
||||
int sync = buffer.getInt( SYNC );
|
||||
|
||||
if( sync == SYNC_TOWER )
|
||||
{
|
||||
if( mMessageListener != null )
|
||||
{
|
||||
mMessageListener.receive( new LJ1200Message( buffer, mAliasList ) );
|
||||
}
|
||||
}
|
||||
else if( sync == SYNC_TRANSPONDER )
|
||||
{
|
||||
if( mMessageListener != null )
|
||||
{
|
||||
mMessageListener.receive( new LJ1200TransponderMessage( buffer, mAliasList ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageListener( Listener<Message> listener )
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
mMessageListener = listener;
|
||||
mMessageListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(CorrectedBinaryMessage message)
|
||||
{
|
||||
int sync = message.getInt(SYNC);
|
||||
|
||||
if(sync == SYNC_TOWER)
|
||||
{
|
||||
if(mMessageListener != null)
|
||||
{
|
||||
mMessageListener.receive(new LJ1200Message(message));
|
||||
}
|
||||
}
|
||||
else if(sync == SYNC_TRANSPONDER)
|
||||
{
|
||||
if(mMessageListener != null)
|
||||
{
|
||||
mMessageListener.receive(new LJ1200TransponderMessage(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageListener(Listener<IMessage> listener)
|
||||
{
|
||||
mMessageListener = listener;
|
||||
}
|
||||
|
||||
public void removeMessageListener()
|
||||
{
|
||||
mMessageListener = null;
|
||||
mMessageListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,194 +1,145 @@
|
||||
/*******************************************************************************
|
||||
* 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/>
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.module.decode.lj1200;
|
||||
|
||||
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.protocol.Protocol;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LJ1200TransponderMessage extends Message
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( LJ1200TransponderMessage.class );
|
||||
private final static Logger mLog = LoggerFactory.getLogger(LJ1200TransponderMessage.class);
|
||||
|
||||
public static int[] SYNC = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
|
||||
public static int[] SYNC = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
|
||||
public static int[] MESSAGE_CRC = { 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 };
|
||||
|
||||
private static SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
|
||||
public static int[] MESSAGE_CRC = {64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79};
|
||||
|
||||
private BinaryMessage mMessage;
|
||||
private AliasList mAliasList;
|
||||
private static SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||
|
||||
private CorrectedBinaryMessage mMessage;
|
||||
private CRC mCRC;
|
||||
|
||||
public LJ1200TransponderMessage( BinaryMessage message, AliasList list )
|
||||
|
||||
public LJ1200TransponderMessage(CorrectedBinaryMessage message)
|
||||
{
|
||||
mMessage = message;
|
||||
mAliasList = list;
|
||||
|
||||
mMessage = message;
|
||||
|
||||
checkCRC();
|
||||
|
||||
switch( mCRC )
|
||||
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;
|
||||
case UNKNOWN:
|
||||
mLog.debug( "UNKNOWN:" + message.toString() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
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;
|
||||
case UNKNOWN:
|
||||
mLog.debug("UNKNOWN:" + message.toString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkCRC()
|
||||
{
|
||||
mCRC = CRC.UNKNOWN;
|
||||
mCRC = CRC.UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
// return mCRC == CRC.PASSED || mCRC == CRC.CORRECTED;
|
||||
|
||||
/* Override validity check until proper CRC is implemented */
|
||||
return true;
|
||||
|
||||
/* Override validity check until proper CRC is implemented */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public String getCRC()
|
||||
{
|
||||
return mMessage.getHex( MESSAGE_CRC, 4 );
|
||||
return mMessage.getHex(MESSAGE_CRC, 4);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "TRANSPONDER TEST" );
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
return sb.toString();
|
||||
sb.append("TRANSPONDER TEST");
|
||||
|
||||
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 )
|
||||
public String pad(String value, int places, String padCharacter)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( value );
|
||||
|
||||
while( sb.length() < places )
|
||||
{
|
||||
sb.append( padCharacter );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
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 )
|
||||
public String format(int number, int decimalPlaces)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int paddingRequired = decimalPlaces - ( String.valueOf( number ).length() );
|
||||
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();
|
||||
}
|
||||
for(int x = 0; x < paddingRequired; x++)
|
||||
{
|
||||
sb.append("0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol()
|
||||
{
|
||||
return "LJ-1200";
|
||||
sb.append(number);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType()
|
||||
@Override
|
||||
public Protocol getProtocol()
|
||||
{
|
||||
return "TRANSPONDER";
|
||||
return Protocol.LOJACK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFromID()
|
||||
@Override
|
||||
public List<Identifier> getIdentifiers()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToID()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage()
|
||||
{
|
||||
return toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorStatus()
|
||||
{
|
||||
return mCRC.getDisplayText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plottable getPlottable()
|
||||
{
|
||||
return null;
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user