#90 - updated metadata and attributes to carry channel system/site/name values to support audio recording name generation. Updated always unsquelched decoder state to reset the PRIMARY_TO address to the channel name since the decoder will never push a value to this attribute and it's needed to correctly display audio content.

This commit is contained in:
Denny
2017-01-22 06:44:07 -05:00
parent 8fb2a66411
commit a57183c4cc
10 changed files with 85 additions and 44 deletions

View File

@@ -20,8 +20,9 @@ package channel.metadata;
public enum Attribute
{
CHANNEL_CONFIGURATION_LABEL_1,
CHANNEL_CONFIGURATION_LABEL_2,
CHANNEL_CONFIGURATION_NAME,
CHANNEL_CONFIGURATION_SITE,
CHANNEL_CONFIGURATION_SYSTEM,
CHANNEL_FREQUENCY,
CHANNEL_FREQUENCY_LABEL,
CHANNEL_STATE,

View File

@@ -202,7 +202,7 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener
return null;
case COLUMN_CONFIGURATION_NAME:
return metadata.getChannelConfigurationLabel1();
return metadata.getChannelConfigurationName();
case COLUMN_PRIMARY_TO:
case COLUMN_PRIMARY_FROM:
case COLUMN_SECONDARY_TO:
@@ -232,9 +232,11 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener
{
switch(mutableMetadataChangeEvent.getAttribute())
{
case CHANNEL_CONFIGURATION_LABEL_1:
case CHANNEL_CONFIGURATION_SYSTEM:
break;
case CHANNEL_CONFIGURATION_LABEL_2:
case CHANNEL_CONFIGURATION_SITE:
break;
case CHANNEL_CONFIGURATION_NAME:
fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION_NAME);
break;
case CHANNEL_FREQUENCY:

View File

@@ -38,8 +38,9 @@ public class Metadata
protected DecoderType mPrimaryDecoderType;
protected boolean mSelected;
protected State mState = State.IDLE;
protected String mChannelConfigurationLabel1;
protected String mChannelConfigurationLabel2;
protected String mChannelConfigurationSystem;
protected String mChannelConfigurationSite;
protected String mChannelConfigurationName;
protected String mChannelFrequencyLabel;
protected long mChannelFrequency;
protected AliasedIdentifier mNetworkID1 = new AliasedIdentifier();
@@ -233,10 +234,10 @@ public class Metadata
{
switch(attribute)
{
case CHANNEL_CONFIGURATION_LABEL_1:
return mChannelConfigurationLabel1;
case CHANNEL_CONFIGURATION_LABEL_2:
return mChannelConfigurationLabel2;
case CHANNEL_CONFIGURATION_SYSTEM:
return mChannelConfigurationSystem;
case CHANNEL_CONFIGURATION_SITE:
return mChannelConfigurationSite;
case CHANNEL_FREQUENCY_LABEL:
return mChannelFrequencyLabel;
case CHANNEL_STATE:
@@ -273,33 +274,49 @@ public class Metadata
/**
* System name from the channel configuration
*/
public String getChannelConfigurationLabel1()
public String getChannelConfigurationSystem()
{
return mChannelConfigurationLabel1;
return mChannelConfigurationSystem;
}
/**
* Indicates if there is a non-null, non-empty channel configuration system value
*/
public boolean hasChannelConfigurationLabel1()
public boolean hasChannelConfigurationSystem()
{
return mChannelConfigurationLabel1 != null && !mChannelConfigurationLabel1.isEmpty();
return mChannelConfigurationSystem != null && !mChannelConfigurationSystem.isEmpty();
}
/**
* Site name from the channel configuration
*/
public String getChannelConfigurationLabel2()
public String getChannelConfigurationSite()
{
return mChannelConfigurationLabel2;
return mChannelConfigurationSite;
}
/**
* Indicates if there is a non-null, non-empty channel configuration site value
*/
public boolean hasChannelConfigurationLabel2()
public boolean hasChannelConfigurationSite()
{
return mChannelConfigurationLabel2 != null && !mChannelConfigurationLabel2.isEmpty();
return mChannelConfigurationSite != null && !mChannelConfigurationSite.isEmpty();
}
/**
* Site name from the channel configuration
*/
public String getChannelConfigurationName()
{
return mChannelConfigurationName;
}
/**
* Indicates if there is a non-null, non-empty channel configuration name value
*/
public boolean hasChannelConfigurationName()
{
return mChannelConfigurationSite != null && !mChannelConfigurationSite.isEmpty();
}
/**
@@ -621,8 +638,9 @@ public class Metadata
copy.mPrimaryDecoderType = mPrimaryDecoderType;
copy.mChannelFrequency = mChannelFrequency;
copy.mChannelConfigurationLabel1 = hasChannelConfigurationLabel1() ? new String(mChannelConfigurationLabel1) : null;
copy.mChannelConfigurationLabel2 = hasChannelConfigurationLabel2() ? new String(mChannelConfigurationLabel2) : null;
copy.mChannelConfigurationSystem = hasChannelConfigurationSystem() ? new String(mChannelConfigurationSystem) : null;
copy.mChannelConfigurationSite = hasChannelConfigurationSite() ? new String(mChannelConfigurationSite) : null;
copy.mChannelConfigurationName = hasChannelConfigurationName() ? new String(mChannelConfigurationName) : null;
copy.mChannelFrequencyLabel = hasChannelFrequencyLabel() ? new String(mChannelFrequencyLabel) : null;
copy.mMessage = hasMessage() ? new String(mMessage) : null;
copy.mMessageType = hasMessageType() ? new String(mMessageType) : null;

View File

@@ -80,13 +80,17 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
{
switch(request.getAttribute())
{
case CHANNEL_CONFIGURATION_LABEL_1:
mChannelConfigurationLabel1 = request.getStringValue();
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_1);
case CHANNEL_CONFIGURATION_SYSTEM:
mChannelConfigurationSystem = request.getStringValue();
broadcast(Attribute.CHANNEL_CONFIGURATION_SYSTEM);
break;
case CHANNEL_CONFIGURATION_LABEL_2:
mChannelConfigurationLabel2 = request.getStringValue();
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_2);
case CHANNEL_CONFIGURATION_SITE:
mChannelConfigurationSite = request.getStringValue();
broadcast(Attribute.CHANNEL_CONFIGURATION_SITE);
break;
case CHANNEL_CONFIGURATION_NAME:
mChannelConfigurationName = request.getStringValue();
broadcast(Attribute.CHANNEL_CONFIGURATION_NAME);
break;
case CHANNEL_FREQUENCY:
if(request.hasValue())
@@ -205,16 +209,22 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
{
resetTemporalAttributes();
if(hasChannelConfigurationLabel1())
if(hasChannelConfigurationSystem())
{
mChannelConfigurationLabel1 = null;
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_1);
mChannelConfigurationSystem = null;
broadcast(Attribute.CHANNEL_CONFIGURATION_SYSTEM);
}
if(hasChannelConfigurationLabel2())
if(hasChannelConfigurationSite())
{
mChannelConfigurationLabel2 = null;
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_2);
mChannelConfigurationSite = null;
broadcast(Attribute.CHANNEL_CONFIGURATION_SITE);
}
if(hasChannelConfigurationName())
{
mChannelConfigurationSite = null;
broadcast(Attribute.CHANNEL_CONFIGURATION_NAME);
}
if(hasChannelFrequencyLabel())

View File

@@ -20,8 +20,11 @@ package channel.state;
import channel.metadata.Attribute;
import channel.metadata.AttributeChangeRequest;
import channel.state.DecoderStateEvent.Event;
import gui.SDRTrunk;
import message.Message;
import module.decode.DecoderType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ScheduledExecutorService;
@@ -31,6 +34,8 @@ import java.util.concurrent.ScheduledExecutorService;
*/
public class AlwaysUnsquelchedDecoderState extends DecoderState
{
private final static Logger mLog = LoggerFactory.getLogger(AlwaysUnsquelchedDecoderState.class);
private DecoderType mDecoderType;
private String mChannelName;
@@ -50,7 +55,6 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
@Override
public void reset()
{
/* No reset actions needed */
}
@Override
@@ -75,7 +79,12 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
@Override
public void receiveDecoderStateEvent(DecoderStateEvent event)
{
/* Not implemented */
if(event.getEvent() == Event.RESET)
{
//Each time we're reset, set the PRIMARY TO attribute back to the channel name, otherwise we won't have
//a primary ID for any audio produced by this state.
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mChannelName));
}
}
@Override

View File

@@ -377,8 +377,8 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder
if(mState == State.FADE)
{
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
getMutableMetadata().resetTemporalAttributes();
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
}
mState = State.IDLE;
@@ -495,7 +495,7 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder
mMutableMetadata.receive(new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
mTrafficChannelCallEvent.getDecoderType()));
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC"));
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_NAME, "TRAFFIC"));
String from = mTrafficChannelCallEvent.getFromID();

View File

@@ -226,7 +226,11 @@ public class ChannelProcessingManager implements ChannelEventListener
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
processingChain.getChannelState().getMutableMetadata().receive(
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, channel.getName()));
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SYSTEM, channel.getSystem()));
processingChain.getChannelState().getMutableMetadata().receive(
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SITE, channel.getSite()));
processingChain.getChannelState().getMutableMetadata().receive(
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_NAME, channel.getName()));
if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER)
{

View File

@@ -533,8 +533,6 @@ public class MPT1327DecoderState extends DecoderState
TrafficChannelAllocationEvent allocationEvent =
(TrafficChannelAllocationEvent) event;
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC"));
String channel = allocationEvent.getCallEvent().getChannel();
if(channel != null)

View File

@@ -3671,8 +3671,6 @@ public class P25DecoderState extends DecoderState
{
TrafficChannelAllocationEvent allocationEvent = (TrafficChannelAllocationEvent) event;
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC"));
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
mCurrentChannel = allocationEvent.getCallEvent().getChannel();

View File

@@ -126,8 +126,9 @@ public class RecorderManager implements Listener<AudioPacket>
Metadata metadata = packet.getMetadata();
sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() + "_" : "SYSTEM-SITE");
sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() : "CHANNEL");
sb.append(metadata.hasChannelConfigurationSystem() ? metadata.getChannelConfigurationSystem() + "_" : "");
sb.append(metadata.hasChannelConfigurationSite() ? metadata.getChannelConfigurationSite() + "_" : "");
sb.append(metadata.hasChannelConfigurationName() ? metadata.getChannelConfigurationName() + "_" : "");
if(metadata.getPrimaryAddressTo().hasIdentifier())
{