mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-15 10:07:26 -05:00
#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:
@@ -20,8 +20,9 @@ package channel.metadata;
|
|||||||
|
|
||||||
public enum Attribute
|
public enum Attribute
|
||||||
{
|
{
|
||||||
CHANNEL_CONFIGURATION_LABEL_1,
|
CHANNEL_CONFIGURATION_NAME,
|
||||||
CHANNEL_CONFIGURATION_LABEL_2,
|
CHANNEL_CONFIGURATION_SITE,
|
||||||
|
CHANNEL_CONFIGURATION_SYSTEM,
|
||||||
CHANNEL_FREQUENCY,
|
CHANNEL_FREQUENCY,
|
||||||
CHANNEL_FREQUENCY_LABEL,
|
CHANNEL_FREQUENCY_LABEL,
|
||||||
CHANNEL_STATE,
|
CHANNEL_STATE,
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
case COLUMN_CONFIGURATION_NAME:
|
case COLUMN_CONFIGURATION_NAME:
|
||||||
return metadata.getChannelConfigurationLabel1();
|
return metadata.getChannelConfigurationName();
|
||||||
case COLUMN_PRIMARY_TO:
|
case COLUMN_PRIMARY_TO:
|
||||||
case COLUMN_PRIMARY_FROM:
|
case COLUMN_PRIMARY_FROM:
|
||||||
case COLUMN_SECONDARY_TO:
|
case COLUMN_SECONDARY_TO:
|
||||||
@@ -232,9 +232,11 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener
|
|||||||
{
|
{
|
||||||
switch(mutableMetadataChangeEvent.getAttribute())
|
switch(mutableMetadataChangeEvent.getAttribute())
|
||||||
{
|
{
|
||||||
case CHANNEL_CONFIGURATION_LABEL_1:
|
case CHANNEL_CONFIGURATION_SYSTEM:
|
||||||
break;
|
break;
|
||||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
case CHANNEL_CONFIGURATION_SITE:
|
||||||
|
break;
|
||||||
|
case CHANNEL_CONFIGURATION_NAME:
|
||||||
fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION_NAME);
|
fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION_NAME);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_FREQUENCY:
|
case CHANNEL_FREQUENCY:
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ public class Metadata
|
|||||||
protected DecoderType mPrimaryDecoderType;
|
protected DecoderType mPrimaryDecoderType;
|
||||||
protected boolean mSelected;
|
protected boolean mSelected;
|
||||||
protected State mState = State.IDLE;
|
protected State mState = State.IDLE;
|
||||||
protected String mChannelConfigurationLabel1;
|
protected String mChannelConfigurationSystem;
|
||||||
protected String mChannelConfigurationLabel2;
|
protected String mChannelConfigurationSite;
|
||||||
|
protected String mChannelConfigurationName;
|
||||||
protected String mChannelFrequencyLabel;
|
protected String mChannelFrequencyLabel;
|
||||||
protected long mChannelFrequency;
|
protected long mChannelFrequency;
|
||||||
protected AliasedIdentifier mNetworkID1 = new AliasedIdentifier();
|
protected AliasedIdentifier mNetworkID1 = new AliasedIdentifier();
|
||||||
@@ -233,10 +234,10 @@ public class Metadata
|
|||||||
{
|
{
|
||||||
switch(attribute)
|
switch(attribute)
|
||||||
{
|
{
|
||||||
case CHANNEL_CONFIGURATION_LABEL_1:
|
case CHANNEL_CONFIGURATION_SYSTEM:
|
||||||
return mChannelConfigurationLabel1;
|
return mChannelConfigurationSystem;
|
||||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
case CHANNEL_CONFIGURATION_SITE:
|
||||||
return mChannelConfigurationLabel2;
|
return mChannelConfigurationSite;
|
||||||
case CHANNEL_FREQUENCY_LABEL:
|
case CHANNEL_FREQUENCY_LABEL:
|
||||||
return mChannelFrequencyLabel;
|
return mChannelFrequencyLabel;
|
||||||
case CHANNEL_STATE:
|
case CHANNEL_STATE:
|
||||||
@@ -273,33 +274,49 @@ public class Metadata
|
|||||||
/**
|
/**
|
||||||
* System name from the channel configuration
|
* 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
|
* 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
|
* 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
|
* 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.mPrimaryDecoderType = mPrimaryDecoderType;
|
||||||
copy.mChannelFrequency = mChannelFrequency;
|
copy.mChannelFrequency = mChannelFrequency;
|
||||||
|
|
||||||
copy.mChannelConfigurationLabel1 = hasChannelConfigurationLabel1() ? new String(mChannelConfigurationLabel1) : null;
|
copy.mChannelConfigurationSystem = hasChannelConfigurationSystem() ? new String(mChannelConfigurationSystem) : null;
|
||||||
copy.mChannelConfigurationLabel2 = hasChannelConfigurationLabel2() ? new String(mChannelConfigurationLabel2) : null;
|
copy.mChannelConfigurationSite = hasChannelConfigurationSite() ? new String(mChannelConfigurationSite) : null;
|
||||||
|
copy.mChannelConfigurationName = hasChannelConfigurationName() ? new String(mChannelConfigurationName) : null;
|
||||||
copy.mChannelFrequencyLabel = hasChannelFrequencyLabel() ? new String(mChannelFrequencyLabel) : null;
|
copy.mChannelFrequencyLabel = hasChannelFrequencyLabel() ? new String(mChannelFrequencyLabel) : null;
|
||||||
copy.mMessage = hasMessage() ? new String(mMessage) : null;
|
copy.mMessage = hasMessage() ? new String(mMessage) : null;
|
||||||
copy.mMessageType = hasMessageType() ? new String(mMessageType) : null;
|
copy.mMessageType = hasMessageType() ? new String(mMessageType) : null;
|
||||||
|
|||||||
@@ -80,13 +80,17 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
{
|
{
|
||||||
switch(request.getAttribute())
|
switch(request.getAttribute())
|
||||||
{
|
{
|
||||||
case CHANNEL_CONFIGURATION_LABEL_1:
|
case CHANNEL_CONFIGURATION_SYSTEM:
|
||||||
mChannelConfigurationLabel1 = request.getStringValue();
|
mChannelConfigurationSystem = request.getStringValue();
|
||||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_1);
|
broadcast(Attribute.CHANNEL_CONFIGURATION_SYSTEM);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
case CHANNEL_CONFIGURATION_SITE:
|
||||||
mChannelConfigurationLabel2 = request.getStringValue();
|
mChannelConfigurationSite = request.getStringValue();
|
||||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_2);
|
broadcast(Attribute.CHANNEL_CONFIGURATION_SITE);
|
||||||
|
break;
|
||||||
|
case CHANNEL_CONFIGURATION_NAME:
|
||||||
|
mChannelConfigurationName = request.getStringValue();
|
||||||
|
broadcast(Attribute.CHANNEL_CONFIGURATION_NAME);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_FREQUENCY:
|
case CHANNEL_FREQUENCY:
|
||||||
if(request.hasValue())
|
if(request.hasValue())
|
||||||
@@ -205,16 +209,22 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
{
|
{
|
||||||
resetTemporalAttributes();
|
resetTemporalAttributes();
|
||||||
|
|
||||||
if(hasChannelConfigurationLabel1())
|
if(hasChannelConfigurationSystem())
|
||||||
{
|
{
|
||||||
mChannelConfigurationLabel1 = null;
|
mChannelConfigurationSystem = null;
|
||||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_1);
|
broadcast(Attribute.CHANNEL_CONFIGURATION_SYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasChannelConfigurationLabel2())
|
if(hasChannelConfigurationSite())
|
||||||
{
|
{
|
||||||
mChannelConfigurationLabel2 = null;
|
mChannelConfigurationSite = null;
|
||||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_2);
|
broadcast(Attribute.CHANNEL_CONFIGURATION_SITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasChannelConfigurationName())
|
||||||
|
{
|
||||||
|
mChannelConfigurationSite = null;
|
||||||
|
broadcast(Attribute.CHANNEL_CONFIGURATION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasChannelFrequencyLabel())
|
if(hasChannelFrequencyLabel())
|
||||||
|
|||||||
@@ -20,8 +20,11 @@ package channel.state;
|
|||||||
import channel.metadata.Attribute;
|
import channel.metadata.Attribute;
|
||||||
import channel.metadata.AttributeChangeRequest;
|
import channel.metadata.AttributeChangeRequest;
|
||||||
import channel.state.DecoderStateEvent.Event;
|
import channel.state.DecoderStateEvent.Event;
|
||||||
|
import gui.SDRTrunk;
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.decode.DecoderType;
|
import module.decode.DecoderType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
@@ -31,6 +34,8 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||||||
*/
|
*/
|
||||||
public class AlwaysUnsquelchedDecoderState extends DecoderState
|
public class AlwaysUnsquelchedDecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(AlwaysUnsquelchedDecoderState.class);
|
||||||
|
|
||||||
private DecoderType mDecoderType;
|
private DecoderType mDecoderType;
|
||||||
private String mChannelName;
|
private String mChannelName;
|
||||||
|
|
||||||
@@ -50,7 +55,6 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
/* No reset actions needed */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -75,7 +79,12 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
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
|
@Override
|
||||||
|
|||||||
@@ -377,8 +377,8 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder
|
|||||||
|
|
||||||
if(mState == State.FADE)
|
if(mState == State.FADE)
|
||||||
{
|
{
|
||||||
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
|
|
||||||
getMutableMetadata().resetTemporalAttributes();
|
getMutableMetadata().resetTemporalAttributes();
|
||||||
|
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = 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,
|
mMutableMetadata.receive(new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
||||||
mTrafficChannelCallEvent.getDecoderType()));
|
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();
|
String from = mTrafficChannelCallEvent.getFromID();
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,11 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
|
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
|
||||||
processingChain.getChannelState().getMutableMetadata().receive(
|
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)
|
if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -533,8 +533,6 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
TrafficChannelAllocationEvent allocationEvent =
|
TrafficChannelAllocationEvent allocationEvent =
|
||||||
(TrafficChannelAllocationEvent) event;
|
(TrafficChannelAllocationEvent) event;
|
||||||
|
|
||||||
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC"));
|
|
||||||
|
|
||||||
String channel = allocationEvent.getCallEvent().getChannel();
|
String channel = allocationEvent.getCallEvent().getChannel();
|
||||||
|
|
||||||
if(channel != null)
|
if(channel != null)
|
||||||
|
|||||||
@@ -3671,8 +3671,6 @@ public class P25DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
TrafficChannelAllocationEvent allocationEvent = (TrafficChannelAllocationEvent) event;
|
TrafficChannelAllocationEvent allocationEvent = (TrafficChannelAllocationEvent) event;
|
||||||
|
|
||||||
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC"));
|
|
||||||
|
|
||||||
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
|
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
|
||||||
|
|
||||||
mCurrentChannel = allocationEvent.getCallEvent().getChannel();
|
mCurrentChannel = allocationEvent.getCallEvent().getChannel();
|
||||||
|
|||||||
@@ -126,8 +126,9 @@ public class RecorderManager implements Listener<AudioPacket>
|
|||||||
|
|
||||||
Metadata metadata = packet.getMetadata();
|
Metadata metadata = packet.getMetadata();
|
||||||
|
|
||||||
sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() + "_" : "SYSTEM-SITE");
|
sb.append(metadata.hasChannelConfigurationSystem() ? metadata.getChannelConfigurationSystem() + "_" : "");
|
||||||
sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() : "CHANNEL");
|
sb.append(metadata.hasChannelConfigurationSite() ? metadata.getChannelConfigurationSite() + "_" : "");
|
||||||
|
sb.append(metadata.hasChannelConfigurationName() ? metadata.getChannelConfigurationName() + "_" : "");
|
||||||
|
|
||||||
if(metadata.getPrimaryAddressTo().hasIdentifier())
|
if(metadata.getPrimaryAddressTo().hasIdentifier())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user