#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,22 +1,37 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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.lj1200;
import alias.Alias;
import alias.AliasList;
import channel.metadata.Attribute;
import channel.metadata.AttributeChangeRequest;
import channel.state.DecoderState;
import channel.state.DecoderStateEvent;
import channel.state.DecoderStateEvent.Event;
import channel.state.State;
import message.Message;
import module.decode.DecoderType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -24,151 +39,138 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ScheduledExecutorService;
import message.Message;
import module.decode.DecoderType;
import channel.metadata.Attribute;
import channel.state.DecoderState;
import channel.state.DecoderStateEvent;
import channel.state.DecoderStateEvent.Event;
import channel.state.State;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import alias.Alias;
import alias.AliasList;
public class LJ1200DecoderState extends DecoderState
{
private final static Logger mLog = LoggerFactory.getLogger( LJ1200DecoderState.class );
private final static Logger mLog = LoggerFactory.getLogger(LJ1200DecoderState.class);
private Set<String> mAddresses = new TreeSet<String>();
private String mAddress;
private Alias mAddressAlias;
public LJ1200DecoderState( AliasList aliasList )
{
super( aliasList );
}
@Override
public DecoderType getDecoderType()
{
return DecoderType.LJ_1200;
}
private Set<String> mAddresses = new TreeSet<String>();
@Override
public void start( ScheduledExecutorService executor )
{
}
private String mAddress;
private Alias mAddressAlias;
@Override
public void stop()
{
}
public String getAddress()
{
return mAddress;
}
public Alias getAddressAlias()
{
return mAddressAlias;
}
@Override
public void receive( Message message )
public LJ1200DecoderState(AliasList aliasList)
{
if( message instanceof LJ1200Message )
{
LJ1200Message lj = (LJ1200Message)message;
if( lj.isValid() )
{
setAddress( lj.getAddress() );
setAddressAlias( lj.getTransponderAlias() );
mAddresses.add( mAddress );
broadcast( LJ1200CallEvent.getLJ1200Event( lj ) );
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
}
}
else if( message instanceof LJ1200TransponderMessage )
{
}
super(aliasList);
}
private void setAddress( String address )
{
mAddress = address;
broadcast( Attribute.TO_TALKGROUP );
}
@Override
public DecoderType getDecoderType()
{
return DecoderType.LJ_1200;
}
private void setAddressAlias( Alias alias )
{
mAddressAlias = alias;
broadcast( Attribute.TO_TALKGROUP_ALIAS );
}
@Override
@Override
public void start(ScheduledExecutorService executor)
{
}
@Override
public void stop()
{
}
public String getAddress()
{
return mAddress;
}
public Alias getAddressAlias()
{
return mAddressAlias;
}
@Override
public void receive(Message message)
{
if(message instanceof LJ1200Message)
{
LJ1200Message lj = (LJ1200Message) message;
if(lj.isValid())
{
setAddress(lj.getAddress());
setAddressAlias(lj.getTransponderAlias());
mAddresses.add(mAddress);
broadcast(LJ1200CallEvent.getLJ1200Event(lj));
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
}
}
else if(message instanceof LJ1200TransponderMessage)
{
}
}
private void setAddress(String address)
{
if(!StringUtils.isEqual(mAddress, address))
{
mAddress = address;
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mAddress, mAddressAlias));
}
}
private void setAddressAlias(Alias alias)
{
mAddressAlias = alias;
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mAddress, mAddressAlias));
}
@Override
public String getActivitySummary()
{
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
sb.append( "=============================\n" );
sb.append( "Decoder:\tLJ-1200I\n\n" );
sb.append("=============================\n");
sb.append("Decoder:\tLJ-1200I\n\n");
if( !mAddresses.isEmpty() )
{
sb.append( "Transponder Addresses:\n" );
List<String> addresses = new ArrayList<String>( mAddresses );
Collections.sort( addresses );
for( String address: addresses )
{
sb.append( "\t" );
sb.append( address );
sb.append( "\n" );
}
}
if(!mAddresses.isEmpty())
{
sb.append("Transponder Addresses:\n");
return sb.toString();
List<String> addresses = new ArrayList<String>(mAddresses);
Collections.sort(addresses);
for(String address : addresses)
{
sb.append("\t");
sb.append(address);
sb.append("\n");
}
}
return sb.toString();
}
@Override
public void init()
{
/* No initialization steps */
}
@Override
public void init()
{
/* No initialization steps */
}
@Override
public void receiveDecoderStateEvent( DecoderStateEvent event )
{
if( event.getEvent() == Event.RESET )
{
resetState();
}
}
private void resetState()
{
setAddress( null );
broadcast( Attribute.TO_TALKGROUP );
setAddressAlias( null );
broadcast( Attribute.TO_TALKGROUP_ALIAS );
}
@Override
public void receiveDecoderStateEvent(DecoderStateEvent event)
{
if(event.getEvent() == Event.RESET)
{
resetState();
}
}
@Override
public void reset()
{
mAddresses.clear();
resetState();
}
private void resetState()
{
mAddress = null;
mAddressAlias = null;
}
@Override
public void reset()
{
mAddresses.clear();
resetState();
}
}