#90 [WIP] merged metadata management for channel state, decoder states and audio metadata into a new metadata class. The new metadata class is maintained for each decoding audio channel, or in the future, a decoding TDMA channel. Audio playback, recording and streaming all use the same metadata object for the channel. The list of channel processing gui panels have been deleted and channel processing status will now reside in a table where each table row is a metadata instance from the processing channel. The channel processing manager is responsible for adding/removing the channel's metadata instance to/from the metadata table. This allows the channel processing table to be the controller for the messages, events and channel spectrum views, keyed to the selected table row metadata.

I still have to clean up the gui components and wire in the table selection listeners.
This commit is contained in:
Denny
2017-01-17 19:24:54 -05:00
parent 16b69d4aef
commit bc8873de01
67 changed files with 6207 additions and 10127 deletions

View File

@@ -1,324 +1,309 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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-2017 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 module.decode.event;
import alias.Alias;
import alias.AliasList;
import module.decode.DecoderType;
import java.text.SimpleDateFormat;
import java.util.Date;
import module.decode.DecoderType;
import alias.Alias;
import alias.AliasList;
import audio.metadata.MetadataType;
public abstract class CallEvent implements Comparable<CallEvent>
{
protected long mEventStart = System.currentTimeMillis();
protected long mEventEnd;
private SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd','HHmmss" );
protected long mEventStart = System.currentTimeMillis();
protected long mEventEnd;
protected DecoderType mDecoderType;
protected CallEventType mCallEventType;
protected AliasList mAliasList;
protected String mFromID;
protected String mToID;
protected String mDetails;
private boolean mValid = true;
public CallEvent( DecoderType decoder,
CallEventType callEventType,
AliasList aliasList,
String fromID,
String toID,
String details )
{
mDecoderType = decoder;
mCallEventType = callEventType;
mAliasList = aliasList;
mFromID = fromID;
mToID = toID;
mDetails = details;
}
/**
* Indicates if this event is valid. Use this method to mark a previously
* dispatched event as invalid and resend it so that any downstream
* processing can remove the invalid event.
*/
public void setValid( boolean valid )
{
mValid = valid;
}
private SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd','HHmmss");
public boolean isValid()
{
return mValid;
}
public void setEnd( long end )
{
mEventEnd = end;
}
public void end()
{
setEnd( System.currentTimeMillis() );
}
public DecoderType getDecoderType()
{
return mDecoderType;
}
public CallEventType getCallEventType()
{
return mCallEventType;
}
public void setCallEventType( CallEventType type )
{
mCallEventType = type;
}
protected DecoderType mDecoderType;
protected CallEventType mCallEventType;
protected AliasList mAliasList;
protected String mFromID;
protected String mToID;
protected String mDetails;
public AliasList getAliasList()
{
return mAliasList;
}
public void setAliasList( AliasList aliasList )
{
mAliasList = aliasList;
}
public boolean hasAliasList()
{
return mAliasList != null;
}
public long getEventStartTime()
{
return mEventStart;
}
public long getEventEndTime()
{
return mEventEnd;
}
public String getFromID()
{
return mFromID;
}
public boolean hasFromID()
{
return mFromID != null;
}
public MetadataType getFromIDType()
{
return MetadataType.FROM;
}
public void setFromID( String id )
{
mFromID = id;
}
public String getToID()
{
return mToID;
}
public boolean hasToID()
{
return mToID != null;
}
public void setToID( String id )
{
mToID = id;
}
private boolean mValid = true;
public MetadataType getToIDType()
{
return MetadataType.TO;
}
public String getDetails()
{
return mDetails;
}
public void setDetails( String details )
{
mDetails = details;
}
public abstract Alias getFromIDAlias();
public abstract Alias getToIDAlias();
public abstract String getChannel();
public CallEvent(DecoderType decoder, CallEventType callEventType, AliasList aliasList, String fromID,
String toID, String details)
{
mDecoderType = decoder;
mCallEventType = callEventType;
mAliasList = aliasList;
mFromID = fromID;
mToID = toID;
mDetails = details;
}
public abstract long getFrequency();
public static String getCSVHeader()
{
return "START_DATE,START_TIME,END_DATE,END_TIME,"
+ "DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,"
+ "CHANNEL,FREQUENCY,DETAILS";
}
public String toCSV()
{
StringBuilder sb = new StringBuilder();
/**
* Indicates if this event is valid. Use this method to mark a previously
* dispatched event as invalid and resend it so that any downstream
* processing can remove the invalid event.
*/
public void setValid(boolean valid)
{
mValid = valid;
}
sb.append( "'" );
sb.append( mSDF.format( new Date( getEventStartTime() ) ) );
sb.append( "','" );
if( mEventEnd != 0 )
{
sb.append( mSDF.format( new Date( getEventEndTime() ) ) );
}
else
{
sb.append( "','" );
}
sb.append( "','" );
sb.append( getDecoderType().toString() );
sb.append( "','" );
sb.append( getCallEventType().toString() );
sb.append( "'," );
if( getFromID() != null )
{
sb.append( "'" );
sb.append( getFromID() );
sb.append( "'" );
}
sb.append( "," );
Alias fromAlias = getFromIDAlias();
if( fromAlias != null )
{
sb.append( "'" );
sb.append( fromAlias.getName() );
sb.append( "'" );
}
sb.append( "," );
public boolean isValid()
{
return mValid;
}
if( getToID() != null )
{
sb.append( "'" );
sb.append( getToID() );
sb.append( "'" );
}
sb.append( "," );
Alias toAlias = getToIDAlias();
if( toAlias != null )
{
sb.append( "'" );
sb.append( toAlias.getName() );
sb.append( "'" );
}
sb.append( ",'" );
sb.append( getChannel() );
sb.append( "','" );
sb.append( getFrequency() );
sb.append( "'," );
if( getDetails() != null )
{
sb.append( "'" );
sb.append( getDetails() );
sb.append( "'" );
}
return sb.toString();
}
public enum CallEventType
{
ANNOUNCEMENT( "Announcement" ),
CALL( "Call" ),
CALL_ALERT( "Call Alert" ),
CALL_DETECT( "Call Detect" ),
CALL_DO_NOT_MONITOR( "Call-Do Not Monitor" ),
CALL_END( "Call End" ),
CALL_UNIQUE_ID( "UID Call" ),
CALL_NO_TUNER( "Call - No Tuner" ),
CALL_TIMEOUT( "Call Timeout" ),
COMMAND( "Command" ),
DATA_CALL( "Data Call" ),
DEREGISTER( "Deregister" ),
EMERGENCY( "EMERGENCY" ),
ENCRYPTED_CALL( "Encrypted Call" ),
FUNCTION( "Function" ),
GPS( "GPS" ),
GROUP_CALL( "Group Call" ),
ID_ANI( "ANI" ),
ID_UNIQUE( "Unique ID" ),
NOTIFICATION( "Notification" ),
PAGE( "Page" ),
PATCH_GROUP_ADD( "Patch Group Add"),
PATCH_GROUP_CALL( "Patch Group Call" ),
PATCH_GROUP_DELETE( "Patch Group Delete"),
QUERY( "Query" ),
REGISTER( "Register" ),
REGISTER_ESN( "ESN" ),
RESPONSE( "Response" ),
SDM( "Short Data Message" ),
STATION_ID( "Station ID" ),
STATUS( "Status" ),
TELEPHONE_INTERCONNECT( "Telephone Interconnect" ),
UNIT_TO_UNIT_CALL( "Unit To Unit Call" ),
UNKNOWN( "Unknown" ),
INVALID( "Invalid" );
private String mLabel;
private CallEventType( String label )
{
mLabel = label;
}
public String getLabel()
{
return mLabel;
}
public String toString()
{
return mLabel;
}
}
public void setEnd(long end)
{
mEventEnd = end;
}
@Override
public int compareTo( CallEvent other )
{
if( other != null && other == this )
{
return 0;
}
return Long.compare( mEventStart, other.getEventStartTime() );
}
public void end()
{
setEnd(System.currentTimeMillis());
}
public DecoderType getDecoderType()
{
return mDecoderType;
}
public CallEventType getCallEventType()
{
return mCallEventType;
}
public void setCallEventType(CallEventType type)
{
mCallEventType = type;
}
public AliasList getAliasList()
{
return mAliasList;
}
public void setAliasList(AliasList aliasList)
{
mAliasList = aliasList;
}
public boolean hasAliasList()
{
return mAliasList != null;
}
public long getEventStartTime()
{
return mEventStart;
}
public long getEventEndTime()
{
return mEventEnd;
}
public String getFromID()
{
return mFromID;
}
public boolean hasFromID()
{
return mFromID != null;
}
public void setFromID(String id)
{
mFromID = id;
}
public String getToID()
{
return mToID;
}
public boolean hasToID()
{
return mToID != null;
}
public void setToID(String id)
{
mToID = id;
}
public String getDetails()
{
return mDetails;
}
public void setDetails(String details)
{
mDetails = details;
}
public abstract Alias getFromIDAlias();
public abstract Alias getToIDAlias();
public abstract String getChannel();
public abstract long getFrequency();
public static String getCSVHeader()
{
return "START_DATE,START_TIME,END_DATE,END_TIME,DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,CHANNEL," +
"FREQUENCY,DETAILS";
}
public String toCSV()
{
StringBuilder sb = new StringBuilder();
sb.append("'");
sb.append(mSDF.format(new Date(getEventStartTime())));
sb.append("','");
if(mEventEnd != 0)
{
sb.append(mSDF.format(new Date(getEventEndTime())));
}
else
{
sb.append("','");
}
sb.append("','");
sb.append(getDecoderType().toString());
sb.append("','");
sb.append(getCallEventType().toString());
sb.append("',");
if(getFromID() != null)
{
sb.append("'");
sb.append(getFromID());
sb.append("'");
}
sb.append(",");
Alias fromAlias = getFromIDAlias();
if(fromAlias != null)
{
sb.append("'");
sb.append(fromAlias.getName());
sb.append("'");
}
sb.append(",");
if(getToID() != null)
{
sb.append("'");
sb.append(getToID());
sb.append("'");
}
sb.append(",");
Alias toAlias = getToIDAlias();
if(toAlias != null)
{
sb.append("'");
sb.append(toAlias.getName());
sb.append("'");
}
sb.append(",'");
sb.append(getChannel());
sb.append("','");
sb.append(getFrequency());
sb.append("',");
if(getDetails() != null)
{
sb.append("'");
sb.append(getDetails());
sb.append("'");
}
return sb.toString();
}
public enum CallEventType
{
ANNOUNCEMENT("Announcement"),
CALL("Call"),
CALL_ALERT("Call Alert"),
CALL_DETECT("Call Detect"),
CALL_DO_NOT_MONITOR("Call-Do Not Monitor"),
CALL_END("Call End"),
CALL_UNIQUE_ID("UID Call"),
CALL_NO_TUNER("Call - No Tuner"),
CALL_TIMEOUT("Call Timeout"),
COMMAND("Command"),
DATA_CALL("Data Call"),
DEREGISTER("Deregister"),
EMERGENCY("EMERGENCY"),
ENCRYPTED_CALL("Encrypted Call"),
FUNCTION("Function"),
GPS("GPS"),
GROUP_CALL("Group Call"),
ID_ANI("ANI"),
ID_UNIQUE("Unique ID"),
NOTIFICATION("Notification"),
PAGE("Page"),
PATCH_GROUP_ADD("Patch Group Add"),
PATCH_GROUP_CALL("Patch Group Call"),
PATCH_GROUP_DELETE("Patch Group Delete"),
QUERY("Query"),
REGISTER("Register"),
REGISTER_ESN("ESN"),
RESPONSE("Response"),
SDM("Short Data Message"),
STATION_ID("Station ID"),
STATUS("Status"),
TELEPHONE_INTERCONNECT("Telephone Interconnect"),
UNIT_TO_UNIT_CALL("Unit To Unit Call"),
UNKNOWN("Unknown"),
INVALID("Invalid");
private String mLabel;
private CallEventType(String label)
{
mLabel = label;
}
public String getLabel()
{
return mLabel;
}
public String toString()
{
return mLabel;
}
}
@Override
public int compareTo(CallEvent other)
{
if(other != null && other == this)
{
return 0;
}
return Long.compare(mEventStart, other.getEventStartTime());
}
}