mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Rebase channel/alias model redesign branch on current master
(v0.2.0.beta5)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -26,9 +26,11 @@ import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.mpt1327.MPT1327Message.IdentType;
|
||||
import module.decode.state.ChangeChannelTimeoutEvent;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
@@ -41,6 +43,8 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.map.ChannelMap;
|
||||
|
||||
@@ -60,15 +64,18 @@ public class MPT1327DecoderState extends DecoderState
|
||||
private ChannelMap mChannelMap;
|
||||
|
||||
private long mFrequency = 0;
|
||||
private long mCallTimeout;
|
||||
|
||||
public MPT1327DecoderState( AliasList aliasList, ChannelMap channelMap,
|
||||
ChannelType channelType )
|
||||
public MPT1327DecoderState( AliasList aliasList,
|
||||
ChannelMap channelMap,
|
||||
ChannelType channelType,
|
||||
long callTimeout )
|
||||
{
|
||||
super( aliasList );
|
||||
|
||||
mChannelMap = channelMap;
|
||||
|
||||
mChannelType = channelType;
|
||||
mCallTimeout = callTimeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -252,8 +259,42 @@ public class MPT1327DecoderState extends DecoderState
|
||||
|
||||
/* Traffic Channel Events */
|
||||
case CLEAR:
|
||||
mChannelNumber = mpt.getChannel();
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
||||
break;
|
||||
case MAINT:
|
||||
broadcast( new DecoderStateEvent( this, Event.END, State.END ) );
|
||||
if( mChannelType == ChannelType.STANDARD )
|
||||
{
|
||||
/**
|
||||
* When we receive a MAINT message and we're configured
|
||||
* as a standard channel, we need to apply the call
|
||||
* timeout specified by the user. Otherwise we'll
|
||||
* be using the shorter default call timeout
|
||||
*/
|
||||
broadcast( new ChangeChannelTimeoutEvent( this,
|
||||
mChannelType, mCallTimeout ) );
|
||||
|
||||
if( mCurrentCallEvent == null )
|
||||
{
|
||||
mCurrentCallEvent = new MPT1327CallEvent.Builder( CallEventType.CALL )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( mChannelNumber ) )
|
||||
.details( "MONITORED TRAFFIC CHANNEL" )
|
||||
.frequency( mFrequency )
|
||||
.to( mpt.getToID() )
|
||||
.build();
|
||||
|
||||
broadcast( mCurrentCallEvent );
|
||||
}
|
||||
|
||||
broadcast(new Metadata(MetadataType.TO,
|
||||
mpt.getToID(), mpt.getToIDAlias(), true));
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.START, State.CALL ) );
|
||||
|
||||
setToTalkgroup( mpt.getToID() );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -276,6 +317,25 @@ public class MPT1327DecoderState extends DecoderState
|
||||
|
||||
mToTalkgroup = null;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
|
||||
/**
|
||||
* If this is a standard channel, reset the fade timeout to the default
|
||||
* timeout. Once processing is underway, if we get a MAINT message,
|
||||
* this indicates we're processing a traffic channel as a standard
|
||||
* channel, so we'll issue a different call timeout then.
|
||||
*/
|
||||
if( mChannelType == ChannelType.STANDARD )
|
||||
{
|
||||
broadcast( new ChangeChannelTimeoutEvent( this, mChannelType,
|
||||
DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS * 1000 ) );
|
||||
|
||||
if( mCurrentCallEvent != null )
|
||||
{
|
||||
mCurrentCallEvent.end();
|
||||
broadcast( mCurrentCallEvent );
|
||||
mCurrentCallEvent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getSite()
|
||||
@@ -552,4 +612,4 @@ public class MPT1327DecoderState extends DecoderState
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user