Closes issue #37 - LoJack site ID aliases are not triggering alias

actions.

-Updated LJ1200Message to return proper address, reply code and site ID
aliases.

-Update LJDecoderState and LJDecoderPanel to properly reset after a
successful decode and to correct issues with gui label coloration.
This commit is contained in:
denny
2015-12-21 19:21:50 -05:00
parent 137d35697e
commit 4a7cc2b852
3 changed files with 44 additions and 10 deletions

View File

@@ -57,6 +57,15 @@ public class LJ1200DecoderPanel extends DecoderPanel
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "" ) ); setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "" ) );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
mTo.setFont( mFontDecoder );
mTo.setForeground( mColorLabelDecoder );
mToAlias.setFont( mFontDecoder );
mToAlias.setForeground( mColorLabelDecoder );
add( mProtocol ); add( mProtocol );
add( mTo ); add( mTo );
add( mToAlias, "wrap" ); add( mToAlias, "wrap" );
@@ -76,14 +85,19 @@ public class LJ1200DecoderPanel extends DecoderPanel
mTo.setText( getDecoderState().getAddress() ); mTo.setText( getDecoderState().getAddress() );
repaint(); repaint();
break; break;
case FROM_TALKGROUP_ALIAS: case TO_TALKGROUP_ALIAS:
Alias alias = getDecoderState().getAddressAlias(); Alias alias = getDecoderState().getAddressAlias();
if( alias != null ) if( alias != null )
{ {
mToAlias.setText( alias.getName() ); mToAlias.setText( alias.getName() );
repaint();
} }
else
{
mToAlias.setText( "" );
}
repaint();
break; break;
default: default:
break; break;

View File

@@ -23,8 +23,12 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import message.Message; import message.Message;
import module.decode.DecoderType; import module.decode.DecoderType;
import module.decode.p25.P25DecoderState;
import module.decode.state.ChangedAttribute; import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderState; import module.decode.state.DecoderState;
import module.decode.state.DecoderStateEvent; import module.decode.state.DecoderStateEvent;
@@ -35,6 +39,8 @@ import alias.AliasList;
public class LJ1200DecoderState extends DecoderState public class LJ1200DecoderState extends DecoderState
{ {
private final static Logger mLog = LoggerFactory.getLogger( LJ1200DecoderState.class );
private Set<String> mAddresses = new TreeSet<String>(); private Set<String> mAddresses = new TreeSet<String>();
private String mAddress; private String mAddress;
@@ -146,16 +152,22 @@ public class LJ1200DecoderState extends DecoderState
{ {
if( event.getEvent() == Event.RESET ) if( event.getEvent() == Event.RESET )
{ {
resetState();
} }
} }
private void resetState()
{
setAddress( null );
broadcast( ChangedAttribute.TO_TALKGROUP );
setAddressAlias( null );
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
}
@Override @Override
public void reset() public void reset()
{ {
mAddresses.clear(); mAddresses.clear();
resetState();
setAddress( null );
setAddressAlias( null );
} }
} }

View File

@@ -138,11 +138,19 @@ public class LJ1200Message extends Message
public Alias getSiteAndReplyCodeAlias() public Alias getSiteAndReplyCodeAlias()
{ {
if( mAliasList != null && Function function = getFunction();
( getFunction() == Function.F1_SITE_ID ||
getFunction() == Function.F1_SPEED_UP ) ) if( mAliasList != null )
{ {
return mAliasList.getSiteID( getReplyCode() ); if( function == Function.F1_SITE_ID ||
function == Function.F1_SPEED_UP ||
function == Function.F2_TEST ||
function == Function.F3_DEACTIVATE ||
function == Function.F4_ACTIVATE ||
function == Function.FF_TRACK_PULSE )
{
return mAliasList.getSiteID( getReplyCode() );
}
} }
return null; return null;