mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-19 20:17:25 -05:00
#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:
1
.idea/dictionaries/denny.xml
generated
1
.idea/dictionaries/denny.xml
generated
@@ -8,6 +8,7 @@
|
|||||||
<w>icecast</w>
|
<w>icecast</w>
|
||||||
<w>ident</w>
|
<w>ident</w>
|
||||||
<w>polyphase</w>
|
<w>polyphase</w>
|
||||||
|
<w>remez</w>
|
||||||
<w>samplerate</w>
|
<w>samplerate</w>
|
||||||
<w>sdrtrunk</w>
|
<w>sdrtrunk</w>
|
||||||
<w>sheirer</w>
|
<w>sheirer</w>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package alias;
|
package alias;
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ import alias.id.siteID.SiteID;
|
|||||||
import alias.id.status.StatusID;
|
import alias.id.status.StatusID;
|
||||||
import alias.id.talkgroup.TalkgroupID;
|
import alias.id.talkgroup.TalkgroupID;
|
||||||
import alias.id.uniqueID.UniqueID;
|
import alias.id.uniqueID.UniqueID;
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import module.decode.lj1200.LJ1200Message.Function;
|
import module.decode.lj1200.LJ1200Message.Function;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -48,16 +48,16 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
public static final String WILDCARD = "*";
|
public static final String WILDCARD = "*";
|
||||||
public static final String REGEX_WILDCARD = ".";
|
public static final String REGEX_WILDCARD = ".";
|
||||||
|
|
||||||
private Map<String, Alias> mESN = new HashMap<>();
|
private Map<String,Alias> mESN = new HashMap<>();
|
||||||
private Map<String, Alias> mFleetsync = new HashMap<>();
|
private Map<String,Alias> mFleetsync = new HashMap<>();
|
||||||
private Map<LoJackFunctionAndID, Alias> mLoJack = new HashMap<>();
|
private Map<LoJackFunctionAndID,Alias> mLoJack = new HashMap<>();
|
||||||
private Map<String, Alias> mMDC1200 = new HashMap<>();
|
private Map<String,Alias> mMDC1200 = new HashMap<>();
|
||||||
private Map<String, Alias> mMobileID = new HashMap<>();
|
private Map<String,Alias> mMobileID = new HashMap<>();
|
||||||
private Map<String, Alias> mMPT1327 = new HashMap<>();
|
private Map<String,Alias> mMPT1327 = new HashMap<>();
|
||||||
private Map<String, Alias> mSiteID = new HashMap<>();
|
private Map<String,Alias> mSiteID = new HashMap<>();
|
||||||
private Map<Integer, Alias> mStatus = new HashMap<>();
|
private Map<Integer,Alias> mStatus = new HashMap<>();
|
||||||
private Map<String, Alias> mTalkgroup = new HashMap<>();
|
private Map<String,Alias> mTalkgroup = new HashMap<>();
|
||||||
private Map<Integer, Alias> mUniqueID = new HashMap<>();
|
private Map<Integer,Alias> mUniqueID = new HashMap<>();
|
||||||
|
|
||||||
private List<WildcardID> mESNWildcards = new ArrayList<>();
|
private List<WildcardID> mESNWildcards = new ArrayList<>();
|
||||||
private List<WildcardID> mMobileIDWildcards = new ArrayList<>();
|
private List<WildcardID> mMobileIDWildcards = new ArrayList<>();
|
||||||
@@ -85,9 +85,9 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
*/
|
*/
|
||||||
public void addAlias(Alias alias)
|
public void addAlias(Alias alias)
|
||||||
{
|
{
|
||||||
if (alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
for (AliasID aliasID : alias.getId())
|
for(AliasID aliasID : alias.getId())
|
||||||
{
|
{
|
||||||
addAliasID(aliasID, alias);
|
addAliasID(aliasID, alias);
|
||||||
}
|
}
|
||||||
@@ -99,18 +99,18 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
*/
|
*/
|
||||||
private void addAliasID(AliasID id, Alias alias)
|
private void addAliasID(AliasID id, Alias alias)
|
||||||
{
|
{
|
||||||
if (id.isValid())
|
if(id.isValid())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (id.getType())
|
switch(id.getType())
|
||||||
{
|
{
|
||||||
case ESN:
|
case ESN:
|
||||||
String esn = ((Esn)id).getEsn();
|
String esn = ((Esn) id).getEsn();
|
||||||
|
|
||||||
if(esn != null)
|
if(esn != null)
|
||||||
{
|
{
|
||||||
if (esn.contains(WILDCARD))
|
if(esn.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mESNWildcards.add(new WildcardID(esn));
|
mESNWildcards.add(new WildcardID(esn));
|
||||||
Collections.sort(mESNWildcards);
|
Collections.sort(mESNWildcards);
|
||||||
@@ -120,11 +120,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FLEETSYNC:
|
case FLEETSYNC:
|
||||||
String fleetsync = ((FleetsyncID)id).getIdent();
|
String fleetsync = ((FleetsyncID) id).getIdent();
|
||||||
|
|
||||||
if(fleetsync != null)
|
if(fleetsync != null)
|
||||||
{
|
{
|
||||||
if (fleetsync.contains(WILDCARD))
|
if(fleetsync.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mFleetsyncWildcards.add(new WildcardID(fleetsync));
|
mFleetsyncWildcards.add(new WildcardID(fleetsync));
|
||||||
Collections.sort(mFleetsyncWildcards);
|
Collections.sort(mFleetsyncWildcards);
|
||||||
@@ -137,11 +137,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
mLoJack.put((LoJackFunctionAndID) id, alias);
|
mLoJack.put((LoJackFunctionAndID) id, alias);
|
||||||
break;
|
break;
|
||||||
case MDC1200:
|
case MDC1200:
|
||||||
String mdc = ((MDC1200ID)id).getIdent();
|
String mdc = ((MDC1200ID) id).getIdent();
|
||||||
|
|
||||||
if(mdc != null)
|
if(mdc != null)
|
||||||
{
|
{
|
||||||
if (mdc.contains(WILDCARD))
|
if(mdc.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mMDC1200Wildcards.add(new WildcardID(mdc));
|
mMDC1200Wildcards.add(new WildcardID(mdc));
|
||||||
Collections.sort(mMDC1200Wildcards);
|
Collections.sort(mMDC1200Wildcards);
|
||||||
@@ -151,11 +151,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MPT1327:
|
case MPT1327:
|
||||||
String mpt = ((MPT1327ID)id).getIdent();
|
String mpt = ((MPT1327ID) id).getIdent();
|
||||||
|
|
||||||
if(mpt != null)
|
if(mpt != null)
|
||||||
{
|
{
|
||||||
if (mpt.contains(WILDCARD))
|
if(mpt.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mMPT1327Wildcards.add(new WildcardID(mpt));
|
mMPT1327Wildcards.add(new WildcardID(mpt));
|
||||||
Collections.sort(mMPT1327Wildcards);
|
Collections.sort(mMPT1327Wildcards);
|
||||||
@@ -165,11 +165,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MIN:
|
case MIN:
|
||||||
String min = ((Min)id).getMin();
|
String min = ((Min) id).getMin();
|
||||||
|
|
||||||
if(min != null)
|
if(min != null)
|
||||||
{
|
{
|
||||||
if (min.contains(WILDCARD))
|
if(min.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mMobileIDWildcards.add(new WildcardID(min));
|
mMobileIDWildcards.add(new WildcardID(min));
|
||||||
Collections.sort(mMobileIDWildcards);
|
Collections.sort(mMobileIDWildcards);
|
||||||
@@ -179,14 +179,14 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LTR_NET_UID:
|
case LTR_NET_UID:
|
||||||
mUniqueID.put(((UniqueID)id).getUid(), alias);
|
mUniqueID.put(((UniqueID) id).getUid(), alias);
|
||||||
break;
|
break;
|
||||||
case SITE:
|
case SITE:
|
||||||
String siteID = ((SiteID)id).getSite();
|
String siteID = ((SiteID) id).getSite();
|
||||||
|
|
||||||
if(siteID != null)
|
if(siteID != null)
|
||||||
{
|
{
|
||||||
if (siteID.contains(WILDCARD))
|
if(siteID.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mSiteWildcards.add(new WildcardID(siteID));
|
mSiteWildcards.add(new WildcardID(siteID));
|
||||||
Collections.sort(mSiteWildcards);
|
Collections.sort(mSiteWildcards);
|
||||||
@@ -199,11 +199,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
mStatus.put(((StatusID) id).getStatus(), alias);
|
mStatus.put(((StatusID) id).getStatus(), alias);
|
||||||
break;
|
break;
|
||||||
case TALKGROUP:
|
case TALKGROUP:
|
||||||
String tgid = ((TalkgroupID)id).getTalkgroup();
|
String tgid = ((TalkgroupID) id).getTalkgroup();
|
||||||
|
|
||||||
if(tgid != null)
|
if(tgid != null)
|
||||||
{
|
{
|
||||||
if (tgid.contains(WILDCARD))
|
if(tgid.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
mTalkgroupWildcards.add(new WildcardID(tgid));
|
mTalkgroupWildcards.add(new WildcardID(tgid));
|
||||||
Collections.sort(mTalkgroupWildcards);
|
Collections.sort(mTalkgroupWildcards);
|
||||||
@@ -222,7 +222,7 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
mLog.error("Couldn't add alias ID " + id + " for alias " + alias);
|
mLog.error("Couldn't add alias ID " + id + " for alias " + alias);
|
||||||
}
|
}
|
||||||
@@ -234,9 +234,9 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
*/
|
*/
|
||||||
public void removeAlias(Alias alias)
|
public void removeAlias(Alias alias)
|
||||||
{
|
{
|
||||||
if (alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
for (AliasID aliasID : alias.getId())
|
for(AliasID aliasID : alias.getId())
|
||||||
{
|
{
|
||||||
removeAliasID(aliasID, alias);
|
removeAliasID(aliasID, alias);
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
if(value != null)
|
if(value != null)
|
||||||
{
|
{
|
||||||
for(WildcardID wildcardID: wildcards)
|
for(WildcardID wildcardID : wildcards)
|
||||||
{
|
{
|
||||||
if(wildcardID.value().equals(value))
|
if(wildcardID.value().equals(value))
|
||||||
{
|
{
|
||||||
@@ -262,12 +262,12 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
*/
|
*/
|
||||||
private void removeAliasID(AliasID id, Alias alias)
|
private void removeAliasID(AliasID id, Alias alias)
|
||||||
{
|
{
|
||||||
if (id.isValid())
|
if(id.isValid())
|
||||||
{
|
{
|
||||||
switch (id.getType())
|
switch(id.getType())
|
||||||
{
|
{
|
||||||
case ESN:
|
case ESN:
|
||||||
String esn = ((Esn)id).getEsn();
|
String esn = ((Esn) id).getEsn();
|
||||||
|
|
||||||
if(esn != null)
|
if(esn != null)
|
||||||
{
|
{
|
||||||
@@ -280,13 +280,13 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
mESN.remove(esn);
|
mESN.remove(esn);
|
||||||
break;
|
break;
|
||||||
case FLEETSYNC:
|
case FLEETSYNC:
|
||||||
String fleetsync = ((FleetsyncID)id).getIdent();
|
String fleetsync = ((FleetsyncID) id).getIdent();
|
||||||
|
|
||||||
if(fleetsync != null)
|
if(fleetsync != null)
|
||||||
{
|
{
|
||||||
if(fleetsync.contains(WILDCARD))
|
if(fleetsync.contains(WILDCARD))
|
||||||
{
|
{
|
||||||
removeWildcard(fleetsync,mFleetsyncWildcards);
|
removeWildcard(fleetsync, mFleetsyncWildcards);
|
||||||
}
|
}
|
||||||
|
|
||||||
mFleetsync.remove(fleetsync);
|
mFleetsync.remove(fleetsync);
|
||||||
@@ -296,7 +296,7 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
mLoJack.remove((LoJackFunctionAndID) id);
|
mLoJack.remove((LoJackFunctionAndID) id);
|
||||||
break;
|
break;
|
||||||
case MDC1200:
|
case MDC1200:
|
||||||
String mdc = ((MDC1200ID)id).getIdent();
|
String mdc = ((MDC1200ID) id).getIdent();
|
||||||
|
|
||||||
if(mdc != null)
|
if(mdc != null)
|
||||||
{
|
{
|
||||||
@@ -309,7 +309,7 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MPT1327:
|
case MPT1327:
|
||||||
String mpt = ((MPT1327ID)id).getIdent();
|
String mpt = ((MPT1327ID) id).getIdent();
|
||||||
|
|
||||||
if(mpt != null)
|
if(mpt != null)
|
||||||
{
|
{
|
||||||
@@ -322,7 +322,7 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MIN:
|
case MIN:
|
||||||
String min = ((Min)id).getMin();
|
String min = ((Min) id).getMin();
|
||||||
|
|
||||||
if(min != null)
|
if(min != null)
|
||||||
{
|
{
|
||||||
@@ -344,7 +344,7 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
mStatus.remove(((StatusID) id).getStatus());
|
mStatus.remove(((StatusID) id).getStatus());
|
||||||
break;
|
break;
|
||||||
case TALKGROUP:
|
case TALKGROUP:
|
||||||
String tgid = ((TalkgroupID)id).getTalkgroup();
|
String tgid = ((TalkgroupID) id).getTalkgroup();
|
||||||
|
|
||||||
if(tgid != null)
|
if(tgid != null)
|
||||||
{
|
{
|
||||||
@@ -378,11 +378,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
*/
|
*/
|
||||||
private String getWildcardMatch(String id, List<WildcardID> wildcards)
|
private String getWildcardMatch(String id, List<WildcardID> wildcards)
|
||||||
{
|
{
|
||||||
if (id != null)
|
if(id != null)
|
||||||
{
|
{
|
||||||
for (WildcardID wildcard : wildcards)
|
for(WildcardID wildcard : wildcards)
|
||||||
{
|
{
|
||||||
if (wildcard.matches(id))
|
if(wildcard.matches(id))
|
||||||
{
|
{
|
||||||
return wildcard.value();
|
return wildcard.value();
|
||||||
}
|
}
|
||||||
@@ -399,15 +399,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (siteID != null)
|
if(siteID != null)
|
||||||
{
|
{
|
||||||
alias = mSiteID.get(siteID);
|
alias = mSiteID.get(siteID);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(siteID, mSiteWildcards);
|
String wildcard = getWildcardMatch(siteID, mSiteWildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mSiteID.get(wildcard);
|
alias = mSiteID.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -440,15 +440,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (esn != null)
|
if(esn != null)
|
||||||
{
|
{
|
||||||
alias = mESN.get(esn);
|
alias = mESN.get(esn);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(esn, mESNWildcards);
|
String wildcard = getWildcardMatch(esn, mESNWildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mESN.get(wildcard);
|
alias = mESN.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -465,15 +465,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (ident != null)
|
if(ident != null)
|
||||||
{
|
{
|
||||||
alias = mFleetsync.get(ident);
|
alias = mFleetsync.get(ident);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(ident, mFleetsyncWildcards);
|
String wildcard = getWildcardMatch(ident, mFleetsyncWildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mFleetsync.get(wildcard);
|
alias = mFleetsync.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -488,11 +488,11 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
*/
|
*/
|
||||||
public Alias getLoJackAlias(Function function, String id)
|
public Alias getLoJackAlias(Function function, String id)
|
||||||
{
|
{
|
||||||
if (id != null)
|
if(id != null)
|
||||||
{
|
{
|
||||||
for (LoJackFunctionAndID lojack : mLoJack.keySet())
|
for(LoJackFunctionAndID lojack : mLoJack.keySet())
|
||||||
{
|
{
|
||||||
if (lojack.matches(function, id))
|
if(lojack.matches(function, id))
|
||||||
{
|
{
|
||||||
return mLoJack.get(lojack);
|
return mLoJack.get(lojack);
|
||||||
}
|
}
|
||||||
@@ -509,15 +509,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (ident != null)
|
if(ident != null)
|
||||||
{
|
{
|
||||||
alias = mMDC1200.get(ident);
|
alias = mMDC1200.get(ident);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(ident, mMDC1200Wildcards);
|
String wildcard = getWildcardMatch(ident, mMDC1200Wildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mMDC1200.get(wildcard);
|
alias = mMDC1200.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -534,15 +534,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (ident != null)
|
if(ident != null)
|
||||||
{
|
{
|
||||||
alias = mMPT1327.get(ident);
|
alias = mMPT1327.get(ident);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(ident, mMPT1327Wildcards);
|
String wildcard = getWildcardMatch(ident, mMPT1327Wildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mMPT1327.get(wildcard);
|
alias = mMPT1327.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -559,15 +559,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (ident != null)
|
if(ident != null)
|
||||||
{
|
{
|
||||||
alias = mMobileID.get(ident);
|
alias = mMobileID.get(ident);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(ident, mMobileIDWildcards);
|
String wildcard = getWildcardMatch(ident, mMobileIDWildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mMobileID.get(wildcard);
|
alias = mMobileID.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -584,15 +584,15 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = null;
|
Alias alias = null;
|
||||||
|
|
||||||
if (tgid != null)
|
if(tgid != null)
|
||||||
{
|
{
|
||||||
alias = mTalkgroup.get(tgid);
|
alias = mTalkgroup.get(tgid);
|
||||||
|
|
||||||
if (alias == null)
|
if(alias == null)
|
||||||
{
|
{
|
||||||
String wildcard = getWildcardMatch(tgid, mTalkgroupWildcards);
|
String wildcard = getWildcardMatch(tgid, mTalkgroupWildcards);
|
||||||
|
|
||||||
if (wildcard != null)
|
if(wildcard != null)
|
||||||
{
|
{
|
||||||
alias = mTalkgroup.get(wildcard);
|
alias = mTalkgroup.get(wildcard);
|
||||||
}
|
}
|
||||||
@@ -619,61 +619,6 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Lookup an alias by metadata type and string value
|
|
||||||
*/
|
|
||||||
public Alias getAlias(String value, MetadataType type)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case ESN:
|
|
||||||
return getESNAlias(value);
|
|
||||||
case FLEETSYNC:
|
|
||||||
return getFleetsyncAlias(value);
|
|
||||||
case MDC1200:
|
|
||||||
return getMDC1200Alias(value);
|
|
||||||
case MOBILE_ID:
|
|
||||||
return getMobileIDNumberAlias(value);
|
|
||||||
case MPT1327:
|
|
||||||
return getMPT1327Alias(value);
|
|
||||||
case SITE_ID:
|
|
||||||
return getSiteID(value);
|
|
||||||
case STATUS:
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return getStatus(Integer.valueOf(value));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//do nothing, we couldn't parse the int value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM:
|
|
||||||
case TO:
|
|
||||||
return getTalkgroupAlias(value);
|
|
||||||
case UNIQUE_ID:
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return getUniqueID(Integer.valueOf(value));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//do nothing, we couldn't parse the int value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive alias change event notifications and modify this list accordingly
|
* Receive alias change event notifications and modify this list accordingly
|
||||||
*/
|
*/
|
||||||
@@ -682,22 +627,22 @@ public class AliasList implements Listener<AliasEvent>
|
|||||||
{
|
{
|
||||||
Alias alias = event.getAlias();
|
Alias alias = event.getAlias();
|
||||||
|
|
||||||
switch (event.getEvent())
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case ADD:
|
case ADD:
|
||||||
if (alias.getList() != null && getName().equalsIgnoreCase(alias.getList()))
|
if(alias.getList() != null && getName().equalsIgnoreCase(alias.getList()))
|
||||||
{
|
{
|
||||||
addAlias(alias);
|
addAlias(alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CHANGE:
|
case CHANGE:
|
||||||
if (alias.getList() != null && getName().equalsIgnoreCase(alias.getList()))
|
if(alias.getList() != null && getName().equalsIgnoreCase(alias.getList()))
|
||||||
{
|
{
|
||||||
addAlias(alias);
|
addAlias(alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DELETE:
|
case DELETE:
|
||||||
if (alias.getList() != null && getName().equalsIgnoreCase(alias.getList()))
|
if(alias.getList() != null && getName().equalsIgnoreCase(alias.getList()))
|
||||||
{
|
{
|
||||||
removeAlias(alias);
|
removeAlias(alias);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,8 @@
|
|||||||
package audio;
|
package audio;
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
import audio.metadata.AudioMetadata;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import audio.output.AudioOutput;
|
import audio.output.AudioOutput;
|
||||||
|
import channel.metadata.Metadata;
|
||||||
import icon.IconManager;
|
import icon.IconManager;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
@@ -50,12 +48,12 @@ public class AudioChannelPanel extends JPanel
|
|||||||
|
|
||||||
private JLabel mChannelName = new JLabel(" ");
|
private JLabel mChannelName = new JLabel(" ");
|
||||||
private JLabel mToLabel = new JLabel("TO:");
|
private JLabel mToLabel = new JLabel("TO:");
|
||||||
private JLabel mTo = new JLabel("");
|
private JLabel mTo = new JLabel("-----");
|
||||||
private JLabel mToAlias = new JLabel("");
|
private JLabel mToAlias = new JLabel("");
|
||||||
|
|
||||||
private JLabel mMutedLabel = new JLabel(" ");
|
private JLabel mMutedLabel = new JLabel(" ");
|
||||||
private JLabel mFromLabel = new JLabel("FROM:");
|
private JLabel mFromLabel = new JLabel("FROM:");
|
||||||
private JLabel mFrom = new JLabel("");
|
private JLabel mFrom = new JLabel("-----");
|
||||||
private JLabel mFromAlias = new JLabel("");
|
private JLabel mFromAlias = new JLabel("");
|
||||||
|
|
||||||
private boolean mConfigured = false;
|
private boolean mConfigured = false;
|
||||||
@@ -71,7 +69,7 @@ public class AudioChannelPanel extends JPanel
|
|||||||
if(mAudioOutput != null)
|
if(mAudioOutput != null)
|
||||||
{
|
{
|
||||||
mAudioOutput.addAudioEventListener(this);
|
mAudioOutput.addAudioEventListener(this);
|
||||||
mAudioOutput.setAudioMetadataListener(new AudioMetadataProcessor());
|
mAudioOutput.setMetadataListener(new AudioMetadataProcessor());
|
||||||
}
|
}
|
||||||
|
|
||||||
mLabelColor = mSettingsManager.getColorSetting(
|
mLabelColor = mSettingsManager.getColorSetting(
|
||||||
@@ -173,11 +171,8 @@ public class AudioChannelPanel extends JPanel
|
|||||||
*/
|
*/
|
||||||
private void resetLabels()
|
private void resetLabels()
|
||||||
{
|
{
|
||||||
mFrom.setText("");
|
updateLabel(mFromLabel, null, mFromAlias, null);
|
||||||
updateAlias(mFromAlias, null);
|
updateLabel(mToLabel, null, mToAlias, null);
|
||||||
|
|
||||||
mTo.setText("");
|
|
||||||
updateAlias(mToAlias, null);
|
|
||||||
|
|
||||||
mConfigured = false;
|
mConfigured = false;
|
||||||
}
|
}
|
||||||
@@ -187,27 +182,25 @@ public class AudioChannelPanel extends JPanel
|
|||||||
* does not occur on the Swing event thread -- wrap any calls to this
|
* does not occur on the Swing event thread -- wrap any calls to this
|
||||||
* method with an event thread call.
|
* method with an event thread call.
|
||||||
*/
|
*/
|
||||||
private void updateAlias(JLabel label, Alias alias)
|
private void updateLabel(JLabel valueLabel, String value, JLabel aliasLabel, Alias alias)
|
||||||
{
|
{
|
||||||
|
if(value != null)
|
||||||
|
{
|
||||||
|
valueLabel.setText(value);
|
||||||
|
|
||||||
if(alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
label.setText(alias.getName());
|
aliasLabel.setIcon(mIconManager.getIcon(alias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
|
||||||
String icon = alias.getIconName();
|
|
||||||
|
|
||||||
if(icon != null)
|
|
||||||
{
|
|
||||||
label.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label.setIcon(null);
|
aliasLabel.setIcon(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label.setText("");
|
valueLabel.setText("-----");
|
||||||
label.setIcon(null);
|
aliasLabel.setIcon(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,45 +208,28 @@ public class AudioChannelPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Processes audio metadata to update this panel's display values
|
* Processes audio metadata to update this panel's display values
|
||||||
*/
|
*/
|
||||||
public class AudioMetadataProcessor implements Listener<AudioMetadata>
|
public class AudioMetadataProcessor implements Listener<Metadata>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void receive(AudioMetadata audioMetadata)
|
public void receive(final Metadata metadata)
|
||||||
{
|
{
|
||||||
if(!mConfigured || audioMetadata.isUpdated())
|
if(metadata.isUpdated() || !mConfigured)
|
||||||
{
|
{
|
||||||
final Metadata from = audioMetadata.getMetadata(MetadataType.FROM);
|
|
||||||
|
|
||||||
final Metadata to = audioMetadata.getMetadata(MetadataType.TO);
|
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if(from != null)
|
updateLabel(mFromLabel, metadata.getPrimaryAddressFrom().getIdentifier(),
|
||||||
{
|
mFromAlias, metadata.getPrimaryAddressFrom().getAlias());
|
||||||
mFrom.setText(from.getValue());
|
|
||||||
updateAlias(mFromAlias, from.getAlias());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrom.setText("-----");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(to != null)
|
updateLabel(mToLabel, metadata.getPrimaryAddressTo().getIdentifier(),
|
||||||
{
|
mToAlias, metadata.getPrimaryAddressTo().getAlias());
|
||||||
mTo.setText(to.getValue());
|
|
||||||
updateAlias(mToAlias, to.getAlias());
|
mConfigured = true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTo.setText("-----");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mConfigured = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,27 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package audio;
|
package audio;
|
||||||
|
|
||||||
|
import audio.AudioEvent.Type;
|
||||||
|
import audio.output.AudioOutput;
|
||||||
|
import audio.output.MonoAudioOutput;
|
||||||
|
import audio.output.StereoAudioOutput;
|
||||||
|
import controller.ThreadPoolManager;
|
||||||
|
import controller.ThreadPoolManager.ThreadType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import properties.SystemProperties;
|
||||||
|
import sample.Broadcaster;
|
||||||
|
import sample.Listener;
|
||||||
|
import source.mixer.MixerChannel;
|
||||||
|
import source.mixer.MixerChannelConfiguration;
|
||||||
|
import source.mixer.MixerManager;
|
||||||
|
|
||||||
|
import javax.sound.sampled.AudioSystem;
|
||||||
|
import javax.sound.sampled.Mixer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -27,28 +45,9 @@ import java.util.concurrent.LinkedTransferQueue;
|
|||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioSystem;
|
|
||||||
import javax.sound.sampled.Mixer;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import properties.SystemProperties;
|
|
||||||
import sample.Broadcaster;
|
|
||||||
import sample.Listener;
|
|
||||||
import source.mixer.MixerChannel;
|
|
||||||
import source.mixer.MixerChannelConfiguration;
|
|
||||||
import source.mixer.MixerManager;
|
|
||||||
import audio.AudioEvent.Type;
|
|
||||||
import audio.output.AudioOutput;
|
|
||||||
import audio.output.MonoAudioOutput;
|
|
||||||
import audio.output.StereoAudioOutput;
|
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
import controller.ThreadPoolManager.ThreadType;
|
|
||||||
|
|
||||||
public class AudioManager implements Listener<AudioPacket>, IAudioController
|
public class AudioManager implements Listener<AudioPacket>, IAudioController
|
||||||
{
|
{
|
||||||
private static final Logger mLog = LoggerFactory.getLogger( AudioManager.class );
|
private static final Logger mLog = LoggerFactory.getLogger(AudioManager.class);
|
||||||
|
|
||||||
public static final int AUDIO_TIMEOUT = 1000; //1 second
|
public static final int AUDIO_TIMEOUT = 1000; //1 second
|
||||||
|
|
||||||
@@ -56,10 +55,10 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
public static final String AUDIO_MIXER_PROPERTY = "audio.manager.mixer";
|
public static final String AUDIO_MIXER_PROPERTY = "audio.manager.mixer";
|
||||||
|
|
||||||
public static final AudioEvent CONFIGURATION_CHANGE_STARTED =
|
public static final AudioEvent CONFIGURATION_CHANGE_STARTED =
|
||||||
new AudioEvent( Type.AUDIO_CONFIGURATION_CHANGE_STARTED, null );
|
new AudioEvent(Type.AUDIO_CONFIGURATION_CHANGE_STARTED, null);
|
||||||
|
|
||||||
public static final AudioEvent CONFIGURATION_CHANGE_COMPLETE =
|
public static final AudioEvent CONFIGURATION_CHANGE_COMPLETE =
|
||||||
new AudioEvent( Type.AUDIO_CONFIGURATION_CHANGE_COMPLETE, null );
|
new AudioEvent(Type.AUDIO_CONFIGURATION_CHANGE_COMPLETE, null);
|
||||||
|
|
||||||
private LinkedTransferQueue<AudioPacket> mAudioPacketQueue = new LinkedTransferQueue<>();
|
private LinkedTransferQueue<AudioPacket> mAudioPacketQueue = new LinkedTransferQueue<>();
|
||||||
private Map<Integer,AudioOutputConnection> mChannelConnectionMap = new HashMap<>();
|
private Map<Integer,AudioOutputConnection> mChannelConnectionMap = new HashMap<>();
|
||||||
@@ -82,7 +81,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
* packets to any combination of outputs based on any alias audio routing
|
* packets to any combination of outputs based on any alias audio routing
|
||||||
* options specified by the user.
|
* options specified by the user.
|
||||||
*/
|
*/
|
||||||
public AudioManager( ThreadPoolManager manager, MixerManager mixerManager )
|
public AudioManager(ThreadPoolManager manager, MixerManager mixerManager)
|
||||||
{
|
{
|
||||||
mThreadPoolManager = manager;
|
mThreadPoolManager = manager;
|
||||||
mMixerManager = mixerManager;
|
mMixerManager = mixerManager;
|
||||||
@@ -96,44 +95,44 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
|
|
||||||
SystemProperties properties = SystemProperties.getInstance();
|
SystemProperties properties = SystemProperties.getInstance();
|
||||||
|
|
||||||
Mixer defaultMixer = AudioSystem.getMixer( null );
|
Mixer defaultMixer = AudioSystem.getMixer(null);
|
||||||
|
|
||||||
String mixer = properties.get( AUDIO_MIXER_PROPERTY, defaultMixer.getMixerInfo().getName() );
|
String mixer = properties.get(AUDIO_MIXER_PROPERTY, defaultMixer.getMixerInfo().getName());
|
||||||
|
|
||||||
String channels = properties.get( AUDIO_CHANNELS_PROPERTY, MixerChannel.MONO.name() );
|
String channels = properties.get(AUDIO_CHANNELS_PROPERTY, MixerChannel.MONO.name());
|
||||||
|
|
||||||
MixerChannelConfiguration[] mixerConfigurations = mMixerManager.getOutputMixers();
|
MixerChannelConfiguration[] mixerConfigurations = mMixerManager.getOutputMixers();
|
||||||
|
|
||||||
for( MixerChannelConfiguration mixerConfig: mixerConfigurations )
|
for(MixerChannelConfiguration mixerConfig : mixerConfigurations)
|
||||||
{
|
{
|
||||||
if( mixerConfig.matches( mixer, channels ) )
|
if(mixerConfig.matches(mixer, channels))
|
||||||
{
|
{
|
||||||
configuration = mixerConfig;
|
configuration = mixerConfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( configuration == null )
|
if(configuration == null)
|
||||||
{
|
{
|
||||||
configuration = getDefaultConfiguration();
|
configuration = getDefaultConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setMixerChannelConfiguration( configuration );
|
setMixerChannelConfiguration(configuration);
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
mLog.error( "Couldn't set stored audio mixer/channel configuration"
|
mLog.error("Couldn't set stored audio mixer/channel configuration"
|
||||||
+ " - using default", e );
|
+ " - using default", e);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setMixerChannelConfiguration( getDefaultConfiguration() );
|
setMixerChannelConfiguration(getDefaultConfiguration());
|
||||||
}
|
}
|
||||||
catch( Exception e2 )
|
catch(Exception e2)
|
||||||
{
|
{
|
||||||
mLog.error( "Couldn't set default audio mixer/channel "
|
mLog.error("Couldn't set default audio mixer/channel "
|
||||||
+ "configuration - no audio will be available", e2 );
|
+ "configuration - no audio will be available", e2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,16 +140,16 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
private MixerChannelConfiguration getDefaultConfiguration()
|
private MixerChannelConfiguration getDefaultConfiguration()
|
||||||
{
|
{
|
||||||
/* Use the system default mixer and mono channel as default startup */
|
/* Use the system default mixer and mono channel as default startup */
|
||||||
Mixer defaultMixer = AudioSystem.getMixer( null );
|
Mixer defaultMixer = AudioSystem.getMixer(null);
|
||||||
|
|
||||||
return new MixerChannelConfiguration( defaultMixer, MixerChannel.MONO );
|
return new MixerChannelConfiguration(defaultMixer, MixerChannel.MONO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
if( mThreadPoolManager != null && mProcessingTask != null )
|
if(mThreadPoolManager != null && mProcessingTask != null)
|
||||||
{
|
{
|
||||||
mThreadPoolManager.cancel( mProcessingTask );
|
mThreadPoolManager.cancel(mProcessingTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAudioPacketQueue.clear();
|
mAudioPacketQueue.clear();
|
||||||
@@ -160,7 +159,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
|
|
||||||
mChannelConnectionMap.clear();
|
mChannelConnectionMap.clear();
|
||||||
|
|
||||||
for( AudioOutputConnection connection: mAudioOutputConnections )
|
for(AudioOutputConnection connection : mAudioOutputConnections)
|
||||||
{
|
{
|
||||||
connection.dispose();
|
connection.dispose();
|
||||||
}
|
}
|
||||||
@@ -169,9 +168,9 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void receive( AudioPacket packet )
|
public synchronized void receive(AudioPacket packet)
|
||||||
{
|
{
|
||||||
mAudioPacketQueue.add( packet );
|
mAudioPacketQueue.add(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,18 +180,18 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
{
|
{
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
for( AudioOutputConnection connection: mAudioOutputConnections )
|
for(AudioOutputConnection connection : mAudioOutputConnections)
|
||||||
{
|
{
|
||||||
if( connection.isInactive() &&
|
if(connection.isInactive() &&
|
||||||
mChannelConnectionMap.containsKey( connection.getSource() ) )
|
mChannelConnectionMap.containsKey(connection.getChannelMetadataID()))
|
||||||
{
|
{
|
||||||
mChannelConnectionMap.remove( connection.getSource() );
|
mChannelConnectionMap.remove(connection.getChannelMetadataID());
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( changed )
|
if(changed)
|
||||||
{
|
{
|
||||||
updateLowestPriorityAssignment();
|
updateLowestPriorityAssignment();
|
||||||
}
|
}
|
||||||
@@ -205,11 +204,10 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
{
|
{
|
||||||
mLowestPriorityConnection = null;
|
mLowestPriorityConnection = null;
|
||||||
|
|
||||||
for( AudioOutputConnection connection: mAudioOutputConnections )
|
for(AudioOutputConnection connection : mAudioOutputConnections)
|
||||||
{
|
{
|
||||||
if( connection.isConnected() &&
|
if(connection.isConnected() &&
|
||||||
( mLowestPriorityConnection == null ||
|
(mLowestPriorityConnection == null || mLowestPriorityConnection.getPriority() > connection.getPriority()))
|
||||||
mLowestPriorityConnection.getPriority() > connection.getPriority() ) )
|
|
||||||
{
|
{
|
||||||
mLowestPriorityConnection = connection;
|
mLowestPriorityConnection = connection;
|
||||||
}
|
}
|
||||||
@@ -217,58 +215,55 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMixerChannelConfiguration( MixerChannelConfiguration entry ) throws AudioException
|
public void setMixerChannelConfiguration(MixerChannelConfiguration entry) throws AudioException
|
||||||
{
|
{
|
||||||
if( entry != null &&
|
if(entry != null &&
|
||||||
( entry.getMixerChannel() == MixerChannel.MONO ||
|
(entry.getMixerChannel() == MixerChannel.MONO || entry.getMixerChannel() == MixerChannel.STEREO))
|
||||||
entry.getMixerChannel() == MixerChannel.STEREO ) )
|
|
||||||
{
|
{
|
||||||
mControllerBroadcaster.broadcast( CONFIGURATION_CHANGE_STARTED );
|
mControllerBroadcaster.broadcast(CONFIGURATION_CHANGE_STARTED);
|
||||||
|
|
||||||
if( mThreadPoolManager != null && mProcessingTask != null )
|
if(mThreadPoolManager != null && mProcessingTask != null)
|
||||||
{
|
{
|
||||||
mThreadPoolManager.cancel( mProcessingTask );
|
mThreadPoolManager.cancel(mProcessingTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
disposeCurrentConfiguration();
|
disposeCurrentConfiguration();
|
||||||
|
|
||||||
switch( entry.getMixerChannel() )
|
switch(entry.getMixerChannel())
|
||||||
{
|
{
|
||||||
case MONO:
|
case MONO:
|
||||||
AudioOutput mono = new MonoAudioOutput( mThreadPoolManager,
|
AudioOutput mono = new MonoAudioOutput(mThreadPoolManager,
|
||||||
entry.getMixer() );
|
entry.getMixer());
|
||||||
mAudioOutputConnections.add( new AudioOutputConnection( mono ) );
|
mAudioOutputConnections.add(new AudioOutputConnection(mono));
|
||||||
mAvailableConnectionCount++;
|
mAvailableConnectionCount++;
|
||||||
mAudioOutputMap.put( mono.getChannelName(), mono );
|
mAudioOutputMap.put(mono.getChannelName(), mono);
|
||||||
break;
|
break;
|
||||||
case STEREO:
|
case STEREO:
|
||||||
AudioOutput left = new StereoAudioOutput( mThreadPoolManager,
|
AudioOutput left = new StereoAudioOutput(mThreadPoolManager, entry.getMixer(), MixerChannel.LEFT);
|
||||||
entry.getMixer(), MixerChannel.LEFT );
|
mAudioOutputConnections.add(new AudioOutputConnection(left));
|
||||||
mAudioOutputConnections.add( new AudioOutputConnection( left ) );
|
|
||||||
mAvailableConnectionCount++;
|
mAvailableConnectionCount++;
|
||||||
mAudioOutputMap.put( left.getChannelName(), left );
|
mAudioOutputMap.put(left.getChannelName(), left);
|
||||||
|
|
||||||
AudioOutput right = new StereoAudioOutput( mThreadPoolManager,
|
AudioOutput right = new StereoAudioOutput(mThreadPoolManager, entry.getMixer(), MixerChannel.RIGHT);
|
||||||
entry.getMixer(), MixerChannel.RIGHT );
|
mAudioOutputConnections.add(new AudioOutputConnection(right));
|
||||||
mAudioOutputConnections.add( new AudioOutputConnection( right ) );
|
|
||||||
mAvailableConnectionCount++;
|
mAvailableConnectionCount++;
|
||||||
mAudioOutputMap.put( right.getChannelName(), right );
|
mAudioOutputMap.put(right.getChannelName(), right);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new AudioException( "Unsupported mixer channel "
|
throw new AudioException("Unsupported mixer channel "
|
||||||
+ "configuration: " + entry.getMixerChannel() );
|
+ "configuration: " + entry.getMixerChannel());
|
||||||
}
|
}
|
||||||
|
|
||||||
mProcessingTask = mThreadPoolManager.scheduleFixedRate(
|
mProcessingTask = mThreadPoolManager.scheduleFixedRate(
|
||||||
ThreadType.AUDIO_PROCESSING, new AudioPacketProcessor(), 15,
|
ThreadType.AUDIO_PROCESSING, new AudioPacketProcessor(), 15,
|
||||||
TimeUnit.MILLISECONDS );
|
TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
mControllerBroadcaster.broadcast( CONFIGURATION_CHANGE_COMPLETE );
|
mControllerBroadcaster.broadcast(CONFIGURATION_CHANGE_COMPLETE);
|
||||||
|
|
||||||
SystemProperties properties = SystemProperties.getInstance();
|
SystemProperties properties = SystemProperties.getInstance();
|
||||||
|
|
||||||
properties.set( AUDIO_MIXER_PROPERTY, entry.getMixer().getMixerInfo().getName() );
|
properties.set(AUDIO_MIXER_PROPERTY, entry.getMixer().getMixerInfo().getName());
|
||||||
properties.set( AUDIO_CHANNELS_PROPERTY, entry.getMixerChannel().name() );
|
properties.set(AUDIO_CHANNELS_PROPERTY, entry.getMixerChannel().name());
|
||||||
properties.save();
|
properties.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,7 +277,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
{
|
{
|
||||||
mChannelConnectionMap.clear();
|
mChannelConnectionMap.clear();
|
||||||
|
|
||||||
for( AudioOutputConnection connection : mAudioOutputConnections )
|
for(AudioOutputConnection connection : mAudioOutputConnections)
|
||||||
{
|
{
|
||||||
connection.dispose();
|
connection.dispose();
|
||||||
}
|
}
|
||||||
@@ -305,30 +300,30 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
@Override
|
@Override
|
||||||
public List<AudioOutput> getAudioOutputs()
|
public List<AudioOutput> getAudioOutputs()
|
||||||
{
|
{
|
||||||
List<AudioOutput> outputs = new ArrayList<>( mAudioOutputMap.values() );
|
List<AudioOutput> outputs = new ArrayList<>(mAudioOutputMap.values());
|
||||||
|
|
||||||
Collections.sort( outputs, new Comparator<AudioOutput>()
|
Collections.sort(outputs, new Comparator<AudioOutput>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public int compare( AudioOutput first, AudioOutput second )
|
public int compare(AudioOutput first, AudioOutput second)
|
||||||
{
|
{
|
||||||
return first.getChannelName().compareTo( second.getChannelName() );
|
return first.getChannelName().compareTo(second.getChannelName());
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
|
|
||||||
return outputs;
|
return outputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addControllerListener( Listener<AudioEvent> listener )
|
public void addControllerListener(Listener<AudioEvent> listener)
|
||||||
{
|
{
|
||||||
mControllerBroadcaster.addListener( listener );
|
mControllerBroadcaster.addListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeControllerListener( Listener<AudioEvent> listener )
|
public void removeControllerListener(Listener<AudioEvent> listener)
|
||||||
{
|
{
|
||||||
mControllerBroadcaster.removeListener( listener );
|
mControllerBroadcaster.removeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -339,25 +334,25 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
* @param packet from a source
|
* @param packet from a source
|
||||||
* @return an audio output connection or null
|
* @return an audio output connection or null
|
||||||
*/
|
*/
|
||||||
private AudioOutputConnection getConnection( AudioPacket packet )
|
private AudioOutputConnection getConnection(AudioPacket packet)
|
||||||
{
|
{
|
||||||
int source = packet.getAudioMetadata().getSource();
|
int channelMetadataID = packet.getMetadata().getMetadataID();
|
||||||
|
|
||||||
//Use an existing connection
|
//Use an existing connection
|
||||||
if( mChannelConnectionMap.containsKey( source ) )
|
if(mChannelConnectionMap.containsKey(channelMetadataID))
|
||||||
{
|
{
|
||||||
return mChannelConnectionMap.get( source );
|
return mChannelConnectionMap.get(channelMetadataID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Connect to and use an available connection
|
//Connect to and use an available connection
|
||||||
if( mAvailableConnectionCount > 0 )
|
if(mAvailableConnectionCount > 0)
|
||||||
{
|
{
|
||||||
for( AudioOutputConnection connection: mAudioOutputConnections )
|
for(AudioOutputConnection connection : mAudioOutputConnections)
|
||||||
{
|
{
|
||||||
if( connection.isDisconnected() )
|
if(connection.isDisconnected())
|
||||||
{
|
{
|
||||||
connection.connect( source );
|
connection.connect(channelMetadataID);
|
||||||
mChannelConnectionMap.put( source, connection );
|
mChannelConnectionMap.put(channelMetadataID, connection);
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,18 +360,18 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
//Preempt an existing connection and connect it to this higher priority source
|
//Preempt an existing connection and connect it to this higher priority source
|
||||||
else //Check for a channel priority override
|
else //Check for a channel priority override
|
||||||
{
|
{
|
||||||
int priority = packet.getAudioMetadata().getPriority();
|
int priority = packet.getMetadata().getAudioPriority();
|
||||||
|
|
||||||
if( mLowestPriorityConnection != null &&
|
if(mLowestPriorityConnection != null &&
|
||||||
priority < mLowestPriorityConnection.getPriority() )
|
priority < mLowestPriorityConnection.getPriority())
|
||||||
{
|
{
|
||||||
AudioOutputConnection connection = mLowestPriorityConnection;
|
AudioOutputConnection connection = mLowestPriorityConnection;
|
||||||
|
|
||||||
mChannelConnectionMap.remove( connection.getSource() );
|
mChannelConnectionMap.remove(connection.getChannelMetadataID());
|
||||||
|
|
||||||
connection.connect( source );
|
connection.connect(channelMetadataID);
|
||||||
|
|
||||||
mChannelConnectionMap.put( source, connection );
|
mChannelConnectionMap.put(channelMetadataID, connection);
|
||||||
|
|
||||||
updateLowestPriorityAssignment();
|
updateLowestPriorityAssignment();
|
||||||
|
|
||||||
@@ -396,31 +391,30 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
{
|
{
|
||||||
disconnectInactiveChannelAssignments();
|
disconnectInactiveChannelAssignments();
|
||||||
|
|
||||||
if( mAudioPacketQueue != null )
|
if(mAudioPacketQueue != null)
|
||||||
{
|
{
|
||||||
List<AudioPacket> packets = new ArrayList<AudioPacket>();
|
List<AudioPacket> packets = new ArrayList<AudioPacket>();
|
||||||
|
|
||||||
mAudioPacketQueue.drainTo( packets );
|
mAudioPacketQueue.drainTo(packets);
|
||||||
|
|
||||||
for( AudioPacket packet: packets )
|
for(AudioPacket packet : packets)
|
||||||
{
|
{
|
||||||
/* Don't process any packet's marked as do not monitor */
|
/* Don't process any packet's marked as do not monitor */
|
||||||
if( !packet.getAudioMetadata().isDoNotMonitor() &&
|
if(!packet.getMetadata().isDoNotMonitor() && packet.getType() == AudioPacket.Type.AUDIO)
|
||||||
packet.getType() == AudioPacket.Type.AUDIO )
|
|
||||||
{
|
{
|
||||||
AudioOutputConnection connection = getConnection( packet );
|
AudioOutputConnection connection = getConnection(packet);
|
||||||
|
|
||||||
if( connection != null )
|
if(connection != null)
|
||||||
{
|
{
|
||||||
connection.receive( packet );
|
connection.receive(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
mLog.error( "Encountered error while processing audio packets", e );
|
mLog.error("Encountered error while processing audio packets", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -436,44 +430,40 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
|
|
||||||
private AudioOutput mAudioOutput;
|
private AudioOutput mAudioOutput;
|
||||||
private int mPriority = 0;
|
private int mPriority = 0;
|
||||||
private int mSource = DISCONNECTED;
|
private int mChannelMetadataID = DISCONNECTED;
|
||||||
|
|
||||||
public AudioOutputConnection( AudioOutput audioOutput )
|
public AudioOutputConnection(AudioOutput audioOutput)
|
||||||
{
|
{
|
||||||
mAudioOutput = audioOutput;
|
mAudioOutput = audioOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void receive( AudioPacket packet )
|
public void receive(AudioPacket packet)
|
||||||
{
|
{
|
||||||
if( packet.hasAudioMetadata() &&
|
if(packet.hasMetadata() && packet.getMetadata().getMetadataID() == mChannelMetadataID)
|
||||||
packet.getAudioMetadata().getSource() == mSource )
|
|
||||||
{
|
{
|
||||||
int priority = packet.getAudioMetadata().getPriority();
|
int priority = packet.getMetadata().getAudioPriority();
|
||||||
|
|
||||||
if( mPriority != priority )
|
if(mPriority != priority)
|
||||||
{
|
{
|
||||||
mPriority = priority;
|
mPriority = priority;
|
||||||
updateLowestPriorityAssignment();
|
updateLowestPriorityAssignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mAudioOutput != null )
|
if(mAudioOutput != null)
|
||||||
{
|
{
|
||||||
mAudioOutput.receive( packet );
|
mAudioOutput.receive(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( packet.hasAudioMetadata() )
|
if(packet.hasMetadata())
|
||||||
{
|
{
|
||||||
mLog.error( "Received audio packet from channel source [" +
|
mLog.error("Received audio packet from channel metadata [" + packet.getMetadata().getMetadataID() +
|
||||||
packet.getAudioMetadata().getSource() +
|
"] however this assignment is currently connected to metadata [" + mChannelMetadataID + "]");
|
||||||
"] however this assignment is currently connected "
|
|
||||||
+ "to channel source [" + mSource + "]" );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.error( "Received audio packet with no metadata - "
|
mLog.error("Received audio packet with no metadata - cannot route audio packet");
|
||||||
+ "cannot route audio packet" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,7 +482,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
*/
|
*/
|
||||||
public boolean isDisconnected()
|
public boolean isDisconnected()
|
||||||
{
|
{
|
||||||
return mSource == DISCONNECTED;
|
return mChannelMetadataID == DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -507,9 +497,9 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
* Connects this assignment to the indicated source so that audio
|
* Connects this assignment to the indicated source so that audio
|
||||||
* packets from this source can be sent to the audio output
|
* packets from this source can be sent to the audio output
|
||||||
*/
|
*/
|
||||||
public void connect( int source )
|
public void connect(int source)
|
||||||
{
|
{
|
||||||
mSource = source;
|
mChannelMetadataID = source;
|
||||||
|
|
||||||
mAudioOutput.updateTimestamp();
|
mAudioOutput.updateTimestamp();
|
||||||
}
|
}
|
||||||
@@ -517,9 +507,9 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
/**
|
/**
|
||||||
* Currently connected source or -1 if disconnected
|
* Currently connected source or -1 if disconnected
|
||||||
*/
|
*/
|
||||||
public int getSource()
|
public int getChannelMetadataID()
|
||||||
{
|
{
|
||||||
return mSource;
|
return mChannelMetadataID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -528,7 +518,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
*/
|
*/
|
||||||
public void disconnect()
|
public void disconnect()
|
||||||
{
|
{
|
||||||
mSource = DISCONNECTED;
|
mChannelMetadataID = DISCONNECTED;
|
||||||
mPriority = 0;
|
mPriority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,7 +528,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
|||||||
*/
|
*/
|
||||||
public boolean isInactive()
|
public boolean isInactive()
|
||||||
{
|
{
|
||||||
return ( mAudioOutput.getLastActivityTimestamp() + AUDIO_TIMEOUT ) < System.currentTimeMillis();
|
return (mAudioOutput.getLastActivityTimestamp() + AUDIO_TIMEOUT) < System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPriority()
|
public int getPriority()
|
||||||
|
|||||||
@@ -1,29 +1,38 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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 audio;
|
package audio;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import audio.squelch.ISquelchStateListener;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import audio.squelch.SquelchState;
|
||||||
|
import channel.metadata.Metadata;
|
||||||
import dsp.filter.design.FilterDesignException;
|
import dsp.filter.design.FilterDesignException;
|
||||||
import dsp.filter.fir.FIRFilterSpecification;
|
import dsp.filter.fir.FIRFilterSpecification;
|
||||||
import dsp.filter.fir.remez.RemezFIRFilterDesigner;
|
import dsp.filter.fir.remez.RemezFIRFilterDesigner;
|
||||||
import dsp.filter.polyphase.PolyphaseFIRDecimatingFilter_RB;
|
import dsp.filter.polyphase.PolyphaseFIRDecimatingFilter_RB;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.real.IFilteredRealBufferListener;
|
import sample.real.IFilteredRealBufferListener;
|
||||||
import sample.real.RealBuffer;
|
import sample.real.RealBuffer;
|
||||||
import audio.metadata.AudioMetadata;
|
|
||||||
import audio.metadata.IMetadataListener;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.squelch.ISquelchStateListener;
|
|
||||||
import audio.squelch.SquelchState;
|
|
||||||
import controller.channel.ChannelEvent;
|
|
||||||
import controller.channel.IChannelEventListener;
|
|
||||||
import dsp.filter.Filters;
|
|
||||||
import dsp.filter.fir.real.RealFIRFilter_R_R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides packaging of demodulated audio sample buffers into audio packets for
|
* Provides packaging of demodulated audio sample buffers into audio packets for
|
||||||
@@ -33,12 +42,8 @@ import dsp.filter.fir.real.RealFIRFilter_R_R;
|
|||||||
* Incorporates audio squelch state listener to control if audio packets are
|
* Incorporates audio squelch state listener to control if audio packets are
|
||||||
* broadcast or ignored.
|
* broadcast or ignored.
|
||||||
*/
|
*/
|
||||||
public class AudioModule extends Module implements IAudioPacketProvider,
|
public class AudioModule extends Module implements IAudioPacketProvider, IFilteredRealBufferListener,
|
||||||
IChannelEventListener,
|
ISquelchStateListener, Listener<RealBuffer>
|
||||||
IMetadataListener,
|
|
||||||
IFilteredRealBufferListener,
|
|
||||||
ISquelchStateListener,
|
|
||||||
Listener<RealBuffer>
|
|
||||||
{
|
{
|
||||||
protected static final Logger mLog = LoggerFactory.getLogger(AudioModule.class);
|
protected static final Logger mLog = LoggerFactory.getLogger(AudioModule.class);
|
||||||
|
|
||||||
@@ -48,48 +53,41 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
{
|
{
|
||||||
//Band-pass filter to both decimate (48kHz to 8kHz) and block 0 - 300 Hz (LTR signalling).
|
//Band-pass filter to both decimate (48kHz to 8kHz) and block 0 - 300 Hz (LTR signalling).
|
||||||
FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||||
.sampleRate( 48000 )
|
.sampleRate(48000)
|
||||||
.stopFrequency1( 150 )
|
.stopFrequency1(150)
|
||||||
.passFrequencyBegin( 300 )
|
.passFrequencyBegin(300)
|
||||||
.passFrequencyEnd( 3500 )
|
.passFrequencyEnd(3500)
|
||||||
.stopFrequency2( 4000 )
|
.stopFrequency2(4000)
|
||||||
.stopRipple( 0.0004 )
|
.stopRipple(0.0004)
|
||||||
.passRipple( 0.008)
|
.passRipple(0.008)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!designer.isValid())
|
if(!designer.isValid())
|
||||||
{
|
{
|
||||||
throw new FilterDesignException("Couldn't design the audio decimation filter");
|
throw new FilterDesignException("Couldn't design the audio decimation filter");
|
||||||
}
|
}
|
||||||
|
|
||||||
mDecimationCoefficients = designer.getImpulseResponse();
|
mDecimationCoefficients = designer.getImpulseResponse();
|
||||||
}
|
}
|
||||||
catch (FilterDesignException e)
|
catch(FilterDesignException e)
|
||||||
{
|
{
|
||||||
mLog.debug("Error designing filter", e);
|
mLog.debug("Error designing filter", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provides a unique identifier for this audio module instance to use as a
|
|
||||||
* source identifier for all audio packets */
|
|
||||||
private static int UNIQUE_ID = 0;
|
|
||||||
private int mSourceID;
|
|
||||||
|
|
||||||
private AudioMetadata mAudioMetadata;
|
|
||||||
private ChannelEventListener mChannelEventListener = new ChannelEventListener();
|
|
||||||
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
||||||
private SquelchState mSquelchState = SquelchState.SQUELCH;
|
private SquelchState mSquelchState = SquelchState.SQUELCH;
|
||||||
private Listener<AudioPacket> mAudioPacketListener;
|
private Listener<AudioPacket> mAudioPacketListener;
|
||||||
private PolyphaseFIRDecimatingFilter_RB mAudioDecimationFilter;
|
private PolyphaseFIRDecimatingFilter_RB mAudioDecimationFilter;
|
||||||
|
private Metadata mMetadata;
|
||||||
|
|
||||||
public AudioModule(boolean record)
|
public AudioModule(Metadata metadata)
|
||||||
{
|
{
|
||||||
mSourceID = ++UNIQUE_ID;
|
mMetadata = metadata;
|
||||||
mAudioMetadata = new AudioMetadata(mSourceID, record);
|
|
||||||
|
|
||||||
mAudioDecimationFilter = new PolyphaseFIRDecimatingFilter_RB(mDecimationCoefficients, 6, 2.0f);
|
mAudioDecimationFilter = new PolyphaseFIRDecimatingFilter_RB(mDecimationCoefficients, 6, 2.0f);
|
||||||
mAudioDecimationFilter.setListener(new Listener<RealBuffer>()
|
mAudioDecimationFilter.setListener(new Listener<RealBuffer>()
|
||||||
@@ -97,9 +95,9 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void receive(RealBuffer realBuffer)
|
public void receive(RealBuffer realBuffer)
|
||||||
{
|
{
|
||||||
if (mAudioPacketListener != null)
|
if(mAudioPacketListener != null)
|
||||||
{
|
{
|
||||||
AudioPacket packet = new AudioPacket(realBuffer.getSamples(), mAudioMetadata.copyOf());
|
AudioPacket packet = new AudioPacket(realBuffer.getSamples(), mMetadata.copyOf());
|
||||||
mAudioPacketListener.receive(packet);
|
mAudioPacketListener.receive(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +114,6 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
mAudioMetadata.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -129,10 +126,9 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
/* Issue an end audio packet in case a recorder is still rolling */
|
/* Issue an end audio packet in case a recorder is still rolling */
|
||||||
if (mAudioPacketListener != null)
|
if(mAudioPacketListener != null)
|
||||||
{
|
{
|
||||||
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END,
|
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END, mMetadata.copyOf()));
|
||||||
mAudioMetadata.copyOf()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,15 +139,9 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void receive(RealBuffer buffer)
|
public void receive(RealBuffer buffer)
|
||||||
{
|
{
|
||||||
if (mAudioPacketListener != null && mSquelchState == SquelchState.UNSQUELCH)
|
if(mAudioPacketListener != null && mSquelchState == SquelchState.UNSQUELCH)
|
||||||
{
|
{
|
||||||
mAudioDecimationFilter.receive(buffer);
|
mAudioDecimationFilter.receive(buffer);
|
||||||
|
|
||||||
// /* We make a copy of the samples, so that we don't affect any other
|
|
||||||
// * processes that might be concurrently processing the same buffer */
|
|
||||||
// float[] audio = Arrays.copyOf( buffer.getSamples(), buffer.getSamples().length );
|
|
||||||
//
|
|
||||||
// mAudioFilter.filter( audio );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,12 +151,6 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Listener<Metadata> getMetadataListener()
|
|
||||||
{
|
|
||||||
return mAudioMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAudioPacketListener(Listener<AudioPacket> listener)
|
public void setAudioPacketListener(Listener<AudioPacket> listener)
|
||||||
{
|
{
|
||||||
@@ -179,41 +163,12 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
mAudioPacketListener = null;
|
mAudioPacketListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Listener<ChannelEvent> getChannelEventListener()
|
|
||||||
{
|
|
||||||
return mChannelEventListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Listener<SquelchState> getSquelchStateListener()
|
public Listener<SquelchState> getSquelchStateListener()
|
||||||
{
|
{
|
||||||
return mSquelchStateListener;
|
return mSquelchStateListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for channel event listener. Responds to channel state reset
|
|
||||||
* events to remove/cleanup current audio metadata
|
|
||||||
*/
|
|
||||||
public class ChannelEventListener implements Listener<ChannelEvent>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void receive(ChannelEvent event)
|
|
||||||
{
|
|
||||||
switch (event.getEvent())
|
|
||||||
{
|
|
||||||
case NOTIFICATION_STATE_RESET:
|
|
||||||
mAudioMetadata.reset();
|
|
||||||
break;
|
|
||||||
case NOTIFICATION_SELECTION_CHANGE:
|
|
||||||
mAudioMetadata.setSelected(event.getChannel().isSelected());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for squelch state listener
|
* Wrapper for squelch state listener
|
||||||
*/
|
*/
|
||||||
@@ -222,10 +177,9 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void receive(SquelchState state)
|
public void receive(SquelchState state)
|
||||||
{
|
{
|
||||||
if (state == SquelchState.SQUELCH && mAudioPacketListener != null)
|
if(state == SquelchState.SQUELCH && mAudioPacketListener != null)
|
||||||
{
|
{
|
||||||
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END,
|
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END, mMetadata.copyOf()));
|
||||||
mAudioMetadata.copyOf()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mSquelchState = state;
|
mSquelchState = state;
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
package audio;
|
|
||||||
|
|
||||||
import sample.real.RealBuffer;
|
|
||||||
import audio.metadata.AudioMetadata;
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,39 +14,45 @@ import audio.metadata.AudioMetadata;
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
package audio;
|
||||||
|
|
||||||
|
import channel.metadata.Metadata;
|
||||||
|
import sample.real.RealBuffer;
|
||||||
|
|
||||||
public class AudioPacket
|
public class AudioPacket
|
||||||
{
|
{
|
||||||
private Type mType;
|
private Type mType;
|
||||||
private RealBuffer mAudioData;
|
private RealBuffer mAudioData;
|
||||||
private AudioMetadata mAudioMetadata;
|
private Metadata mMetadata;
|
||||||
|
|
||||||
public AudioPacket( Type type, AudioMetadata metadata )
|
public AudioPacket(Type type, Metadata metadata)
|
||||||
{
|
{
|
||||||
mType = type;
|
mType = type;
|
||||||
mAudioMetadata = metadata;
|
mMetadata = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AudioPacket( float[] audio, AudioMetadata metadata )
|
public AudioPacket(float[] audio, Metadata metadata)
|
||||||
{
|
{
|
||||||
this( Type.AUDIO, metadata );
|
this(Type.AUDIO, metadata);
|
||||||
|
|
||||||
mAudioData = new RealBuffer( audio );
|
mAudioData = new RealBuffer(audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAudioMetadata()
|
public boolean hasMetadata()
|
||||||
{
|
{
|
||||||
return mAudioMetadata != null;
|
return mMetadata != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AudioMetadata getAudioMetadata()
|
public Metadata getMetadata()
|
||||||
{
|
{
|
||||||
return mAudioMetadata;
|
return mMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMetadata( AudioMetadata metadata )
|
public void setMetadata(Metadata metadata)
|
||||||
{
|
{
|
||||||
mAudioMetadata = metadata;
|
mMetadata = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type getType()
|
public Type getType()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* sdrtrunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,14 +18,11 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package audio.broadcast;
|
package audio.broadcast;
|
||||||
|
|
||||||
import audio.AudioPacket;
|
|
||||||
import audio.IAudioPacketListener;
|
|
||||||
import audio.convert.ISilenceGenerator;
|
import audio.convert.ISilenceGenerator;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import properties.SystemProperties;
|
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@@ -34,14 +31,13 @@ import java.nio.file.Files;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.LinkedTransferQueue;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
public abstract class AudioBroadcaster implements Listener<AudioRecording>
|
public abstract class AudioBroadcaster implements Listener<AudioRecording>
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( AudioBroadcaster.class );
|
private final static Logger mLog = LoggerFactory.getLogger(AudioBroadcaster.class);
|
||||||
|
|
||||||
public static final int PROCESSOR_RUN_INTERVAL_MS = 1000;
|
public static final int PROCESSOR_RUN_INTERVAL_MS = 1000;
|
||||||
|
|
||||||
@@ -107,9 +103,10 @@ public abstract class AudioBroadcaster implements Listener<AudioRecording>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts the next song's audio metadata prior to streaming the next song.
|
* Broadcasts the next song's audio metadata prior to streaming the next song.
|
||||||
|
*
|
||||||
* @param metadata for the next recording that will be streamed
|
* @param metadata for the next recording that will be streamed
|
||||||
*/
|
*/
|
||||||
protected void broadcastMetadata(AudioMetadata metadata)
|
protected void broadcastMetadata(Metadata metadata)
|
||||||
{
|
{
|
||||||
IBroadcastMetadataUpdater metadataUpdater = getMetadataUpdater();
|
IBroadcastMetadataUpdater metadataUpdater = getMetadataUpdater();
|
||||||
|
|
||||||
@@ -136,7 +133,7 @@ public abstract class AudioBroadcaster implements Listener<AudioRecording>
|
|||||||
if(mThreadPoolManager != null)
|
if(mThreadPoolManager != null)
|
||||||
{
|
{
|
||||||
mScheduledTask = mThreadPoolManager.scheduleFixedRate(ThreadPoolManager.ThreadType.AUDIO_PROCESSING,
|
mScheduledTask = mThreadPoolManager.scheduleFixedRate(ThreadPoolManager.ThreadType.AUDIO_PROCESSING,
|
||||||
mRecordingQueueProcessor, PROCESSOR_RUN_INTERVAL_MS, TimeUnit.MILLISECONDS );
|
mRecordingQueueProcessor, PROCESSOR_RUN_INTERVAL_MS, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,6 +157,7 @@ public abstract class AudioBroadcaster implements Listener<AudioRecording>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream name for the broadcast configuration for this broadcaster
|
* Stream name for the broadcast configuration for this broadcaster
|
||||||
|
*
|
||||||
* @return stream name or null
|
* @return stream name or null
|
||||||
*/
|
*/
|
||||||
public String getStreamName()
|
public String getStreamName()
|
||||||
@@ -431,7 +429,7 @@ public abstract class AudioBroadcaster implements Listener<AudioRecording>
|
|||||||
|
|
||||||
if(connected())
|
if(connected())
|
||||||
{
|
{
|
||||||
broadcastMetadata(nextRecording.getAudioMetadata());
|
broadcastMetadata(nextRecording.getMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataUpdateRequired = false;
|
metadataUpdateRequired = false;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* sdrtrunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package audio.broadcast;
|
package audio.broadcast;
|
||||||
|
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -30,22 +30,23 @@ public class AudioRecording implements Comparable<AudioRecording>
|
|||||||
private final static Logger mLog = LoggerFactory.getLogger(StreamManager.class);
|
private final static Logger mLog = LoggerFactory.getLogger(StreamManager.class);
|
||||||
|
|
||||||
private Path mPath;
|
private Path mPath;
|
||||||
private AudioMetadata mAudioMetadata;
|
|
||||||
private long mStartTime;
|
private long mStartTime;
|
||||||
private long mRecordingLength;
|
private long mRecordingLength;
|
||||||
private AtomicInteger mPendingReplayCount = new AtomicInteger();
|
private AtomicInteger mPendingReplayCount = new AtomicInteger();
|
||||||
|
private Metadata mMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio recording that is ready to be streamed
|
* Audio recording that is ready to be streamed
|
||||||
|
*
|
||||||
* @param path to the audio recording file
|
* @param path to the audio recording file
|
||||||
* @param audioMetadata associated with the recording
|
* @param metadata associated with the recording
|
||||||
* @param start time of recording in milliseconds since epoch
|
* @param start time of recording in milliseconds since epoch
|
||||||
* @param recordingLength in milliseconds
|
* @param recordingLength in milliseconds
|
||||||
*/
|
*/
|
||||||
public AudioRecording(Path path, AudioMetadata audioMetadata, long start, long recordingLength)
|
public AudioRecording(Path path, Metadata metadata, long start, long recordingLength)
|
||||||
{
|
{
|
||||||
mPath = path;
|
mPath = path;
|
||||||
mAudioMetadata = audioMetadata;
|
mMetadata = metadata;
|
||||||
mStartTime = start;
|
mStartTime = start;
|
||||||
mRecordingLength = recordingLength;
|
mRecordingLength = recordingLength;
|
||||||
}
|
}
|
||||||
@@ -61,9 +62,9 @@ public class AudioRecording implements Comparable<AudioRecording>
|
|||||||
/**
|
/**
|
||||||
* Optional audio metadata for the recording.
|
* Optional audio metadata for the recording.
|
||||||
*/
|
*/
|
||||||
public AudioMetadata getAudioMetadata()
|
public Metadata getMetadata()
|
||||||
{
|
{
|
||||||
return mAudioMetadata;
|
return mMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package audio.broadcast;
|
|||||||
|
|
||||||
import alias.id.broadcast.BroadcastChannel;
|
import alias.id.broadcast.BroadcastChannel;
|
||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import icon.IconManager;
|
import icon.IconManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -48,7 +48,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class BroadcastModel extends AbstractTableModel implements Listener<AudioPacket>
|
public class BroadcastModel extends AbstractTableModel implements Listener<AudioPacket>
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( BroadcastModel.class );
|
private final static Logger mLog = LoggerFactory.getLogger(BroadcastModel.class);
|
||||||
|
|
||||||
public static final String TEMPORARY_STREAM_DIRECTORY = "streaming";
|
public static final String TEMPORARY_STREAM_DIRECTORY = "streaming";
|
||||||
public static final String TEMPORARY_STREAM_FILE_SUFFIX = "temporary_streaming_file_";
|
public static final String TEMPORARY_STREAM_FILE_SUFFIX = "temporary_streaming_file_";
|
||||||
@@ -84,7 +84,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
|
|
||||||
//Monitor to remove temporary recording files that have been streamed by all audio broadcasters
|
//Monitor to remove temporary recording files that have been streamed by all audio broadcasters
|
||||||
mThreadPoolManager.scheduleFixedRate(ThreadPoolManager.ThreadType.AUDIO_RECORDING,
|
mThreadPoolManager.scheduleFixedRate(ThreadPoolManager.ThreadType.AUDIO_RECORDING,
|
||||||
new RecordingDeletionMonitor(), 15l, TimeUnit.SECONDS );
|
new RecordingDeletionMonitor(), 15l, TimeUnit.SECONDS);
|
||||||
|
|
||||||
removeOrphanedTemporaryRecordings();
|
removeOrphanedTemporaryRecordings();
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
{
|
{
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
|
|
||||||
for(BroadcastConfiguration configuration: mBroadcastConfigurations)
|
for(BroadcastConfiguration configuration : mBroadcastConfigurations)
|
||||||
{
|
{
|
||||||
names.add(configuration.getName());
|
names.add(configuration.getName());
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
*/
|
*/
|
||||||
public void addBroadcastConfigurations(List<BroadcastConfiguration> configurations)
|
public void addBroadcastConfigurations(List<BroadcastConfiguration> configurations)
|
||||||
{
|
{
|
||||||
for(BroadcastConfiguration configuration: configurations)
|
for(BroadcastConfiguration configuration : configurations)
|
||||||
{
|
{
|
||||||
addBroadcastConfiguration(configuration);
|
addBroadcastConfiguration(configuration);
|
||||||
}
|
}
|
||||||
@@ -138,11 +138,11 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
|
|
||||||
int index = mBroadcastConfigurations.size() - 1;
|
int index = mBroadcastConfigurations.size() - 1;
|
||||||
|
|
||||||
fireTableRowsInserted( index, index );
|
fireTableRowsInserted(index, index);
|
||||||
|
|
||||||
mBroadcastConfigurationMap.put(configuration.getName(), configuration);
|
mBroadcastConfigurationMap.put(configuration.getName(), configuration);
|
||||||
|
|
||||||
process( new BroadcastEvent( configuration, BroadcastEvent.Event.CONFIGURATION_ADD) );
|
process(new BroadcastEvent(configuration, BroadcastEvent.Event.CONFIGURATION_ADD));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,6 +164,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the configuration's name so that it is unique among all other broadcast configurations
|
* Updates the configuration's name so that it is unique among all other broadcast configurations
|
||||||
|
*
|
||||||
* @param configuration
|
* @param configuration
|
||||||
*/
|
*/
|
||||||
private void ensureUniqueName(BroadcastConfiguration configuration)
|
private void ensureUniqueName(BroadcastConfiguration configuration)
|
||||||
@@ -235,7 +236,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(BroadcastConfiguration configurationToCompare: mBroadcastConfigurations)
|
for(BroadcastConfiguration configurationToCompare : mBroadcastConfigurations)
|
||||||
{
|
{
|
||||||
if(configurationToCompare != configuration &&
|
if(configurationToCompare != configuration &&
|
||||||
configurationToCompare.getName() != null &&
|
configurationToCompare.getName() != null &&
|
||||||
@@ -258,9 +259,9 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
|
|
||||||
mBroadcastConfigurationMap.remove(broadcastConfiguration.getName());
|
mBroadcastConfigurationMap.remove(broadcastConfiguration.getName());
|
||||||
|
|
||||||
process(new BroadcastEvent( broadcastConfiguration, BroadcastEvent.Event.CONFIGURATION_DELETE));
|
process(new BroadcastEvent(broadcastConfiguration, BroadcastEvent.Event.CONFIGURATION_DELETE));
|
||||||
|
|
||||||
fireTableRowsDeleted( index, index );
|
fireTableRowsDeleted(index, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,8 +276,8 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
@Override
|
@Override
|
||||||
public void receive(AudioPacket audioPacket)
|
public void receive(AudioPacket audioPacket)
|
||||||
{
|
{
|
||||||
if (audioPacket.hasAudioMetadata() &&
|
if(audioPacket.hasMetadata() &&
|
||||||
audioPacket.getAudioMetadata().isStreamable())
|
audioPacket.getMetadata().isStreamable())
|
||||||
{
|
{
|
||||||
mStreamManager.receive(audioPacket);
|
mStreamManager.receive(audioPacket);
|
||||||
}
|
}
|
||||||
@@ -287,7 +288,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
*/
|
*/
|
||||||
private void createBroadcaster(BroadcastConfiguration broadcastConfiguration)
|
private void createBroadcaster(BroadcastConfiguration broadcastConfiguration)
|
||||||
{
|
{
|
||||||
if (broadcastConfiguration != null &&
|
if(broadcastConfiguration != null &&
|
||||||
broadcastConfiguration.isEnabled() &&
|
broadcastConfiguration.isEnabled() &&
|
||||||
broadcastConfiguration.isValid() &&
|
broadcastConfiguration.isValid() &&
|
||||||
!mBroadcasterMap.containsKey(broadcastConfiguration.getName()))
|
!mBroadcasterMap.containsKey(broadcastConfiguration.getName()))
|
||||||
@@ -295,7 +296,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
AudioBroadcaster audioBroadcaster = BroadcastFactory.getBroadcaster(mThreadPoolManager,
|
AudioBroadcaster audioBroadcaster = BroadcastFactory.getBroadcaster(mThreadPoolManager,
|
||||||
broadcastConfiguration);
|
broadcastConfiguration);
|
||||||
|
|
||||||
if (audioBroadcaster != null)
|
if(audioBroadcaster != null)
|
||||||
{
|
{
|
||||||
audioBroadcaster.setListener(new Listener<BroadcastEvent>()
|
audioBroadcaster.setListener(new Listener<BroadcastEvent>()
|
||||||
{
|
{
|
||||||
@@ -377,7 +378,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
*/
|
*/
|
||||||
private void broadcast(BroadcastEvent event)
|
private void broadcast(BroadcastEvent event)
|
||||||
{
|
{
|
||||||
mBroadcastEventBroadcaster.broadcast( event );
|
mBroadcastEventBroadcaster.broadcast(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -395,7 +396,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
case CONFIGURATION_CHANGE:
|
case CONFIGURATION_CHANGE:
|
||||||
BroadcastConfiguration broadcastConfiguration = broadcastEvent.getBroadcastConfiguration();
|
BroadcastConfiguration broadcastConfiguration = broadcastEvent.getBroadcastConfiguration();
|
||||||
int index = mBroadcastConfigurations.indexOf(broadcastConfiguration);
|
int index = mBroadcastConfigurations.indexOf(broadcastConfiguration);
|
||||||
fireTableRowsUpdated( index, index );
|
fireTableRowsUpdated(index, index);
|
||||||
|
|
||||||
//Delete and recreate the broadcaster for any broadcast configuration changes
|
//Delete and recreate the broadcaster for any broadcast configuration changes
|
||||||
String previousChannelName = cleanupMapAssociations(broadcastConfiguration);
|
String previousChannelName = cleanupMapAssociations(broadcastConfiguration);
|
||||||
@@ -452,7 +453,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
{
|
{
|
||||||
String oldName = null;
|
String oldName = null;
|
||||||
|
|
||||||
for(Map.Entry<String,BroadcastConfiguration> entry: mBroadcastConfigurationMap.entrySet())
|
for(Map.Entry<String,BroadcastConfiguration> entry : mBroadcastConfigurationMap.entrySet())
|
||||||
{
|
{
|
||||||
if(entry.getValue() == broadcastConfiguration)
|
if(entry.getValue() == broadcastConfiguration)
|
||||||
{
|
{
|
||||||
@@ -488,7 +489,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( rowIndex <= mBroadcastConfigurations.size())
|
if(rowIndex <= mBroadcastConfigurations.size())
|
||||||
{
|
{
|
||||||
BroadcastConfiguration configuration = mBroadcastConfigurations.get(rowIndex);
|
BroadcastConfiguration configuration = mBroadcastConfigurations.get(rowIndex);
|
||||||
|
|
||||||
@@ -686,19 +687,19 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
@Override
|
@Override
|
||||||
public void receive(AudioRecording audioRecording)
|
public void receive(AudioRecording audioRecording)
|
||||||
{
|
{
|
||||||
AudioMetadata metadata = audioRecording.getAudioMetadata();
|
Metadata metadata = audioRecording.getMetadata();
|
||||||
|
|
||||||
if(metadata != null && metadata.isStreamable())
|
if(metadata != null && metadata.isStreamable())
|
||||||
{
|
{
|
||||||
for (BroadcastChannel broadcastChannel : metadata.getBroadcastChannels())
|
for(BroadcastChannel broadcastChannel : metadata.getBroadcastChannels())
|
||||||
{
|
{
|
||||||
String channelName = broadcastChannel.getChannelName();
|
String channelName = broadcastChannel.getChannelName();
|
||||||
|
|
||||||
if (channelName != null)
|
if(channelName != null)
|
||||||
{
|
{
|
||||||
AudioBroadcaster audioBroadcaster = getBroadcaster(channelName);
|
AudioBroadcaster audioBroadcaster = getBroadcaster(channelName);
|
||||||
|
|
||||||
if (audioBroadcaster != null)
|
if(audioBroadcaster != null)
|
||||||
{
|
{
|
||||||
audioRecording.addPendingReplay();
|
audioRecording.addPendingReplay();
|
||||||
audioBroadcaster.receive(audioRecording);
|
audioBroadcaster.receive(audioRecording);
|
||||||
@@ -739,7 +740,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
|
|
||||||
if(!recordingsToDelete.isEmpty())
|
if(!recordingsToDelete.isEmpty())
|
||||||
{
|
{
|
||||||
for(AudioRecording recordingToDelete: recordingsToDelete)
|
for(AudioRecording recordingToDelete : recordingsToDelete)
|
||||||
{
|
{
|
||||||
mRecordingQueue.remove(recordingToDelete);
|
mRecordingQueue.remove(recordingToDelete);
|
||||||
removeRecording(recordingToDelete);
|
removeRecording(recordingToDelete);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package audio.broadcast;
|
package audio.broadcast;
|
||||||
|
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
|
|
||||||
public interface IBroadcastMetadataUpdater
|
public interface IBroadcastMetadataUpdater
|
||||||
{
|
{
|
||||||
@@ -27,5 +27,5 @@ public interface IBroadcastMetadataUpdater
|
|||||||
*
|
*
|
||||||
* @param metadata containing metadata attributes
|
* @param metadata containing metadata attributes
|
||||||
*/
|
*/
|
||||||
void update(AudioMetadata metadata);
|
void update(Metadata metadata);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* sdrtrunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,7 +48,7 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
private Listener<AudioRecording> mAudioRecordingListener;
|
private Listener<AudioRecording> mAudioRecordingListener;
|
||||||
private BroadcastFormat mBroadcastFormat;
|
private BroadcastFormat mBroadcastFormat;
|
||||||
private Path mTempDirectory;
|
private Path mTempDirectory;
|
||||||
private Map<Integer, AudioRecorder> mStreamRecorders = new HashMap<>();
|
private Map<Integer,AudioRecorder> mStreamRecorders = new HashMap<>();
|
||||||
private Runnable mRecorderMonitor;
|
private Runnable mRecorderMonitor;
|
||||||
private ScheduledFuture<?> mRecorderMonitorFuture;
|
private ScheduledFuture<?> mRecorderMonitorFuture;
|
||||||
private AtomicBoolean mRunning = new AtomicBoolean();
|
private AtomicBoolean mRunning = new AtomicBoolean();
|
||||||
@@ -68,8 +68,8 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
public StreamManager(ThreadPoolManager threadPoolManager, Listener<AudioRecording> listener,
|
public StreamManager(ThreadPoolManager threadPoolManager, Listener<AudioRecording> listener,
|
||||||
BroadcastFormat broadcastFormat, Path tempDirectory)
|
BroadcastFormat broadcastFormat, Path tempDirectory)
|
||||||
{
|
{
|
||||||
assert(tempDirectory != null && Files.isDirectory(tempDirectory));
|
assert (tempDirectory != null && Files.isDirectory(tempDirectory));
|
||||||
assert(mThreadPoolManager != null);
|
assert (mThreadPoolManager != null);
|
||||||
|
|
||||||
mThreadPoolManager = threadPoolManager;
|
mThreadPoolManager = threadPoolManager;
|
||||||
mAudioRecordingListener = listener;
|
mAudioRecordingListener = listener;
|
||||||
@@ -107,11 +107,11 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
mRecorderMonitorFuture.cancel(true);
|
mRecorderMonitorFuture.cancel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mStreamRecorders)
|
synchronized(mStreamRecorders)
|
||||||
{
|
{
|
||||||
List<Integer> streamKeys = new ArrayList<>(mStreamRecorders.keySet());
|
List<Integer> streamKeys = new ArrayList<>(mStreamRecorders.keySet());
|
||||||
|
|
||||||
for(Integer streamKey: streamKeys)
|
for(Integer streamKey : streamKeys)
|
||||||
{
|
{
|
||||||
removeRecorder(streamKey);
|
removeRecorder(streamKey);
|
||||||
}
|
}
|
||||||
@@ -122,19 +122,19 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
@Override
|
@Override
|
||||||
public void receive(AudioPacket audioPacket)
|
public void receive(AudioPacket audioPacket)
|
||||||
{
|
{
|
||||||
if(mRunning.get() && audioPacket.hasAudioMetadata())
|
if(mRunning.get() && audioPacket.hasMetadata())
|
||||||
{
|
{
|
||||||
synchronized (mStreamRecorders)
|
synchronized(mStreamRecorders)
|
||||||
{
|
{
|
||||||
int sourceChannelID = audioPacket.getAudioMetadata().getSource();
|
int channelMetadataID = audioPacket.getMetadata().getMetadataID();
|
||||||
|
|
||||||
AudioPacket.Type type = audioPacket.getType();
|
AudioPacket.Type type = audioPacket.getType();
|
||||||
|
|
||||||
if(type == AudioPacket.Type.AUDIO)
|
if(type == AudioPacket.Type.AUDIO)
|
||||||
{
|
{
|
||||||
if(mStreamRecorders.containsKey(sourceChannelID))
|
if(mStreamRecorders.containsKey(channelMetadataID))
|
||||||
{
|
{
|
||||||
AudioRecorder recorder = mStreamRecorders.get(sourceChannelID);
|
AudioRecorder recorder = mStreamRecorders.get(channelMetadataID);
|
||||||
|
|
||||||
if(recorder != null)
|
if(recorder != null)
|
||||||
{
|
{
|
||||||
@@ -147,12 +147,12 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
mBroadcastFormat);
|
mBroadcastFormat);
|
||||||
recorder.start(mThreadPoolManager.getScheduledExecutorService());
|
recorder.start(mThreadPoolManager.getScheduledExecutorService());
|
||||||
recorder.receive(audioPacket);
|
recorder.receive(audioPacket);
|
||||||
mStreamRecorders.put(sourceChannelID, recorder);
|
mStreamRecorders.put(channelMetadataID, recorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(type == AudioPacket.Type.END)
|
else if(type == AudioPacket.Type.END)
|
||||||
{
|
{
|
||||||
removeRecorder(sourceChannelID);
|
removeRecorder(channelMetadataID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -203,8 +203,8 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(BroadcastModel.TEMPORARY_STREAM_FILE_SUFFIX);
|
sb.append(BroadcastModel.TEMPORARY_STREAM_FILE_SUFFIX);
|
||||||
sb.append(sNextRecordingNumber.incrementAndGet()).append("_");
|
sb.append(sNextRecordingNumber.incrementAndGet()).append("_");
|
||||||
sb.append( TimeStamp.getLongTimeStamp( "_" ) );
|
sb.append(TimeStamp.getLongTimeStamp("_"));
|
||||||
sb.append( mBroadcastFormat.getFileExtension() );
|
sb.append(mBroadcastFormat.getFileExtension());
|
||||||
|
|
||||||
Path temporaryRecordingPath = mTempDirectory.resolve(sb.toString());
|
Path temporaryRecordingPath = mTempDirectory.resolve(sb.toString());
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ public class StreamManager implements Listener<AudioPacket>
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
synchronized (mStreamRecorders)
|
synchronized(mStreamRecorders)
|
||||||
{
|
{
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* sdrtrunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,9 +19,7 @@
|
|||||||
package audio.broadcast.icecast;
|
package audio.broadcast.icecast;
|
||||||
|
|
||||||
import audio.broadcast.IBroadcastMetadataUpdater;
|
import audio.broadcast.IBroadcastMetadataUpdater;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import org.apache.mina.core.future.ConnectFuture;
|
import org.apache.mina.core.future.ConnectFuture;
|
||||||
import org.apache.mina.core.service.IoHandlerAdapter;
|
import org.apache.mina.core.service.IoHandlerAdapter;
|
||||||
@@ -58,7 +56,7 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
|
|||||||
private NioSocketConnector mSocketConnector;
|
private NioSocketConnector mSocketConnector;
|
||||||
private AtomicBoolean mUpdating = new AtomicBoolean();
|
private AtomicBoolean mUpdating = new AtomicBoolean();
|
||||||
private Queue<String> mMetadataQueue = new LinkedTransferQueue<>();
|
private Queue<String> mMetadataQueue = new LinkedTransferQueue<>();
|
||||||
private Map<String, String> mHTTPHeaders;
|
private Map<String,String> mHTTPHeaders;
|
||||||
private boolean mStackTraceLoggingSuppressed;
|
private boolean mStackTraceLoggingSuppressed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,7 +76,7 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
|
|||||||
*/
|
*/
|
||||||
private NioSocketConnector getSocketConnector()
|
private NioSocketConnector getSocketConnector()
|
||||||
{
|
{
|
||||||
if (mSocketConnector == null)
|
if(mSocketConnector == null)
|
||||||
{
|
{
|
||||||
mSocketConnector = new NioSocketConnector();
|
mSocketConnector = new NioSocketConnector();
|
||||||
// mSocketConnector.getFilterChain().addLast("logger", new LoggingFilter(IcecastBroadcastMetadataUpdater.class));
|
// mSocketConnector.getFilterChain().addLast("logger", new LoggingFilter(IcecastBroadcastMetadataUpdater.class));
|
||||||
@@ -116,19 +114,19 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
|
|||||||
* and will remain in the update queue until the next metadata update is requested. However, this is a design
|
* and will remain in the update queue until the next metadata update is requested. However, this is a design
|
||||||
* trade-off to avoid having a scheduled runnable repeatedly processing the update queue.
|
* trade-off to avoid having a scheduled runnable repeatedly processing the update queue.
|
||||||
*/
|
*/
|
||||||
public void update(AudioMetadata audioMetadata)
|
public void update(Metadata metadata)
|
||||||
{
|
{
|
||||||
mMetadataQueue.offer(getSong(audioMetadata));
|
mMetadataQueue.offer(getSong(metadata));
|
||||||
|
|
||||||
if (mUpdating.compareAndSet(false, true))
|
if(mUpdating.compareAndSet(false, true))
|
||||||
{
|
{
|
||||||
String song = mMetadataQueue.poll();
|
String song = mMetadataQueue.poll();
|
||||||
|
|
||||||
while (song != null)
|
while(song != null)
|
||||||
{
|
{
|
||||||
HttpRequest updateRequest = createUpdateRequest(song);
|
HttpRequest updateRequest = createUpdateRequest(song);
|
||||||
|
|
||||||
if (updateRequest != null)
|
if(updateRequest != null)
|
||||||
{
|
{
|
||||||
mThreadPoolManager.scheduleOnce(new Runnable()
|
mThreadPoolManager.scheduleOnce(new Runnable()
|
||||||
{
|
{
|
||||||
@@ -143,22 +141,22 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
|
|||||||
connectFuture.awaitUninterruptibly();
|
connectFuture.awaitUninterruptibly();
|
||||||
IoSession session = connectFuture.getSession();
|
IoSession session = connectFuture.getSession();
|
||||||
|
|
||||||
if (session != null)
|
if(session != null)
|
||||||
{
|
{
|
||||||
session.write(updateRequest);
|
session.write(updateRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
Throwable throwableCause = e.getCause();
|
Throwable throwableCause = e.getCause();
|
||||||
|
|
||||||
if (throwableCause instanceof ConnectException)
|
if(throwableCause instanceof ConnectException)
|
||||||
{
|
{
|
||||||
//Do nothing, the server is unavailable
|
//Do nothing, the server is unavailable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!mStackTraceLoggingSuppressed)
|
if(!mStackTraceLoggingSuppressed)
|
||||||
{
|
{
|
||||||
mLog.error("Error sending metadata update. Future errors will " +
|
mLog.error("Error sending metadata update. Future errors will " +
|
||||||
"be suppressed", e);
|
"be suppressed", e);
|
||||||
@@ -182,52 +180,45 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
|
|||||||
/**
|
/**
|
||||||
* Creates the song information for a metadata update
|
* Creates the song information for a metadata update
|
||||||
*/
|
*/
|
||||||
private static String getSong(AudioMetadata audioMetadata)
|
private static String getSong(Metadata metadata)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if(audioMetadata != null)
|
if(metadata != null)
|
||||||
{
|
{
|
||||||
Metadata to = audioMetadata.getMetadata(MetadataType.TO);
|
String to = metadata.getPrimaryAddressTo().getIdentifier();
|
||||||
|
|
||||||
sb.append("TO:");
|
sb.append("TO:");
|
||||||
|
|
||||||
if(to != null)
|
if(metadata.getPrimaryAddressTo().hasAlias())
|
||||||
{
|
{
|
||||||
if(to.hasAlias())
|
sb.append(metadata.getPrimaryAddressTo().getAlias().getName());
|
||||||
{
|
|
||||||
sb.append(to.getAlias().getName());
|
|
||||||
}
|
}
|
||||||
else
|
else if(metadata.getPrimaryAddressTo().hasIdentifier())
|
||||||
{
|
{
|
||||||
sb.append(to.getValue());
|
sb.append(metadata.getPrimaryAddressTo().getIdentifier());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("UNKNOWN");
|
sb.append("UNKNOWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata from = audioMetadata.getMetadata(MetadataType.FROM);
|
|
||||||
|
|
||||||
sb.append(" FROM:");
|
sb.append(" FROM:");
|
||||||
|
|
||||||
if(from != null)
|
if(metadata.getPrimaryAddressFrom().hasAlias())
|
||||||
{
|
{
|
||||||
|
sb.append(metadata.getPrimaryAddressFrom().getAlias().getName());
|
||||||
if(from.hasAlias())
|
|
||||||
{
|
|
||||||
sb.append(from.getAlias().getName());
|
|
||||||
}
|
}
|
||||||
else
|
else if(metadata.getPrimaryAddressFrom().hasIdentifier())
|
||||||
{
|
{
|
||||||
sb.append(from.getValue());
|
sb.append(metadata.getPrimaryAddressFrom().getIdentifier());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("UNKNOWN");
|
sb.append("UNKNOWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -255,7 +246,7 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
|
|||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e)
|
catch(UnsupportedEncodingException e)
|
||||||
{
|
{
|
||||||
//This should never happen
|
//This should never happen
|
||||||
mLog.error("UTF-8 encoding is not supported - can't update song metadata");
|
mLog.error("UTF-8 encoding is not supported - can't update song metadata");
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
package audio.broadcast.shoutcast.v1;
|
package audio.broadcast.shoutcast.v1;
|
||||||
|
|
||||||
import audio.broadcast.IBroadcastMetadataUpdater;
|
import audio.broadcast.IBroadcastMetadataUpdater;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import org.apache.mina.core.future.ConnectFuture;
|
import org.apache.mina.core.future.ConnectFuture;
|
||||||
import org.apache.mina.core.service.IoHandlerAdapter;
|
import org.apache.mina.core.service.IoHandlerAdapter;
|
||||||
@@ -57,7 +55,6 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
|
|||||||
private NioSocketConnector mSocketConnector;
|
private NioSocketConnector mSocketConnector;
|
||||||
private AtomicBoolean mUpdating = new AtomicBoolean();
|
private AtomicBoolean mUpdating = new AtomicBoolean();
|
||||||
private Queue<String> mMetadataQueue = new LinkedTransferQueue<>();
|
private Queue<String> mMetadataQueue = new LinkedTransferQueue<>();
|
||||||
private Map<String, String> mHTTPHeaders;
|
|
||||||
private boolean mStackTraceLoggingSuppressed;
|
private boolean mStackTraceLoggingSuppressed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +74,7 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
|
|||||||
*/
|
*/
|
||||||
private NioSocketConnector getSocketConnector()
|
private NioSocketConnector getSocketConnector()
|
||||||
{
|
{
|
||||||
if (mSocketConnector == null)
|
if(mSocketConnector == null)
|
||||||
{
|
{
|
||||||
mSocketConnector = new NioSocketConnector();
|
mSocketConnector = new NioSocketConnector();
|
||||||
|
|
||||||
@@ -116,19 +113,19 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
|
|||||||
* and will remain in the update queue until the next metadata update is requested. However, this is a design
|
* and will remain in the update queue until the next metadata update is requested. However, this is a design
|
||||||
* trade-off to avoid having a scheduled runnable repeatedly processing the update queue.
|
* trade-off to avoid having a scheduled runnable repeatedly processing the update queue.
|
||||||
*/
|
*/
|
||||||
public void update(AudioMetadata audioMetadata)
|
public void update(Metadata metadata)
|
||||||
{
|
{
|
||||||
mMetadataQueue.offer(getSong(audioMetadata));
|
mMetadataQueue.offer(getSong(metadata));
|
||||||
|
|
||||||
if (mUpdating.compareAndSet(false, true))
|
if(mUpdating.compareAndSet(false, true))
|
||||||
{
|
{
|
||||||
String song = mMetadataQueue.poll();
|
String song = mMetadataQueue.poll();
|
||||||
|
|
||||||
while (song != null)
|
while(song != null)
|
||||||
{
|
{
|
||||||
HttpRequest updateRequest = createUpdateRequest(song);
|
HttpRequest updateRequest = createUpdateRequest(song);
|
||||||
|
|
||||||
if (updateRequest != null)
|
if(updateRequest != null)
|
||||||
{
|
{
|
||||||
mThreadPoolManager.scheduleOnce(new Runnable()
|
mThreadPoolManager.scheduleOnce(new Runnable()
|
||||||
{
|
{
|
||||||
@@ -143,22 +140,22 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
|
|||||||
connectFuture.awaitUninterruptibly();
|
connectFuture.awaitUninterruptibly();
|
||||||
IoSession session = connectFuture.getSession();
|
IoSession session = connectFuture.getSession();
|
||||||
|
|
||||||
if (session != null)
|
if(session != null)
|
||||||
{
|
{
|
||||||
session.write(updateRequest);
|
session.write(updateRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
Throwable throwableCause = e.getCause();
|
Throwable throwableCause = e.getCause();
|
||||||
|
|
||||||
if (throwableCause instanceof ConnectException)
|
if(throwableCause instanceof ConnectException)
|
||||||
{
|
{
|
||||||
//Do nothing, the server is unavailable
|
//Do nothing, the server is unavailable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!mStackTraceLoggingSuppressed)
|
if(!mStackTraceLoggingSuppressed)
|
||||||
{
|
{
|
||||||
mLog.error("Error sending metadata update. Future errors will " +
|
mLog.error("Error sending metadata update. Future errors will " +
|
||||||
"be suppressed", e);
|
"be suppressed", e);
|
||||||
@@ -182,52 +179,45 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
|
|||||||
/**
|
/**
|
||||||
* Creates the song information for a metadata update
|
* Creates the song information for a metadata update
|
||||||
*/
|
*/
|
||||||
private static String getSong(AudioMetadata audioMetadata)
|
private static String getSong(Metadata metadata)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if(audioMetadata != null)
|
if(metadata != null)
|
||||||
{
|
{
|
||||||
Metadata to = audioMetadata.getMetadata(MetadataType.TO);
|
String to = metadata.getPrimaryAddressTo().getIdentifier();
|
||||||
|
|
||||||
sb.append("TO:");
|
sb.append("TO:");
|
||||||
|
|
||||||
if(to != null)
|
if(metadata.getPrimaryAddressTo().hasAlias())
|
||||||
{
|
{
|
||||||
if(to.hasAlias())
|
sb.append(metadata.getPrimaryAddressTo().getAlias().getName());
|
||||||
{
|
|
||||||
sb.append(to.getAlias().getName());
|
|
||||||
}
|
}
|
||||||
else
|
else if(metadata.getPrimaryAddressTo().hasIdentifier())
|
||||||
{
|
{
|
||||||
sb.append(to.getValue());
|
sb.append(metadata.getPrimaryAddressTo().getIdentifier());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("UNKNOWN");
|
sb.append("UNKNOWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata from = audioMetadata.getMetadata(MetadataType.FROM);
|
|
||||||
|
|
||||||
sb.append(" FROM:");
|
sb.append(" FROM:");
|
||||||
|
|
||||||
if(from != null)
|
if(metadata.getPrimaryAddressFrom().hasAlias())
|
||||||
{
|
{
|
||||||
|
sb.append(metadata.getPrimaryAddressFrom().getAlias().getName());
|
||||||
if(from.hasAlias())
|
|
||||||
{
|
|
||||||
sb.append(from.getAlias().getName());
|
|
||||||
}
|
}
|
||||||
else
|
else if(metadata.getPrimaryAddressFrom().hasIdentifier())
|
||||||
{
|
{
|
||||||
sb.append(from.getValue());
|
sb.append(metadata.getPrimaryAddressFrom().getIdentifier());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("UNKNOWN");
|
sb.append("UNKNOWN");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -256,7 +246,7 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
|
|||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e)
|
catch(UnsupportedEncodingException e)
|
||||||
{
|
{
|
||||||
//This should never happen
|
//This should never happen
|
||||||
mLog.error("UTF-8 encoding is not supported - can't update song metadata");
|
mLog.error("UTF-8 encoding is not supported - can't update song metadata");
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ import audio.broadcast.shoutcast.v2.ultravox.UltravoxMessageFactory;
|
|||||||
import audio.broadcast.shoutcast.v2.ultravox.UltravoxMessageType;
|
import audio.broadcast.shoutcast.v2.ultravox.UltravoxMessageType;
|
||||||
import audio.broadcast.shoutcast.v2.ultravox.UltravoxMetadata;
|
import audio.broadcast.shoutcast.v2.ultravox.UltravoxMetadata;
|
||||||
import audio.broadcast.shoutcast.v2.ultravox.UltravoxProtocolFactory;
|
import audio.broadcast.shoutcast.v2.ultravox.UltravoxProtocolFactory;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import org.apache.mina.core.RuntimeIoException;
|
import org.apache.mina.core.RuntimeIoException;
|
||||||
import org.apache.mina.core.future.ConnectFuture;
|
import org.apache.mina.core.future.ConnectFuture;
|
||||||
@@ -62,7 +60,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
|
|
||||||
public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBroadcastMetadataUpdater
|
public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBroadcastMetadataUpdater
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( ShoutcastV2AudioBroadcaster.class );
|
private final static Logger mLog = LoggerFactory.getLogger(ShoutcastV2AudioBroadcaster.class);
|
||||||
private static final long RECONNECT_INTERVAL_MILLISECONDS = 30000; //30 seconds
|
private static final long RECONNECT_INTERVAL_MILLISECONDS = 30000; //30 seconds
|
||||||
private int mMaxPayloadSize = 16377;
|
private int mMaxPayloadSize = 16377;
|
||||||
|
|
||||||
@@ -93,7 +91,7 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
|
|
||||||
public ShoutcastV2Configuration getConfiguration()
|
public ShoutcastV2Configuration getConfiguration()
|
||||||
{
|
{
|
||||||
return (ShoutcastV2Configuration)getBroadcastConfiguration();
|
return (ShoutcastV2Configuration) getBroadcastConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +120,7 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(AudioMetadata metadata)
|
public void update(Metadata metadata)
|
||||||
{
|
{
|
||||||
List<UltravoxMessage> metadataMessages = getMetadataMessages(metadata);
|
List<UltravoxMessage> metadataMessages = getMetadataMessages(metadata);
|
||||||
|
|
||||||
@@ -242,7 +240,7 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
* @param metadata containing audio metadata tags and attributes
|
* @param metadata containing audio metadata tags and attributes
|
||||||
* @return a sequence of CacheableXMLMetadata messages sufficient to carry the complete set of metadata
|
* @return a sequence of CacheableXMLMetadata messages sufficient to carry the complete set of metadata
|
||||||
*/
|
*/
|
||||||
private List<UltravoxMessage> getMetadataMessages(AudioMetadata metadata)
|
private List<UltravoxMessage> getMetadataMessages(Metadata metadata)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
@@ -264,30 +262,22 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
|
|
||||||
if(metadata != null)
|
if(metadata != null)
|
||||||
{
|
{
|
||||||
Metadata to = metadata.getMetadata(MetadataType.TO);
|
if(metadata.getPrimaryAddressTo().hasAlias())
|
||||||
if(to != null)
|
|
||||||
{
|
{
|
||||||
if(to.hasAlias())
|
sb.append(UltravoxMetadata.TITLE_2.asXML(metadata.getPrimaryAddressTo().getAlias().getName()));
|
||||||
{
|
|
||||||
sb.append(UltravoxMetadata.TITLE_2.asXML(to.getAlias().toString()));
|
|
||||||
}
|
}
|
||||||
else
|
else if(metadata.getPrimaryAddressTo().hasIdentifier())
|
||||||
{
|
{
|
||||||
sb.append(UltravoxMetadata.TITLE_2.asXML(to.getValue()));
|
sb.append(UltravoxMetadata.TITLE_2.asXML(metadata.getPrimaryAddressTo().getIdentifier()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata from = metadata.getMetadata(MetadataType.FROM);
|
if(metadata.getPrimaryAddressFrom().hasAlias())
|
||||||
if(from != null)
|
|
||||||
{
|
{
|
||||||
if(from.hasAlias())
|
sb.append(UltravoxMetadata.TITLE_3.asXML("From:" + metadata.getPrimaryAddressFrom().getAlias().getName()));
|
||||||
{
|
|
||||||
sb.append(UltravoxMetadata.TITLE_3.asXML("From: " + from.getAlias().toString()));
|
|
||||||
}
|
}
|
||||||
else
|
else if(metadata.getPrimaryAddressFrom().hasIdentifier())
|
||||||
{
|
{
|
||||||
sb.append(UltravoxMetadata.TITLE_3.asXML("From: " + from.getValue()));
|
sb.append(UltravoxMetadata.TITLE_3.asXML("From:" + metadata.getPrimaryAddressFrom().getIdentifier()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -301,7 +291,7 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
|
|
||||||
int pointer = 0;
|
int pointer = 0;
|
||||||
int messageCounter = 1;
|
int messageCounter = 1;
|
||||||
int messageCount = (int)Math.ceil((double)xml.length / (double)(mMaxPayloadSize - 6));
|
int messageCount = (int) Math.ceil((double) xml.length / (double) (mMaxPayloadSize - 6));
|
||||||
|
|
||||||
if(messageCount > 32)
|
if(messageCount > 32)
|
||||||
{
|
{
|
||||||
@@ -317,9 +307,9 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
|
|
||||||
byte[] payload = new byte[payloadSize + 6];
|
byte[] payload = new byte[payloadSize + 6];
|
||||||
|
|
||||||
payload[1] = (byte)(0x01);
|
payload[1] = (byte) (0x01);
|
||||||
payload[3] = (byte)(messageCount & 0xFF);
|
payload[3] = (byte) (messageCount & 0xFF);
|
||||||
payload[5] = (byte)(messageCounter & 0xFF);
|
payload[5] = (byte) (messageCounter & 0xFF);
|
||||||
|
|
||||||
System.arraycopy(xml, pointer, payload, 6, payloadSize);
|
System.arraycopy(xml, pointer, payload, 6, payloadSize);
|
||||||
|
|
||||||
@@ -368,9 +358,9 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(IoSession session, Throwable cause) throws Exception
|
public void exceptionCaught(IoSession session, Throwable cause) throws Exception
|
||||||
{
|
{
|
||||||
if(cause instanceof IOException && ((IOException)cause).getMessage().startsWith("Connection reset"))
|
if(cause instanceof IOException && ((IOException) cause).getMessage().startsWith("Connection reset"))
|
||||||
{
|
{
|
||||||
IOException ioe = (IOException)cause;
|
IOException ioe = (IOException) cause;
|
||||||
|
|
||||||
if(ioe.getMessage() != null && ioe.getMessage().startsWith("Connection reset"))
|
if(ioe.getMessage() != null && ioe.getMessage().startsWith("Connection reset"))
|
||||||
{
|
{
|
||||||
@@ -398,12 +388,12 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
{
|
{
|
||||||
if(object instanceof UltravoxMessage)
|
if(object instanceof UltravoxMessage)
|
||||||
{
|
{
|
||||||
UltravoxMessage ultravoxMessage = (UltravoxMessage)object;
|
UltravoxMessage ultravoxMessage = (UltravoxMessage) object;
|
||||||
|
|
||||||
switch (ultravoxMessage.getMessageType())
|
switch(ultravoxMessage.getMessageType())
|
||||||
{
|
{
|
||||||
case REQUEST_CIPHER:
|
case REQUEST_CIPHER:
|
||||||
String cipherKey = ((RequestCipher)ultravoxMessage).getCipher();
|
String cipherKey = ((RequestCipher) ultravoxMessage).getCipher();
|
||||||
|
|
||||||
AuthenticateBroadcast authenticateBroadcast = new AuthenticateBroadcast();
|
AuthenticateBroadcast authenticateBroadcast = new AuthenticateBroadcast();
|
||||||
|
|
||||||
@@ -476,7 +466,7 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMaxPayloadSize = ((NegotiateMaxPayloadSize)ultravoxMessage).getMaximumPayloadSize();
|
mMaxPayloadSize = ((NegotiateMaxPayloadSize) ultravoxMessage).getMaximumPayloadSize();
|
||||||
|
|
||||||
ConfigureIcyPublic configureIcyPublic = new ConfigureIcyPublic();
|
ConfigureIcyPublic configureIcyPublic = new ConfigureIcyPublic();
|
||||||
configureIcyPublic.setPublic(getConfiguration().isPublic());
|
configureIcyPublic.setPublic(getConfiguration().isPublic());
|
||||||
|
|||||||
@@ -1,357 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* 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
|
|
||||||
* 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 audio.metadata;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import alias.id.broadcast.BroadcastChannel;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
import alias.Alias;
|
|
||||||
import alias.id.priority.Priority;
|
|
||||||
|
|
||||||
public class AudioMetadata implements Listener<Metadata>
|
|
||||||
{
|
|
||||||
protected static final Logger mLog = LoggerFactory.getLogger(AudioMetadata.class);
|
|
||||||
|
|
||||||
private int mSource;
|
|
||||||
private Map<MetadataType, Metadata> mMetadata = new HashMap<>();
|
|
||||||
private boolean mUpdated = false;
|
|
||||||
|
|
||||||
/* Channel Selected == highest priority */
|
|
||||||
private boolean mSelected = false;
|
|
||||||
|
|
||||||
/* Call Priority */
|
|
||||||
private int mPriority = Priority.DEFAULT_PRIORITY;
|
|
||||||
|
|
||||||
/* Indicates if the overall source is recordable */
|
|
||||||
private boolean mSourceRecordable = false;
|
|
||||||
|
|
||||||
/* Indicates the current recordable state */
|
|
||||||
private boolean mRecordable = false;
|
|
||||||
|
|
||||||
/* Indicates the current streamable state */
|
|
||||||
private boolean mStreamable = false;
|
|
||||||
|
|
||||||
/* A unique identifier for this metadata */
|
|
||||||
private String mIdentifier;
|
|
||||||
|
|
||||||
public AudioMetadata(int source, boolean recordable)
|
|
||||||
{
|
|
||||||
mSource = source;
|
|
||||||
|
|
||||||
setIdentifier(mSource);
|
|
||||||
|
|
||||||
mSourceRecordable = recordable;
|
|
||||||
|
|
||||||
setRecordable(mSourceRecordable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a unique identifier for this audio metadata that contains the
|
|
||||||
* source id and optionally the TO metadata string.
|
|
||||||
*/
|
|
||||||
public String getIdentifier()
|
|
||||||
{
|
|
||||||
return mIdentifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentifier(int source)
|
|
||||||
{
|
|
||||||
setIdentifier(source, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdentifier(int source, String id)
|
|
||||||
{
|
|
||||||
mIdentifier = "SRC:" + source + " ID:" + (id == null ? "UNKNOWN" : id);
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a copy of the current audio metadata.
|
|
||||||
*/
|
|
||||||
public AudioMetadata copyOf()
|
|
||||||
{
|
|
||||||
AudioMetadata copy = new AudioMetadata(mSource, mSourceRecordable);
|
|
||||||
|
|
||||||
copy.mPriority = mPriority;
|
|
||||||
copy.mSelected = mSelected;
|
|
||||||
copy.mRecordable = mRecordable;
|
|
||||||
copy.mStreamable = mStreamable;
|
|
||||||
|
|
||||||
copy.mMetadata.putAll(mMetadata);
|
|
||||||
copy.mUpdated = mUpdated;
|
|
||||||
copy.mIdentifier = new String(mIdentifier);
|
|
||||||
|
|
||||||
mUpdated = false;
|
|
||||||
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes any accumulated temporal metadata and returns to a default set.
|
|
||||||
*/
|
|
||||||
public void reset()
|
|
||||||
{
|
|
||||||
//Reset recordable state, identifier and audio call priority levels and reprocess the metadata
|
|
||||||
mRecordable = mSourceRecordable;
|
|
||||||
mStreamable = false;
|
|
||||||
setIdentifier(mSource);
|
|
||||||
mPriority = Priority.DEFAULT_PRIORITY;
|
|
||||||
|
|
||||||
List<MetadataType> toRemove = new ArrayList<>();
|
|
||||||
|
|
||||||
for (MetadataType type : mMetadata.keySet())
|
|
||||||
{
|
|
||||||
Metadata metadata = mMetadata.get(type);
|
|
||||||
|
|
||||||
if (metadata != null)
|
|
||||||
{
|
|
||||||
if (metadata.isTemporal())
|
|
||||||
{
|
|
||||||
toRemove.add(type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
processMetadata(metadata);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MetadataType type : toRemove)
|
|
||||||
{
|
|
||||||
mMetadata.remove(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processMetadata(Metadata metadata)
|
|
||||||
{
|
|
||||||
if (metadata.hasAlias())
|
|
||||||
{
|
|
||||||
Alias alias = metadata.getAlias();
|
|
||||||
|
|
||||||
if (metadata.getMetadataType() == MetadataType.FROM || metadata.getMetadataType() == MetadataType.TO)
|
|
||||||
{
|
|
||||||
if (!alias.isRecordable())
|
|
||||||
{
|
|
||||||
mRecordable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alias.isStreamable())
|
|
||||||
{
|
|
||||||
mStreamable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (metadata.getMetadataType() == MetadataType.TO)
|
|
||||||
{
|
|
||||||
setIdentifier(mSource, metadata.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alias != null && alias.getCallPriority() < mPriority)
|
|
||||||
{
|
|
||||||
mPriority = alias.getCallPriority();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if this audio metadata contains updated information. The flag
|
|
||||||
* will only be set when new data is added and will be reset by a copyOf()
|
|
||||||
* method invocation.
|
|
||||||
*/
|
|
||||||
public boolean isUpdated()
|
|
||||||
{
|
|
||||||
return mUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdated(boolean updated)
|
|
||||||
{
|
|
||||||
mUpdated = updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the metadata. Any temporal metadata will be removed when the
|
|
||||||
* dispose() method is invoked.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void receive(Metadata metadata)
|
|
||||||
{
|
|
||||||
if (metadata.isReset())
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Metadata existing = mMetadata.get(metadata.getMetadataType());
|
|
||||||
|
|
||||||
if (existing == null || !existing.equals(metadata))
|
|
||||||
{
|
|
||||||
mMetadata.put(metadata.getMetadataType(), metadata);
|
|
||||||
processMetadata(metadata);
|
|
||||||
setUpdated(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the complete set of metadata
|
|
||||||
*/
|
|
||||||
public Map<MetadataType, Metadata> getMetadata()
|
|
||||||
{
|
|
||||||
return mMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the metadata object matching the type or null
|
|
||||||
*/
|
|
||||||
public Metadata getMetadata(MetadataType type)
|
|
||||||
{
|
|
||||||
return mMetadata.get(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Source channel ID
|
|
||||||
*/
|
|
||||||
public void setSource(int source)
|
|
||||||
{
|
|
||||||
mSource = source;
|
|
||||||
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSource()
|
|
||||||
{
|
|
||||||
return mSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the priority of this audio packet within the defined min/max priority range
|
|
||||||
*/
|
|
||||||
public void setPriority(int priority)
|
|
||||||
{
|
|
||||||
mPriority = priority;
|
|
||||||
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the priority of this audio metadata
|
|
||||||
*
|
|
||||||
* @return - priority of audio packet where lower numbers are higher priority
|
|
||||||
*/
|
|
||||||
public int getPriority()
|
|
||||||
{
|
|
||||||
return mPriority;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDoNotMonitor()
|
|
||||||
{
|
|
||||||
return mPriority == Priority.DO_NOT_MONITOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Selected audio channel. A selected channel will override the priority
|
|
||||||
* level so that the audio can be listened to immediately.
|
|
||||||
*/
|
|
||||||
public void setSelected(boolean selected)
|
|
||||||
{
|
|
||||||
mSelected = selected;
|
|
||||||
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSelected()
|
|
||||||
{
|
|
||||||
return mSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if audio associated with this metadata is recordable.
|
|
||||||
*/
|
|
||||||
public boolean isRecordable()
|
|
||||||
{
|
|
||||||
return mRecordable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecordable(boolean recordable)
|
|
||||||
{
|
|
||||||
mRecordable = recordable;
|
|
||||||
mUpdated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the audio associated with this metadata is streamable
|
|
||||||
*/
|
|
||||||
public boolean isStreamable()
|
|
||||||
{
|
|
||||||
return mStreamable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<BroadcastChannel> getBroadcastChannels()
|
|
||||||
{
|
|
||||||
Set<BroadcastChannel> broadcastChannels = new TreeSet<>();
|
|
||||||
|
|
||||||
for(Metadata metadata: mMetadata.values())
|
|
||||||
{
|
|
||||||
if(metadata.hasAlias() && metadata.getAlias().isStreamable())
|
|
||||||
{
|
|
||||||
Alias alias = metadata.getAlias();
|
|
||||||
|
|
||||||
broadcastChannels.addAll(alias.getBroadcastChannels());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return broadcastChannels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append("Audio Metadata - source:");
|
|
||||||
sb.append(getSource());
|
|
||||||
sb.append(" priority:");
|
|
||||||
sb.append(getPriority());
|
|
||||||
sb.append(" updated:" + isUpdated());
|
|
||||||
sb.append(" ");
|
|
||||||
|
|
||||||
for (Entry<MetadataType, Metadata> entry : getMetadata().entrySet())
|
|
||||||
{
|
|
||||||
sb.append(entry.getValue().getKey());
|
|
||||||
sb.append(":");
|
|
||||||
sb.append(entry.getValue().getValue());
|
|
||||||
sb.append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package audio.metadata;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
|
|
||||||
public interface IMetadataListener
|
|
||||||
{
|
|
||||||
public Listener<Metadata> getMetadataListener();
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package audio.metadata;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
|
|
||||||
public interface IMetadataProvider
|
|
||||||
{
|
|
||||||
public void setMetadataListener( Listener<Metadata> listener );
|
|
||||||
public void removeMetadataListener();
|
|
||||||
}
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* 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
|
|
||||||
* 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 audio.metadata;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
|
|
||||||
public class Metadata
|
|
||||||
{
|
|
||||||
private MetadataType mMetadataType;
|
|
||||||
private String mValue;
|
|
||||||
private Alias mValueAlias;
|
|
||||||
private boolean mTemporal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constucts a metadata object with the temporal settings. Temporal
|
|
||||||
* indicates that this metadata will be removed at the end of a reset
|
|
||||||
* event, or call end event.
|
|
||||||
*/
|
|
||||||
public Metadata( MetadataType metadataType, String value, Alias alias, boolean temporal )
|
|
||||||
{
|
|
||||||
mMetadataType = metadataType;
|
|
||||||
mValue = value;
|
|
||||||
mValueAlias = alias;
|
|
||||||
mTemporal = temporal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constucts a metadata object with the temporal settings. Temporal
|
|
||||||
* indicates that this metadata will be removed at the end of a reset
|
|
||||||
* event, or call end event.
|
|
||||||
*/
|
|
||||||
public Metadata( MetadataType metadataType, String value, boolean temporal )
|
|
||||||
{
|
|
||||||
this( metadataType, value, null, temporal );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constucts a non-temporal metadata object
|
|
||||||
*/
|
|
||||||
public Metadata( MetadataType metadataType, String value, Alias alias )
|
|
||||||
{
|
|
||||||
this( metadataType, value, alias, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constucts a non-temporal metadata object
|
|
||||||
*/
|
|
||||||
public Metadata( MetadataType metadataType, String value )
|
|
||||||
{
|
|
||||||
this( metadataType, value, null, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
public MetadataType getMetadataType()
|
|
||||||
{
|
|
||||||
return mMetadataType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey()
|
|
||||||
{
|
|
||||||
return mMetadataType.getLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue()
|
|
||||||
{
|
|
||||||
return mValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getAlias()
|
|
||||||
{
|
|
||||||
return mValueAlias;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAlias()
|
|
||||||
{
|
|
||||||
return mValueAlias != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates that this piece of metadata is only valid for the duration of
|
|
||||||
* a call event and should be removed during a reset
|
|
||||||
*/
|
|
||||||
public boolean isTemporal()
|
|
||||||
{
|
|
||||||
return mTemporal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReset()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( mMetadataType.getLabel() );
|
|
||||||
sb.append( ":" );
|
|
||||||
sb.append( mValue );
|
|
||||||
sb.append( " Alias:" );
|
|
||||||
sb.append( mValueAlias == null ? "null" : getAlias().getName() );
|
|
||||||
sb.append( " [" );
|
|
||||||
sb.append( mMetadataType.name() );
|
|
||||||
sb.append( "] temporal:" );
|
|
||||||
sb.append( mTemporal );
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals( Metadata other )
|
|
||||||
{
|
|
||||||
if( mMetadataType != other.getMetadataType() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mTemporal != other.isTemporal() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mValue != null && other.getValue() != null &&
|
|
||||||
!mValue.contentEquals( other.getValue() ))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( mValue == null && other.getValue() != null ) ||
|
|
||||||
( mValue != null && other.getValue() == null ) )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mValueAlias != null && other.getAlias() != null &&
|
|
||||||
!mValueAlias.getName().contentEquals( other.getAlias().getName() ))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( mValueAlias == null && other.getAlias() != null ) ||
|
|
||||||
( mValueAlias != null && other.getAlias() == null ) )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package audio.metadata;
|
|
||||||
|
|
||||||
public class MetadataReset extends Metadata
|
|
||||||
{
|
|
||||||
public MetadataReset()
|
|
||||||
{
|
|
||||||
super( MetadataType.TEMPORAL_RESET, "reset", true );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReset()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package audio.metadata;
|
|
||||||
|
|
||||||
public enum MetadataType
|
|
||||||
{
|
|
||||||
CHANNEL_NUMBER( "Channel Number" ),
|
|
||||||
CHANNEL_NAME( "Channel Name" ),
|
|
||||||
DETAILS( "Details" ),
|
|
||||||
ESN( "ESN" ),
|
|
||||||
FLEETSYNC( "Fleetsync" ),
|
|
||||||
FREQUENCY( "Frequency" ),
|
|
||||||
FROM( "From" ),
|
|
||||||
MDC1200( "MDC-1200" ),
|
|
||||||
MOBILE_ID( "Mobile ID" ),
|
|
||||||
MPT1327( "MPT-1327" ),
|
|
||||||
PROTOCOL( "Protocol" ),
|
|
||||||
SITE_ID( "Site ID" ),
|
|
||||||
STATUS( "Status" ),
|
|
||||||
SYSTEM( "System" ),
|
|
||||||
TO( "To" ),
|
|
||||||
UNIQUE_ID( "Unique ID" ),
|
|
||||||
|
|
||||||
TEMPORAL_RESET( "Reset" );
|
|
||||||
|
|
||||||
private String mLabel;
|
|
||||||
|
|
||||||
private MetadataType( String label )
|
|
||||||
{
|
|
||||||
mLabel = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel()
|
|
||||||
{
|
|
||||||
return mLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return mLabel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,16 +14,21 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package audio.output;
|
package audio.output;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import audio.AudioEvent;
|
||||||
import java.util.ArrayList;
|
import audio.AudioPacket;
|
||||||
import java.util.List;
|
import audio.AudioPacket.Type;
|
||||||
import java.util.concurrent.LinkedTransferQueue;
|
import channel.metadata.Metadata;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import controller.ThreadPoolManager;
|
||||||
import java.util.concurrent.TimeUnit;
|
import controller.ThreadPoolManager.ThreadType;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sample.Broadcaster;
|
||||||
|
import sample.Listener;
|
||||||
|
import source.mixer.MixerChannel;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioFormat;
|
import javax.sound.sampled.AudioFormat;
|
||||||
import javax.sound.sampled.BooleanControl;
|
import javax.sound.sampled.BooleanControl;
|
||||||
@@ -35,29 +40,23 @@ import javax.sound.sampled.LineListener;
|
|||||||
import javax.sound.sampled.LineUnavailableException;
|
import javax.sound.sampled.LineUnavailableException;
|
||||||
import javax.sound.sampled.Mixer;
|
import javax.sound.sampled.Mixer;
|
||||||
import javax.sound.sampled.SourceDataLine;
|
import javax.sound.sampled.SourceDataLine;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
import org.slf4j.Logger;
|
import java.util.ArrayList;
|
||||||
import org.slf4j.LoggerFactory;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.LinkedTransferQueue;
|
||||||
import sample.Broadcaster;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import sample.Listener;
|
import java.util.concurrent.TimeUnit;
|
||||||
import source.mixer.MixerChannel;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import audio.AudioEvent;
|
|
||||||
import audio.AudioPacket;
|
|
||||||
import audio.AudioPacket.Type;
|
|
||||||
import audio.metadata.AudioMetadata;
|
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
import controller.ThreadPoolManager.ThreadType;
|
|
||||||
|
|
||||||
public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( AudioOutput.class );
|
private final static Logger mLog = LoggerFactory.getLogger(AudioOutput.class);
|
||||||
|
|
||||||
private LinkedTransferQueue<AudioPacket> mBuffer = new LinkedTransferQueue<>();
|
private LinkedTransferQueue<AudioPacket> mBuffer = new LinkedTransferQueue<>();
|
||||||
private int mBufferStartThreshold;
|
private int mBufferStartThreshold;
|
||||||
private int mBufferStopThreshold;
|
private int mBufferStopThreshold;
|
||||||
|
|
||||||
private Listener<AudioMetadata> mAudioMetadataListener;
|
private Listener<Metadata> mMetadataListener;
|
||||||
private Broadcaster<AudioEvent> mAudioEventBroadcaster = new Broadcaster<>();
|
private Broadcaster<AudioEvent> mAudioEventBroadcaster = new Broadcaster<>();
|
||||||
|
|
||||||
private ThreadPoolManager mThreadPoolManager;
|
private ThreadPoolManager mThreadPoolManager;
|
||||||
@@ -90,12 +89,12 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
* @param lineInfo to use when obtaining the source data line
|
* @param lineInfo to use when obtaining the source data line
|
||||||
* @param requestedBufferSize of approximately 1 second of audio
|
* @param requestedBufferSize of approximately 1 second of audio
|
||||||
*/
|
*/
|
||||||
public AudioOutput( ThreadPoolManager threadPoolManager,
|
public AudioOutput(ThreadPoolManager threadPoolManager,
|
||||||
Mixer mixer,
|
Mixer mixer,
|
||||||
MixerChannel mixerChannel,
|
MixerChannel mixerChannel,
|
||||||
AudioFormat audioFormat,
|
AudioFormat audioFormat,
|
||||||
Line.Info lineInfo,
|
Line.Info lineInfo,
|
||||||
int requestedBufferSize )
|
int requestedBufferSize)
|
||||||
{
|
{
|
||||||
mThreadPoolManager = threadPoolManager;
|
mThreadPoolManager = threadPoolManager;
|
||||||
mMixer = mixer;
|
mMixer = mixer;
|
||||||
@@ -103,77 +102,77 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mOutput = (SourceDataLine)mMixer.getLine( lineInfo );
|
mOutput = (SourceDataLine) mMixer.getLine(lineInfo);
|
||||||
|
|
||||||
if( mOutput != null )
|
if(mOutput != null)
|
||||||
{
|
{
|
||||||
mOutput.open( audioFormat, requestedBufferSize );
|
mOutput.open(audioFormat, requestedBufferSize);
|
||||||
|
|
||||||
//Start threshold: buffer is full with 10% or less of capacity remaining
|
//Start threshold: buffer is full with 10% or less of capacity remaining
|
||||||
mBufferStartThreshold = (int)( mOutput.getBufferSize() * 0.10 );
|
mBufferStartThreshold = (int) (mOutput.getBufferSize() * 0.10);
|
||||||
|
|
||||||
//Stop threshold: buffer is empty with 90% or more capacity available
|
//Stop threshold: buffer is empty with 90% or more capacity available
|
||||||
mBufferStopThreshold = (int)( mOutput.getBufferSize() * 0.90 );
|
mBufferStopThreshold = (int) (mOutput.getBufferSize() * 0.90);
|
||||||
|
|
||||||
mOutput.addLineListener( this );
|
mOutput.addLineListener(this);
|
||||||
|
|
||||||
if( mOutput != null )
|
if(mOutput != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Control gain = mOutput.getControl( FloatControl.Type.MASTER_GAIN );
|
Control gain = mOutput.getControl(FloatControl.Type.MASTER_GAIN);
|
||||||
mGainControl = (FloatControl)gain;
|
mGainControl = (FloatControl) gain;
|
||||||
}
|
}
|
||||||
catch( IllegalArgumentException iae )
|
catch(IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
mLog.warn( "Couldn't obtain MASTER GAIN control for stereo line [" +
|
mLog.warn("Couldn't obtain MASTER GAIN control for stereo line [" +
|
||||||
mixer.getMixerInfo().getName() + " | " + getChannelName() + "]" );
|
mixer.getMixerInfo().getName() + " | " + getChannelName() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Control mute = mOutput.getControl( BooleanControl.Type.MUTE );
|
Control mute = mOutput.getControl(BooleanControl.Type.MUTE);
|
||||||
mMuteControl = (BooleanControl)mute;
|
mMuteControl = (BooleanControl) mute;
|
||||||
}
|
}
|
||||||
catch( IllegalArgumentException iae )
|
catch(IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
mLog.warn( "Couldn't obtain MUTE control for stereo line [" +
|
mLog.warn("Couldn't obtain MUTE control for stereo line [" +
|
||||||
mixer.getMixerInfo().getName() + " | " + getChannelName() + "]" );
|
mixer.getMixerInfo().getName() + " | " + getChannelName() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run the queue processor task every 40 milliseconds or 25 times a second */
|
/* Run the queue processor task every 40 milliseconds or 25 times a second */
|
||||||
mProcessorTask = mThreadPoolManager.scheduleFixedRate(
|
mProcessorTask = mThreadPoolManager.scheduleFixedRate(
|
||||||
ThreadType.AUDIO_PROCESSING, new BufferProcessor(),
|
ThreadType.AUDIO_PROCESSING, new BufferProcessor(),
|
||||||
40, TimeUnit.MILLISECONDS );
|
40, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAudioStartEvent = new AudioEvent( AudioEvent.Type.AUDIO_STARTED,
|
mAudioStartEvent = new AudioEvent(AudioEvent.Type.AUDIO_STARTED,
|
||||||
getChannelName() );
|
getChannelName());
|
||||||
mAudioStopEvent = new AudioEvent( AudioEvent.Type.AUDIO_STOPPED,
|
mAudioStopEvent = new AudioEvent(AudioEvent.Type.AUDIO_STOPPED,
|
||||||
getChannelName() );
|
getChannelName());
|
||||||
|
|
||||||
mCanProcessAudio = true;
|
mCanProcessAudio = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( LineUnavailableException e )
|
catch(LineUnavailableException e)
|
||||||
{
|
{
|
||||||
mLog.error( "Couldn't obtain audio source data line for "
|
mLog.error("Couldn't obtain audio source data line for "
|
||||||
+ "audio output - mixer [" + mMixer.getMixerInfo().getName() + "]" );
|
+ "audio output - mixer [" + mMixer.getMixerInfo().getName() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
broadcast( new AudioEvent( AudioEvent.Type.AUDIO_STOPPED, getChannelName() ) );
|
broadcast(new AudioEvent(AudioEvent.Type.AUDIO_STOPPED, getChannelName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
mCanProcessAudio = false;
|
mCanProcessAudio = false;
|
||||||
|
|
||||||
if( mProcessorTask != null && mThreadPoolManager != null )
|
if(mProcessorTask != null && mThreadPoolManager != null)
|
||||||
{
|
{
|
||||||
mThreadPoolManager.cancel( mProcessorTask );
|
mThreadPoolManager.cancel(mProcessorTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
mThreadPoolManager = null;
|
mThreadPoolManager = null;
|
||||||
@@ -183,9 +182,9 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
|
|
||||||
mAudioEventBroadcaster.dispose();
|
mAudioEventBroadcaster.dispose();
|
||||||
mAudioEventBroadcaster = null;
|
mAudioEventBroadcaster = null;
|
||||||
mAudioMetadataListener = null;
|
mMetadataListener = null;
|
||||||
|
|
||||||
if( mOutput != null )
|
if(mOutput != null)
|
||||||
{
|
{
|
||||||
mOutput.close();
|
mOutput.close();
|
||||||
}
|
}
|
||||||
@@ -199,7 +198,7 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
* Converts the audio packet data into a byte buffer format appropriate for
|
* Converts the audio packet data into a byte buffer format appropriate for
|
||||||
* the underlying source data line.
|
* the underlying source data line.
|
||||||
*/
|
*/
|
||||||
protected abstract ByteBuffer convert( AudioPacket packet );
|
protected abstract ByteBuffer convert(AudioPacket packet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio output channel name
|
* Audio output channel name
|
||||||
@@ -220,46 +219,46 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
/**
|
/**
|
||||||
* Registers a single listener to receive audio start and audio stop events
|
* Registers a single listener to receive audio start and audio stop events
|
||||||
*/
|
*/
|
||||||
public void addAudioEventListener( Listener<AudioEvent> listener )
|
public void addAudioEventListener(Listener<AudioEvent> listener)
|
||||||
{
|
{
|
||||||
mAudioEventBroadcaster.addListener( listener );
|
mAudioEventBroadcaster.addListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAudioEventListener( Listener<AudioEvent> listener )
|
public void removeAudioEventListener(Listener<AudioEvent> listener)
|
||||||
{
|
{
|
||||||
mAudioEventBroadcaster.removeListener( listener );
|
mAudioEventBroadcaster.removeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts an audio event to the registered listener
|
* Broadcasts an audio event to the registered listener
|
||||||
*/
|
*/
|
||||||
private void broadcast( AudioEvent audioEvent )
|
private void broadcast(AudioEvent audioEvent)
|
||||||
{
|
{
|
||||||
mAudioEventBroadcaster.broadcast( audioEvent );
|
mAudioEventBroadcaster.broadcast(audioEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a single listener to receive the audio metadata from each
|
* Registers a single listener to receive the audio metadata from each
|
||||||
* audio packet
|
* audio packet
|
||||||
*/
|
*/
|
||||||
public void setAudioMetadataListener( Listener<AudioMetadata> listener )
|
public void setMetadataListener(Listener<Metadata> listener)
|
||||||
{
|
{
|
||||||
mAudioMetadataListener = listener;
|
mMetadataListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAudioMetadataListener()
|
public void removeAudioMetadataListener()
|
||||||
{
|
{
|
||||||
mAudioMetadataListener = null;
|
mMetadataListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts audio metadata to the registered listener
|
* Broadcasts audio metadata to the registered listener
|
||||||
*/
|
*/
|
||||||
private void broadcast( AudioMetadata metadata )
|
private void broadcast(Metadata metadata)
|
||||||
{
|
{
|
||||||
if( mAudioMetadataListener != null )
|
if(mMetadataListener != null)
|
||||||
{
|
{
|
||||||
mAudioMetadataListener.receive( metadata );
|
mMetadataListener.receive(metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,15 +279,15 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( AudioPacket packet )
|
public void receive(AudioPacket packet)
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio )
|
if(mCanProcessAudio)
|
||||||
{
|
{
|
||||||
//Update the activity timestamp so that this audio output doesn't
|
//Update the activity timestamp so that this audio output doesn't
|
||||||
//get disconnected before it starts processing the audio stream
|
//get disconnected before it starts processing the audio stream
|
||||||
updateTimestamp();
|
updateTimestamp();
|
||||||
|
|
||||||
mBuffer.add( packet );
|
mBuffer.add(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,42 +306,42 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
{
|
{
|
||||||
/* The processing flag ensures that only one instance of the
|
/* The processing flag ensures that only one instance of the
|
||||||
* processor can run at any given time */
|
* processor can run at any given time */
|
||||||
if( mProcessing.compareAndSet( false, true ) )
|
if(mProcessing.compareAndSet(false, true))
|
||||||
{
|
{
|
||||||
List<AudioPacket> packets = new ArrayList<AudioPacket>();
|
List<AudioPacket> packets = new ArrayList<AudioPacket>();
|
||||||
|
|
||||||
mBuffer.drainTo( packets );
|
mBuffer.drainTo(packets);
|
||||||
|
|
||||||
for( AudioPacket packet: packets )
|
for(AudioPacket packet : packets)
|
||||||
{
|
{
|
||||||
if( packet.getType() == Type.AUDIO )
|
if(packet.getType() == Type.AUDIO)
|
||||||
{
|
{
|
||||||
broadcast( packet.getAudioMetadata() );
|
broadcast(packet.getMetadata());
|
||||||
|
|
||||||
ByteBuffer buffer = convert( packet );
|
ByteBuffer buffer = convert(packet);
|
||||||
|
|
||||||
int wrote = 0;
|
int wrote = 0;
|
||||||
|
|
||||||
if( !mOutput.isRunning() )
|
if(!mOutput.isRunning())
|
||||||
{
|
{
|
||||||
int toWrite = mOutput.available();
|
int toWrite = mOutput.available();
|
||||||
|
|
||||||
if( toWrite > buffer.array().length )
|
if(toWrite > buffer.array().length)
|
||||||
{
|
{
|
||||||
toWrite = buffer.array().length;
|
toWrite = buffer.array().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Top off the buffer and check if we can start it
|
//Top off the buffer and check if we can start it
|
||||||
wrote += mOutput.write( buffer.array(), 0, toWrite );
|
wrote += mOutput.write(buffer.array(), 0, toWrite);
|
||||||
|
|
||||||
checkStart();
|
checkStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mOutput.isRunning() && wrote < buffer.array().length )
|
if(mOutput.isRunning() && wrote < buffer.array().length)
|
||||||
{
|
{
|
||||||
//Blocking write
|
//Blocking write
|
||||||
wrote += mOutput.write( buffer.array(), wrote,
|
wrote += mOutput.write(buffer.array(), wrote,
|
||||||
buffer.array().length - wrote );
|
buffer.array().length - wrote);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTimestamp();
|
updateTimestamp();
|
||||||
@@ -351,12 +350,12 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
|
|
||||||
checkStop();
|
checkStop();
|
||||||
|
|
||||||
mProcessing.set( false );
|
mProcessing.set(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
mLog.error( "Error while processing audio buffers", e );
|
mLog.error("Error while processing audio buffers", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,9 +365,9 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
*/
|
*/
|
||||||
private void checkStart()
|
private void checkStart()
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio &&
|
if(mCanProcessAudio &&
|
||||||
!mOutput.isRunning() &&
|
!mOutput.isRunning() &&
|
||||||
mOutput.available() <= mBufferStartThreshold )
|
mOutput.available() <= mBufferStartThreshold)
|
||||||
{
|
{
|
||||||
mOutput.start();
|
mOutput.start();
|
||||||
}
|
}
|
||||||
@@ -381,9 +380,9 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
*/
|
*/
|
||||||
private void checkStop()
|
private void checkStop()
|
||||||
{
|
{
|
||||||
if( mCanProcessAudio &&
|
if(mCanProcessAudio &&
|
||||||
mOutput.isRunning() &&
|
mOutput.isRunning() &&
|
||||||
mOutput.available() >= mBufferStopThreshold )
|
mOutput.available() >= mBufferStopThreshold)
|
||||||
{
|
{
|
||||||
mOutput.drain();
|
mOutput.drain();
|
||||||
mOutput.stop();
|
mOutput.stop();
|
||||||
@@ -394,14 +393,14 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
/**
|
/**
|
||||||
* Sets the mute state for this audio output channel
|
* Sets the mute state for this audio output channel
|
||||||
*/
|
*/
|
||||||
public void setMuted( boolean muted )
|
public void setMuted(boolean muted)
|
||||||
{
|
{
|
||||||
if( mMuteControl != null )
|
if(mMuteControl != null)
|
||||||
{
|
{
|
||||||
mMuteControl.setValue( muted );
|
mMuteControl.setValue(muted);
|
||||||
|
|
||||||
broadcast( new AudioEvent( muted ? AudioEvent.Type.AUDIO_MUTED :
|
broadcast(new AudioEvent(muted ? AudioEvent.Type.AUDIO_MUTED :
|
||||||
AudioEvent.Type.AUDIO_UNMUTED, getChannelName() ) );
|
AudioEvent.Type.AUDIO_UNMUTED, getChannelName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +409,7 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
*/
|
*/
|
||||||
public boolean isMuted()
|
public boolean isMuted()
|
||||||
{
|
{
|
||||||
if( mMuteControl != null )
|
if(mMuteControl != null)
|
||||||
{
|
{
|
||||||
return mMuteControl.getValue();
|
return mMuteControl.getValue();
|
||||||
}
|
}
|
||||||
@@ -436,17 +435,17 @@ public abstract class AudioOutput implements Listener<AudioPacket>, LineListener
|
|||||||
* to the registered listener as the state changes
|
* to the registered listener as the state changes
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update( LineEvent event )
|
public void update(LineEvent event)
|
||||||
{
|
{
|
||||||
LineEvent.Type type = event.getType();
|
LineEvent.Type type = event.getType();
|
||||||
|
|
||||||
if( type == LineEvent.Type.START )
|
if(type == LineEvent.Type.START)
|
||||||
{
|
{
|
||||||
mAudioEventBroadcaster.broadcast( mAudioStartEvent );
|
mAudioEventBroadcaster.broadcast(mAudioStartEvent);
|
||||||
}
|
}
|
||||||
else if( type == LineEvent.Type.STOP )
|
else if(type == LineEvent.Type.STOP)
|
||||||
{
|
{
|
||||||
mAudioEventBroadcaster.broadcast( mAudioStopEvent );
|
mAudioEventBroadcaster.broadcast(mAudioStopEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public enum Attribute
|
|||||||
CHANNEL_CONFIGURATION_LABEL_1,
|
CHANNEL_CONFIGURATION_LABEL_1,
|
||||||
CHANNEL_CONFIGURATION_LABEL_2,
|
CHANNEL_CONFIGURATION_LABEL_2,
|
||||||
CHANNEL_FREQUENCY,
|
CHANNEL_FREQUENCY,
|
||||||
CHANNEL_ID,
|
CHANNEL_FREQUENCY_LABEL,
|
||||||
CHANNEL_STATE,
|
CHANNEL_STATE,
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
MESSAGE_TYPE,
|
MESSAGE_TYPE,
|
||||||
@@ -31,32 +31,7 @@ public enum Attribute
|
|||||||
NETWORK_ID_2,
|
NETWORK_ID_2,
|
||||||
PRIMARY_ADDRESS_FROM,
|
PRIMARY_ADDRESS_FROM,
|
||||||
PRIMARY_ADDRESS_TO,
|
PRIMARY_ADDRESS_TO,
|
||||||
|
PRIMARY_DECODER_TYPE,
|
||||||
SECONDARY_ADDRESS_FROM,
|
SECONDARY_ADDRESS_FROM,
|
||||||
SECONDARY_ADDRESS_TO,
|
SECONDARY_ADDRESS_TO,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TODO: remove all attributes below here ********************
|
|
||||||
|
|
||||||
CHANNEL_NUMBER,
|
|
||||||
CHANNEL_NAME,
|
|
||||||
CHANNEL_SITE_NUMBER,
|
|
||||||
CHANNEL_SITE_NUMBER_ALIAS,
|
|
||||||
DESCRIPTION,
|
|
||||||
FROM_TALKGROUP,
|
|
||||||
FROM_TALKGROUP_ALIAS,
|
|
||||||
FROM_TALKGROUP_TYPE,
|
|
||||||
NAC,
|
|
||||||
SITE,
|
|
||||||
SITE_ALIAS,
|
|
||||||
SITE_NAME,
|
|
||||||
SOURCE,
|
|
||||||
SYSTEM,
|
|
||||||
SYSTEM_NAME,
|
|
||||||
TO_TALKGROUP,
|
|
||||||
TO_TALKGROUP_ALIAS,
|
|
||||||
TO_TALKGROUP_TYPE;
|
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package channel.metadata;
|
package channel.metadata;
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
|
import module.decode.DecoderType;
|
||||||
|
|
||||||
public class AttributeChangeRequest<T>
|
public class AttributeChangeRequest<T>
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,9 @@ public class AttributeChangeRequest<T>
|
|||||||
return mAlias != null;
|
return mAlias != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value as a String or null if the value is not a String instance.
|
||||||
|
*/
|
||||||
public String getStringValue()
|
public String getStringValue()
|
||||||
{
|
{
|
||||||
if(mValue instanceof String)
|
if(mValue instanceof String)
|
||||||
@@ -99,6 +103,9 @@ public class AttributeChangeRequest<T>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value as a Long or null if the value is not a Long instance.
|
||||||
|
*/
|
||||||
public Long getLongValue()
|
public Long getLongValue()
|
||||||
{
|
{
|
||||||
if(mValue instanceof Long)
|
if(mValue instanceof Long)
|
||||||
@@ -108,4 +115,17 @@ public class AttributeChangeRequest<T>
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value as a DecoderType or null if the value is not a DecoderType instance.
|
||||||
|
*/
|
||||||
|
public DecoderType getDecoderTypeValue()
|
||||||
|
{
|
||||||
|
if(mValue instanceof DecoderType)
|
||||||
|
{
|
||||||
|
return (DecoderType)mValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener
|
|||||||
fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION);
|
fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_FREQUENCY:
|
case CHANNEL_FREQUENCY:
|
||||||
case CHANNEL_ID:
|
case CHANNEL_FREQUENCY_LABEL:
|
||||||
fireTableCellUpdated(rowIndex, COLUMN_FREQUENCY);
|
fireTableCellUpdated(rowIndex, COLUMN_FREQUENCY);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE:
|
case CHANNEL_STATE:
|
||||||
|
|||||||
@@ -20,42 +20,86 @@ package channel.metadata;
|
|||||||
|
|
||||||
import com.jidesoft.swing.JideSplitPane;
|
import com.jidesoft.swing.JideSplitPane;
|
||||||
import com.jidesoft.swing.JideTabbedPane;
|
import com.jidesoft.swing.JideTabbedPane;
|
||||||
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import icon.IconManager;
|
||||||
import icon.IconTableModel;
|
import icon.IconTableModel;
|
||||||
|
import module.decode.event.CallEventPanel;
|
||||||
|
import module.decode.event.MessageActivityPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import settings.SettingsManager;
|
||||||
|
import spectrum.ChannelSpectrumPanel;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
public class ChannelMetadataViewer extends JPanel
|
public class ChannelMetadataViewer extends JPanel
|
||||||
{
|
{
|
||||||
private ChannelMetadataModel mChannelMetadataModel;
|
private CallEventPanel mCallEventPanel;
|
||||||
private IconTableModel mIconTableModel;
|
private MessageActivityPanel mMessageActivityPanel;
|
||||||
|
private ChannelSpectrumPanel mChannelSpectrumPanel;
|
||||||
|
private ChannelMetadataPanel mChannelMetadataPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GUI panel that combines the currently decoding channels metadata table and viewers for channel details,
|
* GUI panel that combines the currently decoding channels metadata table and viewers for channel details,
|
||||||
* messages, events, and spectral view.
|
* messages, events, and spectral view.
|
||||||
*/
|
*/
|
||||||
public ChannelMetadataViewer(ChannelMetadataModel channelMetadataModel, IconTableModel iconTableModel)
|
public ChannelMetadataViewer(ChannelProcessingManager channelProcessingManager, IconManager iconManager,
|
||||||
|
SettingsManager settingsManager)
|
||||||
{
|
{
|
||||||
mChannelMetadataModel = channelMetadataModel;
|
mCallEventPanel = new CallEventPanel(iconManager, channelProcessingManager);
|
||||||
mIconTableModel = iconTableModel;
|
mMessageActivityPanel = new MessageActivityPanel(channelProcessingManager);
|
||||||
|
mChannelSpectrumPanel = new ChannelSpectrumPanel(settingsManager, channelProcessingManager);
|
||||||
|
mChannelMetadataPanel = new ChannelMetadataPanel(channelProcessingManager.getChannelMetadataModel(),
|
||||||
|
iconManager.getModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
|
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
|
||||||
|
|
||||||
ChannelMetadataPanel channelMetadataPanel = new ChannelMetadataPanel(mChannelMetadataModel, mIconTableModel);
|
|
||||||
|
|
||||||
JideTabbedPane tabbedPane = new JideTabbedPane();
|
JideTabbedPane tabbedPane = new JideTabbedPane();
|
||||||
tabbedPane.addTab("Details", new JPanel());
|
tabbedPane.addTab("Details", new JPanel());
|
||||||
tabbedPane.addTab("Events", new JPanel());
|
tabbedPane.addTab("Events", mCallEventPanel);
|
||||||
tabbedPane.addTab("Messages", new JPanel());
|
tabbedPane.addTab("Messages", mMessageActivityPanel);
|
||||||
tabbedPane.addTab("Spectrum", new JPanel());
|
tabbedPane.addTab("Spectrum", mChannelSpectrumPanel);
|
||||||
|
|
||||||
JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
|
JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
|
||||||
splitPane.add(channelMetadataPanel);
|
splitPane.add(mChannelMetadataPanel);
|
||||||
splitPane.add(tabbedPane);
|
splitPane.add(tabbedPane);
|
||||||
|
|
||||||
|
//TODO: move this change listener to the metadata table view
|
||||||
|
// /**
|
||||||
|
// * Change listener to enable/disable the channel spectrum display
|
||||||
|
// * only when the tab is visible, and a channel has been selected
|
||||||
|
// */
|
||||||
|
// mTabbedPane.addChangeListener(new ChangeListener()
|
||||||
|
// {
|
||||||
|
// @Override
|
||||||
|
// public void stateChanged(ChangeEvent event)
|
||||||
|
// {
|
||||||
|
// int index = mTabbedPane.getSelectedIndex();
|
||||||
|
//
|
||||||
|
// Component component = mTabbedPane.getComponentAt(index);
|
||||||
|
//
|
||||||
|
// if(component instanceof ChannelSpectrumPanel)
|
||||||
|
// {
|
||||||
|
// mChannelSpectrumPanel.setEnabled(true);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// mChannelSpectrumPanel.setEnabled(false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
//TODO: call, message and spectrum should listen to the metadata table now
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /* Register each of the components to receive channel events when the
|
||||||
|
// * channels are selected or change */
|
||||||
|
// mChannelModel.addListener(mCallEventPanel);
|
||||||
|
// mChannelModel.addListener(mChannelSpectrumPanel);
|
||||||
|
// mChannelModel.addListener(mMessageActivityPanel);
|
||||||
|
|
||||||
add(splitPane);
|
add(splitPane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class Metadata
|
|||||||
|
|
||||||
//Lazily constructed member variables.
|
//Lazily constructed member variables.
|
||||||
private Integer mAudioPriority;
|
private Integer mAudioPriority;
|
||||||
private Boolean mRecordable;
|
protected Boolean mRecordable;
|
||||||
private List<BroadcastChannel> mBroadcastChannels;
|
private List<BroadcastChannel> mBroadcastChannels;
|
||||||
|
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ public class Metadata
|
|||||||
return mChannelConfigurationLabel1;
|
return mChannelConfigurationLabel1;
|
||||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
case CHANNEL_CONFIGURATION_LABEL_2:
|
||||||
return mChannelConfigurationLabel2;
|
return mChannelConfigurationLabel2;
|
||||||
case CHANNEL_ID:
|
case CHANNEL_FREQUENCY_LABEL:
|
||||||
return mChannelFrequencyLabel;
|
return mChannelFrequencyLabel;
|
||||||
case CHANNEL_STATE:
|
case CHANNEL_STATE:
|
||||||
return mState.getDisplayValue();
|
return mState.getDisplayValue();
|
||||||
|
|||||||
@@ -47,6 +47,15 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
public void setSelected(boolean selected)
|
public void setSelected(boolean selected)
|
||||||
{
|
{
|
||||||
mSelected = selected;
|
mSelected = selected;
|
||||||
|
mUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the recordable flag to the argument value and overrides any recordable settings in the enclosed aliases.
|
||||||
|
*/
|
||||||
|
public void setRecordable(boolean recordable)
|
||||||
|
{
|
||||||
|
mRecordable = recordable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,6 +64,7 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
public void setPrimaryDecoderType(DecoderType decoderType)
|
public void setPrimaryDecoderType(DecoderType decoderType)
|
||||||
{
|
{
|
||||||
mPrimaryDecoderType = decoderType;
|
mPrimaryDecoderType = decoderType;
|
||||||
|
mUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,9 +95,9 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
}
|
}
|
||||||
broadcast(Attribute.CHANNEL_FREQUENCY);
|
broadcast(Attribute.CHANNEL_FREQUENCY);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_ID:
|
case CHANNEL_FREQUENCY_LABEL:
|
||||||
mChannelFrequencyLabel = request.getStringValue();
|
mChannelFrequencyLabel = request.getStringValue();
|
||||||
broadcast(Attribute.CHANNEL_ID);
|
broadcast(Attribute.CHANNEL_FREQUENCY_LABEL);
|
||||||
break;
|
break;
|
||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
mMessage = request.getStringValue();
|
mMessage = request.getStringValue();
|
||||||
@@ -117,6 +127,10 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
mPrimaryAddressTo.setAlias(request.getAlias());
|
mPrimaryAddressTo.setAlias(request.getAlias());
|
||||||
broadcast(Attribute.PRIMARY_ADDRESS_TO);
|
broadcast(Attribute.PRIMARY_ADDRESS_TO);
|
||||||
break;
|
break;
|
||||||
|
case PRIMARY_DECODER_TYPE:
|
||||||
|
mPrimaryDecoderType = request.getDecoderTypeValue();
|
||||||
|
broadcast(Attribute.PRIMARY_DECODER_TYPE);
|
||||||
|
break;
|
||||||
case SECONDARY_ADDRESS_FROM:
|
case SECONDARY_ADDRESS_FROM:
|
||||||
mSecondaryAddressFrom.setIdentifier(request.getStringValue());
|
mSecondaryAddressFrom.setIdentifier(request.getStringValue());
|
||||||
mSecondaryAddressFrom.setAlias(request.getAlias());
|
mSecondaryAddressFrom.setAlias(request.getAlias());
|
||||||
@@ -135,6 +149,8 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
throw new IllegalArgumentException("Unrecognized Metadata Attribute: " +
|
throw new IllegalArgumentException("Unrecognized Metadata Attribute: " +
|
||||||
request.getAttribute().name());
|
request.getAttribute().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,6 +194,8 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
mSecondaryAddressTo.reset();
|
mSecondaryAddressTo.reset();
|
||||||
broadcast(Attribute.SECONDARY_ADDRESS_TO);
|
broadcast(Attribute.SECONDARY_ADDRESS_TO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -202,7 +220,7 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
if(hasChannelFrequencyLabel())
|
if(hasChannelFrequencyLabel())
|
||||||
{
|
{
|
||||||
mChannelFrequencyLabel = null;
|
mChannelFrequencyLabel = null;
|
||||||
broadcast(Attribute.CHANNEL_ID);
|
broadcast(Attribute.CHANNEL_FREQUENCY_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasChannelFrequency())
|
if(hasChannelFrequency())
|
||||||
@@ -211,6 +229,12 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
broadcast(Attribute.CHANNEL_FREQUENCY);
|
broadcast(Attribute.CHANNEL_FREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hasPrimaryDecoderType())
|
||||||
|
{
|
||||||
|
mPrimaryDecoderType = null;
|
||||||
|
broadcast(Attribute.PRIMARY_DECODER_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
if(mNetworkID1.hasIdentifier())
|
if(mNetworkID1.hasIdentifier())
|
||||||
{
|
{
|
||||||
mNetworkID1.reset();
|
mNetworkID1.reset();
|
||||||
@@ -222,6 +246,8 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
mNetworkID2.reset();
|
mNetworkID2.reset();
|
||||||
broadcast(Attribute.NETWORK_ID_2);
|
broadcast(Attribute.NETWORK_ID_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,317 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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 channel.state;
|
|
||||||
|
|
||||||
import audio.AudioPanel;
|
|
||||||
import controller.channel.Channel;
|
|
||||||
import controller.channel.ChannelEvent;
|
|
||||||
import controller.channel.ChannelEvent.Event;
|
|
||||||
import controller.channel.ChannelEventListener;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
import controller.channel.ChannelProcessingManager;
|
|
||||||
import icon.IconManager;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.ColorSettingMenuItem;
|
|
||||||
import settings.ColorSettingResetMenuItem;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.awt.event.MouseListener;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gui wrapper for the list of currently processing primary channels
|
|
||||||
*/
|
|
||||||
public class ChannelList extends JPanel implements ChannelEventListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Map<Channel, ChannelPanel> mDisplayedPanels = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
private ChannelModel mChannelModel;
|
|
||||||
private ChannelProcessingManager mChannelProcessingManager;
|
|
||||||
private IconManager mIconManager;
|
|
||||||
private SettingsManager mSettingsManager;
|
|
||||||
private AudioPanel mAudioPanel;
|
|
||||||
|
|
||||||
public ChannelList(ChannelModel channelModel,
|
|
||||||
ChannelProcessingManager channelProcessingManager,
|
|
||||||
IconManager iconManager,
|
|
||||||
SettingsManager settingsManager,
|
|
||||||
AudioPanel audioPanel)
|
|
||||||
{
|
|
||||||
mChannelModel = channelModel;
|
|
||||||
mChannelProcessingManager = channelProcessingManager;
|
|
||||||
mIconManager = iconManager;
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mAudioPanel = audioPanel;
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0,wrap 1", "[grow,fill]", "[]0[]"));
|
|
||||||
setBackground(Color.BLACK);
|
|
||||||
|
|
||||||
addMouseListener(new ListSelectionListener());
|
|
||||||
|
|
||||||
add(mAudioPanel);
|
|
||||||
|
|
||||||
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
|
|
||||||
add(separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void channelChanged(ChannelEvent event)
|
|
||||||
{
|
|
||||||
switch(event.getEvent())
|
|
||||||
{
|
|
||||||
case NOTIFICATION_PROCESSING_START:
|
|
||||||
addChannelPanel(event.getChannel());
|
|
||||||
break;
|
|
||||||
case NOTIFICATION_PROCESSING_STOP:
|
|
||||||
removeChannelPanel(event.getChannel());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addChannelPanel(Channel channel)
|
|
||||||
{
|
|
||||||
if(!mDisplayedPanels.containsKey(channel))
|
|
||||||
{
|
|
||||||
ChannelPanel channelPanel = new ChannelPanel(mChannelModel,
|
|
||||||
mChannelProcessingManager, mIconManager, mSettingsManager, channel);
|
|
||||||
|
|
||||||
add(channelPanel);
|
|
||||||
|
|
||||||
mDisplayedPanels.put(channel, channelPanel);
|
|
||||||
|
|
||||||
revalidate();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeChannelPanel(Channel channel)
|
|
||||||
{
|
|
||||||
if(mDisplayedPanels.containsKey(channel))
|
|
||||||
{
|
|
||||||
ChannelPanel panel = mDisplayedPanels.remove(channel);
|
|
||||||
|
|
||||||
if(panel != null)
|
|
||||||
{
|
|
||||||
remove(panel);
|
|
||||||
|
|
||||||
panel.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
revalidate();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ListSelectionListener implements MouseListener
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e)
|
|
||||||
{
|
|
||||||
Component component = getComponentAt(e.getPoint());
|
|
||||||
|
|
||||||
if(component instanceof ChannelPanel)
|
|
||||||
{
|
|
||||||
ChannelPanel panel = (ChannelPanel) component;
|
|
||||||
|
|
||||||
Channel channel = panel.getChannel();
|
|
||||||
|
|
||||||
if(e.getButton() == MouseEvent.BUTTON1)
|
|
||||||
{
|
|
||||||
if(channel.isSelected())
|
|
||||||
{
|
|
||||||
mChannelModel.broadcast(new ChannelEvent(channel, Event.REQUEST_DESELECT));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mChannelModel.broadcast(new ChannelEvent(channel, Event.REQUEST_SELECT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(e.getButton() == MouseEvent.BUTTON3)
|
|
||||||
{
|
|
||||||
JPopupMenu popupMenu = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenu menu = panel.getContextMenu();
|
|
||||||
|
|
||||||
if(menu != null)
|
|
||||||
{
|
|
||||||
popupMenu.add(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
JMenu colorMenu = new JMenu("Color");
|
|
||||||
popupMenu.add(colorMenu);
|
|
||||||
|
|
||||||
JMenu backgroundMenu = new JMenu("Background");
|
|
||||||
colorMenu.add(backgroundMenu);
|
|
||||||
|
|
||||||
backgroundMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_BACKGROUND));
|
|
||||||
backgroundMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_BACKGROUND));
|
|
||||||
|
|
||||||
JMenu channelsMenu = new JMenu("Channel State");
|
|
||||||
colorMenu.add(channelsMenu);
|
|
||||||
|
|
||||||
JMenu callMenu = new JMenu("Call");
|
|
||||||
channelsMenu.add(callMenu);
|
|
||||||
|
|
||||||
callMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL));
|
|
||||||
callMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL));
|
|
||||||
callMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
callMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL));
|
|
||||||
callMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL));
|
|
||||||
|
|
||||||
JMenu controlMenu = new JMenu("Control");
|
|
||||||
channelsMenu.add(controlMenu);
|
|
||||||
|
|
||||||
controlMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL));
|
|
||||||
controlMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL));
|
|
||||||
controlMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
controlMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL));
|
|
||||||
controlMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL));
|
|
||||||
|
|
||||||
JMenu dataMenu = new JMenu("Data");
|
|
||||||
channelsMenu.add(dataMenu);
|
|
||||||
|
|
||||||
dataMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA));
|
|
||||||
dataMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA));
|
|
||||||
dataMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
dataMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA));
|
|
||||||
dataMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA));
|
|
||||||
|
|
||||||
JMenu fadeMenu = new JMenu("Fade");
|
|
||||||
channelsMenu.add(fadeMenu);
|
|
||||||
|
|
||||||
fadeMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE));
|
|
||||||
fadeMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE));
|
|
||||||
fadeMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
fadeMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE));
|
|
||||||
fadeMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE));
|
|
||||||
|
|
||||||
JMenu idleMenu = new JMenu("Idle");
|
|
||||||
channelsMenu.add(idleMenu);
|
|
||||||
|
|
||||||
idleMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE));
|
|
||||||
idleMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE));
|
|
||||||
idleMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
idleMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE));
|
|
||||||
idleMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE));
|
|
||||||
|
|
||||||
JMenu noTunerMenu = new JMenu("No Tuner");
|
|
||||||
channelsMenu.add(noTunerMenu);
|
|
||||||
|
|
||||||
noTunerMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER));
|
|
||||||
noTunerMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER));
|
|
||||||
noTunerMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
noTunerMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER));
|
|
||||||
noTunerMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER));
|
|
||||||
|
|
||||||
JMenu labelMenu = new JMenu("Labels");
|
|
||||||
colorMenu.add(labelMenu);
|
|
||||||
|
|
||||||
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER));
|
|
||||||
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER));
|
|
||||||
labelMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER));
|
|
||||||
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER));
|
|
||||||
labelMenu.add(new JSeparator());
|
|
||||||
|
|
||||||
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS));
|
|
||||||
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS));
|
|
||||||
|
|
||||||
JMenu selectedMenu = new JMenu("Selected");
|
|
||||||
colorMenu.add(selectedMenu);
|
|
||||||
|
|
||||||
selectedMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL));
|
|
||||||
selectedMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL));
|
|
||||||
|
|
||||||
popupMenu.show(ChannelList.this, e.getX(), e.getY());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mousePressed(MouseEvent e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mouseReleased(MouseEvent e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mouseEntered(MouseEvent e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mouseExited(MouseEvent e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,466 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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 channel.state;
|
|
||||||
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import controller.channel.Channel;
|
|
||||||
import controller.channel.ChannelEvent;
|
|
||||||
import controller.channel.ChannelEvent.Event;
|
|
||||||
import controller.channel.ChannelEventListener;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
import controller.channel.ChannelProcessingManager;
|
|
||||||
import controller.channel.ChannelUtils;
|
|
||||||
import icon.IconManager;
|
|
||||||
import module.ProcessingChain;
|
|
||||||
import module.decode.DecoderFactory;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import record.RecorderType;
|
|
||||||
import record.config.RecordConfiguration;
|
|
||||||
import sample.Listener;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingChangeListener;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ChannelPanel extends JPanel
|
|
||||||
implements Listener<Attribute>,
|
|
||||||
SettingChangeListener,
|
|
||||||
ChannelEventListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(ChannelPanel.class);
|
|
||||||
|
|
||||||
private Font mFontDetails = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
|
||||||
private Font mFontDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
|
||||||
|
|
||||||
protected Color mColorChannelBackground;
|
|
||||||
protected Color mColorChannelSelected;
|
|
||||||
protected Color mColorTopCall;
|
|
||||||
protected Color mColorMiddleCall;
|
|
||||||
protected Color mColorTopControl;
|
|
||||||
protected Color mColorMiddleControl;
|
|
||||||
protected Color mColorTopData;
|
|
||||||
protected Color mColorMiddleData;
|
|
||||||
protected Color mColorTopFade;
|
|
||||||
protected Color mColorMiddleFade;
|
|
||||||
protected Color mColorTopIdle;
|
|
||||||
protected Color mColorMiddleIdle;
|
|
||||||
protected Color mColorTopNoTuner;
|
|
||||||
protected Color mColorMiddleNoTuner;
|
|
||||||
protected Color mColorLabelDetails;
|
|
||||||
protected Color mColorLabelDecoder;
|
|
||||||
protected Color mColorLabelAuxDecoder;
|
|
||||||
|
|
||||||
private JLabel mStateLabel;
|
|
||||||
private JLabel mSourceLabel;
|
|
||||||
private JLabel mOptionsLabel;
|
|
||||||
|
|
||||||
private JLabel mSystemLabel;
|
|
||||||
private JLabel mSiteLabel;
|
|
||||||
private JLabel mChannelLabel;
|
|
||||||
|
|
||||||
protected SettingsManager mSettingsManager;
|
|
||||||
protected IconManager mIconManager;
|
|
||||||
|
|
||||||
private Channel mChannel;
|
|
||||||
private ChannelState mChannelState;
|
|
||||||
private List<DecoderPanel> mDecoderPanels = new ArrayList<>();
|
|
||||||
private ChannelModel mChannelModel;
|
|
||||||
private ChannelProcessingManager mChannelProcessingManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gui component to a channel state. Provides System, Site and channel
|
|
||||||
* name, source and channel state visualization.
|
|
||||||
*
|
|
||||||
* Updates color background according to current channel state.
|
|
||||||
*/
|
|
||||||
public ChannelPanel(ChannelModel channelModel,
|
|
||||||
ChannelProcessingManager channelProcessingManager,
|
|
||||||
IconManager iconManager,
|
|
||||||
SettingsManager settingsManager,
|
|
||||||
Channel channel)
|
|
||||||
{
|
|
||||||
mChannelModel = channelModel;
|
|
||||||
mChannelProcessingManager = channelProcessingManager;
|
|
||||||
mIconManager = iconManager;
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mChannel = channel;
|
|
||||||
|
|
||||||
ProcessingChain processingChain =
|
|
||||||
channelProcessingManager.getProcessingChain(mChannel);
|
|
||||||
|
|
||||||
if(processingChain != null)
|
|
||||||
{
|
|
||||||
mChannelState = processingChain.getChannelState();
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
for(DecoderState decoderState : processingChain.getDecoderStates())
|
|
||||||
{
|
|
||||||
DecoderPanel panel = DecoderFactory.getDecoderPanel(mIconManager, mSettingsManager, decoderState);
|
|
||||||
mDecoderPanels.add(panel);
|
|
||||||
add(panel, "grow,span");
|
|
||||||
}
|
|
||||||
|
|
||||||
mChannelState.setChangedAttributeListener(this);
|
|
||||||
mChannelModel.addListener(this);
|
|
||||||
mSettingsManager.addListener(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mLog.error("Processing Chain was null!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
getColors();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 1 1 1 1", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mSystemLabel = new JLabel(mChannel.getSystem());
|
|
||||||
mSystemLabel.setFont(mFontDetails);
|
|
||||||
mSystemLabel.setForeground(mColorLabelDetails);
|
|
||||||
add(mSystemLabel);
|
|
||||||
|
|
||||||
mSiteLabel = new JLabel(mChannel.getSite());
|
|
||||||
mSiteLabel.setFont(mFontDetails);
|
|
||||||
mSiteLabel.setForeground(mColorLabelDetails);
|
|
||||||
add(mSiteLabel);
|
|
||||||
|
|
||||||
mChannelLabel = new JLabel(mChannel.getName());
|
|
||||||
mChannelLabel.setFont(mFontDetails);
|
|
||||||
mChannelLabel.setForeground(mColorLabelDetails);
|
|
||||||
add(mChannelLabel, "wrap");
|
|
||||||
|
|
||||||
mStateLabel = new JLabel(mChannelState.getState().getDisplayValue());
|
|
||||||
mStateLabel.setFont(mFontDecoder);
|
|
||||||
mStateLabel.setForeground(mColorLabelDecoder);
|
|
||||||
add(mStateLabel);
|
|
||||||
|
|
||||||
mSourceLabel = new JLabel(mChannel.getSourceConfiguration().getDescription());
|
|
||||||
mSourceLabel.setFont(mFontDetails);
|
|
||||||
mSourceLabel.setForeground(mColorLabelDetails);
|
|
||||||
add(mSourceLabel);
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
if(!mChannel.getEventLogConfiguration().getLoggers().isEmpty())
|
|
||||||
{
|
|
||||||
sb.append("LOG ");
|
|
||||||
}
|
|
||||||
|
|
||||||
RecordConfiguration recordConfig = mChannel.getRecordConfiguration();
|
|
||||||
|
|
||||||
if(recordConfig.getRecorders().contains(RecorderType.AUDIO))
|
|
||||||
{
|
|
||||||
sb.append("AUDIO ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(recordConfig.getRecorders().contains(RecorderType.BASEBAND) ||
|
|
||||||
recordConfig.getRecorders().contains(RecorderType.TRAFFIC_BASEBAND))
|
|
||||||
{
|
|
||||||
sb.append("BASEBAND");
|
|
||||||
}
|
|
||||||
|
|
||||||
mOptionsLabel = new JLabel(sb.toString());
|
|
||||||
mOptionsLabel.setFont(mFontDetails);
|
|
||||||
mOptionsLabel.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mOptionsLabel, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Channel getChannel()
|
|
||||||
{
|
|
||||||
return mChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
mChannelModel.removeListener(this);
|
|
||||||
mChannelModel = null;
|
|
||||||
|
|
||||||
mChannelProcessingManager = null;
|
|
||||||
|
|
||||||
mSettingsManager.removeListener(this);
|
|
||||||
mSettingsManager = null;
|
|
||||||
|
|
||||||
mChannelState.removeChangedAttributeListener();
|
|
||||||
mChannelState = null;
|
|
||||||
mChannel = null;
|
|
||||||
|
|
||||||
for(DecoderPanel panel : mDecoderPanels)
|
|
||||||
{
|
|
||||||
panel.dispose();
|
|
||||||
remove(panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
mDecoderPanels.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE:
|
|
||||||
if(mChannelState != null && mChannelState.getState() != null)
|
|
||||||
{
|
|
||||||
mStateLabel.setText(mChannelState.getState().getDisplayValue());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SOURCE:
|
|
||||||
mSourceLabel.setText(mChannel.getSourceConfiguration()
|
|
||||||
.getDescription());
|
|
||||||
break;
|
|
||||||
case CHANNEL_NAME:
|
|
||||||
case SITE_NAME:
|
|
||||||
case SYSTEM_NAME:
|
|
||||||
mChannelLabel.setText(mChannel.toString());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void paintComponent(Graphics g)
|
|
||||||
{
|
|
||||||
super.paintComponent(g);
|
|
||||||
|
|
||||||
setBackground(mColorChannelBackground);
|
|
||||||
|
|
||||||
Graphics2D g2 = (Graphics2D) g.create();
|
|
||||||
|
|
||||||
Paint p = null;
|
|
||||||
|
|
||||||
final Channel channel = mChannel;
|
|
||||||
|
|
||||||
if(mChannelState != null)
|
|
||||||
{
|
|
||||||
switch(mChannelState.getState())
|
|
||||||
{
|
|
||||||
case CALL:
|
|
||||||
p = getGradient(mColorTopCall, mColorMiddleCall);
|
|
||||||
break;
|
|
||||||
case CONTROL:
|
|
||||||
p = getGradient(mColorTopControl, mColorMiddleControl);
|
|
||||||
break;
|
|
||||||
case DATA:
|
|
||||||
p = getGradient(mColorTopData, mColorMiddleData);
|
|
||||||
break;
|
|
||||||
case FADE:
|
|
||||||
p = getGradient(mColorTopFade, mColorMiddleFade);
|
|
||||||
break;
|
|
||||||
case IDLE:
|
|
||||||
default:
|
|
||||||
p = getGradient(mColorTopIdle, mColorMiddleIdle);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(p == null)
|
|
||||||
{
|
|
||||||
p = getGradient(mColorTopIdle, mColorMiddleIdle);
|
|
||||||
}
|
|
||||||
|
|
||||||
g2.setPaint(p);
|
|
||||||
g2.fillRect(0, 0, getWidth(), getHeight());
|
|
||||||
|
|
||||||
/* Draw bottom separator line */
|
|
||||||
g2.setColor(Color.LIGHT_GRAY);
|
|
||||||
g2.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
|
|
||||||
|
|
||||||
/* Draw channel selected box */
|
|
||||||
if(getChannel() != null && getChannel().isSelected())
|
|
||||||
{
|
|
||||||
g2.setColor(mColorChannelSelected);
|
|
||||||
g2.drawRect(1, 1, getWidth() - 2, getHeight() - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
g2.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void getColors()
|
|
||||||
{
|
|
||||||
mColorChannelBackground = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_BACKGROUND).getColor();
|
|
||||||
mColorChannelSelected = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL).getColor();
|
|
||||||
mColorTopCall = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL).getColor();
|
|
||||||
mColorMiddleCall = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL).getColor();
|
|
||||||
mColorTopControl = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL).getColor();
|
|
||||||
mColorMiddleControl = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL).getColor();
|
|
||||||
mColorTopData = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA).getColor();
|
|
||||||
mColorMiddleData = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA).getColor();
|
|
||||||
mColorTopFade = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE).getColor();
|
|
||||||
mColorMiddleFade = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE).getColor();
|
|
||||||
mColorTopIdle = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE).getColor();
|
|
||||||
mColorMiddleIdle = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE).getColor();
|
|
||||||
mColorTopNoTuner = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER).getColor();
|
|
||||||
mColorMiddleNoTuner = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER).getColor();
|
|
||||||
|
|
||||||
mColorLabelDetails = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
|
|
||||||
mColorLabelDecoder = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
|
|
||||||
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER).getColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
private GradientPaint getGradient(Color top, Color middle)
|
|
||||||
{
|
|
||||||
return new GradientPaint(0f, -50.0f, top,
|
|
||||||
0f, (float) getHeight() / 2.2f, middle, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_BACKGROUND:
|
|
||||||
mColorChannelBackground = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_CALL:
|
|
||||||
mColorMiddleCall = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_CALL:
|
|
||||||
mColorTopCall = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL:
|
|
||||||
mColorMiddleControl = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_CONTROL:
|
|
||||||
mColorTopControl = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_DATA:
|
|
||||||
mColorMiddleData = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_DATA:
|
|
||||||
mColorTopData = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_FADE:
|
|
||||||
mColorMiddleFade = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_FADE:
|
|
||||||
mColorTopFade = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_IDLE:
|
|
||||||
mColorMiddleIdle = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_IDLE:
|
|
||||||
mColorTopIdle = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER:
|
|
||||||
mColorMiddleNoTuner = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_NO_TUNER:
|
|
||||||
mColorTopNoTuner = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_AUX_DECODER:
|
|
||||||
mColorLabelAuxDecoder = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
mColorLabelDecoder = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
|
||||||
mColorLabelDetails = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_SELECTED_CHANNEL:
|
|
||||||
mColorChannelSelected = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingDeleted(Setting setting)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public JMenu getContextMenu()
|
|
||||||
{
|
|
||||||
return ChannelUtils.getContextMenu(mChannelModel, mChannelProcessingManager,
|
|
||||||
mChannel, ChannelPanel.this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void channelChanged(ChannelEvent event)
|
|
||||||
{
|
|
||||||
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
|
||||||
event.getChannel() == mChannel)
|
|
||||||
{
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,57 +14,52 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package channel.state;
|
package channel.state;
|
||||||
|
|
||||||
|
import audio.squelch.ISquelchStateProvider;
|
||||||
|
import audio.squelch.SquelchState;
|
||||||
|
import channel.metadata.Attribute;
|
||||||
|
import channel.metadata.AttributeChangeRequest;
|
||||||
|
import channel.metadata.IAttributeChangeRequestListener;
|
||||||
|
import channel.metadata.MutableMetadata;
|
||||||
|
import channel.state.DecoderStateEvent.Event;
|
||||||
|
import channel.traffic.TrafficChannelManager;
|
||||||
|
import controller.channel.Channel.ChannelType;
|
||||||
|
import module.Module;
|
||||||
|
import module.decode.DecoderType;
|
||||||
|
import module.decode.config.DecodeConfiguration;
|
||||||
|
import module.decode.event.CallEvent;
|
||||||
|
import module.decode.event.ICallEventProvider;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sample.Listener;
|
||||||
|
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import channel.metadata.Attribute;
|
public class ChannelState extends Module implements ICallEventProvider, IDecoderStateEventListener,
|
||||||
import channel.metadata.AttributeChangeRequest;
|
IDecoderStateEventProvider, ISquelchStateProvider, IAttributeChangeRequestListener
|
||||||
import channel.metadata.IAttributeChangeRequestListener;
|
|
||||||
import channel.metadata.MutableMetadata;
|
|
||||||
import channel.traffic.TrafficChannelManager;
|
|
||||||
import module.Module;
|
|
||||||
import module.decode.config.DecodeConfiguration;
|
|
||||||
import module.decode.event.CallEvent;
|
|
||||||
import module.decode.event.ICallEventProvider;
|
|
||||||
import channel.state.DecoderStateEvent.Event;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
import audio.metadata.IMetadataProvider;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataReset;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import audio.squelch.ISquelchStateProvider;
|
|
||||||
import audio.squelch.SquelchState;
|
|
||||||
import controller.channel.Channel.ChannelType;
|
|
||||||
|
|
||||||
public class ChannelState extends Module implements ICallEventProvider, IChangedAttributeProvider,
|
|
||||||
IDecoderStateEventListener, IDecoderStateEventProvider, IMetadataProvider, ISquelchStateProvider,
|
|
||||||
IAttributeChangeRequestListener
|
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog = LoggerFactory.getLogger(ChannelState.class);
|
||||||
LoggerFactory.getLogger( ChannelState.class );
|
|
||||||
|
|
||||||
public static final long FADE_TIMEOUT_DELAY = 1200;
|
public static final long FADE_TIMEOUT_DELAY = 1200;
|
||||||
public static final long RESET_TIMEOUT_DELAY = 2000;
|
public static final long RESET_TIMEOUT_DELAY = 2000;
|
||||||
|
|
||||||
private MutableMetadata mMutableMetadata = new MutableMetadata();
|
private MutableMetadata mMutableMetadata = new MutableMetadata();
|
||||||
private State mState = State.IDLE;
|
private State mState = State.IDLE;
|
||||||
|
|
||||||
private Listener<CallEvent> mCallEventListener;
|
private Listener<CallEvent> mCallEventListener;
|
||||||
private Listener<Attribute> mChangedAttributeListener;
|
|
||||||
private Listener<DecoderStateEvent> mDecoderStateListener;
|
private Listener<DecoderStateEvent> mDecoderStateListener;
|
||||||
private Listener<Metadata> mMetadataListener;
|
|
||||||
private Listener<SquelchState> mSquelchStateListener;
|
private Listener<SquelchState> mSquelchStateListener;
|
||||||
private DecoderStateEventReceiver mDecoderStateEventReceiver =
|
private DecoderStateEventReceiver mDecoderStateEventReceiver = new DecoderStateEventReceiver();
|
||||||
new DecoderStateEventReceiver();
|
private StateMonitor mStateMonitor = new StateMonitor();
|
||||||
|
private ScheduledFuture<?> mStateMonitorFuture;
|
||||||
|
private ChannelType mChannelType;
|
||||||
|
private TrafficChannelManager mTrafficChannelEndListener;
|
||||||
|
private CallEvent mTrafficChannelCallEvent;
|
||||||
|
|
||||||
private boolean mSquelchLocked = false;
|
private boolean mSquelchLocked = false;
|
||||||
private boolean mSelected = false;
|
private boolean mSelected = false;
|
||||||
@@ -74,13 +69,6 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
private long mFadeTimeout;
|
private long mFadeTimeout;
|
||||||
private long mEndTimeout;
|
private long mEndTimeout;
|
||||||
|
|
||||||
private StateMonitor mStateMonitor = new StateMonitor();
|
|
||||||
private ScheduledFuture<?> mStateMonitorFuture;
|
|
||||||
|
|
||||||
private ChannelType mChannelType;
|
|
||||||
|
|
||||||
private TrafficChannelManager mTrafficChannelEndListener;
|
|
||||||
private CallEvent mTrafficChannelCallEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channel state tracks the overall state of all processing modules and decoders
|
* Channel state tracks the overall state of all processing modules and decoders
|
||||||
@@ -108,7 +96,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
* ended, while continuing to display the call details for the user
|
* ended, while continuing to display the call details for the user
|
||||||
* TEARDOWN Indicates a traffic channel that will be torn down for reuse.
|
* TEARDOWN Indicates a traffic channel that will be torn down for reuse.
|
||||||
*/
|
*/
|
||||||
public ChannelState( ChannelType channelType )
|
public ChannelState(ChannelType channelType)
|
||||||
{
|
{
|
||||||
mChannelType = channelType;
|
mChannelType = channelType;
|
||||||
}
|
}
|
||||||
@@ -131,33 +119,34 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
@Override
|
@Override
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
broadcast( new DecoderStateEvent( this, Event.RESET, State.IDLE ) );
|
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
|
||||||
|
|
||||||
mMutableMetadata.resetTemporalAttributes();
|
mMutableMetadata.resetTemporalAttributes();
|
||||||
|
|
||||||
mState = State.IDLE;
|
mState = State.IDLE;
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
if( mStateMonitorFuture == null && mStateMonitor != null )
|
if(mStateMonitorFuture == null && mStateMonitor != null)
|
||||||
{
|
{
|
||||||
mMutableMetadata.resetAllAttributes();
|
mMutableMetadata.resetAllAttributes();
|
||||||
|
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
|
|
||||||
if( mTrafficChannelEndListener != null )
|
if(mTrafficChannelEndListener != null)
|
||||||
{
|
{
|
||||||
setState( State.CALL );
|
setState(State.CALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mStateMonitorFuture = executor.scheduleAtFixedRate( mStateMonitor, 0, 20, TimeUnit.MILLISECONDS );
|
mStateMonitorFuture = executor.scheduleAtFixedRate(mStateMonitor, 0, 20, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
catch( RejectedExecutionException ree )
|
catch(RejectedExecutionException ree)
|
||||||
{
|
{
|
||||||
mLog.error( "state monitor scheduled task rejected", ree );
|
mLog.error("state monitor scheduled task rejected", ree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,22 +154,22 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
@Override
|
@Override
|
||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
if( mStateMonitorFuture != null )
|
if(mStateMonitorFuture != null)
|
||||||
{
|
{
|
||||||
boolean success = mStateMonitorFuture.cancel( true );
|
boolean success = mStateMonitorFuture.cancel(true);
|
||||||
|
|
||||||
if( !success )
|
if(!success)
|
||||||
{
|
{
|
||||||
mLog.error("Couldn't stop monitoring scheduled future" );
|
mLog.error("Couldn't stop monitoring scheduled future");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTrafficChannelEndListener = null;
|
mTrafficChannelEndListener = null;
|
||||||
|
|
||||||
if( mTrafficChannelCallEvent != null )
|
if(mTrafficChannelCallEvent != null)
|
||||||
{
|
{
|
||||||
mTrafficChannelCallEvent.end();
|
mTrafficChannelCallEvent.end();
|
||||||
broadcast( mTrafficChannelCallEvent );
|
broadcast(mTrafficChannelCallEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTrafficChannelCallEvent = null;
|
mTrafficChannelCallEvent = null;
|
||||||
@@ -193,7 +182,6 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
mCallEventListener = null;
|
mCallEventListener = null;
|
||||||
mChangedAttributeListener = null;
|
|
||||||
mDecoderStateListener = null;
|
mDecoderStateListener = null;
|
||||||
mSquelchStateListener = null;
|
mSquelchStateListener = null;
|
||||||
mStateMonitor = null;
|
mStateMonitor = null;
|
||||||
@@ -209,27 +197,27 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
return mChannelType == ChannelType.TRAFFIC;
|
return mChannelType == ChannelType.TRAFFIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStandardChannelTimeout( long milliseconds )
|
public void setStandardChannelTimeout(long milliseconds)
|
||||||
{
|
{
|
||||||
mStandardChannelFadeTimeout = milliseconds;
|
mStandardChannelFadeTimeout = milliseconds;
|
||||||
|
|
||||||
if( mChannelType == ChannelType.STANDARD )
|
if(mChannelType == ChannelType.STANDARD)
|
||||||
{
|
{
|
||||||
mFadeTimeout = mStandardChannelFadeTimeout;
|
mFadeTimeout = mStandardChannelFadeTimeout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrafficChannelTimeout( long milliseconds )
|
public void setTrafficChannelTimeout(long milliseconds)
|
||||||
{
|
{
|
||||||
mTrafficChannelFadeTimeout = milliseconds;
|
mTrafficChannelFadeTimeout = milliseconds;
|
||||||
|
|
||||||
if( mChannelType == ChannelType.TRAFFIC )
|
if(mChannelType == ChannelType.TRAFFIC)
|
||||||
{
|
{
|
||||||
mFadeTimeout = System.currentTimeMillis() + mTrafficChannelFadeTimeout;
|
mFadeTimeout = System.currentTimeMillis() + mTrafficChannelFadeTimeout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelected( boolean selected )
|
public void setSelected(boolean selected)
|
||||||
{
|
{
|
||||||
mSelected = selected;
|
mSelected = selected;
|
||||||
}
|
}
|
||||||
@@ -249,7 +237,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
*/
|
*/
|
||||||
private void updateFadeTimeout()
|
private void updateFadeTimeout()
|
||||||
{
|
{
|
||||||
if( isTrafficChannel() )
|
if(isTrafficChannel())
|
||||||
{
|
{
|
||||||
mFadeTimeout = System.currentTimeMillis() + mTrafficChannelFadeTimeout;
|
mFadeTimeout = System.currentTimeMillis() + mTrafficChannelFadeTimeout;
|
||||||
}
|
}
|
||||||
@@ -265,7 +253,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
*/
|
*/
|
||||||
private void updateResetTimeout()
|
private void updateResetTimeout()
|
||||||
{
|
{
|
||||||
if( isTrafficChannel() )
|
if(isTrafficChannel())
|
||||||
{
|
{
|
||||||
mEndTimeout = System.currentTimeMillis();
|
mEndTimeout = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
@@ -278,11 +266,11 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
/**
|
/**
|
||||||
* Broadcasts the squelch state to the registered listener
|
* Broadcasts the squelch state to the registered listener
|
||||||
*/
|
*/
|
||||||
protected void broadcast( SquelchState state )
|
protected void broadcast(SquelchState state)
|
||||||
{
|
{
|
||||||
if( mSquelchStateListener != null && !mSquelchLocked )
|
if(mSquelchStateListener != null && !mSquelchLocked)
|
||||||
{
|
{
|
||||||
mSquelchStateListener.receive( state );
|
mSquelchStateListener.receive(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +278,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
* Sets the squelch state listener
|
* Sets the squelch state listener
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSquelchStateListener( Listener<SquelchState> listener )
|
public void setSquelchStateListener(Listener<SquelchState> listener)
|
||||||
{
|
{
|
||||||
mSquelchStateListener = listener;
|
mSquelchStateListener = listener;
|
||||||
}
|
}
|
||||||
@@ -311,44 +299,41 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
* change. Also broadcasts changed attribute and decoder state events so
|
* change. Also broadcasts changed attribute and decoder state events so
|
||||||
* that external processes can maintain sync with this channel state.
|
* that external processes can maintain sync with this channel state.
|
||||||
*/
|
*/
|
||||||
protected void setState( State state )
|
protected void setState(State state)
|
||||||
{
|
{
|
||||||
synchronized( mState )
|
synchronized(mState)
|
||||||
{
|
{
|
||||||
if( state == mState )
|
if(state == mState)
|
||||||
{
|
{
|
||||||
if( State.CALL_STATES.contains( state ) )
|
if(State.CALL_STATES.contains(state))
|
||||||
{
|
{
|
||||||
updateFadeTimeout();
|
updateFadeTimeout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( state != mState && mState.canChangeTo( state ) )
|
else if(state != mState && mState.canChangeTo(state))
|
||||||
{
|
{
|
||||||
switch( state )
|
switch(state)
|
||||||
{
|
{
|
||||||
case CONTROL:
|
case CONTROL:
|
||||||
//Don't allow traffic channels to be control channels,
|
//Don't allow traffic channels to be control channels,
|
||||||
//otherwise they can't transition to call tear down
|
//otherwise they can't transition to call tear down
|
||||||
if( isStandardChannel() )
|
if(isStandardChannel())
|
||||||
{
|
{
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast(SquelchState.SQUELCH);
|
||||||
updateFadeTimeout();
|
updateFadeTimeout();
|
||||||
mState = state;
|
mState = state;
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DATA:
|
case DATA:
|
||||||
case ENCRYPTED:
|
case ENCRYPTED:
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast(SquelchState.SQUELCH);
|
||||||
updateFadeTimeout();
|
updateFadeTimeout();
|
||||||
mState = state;
|
mState = state;
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
|
||||||
break;
|
break;
|
||||||
case CALL:
|
case CALL:
|
||||||
broadcast( SquelchState.UNSQUELCH );
|
broadcast(SquelchState.UNSQUELCH);
|
||||||
updateFadeTimeout();
|
updateFadeTimeout();
|
||||||
mState = state;
|
mState = state;
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
|
||||||
break;
|
break;
|
||||||
case FADE:
|
case FADE:
|
||||||
processFadeState();
|
processFadeState();
|
||||||
@@ -365,6 +350,8 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -381,66 +368,64 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
updateResetTimeout();
|
updateResetTimeout();
|
||||||
mState = State.FADE;
|
mState = State.FADE;
|
||||||
|
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast(SquelchState.SQUELCH);
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processIdleState()
|
private void processIdleState()
|
||||||
{
|
{
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast(SquelchState.SQUELCH);
|
||||||
|
|
||||||
if( mState == State.FADE )
|
if(mState == State.FADE)
|
||||||
{
|
{
|
||||||
broadcast( new DecoderStateEvent( this, Event.RESET, State.IDLE ) );
|
broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE));
|
||||||
broadcast( new MetadataReset() );
|
getMutableMetadata().resetTemporalAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
mState = State.IDLE;
|
mState = State.IDLE;
|
||||||
|
getMutableMetadata().receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processTeardownState()
|
private void processTeardownState()
|
||||||
{
|
{
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast(SquelchState.SQUELCH);
|
||||||
|
|
||||||
broadcast( new MetadataReset() );
|
getMutableMetadata().resetTemporalAttributes();
|
||||||
|
|
||||||
mState = State.TEARDOWN;
|
mState = State.TEARDOWN;
|
||||||
|
|
||||||
broadcast( Attribute.CHANNEL_STATE );
|
mMutableMetadata.receive(new AttributeChangeRequest<State>(Attribute.CHANNEL_STATE, mState));
|
||||||
|
|
||||||
if( mTrafficChannelEndListener != null )
|
if(mTrafficChannelEndListener != null)
|
||||||
{
|
{
|
||||||
mTrafficChannelEndListener.callEnd( mTrafficChannelCallEvent.getChannel() );
|
mTrafficChannelEndListener.callEnd(mTrafficChannelCallEvent.getChannel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts the call event to the registered listener
|
* Broadcasts the call event to the registered listener
|
||||||
*/
|
*/
|
||||||
protected void broadcast( CallEvent event )
|
protected void broadcast(CallEvent event)
|
||||||
{
|
{
|
||||||
if( mCallEventListener != null )
|
if(mCallEventListener != null)
|
||||||
{
|
{
|
||||||
mCallEventListener.receive( event );
|
mCallEventListener.receive(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCallEventListener( Listener<CallEvent> listener )
|
public void addCallEventListener(Listener<CallEvent> listener)
|
||||||
{
|
{
|
||||||
mCallEventListener = listener;
|
mCallEventListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeCallEventListener( Listener<CallEvent> listener )
|
public void removeCallEventListener(Listener<CallEvent> listener)
|
||||||
{
|
{
|
||||||
mCallEventListener = null;
|
mCallEventListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//NEW:
|
//NEW:
|
||||||
@Override
|
@Override
|
||||||
public Listener<AttributeChangeRequest> getAttributeChangeRequestListener()
|
public Listener<AttributeChangeRequest> getAttributeChangeRequestListener()
|
||||||
@@ -448,44 +433,14 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
return mMutableMetadata;
|
return mMutableMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcasts the channel state attribute change event to all registered
|
|
||||||
* listeners
|
|
||||||
*/
|
|
||||||
protected void broadcast( Attribute attribute )
|
|
||||||
{
|
|
||||||
if( mChangedAttributeListener != null )
|
|
||||||
{
|
|
||||||
mChangedAttributeListener.receive( attribute );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the listener to receive channel state attribute change events
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setChangedAttributeListener( Listener<Attribute> listener )
|
|
||||||
{
|
|
||||||
mChangedAttributeListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the listener to receive channel state attribute change events
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void removeChangedAttributeListener()
|
|
||||||
{
|
|
||||||
mChangedAttributeListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts a channel state event to any registered listeners
|
* Broadcasts a channel state event to any registered listeners
|
||||||
*/
|
*/
|
||||||
protected void broadcast( DecoderStateEvent event )
|
protected void broadcast(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
if( mDecoderStateListener != null )
|
if(mDecoderStateListener != null)
|
||||||
{
|
{
|
||||||
mDecoderStateListener.receive( event );
|
mDecoderStateListener.receive(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +448,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
* Adds a decoder state event listener
|
* Adds a decoder state event listener
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setDecoderStateListener( Listener<DecoderStateEvent> listener )
|
public void setDecoderStateListener(Listener<DecoderStateEvent> listener)
|
||||||
{
|
{
|
||||||
mDecoderStateListener = listener;
|
mDecoderStateListener = listener;
|
||||||
}
|
}
|
||||||
@@ -513,40 +468,11 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
return mDecoderStateEventReceiver;
|
return mDecoderStateEventReceiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcasts metadata to the registered listener
|
|
||||||
*/
|
|
||||||
protected void broadcast( Metadata metadata )
|
|
||||||
{
|
|
||||||
if( mMetadataListener != null )
|
|
||||||
{
|
|
||||||
mMetadataListener.receive( metadata );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a metadata listener
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setMetadataListener( Listener<Metadata> listener )
|
|
||||||
{
|
|
||||||
mMetadataListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the decoder state event listener
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void removeMetadataListener()
|
|
||||||
{
|
|
||||||
mMetadataListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a listener to be notified when a traffic channel call event is
|
* Registers a listener to be notified when a traffic channel call event is
|
||||||
* completed, so that the listener can perform call tear-down
|
* completed, so that the listener can perform call tear-down
|
||||||
*/
|
*/
|
||||||
public void configureAsTrafficChannel( TrafficChannelManager manager, CallEvent callEvent )
|
public void configureAsTrafficChannel(TrafficChannelManager manager, CallEvent callEvent)
|
||||||
{
|
{
|
||||||
mTrafficChannelEndListener = manager;
|
mTrafficChannelEndListener = manager;
|
||||||
|
|
||||||
@@ -555,47 +481,40 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
/* Broadcast the call event details as metadata for the audio manager */
|
/* Broadcast the call event details as metadata for the audio manager */
|
||||||
String channel = mTrafficChannelCallEvent.getChannel();
|
String channel = mTrafficChannelCallEvent.getChannel();
|
||||||
|
|
||||||
if( channel != null )
|
if(channel != null)
|
||||||
{
|
{
|
||||||
broadcast( new Metadata( MetadataType.CHANNEL_NUMBER, channel, true ) );
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast( new Metadata( MetadataType.PROTOCOL,
|
mMutableMetadata.receive(new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
||||||
mTrafficChannelCallEvent.getDecoderType().getDisplayString(), true ) );
|
mTrafficChannelCallEvent.getDecoderType()));
|
||||||
|
|
||||||
String details = mTrafficChannelCallEvent.getDetails();
|
String details = mTrafficChannelCallEvent.getDetails();
|
||||||
|
|
||||||
if( details != null )
|
|
||||||
{
|
|
||||||
broadcast( new Metadata( MetadataType.DETAILS, details, true ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
String from = mTrafficChannelCallEvent.getFromID();
|
String from = mTrafficChannelCallEvent.getFromID();
|
||||||
|
|
||||||
if( from != null )
|
if(from != null)
|
||||||
{
|
{
|
||||||
broadcast( new Metadata( mTrafficChannelCallEvent.getFromIDType(),
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, from));
|
||||||
from, mTrafficChannelCallEvent.getFromIDAlias(), true ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String to = mTrafficChannelCallEvent.getToID();
|
String to = mTrafficChannelCallEvent.getToID();
|
||||||
|
|
||||||
if( to != null )
|
if(to != null)
|
||||||
{
|
{
|
||||||
broadcast( new Metadata( mTrafficChannelCallEvent.getToIDType(), to,
|
mMutableMetadata.receive(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, to));
|
||||||
mTrafficChannelCallEvent.getToIDAlias(), true ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long frequency = mTrafficChannelCallEvent.getFrequency();
|
long frequency = mTrafficChannelCallEvent.getFrequency();
|
||||||
|
|
||||||
if( frequency > 0 )
|
if(frequency > 0)
|
||||||
{
|
{
|
||||||
broadcast( new Metadata( MetadataType.FREQUENCY, String.valueOf( frequency ), true ) );
|
mMutableMetadata.receive(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, frequency));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rebroadcast the allocation event so that the internal decoder states
|
/* Rebroadcast the allocation event so that the internal decoder states
|
||||||
* can self-configure with the call event details */
|
* can self-configure with the call event details */
|
||||||
broadcast( mTrafficChannelCallEvent );
|
broadcast(mTrafficChannelCallEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -604,46 +523,46 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
public class DecoderStateEventReceiver implements Listener<DecoderStateEvent>
|
public class DecoderStateEventReceiver implements Listener<DecoderStateEvent>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void receive( DecoderStateEvent event )
|
public void receive(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
if( event.getSource() != this )
|
if(event.getSource() != this)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case ALWAYS_UNSQUELCH:
|
case ALWAYS_UNSQUELCH:
|
||||||
broadcast( SquelchState.UNSQUELCH );
|
broadcast(SquelchState.UNSQUELCH);
|
||||||
mSquelchLocked = true;
|
mSquelchLocked = true;
|
||||||
break;
|
break;
|
||||||
case CHANGE_CALL_TIMEOUT:
|
case CHANGE_CALL_TIMEOUT:
|
||||||
if( event instanceof ChangeChannelTimeoutEvent )
|
if(event instanceof ChangeChannelTimeoutEvent)
|
||||||
{
|
{
|
||||||
ChangeChannelTimeoutEvent timeout = (ChangeChannelTimeoutEvent)event;
|
ChangeChannelTimeoutEvent timeout = (ChangeChannelTimeoutEvent) event;
|
||||||
|
|
||||||
if( timeout.getChannelType() == ChannelType.STANDARD )
|
if(timeout.getChannelType() == ChannelType.STANDARD)
|
||||||
{
|
{
|
||||||
setStandardChannelTimeout( timeout.getCallTimeout() );
|
setStandardChannelTimeout(timeout.getCallTimeout());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setTrafficChannelTimeout( timeout.getCallTimeout() );
|
setTrafficChannelTimeout(timeout.getCallTimeout());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case CONTINUATION:
|
case CONTINUATION:
|
||||||
case DECODE:
|
case DECODE:
|
||||||
case START:
|
case START:
|
||||||
if( State.CALL_STATES.contains( event.getState() ) )
|
if(State.CALL_STATES.contains(event.getState()))
|
||||||
{
|
{
|
||||||
setState( event.getState() );
|
setState(event.getState());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case END:
|
case END:
|
||||||
if( isTrafficChannel() )
|
if(isTrafficChannel())
|
||||||
{
|
{
|
||||||
setState( State.TEARDOWN );
|
setState(State.TEARDOWN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setState( State.FADE );
|
setState(State.FADE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RESET:
|
case RESET:
|
||||||
@@ -672,17 +591,17 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
synchronized( mState )
|
synchronized(mState)
|
||||||
{
|
{
|
||||||
if( State.CALL_STATES.contains( mState ) &&
|
if(State.CALL_STATES.contains(mState) &&
|
||||||
mFadeTimeout <= System.currentTimeMillis() )
|
mFadeTimeout <= System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
processFadeState();
|
processFadeState();
|
||||||
}
|
}
|
||||||
else if( mState == State.FADE &&
|
else if(mState == State.FADE &&
|
||||||
mEndTimeout <= System.currentTimeMillis() )
|
mEndTimeout <= System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
if( isTrafficChannel() )
|
if(isTrafficChannel())
|
||||||
{
|
{
|
||||||
processTeardownState();
|
processTeardownState();
|
||||||
}
|
}
|
||||||
@@ -693,14 +612,14 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
mLog.error( "Exception thrown while state monitor is running " +
|
mLog.error("Exception thrown while state monitor is running " +
|
||||||
"- state [" + getState() +
|
"- state [" + getState() +
|
||||||
"] current [" + System.currentTimeMillis() +
|
"] current [" + System.currentTimeMillis() +
|
||||||
"] mResetTimeout [" + mEndTimeout +
|
"] mResetTimeout [" + mEndTimeout +
|
||||||
"] mFadeTimeout [" + mFadeTimeout +
|
"] mFadeTimeout [" + mFadeTimeout +
|
||||||
"]", e );
|
"]", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,163 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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 channel.state;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import icon.IconManager;
|
|
||||||
import sample.Listener;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingChangeListener;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public abstract class DecoderPanel extends JPanel
|
|
||||||
implements Listener<Attribute>, SettingChangeListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
protected Font mFontDetails = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
|
||||||
protected Font mFontDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
|
||||||
protected Font mFontAuxDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 10);
|
|
||||||
public static final int ICON_SIZE = 12;
|
|
||||||
|
|
||||||
protected Color mColorLabelDetails;
|
|
||||||
protected Color mColorLabelDecoder;
|
|
||||||
protected Color mColorLabelAuxDecoder;
|
|
||||||
|
|
||||||
protected IconManager mIconManager;
|
|
||||||
protected SettingsManager mSettingsManager;
|
|
||||||
protected DecoderState mDecoderState;
|
|
||||||
|
|
||||||
public DecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
|
||||||
{
|
|
||||||
mIconManager = iconManager;
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mSettingsManager.addListener(this);
|
|
||||||
|
|
||||||
mDecoderState = decoderState;
|
|
||||||
|
|
||||||
mDecoderState.setChangedAttributeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
mSettingsManager.removeListener(this);
|
|
||||||
mSettingsManager = null;
|
|
||||||
|
|
||||||
mDecoderState.removeChangedAttributeListener();
|
|
||||||
mDecoderState = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return mDecoderState;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
getColors();
|
|
||||||
|
|
||||||
setOpaque(false); //Use the parent panel's background color
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getColors()
|
|
||||||
{
|
|
||||||
mColorLabelDetails = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
|
|
||||||
mColorLabelDecoder = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
|
|
||||||
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER).getColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_AUX_DECODER:
|
|
||||||
mColorLabelAuxDecoder = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
mColorLabelDecoder = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
|
||||||
mColorLabelDetails = colorSetting.getColor();
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingDeleted(Setting setting)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setAliasLabel(final JLabel label, final Alias alias)
|
|
||||||
{
|
|
||||||
setAliasLabel(label, alias, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setAliasLabel(final JLabel label, final Alias alias, boolean includeIcon)
|
|
||||||
{
|
|
||||||
if(alias != null)
|
|
||||||
{
|
|
||||||
label.setText(alias.getName());
|
|
||||||
|
|
||||||
if(includeIcon)
|
|
||||||
{
|
|
||||||
String iconName = alias.getIconName();
|
|
||||||
|
|
||||||
if(iconName != null)
|
|
||||||
{
|
|
||||||
label.setIcon(mIconManager.getIcon(iconName, IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setText("");
|
|
||||||
label.setIcon(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
package channel.state;
|
package channel.state;
|
||||||
|
|
||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import audio.metadata.IMetadataProvider;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.metadata.AttributeChangeRequest;
|
import channel.metadata.AttributeChangeRequest;
|
||||||
import channel.metadata.IAttributeChangeRequestProvider;
|
import channel.metadata.IAttributeChangeRequestProvider;
|
||||||
import message.IMessageListener;
|
import message.IMessageListener;
|
||||||
@@ -193,4 +190,5 @@ public abstract class DecoderState extends Module implements ActivitySummaryProv
|
|||||||
{
|
{
|
||||||
mAttributeChangeRequestListener = null;
|
mAttributeChangeRequestListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package channel.state;
|
|
||||||
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import sample.Listener;
|
|
||||||
|
|
||||||
public interface IChangedAttributeProvider
|
|
||||||
{
|
|
||||||
public void setChangedAttributeListener( Listener<Attribute> listener );
|
|
||||||
public void removeChangedAttributeListener();
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,45 +14,33 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package controller;
|
package controller;
|
||||||
|
|
||||||
import java.awt.Color;
|
import alias.AliasController;
|
||||||
import java.awt.Component;
|
import alias.AliasModel;
|
||||||
import java.awt.Dimension;
|
import audio.AudioManager;
|
||||||
|
import audio.AudioPanel;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import audio.broadcast.BroadcastModel;
|
import audio.broadcast.BroadcastModel;
|
||||||
import audio.broadcast.BroadcastPanel;
|
import audio.broadcast.BroadcastPanel;
|
||||||
|
import channel.metadata.ChannelMetadataViewer;
|
||||||
|
import com.jidesoft.swing.JideTabbedPane;
|
||||||
|
import controller.channel.ChannelController;
|
||||||
|
import controller.channel.ChannelModel;
|
||||||
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import controller.channel.map.ChannelMapModel;
|
||||||
import icon.IconManager;
|
import icon.IconManager;
|
||||||
import map.MapPanel;
|
import map.MapPanel;
|
||||||
import map.MapService;
|
import map.MapService;
|
||||||
import module.decode.event.CallEventPanel;
|
|
||||||
import module.decode.event.MessageActivityPanel;
|
|
||||||
import channel.state.ChannelList;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import source.SourceManager;
|
import source.SourceManager;
|
||||||
import source.tuner.TunerModel;
|
import source.tuner.TunerModel;
|
||||||
import source.tuner.TunerViewPanel;
|
import source.tuner.TunerViewPanel;
|
||||||
import spectrum.ChannelSpectrumPanel;
|
|
||||||
import alias.AliasController;
|
|
||||||
import alias.AliasModel;
|
|
||||||
import audio.AudioManager;
|
|
||||||
import audio.AudioPanel;
|
|
||||||
|
|
||||||
import com.jidesoft.swing.JideSplitPane;
|
import javax.swing.*;
|
||||||
import com.jidesoft.swing.JideTabbedPane;
|
import java.awt.*;
|
||||||
|
|
||||||
import controller.channel.ChannelController;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
import controller.channel.ChannelProcessingManager;
|
|
||||||
import controller.channel.map.ChannelMapModel;
|
|
||||||
|
|
||||||
public class ControllerPanel extends JPanel
|
public class ControllerPanel extends JPanel
|
||||||
{
|
{
|
||||||
@@ -61,13 +49,10 @@ public class ControllerPanel extends JPanel
|
|||||||
private AliasController mAliasController;
|
private AliasController mAliasController;
|
||||||
private AudioPanel mAudioPanel;
|
private AudioPanel mAudioPanel;
|
||||||
private BroadcastPanel mBroadcastPanel;
|
private BroadcastPanel mBroadcastPanel;
|
||||||
private CallEventPanel mCallEventPanel;
|
|
||||||
private ChannelController mChannelController;
|
private ChannelController mChannelController;
|
||||||
private ChannelList mChannelStateList;
|
private ChannelMetadataViewer mChannelMetadataViewer;
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
private ChannelSpectrumPanel mChannelSpectrumPanel;
|
|
||||||
private MapPanel mMapPanel;
|
private MapPanel mMapPanel;
|
||||||
private MessageActivityPanel mMessageActivityPanel;
|
|
||||||
private TunerViewPanel mTunerManagerPanel;
|
private TunerViewPanel mTunerManagerPanel;
|
||||||
|
|
||||||
private JideTabbedPane mTabbedPane;
|
private JideTabbedPane mTabbedPane;
|
||||||
@@ -89,24 +74,16 @@ public class ControllerPanel extends JPanel
|
|||||||
|
|
||||||
mAudioPanel = new AudioPanel(iconManager, settingsManager, sourceManager, audioManager);
|
mAudioPanel = new AudioPanel(iconManager, settingsManager, sourceManager, audioManager);
|
||||||
|
|
||||||
mMapPanel = new MapPanel(mapService, iconManager, settingsManager);
|
mChannelMetadataViewer = new ChannelMetadataViewer(channelProcessingManager, iconManager, settingsManager);
|
||||||
|
|
||||||
mMessageActivityPanel = new MessageActivityPanel(channelProcessingManager);
|
mMapPanel = new MapPanel(mapService, iconManager, settingsManager);
|
||||||
|
|
||||||
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, iconManager);
|
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, iconManager);
|
||||||
|
|
||||||
mCallEventPanel = new CallEventPanel(iconManager, channelProcessingManager);
|
mChannelController = new ChannelController(channelModel, channelMapModel, sourceManager, aliasModel);
|
||||||
|
|
||||||
mChannelSpectrumPanel = new ChannelSpectrumPanel(settingsManager,
|
|
||||||
channelProcessingManager);
|
|
||||||
|
|
||||||
mChannelStateList = new ChannelList(channelModel, channelProcessingManager, iconManager,
|
|
||||||
settingsManager, mAudioPanel);
|
|
||||||
|
|
||||||
mChannelController = new ChannelController(channelModel, channelMapModel,
|
|
||||||
sourceManager, aliasModel);
|
|
||||||
|
|
||||||
mAliasController = new AliasController(aliasModel, broadcastModel, iconManager);
|
mAliasController = new AliasController(aliasModel, broadcastModel, iconManager);
|
||||||
|
|
||||||
mTunerManagerPanel = new TunerViewPanel(tunerModel);
|
mTunerManagerPanel = new TunerViewPanel(tunerModel);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@@ -114,66 +91,24 @@ public class ControllerPanel extends JPanel
|
|||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout(new MigLayout("insets 0 0 0 0 ",
|
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[]0[grow,fill]"));
|
||||||
"[grow,fill]",
|
|
||||||
"[grow,fill]"));
|
add(mAudioPanel);
|
||||||
|
|
||||||
//Tabbed View - configuration, calls, messages, map
|
//Tabbed View - configuration, calls, messages, map
|
||||||
mTabbedPane = new JideTabbedPane();
|
mTabbedPane = new JideTabbedPane();
|
||||||
mTabbedPane.setFont(this.getFont());
|
mTabbedPane.setFont(this.getFont());
|
||||||
mTabbedPane.setForeground(Color.BLACK);
|
mTabbedPane.setForeground(Color.BLACK);
|
||||||
mTabbedPane.addTab("Tuners", mTunerManagerPanel);
|
mTabbedPane.addTab("Now Playing", mChannelMetadataViewer);
|
||||||
mTabbedPane.addTab("Channels", mChannelController);
|
|
||||||
mTabbedPane.addTab("Aliases", mAliasController);
|
mTabbedPane.addTab("Aliases", mAliasController);
|
||||||
mTabbedPane.addTab("Channel Spectrum", mChannelSpectrumPanel);
|
mTabbedPane.addTab("Channels", mChannelController);
|
||||||
mTabbedPane.addTab("Events", mCallEventPanel);
|
|
||||||
mTabbedPane.addTab("Map", mMapPanel);
|
mTabbedPane.addTab("Map", mMapPanel);
|
||||||
mTabbedPane.addTab("Messages", mMessageActivityPanel);
|
|
||||||
mTabbedPane.addTab("Streaming", mBroadcastPanel);
|
mTabbedPane.addTab("Streaming", mBroadcastPanel);
|
||||||
|
mTabbedPane.addTab("Tuners", mTunerManagerPanel);
|
||||||
/**
|
|
||||||
* Change listener to enable/disable the channel spectrum display
|
|
||||||
* only when the tab is visible, and a channel has been selected
|
|
||||||
*/
|
|
||||||
mTabbedPane.addChangeListener(new ChangeListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void stateChanged(ChangeEvent event)
|
|
||||||
{
|
|
||||||
int index = mTabbedPane.getSelectedIndex();
|
|
||||||
|
|
||||||
Component component = mTabbedPane.getComponentAt(index);
|
|
||||||
|
|
||||||
if (component instanceof ChannelSpectrumPanel)
|
|
||||||
{
|
|
||||||
mChannelSpectrumPanel.setEnabled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mChannelSpectrumPanel.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Register each of the components to receive channel events when the
|
|
||||||
* channels are selected or change */
|
|
||||||
mChannelModel.addListener(mCallEventPanel);
|
|
||||||
mChannelModel.addListener(mChannelStateList);
|
|
||||||
mChannelModel.addListener(mChannelSpectrumPanel);
|
|
||||||
mChannelModel.addListener(mMessageActivityPanel);
|
|
||||||
|
|
||||||
JScrollPane channelStateListScroll = new JScrollPane();
|
|
||||||
channelStateListScroll.getViewport().setView(mChannelStateList);
|
|
||||||
channelStateListScroll.setPreferredSize(new Dimension(400, 500));
|
|
||||||
|
|
||||||
//Set preferred size to influence the split between these panels
|
//Set preferred size to influence the split between these panels
|
||||||
mTabbedPane.setPreferredSize(new Dimension(880, 500));
|
mTabbedPane.setPreferredSize(new Dimension(880, 500));
|
||||||
|
|
||||||
JideSplitPane channelSplit = new JideSplitPane(JideSplitPane.HORIZONTAL_SPLIT);
|
add(mTabbedPane);
|
||||||
channelSplit.setDividerSize(5);
|
|
||||||
channelSplit.add(channelStateListScroll);
|
|
||||||
channelSplit.add(mTabbedPane);
|
|
||||||
|
|
||||||
add(channelSplit);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,50 +14,51 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package controller.channel;
|
package controller.channel;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import alias.AliasModel;
|
||||||
import java.util.List;
|
import audio.AudioPacket;
|
||||||
import java.util.Map;
|
import channel.metadata.Attribute;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import channel.metadata.AttributeChangeRequest;
|
||||||
|
import channel.metadata.ChannelMetadataModel;
|
||||||
|
import controller.channel.Channel.ChannelType;
|
||||||
|
import controller.channel.ChannelEvent.Event;
|
||||||
|
import controller.channel.map.ChannelMapModel;
|
||||||
|
import filter.FilterSet;
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
import module.ProcessingChain;
|
import module.ProcessingChain;
|
||||||
import module.decode.DecoderFactory;
|
import module.decode.DecoderFactory;
|
||||||
import module.decode.event.MessageActivityModel;
|
import module.decode.event.MessageActivityModel;
|
||||||
import module.log.EventLogManager;
|
import module.log.EventLogManager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import record.RecorderManager;
|
import record.RecorderManager;
|
||||||
import record.RecorderType;
|
import record.RecorderType;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import source.Source;
|
import source.Source;
|
||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.SourceManager;
|
import source.SourceManager;
|
||||||
import alias.AliasModel;
|
|
||||||
import audio.AudioPacket;
|
import java.util.HashMap;
|
||||||
import audio.metadata.Metadata;
|
import java.util.List;
|
||||||
import audio.metadata.MetadataType;
|
import java.util.Map;
|
||||||
import controller.channel.Channel.ChannelType;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import controller.channel.ChannelEvent.Event;
|
|
||||||
import controller.channel.map.ChannelMapModel;
|
|
||||||
import filter.FilterSet;
|
|
||||||
|
|
||||||
public class ChannelProcessingManager implements ChannelEventListener
|
public class ChannelProcessingManager implements ChannelEventListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(ChannelProcessingManager.class);
|
private final static Logger mLog = LoggerFactory.getLogger(ChannelProcessingManager.class);
|
||||||
|
|
||||||
private Map<Integer, ProcessingChain> mProcessingChains = new HashMap<>();
|
private Map<Integer,ProcessingChain> mProcessingChains = new HashMap<>();
|
||||||
|
|
||||||
private List<Listener<AudioPacket>> mAudioPacketListeners = new CopyOnWriteArrayList<>();
|
private List<Listener<AudioPacket>> mAudioPacketListeners = new CopyOnWriteArrayList<>();
|
||||||
private List<Listener<Message>> mMessageListeners = new CopyOnWriteArrayList<>();
|
private List<Listener<Message>> mMessageListeners = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
private ChannelMapModel mChannelMapModel;
|
private ChannelMapModel mChannelMapModel;
|
||||||
|
private ChannelMetadataModel mChannelMetadataModel = new ChannelMetadataModel();
|
||||||
private AliasModel mAliasModel;
|
private AliasModel mAliasModel;
|
||||||
private EventLogManager mEventLogManager;
|
private EventLogManager mEventLogManager;
|
||||||
private RecorderManager mRecorderManager;
|
private RecorderManager mRecorderManager;
|
||||||
@@ -78,6 +79,14 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
mSourceManager = sourceManager;
|
mSourceManager = sourceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Channel metadata model containing metadata for each channel or channel time-slice that is currently processing.
|
||||||
|
*/
|
||||||
|
public ChannelMetadataModel getChannelMetadataModel()
|
||||||
|
{
|
||||||
|
return mChannelMetadataModel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if a processing chain is constructed for the channel and that
|
* Indicates if a processing chain is constructed for the channel and that
|
||||||
* the processing chain is currently processing.
|
* the processing chain is currently processing.
|
||||||
@@ -102,19 +111,19 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
{
|
{
|
||||||
Channel channel = event.getChannel();
|
Channel channel = event.getChannel();
|
||||||
|
|
||||||
switch (event.getEvent())
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case REQUEST_ENABLE:
|
case REQUEST_ENABLE:
|
||||||
if (!mProcessingChains.containsKey(channel.getChannelID()) ||
|
if(!mProcessingChains.containsKey(channel.getChannelID()) ||
|
||||||
!mProcessingChains.get(channel.getChannelID()).isProcessing())
|
!mProcessingChains.get(channel.getChannelID()).isProcessing())
|
||||||
{
|
{
|
||||||
startProcessing(event);
|
startProcessing(event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REQUEST_DISABLE:
|
case REQUEST_DISABLE:
|
||||||
if (channel.getEnabled())
|
if(channel.getEnabled())
|
||||||
{
|
{
|
||||||
switch (channel.getChannelType())
|
switch(channel.getChannelType())
|
||||||
{
|
{
|
||||||
case STANDARD:
|
case STANDARD:
|
||||||
stopProcessing(channel, true);
|
stopProcessing(channel, true);
|
||||||
@@ -129,13 +138,13 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case NOTIFICATION_DELETE:
|
case NOTIFICATION_DELETE:
|
||||||
if (channel.getEnabled())
|
if(channel.getEnabled())
|
||||||
{
|
{
|
||||||
stopProcessing(channel, true);
|
stopProcessing(channel, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOTIFICATION_CONFIGURATION_CHANGE:
|
case NOTIFICATION_CONFIGURATION_CHANGE:
|
||||||
if (isProcessing(channel))
|
if(isProcessing(channel))
|
||||||
{
|
{
|
||||||
stopProcessing(channel, false);
|
stopProcessing(channel, false);
|
||||||
startProcessing(event);
|
startProcessing(event);
|
||||||
@@ -153,7 +162,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
|
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
|
||||||
|
|
||||||
//If we're already processing, ignore the request
|
//If we're already processing, ignore the request
|
||||||
if (processingChain != null && processingChain.isProcessing())
|
if(processingChain != null && processingChain.isProcessing())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -166,12 +175,12 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
source = mSourceManager.getSource(channel.getSourceConfiguration(),
|
source = mSourceManager.getSource(channel.getSourceConfiguration(),
|
||||||
channel.getDecodeConfiguration().getDecoderType().getChannelBandwidth());
|
channel.getDecodeConfiguration().getDecoderType().getChannelBandwidth());
|
||||||
}
|
}
|
||||||
catch (SourceException se)
|
catch(SourceException se)
|
||||||
{
|
{
|
||||||
mLog.debug("Error obtaining source for channel [" + channel.getName() + "]", se);
|
mLog.debug("Error obtaining source for channel [" + channel.getName() + "]", se);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source == null)
|
if(source == null)
|
||||||
{
|
{
|
||||||
channel.setEnabled(false);
|
channel.setEnabled(false);
|
||||||
|
|
||||||
@@ -181,25 +190,25 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processingChain == null)
|
if(processingChain == null)
|
||||||
{
|
{
|
||||||
processingChain = new ProcessingChain(channel.getName(),
|
processingChain = new ProcessingChain(channel.getName(),
|
||||||
channel.getChannelType());
|
channel.getChannelType());
|
||||||
|
|
||||||
/* Register global listeners */
|
/* Register global listeners */
|
||||||
for (Listener<AudioPacket> listener : mAudioPacketListeners)
|
for(Listener<AudioPacket> listener : mAudioPacketListeners)
|
||||||
{
|
{
|
||||||
processingChain.addAudioPacketListener(listener);
|
processingChain.addAudioPacketListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Listener<Message> listener : mMessageListeners)
|
for(Listener<Message> listener : mMessageListeners)
|
||||||
{
|
{
|
||||||
processingChain.addMessageListener(listener);
|
processingChain.addMessageListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Processing Modules */
|
/* Processing Modules */
|
||||||
List<Module> modules = DecoderFactory.getModules(mChannelModel,
|
List<Module> modules = DecoderFactory.getModules(mChannelModel, mChannelMapModel, this,
|
||||||
mChannelMapModel, this, mAliasModel, channel);
|
mAliasModel, channel, processingChain.getChannelState().getMutableMetadata());
|
||||||
processingChain.addModules(modules);
|
processingChain.addModules(modules);
|
||||||
|
|
||||||
/* Setup message activity model with filtering */
|
/* Setup message activity model with filtering */
|
||||||
@@ -207,20 +216,45 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
MessageActivityModel messageModel = new MessageActivityModel(messageFilter);
|
MessageActivityModel messageModel = new MessageActivityModel(messageFilter);
|
||||||
processingChain.setMessageActivityModel(messageModel);
|
processingChain.setMessageActivityModel(messageModel);
|
||||||
|
|
||||||
/* Inject channel metadata that will be inserted into audio packets
|
//Override recordable flag in metadata if user has specified audio recording
|
||||||
* for the recorder manager and streaming */
|
if(channel.getRecordConfiguration() != null &&
|
||||||
processingChain.broadcast(
|
channel.getRecordConfiguration().getRecorders().contains(RecorderType.AUDIO))
|
||||||
new Metadata(MetadataType.SYSTEM, channel.getSystem()));
|
{
|
||||||
processingChain.broadcast(
|
processingChain.getChannelState().getMutableMetadata().setRecordable(true);
|
||||||
new Metadata(MetadataType.SITE_ID, channel.getSite()));
|
}
|
||||||
processingChain.broadcast(
|
|
||||||
new Metadata(MetadataType.CHANNEL_NAME, channel.getName()));
|
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if(channel.getSystem() != null)
|
||||||
|
{
|
||||||
|
sb.append(channel.getSystem());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(channel.getSite() != null)
|
||||||
|
{
|
||||||
|
if(sb.length() > 0)
|
||||||
|
{
|
||||||
|
sb.append(" - ");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(channel.getSite());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sb.length() > 0)
|
||||||
|
{
|
||||||
|
processingChain.getChannelState().getMutableMetadata()
|
||||||
|
.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_1, sb.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
processingChain.getChannelState().getMutableMetadata()
|
||||||
|
.receive(new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_LABEL_2, channel.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup event logging */
|
/* Setup event logging */
|
||||||
List<Module> loggers = mEventLogManager.getLoggers(channel.getEventLogConfiguration(), channel.getName());
|
List<Module> loggers = mEventLogManager.getLoggers(channel.getEventLogConfiguration(), channel.getName());
|
||||||
|
|
||||||
if (!loggers.isEmpty())
|
if(!loggers.isEmpty())
|
||||||
{
|
{
|
||||||
processingChain.addModules(loggers);
|
processingChain.addModules(loggers);
|
||||||
}
|
}
|
||||||
@@ -228,16 +262,16 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
/* Setup recorders */
|
/* Setup recorders */
|
||||||
List<RecorderType> recorders = channel.getRecordConfiguration().getRecorders();
|
List<RecorderType> recorders = channel.getRecordConfiguration().getRecorders();
|
||||||
|
|
||||||
if (!recorders.isEmpty())
|
if(!recorders.isEmpty())
|
||||||
{
|
{
|
||||||
/* Add baseband recorder */
|
/* Add baseband recorder */
|
||||||
if ((recorders.contains(RecorderType.BASEBAND) && channel.getChannelType() == ChannelType.STANDARD))
|
if((recorders.contains(RecorderType.BASEBAND) && channel.getChannelType() == ChannelType.STANDARD))
|
||||||
{
|
{
|
||||||
processingChain.addModule(mRecorderManager.getBasebandRecorder(channel.toString()));
|
processingChain.addModule(mRecorderManager.getBasebandRecorder(channel.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add traffic channel baseband recorder */
|
/* Add traffic channel baseband recorder */
|
||||||
if (recorders.contains(RecorderType.TRAFFIC_BASEBAND) && channel.getChannelType() == ChannelType.TRAFFIC)
|
if(recorders.contains(RecorderType.TRAFFIC_BASEBAND) && channel.getChannelType() == ChannelType.TRAFFIC)
|
||||||
{
|
{
|
||||||
processingChain.addModule(mRecorderManager.getBasebandRecorder(channel.toString()));
|
processingChain.addModule(mRecorderManager.getBasebandRecorder(channel.toString()));
|
||||||
}
|
}
|
||||||
@@ -245,7 +279,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
processingChain.setSource(source);
|
processingChain.setSource(source);
|
||||||
|
|
||||||
if (event instanceof TrafficChannelEvent)
|
if(event instanceof TrafficChannelEvent)
|
||||||
{
|
{
|
||||||
TrafficChannelEvent trafficChannelEvent = (TrafficChannelEvent) event;
|
TrafficChannelEvent trafficChannelEvent = (TrafficChannelEvent) event;
|
||||||
|
|
||||||
@@ -268,7 +302,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
{
|
{
|
||||||
channel.setEnabled(false);
|
channel.setEnabled(false);
|
||||||
|
|
||||||
if (mProcessingChains.containsKey(channel.getChannelID()))
|
if(mProcessingChains.containsKey(channel.getChannelID()))
|
||||||
{
|
{
|
||||||
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
|
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
|
||||||
|
|
||||||
@@ -281,7 +315,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
mChannelModel.broadcast(new ChannelEvent(channel, Event.NOTIFICATION_PROCESSING_STOP));
|
mChannelModel.broadcast(new ChannelEvent(channel, Event.NOTIFICATION_PROCESSING_STOP));
|
||||||
|
|
||||||
if (remove)
|
if(remove)
|
||||||
{
|
{
|
||||||
mProcessingChains.remove(channel.getChannelID());
|
mProcessingChains.remove(channel.getChannelID());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,15 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package instrument.gui;
|
package instrument.gui;
|
||||||
|
|
||||||
|
import alias.AliasModel;
|
||||||
|
import controller.channel.Channel;
|
||||||
|
import controller.channel.ChannelModel;
|
||||||
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import controller.channel.map.ChannelMapModel;
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.InstrumentableProcessingChain;
|
import instrument.InstrumentableProcessingChain;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
@@ -38,8 +44,21 @@ import instrument.tap.stream.QPSKTap;
|
|||||||
import instrument.tap.stream.QPSKTapPanel;
|
import instrument.tap.stream.QPSKTapPanel;
|
||||||
import instrument.tap.stream.SymbolEventTap;
|
import instrument.tap.stream.SymbolEventTap;
|
||||||
import instrument.tap.stream.SymbolEventTapViewPanel;
|
import instrument.tap.stream.SymbolEventTapViewPanel;
|
||||||
|
import message.Message;
|
||||||
|
import module.Module;
|
||||||
|
import module.decode.DecoderFactory;
|
||||||
|
import module.decode.config.DecodeConfiguration;
|
||||||
|
import module.log.EventLogManager;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import playlist.PlaylistManager;
|
||||||
|
import sample.Listener;
|
||||||
|
import source.IControllableFileSource;
|
||||||
|
import source.Source;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@@ -47,50 +66,18 @@ import java.awt.event.MouseListener;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JCheckBoxMenuItem;
|
public class DecoderViewFrame extends JInternalFrame implements Listener<Message>
|
||||||
import javax.swing.JInternalFrame;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.JSeparator;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import module.Module;
|
|
||||||
import module.decode.DecoderFactory;
|
|
||||||
import module.decode.config.DecodeConfiguration;
|
|
||||||
import module.log.EventLogManager;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import playlist.PlaylistManager;
|
|
||||||
import sample.Listener;
|
|
||||||
import source.IControllableFileSource;
|
|
||||||
import source.Source;
|
|
||||||
import alias.AliasModel;
|
|
||||||
import controller.channel.Channel;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
import controller.channel.ChannelProcessingManager;
|
|
||||||
import controller.channel.map.ChannelMapModel;
|
|
||||||
|
|
||||||
public class DecoderViewFrame extends JInternalFrame
|
|
||||||
implements Listener<Message>
|
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private final static Logger mLog =
|
private final static Logger mLog = LoggerFactory.getLogger(DecoderViewFrame.class);
|
||||||
LoggerFactory.getLogger( DecoderViewFrame.class );
|
|
||||||
|
|
||||||
private DecodeConfiguration mDecodeConfig;
|
private DecodeConfiguration mDecodeConfig;
|
||||||
private InstrumentableProcessingChain mProcessingChain;
|
private InstrumentableProcessingChain mProcessingChain;
|
||||||
private IControllableFileSource mSource;
|
private IControllableFileSource mSource;
|
||||||
|
|
||||||
private HashMap<Tap,TapViewPanel> mPanelMap =
|
private HashMap<Tap,TapViewPanel> mPanelMap = new HashMap<Tap,TapViewPanel>();
|
||||||
new HashMap<Tap,TapViewPanel>();
|
|
||||||
|
|
||||||
public DecoderViewFrame( PlaylistManager playlistManager,
|
public DecoderViewFrame(PlaylistManager playlistManager, Channel channel, IControllableFileSource source)
|
||||||
Channel channel,
|
|
||||||
IControllableFileSource source )
|
|
||||||
{
|
{
|
||||||
mSource = source;
|
mSource = source;
|
||||||
|
|
||||||
@@ -101,18 +88,17 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
ChannelModel channelModel = new ChannelModel();
|
ChannelModel channelModel = new ChannelModel();
|
||||||
ChannelMapModel channelMapModel = new ChannelMapModel();
|
ChannelMapModel channelMapModel = new ChannelMapModel();
|
||||||
|
|
||||||
ChannelProcessingManager channelProcessingManager =
|
ChannelProcessingManager channelProcessingManager = new ChannelProcessingManager(channelModel, channelMapModel,
|
||||||
new ChannelProcessingManager( channelModel, channelMapModel,
|
new AliasModel(), new EventLogManager(), null, null);
|
||||||
new AliasModel(), new EventLogManager(), null, null );
|
|
||||||
|
|
||||||
List<Module> modules = DecoderFactory.getModules( channelModel,
|
List<Module> modules = DecoderFactory.getModules(channelModel, channelMapModel, channelProcessingManager,
|
||||||
channelMapModel, channelProcessingManager, new AliasModel(), channel );
|
new AliasModel(), channel, mProcessingChain.getChannelState().getMutableMetadata());
|
||||||
|
|
||||||
mProcessingChain.addModules( modules );
|
mProcessingChain.addModules(modules);
|
||||||
|
|
||||||
mProcessingChain.addMessageListener( this );
|
mProcessingChain.addMessageListener(this);
|
||||||
|
|
||||||
mProcessingChain.setSource( (Source)mSource );
|
mProcessingChain.setSource((Source) mSource);
|
||||||
|
|
||||||
mProcessingChain.start();
|
mProcessingChain.start();
|
||||||
|
|
||||||
@@ -121,69 +107,80 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
|
|
||||||
private void initGui()
|
private void initGui()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]" ) );
|
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]"));
|
||||||
|
|
||||||
setTitle( "Decoder [" + mDecodeConfig.getDecoderType().getDisplayString() + "]" );
|
setTitle("Decoder [" + mDecodeConfig.getDecoderType().getDisplayString() + "]");
|
||||||
setPreferredSize( new Dimension( 450, 250 ) );
|
setPreferredSize(new Dimension(450, 250));
|
||||||
setSize( 450, 250 );
|
setSize(450, 250);
|
||||||
|
|
||||||
setResizable( true );
|
setResizable(true);
|
||||||
setClosable( true );
|
setClosable(true);
|
||||||
setIconifiable( true );
|
setIconifiable(true);
|
||||||
setMaximizable( false );
|
setMaximizable(false);
|
||||||
|
|
||||||
addMouseListener( new MouseListener()
|
addMouseListener(new MouseListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked( MouseEvent me )
|
public void mouseClicked(MouseEvent me)
|
||||||
{
|
{
|
||||||
if( me.getButton() == MouseEvent.BUTTON3 )
|
if(me.getButton() == MouseEvent.BUTTON3)
|
||||||
{
|
{
|
||||||
JPopupMenu popup = new JPopupMenu();
|
JPopupMenu popup = new JPopupMenu();
|
||||||
|
|
||||||
popup.add( getTapContextMenu() );
|
popup.add(getTapContextMenu());
|
||||||
|
|
||||||
if( !mPanelMap.values().isEmpty() )
|
if(!mPanelMap.values().isEmpty())
|
||||||
{
|
{
|
||||||
popup.add( new JSeparator() );
|
popup.add(new JSeparator());
|
||||||
|
|
||||||
for( TapViewPanel panel: mPanelMap.values() )
|
for(TapViewPanel panel : mPanelMap.values())
|
||||||
{
|
{
|
||||||
popup.add( panel.getContextMenu() );
|
popup.add(panel.getContextMenu());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.show( DecoderViewFrame.this, me.getX(), me.getY() );
|
popup.show(DecoderViewFrame.this, me.getX(), me.getY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered( MouseEvent arg0 ) {}
|
public void mouseEntered(MouseEvent arg0)
|
||||||
@Override
|
{
|
||||||
public void mouseExited( MouseEvent arg0 ) {}
|
}
|
||||||
@Override
|
|
||||||
public void mousePressed( MouseEvent arg0 ) {}
|
|
||||||
@Override
|
|
||||||
public void mouseReleased( MouseEvent arg0 ) {}
|
|
||||||
|
|
||||||
} );
|
@Override
|
||||||
|
public void mouseExited(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private JMenu getTapContextMenu()
|
private JMenu getTapContextMenu()
|
||||||
{
|
{
|
||||||
JMenu menu = new JMenu( "Modules" );
|
JMenu menu = new JMenu("Modules");
|
||||||
|
|
||||||
if( mProcessingChain != null )
|
if(mProcessingChain != null)
|
||||||
{
|
{
|
||||||
for( Module module: mProcessingChain.getModules() )
|
for(Module module : mProcessingChain.getModules())
|
||||||
{
|
{
|
||||||
if( module instanceof Instrumentable )
|
if(module instanceof Instrumentable)
|
||||||
{
|
{
|
||||||
List<TapGroup> groups = ((Instrumentable)module).getTapGroups();
|
List<TapGroup> groups = ((Instrumentable) module).getTapGroups();
|
||||||
|
|
||||||
for( TapGroup group: groups )
|
for(TapGroup group : groups)
|
||||||
{
|
{
|
||||||
menu.add( new TapGroupMenu( group ) );
|
menu.add(new TapGroupMenu(group));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,80 +189,80 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add( Tap tap )
|
public void add(Tap tap)
|
||||||
{
|
{
|
||||||
TapViewPanel panel = null;
|
TapViewPanel panel = null;
|
||||||
|
|
||||||
switch( tap.getType() )
|
switch(tap.getType())
|
||||||
{
|
{
|
||||||
case EVENT_SYNC_DETECT:
|
case EVENT_SYNC_DETECT:
|
||||||
break;
|
break;
|
||||||
case STREAM_BINARY:
|
case STREAM_BINARY:
|
||||||
panel = new BinaryTapViewPanel( (BinaryTap)tap );
|
panel = new BinaryTapViewPanel((BinaryTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_COMPLEX:
|
case STREAM_COMPLEX:
|
||||||
panel = new ComplexTapViewPanel( (ComplexTap)tap );
|
panel = new ComplexTapViewPanel((ComplexTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_COMPLEX_SAMPLE:
|
case STREAM_COMPLEX_SAMPLE:
|
||||||
panel = new ComplexSampleTapViewPanel( (ComplexSampleTap)tap );
|
panel = new ComplexSampleTapViewPanel((ComplexSampleTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_DIBIT:
|
case STREAM_DIBIT:
|
||||||
panel = new DibitTapViewPanel( (DibitTap)tap );
|
panel = new DibitTapViewPanel((DibitTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_EYE_DIAGRAM:
|
case STREAM_EYE_DIAGRAM:
|
||||||
panel = new EyeDiagramDataTapPanel( (EyeDiagramDataTap)tap ) ;
|
panel = new EyeDiagramDataTapPanel((EyeDiagramDataTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_FLOAT:
|
case STREAM_FLOAT:
|
||||||
panel = new FloatTapViewPanel( (FloatTap)tap );
|
panel = new FloatTapViewPanel((FloatTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_QPSK:
|
case STREAM_QPSK:
|
||||||
panel = new QPSKTapPanel( (QPSKTap)tap );
|
panel = new QPSKTapPanel((QPSKTap) tap);
|
||||||
break;
|
break;
|
||||||
case STREAM_SYMBOL:
|
case STREAM_SYMBOL:
|
||||||
panel = new SymbolEventTapViewPanel( (SymbolEventTap)tap );
|
panel = new SymbolEventTapViewPanel((SymbolEventTap) tap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( panel != null )
|
if(panel != null)
|
||||||
{
|
{
|
||||||
add( panel, "span" );
|
add(panel, "span");
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
mPanelMap.put( tap, panel );
|
mPanelMap.put(tap, panel);
|
||||||
|
|
||||||
for( Module module: mProcessingChain.getModules() )
|
for(Module module : mProcessingChain.getModules())
|
||||||
{
|
{
|
||||||
if( module instanceof Instrumentable )
|
if(module instanceof Instrumentable)
|
||||||
{
|
{
|
||||||
((Instrumentable)module).registerTap( tap );
|
((Instrumentable) module).registerTap(tap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.info( "Tap panel is null, couldn't add for tap " +
|
mLog.info("Tap panel is null, couldn't add for tap " +
|
||||||
tap.getName() + "[" + tap.getType().toString() + "]" );
|
tap.getName() + "[" + tap.getType().toString() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove( Tap tap )
|
public void remove(Tap tap)
|
||||||
{
|
{
|
||||||
for( Module module: mProcessingChain.getModules() )
|
for(Module module : mProcessingChain.getModules())
|
||||||
{
|
{
|
||||||
if( module instanceof Instrumentable )
|
if(module instanceof Instrumentable)
|
||||||
{
|
{
|
||||||
((Instrumentable)module).unregisterTap( tap );
|
((Instrumentable) module).unregisterTap(tap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TapViewPanel panel = mPanelMap.get( tap );
|
TapViewPanel panel = mPanelMap.get(tap);
|
||||||
|
|
||||||
remove( panel );
|
remove(panel);
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
mPanelMap.remove( tap );
|
mPanelMap.remove(tap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AddAllTapsItem extends JMenuItem
|
public class AddAllTapsItem extends JMenuItem
|
||||||
@@ -274,23 +271,23 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
|
|
||||||
private final List<Tap> mTaps;
|
private final List<Tap> mTaps;
|
||||||
|
|
||||||
public AddAllTapsItem( final List<Tap> taps )
|
public AddAllTapsItem(final List<Tap> taps)
|
||||||
{
|
{
|
||||||
super( "All Taps" );
|
super("All Taps");
|
||||||
|
|
||||||
mTaps = taps;
|
mTaps = taps;
|
||||||
|
|
||||||
addActionListener( new ActionListener()
|
addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed( ActionEvent e )
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
for( Tap tap: mTaps )
|
for(Tap tap : mTaps)
|
||||||
{
|
{
|
||||||
DecoderViewFrame.this.add( tap );
|
DecoderViewFrame.this.add(tap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,39 +296,39 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Tap mTap;
|
private Tap mTap;
|
||||||
|
|
||||||
public TapSelectionItem( Tap tap )
|
public TapSelectionItem(Tap tap)
|
||||||
{
|
{
|
||||||
super( tap.getName() );
|
super(tap.getName());
|
||||||
|
|
||||||
mTap = tap;
|
mTap = tap;
|
||||||
|
|
||||||
if( mPanelMap.keySet().contains( tap ) )
|
if(mPanelMap.keySet().contains(tap))
|
||||||
{
|
{
|
||||||
setSelected( true );
|
setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
addActionListener( new ActionListener()
|
addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed( ActionEvent arg0 )
|
public void actionPerformed(ActionEvent arg0)
|
||||||
{
|
{
|
||||||
if( mPanelMap.keySet().contains( mTap ) )
|
if(mPanelMap.keySet().contains(mTap))
|
||||||
{
|
{
|
||||||
DecoderViewFrame.this.remove( mTap );
|
DecoderViewFrame.this.remove(mTap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DecoderViewFrame.this.add( mTap );
|
DecoderViewFrame.this.add(mTap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
mLog.info( message.toString() );
|
mLog.info(message.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TapGroupMenu extends JMenu
|
public class TapGroupMenu extends JMenu
|
||||||
@@ -339,19 +336,19 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private TapGroup mTapGroup;
|
private TapGroup mTapGroup;
|
||||||
|
|
||||||
public TapGroupMenu( TapGroup tapGroup )
|
public TapGroupMenu(TapGroup tapGroup)
|
||||||
{
|
{
|
||||||
super( tapGroup.getName() );
|
super(tapGroup.getName());
|
||||||
|
|
||||||
mTapGroup = tapGroup;
|
mTapGroup = tapGroup;
|
||||||
|
|
||||||
add( new AddAllTapsItem( mTapGroup.getTaps() ) );
|
add(new AddAllTapsItem(mTapGroup.getTaps()));
|
||||||
|
|
||||||
add( new JSeparator() );
|
add(new JSeparator());
|
||||||
|
|
||||||
for( Tap tap: mTapGroup.getTaps() )
|
for(Tap tap : mTapGroup.getTaps())
|
||||||
{
|
{
|
||||||
add( new TapSelectionItem( tap ) );
|
add(new TapSelectionItem(tap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2015-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,18 +14,23 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module;
|
package module;
|
||||||
|
|
||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.IAudioPacketListener;
|
import audio.IAudioPacketListener;
|
||||||
import audio.IAudioPacketProvider;
|
import audio.IAudioPacketProvider;
|
||||||
import audio.metadata.IMetadataListener;
|
|
||||||
import audio.metadata.IMetadataProvider;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.squelch.ISquelchStateListener;
|
import audio.squelch.ISquelchStateListener;
|
||||||
import audio.squelch.ISquelchStateProvider;
|
import audio.squelch.ISquelchStateProvider;
|
||||||
import audio.squelch.SquelchState;
|
import audio.squelch.SquelchState;
|
||||||
|
import channel.state.ChannelState;
|
||||||
|
import channel.state.DecoderState;
|
||||||
|
import channel.state.DecoderStateEvent;
|
||||||
|
import channel.state.DecoderStateEvent.Event;
|
||||||
|
import channel.state.IDecoderStateEventListener;
|
||||||
|
import channel.state.IDecoderStateEventProvider;
|
||||||
|
import channel.state.State;
|
||||||
import controller.NamingThreadFactory;
|
import controller.NamingThreadFactory;
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
import controller.channel.ChannelEvent;
|
import controller.channel.ChannelEvent;
|
||||||
@@ -39,13 +44,6 @@ import module.decode.event.CallEventModel;
|
|||||||
import module.decode.event.ICallEventListener;
|
import module.decode.event.ICallEventListener;
|
||||||
import module.decode.event.ICallEventProvider;
|
import module.decode.event.ICallEventProvider;
|
||||||
import module.decode.event.MessageActivityModel;
|
import module.decode.event.MessageActivityModel;
|
||||||
import channel.state.ChannelState;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import channel.state.DecoderStateEvent;
|
|
||||||
import channel.state.DecoderStateEvent.Event;
|
|
||||||
import channel.state.IDecoderStateEventListener;
|
|
||||||
import channel.state.IDecoderStateEventProvider;
|
|
||||||
import channel.state.State;
|
|
||||||
import module.log.EventLogger;
|
import module.log.EventLogger;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -98,7 +96,6 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
private final static Logger mLog = LoggerFactory.getLogger(ProcessingChain.class);
|
private final static Logger mLog = LoggerFactory.getLogger(ProcessingChain.class);
|
||||||
|
|
||||||
private Broadcaster<AudioPacket> mAudioPacketBroadcaster = new Broadcaster<>();
|
private Broadcaster<AudioPacket> mAudioPacketBroadcaster = new Broadcaster<>();
|
||||||
private Broadcaster<Metadata> mMetadataBroadcaster = new Broadcaster<>();
|
|
||||||
private Broadcaster<CallEvent> mCallEventBroadcaster = new Broadcaster<>();
|
private Broadcaster<CallEvent> mCallEventBroadcaster = new Broadcaster<>();
|
||||||
private Broadcaster<ChannelEvent> mChannelEventBroadcaster = new Broadcaster<>();
|
private Broadcaster<ChannelEvent> mChannelEventBroadcaster = new Broadcaster<>();
|
||||||
private Broadcaster<ComplexBuffer> mComplexBufferBroadcaster = new Broadcaster<>();
|
private Broadcaster<ComplexBuffer> mComplexBufferBroadcaster = new Broadcaster<>();
|
||||||
@@ -186,17 +183,6 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcasts the metadata to any registered listeners
|
|
||||||
*/
|
|
||||||
public void broadcast(Metadata metadata)
|
|
||||||
{
|
|
||||||
if(mMetadataBroadcaster != null)
|
|
||||||
{
|
|
||||||
mMetadataBroadcaster.broadcast(metadata);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if this processing chain is currently receiving samples from
|
* Indicates if this processing chain is currently receiving samples from
|
||||||
* a source and sending those samples to the decoders.
|
* a source and sending those samples to the decoders.
|
||||||
@@ -227,9 +213,8 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
if(isProcessing())
|
if(isProcessing())
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Processing chain is currently "
|
throw new IllegalStateException("Processing chain is currently processing. Invoke stop() on the " +
|
||||||
+ "processing. Invoke stop() on the processing chain before "
|
"processing chain before applying a new sample source");
|
||||||
+ "applying a new sample source");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mSource = source;
|
mSource = source;
|
||||||
@@ -314,68 +299,52 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
if(module instanceof IAudioPacketListener)
|
if(module instanceof IAudioPacketListener)
|
||||||
{
|
{
|
||||||
mAudioPacketBroadcaster.addListener(
|
mAudioPacketBroadcaster.addListener(((IAudioPacketListener) module).getAudioPacketListener());
|
||||||
((IAudioPacketListener) module).getAudioPacketListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof ICallEventListener)
|
if(module instanceof ICallEventListener)
|
||||||
{
|
{
|
||||||
mCallEventBroadcaster.addListener(
|
mCallEventBroadcaster.addListener(((ICallEventListener) module).getCallEventListener());
|
||||||
((ICallEventListener) module).getCallEventListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IChannelEventListener)
|
if(module instanceof IChannelEventListener)
|
||||||
{
|
{
|
||||||
mChannelEventBroadcaster.addListener(
|
mChannelEventBroadcaster.addListener(((IChannelEventListener) module).getChannelEventListener());
|
||||||
((IChannelEventListener) module).getChannelEventListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IComplexBufferListener)
|
if(module instanceof IComplexBufferListener)
|
||||||
{
|
{
|
||||||
mComplexBufferBroadcaster.addListener(
|
mComplexBufferBroadcaster.addListener(((IComplexBufferListener) module).getComplexBufferListener());
|
||||||
((IComplexBufferListener) module).getComplexBufferListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IDecoderStateEventListener)
|
if(module instanceof IDecoderStateEventListener)
|
||||||
{
|
{
|
||||||
mDecoderStateEventBroadcaster.addListener(
|
mDecoderStateEventBroadcaster.addListener(((IDecoderStateEventListener) module).getDecoderStateListener());
|
||||||
((IDecoderStateEventListener) module).getDecoderStateListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IFrequencyChangeListener)
|
if(module instanceof IFrequencyChangeListener)
|
||||||
{
|
{
|
||||||
mFrequencyChangeEventBroadcaster.addListener(
|
mFrequencyChangeEventBroadcaster.addListener(((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
||||||
((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IMessageListener)
|
if(module instanceof IMessageListener)
|
||||||
{
|
{
|
||||||
mMessageBroadcaster.addListener(
|
mMessageBroadcaster.addListener(((IMessageListener) module).getMessageListener());
|
||||||
((IMessageListener) module).getMessageListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(module instanceof IMetadataListener)
|
|
||||||
{
|
|
||||||
mMetadataBroadcaster.addListener(
|
|
||||||
((IMetadataListener) module).getMetadataListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IFilteredRealBufferListener)
|
if(module instanceof IFilteredRealBufferListener)
|
||||||
{
|
{
|
||||||
mFilteredRealBufferBroadcaster.addListener(
|
mFilteredRealBufferBroadcaster.addListener(((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
||||||
((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof ISquelchStateListener)
|
if(module instanceof ISquelchStateListener)
|
||||||
{
|
{
|
||||||
mSquelchStateBroadcaster.addListener(
|
mSquelchStateBroadcaster.addListener(((ISquelchStateListener) module).getSquelchStateListener());
|
||||||
((ISquelchStateListener) module).getSquelchStateListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IUnFilteredRealBufferListener)
|
if(module instanceof IUnFilteredRealBufferListener)
|
||||||
{
|
{
|
||||||
mUnFilteredRealBufferBroadcaster.addListener(
|
mUnFilteredRealBufferBroadcaster.addListener(((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
||||||
((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,38 +356,32 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
if(module instanceof IAudioPacketListener)
|
if(module instanceof IAudioPacketListener)
|
||||||
{
|
{
|
||||||
mAudioPacketBroadcaster.removeListener(
|
mAudioPacketBroadcaster.removeListener(((IAudioPacketListener) module).getAudioPacketListener());
|
||||||
((IAudioPacketListener) module).getAudioPacketListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof ICallEventListener)
|
if(module instanceof ICallEventListener)
|
||||||
{
|
{
|
||||||
mCallEventBroadcaster.removeListener(
|
mCallEventBroadcaster.removeListener(((ICallEventListener) module).getCallEventListener());
|
||||||
((ICallEventListener) module).getCallEventListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IChannelEventListener)
|
if(module instanceof IChannelEventListener)
|
||||||
{
|
{
|
||||||
mChannelEventBroadcaster.removeListener(
|
mChannelEventBroadcaster.removeListener(((IChannelEventListener) module).getChannelEventListener());
|
||||||
((IChannelEventListener) module).getChannelEventListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IComplexBufferListener)
|
if(module instanceof IComplexBufferListener)
|
||||||
{
|
{
|
||||||
mComplexBufferBroadcaster.removeListener(
|
mComplexBufferBroadcaster.removeListener(((IComplexBufferListener) module).getComplexBufferListener());
|
||||||
((IComplexBufferListener) module).getComplexBufferListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IDecoderStateEventListener)
|
if(module instanceof IDecoderStateEventListener)
|
||||||
{
|
{
|
||||||
mDecoderStateEventBroadcaster.removeListener(
|
mDecoderStateEventBroadcaster.removeListener(((IDecoderStateEventListener) module).getDecoderStateListener());
|
||||||
((IDecoderStateEventListener) module).getDecoderStateListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IFrequencyChangeListener)
|
if(module instanceof IFrequencyChangeListener)
|
||||||
{
|
{
|
||||||
mFrequencyChangeEventBroadcaster.removeListener(
|
mFrequencyChangeEventBroadcaster.removeListener(((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
||||||
((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IMessageListener)
|
if(module instanceof IMessageListener)
|
||||||
@@ -426,27 +389,19 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
mMessageBroadcaster.removeListener(((IMessageListener) module).getMessageListener());
|
mMessageBroadcaster.removeListener(((IMessageListener) module).getMessageListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IMetadataListener)
|
|
||||||
{
|
|
||||||
mMetadataBroadcaster.removeListener(((IMetadataListener) module).getMetadataListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(module instanceof IFilteredRealBufferListener)
|
if(module instanceof IFilteredRealBufferListener)
|
||||||
{
|
{
|
||||||
mFilteredRealBufferBroadcaster.removeListener(
|
mFilteredRealBufferBroadcaster.removeListener(((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
||||||
((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof ISquelchStateListener)
|
if(module instanceof ISquelchStateListener)
|
||||||
{
|
{
|
||||||
mSquelchStateBroadcaster.removeListener(
|
mSquelchStateBroadcaster.removeListener(((ISquelchStateListener) module).getSquelchStateListener());
|
||||||
((ISquelchStateListener) module).getSquelchStateListener());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IUnFilteredRealBufferListener)
|
if(module instanceof IUnFilteredRealBufferListener)
|
||||||
{
|
{
|
||||||
mUnFilteredRealBufferBroadcaster.removeListener(
|
mUnFilteredRealBufferBroadcaster.removeListener(((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
||||||
((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,8 +413,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
if(module instanceof IAudioPacketProvider)
|
if(module instanceof IAudioPacketProvider)
|
||||||
{
|
{
|
||||||
((IAudioPacketProvider) module).setAudioPacketListener(
|
((IAudioPacketProvider) module).setAudioPacketListener(mAudioPacketBroadcaster);
|
||||||
mAudioPacketBroadcaster);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof ICallEventProvider)
|
if(module instanceof ICallEventProvider)
|
||||||
@@ -469,20 +423,17 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
|
|
||||||
if(module instanceof IChannelEventProvider)
|
if(module instanceof IChannelEventProvider)
|
||||||
{
|
{
|
||||||
((IChannelEventProvider) module).setChannelEventListener(
|
((IChannelEventProvider) module).setChannelEventListener(mChannelEventBroadcaster);
|
||||||
mChannelEventBroadcaster);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IDecoderStateEventProvider)
|
if(module instanceof IDecoderStateEventProvider)
|
||||||
{
|
{
|
||||||
((IDecoderStateEventProvider) module).setDecoderStateListener(
|
((IDecoderStateEventProvider) module).setDecoderStateListener(mDecoderStateEventBroadcaster);
|
||||||
mDecoderStateEventBroadcaster);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IFrequencyChangeProvider)
|
if(module instanceof IFrequencyChangeProvider)
|
||||||
{
|
{
|
||||||
((IFrequencyChangeProvider) module).setFrequencyChangeListener(
|
((IFrequencyChangeProvider) module).setFrequencyChangeListener(mFrequencyChangeEventBroadcaster);
|
||||||
mFrequencyChangeEventBroadcaster);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IMessageProvider)
|
if(module instanceof IMessageProvider)
|
||||||
@@ -490,28 +441,19 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
((IMessageProvider) module).setMessageListener(mMessageBroadcaster);
|
((IMessageProvider) module).setMessageListener(mMessageBroadcaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IMetadataProvider)
|
|
||||||
{
|
|
||||||
((IMetadataProvider) module).setMetadataListener(
|
|
||||||
mMetadataBroadcaster);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(module instanceof IFilteredRealBufferProvider)
|
if(module instanceof IFilteredRealBufferProvider)
|
||||||
{
|
{
|
||||||
((IFilteredRealBufferProvider) module)
|
((IFilteredRealBufferProvider) module).setFilteredRealBufferListener(mFilteredRealBufferBroadcaster);
|
||||||
.setFilteredRealBufferListener(mFilteredRealBufferBroadcaster);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof ISquelchStateProvider)
|
if(module instanceof ISquelchStateProvider)
|
||||||
{
|
{
|
||||||
((ISquelchStateProvider) module).setSquelchStateListener(
|
((ISquelchStateProvider) module).setSquelchStateListener(mSquelchStateBroadcaster);
|
||||||
mSquelchStateBroadcaster);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IUnFilteredRealBufferProvider)
|
if(module instanceof IUnFilteredRealBufferProvider)
|
||||||
{
|
{
|
||||||
((IUnFilteredRealBufferProvider) module)
|
((IUnFilteredRealBufferProvider) module).setUnFilteredRealBufferListener(mUnFilteredRealBufferBroadcaster);
|
||||||
.setUnFilteredRealBufferListener(mUnFilteredRealBufferBroadcaster);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,11 +493,6 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
((IMessageProvider) module).setMessageListener(null);
|
((IMessageProvider) module).setMessageListener(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(module instanceof IMetadataProvider)
|
|
||||||
{
|
|
||||||
((IMetadataProvider) module).setMetadataListener(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(module instanceof IFilteredRealBufferProvider)
|
if(module instanceof IFilteredRealBufferProvider)
|
||||||
{
|
{
|
||||||
((IFilteredRealBufferProvider) module).setFilteredRealBufferListener(null);
|
((IFilteredRealBufferProvider) module).setFilteredRealBufferListener(null);
|
||||||
@@ -615,8 +552,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
long frequency = tcs.getFrequency();
|
long frequency = tcs.getFrequency();
|
||||||
|
|
||||||
mDecoderStateEventBroadcaster.broadcast(
|
mDecoderStateEventBroadcaster.broadcast(
|
||||||
new DecoderStateEvent(this, Event.SOURCE_FREQUENCY,
|
new DecoderStateEvent(this, Event.SOURCE_FREQUENCY, State.IDLE, frequency));
|
||||||
State.IDLE, frequency));
|
|
||||||
}
|
}
|
||||||
catch(SourceException e)
|
catch(SourceException e)
|
||||||
{
|
{
|
||||||
@@ -697,7 +633,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
List<Module> eventLoggingModules = new ArrayList<>();
|
List<Module> eventLoggingModules = new ArrayList<>();
|
||||||
|
|
||||||
for(Module module: mModules)
|
for(Module module : mModules)
|
||||||
{
|
{
|
||||||
if(module instanceof EventLogger)
|
if(module instanceof EventLogger)
|
||||||
{
|
{
|
||||||
@@ -705,7 +641,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Module eventLoggingModule: eventLoggingModules)
|
for(Module eventLoggingModule : eventLoggingModules)
|
||||||
{
|
{
|
||||||
removeModule(eventLoggingModule);
|
removeModule(eventLoggingModule);
|
||||||
}
|
}
|
||||||
@@ -718,7 +654,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
{
|
{
|
||||||
List<Module> recordingModules = new ArrayList<>();
|
List<Module> recordingModules = new ArrayList<>();
|
||||||
|
|
||||||
for(Module module: mModules)
|
for(Module module : mModules)
|
||||||
{
|
{
|
||||||
if(module instanceof RealBufferWaveRecorder || module instanceof ComplexBufferWaveRecorder)
|
if(module instanceof RealBufferWaveRecorder || module instanceof ComplexBufferWaveRecorder)
|
||||||
{
|
{
|
||||||
@@ -726,7 +662,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Module recordingModule: recordingModules)
|
for(Module recordingModule : recordingModules)
|
||||||
{
|
{
|
||||||
removeModule(recordingModule);
|
removeModule(recordingModule);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ package module.decode;
|
|||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import alias.AliasModel;
|
import alias.AliasModel;
|
||||||
import audio.AudioModule;
|
import audio.AudioModule;
|
||||||
|
import channel.metadata.Metadata;
|
||||||
|
import channel.state.AlwaysUnsquelchedDecoderState;
|
||||||
|
import channel.traffic.TrafficChannelManager;
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
import controller.channel.ChannelModel;
|
import controller.channel.ChannelModel;
|
||||||
@@ -32,55 +35,45 @@ import filter.FilterSet;
|
|||||||
import filter.IFilter;
|
import filter.IFilter;
|
||||||
import gui.editor.EmptyValidatingEditor;
|
import gui.editor.EmptyValidatingEditor;
|
||||||
import gui.editor.ValidatingEditor;
|
import gui.editor.ValidatingEditor;
|
||||||
import icon.IconManager;
|
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import message.MessageDirection;
|
import message.MessageDirection;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
import module.decode.am.AMDecoder;
|
import module.decode.am.AMDecoder;
|
||||||
import module.decode.am.AMDecoderEditor;
|
import module.decode.am.AMDecoderEditor;
|
||||||
import module.decode.am.AMDecoderPanel;
|
|
||||||
import module.decode.am.DecodeConfigAM;
|
import module.decode.am.DecodeConfigAM;
|
||||||
import module.decode.config.AuxDecodeConfiguration;
|
import module.decode.config.AuxDecodeConfiguration;
|
||||||
import module.decode.config.DecodeConfiguration;
|
import module.decode.config.DecodeConfiguration;
|
||||||
import module.decode.fleetsync2.Fleetsync2Decoder;
|
import module.decode.fleetsync2.Fleetsync2Decoder;
|
||||||
import module.decode.fleetsync2.Fleetsync2DecoderPanel;
|
|
||||||
import module.decode.fleetsync2.Fleetsync2DecoderState;
|
import module.decode.fleetsync2.Fleetsync2DecoderState;
|
||||||
import module.decode.fleetsync2.FleetsyncMessageFilter;
|
import module.decode.fleetsync2.FleetsyncMessageFilter;
|
||||||
import module.decode.lj1200.LJ1200Decoder;
|
import module.decode.lj1200.LJ1200Decoder;
|
||||||
import module.decode.lj1200.LJ1200DecoderPanel;
|
|
||||||
import module.decode.lj1200.LJ1200DecoderState;
|
import module.decode.lj1200.LJ1200DecoderState;
|
||||||
import module.decode.lj1200.LJ1200MessageFilter;
|
import module.decode.lj1200.LJ1200MessageFilter;
|
||||||
import module.decode.ltrnet.DecodeConfigLTRNet;
|
import module.decode.ltrnet.DecodeConfigLTRNet;
|
||||||
import module.decode.ltrnet.LTRNetDecoder;
|
import module.decode.ltrnet.LTRNetDecoder;
|
||||||
import module.decode.ltrnet.LTRNetDecoderEditor;
|
import module.decode.ltrnet.LTRNetDecoderEditor;
|
||||||
import module.decode.ltrnet.LTRNetDecoderPanel;
|
|
||||||
import module.decode.ltrnet.LTRNetDecoderState;
|
import module.decode.ltrnet.LTRNetDecoderState;
|
||||||
import module.decode.ltrnet.LTRNetMessageFilter;
|
import module.decode.ltrnet.LTRNetMessageFilter;
|
||||||
import module.decode.ltrstandard.DecodeConfigLTRStandard;
|
import module.decode.ltrstandard.DecodeConfigLTRStandard;
|
||||||
import module.decode.ltrstandard.LTRStandardDecoder;
|
import module.decode.ltrstandard.LTRStandardDecoder;
|
||||||
import module.decode.ltrstandard.LTRStandardDecoderEditor;
|
import module.decode.ltrstandard.LTRStandardDecoderEditor;
|
||||||
import module.decode.ltrstandard.LTRStandardDecoderPanel;
|
|
||||||
import module.decode.ltrstandard.LTRStandardDecoderState;
|
import module.decode.ltrstandard.LTRStandardDecoderState;
|
||||||
import module.decode.ltrstandard.LTRStandardMessageFilter;
|
import module.decode.ltrstandard.LTRStandardMessageFilter;
|
||||||
import module.decode.mdc1200.MDCDecoder;
|
import module.decode.mdc1200.MDCDecoder;
|
||||||
import module.decode.mdc1200.MDCDecoderPanel;
|
|
||||||
import module.decode.mdc1200.MDCDecoderState;
|
import module.decode.mdc1200.MDCDecoderState;
|
||||||
import module.decode.mdc1200.MDCMessageFilter;
|
import module.decode.mdc1200.MDCMessageFilter;
|
||||||
import module.decode.mpt1327.DecodeConfigMPT1327;
|
import module.decode.mpt1327.DecodeConfigMPT1327;
|
||||||
import module.decode.mpt1327.MPT1327Decoder;
|
import module.decode.mpt1327.MPT1327Decoder;
|
||||||
import module.decode.mpt1327.MPT1327Decoder.Sync;
|
import module.decode.mpt1327.MPT1327Decoder.Sync;
|
||||||
import module.decode.mpt1327.MPT1327DecoderEditor;
|
import module.decode.mpt1327.MPT1327DecoderEditor;
|
||||||
import module.decode.mpt1327.MPT1327DecoderPanel;
|
|
||||||
import module.decode.mpt1327.MPT1327DecoderState;
|
import module.decode.mpt1327.MPT1327DecoderState;
|
||||||
import module.decode.mpt1327.MPT1327MessageFilter;
|
import module.decode.mpt1327.MPT1327MessageFilter;
|
||||||
import module.decode.nbfm.DecodeConfigNBFM;
|
import module.decode.nbfm.DecodeConfigNBFM;
|
||||||
import module.decode.nbfm.NBFMDecoder;
|
import module.decode.nbfm.NBFMDecoder;
|
||||||
import module.decode.nbfm.NBFMDecoderEditor;
|
import module.decode.nbfm.NBFMDecoderEditor;
|
||||||
import module.decode.nbfm.NBFMDecoderPanel;
|
|
||||||
import module.decode.p25.DecodeConfigP25Phase1;
|
import module.decode.p25.DecodeConfigP25Phase1;
|
||||||
import module.decode.p25.P25Decoder.Modulation;
|
import module.decode.p25.P25Decoder.Modulation;
|
||||||
import module.decode.p25.P25DecoderEditor;
|
import module.decode.p25.P25DecoderEditor;
|
||||||
import module.decode.p25.P25DecoderPanel;
|
|
||||||
import module.decode.p25.P25DecoderState;
|
import module.decode.p25.P25DecoderState;
|
||||||
import module.decode.p25.P25_C4FMDecoder;
|
import module.decode.p25.P25_C4FMDecoder;
|
||||||
import module.decode.p25.P25_LSMDecoder;
|
import module.decode.p25.P25_LSMDecoder;
|
||||||
@@ -89,26 +82,14 @@ import module.decode.p25.message.filter.P25MessageFilterSet;
|
|||||||
import module.decode.passport.DecodeConfigPassport;
|
import module.decode.passport.DecodeConfigPassport;
|
||||||
import module.decode.passport.PassportDecoder;
|
import module.decode.passport.PassportDecoder;
|
||||||
import module.decode.passport.PassportDecoderEditor;
|
import module.decode.passport.PassportDecoderEditor;
|
||||||
import module.decode.passport.PassportDecoderPanel;
|
|
||||||
import module.decode.passport.PassportDecoderState;
|
import module.decode.passport.PassportDecoderState;
|
||||||
import module.decode.passport.PassportMessageFilter;
|
import module.decode.passport.PassportMessageFilter;
|
||||||
import channel.state.AlwaysUnsquelchedDecoderState;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import channel.traffic.TrafficChannelManager;
|
|
||||||
import module.decode.tait.Tait1200Decoder;
|
import module.decode.tait.Tait1200Decoder;
|
||||||
import module.decode.tait.Tait1200DecoderPanel;
|
|
||||||
import module.decode.tait.Tait1200DecoderState;
|
import module.decode.tait.Tait1200DecoderState;
|
||||||
import module.demodulate.am.AMDemodulatorModule;
|
import module.demodulate.am.AMDemodulatorModule;
|
||||||
import module.demodulate.audio.DemodulatedAudioFilterModule;
|
import module.demodulate.audio.DemodulatedAudioFilterModule;
|
||||||
import module.demodulate.fm.FMDemodulatorModule;
|
import module.demodulate.fm.FMDemodulatorModule;
|
||||||
import properties.SystemProperties;
|
|
||||||
import record.RecorderType;
|
|
||||||
import record.config.RecordConfiguration;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import util.TimeStamp;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -129,14 +110,15 @@ public class DecoderFactory
|
|||||||
ChannelMapModel channelMapModel,
|
ChannelMapModel channelMapModel,
|
||||||
ChannelProcessingManager channelProcessingManager,
|
ChannelProcessingManager channelProcessingManager,
|
||||||
AliasModel aliasModel,
|
AliasModel aliasModel,
|
||||||
Channel channel)
|
Channel channel,
|
||||||
|
Metadata metadata)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Get the optional alias list for the decode modules to use */
|
/* Get the optional alias list for the decode modules to use */
|
||||||
AliasList aliasList = aliasModel.getAliasList(channel.getAliasListName());
|
AliasList aliasList = aliasModel.getAliasList(channel.getAliasListName());
|
||||||
|
|
||||||
List<Module> modules = getPrimaryModules(channelModel, channelMapModel,
|
List<Module> modules = getPrimaryModules(channelModel, channelMapModel, channelProcessingManager, aliasList,
|
||||||
channelProcessingManager, aliasList, channel);
|
channel, metadata);
|
||||||
|
|
||||||
modules.addAll(getAuxiliaryDecoders(channel.getAuxDecodeConfiguration(), aliasList));
|
modules.addAll(getAuxiliaryDecoders(channel.getAuxDecodeConfiguration(), aliasList));
|
||||||
|
|
||||||
@@ -150,7 +132,7 @@ public class DecoderFactory
|
|||||||
ChannelMapModel channelMapModel,
|
ChannelMapModel channelMapModel,
|
||||||
ChannelProcessingManager channelProcessingManager,
|
ChannelProcessingManager channelProcessingManager,
|
||||||
AliasList aliasList,
|
AliasList aliasList,
|
||||||
Channel channel)
|
Channel channel, Metadata metadata)
|
||||||
{
|
{
|
||||||
List<Module> modules = new ArrayList<Module>();
|
List<Module> modules = new ArrayList<Module>();
|
||||||
|
|
||||||
@@ -162,11 +144,6 @@ public class DecoderFactory
|
|||||||
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
|
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
|
||||||
int iqStop = iqPass + 1250;
|
int iqStop = iqPass + 1250;
|
||||||
|
|
||||||
RecordConfiguration recordConfig = channel.getRecordConfiguration();
|
|
||||||
|
|
||||||
boolean recordAudio = recordConfig == null ? false :
|
|
||||||
recordConfig.getRecorders().contains(RecorderType.AUDIO);
|
|
||||||
|
|
||||||
switch(decodeConfig.getDecoderType())
|
switch(decodeConfig.getDecoderType())
|
||||||
{
|
{
|
||||||
case AM:
|
case AM:
|
||||||
@@ -174,14 +151,14 @@ public class DecoderFactory
|
|||||||
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.AM, channel.getName()));
|
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.AM, channel.getName()));
|
||||||
modules.add(new AMDemodulatorModule());
|
modules.add(new AMDemodulatorModule());
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add(new AudioModule(recordAudio));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case NBFM:
|
case NBFM:
|
||||||
modules.add(new NBFMDecoder(decodeConfig));
|
modules.add(new NBFMDecoder(decodeConfig));
|
||||||
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.NBFM, channel.getName()));
|
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.NBFM, channel.getName()));
|
||||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add(new AudioModule(recordAudio));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case LTR_STANDARD:
|
case LTR_STANDARD:
|
||||||
MessageDirection direction = ((DecodeConfigLTRStandard) decodeConfig).getMessageDirection();
|
MessageDirection direction = ((DecodeConfigLTRStandard) decodeConfig).getMessageDirection();
|
||||||
@@ -189,49 +166,46 @@ public class DecoderFactory
|
|||||||
modules.add(new LTRStandardDecoderState(aliasList));
|
modules.add(new LTRStandardDecoderState(aliasList));
|
||||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add(new AudioModule(recordAudio));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case LTR_NET:
|
case LTR_NET:
|
||||||
modules.add(new LTRNetDecoder((DecodeConfigLTRNet) decodeConfig, aliasList));
|
modules.add(new LTRNetDecoder((DecodeConfigLTRNet) decodeConfig, aliasList));
|
||||||
modules.add(new LTRNetDecoderState(aliasList));
|
modules.add(new LTRNetDecoderState(aliasList));
|
||||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add(new AudioModule(recordAudio));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case MPT1327:
|
case MPT1327:
|
||||||
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327) decodeConfig;
|
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327) decodeConfig;
|
||||||
|
|
||||||
ChannelMap channelMap = channelMapModel
|
ChannelMap channelMap = channelMapModel.getChannelMap(mptConfig.getChannelMapName());
|
||||||
.getChannelMap(mptConfig.getChannelMapName());
|
|
||||||
|
|
||||||
Sync sync = mptConfig.getSync();
|
Sync sync = mptConfig.getSync();
|
||||||
|
|
||||||
modules.add(new MPT1327Decoder(aliasList, sync));
|
modules.add(new MPT1327Decoder(aliasList, sync));
|
||||||
|
|
||||||
|
|
||||||
modules.add(new MPT1327DecoderState(aliasList, channelMap,
|
modules.add(new MPT1327DecoderState(aliasList, channelMap, channelType, mptConfig.getCallTimeout() * 1000));
|
||||||
channelType, mptConfig.getCallTimeout() * 1000));
|
|
||||||
|
|
||||||
if(channelType == ChannelType.STANDARD)
|
if(channelType == ChannelType.STANDARD)
|
||||||
{
|
{
|
||||||
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
|
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
|
||||||
|
|
||||||
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager,
|
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager, decodeConfig,
|
||||||
decodeConfig, recordConfig, channel.getSystem(),
|
channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(),
|
||||||
channel.getSite(), (aliasList != null ? aliasList.getName() : null), timeout,
|
(aliasList != null ? aliasList.getName() : null), timeout, mptConfig.getTrafficChannelPoolSize()));
|
||||||
mptConfig.getTrafficChannelPoolSize()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add(new AudioModule(recordAudio));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case PASSPORT:
|
case PASSPORT:
|
||||||
modules.add(new PassportDecoder(decodeConfig, aliasList));
|
modules.add(new PassportDecoder(decodeConfig, aliasList));
|
||||||
modules.add(new PassportDecoderState(aliasList));
|
modules.add(new PassportDecoderState(aliasList));
|
||||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add(new AudioModule(recordAudio));
|
modules.add(new AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
case P25_PHASE1:
|
case P25_PHASE1:
|
||||||
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1) decodeConfig;
|
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1) decodeConfig;
|
||||||
@@ -244,17 +218,15 @@ public class DecoderFactory
|
|||||||
case C4FM:
|
case C4FM:
|
||||||
modules.add(new FMDemodulatorModule(6750, 7500));
|
modules.add(new FMDemodulatorModule(6750, 7500));
|
||||||
modules.add(new P25_C4FMDecoder(aliasList, decodeConfig.getAFCMaximumCorrection()));
|
modules.add(new P25_C4FMDecoder(aliasList, decodeConfig.getAFCMaximumCorrection()));
|
||||||
modules.add(new P25DecoderState(aliasList, channelType,
|
modules.add(new P25DecoderState(aliasList, channelType, Modulation.C4FM,
|
||||||
Modulation.C4FM, p25Config.getIgnoreDataCalls()));
|
p25Config.getIgnoreDataCalls()));
|
||||||
break;
|
break;
|
||||||
case CQPSK:
|
case CQPSK:
|
||||||
modules.add(new P25_LSMDecoder(aliasList));
|
modules.add(new P25_LSMDecoder(aliasList));
|
||||||
modules.add(new P25DecoderState(aliasList, channelType,
|
modules.add(new P25DecoderState(aliasList, channelType, Modulation.CQPSK, p25Config.getIgnoreDataCalls()));
|
||||||
Modulation.CQPSK, p25Config.getIgnoreDataCalls()));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unrecognized P25 "
|
throw new IllegalArgumentException("Unrecognized P25 Phase 1 Modulation [" + modulation + "]");
|
||||||
+ "Phase 1 Modulation [" + modulation + "]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(channelType == ChannelType.STANDARD)
|
if(channelType == ChannelType.STANDARD)
|
||||||
@@ -262,19 +234,15 @@ public class DecoderFactory
|
|||||||
//Set call timeout to 3 seconds for P25 traffic channels
|
//Set call timeout to 3 seconds for P25 traffic channels
|
||||||
long timeout = 3000;
|
long timeout = 3000;
|
||||||
|
|
||||||
modules.add(new TrafficChannelManager(channelModel,
|
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager, decodeConfig,
|
||||||
channelProcessingManager, decodeConfig,
|
channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(),
|
||||||
recordConfig, channel.getSystem(), channel.getSite(),
|
(aliasList != null ? aliasList.getName() : null), timeout, p25Config.getTrafficChannelPoolSize()));
|
||||||
(aliasList != null ? aliasList.getName() : null), timeout,
|
|
||||||
p25Config.getTrafficChannelPoolSize()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modules.add(new P25AudioModule(recordAudio));
|
modules.add(new P25AudioModule(metadata));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("Unknown decoder type [" + decodeConfig.getDecoderType().toString() + "]");
|
||||||
"Unknown decoder type [" +
|
|
||||||
decodeConfig.getDecoderType().toString() + "]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return modules;
|
return modules;
|
||||||
@@ -324,39 +292,6 @@ public class DecoderFactory
|
|||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DecoderPanel getDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
|
||||||
DecoderState decoderState)
|
|
||||||
{
|
|
||||||
switch(decoderState.getDecoderType())
|
|
||||||
{
|
|
||||||
case AM:
|
|
||||||
return new AMDecoderPanel(iconManager, settingsManager, decoderState);
|
|
||||||
case FLEETSYNC2:
|
|
||||||
return new Fleetsync2DecoderPanel(iconManager, settingsManager, (Fleetsync2DecoderState) decoderState);
|
|
||||||
case LJ_1200:
|
|
||||||
return new LJ1200DecoderPanel(iconManager, settingsManager, (LJ1200DecoderState) decoderState);
|
|
||||||
case LTR_NET:
|
|
||||||
return new LTRNetDecoderPanel(iconManager, settingsManager, (LTRNetDecoderState) decoderState);
|
|
||||||
case LTR_STANDARD:
|
|
||||||
return new LTRStandardDecoderPanel(iconManager, settingsManager, (LTRStandardDecoderState) decoderState);
|
|
||||||
case MDC1200:
|
|
||||||
return new MDCDecoderPanel(iconManager, settingsManager, (MDCDecoderState) decoderState);
|
|
||||||
case MPT1327:
|
|
||||||
return new MPT1327DecoderPanel(iconManager, settingsManager, (MPT1327DecoderState) decoderState);
|
|
||||||
case NBFM:
|
|
||||||
return new NBFMDecoderPanel(iconManager, settingsManager, decoderState);
|
|
||||||
case P25_PHASE1:
|
|
||||||
return new P25DecoderPanel(iconManager, settingsManager, (P25DecoderState) decoderState);
|
|
||||||
case PASSPORT:
|
|
||||||
return new PassportDecoderPanel(iconManager, settingsManager, (PassportDecoderState) decoderState);
|
|
||||||
case TAIT_1200:
|
|
||||||
return new Tait1200DecoderPanel(iconManager, settingsManager, (Tait1200DecoderState) decoderState);
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unrecognized decoder: " +
|
|
||||||
decoderState.getDecoderType().getDisplayString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles a filter set containing filters for the primary channel
|
* Assembles a filter set containing filters for the primary channel
|
||||||
* decoder and each of the auxiliary decoders
|
* decoder and each of the auxiliary decoders
|
||||||
@@ -451,8 +386,7 @@ public class DecoderFactory
|
|||||||
case P25_PHASE1:
|
case P25_PHASE1:
|
||||||
return new DecodeConfigP25Phase1();
|
return new DecodeConfigP25Phase1();
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("DecodeConfigFactory - unknown decoder type ["
|
throw new IllegalArgumentException("DecodeConfigFactory - unknown decoder type [" + decoder.toString() + "]");
|
||||||
+ decoder.toString() + "]");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,25 +476,10 @@ public class DecoderFactory
|
|||||||
copyPass.setAFCMaximumCorrection(originalPass.getAFCMaximumCorrection());
|
copyPass.setAFCMaximumCorrection(originalPass.getAFCMaximumCorrection());
|
||||||
return copyPass;
|
return copyPass;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unrecognized decoder "
|
throw new IllegalArgumentException("Unrecognized decoder configuration type:" + config.getDecoderType());
|
||||||
+ "configuration type:" + config.getDecoderType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRecordingFilename(String token)
|
|
||||||
{
|
|
||||||
//Get the base recording filename
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(SystemProperties.getInstance()
|
|
||||||
.getApplicationFolder("recordings"));
|
|
||||||
sb.append(File.separator);
|
|
||||||
sb.append(TimeStamp.getTimeStamp("_"));
|
|
||||||
sb.append("_");
|
|
||||||
sb.append(token);
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.am;
|
|
||||||
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class AMDecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel("AM");
|
|
||||||
|
|
||||||
public AMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
if(mProtocol != null)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,23 +14,23 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.event;
|
package module.decode.event;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import audio.metadata.MetadataType;
|
import module.decode.DecoderType;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public abstract class CallEvent implements Comparable<CallEvent>
|
public abstract class CallEvent implements Comparable<CallEvent>
|
||||||
{
|
{
|
||||||
protected long mEventStart = System.currentTimeMillis();
|
protected long mEventStart = System.currentTimeMillis();
|
||||||
protected long mEventEnd;
|
protected long mEventEnd;
|
||||||
|
|
||||||
private SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd','HHmmss" );
|
private SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd','HHmmss");
|
||||||
|
|
||||||
protected DecoderType mDecoderType;
|
protected DecoderType mDecoderType;
|
||||||
protected CallEventType mCallEventType;
|
protected CallEventType mCallEventType;
|
||||||
@@ -41,12 +41,8 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
|
|
||||||
private boolean mValid = true;
|
private boolean mValid = true;
|
||||||
|
|
||||||
public CallEvent( DecoderType decoder,
|
public CallEvent(DecoderType decoder, CallEventType callEventType, AliasList aliasList, String fromID,
|
||||||
CallEventType callEventType,
|
String toID, String details)
|
||||||
AliasList aliasList,
|
|
||||||
String fromID,
|
|
||||||
String toID,
|
|
||||||
String details )
|
|
||||||
{
|
{
|
||||||
mDecoderType = decoder;
|
mDecoderType = decoder;
|
||||||
mCallEventType = callEventType;
|
mCallEventType = callEventType;
|
||||||
@@ -61,7 +57,7 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
* dispatched event as invalid and resend it so that any downstream
|
* dispatched event as invalid and resend it so that any downstream
|
||||||
* processing can remove the invalid event.
|
* processing can remove the invalid event.
|
||||||
*/
|
*/
|
||||||
public void setValid( boolean valid )
|
public void setValid(boolean valid)
|
||||||
{
|
{
|
||||||
mValid = valid;
|
mValid = valid;
|
||||||
}
|
}
|
||||||
@@ -71,14 +67,14 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
return mValid;
|
return mValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnd( long end )
|
public void setEnd(long end)
|
||||||
{
|
{
|
||||||
mEventEnd = end;
|
mEventEnd = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void end()
|
public void end()
|
||||||
{
|
{
|
||||||
setEnd( System.currentTimeMillis() );
|
setEnd(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public DecoderType getDecoderType()
|
public DecoderType getDecoderType()
|
||||||
@@ -91,7 +87,7 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
return mCallEventType;
|
return mCallEventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCallEventType( CallEventType type )
|
public void setCallEventType(CallEventType type)
|
||||||
{
|
{
|
||||||
mCallEventType = type;
|
mCallEventType = type;
|
||||||
}
|
}
|
||||||
@@ -101,7 +97,7 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
return mAliasList;
|
return mAliasList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAliasList( AliasList aliasList )
|
public void setAliasList(AliasList aliasList)
|
||||||
{
|
{
|
||||||
mAliasList = aliasList;
|
mAliasList = aliasList;
|
||||||
}
|
}
|
||||||
@@ -131,12 +127,7 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
return mFromID != null;
|
return mFromID != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataType getFromIDType()
|
public void setFromID(String id)
|
||||||
{
|
|
||||||
return MetadataType.FROM;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFromID( String id )
|
|
||||||
{
|
{
|
||||||
mFromID = id;
|
mFromID = id;
|
||||||
}
|
}
|
||||||
@@ -151,22 +142,17 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
return mToID != null;
|
return mToID != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToID( String id )
|
public void setToID(String id)
|
||||||
{
|
{
|
||||||
mToID = id;
|
mToID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetadataType getToIDType()
|
|
||||||
{
|
|
||||||
return MetadataType.TO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDetails()
|
public String getDetails()
|
||||||
{
|
{
|
||||||
return mDetails;
|
return mDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDetails( String details )
|
public void setDetails(String details)
|
||||||
{
|
{
|
||||||
mDetails = details;
|
mDetails = details;
|
||||||
}
|
}
|
||||||
@@ -181,75 +167,74 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
|
|
||||||
public static String getCSVHeader()
|
public static String getCSVHeader()
|
||||||
{
|
{
|
||||||
return "START_DATE,START_TIME,END_DATE,END_TIME,"
|
return "START_DATE,START_TIME,END_DATE,END_TIME,DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,CHANNEL," +
|
||||||
+ "DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,"
|
"FREQUENCY,DETAILS";
|
||||||
+ "CHANNEL,FREQUENCY,DETAILS";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toCSV()
|
public String toCSV()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
sb.append( mSDF.format( new Date( getEventStartTime() ) ) );
|
sb.append(mSDF.format(new Date(getEventStartTime())));
|
||||||
sb.append( "','" );
|
sb.append("','");
|
||||||
if( mEventEnd != 0 )
|
if(mEventEnd != 0)
|
||||||
{
|
{
|
||||||
sb.append( mSDF.format( new Date( getEventEndTime() ) ) );
|
sb.append(mSDF.format(new Date(getEventEndTime())));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append( "','" );
|
sb.append("','");
|
||||||
}
|
}
|
||||||
sb.append( "','" );
|
sb.append("','");
|
||||||
sb.append( getDecoderType().toString() );
|
sb.append(getDecoderType().toString());
|
||||||
sb.append( "','" );
|
sb.append("','");
|
||||||
sb.append( getCallEventType().toString() );
|
sb.append(getCallEventType().toString());
|
||||||
sb.append( "'," );
|
sb.append("',");
|
||||||
if( getFromID() != null )
|
if(getFromID() != null)
|
||||||
{
|
{
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
sb.append( getFromID() );
|
sb.append(getFromID());
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
}
|
}
|
||||||
sb.append( "," );
|
sb.append(",");
|
||||||
|
|
||||||
Alias fromAlias = getFromIDAlias();
|
Alias fromAlias = getFromIDAlias();
|
||||||
|
|
||||||
if( fromAlias != null )
|
if(fromAlias != null)
|
||||||
{
|
{
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
sb.append( fromAlias.getName() );
|
sb.append(fromAlias.getName());
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
}
|
}
|
||||||
sb.append( "," );
|
sb.append(",");
|
||||||
|
|
||||||
if( getToID() != null )
|
if(getToID() != null)
|
||||||
{
|
{
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
sb.append( getToID() );
|
sb.append(getToID());
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
}
|
}
|
||||||
sb.append( "," );
|
sb.append(",");
|
||||||
|
|
||||||
Alias toAlias = getToIDAlias();
|
Alias toAlias = getToIDAlias();
|
||||||
|
|
||||||
if( toAlias != null )
|
if(toAlias != null)
|
||||||
{
|
{
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
sb.append( toAlias.getName() );
|
sb.append(toAlias.getName());
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
}
|
}
|
||||||
sb.append( ",'" );
|
sb.append(",'");
|
||||||
sb.append( getChannel() );
|
sb.append(getChannel());
|
||||||
sb.append( "','" );
|
sb.append("','");
|
||||||
sb.append( getFrequency() );
|
sb.append(getFrequency());
|
||||||
sb.append( "'," );
|
sb.append("',");
|
||||||
if( getDetails() != null )
|
if(getDetails() != null)
|
||||||
{
|
{
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
sb.append( getDetails() );
|
sb.append(getDetails());
|
||||||
sb.append( "'" );
|
sb.append("'");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
@@ -257,45 +242,45 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
|
|
||||||
public enum CallEventType
|
public enum CallEventType
|
||||||
{
|
{
|
||||||
ANNOUNCEMENT( "Announcement" ),
|
ANNOUNCEMENT("Announcement"),
|
||||||
CALL( "Call" ),
|
CALL("Call"),
|
||||||
CALL_ALERT( "Call Alert" ),
|
CALL_ALERT("Call Alert"),
|
||||||
CALL_DETECT( "Call Detect" ),
|
CALL_DETECT("Call Detect"),
|
||||||
CALL_DO_NOT_MONITOR( "Call-Do Not Monitor" ),
|
CALL_DO_NOT_MONITOR("Call-Do Not Monitor"),
|
||||||
CALL_END( "Call End" ),
|
CALL_END("Call End"),
|
||||||
CALL_UNIQUE_ID( "UID Call" ),
|
CALL_UNIQUE_ID("UID Call"),
|
||||||
CALL_NO_TUNER( "Call - No Tuner" ),
|
CALL_NO_TUNER("Call - No Tuner"),
|
||||||
CALL_TIMEOUT( "Call Timeout" ),
|
CALL_TIMEOUT("Call Timeout"),
|
||||||
COMMAND( "Command" ),
|
COMMAND("Command"),
|
||||||
DATA_CALL( "Data Call" ),
|
DATA_CALL("Data Call"),
|
||||||
DEREGISTER( "Deregister" ),
|
DEREGISTER("Deregister"),
|
||||||
EMERGENCY( "EMERGENCY" ),
|
EMERGENCY("EMERGENCY"),
|
||||||
ENCRYPTED_CALL( "Encrypted Call" ),
|
ENCRYPTED_CALL("Encrypted Call"),
|
||||||
FUNCTION( "Function" ),
|
FUNCTION("Function"),
|
||||||
GPS( "GPS" ),
|
GPS("GPS"),
|
||||||
GROUP_CALL( "Group Call" ),
|
GROUP_CALL("Group Call"),
|
||||||
ID_ANI( "ANI" ),
|
ID_ANI("ANI"),
|
||||||
ID_UNIQUE( "Unique ID" ),
|
ID_UNIQUE("Unique ID"),
|
||||||
NOTIFICATION( "Notification" ),
|
NOTIFICATION("Notification"),
|
||||||
PAGE( "Page" ),
|
PAGE("Page"),
|
||||||
PATCH_GROUP_ADD( "Patch Group Add"),
|
PATCH_GROUP_ADD("Patch Group Add"),
|
||||||
PATCH_GROUP_CALL( "Patch Group Call" ),
|
PATCH_GROUP_CALL("Patch Group Call"),
|
||||||
PATCH_GROUP_DELETE( "Patch Group Delete"),
|
PATCH_GROUP_DELETE("Patch Group Delete"),
|
||||||
QUERY( "Query" ),
|
QUERY("Query"),
|
||||||
REGISTER( "Register" ),
|
REGISTER("Register"),
|
||||||
REGISTER_ESN( "ESN" ),
|
REGISTER_ESN("ESN"),
|
||||||
RESPONSE( "Response" ),
|
RESPONSE("Response"),
|
||||||
SDM( "Short Data Message" ),
|
SDM("Short Data Message"),
|
||||||
STATION_ID( "Station ID" ),
|
STATION_ID("Station ID"),
|
||||||
STATUS( "Status" ),
|
STATUS("Status"),
|
||||||
TELEPHONE_INTERCONNECT( "Telephone Interconnect" ),
|
TELEPHONE_INTERCONNECT("Telephone Interconnect"),
|
||||||
UNIT_TO_UNIT_CALL( "Unit To Unit Call" ),
|
UNIT_TO_UNIT_CALL("Unit To Unit Call"),
|
||||||
UNKNOWN( "Unknown" ),
|
UNKNOWN("Unknown"),
|
||||||
INVALID( "Invalid" );
|
INVALID("Invalid");
|
||||||
|
|
||||||
private String mLabel;
|
private String mLabel;
|
||||||
|
|
||||||
private CallEventType( String label )
|
private CallEventType(String label)
|
||||||
{
|
{
|
||||||
mLabel = label;
|
mLabel = label;
|
||||||
}
|
}
|
||||||
@@ -312,13 +297,13 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo( CallEvent other )
|
public int compareTo(CallEvent other)
|
||||||
{
|
{
|
||||||
if( other != null && other == this )
|
if(other != null && other == this)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Long.compare( mEventStart, other.getEventStartTime() );
|
return Long.compare(mEventStart, other.getEventStartTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,37 +14,12 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.event;
|
package module.decode.event;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.awt.event.MouseListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JSlider;
|
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import module.ProcessingChain;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.jidesoft.swing.JideButton;
|
import com.jidesoft.swing.JideButton;
|
||||||
import com.jidesoft.swing.JideSplitButton;
|
import com.jidesoft.swing.JideSplitButton;
|
||||||
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
import controller.channel.ChannelEvent;
|
import controller.channel.ChannelEvent;
|
||||||
import controller.channel.ChannelEvent.Event;
|
import controller.channel.ChannelEvent.Event;
|
||||||
@@ -52,13 +27,26 @@ import controller.channel.ChannelEventListener;
|
|||||||
import controller.channel.ChannelProcessingManager;
|
import controller.channel.ChannelProcessingManager;
|
||||||
import filter.FilterEditorPanel;
|
import filter.FilterEditorPanel;
|
||||||
import filter.FilterSet;
|
import filter.FilterSet;
|
||||||
|
import message.Message;
|
||||||
|
import module.ProcessingChain;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.ChangeEvent;
|
||||||
|
import javax.swing.event.ChangeListener;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
|
||||||
public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final static Logger mLog =
|
private final static Logger mLog = LoggerFactory.getLogger(MessageActivityPanel.class);
|
||||||
LoggerFactory.getLogger( MessageActivityPanel.class );
|
|
||||||
|
|
||||||
private static MessageActivityModel EMPTY_MODEL = new MessageActivityModel();
|
private static MessageActivityModel EMPTY_MODEL = new MessageActivityModel();
|
||||||
|
|
||||||
@@ -71,37 +59,34 @@ public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
|||||||
|
|
||||||
private ChannelProcessingManager mChannelProcessingManager;
|
private ChannelProcessingManager mChannelProcessingManager;
|
||||||
|
|
||||||
public MessageActivityPanel( ChannelProcessingManager channelProcessingManager )
|
public MessageActivityPanel(ChannelProcessingManager channelProcessingManager)
|
||||||
{
|
{
|
||||||
mChannelProcessingManager = channelProcessingManager;
|
mChannelProcessingManager = channelProcessingManager;
|
||||||
|
|
||||||
setLayout( new MigLayout("insets 0 0 0 0", "[][grow,fill]", "[]0[grow,fill]") );
|
setLayout(new MigLayout("insets 0 0 0 0", "[][grow,fill]", "[]0[grow,fill]"));
|
||||||
|
|
||||||
add( mManagementPanel, "span,growx" );
|
add(mManagementPanel, "span,growx");
|
||||||
|
|
||||||
mMessageTable = new JTable( mDisplayedModel );
|
mMessageTable = new JTable(mDisplayedModel);
|
||||||
|
|
||||||
add( new JScrollPane( mMessageTable ), "span,grow" );
|
add(new JScrollPane(mMessageTable), "span,grow");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelChanged( ChannelEvent event )
|
public void channelChanged(ChannelEvent event)
|
||||||
{
|
{
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
if( event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
||||||
event.getChannel().isSelected() )
|
event.getChannel().isSelected())
|
||||||
{
|
{
|
||||||
if( mDisplayedChannel == null ||
|
if(mDisplayedChannel == null || (mDisplayedChannel != null && mDisplayedChannel != event.getChannel()))
|
||||||
( mDisplayedChannel != null &&
|
|
||||||
mDisplayedChannel != event.getChannel() ) )
|
|
||||||
{
|
{
|
||||||
mDisplayedChannel = event.getChannel();
|
mDisplayedChannel = event.getChannel();
|
||||||
|
|
||||||
ProcessingChain chain = mChannelProcessingManager
|
ProcessingChain chain = mChannelProcessingManager.getProcessingChain(mDisplayedChannel);
|
||||||
.getProcessingChain( mDisplayedChannel );
|
|
||||||
|
|
||||||
if( chain != null )
|
if(chain != null)
|
||||||
{
|
{
|
||||||
mDisplayedModel = chain.getMessageActivityModel();
|
mDisplayedModel = chain.getMessageActivityModel();
|
||||||
}
|
}
|
||||||
@@ -110,37 +95,35 @@ public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
|||||||
mDisplayedModel = EMPTY_MODEL;
|
mDisplayedModel = EMPTY_MODEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mMessageTable.setModel( mDisplayedModel );
|
mMessageTable.setModel(mDisplayedModel);
|
||||||
|
|
||||||
if( mDisplayedChannel != null )
|
if(mDisplayedChannel != null)
|
||||||
{
|
{
|
||||||
mManagementPanel.enable();
|
mManagementPanel.enableButtons();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mManagementPanel.disable();
|
mManagementPanel.disableButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP ||
|
else if(event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP || event.getEvent() == Event.REQUEST_DISABLE)
|
||||||
event.getEvent() == Event.REQUEST_DISABLE )
|
|
||||||
{
|
{
|
||||||
if( mDisplayedChannel != null &&
|
if(mDisplayedChannel != null && mDisplayedChannel == event.getChannel())
|
||||||
mDisplayedChannel == event.getChannel() )
|
|
||||||
{
|
{
|
||||||
mDisplayedChannel = null;
|
mDisplayedChannel = null;
|
||||||
|
|
||||||
mMessageTable.setModel( EMPTY_MODEL );
|
mMessageTable.setModel(EMPTY_MODEL);
|
||||||
|
|
||||||
mManagementPanel.disable();
|
mManagementPanel.disableButtons();
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( changed )
|
if(changed)
|
||||||
{
|
{
|
||||||
revalidate();
|
revalidate();
|
||||||
repaint();
|
repaint();
|
||||||
@@ -156,24 +139,24 @@ public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
|||||||
|
|
||||||
public MessageManagementPanel()
|
public MessageManagementPanel()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout("insets 2 2 5 5", "[]5[left,grow]", "") );
|
setLayout(new MigLayout("insets 2 2 5 5", "[]5[left,grow]", ""));
|
||||||
|
|
||||||
disable();
|
disableButtons();
|
||||||
|
|
||||||
add( mFilterButton );
|
add(mFilterButton);
|
||||||
add( mHistoryButton );
|
add(mHistoryButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enable()
|
public void enableButtons()
|
||||||
{
|
{
|
||||||
mHistoryButton.setEnabled( true );
|
mHistoryButton.setEnabled(true);
|
||||||
mFilterButton.setEnabled( true );
|
mFilterButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable()
|
public void disableButtons()
|
||||||
{
|
{
|
||||||
mHistoryButton.setEnabled( false );
|
mHistoryButton.setEnabled(false);
|
||||||
mFilterButton.setEnabled( false );
|
mFilterButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,74 +166,85 @@ public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
|||||||
|
|
||||||
public MessageHistoryButton()
|
public MessageHistoryButton()
|
||||||
{
|
{
|
||||||
super( "Clear" );
|
super("Clear");
|
||||||
|
|
||||||
JPanel historyPanel = new JPanel();
|
JPanel historyPanel = new JPanel();
|
||||||
|
|
||||||
historyPanel.add( new JLabel( "Message History:" ) );
|
historyPanel.add(new JLabel("Message History:"));
|
||||||
|
|
||||||
final JSlider slider = new JSlider();
|
final JSlider slider = new JSlider();
|
||||||
slider.setMinimum( 0 );
|
slider.setMinimum(0);
|
||||||
slider.setMaximum( 2000 );
|
slider.setMaximum(2000);
|
||||||
slider.setMajorTickSpacing( 500 );
|
slider.setMajorTickSpacing(500);
|
||||||
slider.setPaintTicks( true );
|
slider.setPaintTicks(true);
|
||||||
slider.setPaintLabels( true );
|
slider.setPaintLabels(true);
|
||||||
|
|
||||||
slider.addMouseListener( new MouseListener()
|
slider.addMouseListener(new MouseListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked( MouseEvent arg0 )
|
public void mouseClicked(MouseEvent arg0)
|
||||||
{
|
{
|
||||||
if( SwingUtilities.isLeftMouseButton( arg0 ) &&
|
if(SwingUtilities.isLeftMouseButton(arg0) &&
|
||||||
arg0.getClickCount() == 2 )
|
arg0.getClickCount() == 2)
|
||||||
{
|
{
|
||||||
slider.setValue( 500 ); //default
|
slider.setValue(500); //default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseEntered( MouseEvent arg0 ) {}
|
public void mouseEntered(MouseEvent arg0)
|
||||||
public void mouseExited( MouseEvent arg0 ) {}
|
|
||||||
public void mousePressed( MouseEvent arg0 ) {}
|
|
||||||
public void mouseReleased( MouseEvent arg0 ) {}
|
|
||||||
} );
|
|
||||||
|
|
||||||
if( mDisplayedModel != null )
|
|
||||||
{
|
{
|
||||||
slider.setValue( mDisplayedModel.getMaxMessageCount() );
|
}
|
||||||
|
|
||||||
|
public void mouseExited(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mousePressed(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(mDisplayedModel != null)
|
||||||
|
{
|
||||||
|
slider.setValue(mDisplayedModel.getMaxMessageCount());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
slider.setValue( 500 );
|
slider.setValue(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
slider.addChangeListener( new ChangeListener()
|
slider.addChangeListener(new ChangeListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void stateChanged( ChangeEvent arg0 )
|
public void stateChanged(ChangeEvent arg0)
|
||||||
{
|
{
|
||||||
if( mDisplayedModel != null )
|
if(mDisplayedModel != null)
|
||||||
{
|
{
|
||||||
mDisplayedModel.setMaxMessageCount( slider.getValue() );
|
mDisplayedModel.setMaxMessageCount(slider.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
historyPanel.add( slider );
|
historyPanel.add(slider);
|
||||||
|
|
||||||
add( historyPanel );
|
add(historyPanel);
|
||||||
|
|
||||||
/* Clear messages */
|
/* Clear messages */
|
||||||
addActionListener( new ActionListener()
|
addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed( ActionEvent e )
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
if( mDisplayedModel != null )
|
if(mDisplayedModel != null)
|
||||||
{
|
{
|
||||||
mDisplayedModel.clear();
|
mDisplayedModel.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,70 +254,70 @@ public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
|||||||
|
|
||||||
public MessageFilterButton()
|
public MessageFilterButton()
|
||||||
{
|
{
|
||||||
super( "Filter" );
|
super("Filter");
|
||||||
|
|
||||||
addActionListener( new ActionListener()
|
addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed( ActionEvent arg0 )
|
public void actionPerformed(ActionEvent arg0)
|
||||||
{
|
{
|
||||||
if( mDisplayedChannel == null )
|
if(mDisplayedChannel == null)
|
||||||
{
|
{
|
||||||
JOptionPane.showMessageDialog( MessageFilterButton.this,
|
JOptionPane.showMessageDialog(MessageFilterButton.this,
|
||||||
"Please enable and select a decoding channel to "
|
"Please enable and select a decoding channel to "
|
||||||
+ "adjust the channel's message display filter" );
|
+ "adjust the channel's message display filter");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( mDisplayedModel != null )
|
if(mDisplayedModel != null)
|
||||||
{
|
{
|
||||||
final JFrame editor = new JFrame();
|
final JFrame editor = new JFrame();
|
||||||
|
|
||||||
editor.setTitle( "Message Filter Editor" );
|
editor.setTitle("Message Filter Editor");
|
||||||
editor.setSize( 600, 400 );
|
editor.setSize(600, 400);
|
||||||
editor.setLocationRelativeTo( MessageFilterButton.this );
|
editor.setLocationRelativeTo(MessageFilterButton.this);
|
||||||
editor.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
|
editor.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
editor.setLayout( new MigLayout( "", "[grow,fill]",
|
editor.setLayout(new MigLayout("", "[grow,fill]",
|
||||||
"[grow,fill][][]" ) );
|
"[grow,fill][][]"));
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings("unchecked")
|
||||||
FilterSet<Message> filter = (FilterSet<Message>)
|
FilterSet<Message> filter = (FilterSet<Message>)
|
||||||
mDisplayedModel.getMessageFilter();
|
mDisplayedModel.getMessageFilter();
|
||||||
|
|
||||||
FilterEditorPanel<Message> panel =
|
FilterEditorPanel<Message> panel =
|
||||||
new FilterEditorPanel<Message>( filter );
|
new FilterEditorPanel<Message>(filter);
|
||||||
|
|
||||||
JScrollPane scroller = new JScrollPane( panel );
|
JScrollPane scroller = new JScrollPane(panel);
|
||||||
scroller.setViewportView( panel );
|
scroller.setViewportView(panel);
|
||||||
|
|
||||||
editor.add( scroller, "wrap" );
|
editor.add(scroller, "wrap");
|
||||||
|
|
||||||
editor.add( new JLabel( "Right-click to select/deselect "
|
editor.add(new JLabel("Right-click to select/deselect "
|
||||||
+ "all nodes" ), "wrap" );
|
+ "all nodes"), "wrap");
|
||||||
|
|
||||||
JButton close = new JButton( "Close" );
|
JButton close = new JButton("Close");
|
||||||
close.addActionListener( new ActionListener()
|
close.addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed( ActionEvent e )
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
editor.dispose();
|
editor.dispose();
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
|
|
||||||
editor.add( close );
|
editor.add(close);
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
editor.setVisible( true );
|
editor.setVisible(true);
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.fleetsync2;
|
|
||||||
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class Fleetsync2DecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2DecoderPanel.class);
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private static final String PROTOCOL = "FSync II";
|
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel(" ");
|
|
||||||
private JLabel mTo = new JLabel(" ");
|
|
||||||
private JLabel mToAlias = new JLabel(" ");
|
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel(" ");
|
|
||||||
private JLabel mFrom = new JLabel(" ");
|
|
||||||
private JLabel mFromAlias = new JLabel(" ");
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel(PROTOCOL);
|
|
||||||
private JLabel mMessage = new JLabel(" ");
|
|
||||||
private JLabel mMessageType = new JLabel(" ");
|
|
||||||
|
|
||||||
public Fleetsync2DecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
|
||||||
Fleetsync2DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fleetsync2DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (Fleetsync2DecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mToLabel.setFont(mFontAuxDecoder);
|
|
||||||
mToLabel.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mToLabel);
|
|
||||||
|
|
||||||
mTo.setFont(mFontAuxDecoder);
|
|
||||||
mTo.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mTo);
|
|
||||||
|
|
||||||
mToAlias.setFont(mFontAuxDecoder);
|
|
||||||
mToAlias.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mToAlias, "wrap");
|
|
||||||
|
|
||||||
mFromLabel.setFont(mFontAuxDecoder);
|
|
||||||
mFromLabel.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mFromLabel);
|
|
||||||
|
|
||||||
mFrom.setFont(mFontAuxDecoder);
|
|
||||||
mFrom.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mFrom);
|
|
||||||
|
|
||||||
mFromAlias.setFont(mFontAuxDecoder);
|
|
||||||
mFromAlias.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mFromAlias, "wrap");
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontAuxDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mProtocol);
|
|
||||||
|
|
||||||
mMessageType.setFont(mFontAuxDecoder);
|
|
||||||
mMessageType.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mMessageType);
|
|
||||||
|
|
||||||
mMessage.setFont(mFontAuxDecoder);
|
|
||||||
mMessage.setForeground(mColorLabelAuxDecoder);
|
|
||||||
add(mMessage, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
String from = getDecoderState().getFromID();
|
|
||||||
|
|
||||||
if(from != null)
|
|
||||||
{
|
|
||||||
mFromLabel.setText("FROM:");
|
|
||||||
mFrom.setText(from);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromLabel.setText(" ");
|
|
||||||
mFrom.setText(" ");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
setAliasLabel(mFromAlias, getDecoderState().getFromIDAlias());
|
|
||||||
break;
|
|
||||||
case MESSAGE:
|
|
||||||
mMessage.setText(getDecoderState().getMessage());
|
|
||||||
break;
|
|
||||||
case MESSAGE_TYPE:
|
|
||||||
mMessageType.setText(getDecoderState().getMessageType());
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String to = getDecoderState().getToID();
|
|
||||||
|
|
||||||
if(to != null)
|
|
||||||
{
|
|
||||||
mToLabel.setText("TO:");
|
|
||||||
mTo.setText(to);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToLabel.setText(" ");
|
|
||||||
mTo.setText(" ");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
setAliasLabel(mToAlias, getDecoderState().getToIDAlias());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting) setting;
|
|
||||||
|
|
||||||
if(color.getColorSettingName() ==
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
|
||||||
{
|
|
||||||
mFromLabel.setForeground(color.getColor());
|
|
||||||
mFrom.setForeground(color.getColor());
|
|
||||||
mFromAlias.setForeground(color.getColor());
|
|
||||||
mToLabel.setForeground(color.getColor());
|
|
||||||
mTo.setForeground(color.getColor());
|
|
||||||
mToAlias.setForeground(color.getColor());
|
|
||||||
mProtocol.setForeground(color.getColor());
|
|
||||||
mMessageType.setForeground(color.getColor());
|
|
||||||
mMessage.setForeground(color.getColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,18 +14,21 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.fleetsync2;
|
package module.decode.fleetsync2;
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import channel.metadata.Attribute;
|
import channel.metadata.Attribute;
|
||||||
|
import channel.metadata.AttributeChangeRequest;
|
||||||
import channel.state.DecoderState;
|
import channel.state.DecoderState;
|
||||||
import channel.state.DecoderStateEvent;
|
import channel.state.DecoderStateEvent;
|
||||||
import channel.state.DecoderStateEvent.Event;
|
import channel.state.DecoderStateEvent.Event;
|
||||||
import channel.state.State;
|
import channel.state.State;
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.decode.DecoderType;
|
import module.decode.DecoderType;
|
||||||
|
import util.StringUtils;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
@@ -116,7 +119,6 @@ public class Fleetsync2DecoderState extends DecoderState
|
|||||||
State state = State.CALL;
|
State state = State.CALL;
|
||||||
|
|
||||||
setFromID(fleetsync.getFromID());
|
setFromID(fleetsync.getFromID());
|
||||||
setFromIDAlias(fleetsync.getFromIDAlias());
|
|
||||||
mIdents.add(fleetsync.getFromID());
|
mIdents.add(fleetsync.getFromID());
|
||||||
|
|
||||||
FleetsyncMessageType type = fleetsync.getMessageType();
|
FleetsyncMessageType type = fleetsync.getMessageType();
|
||||||
@@ -124,7 +126,6 @@ public class Fleetsync2DecoderState extends DecoderState
|
|||||||
if(type != FleetsyncMessageType.ANI)
|
if(type != FleetsyncMessageType.ANI)
|
||||||
{
|
{
|
||||||
setToID(fleetsync.getToID());
|
setToID(fleetsync.getToID());
|
||||||
setToIDAlias(fleetsync.getToIDAlias());
|
|
||||||
mIdents.add(fleetsync.getToID());
|
mIdents.add(fleetsync.getToID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,22 +180,19 @@ public class Fleetsync2DecoderState extends DecoderState
|
|||||||
return mFrom;
|
return mFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFromID(String from)
|
|
||||||
{
|
|
||||||
mFrom = from;
|
|
||||||
|
|
||||||
broadcast(Attribute.FROM_TALKGROUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getFromIDAlias()
|
public Alias getFromIDAlias()
|
||||||
{
|
{
|
||||||
return mFromAlias;
|
return mFromAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFromIDAlias(Alias alias)
|
public void setFromID(String from)
|
||||||
{
|
{
|
||||||
mFromAlias = alias;
|
if(!StringUtils.isEqual(mFrom, from))
|
||||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
{
|
||||||
|
mFrom = from;
|
||||||
|
mFromAlias = hasAliasList() ? getAliasList().getFleetsyncAlias(mFrom) : null;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, mFrom, mFromAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToID()
|
public String getToID()
|
||||||
@@ -202,21 +200,19 @@ public class Fleetsync2DecoderState extends DecoderState
|
|||||||
return mTo;
|
return mTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToID(String to)
|
|
||||||
{
|
|
||||||
mTo = to;
|
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getToIDAlias()
|
public Alias getToIDAlias()
|
||||||
{
|
{
|
||||||
return mToAlias;
|
return mToAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToIDAlias(Alias alias)
|
public void setToID(String to)
|
||||||
{
|
{
|
||||||
mToAlias = alias;
|
if(!StringUtils.isEqual(mTo, to))
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
{
|
||||||
|
mTo = to;
|
||||||
|
mToAlias = hasAliasList() ? getAliasList().getFleetsyncAlias(mTo) : null;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mTo, mToAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
public String getMessage()
|
||||||
@@ -225,20 +221,26 @@ public class Fleetsync2DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(String message)
|
public void setMessage(String message)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessage, message))
|
||||||
{
|
{
|
||||||
mMessage = message;
|
mMessage = message;
|
||||||
broadcast(Attribute.MESSAGE);
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, mMessage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessageType()
|
public String getMessageType()
|
||||||
{
|
{
|
||||||
return mMessageType;
|
return "Fleetsync " + mMessageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageType(String type)
|
public void setMessageType(String type)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessageType, type))
|
||||||
{
|
{
|
||||||
mMessageType = type;
|
mMessageType = type;
|
||||||
broadcast(Attribute.MESSAGE_TYPE);
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, getMessageType()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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 icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class LJ1200DecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private static final String PROTOCOL = "LJ-1200";
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel(PROTOCOL);
|
|
||||||
private JLabel mTo = new JLabel();
|
|
||||||
private JLabel mToAlias = new JLabel();
|
|
||||||
|
|
||||||
public LJ1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, LJ1200DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", ""));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mTo.setFont(mFontDecoder);
|
|
||||||
mTo.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mToAlias.setFont(mFontDecoder);
|
|
||||||
mToAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mTo);
|
|
||||||
add(mToAlias, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
public LJ1200DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (LJ1200DecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
mTo.setText(getDecoderState().getAddress());
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias alias = getDecoderState().getAddressAlias();
|
|
||||||
|
|
||||||
if(alias != null)
|
|
||||||
{
|
|
||||||
mToAlias.setText(alias.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToAlias.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting) setting;
|
|
||||||
|
|
||||||
if(color.getColorSettingName() ==
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(color.getColor());
|
|
||||||
mTo.setForeground(color.getColor());
|
|
||||||
mToAlias.setForeground(color.getColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,24 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.lj1200;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,32 +39,18 @@ import java.util.Set;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
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
|
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 Set<String> mAddresses = new TreeSet<String>();
|
||||||
|
|
||||||
private String mAddress;
|
private String mAddress;
|
||||||
private Alias mAddressAlias;
|
private Alias mAddressAlias;
|
||||||
|
|
||||||
public LJ1200DecoderState( AliasList aliasList )
|
public LJ1200DecoderState(AliasList aliasList)
|
||||||
{
|
{
|
||||||
super( aliasList );
|
super(aliasList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,7 +60,7 @@ public class LJ1200DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,40 +80,43 @@ public class LJ1200DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if( message instanceof LJ1200Message )
|
if(message instanceof LJ1200Message)
|
||||||
{
|
{
|
||||||
LJ1200Message lj = (LJ1200Message)message;
|
LJ1200Message lj = (LJ1200Message) message;
|
||||||
|
|
||||||
if( lj.isValid() )
|
if(lj.isValid())
|
||||||
{
|
{
|
||||||
setAddress( lj.getAddress() );
|
setAddress(lj.getAddress());
|
||||||
setAddressAlias( lj.getTransponderAlias() );
|
setAddressAlias(lj.getTransponderAlias());
|
||||||
|
|
||||||
mAddresses.add( mAddress );
|
mAddresses.add(mAddress);
|
||||||
|
|
||||||
broadcast( LJ1200CallEvent.getLJ1200Event( lj ) );
|
broadcast(LJ1200CallEvent.getLJ1200Event(lj));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( message instanceof LJ1200TransponderMessage )
|
else if(message instanceof LJ1200TransponderMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAddress( String address )
|
private void setAddress(String address)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mAddress, address))
|
||||||
{
|
{
|
||||||
mAddress = address;
|
mAddress = address;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mAddress, mAddressAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAddressAlias( Alias alias )
|
private void setAddressAlias(Alias alias)
|
||||||
{
|
{
|
||||||
mAddressAlias = alias;
|
mAddressAlias = alias;
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mAddress, mAddressAlias));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,22 +124,22 @@ public class LJ1200DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "=============================\n" );
|
sb.append("=============================\n");
|
||||||
sb.append( "Decoder:\tLJ-1200I\n\n" );
|
sb.append("Decoder:\tLJ-1200I\n\n");
|
||||||
|
|
||||||
if( !mAddresses.isEmpty() )
|
if(!mAddresses.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( "Transponder Addresses:\n" );
|
sb.append("Transponder Addresses:\n");
|
||||||
|
|
||||||
List<String> addresses = new ArrayList<String>( mAddresses );
|
List<String> addresses = new ArrayList<String>(mAddresses);
|
||||||
|
|
||||||
Collections.sort( addresses );
|
Collections.sort(addresses);
|
||||||
|
|
||||||
for( String address: addresses )
|
for(String address : addresses)
|
||||||
{
|
{
|
||||||
sb.append( "\t" );
|
sb.append("\t");
|
||||||
sb.append( address );
|
sb.append(address);
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,9 +153,9 @@ public class LJ1200DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
if( event.getEvent() == Event.RESET )
|
if(event.getEvent() == Event.RESET)
|
||||||
{
|
{
|
||||||
resetState();
|
resetState();
|
||||||
}
|
}
|
||||||
@@ -159,10 +163,8 @@ public class LJ1200DecoderState extends DecoderState
|
|||||||
|
|
||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
setAddress( null );
|
mAddress = null;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
mAddressAlias = null;
|
||||||
setAddressAlias( null );
|
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.ltrnet;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class LTRNetDecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel("LTR-Net");
|
|
||||||
private JLabel mTalkgroup = new JLabel();
|
|
||||||
private JLabel mTalkgroupAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mLCN = new JLabel("LCN:");
|
|
||||||
private JLabel mDescription = new JLabel();
|
|
||||||
|
|
||||||
public LTRNetDecoderPanel(IconManager iconManager, SettingsManager settingsManager, LTRNetDecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mTalkgroup.setFont(mFontDecoder);
|
|
||||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mTalkgroupAlias.setFont(mFontDecoder);
|
|
||||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mLCN.setFont(mFontDecoder);
|
|
||||||
mLCN.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mDescription.setFont(mFontDecoder);
|
|
||||||
mDescription.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mTalkgroup);
|
|
||||||
add(mTalkgroupAlias, "wrap");
|
|
||||||
|
|
||||||
add(mLCN);
|
|
||||||
add(mDescription, "span");
|
|
||||||
}
|
|
||||||
|
|
||||||
public LTRNetDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (LTRNetDecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
LTRNetDecoderState state = getDecoderState();
|
|
||||||
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
mTalkgroup.setText(state.getToTalkgroup());
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias tgAlias = state.getToTalkgroupAlias();
|
|
||||||
setAliasLabel(mTalkgroupAlias, tgAlias);
|
|
||||||
break;
|
|
||||||
case DESCRIPTION:
|
|
||||||
mDescription.setText(state.getDescription());
|
|
||||||
break;
|
|
||||||
case CHANNEL_NUMBER:
|
|
||||||
mLCN.setText("LCN: " + state.getChannelNumber());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
if(mProtocol != null)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mTalkgroup != null)
|
|
||||||
{
|
|
||||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mTalkgroupAlias != null)
|
|
||||||
{
|
|
||||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mLCN != null)
|
|
||||||
{
|
|
||||||
mLCN.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mDescription != null)
|
|
||||||
{
|
|
||||||
mDescription.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,30 +17,28 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.ltrnet;
|
package module.decode.ltrnet;
|
||||||
|
|
||||||
|
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 module.decode.event.CallEvent;
|
||||||
|
import module.decode.event.CallEvent.CallEventType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import util.StringUtils;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import module.decode.event.CallEvent;
|
|
||||||
import module.decode.event.CallEvent.CallEventType;
|
|
||||||
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;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
|
|
||||||
public class LTRNetDecoderState extends DecoderState
|
public class LTRNetDecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(LTRNetDecoderState.class);
|
private final static Logger mLog = LoggerFactory.getLogger(LTRNetDecoderState.class);
|
||||||
@@ -53,15 +51,18 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
private TreeSet<Integer> mUniqueIDs = new TreeSet<Integer>();
|
private TreeSet<Integer> mUniqueIDs = new TreeSet<Integer>();
|
||||||
private TreeSet<String> mNeighborIDs = new TreeSet<String>();
|
private TreeSet<String> mNeighborIDs = new TreeSet<String>();
|
||||||
private TreeSet<String> mSiteIDs = new TreeSet<String>();
|
private TreeSet<String> mSiteIDs = new TreeSet<String>();
|
||||||
private HashMap<Integer, Long> mReceiveFrequencies =
|
private HashMap<Integer,Long> mReceiveFrequencies =
|
||||||
new HashMap<Integer, Long>();
|
new HashMap<Integer,Long>();
|
||||||
private HashMap<Integer, Long> mTransmitFrequencies =
|
private HashMap<Integer,Long> mTransmitFrequencies =
|
||||||
new HashMap<Integer, Long>();
|
new HashMap<Integer,Long>();
|
||||||
private HashMap<Integer, String> mActiveCalls = new HashMap<Integer, String>();
|
private HashMap<Integer,String> mActiveCalls = new HashMap<Integer,String>();
|
||||||
|
|
||||||
private String mTalkgroup;
|
private String mToTalkgroup;
|
||||||
private Alias mTalkgroupAlias;
|
private Alias mToTalkgroupAlias;
|
||||||
private String mDescription;
|
private String mFromTalkgroup;
|
||||||
|
private Alias mFromTalkgroupAlias;
|
||||||
|
private String mMessage;
|
||||||
|
private String mMessageType;
|
||||||
private int mChannelNumber;
|
private int mChannelNumber;
|
||||||
private long mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
|
|
||||||
@@ -79,27 +80,26 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public void receive(Message message)
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if (message.isValid())
|
if(message.isValid())
|
||||||
{
|
{
|
||||||
State state = State.IDLE;
|
State state = State.IDLE;
|
||||||
|
|
||||||
if (message instanceof LTRNetOSWMessage)
|
if(message instanceof LTRNetOSWMessage)
|
||||||
{
|
{
|
||||||
LTRNetOSWMessage ltr = (LTRNetOSWMessage) message;
|
LTRNetOSWMessage ltr = (LTRNetOSWMessage) message;
|
||||||
|
|
||||||
switch (ltr.getMessageType())
|
switch(ltr.getMessageType())
|
||||||
{
|
{
|
||||||
case CA_ENDD:
|
case CA_ENDD:
|
||||||
if (mChannelNumber == 0)
|
if(mChannelNumber == 0)
|
||||||
{
|
{
|
||||||
mChannelNumber = ltr.getChannel();
|
setChannelNumber(ltr.getChannel());
|
||||||
broadcast(Attribute.CHANNEL_NUMBER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process FCC Station ID Events */
|
/* Process FCC Station ID Events */
|
||||||
if (ltr.getGroup() == 254)
|
if(ltr.getGroup() == 254)
|
||||||
{
|
{
|
||||||
if (mCurrentCallEvent == null ||
|
if(mCurrentCallEvent == null ||
|
||||||
mCurrentCallEvent.getCallEventType() !=
|
mCurrentCallEvent.getCallEventType() !=
|
||||||
CallEventType.STATION_ID)
|
CallEventType.STATION_ID)
|
||||||
{
|
{
|
||||||
@@ -113,13 +113,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
broadcast(mCurrentCallEvent);
|
broadcast(mCurrentCallEvent);
|
||||||
|
|
||||||
broadcast(new DecoderStateEvent(this,
|
broadcast(new DecoderStateEvent(this, Event.START, State.DATA));
|
||||||
Event.START, State.DATA));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
broadcast(new DecoderStateEvent(this,
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.DATA));
|
||||||
Event.CONTINUATION, State.DATA));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -128,15 +126,14 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CA_STRT:
|
case CA_STRT:
|
||||||
if (mChannelNumber == 0)
|
if(mChannelNumber == 0)
|
||||||
{
|
{
|
||||||
mChannelNumber = ltr.getChannel();
|
setChannelNumber(ltr.getChannel());
|
||||||
broadcast(Attribute.CHANNEL_NUMBER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the call event channel matches our current channel
|
/* If the call event channel matches our current channel
|
||||||
* then it's a call, otherwise it's a call detect. */
|
* then it's a call, otherwise it's a call detect. */
|
||||||
if (ltr.getChannel() == mChannelNumber)
|
if(ltr.getChannel() == mChannelNumber)
|
||||||
{
|
{
|
||||||
processCallMessage(ltr);
|
processCallMessage(ltr);
|
||||||
}
|
}
|
||||||
@@ -147,10 +144,9 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case SY_IDLE:
|
case SY_IDLE:
|
||||||
if (mChannelNumber != ltr.getChannel())
|
if(mChannelNumber != ltr.getChannel())
|
||||||
{
|
{
|
||||||
mChannelNumber = ltr.getChannel();
|
setChannelNumber(ltr.getChannel());
|
||||||
broadcast(Attribute.CHANNEL_NUMBER);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MA_CHNH:
|
case MA_CHNH:
|
||||||
@@ -159,24 +155,22 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
break;
|
break;
|
||||||
case FQ_RXHI:
|
case FQ_RXHI:
|
||||||
case FQ_RXLO:
|
case FQ_RXLO:
|
||||||
if (ltr.getFrequency() > 0)
|
if(ltr.getFrequency() > 0)
|
||||||
{
|
{
|
||||||
mReceiveFrequencies.put(ltr.getHomeRepeater(),
|
mReceiveFrequencies.put(ltr.getHomeRepeater(), ltr.getFrequency());
|
||||||
ltr.getFrequency());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FQ_TXHI:
|
case FQ_TXHI:
|
||||||
case FQ_TXLO:
|
case FQ_TXLO:
|
||||||
if (ltr.getFrequency() > 0)
|
if(ltr.getFrequency() > 0)
|
||||||
{
|
{
|
||||||
mTransmitFrequencies.put(ltr.getHomeRepeater(),
|
mTransmitFrequencies.put(ltr.getHomeRepeater(), ltr.getFrequency());
|
||||||
ltr.getFrequency());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_NBOR:
|
case ID_NBOR:
|
||||||
String neighborID = ltr.getNeighborID();
|
String neighborID = ltr.getNeighborID();
|
||||||
|
|
||||||
if (neighborID != null)
|
if(neighborID != null)
|
||||||
{
|
{
|
||||||
mNeighborIDs.add(neighborID);
|
mNeighborIDs.add(neighborID);
|
||||||
}
|
}
|
||||||
@@ -186,12 +180,12 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
int uniqueID = ltr.getRadioUniqueID();
|
int uniqueID = ltr.getRadioUniqueID();
|
||||||
|
|
||||||
if (uniqueID != LTRNetOSWMessage.INT_NULL_VALUE)
|
if(uniqueID != LTRNetOSWMessage.INT_NULL_VALUE)
|
||||||
{
|
{
|
||||||
mUniqueIDs.add(uniqueID);
|
mUniqueIDs.add(uniqueID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCurrentLTRCallEvent() == null)
|
if(getCurrentLTRCallEvent() == null)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||||
DecoderType.LTR_NET, CallEventType.REGISTER)
|
DecoderType.LTR_NET, CallEventType.REGISTER)
|
||||||
@@ -210,16 +204,13 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
broadcast(mCurrentCallEvent);
|
broadcast(mCurrentCallEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTalkgroup = String.valueOf(uniqueID);
|
setFromTalkgroup(String.valueOf(uniqueID));
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
setFromTalkgroupAlias(ltr.getRadioUniqueIDAlias());
|
||||||
|
|
||||||
mTalkgroupAlias = ltr.getRadioUniqueIDAlias();
|
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
break;
|
break;
|
||||||
case ID_SITE:
|
case ID_SITE:
|
||||||
String siteID = ltr.getSiteID();
|
String siteID = ltr.getSiteID();
|
||||||
|
|
||||||
if (siteID != null)
|
if(siteID != null)
|
||||||
{
|
{
|
||||||
mSiteIDs.add(siteID);
|
mSiteIDs.add(siteID);
|
||||||
}
|
}
|
||||||
@@ -228,11 +219,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (message instanceof LTRNetISWMessage)
|
else if(message instanceof LTRNetISWMessage)
|
||||||
{
|
{
|
||||||
LTRNetISWMessage ltr = ((LTRNetISWMessage) message);
|
LTRNetISWMessage ltr = ((LTRNetISWMessage) message);
|
||||||
|
|
||||||
switch (ltr.getMessageType())
|
switch(ltr.getMessageType())
|
||||||
{
|
{
|
||||||
case CA_STRT:
|
case CA_STRT:
|
||||||
processCallMessage(ltr);
|
processCallMessage(ltr);
|
||||||
@@ -246,23 +237,18 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
String esn = ltr.getESN();
|
String esn = ltr.getESN();
|
||||||
|
|
||||||
if (!esn.contains("xxxx"))
|
if(!esn.contains("xxxx"))
|
||||||
{
|
{
|
||||||
mESNs.add(ltr.getESN());
|
mESNs.add(ltr.getESN());
|
||||||
}
|
}
|
||||||
|
|
||||||
mDescription = "ESN";
|
setMessageType("ESN");
|
||||||
broadcast(Attribute.DESCRIPTION);
|
setFromTalkgroup(ltr.getESN());
|
||||||
|
setFromTalkgroupAlias(ltr.getESNAlias());
|
||||||
mTalkgroup = ltr.getESN();
|
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
mTalkgroupAlias = ltr.getESNAlias();
|
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||||
|
|
||||||
if (mCurrentCallEvent == null)
|
if(mCurrentCallEvent == null)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||||
DecoderType.LTR_NET, CallEventType.REGISTER_ESN)
|
DecoderType.LTR_NET, CallEventType.REGISTER_ESN)
|
||||||
@@ -281,20 +267,15 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
int uniqueid = ltr.getRadioUniqueID();
|
int uniqueid = ltr.getRadioUniqueID();
|
||||||
|
|
||||||
if (uniqueid != LTRNetISWMessage.INT_NULL_VALUE)
|
if(uniqueid != LTRNetISWMessage.INT_NULL_VALUE)
|
||||||
{
|
{
|
||||||
mUniqueIDs.add(uniqueid);
|
mUniqueIDs.add(uniqueid);
|
||||||
|
|
||||||
mDescription = "REGISTER UID";
|
setMessageType("REGISTER UID");
|
||||||
broadcast(Attribute.DESCRIPTION);
|
setToTalkgroup(String.valueOf(uniqueid));
|
||||||
|
setToTalkgroupAlias(ltr.getRadioUniqueIDAlias());
|
||||||
|
|
||||||
mTalkgroup = String.valueOf(uniqueid);
|
if(getCurrentLTRCallEvent() == null)
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
mTalkgroupAlias = ltr.getRadioUniqueIDAlias();
|
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
if (getCurrentLTRCallEvent() == null)
|
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||||
DecoderType.LTR_NET, CallEventType.REGISTER)
|
DecoderType.LTR_NET, CallEventType.REGISTER)
|
||||||
@@ -323,7 +304,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
public LTRCallEvent getCurrentLTRCallEvent()
|
public LTRCallEvent getCurrentLTRCallEvent()
|
||||||
{
|
{
|
||||||
if (mCurrentCallEvent != null)
|
if(mCurrentCallEvent != null)
|
||||||
{
|
{
|
||||||
return (LTRCallEvent) mCurrentCallEvent;
|
return (LTRCallEvent) mCurrentCallEvent;
|
||||||
}
|
}
|
||||||
@@ -339,7 +320,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append("Activity Summary\n");
|
sb.append("Activity Summary\n");
|
||||||
sb.append("Decoder:\tLTR-Net\n\n");
|
sb.append("Decoder:\tLTR-Net\n\n");
|
||||||
|
|
||||||
if (mSiteIDs.isEmpty())
|
if(mSiteIDs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append("Site:\tUnknown\n");
|
sb.append("Site:\tUnknown\n");
|
||||||
}
|
}
|
||||||
@@ -347,7 +328,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
Iterator<String> it = mSiteIDs.iterator();
|
Iterator<String> it = mSiteIDs.iterator();
|
||||||
|
|
||||||
while (it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
sb.append("Site:\t");
|
sb.append("Site:\t");
|
||||||
|
|
||||||
@@ -355,11 +336,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
sb.append(siteID);
|
sb.append(siteID);
|
||||||
|
|
||||||
if (hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias siteAlias = getAliasList().getSiteID(String.valueOf(siteID));
|
Alias siteAlias = getAliasList().getSiteID(String.valueOf(siteID));
|
||||||
|
|
||||||
if (siteAlias != null)
|
if(siteAlias != null)
|
||||||
{
|
{
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(siteAlias.getName());
|
sb.append(siteAlias.getName());
|
||||||
@@ -372,31 +353,31 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
sb.append("\nLCNs (transmit | receive)\n");
|
sb.append("\nLCNs (transmit | receive)\n");
|
||||||
|
|
||||||
if (mReceiveFrequencies.isEmpty() && mTransmitFrequencies.isEmpty())
|
if(mReceiveFrequencies.isEmpty() && mTransmitFrequencies.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int x = 1; x < 21; x++)
|
for(int x = 1; x < 21; x++)
|
||||||
{
|
{
|
||||||
long rcv = 0;
|
long rcv = 0;
|
||||||
|
|
||||||
if (mReceiveFrequencies.containsKey(x))
|
if(mReceiveFrequencies.containsKey(x))
|
||||||
{
|
{
|
||||||
rcv = mReceiveFrequencies.get(x);
|
rcv = mReceiveFrequencies.get(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long xmt = 0;
|
long xmt = 0;
|
||||||
|
|
||||||
if (mTransmitFrequencies.containsKey(x))
|
if(mTransmitFrequencies.containsKey(x))
|
||||||
{
|
{
|
||||||
xmt = mTransmitFrequencies.get(x);
|
xmt = mTransmitFrequencies.get(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcv > 0 || xmt > 0)
|
if(rcv > 0 || xmt > 0)
|
||||||
{
|
{
|
||||||
if (x < 10)
|
if(x < 10)
|
||||||
{
|
{
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
@@ -404,7 +385,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append(x);
|
sb.append(x);
|
||||||
sb.append(": ");
|
sb.append(": ");
|
||||||
|
|
||||||
if (xmt == 0)
|
if(xmt == 0)
|
||||||
{
|
{
|
||||||
sb.append("---.-----");
|
sb.append("---.-----");
|
||||||
}
|
}
|
||||||
@@ -414,7 +395,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
sb.append(" | ");
|
sb.append(" | ");
|
||||||
|
|
||||||
if (rcv == 0)
|
if(rcv == 0)
|
||||||
{
|
{
|
||||||
sb.append("---.-----");
|
sb.append("---.-----");
|
||||||
}
|
}
|
||||||
@@ -423,7 +404,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append(mDecimalFormatter.format((double) rcv / 1E6d));
|
sb.append(mDecimalFormatter.format((double) rcv / 1E6d));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x == mChannelNumber)
|
if(x == mChannelNumber)
|
||||||
{
|
{
|
||||||
sb.append(" **");
|
sb.append(" **");
|
||||||
}
|
}
|
||||||
@@ -435,7 +416,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
sb.append("\nTalkgroups\n");
|
sb.append("\nTalkgroups\n");
|
||||||
|
|
||||||
if (mTalkgroups.isEmpty())
|
if(mTalkgroups.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
@@ -443,7 +424,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
Iterator<String> it = mTalkgroups.iterator();
|
Iterator<String> it = mTalkgroups.iterator();
|
||||||
|
|
||||||
while (it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String tgid = it.next();
|
String tgid = it.next();
|
||||||
|
|
||||||
@@ -451,11 +432,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append(tgid);
|
sb.append(tgid);
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
|
|
||||||
if (hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getTalkgroupAlias(tgid);
|
Alias alias = getAliasList().getTalkgroupAlias(tgid);
|
||||||
|
|
||||||
if (alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append(alias.getName());
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
@@ -467,7 +448,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
sb.append("\nRadio Unique IDs\n");
|
sb.append("\nRadio Unique IDs\n");
|
||||||
|
|
||||||
if (mUniqueIDs.isEmpty())
|
if(mUniqueIDs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
@@ -475,7 +456,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
Iterator<Integer> it = mUniqueIDs.iterator();
|
Iterator<Integer> it = mUniqueIDs.iterator();
|
||||||
|
|
||||||
while (it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
int uid = it.next();
|
int uid = it.next();
|
||||||
|
|
||||||
@@ -483,11 +464,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append(uid);
|
sb.append(uid);
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
|
|
||||||
if (hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getUniqueID(uid);
|
Alias alias = getAliasList().getUniqueID(uid);
|
||||||
|
|
||||||
if (alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append(alias.getName());
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
@@ -499,7 +480,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
sb.append("\nESNs\n");
|
sb.append("\nESNs\n");
|
||||||
|
|
||||||
if (mESNs.isEmpty())
|
if(mESNs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
@@ -507,7 +488,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
Iterator<String> it = mESNs.iterator();
|
Iterator<String> it = mESNs.iterator();
|
||||||
|
|
||||||
while (it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String esn = it.next();
|
String esn = it.next();
|
||||||
|
|
||||||
@@ -515,11 +496,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append(esn);
|
sb.append(esn);
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
|
|
||||||
if (hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getESNAlias(esn);
|
Alias alias = getAliasList().getESNAlias(esn);
|
||||||
|
|
||||||
if (alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append(alias.getName());
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
@@ -531,7 +512,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
sb.append("\nNeighbor Sites\n");
|
sb.append("\nNeighbor Sites\n");
|
||||||
|
|
||||||
if (mNeighborIDs.isEmpty())
|
if(mNeighborIDs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
@@ -539,7 +520,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
Iterator<String> it = mNeighborIDs.iterator();
|
Iterator<String> it = mNeighborIDs.iterator();
|
||||||
|
|
||||||
while (it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String neighbor = it.next();
|
String neighbor = it.next();
|
||||||
|
|
||||||
@@ -547,11 +528,11 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
sb.append(neighbor);
|
sb.append(neighbor);
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
|
|
||||||
if (hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getSiteID(String.valueOf(neighbor));
|
Alias alias = getAliasList().getSiteID(String.valueOf(neighbor));
|
||||||
|
|
||||||
if (alias != null)
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append(alias.getName());
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
@@ -569,7 +550,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
*/
|
*/
|
||||||
private void processCallDetectMessage(LTRNetMessage message)
|
private void processCallDetectMessage(LTRNetMessage message)
|
||||||
{
|
{
|
||||||
if (!mActiveCalls.containsKey(message.getChannel()) ||
|
if(!mActiveCalls.containsKey(message.getChannel()) ||
|
||||||
!mActiveCalls.get(message.getChannel()).contentEquals(message.getTalkgroupID()))
|
!mActiveCalls.get(message.getChannel()).contentEquals(message.getTalkgroupID()))
|
||||||
{
|
{
|
||||||
mActiveCalls.put(message.getChannel(), message.getTalkgroupID());
|
mActiveCalls.put(message.getChannel(), message.getTalkgroupID());
|
||||||
@@ -578,7 +559,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
long frequency = 0;
|
long frequency = 0;
|
||||||
|
|
||||||
if (mTransmitFrequencies.containsKey(channel))
|
if(mTransmitFrequencies.containsKey(channel))
|
||||||
{
|
{
|
||||||
frequency = mTransmitFrequencies.get(channel);
|
frequency = mTransmitFrequencies.get(channel);
|
||||||
}
|
}
|
||||||
@@ -616,49 +597,46 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
int group = message.getGroup();
|
int group = message.getGroup();
|
||||||
|
|
||||||
/* Process call registration */
|
/* Process call registration */
|
||||||
if (group == 253)
|
if(group == 253)
|
||||||
{
|
{
|
||||||
|
setMessageType("REGISTER");
|
||||||
broadcast(new DecoderStateEvent(this, Event.START, State.DATA));
|
broadcast(new DecoderStateEvent(this, Event.START, State.DATA));
|
||||||
mDescription = "REGISTER";
|
|
||||||
broadcast(Attribute.DESCRIPTION);
|
|
||||||
}
|
}
|
||||||
/* Process call */
|
/* Process call */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String talkgroup = message.getTalkgroupID();
|
String talkgroup = message.getTalkgroupID();
|
||||||
|
|
||||||
if (isValidTalkgroup(talkgroup))
|
if(isValidTalkgroup(talkgroup))
|
||||||
{
|
{
|
||||||
final LTRCallEvent current = getCurrentLTRCallEvent();
|
final LTRCallEvent current = getCurrentLTRCallEvent();
|
||||||
|
|
||||||
/* If this is a new call or the talkgroup is different from the current
|
/* If this is a new call or the talkgroup is different from the current
|
||||||
* call, create a new call event */
|
* call, create a new call event */
|
||||||
if (current == null || isDifferentTalkgroup(talkgroup))
|
if(current == null || isDifferentTalkgroup(talkgroup))
|
||||||
{
|
{
|
||||||
/* Invalidate the current call */
|
/* Invalidate the current call */
|
||||||
if (current != null)
|
if(current != null)
|
||||||
{
|
{
|
||||||
current.setValid(false);
|
current.setValid(false);
|
||||||
broadcast(current);
|
broadcast(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTalkgroup = message.getTalkgroupID();
|
setToTalkgroup(message.getTalkgroupID());
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
/* A talkgroup must be seen at least once before it will be added
|
/* A talkgroup must be seen at least once before it will be added
|
||||||
* to the mTalkgroups list that is used in the activity summary,
|
* to the mTalkgroups list that is used in the activity summary,
|
||||||
* so that we don't pollute the summary with one-off error talkgroups */
|
* so that we don't pollute the summary with one-off error talkgroups */
|
||||||
if (mTalkgroupsFirstHeard.contains(mTalkgroup))
|
if(mTalkgroupsFirstHeard.contains(mToTalkgroup))
|
||||||
{
|
{
|
||||||
mTalkgroups.add(mTalkgroup);
|
mTalkgroups.add(mToTalkgroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTalkgroupsFirstHeard.add(mTalkgroup);
|
mTalkgroupsFirstHeard.add(mToTalkgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTalkgroupAlias = message.getTalkgroupIDAlias();
|
setToTalkgroupAlias(message.getTalkgroupIDAlias());
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
CallEvent callEvent = new LTRCallEvent.Builder(DecoderType.LTR_NET, CallEventType.CALL)
|
CallEvent callEvent = new LTRCallEvent.Builder(DecoderType.LTR_NET, CallEventType.CALL)
|
||||||
.aliasList(getAliasList())
|
.aliasList(getAliasList())
|
||||||
@@ -671,8 +649,6 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
mCurrentCallEvent = callEvent;
|
mCurrentCallEvent = callEvent;
|
||||||
|
|
||||||
broadcast(new Metadata(MetadataType.TO, mTalkgroup, mTalkgroupAlias, true));
|
|
||||||
|
|
||||||
broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
|
broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,7 +659,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
private void processCallEndMessage(LTRNetMessage message)
|
private void processCallEndMessage(LTRNetMessage message)
|
||||||
{
|
{
|
||||||
if (mCurrentCallEvent != null &&
|
if(mCurrentCallEvent != null &&
|
||||||
mCurrentCallEvent.getCallEventType() == CallEventType.CALL)
|
mCurrentCallEvent.getCallEventType() == CallEventType.CALL)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.setEnd(System.currentTimeMillis());
|
mCurrentCallEvent.setEnd(System.currentTimeMillis());
|
||||||
@@ -719,7 +695,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
*/
|
*/
|
||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
if (mCurrentCallEvent != null && mCurrentCallEvent
|
if(mCurrentCallEvent != null && mCurrentCallEvent
|
||||||
.getCallEventType() == CallEventType.CALL)
|
.getCallEventType() == CallEventType.CALL)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.end();
|
mCurrentCallEvent.end();
|
||||||
@@ -728,29 +704,97 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
|
|
||||||
mTalkgroup = null;
|
mToTalkgroup = null;
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
mTalkgroupAlias = null;
|
mToTalkgroupAlias = null;
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
mDescription = null;
|
mMessageType = null;
|
||||||
broadcast(Attribute.DESCRIPTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToTalkgroup()
|
public String getToTalkgroup()
|
||||||
{
|
{
|
||||||
return mTalkgroup;
|
return mToTalkgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToTalkgroup(String toTalkgroup)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mToTalkgroup, toTalkgroup))
|
||||||
|
{
|
||||||
|
mToTalkgroup = toTalkgroup;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToTalkgroupAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getToTalkgroupAlias()
|
public Alias getToTalkgroupAlias()
|
||||||
{
|
{
|
||||||
return mTalkgroupAlias;
|
return mToTalkgroupAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public void setToTalkgroupAlias(Alias alias)
|
||||||
{
|
{
|
||||||
return mDescription;
|
if(mToTalkgroupAlias == null || (alias != null && mToTalkgroupAlias != alias))
|
||||||
|
{
|
||||||
|
mToTalkgroupAlias = alias;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToTalkgroupAlias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromTalkgroup()
|
||||||
|
{
|
||||||
|
return mFromTalkgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromTalkgroup(String fromTalkgroup)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mFromTalkgroup, fromTalkgroup))
|
||||||
|
{
|
||||||
|
mFromTalkgroup = fromTalkgroup;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||||
|
mFromTalkgroupAlias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Alias getFromTalkgroupAlias()
|
||||||
|
{
|
||||||
|
return mFromTalkgroupAlias;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromTalkgroupAlias(Alias alias)
|
||||||
|
{
|
||||||
|
if(mFromTalkgroupAlias == null || (alias != null && alias != mFromTalkgroupAlias))
|
||||||
|
{
|
||||||
|
mFromTalkgroupAlias = alias;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||||
|
mFromTalkgroupAlias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage()
|
||||||
|
{
|
||||||
|
return mMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessage, message))
|
||||||
|
{
|
||||||
|
mMessage = message;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, mMessageType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessageType()
|
||||||
|
{
|
||||||
|
return mMessageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMessageType(String messageType)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessageType, messageType))
|
||||||
|
{
|
||||||
|
mMessageType = messageType;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, mMessageType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasChannelNumber()
|
public boolean hasChannelNumber()
|
||||||
@@ -763,6 +807,16 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
return mChannelNumber;
|
return mChannelNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setChannelNumber(int channelNumber)
|
||||||
|
{
|
||||||
|
if(mChannelNumber != channelNumber)
|
||||||
|
{
|
||||||
|
mChannelNumber = channelNumber;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL,
|
||||||
|
"LCN:" + getChannelNumber()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
@@ -772,7 +826,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
switch (event.getEvent())
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case RESET:
|
case RESET:
|
||||||
resetState();
|
resetState();
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.ltrstandard;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class LTRStandardDecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel("LTR Standard");
|
|
||||||
private JLabel mTalkgroup = new JLabel();
|
|
||||||
private JLabel mTalkgroupAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mLCN = new JLabel("LCN:");
|
|
||||||
|
|
||||||
public LTRStandardDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
|
||||||
LTRStandardDecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mTalkgroup.setFont(mFontDecoder);
|
|
||||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mTalkgroupAlias.setFont(mFontDecoder);
|
|
||||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mLCN.setFont(mFontDecoder);
|
|
||||||
mLCN.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mTalkgroup);
|
|
||||||
add(mTalkgroupAlias, "wrap");
|
|
||||||
|
|
||||||
add(mLCN, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
public LTRStandardDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (LTRStandardDecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
LTRStandardDecoderState state = getDecoderState();
|
|
||||||
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case CHANNEL_NUMBER:
|
|
||||||
if(state.getChannelNumber() != 0)
|
|
||||||
{
|
|
||||||
mLCN.setText("LCN: " + state.getChannelNumber());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
mTalkgroup.setText(state.getTalkgroup());
|
|
||||||
/* fall-through */
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias alias = state.getTalkgroupAlias();
|
|
||||||
|
|
||||||
if(alias != null)
|
|
||||||
{
|
|
||||||
mTalkgroupAlias.setText(alias.getName());
|
|
||||||
mTalkgroupAlias.setIcon(mIconManager.getIcon(alias.getIconName(),
|
|
||||||
IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTalkgroupAlias.setText(null);
|
|
||||||
mTalkgroupAlias.setIcon(null);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
if(mProtocol != null)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mTalkgroup != null)
|
|
||||||
{
|
|
||||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mTalkgroupAlias != null)
|
|
||||||
{
|
|
||||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mLCN != null)
|
|
||||||
{
|
|
||||||
mLCN.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,30 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.ltrstandard;
|
package module.decode.ltrstandard;
|
||||||
|
|
||||||
|
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 module.decode.event.CallEvent.CallEventType;
|
||||||
|
import module.decode.ltrnet.LTRCallEvent;
|
||||||
|
import module.decode.ltrstandard.message.CallEndMessage;
|
||||||
|
import module.decode.ltrstandard.message.CallMessage;
|
||||||
|
import module.decode.ltrstandard.message.IdleMessage;
|
||||||
|
import module.decode.ltrstandard.message.LTRStandardMessage;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -26,32 +47,10 @@ import java.util.Set;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import module.decode.event.CallEvent.CallEventType;
|
|
||||||
import module.decode.ltrnet.LTRCallEvent;
|
|
||||||
import module.decode.ltrstandard.message.CallEndMessage;
|
|
||||||
import module.decode.ltrstandard.message.CallMessage;
|
|
||||||
import module.decode.ltrstandard.message.IdleMessage;
|
|
||||||
import module.decode.ltrstandard.message.LTRStandardMessage;
|
|
||||||
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;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
|
|
||||||
public class LTRStandardDecoderState extends DecoderState
|
public class LTRStandardDecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( LTRStandardDecoderState.class );
|
LoggerFactory.getLogger(LTRStandardDecoderState.class);
|
||||||
|
|
||||||
private Map<Integer,LTRCallEvent> mActiveCalls = new HashMap<>();
|
private Map<Integer,LTRCallEvent> mActiveCalls = new HashMap<>();
|
||||||
private Set<String> mTalkgroupsFirstHeard = new HashSet<>();
|
private Set<String> mTalkgroupsFirstHeard = new HashSet<>();
|
||||||
@@ -62,9 +61,9 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
private long mFrequency;
|
private long mFrequency;
|
||||||
private LCNTracker mLCNTracker = new LCNTracker();
|
private LCNTracker mLCNTracker = new LCNTracker();
|
||||||
|
|
||||||
public LTRStandardDecoderState( AliasList aliasList )
|
public LTRStandardDecoderState(AliasList aliasList)
|
||||||
{
|
{
|
||||||
super( aliasList );
|
super(aliasList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,7 +73,7 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
@@ -86,108 +85,99 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if( message.isValid() && message instanceof LTRStandardMessage )
|
if(message.isValid() && message instanceof LTRStandardMessage)
|
||||||
{
|
{
|
||||||
switch( ((LTRStandardMessage)message).getMessageType() )
|
switch(((LTRStandardMessage) message).getMessageType())
|
||||||
{
|
{
|
||||||
case CA_STRT:
|
case CA_STRT:
|
||||||
CallMessage start = (CallMessage)message;
|
CallMessage start = (CallMessage) message;
|
||||||
|
|
||||||
int channel = start.getChannel();
|
int channel = start.getChannel();
|
||||||
|
|
||||||
mLCNTracker.processCallChannel( channel );
|
setChannelNumber(channel);
|
||||||
|
|
||||||
mLCNTracker.processFreeChannel( start.getFree() );
|
mLCNTracker.processFreeChannel(start.getFree());
|
||||||
|
|
||||||
//Only process calls on this LCN, or call detects for
|
//Only process calls on this LCN, or call detects for
|
||||||
//talkgroups that are homed on this LCN
|
//talkgroups that are homed on this LCN
|
||||||
if( mLCNTracker.isValidChannel( channel ) &&
|
if(mLCNTracker.isValidChannel(channel) &&
|
||||||
( mLCNTracker.isCurrentChannel( channel ) ||
|
(mLCNTracker.isCurrentChannel(channel) ||
|
||||||
mLCNTracker.isCurrentChannel( start.getHomeRepeater() ) ) )
|
mLCNTracker.isCurrentChannel(start.getHomeRepeater())))
|
||||||
{
|
{
|
||||||
LTRCallEvent event = mActiveCalls.get( channel );
|
LTRCallEvent event = mActiveCalls.get(channel);
|
||||||
|
|
||||||
if( event == null ||
|
if(event == null || !event.isMatchingTalkgroup(start.getToID()))
|
||||||
!event.isMatchingTalkgroup( start.getToID() ) )
|
|
||||||
{
|
{
|
||||||
//Check for different talkgroup
|
//Check for different talkgroup
|
||||||
if( event != null )
|
if(event != null)
|
||||||
{
|
{
|
||||||
event.end();
|
event.end();
|
||||||
mActiveCalls.remove( channel );
|
mActiveCalls.remove(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean current = mLCNTracker.isCurrentChannel( channel );
|
boolean current = mLCNTracker.isCurrentChannel(channel);
|
||||||
|
|
||||||
event = new LTRCallEvent.Builder(
|
event = new LTRCallEvent.Builder(
|
||||||
DecoderType.LTR_STANDARD,
|
DecoderType.LTR_STANDARD,
|
||||||
current ? CallEventType.CALL : CallEventType.CALL_DETECT )
|
current ? CallEventType.CALL : CallEventType.CALL_DETECT)
|
||||||
.to( start.getToID() )
|
.to(start.getToID())
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( start.getChannelFormatted() )
|
.channel(start.getChannelFormatted())
|
||||||
.frequency( current ? mFrequency : 0 )
|
.frequency(current ? mFrequency : 0)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
mActiveCalls.put( channel, event );
|
mActiveCalls.put(channel, event);
|
||||||
|
|
||||||
broadcast( event );
|
broadcast(event);
|
||||||
|
|
||||||
if( mLCNTracker.isCurrentChannel( channel ) )
|
if(mLCNTracker.isCurrentChannel(channel))
|
||||||
{
|
{
|
||||||
mTalkgroup = start.getToID();
|
setTalkgroup(start.getToID());
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
|
||||||
|
|
||||||
processTalkgroup( mTalkgroup );
|
processTalkgroup(mTalkgroup);
|
||||||
|
|
||||||
mTalkgroupAlias = start.getToIDAlias();
|
setTalkgroupAlias(start.getToIDAlias());
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
|
||||||
|
|
||||||
broadcast( new Metadata( MetadataType.TO,
|
|
||||||
mTalkgroup, mTalkgroupAlias, true ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this,
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL));
|
||||||
Event.CONTINUATION, State.CALL ) );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CA_ENDD:
|
case CA_ENDD:
|
||||||
CallEndMessage end = (CallEndMessage)message;
|
CallEndMessage end = (CallEndMessage) message;
|
||||||
|
|
||||||
//Home channel is 31 for call end -- use the free channel
|
//Home channel is 31 for call end -- use the free channel
|
||||||
//as the call end channel
|
//as the call end channel
|
||||||
int repeater = end.getFree();
|
int repeater = end.getFree();
|
||||||
|
|
||||||
mLCNTracker.processCallChannel( repeater );
|
setChannelNumber(repeater);
|
||||||
|
|
||||||
if( mLCNTracker.isCurrentChannel( repeater ) )
|
if(mLCNTracker.isCurrentChannel(repeater))
|
||||||
{
|
{
|
||||||
mTalkgroup = end.getToID();
|
setTalkgroup(end.getToID());
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
|
||||||
|
|
||||||
processTalkgroup( mTalkgroup );
|
processTalkgroup(mTalkgroup);
|
||||||
|
|
||||||
mTalkgroupAlias = end.getToIDAlias();
|
setTalkgroupAlias(end.getToIDAlias());
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
|
||||||
|
|
||||||
LTRCallEvent event = mActiveCalls.remove( repeater );
|
LTRCallEvent event = mActiveCalls.remove(repeater);
|
||||||
|
|
||||||
if( event != null )
|
if(event != null)
|
||||||
{
|
{
|
||||||
event.end();
|
event.end();
|
||||||
broadcast( event );
|
broadcast(event);
|
||||||
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
broadcast(new DecoderStateEvent(this, Event.END, State.FADE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SY_IDLE:
|
case SY_IDLE:
|
||||||
IdleMessage idle = (IdleMessage)message;
|
IdleMessage idle = (IdleMessage) message;
|
||||||
|
|
||||||
int lcn = idle.getChannel();
|
int lcn = idle.getChannel();
|
||||||
|
|
||||||
mLCNTracker.processCallChannel( lcn );
|
mLCNTracker.processCallChannel(lcn);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case UN_KNWN:
|
case UN_KNWN:
|
||||||
@@ -197,15 +187,15 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processTalkgroup( String talkgroup )
|
private void processTalkgroup(String talkgroup)
|
||||||
{
|
{
|
||||||
if( mTalkgroupsFirstHeard.contains( talkgroup ) )
|
if(mTalkgroupsFirstHeard.contains(talkgroup))
|
||||||
{
|
{
|
||||||
mTalkgroups.add( talkgroup );
|
mTalkgroups.add(talkgroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTalkgroupsFirstHeard.add( talkgroup );
|
mTalkgroupsFirstHeard.add(talkgroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,25 +217,22 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
*/
|
*/
|
||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
for( Integer key: mActiveCalls.keySet() )
|
for(Integer key : mActiveCalls.keySet())
|
||||||
{
|
{
|
||||||
LTRCallEvent event = mActiveCalls.get( key );
|
LTRCallEvent event = mActiveCalls.get(key);
|
||||||
|
|
||||||
if( event != null )
|
if(event != null)
|
||||||
{
|
{
|
||||||
event.end();
|
event.end();
|
||||||
|
|
||||||
broadcast( event );
|
broadcast(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mActiveCalls.clear();
|
mActiveCalls.clear();
|
||||||
|
|
||||||
mTalkgroup = null;
|
mTalkgroup = null;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
|
||||||
|
|
||||||
mTalkgroupAlias = null;
|
mTalkgroupAlias = null;
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTalkgroup()
|
public String getTalkgroup()
|
||||||
@@ -253,11 +240,29 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
return mTalkgroup;
|
return mTalkgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setTalkgroup(String talkgroup)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mTalkgroup, talkgroup))
|
||||||
|
{
|
||||||
|
mTalkgroup = talkgroup;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mTalkgroup, mTalkgroupAlias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Alias getTalkgroupAlias()
|
public Alias getTalkgroupAlias()
|
||||||
{
|
{
|
||||||
return mTalkgroupAlias;
|
return mTalkgroupAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setTalkgroupAlias(Alias alias)
|
||||||
|
{
|
||||||
|
if(mTalkgroupAlias == null || (alias != null && mTalkgroupAlias != alias))
|
||||||
|
{
|
||||||
|
mTalkgroupAlias = alias;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mTalkgroup, mTalkgroupAlias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasChannelNumber()
|
public boolean hasChannelNumber()
|
||||||
{
|
{
|
||||||
return mLCNTracker.getCurrentChannel() != 0;
|
return mLCNTracker.getCurrentChannel() != 0;
|
||||||
@@ -268,15 +273,28 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
return mLCNTracker.getCurrentChannel();
|
return mLCNTracker.getCurrentChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setChannelNumber(int channel)
|
||||||
|
{
|
||||||
|
int original = mLCNTracker.getCurrentChannel();
|
||||||
|
|
||||||
|
mLCNTracker.processCallChannel(channel);
|
||||||
|
|
||||||
|
if(mLCNTracker.getCurrentChannel() != original)
|
||||||
|
{
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL,
|
||||||
|
"LCN:" + mLCNTracker.getCurrentChannel()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case RESET:
|
case RESET:
|
||||||
resetState();
|
resetState();
|
||||||
@@ -294,62 +312,62 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "Activity Summary\n\n" );
|
sb.append("Activity Summary\n\n");
|
||||||
|
|
||||||
sb.append( "Decoder:\tLTR-Standard\n" );
|
sb.append("Decoder:\tLTR-Standard\n");
|
||||||
|
|
||||||
sb.append( "Monitored LCN: " );
|
sb.append("Monitored LCN: ");
|
||||||
|
|
||||||
if( hasChannelNumber() )
|
if(hasChannelNumber())
|
||||||
{
|
{
|
||||||
sb.append( getChannelNumber() );
|
sb.append(getChannelNumber());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append( "*Insufficient Data*" );
|
sb.append("*Insufficient Data*");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
|
|
||||||
sb.append( "Active LCNs:\t" );
|
sb.append("Active LCNs:\t");
|
||||||
|
|
||||||
List<Integer> lcns = mLCNTracker.getActiveLCNs();
|
List<Integer> lcns = mLCNTracker.getActiveLCNs();
|
||||||
|
|
||||||
if( lcns.size() > 0 )
|
if(lcns.size() > 0)
|
||||||
{
|
{
|
||||||
sb.append( mLCNTracker.getActiveLCNs() );
|
sb.append(mLCNTracker.getActiveLCNs());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append( "*Insufficient Data*" );
|
sb.append("*Insufficient Data*");
|
||||||
}
|
}
|
||||||
sb.append( "\n\n" );
|
sb.append("\n\n");
|
||||||
|
|
||||||
sb.append( "Talkgroups\n" );
|
sb.append("Talkgroups\n");
|
||||||
|
|
||||||
if( mTalkgroups.isEmpty() )
|
if(mTalkgroups.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( String talkgroup: mTalkgroups )
|
for(String talkgroup : mTalkgroups)
|
||||||
{
|
{
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( talkgroup );
|
sb.append(talkgroup);
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getTalkgroupAlias( talkgroup );
|
Alias alias = getAliasList().getTalkgroupAlias(talkgroup);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,33 +397,33 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
|
|
||||||
public void logStatistics()
|
public void logStatistics()
|
||||||
{
|
{
|
||||||
for( int x = 1; x <= 20; x++ )
|
for(int x = 1; x <= 20; x++)
|
||||||
{
|
{
|
||||||
mLog.debug( "Call " + x + ": " + mCallLCNCounts[ x ] );
|
mLog.debug("Call " + x + ": " + mCallLCNCounts[x]);
|
||||||
}
|
}
|
||||||
mLog.debug( "Call Highest Count: " + mCallHighestCount );
|
mLog.debug("Call Highest Count: " + mCallHighestCount);
|
||||||
for( int x = 1; x <= 20; x++ )
|
for(int x = 1; x <= 20; x++)
|
||||||
{
|
{
|
||||||
mLog.debug( "Free " + x + ": " + mFreeLCNCounts[ x ] );
|
mLog.debug("Free " + x + ": " + mFreeLCNCounts[x]);
|
||||||
}
|
}
|
||||||
mLog.debug( "Free Highest Count: " + mFreeHighestCount );
|
mLog.debug("Free Highest Count: " + mFreeHighestCount);
|
||||||
|
|
||||||
mLog.debug( "Current LCN: " + mCurrentLCN );
|
mLog.debug("Current LCN: " + mCurrentLCN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
//Dim channel arrays to 21 -- ignore the 0 index
|
//Dim channel arrays to 21 -- ignore the 0 index
|
||||||
mCallLCNCounts = new int[ 21 ];
|
mCallLCNCounts = new int[21];
|
||||||
mFreeLCNCounts = new int[ 21 ];
|
mFreeLCNCounts = new int[21];
|
||||||
mCallHighestCount = 3;
|
mCallHighestCount = 3;
|
||||||
mFreeHighestCount = DEFAULT_COUNT;
|
mFreeHighestCount = DEFAULT_COUNT;
|
||||||
mCurrentLCN = 0;
|
mCurrentLCN = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCurrentChannel( int channel )
|
public boolean isCurrentChannel(int channel)
|
||||||
{
|
{
|
||||||
if( mCurrentLCN == 0 )
|
if(mCurrentLCN == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -428,45 +446,43 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
* highest free channel count. A channel is also valid when it is
|
* highest free channel count. A channel is also valid when it is
|
||||||
* the currently monitored channel.
|
* the currently monitored channel.
|
||||||
*/
|
*/
|
||||||
public boolean isValidChannel( int channel )
|
public boolean isValidChannel(int channel)
|
||||||
{
|
{
|
||||||
if( isCurrentChannel( channel ) )
|
if(isCurrentChannel(channel))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = mFreeLCNCounts[ channel ];
|
int count = mFreeLCNCounts[channel];
|
||||||
|
|
||||||
int threshold = (int)( (double)mFreeHighestCount * 0.2 );
|
int threshold = (int) ((double) mFreeHighestCount * 0.2);
|
||||||
|
|
||||||
return count >= threshold;
|
return count >= threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processCallChannel( int channel )
|
public void processCallChannel(int channel)
|
||||||
{
|
{
|
||||||
if( 1 <= channel && channel <= 20 )
|
if(1 <= channel && channel <= 20)
|
||||||
{
|
{
|
||||||
mCallLCNCounts[ channel ]++;
|
mCallLCNCounts[channel]++;
|
||||||
|
|
||||||
if( mCallLCNCounts[ channel ] > mCallHighestCount )
|
if(mCallLCNCounts[channel] > mCallHighestCount)
|
||||||
{
|
{
|
||||||
mCallHighestCount = mCallLCNCounts[ channel ];
|
mCallHighestCount = mCallLCNCounts[channel];
|
||||||
mCurrentLCN = channel;
|
mCurrentLCN = channel;
|
||||||
|
|
||||||
broadcast( Attribute.CHANNEL_NUMBER );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processFreeChannel( int channel )
|
public void processFreeChannel(int channel)
|
||||||
{
|
{
|
||||||
if( 1 <= channel && channel <= 20 )
|
if(1 <= channel && channel <= 20)
|
||||||
{
|
{
|
||||||
mFreeLCNCounts[ channel ]++;
|
mFreeLCNCounts[channel]++;
|
||||||
|
|
||||||
if( mFreeLCNCounts[ channel ] > mFreeHighestCount )
|
if(mFreeLCNCounts[channel] > mFreeHighestCount)
|
||||||
{
|
{
|
||||||
mFreeHighestCount = mFreeLCNCounts[ channel ];
|
mFreeHighestCount = mFreeLCNCounts[channel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -475,17 +491,17 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
List<Integer> active = new ArrayList<>();
|
List<Integer> active = new ArrayList<>();
|
||||||
|
|
||||||
if( mFreeHighestCount > DEFAULT_COUNT )
|
if(mFreeHighestCount > DEFAULT_COUNT)
|
||||||
{
|
{
|
||||||
for( int x = 1; x <= 20; x++ )
|
for(int x = 1; x <= 20; x++)
|
||||||
{
|
{
|
||||||
if( mCurrentLCN != 0 && isCurrentChannel( x ) )
|
if(mCurrentLCN != 0 && isCurrentChannel(x))
|
||||||
{
|
{
|
||||||
active.add( x );
|
active.add(x);
|
||||||
}
|
}
|
||||||
else if( isValidChannel( x ) )
|
else if(isValidChannel(x))
|
||||||
{
|
{
|
||||||
active.add( x );
|
active.add(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,183 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.mdc1200;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class MDCDecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private static final String sPROTOCOL = "MDC-1200";
|
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel(" ");
|
|
||||||
private JLabel mFrom = new JLabel();
|
|
||||||
private JLabel mFromAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel(" ");
|
|
||||||
private JLabel mTo = new JLabel();
|
|
||||||
private JLabel mToAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel(sPROTOCOL);
|
|
||||||
private JLabel mMessage = new JLabel();
|
|
||||||
private JLabel mMessageType = new JLabel();
|
|
||||||
|
|
||||||
public MDCDecoderPanel(IconManager iconManager, SettingsManager settingsManager, MDCDecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDCDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (MDCDecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
add(mFromLabel);
|
|
||||||
add(mFrom);
|
|
||||||
add(mFromAlias, "wrap");
|
|
||||||
|
|
||||||
add(mToLabel);
|
|
||||||
add(mTo);
|
|
||||||
add(mToAlias, "wrap");
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mMessageType);
|
|
||||||
add(mMessage, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
String from = getDecoderState().getFrom();
|
|
||||||
|
|
||||||
if(from != null)
|
|
||||||
{
|
|
||||||
mFromLabel.setText("FM:");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromLabel.setText(" ");
|
|
||||||
}
|
|
||||||
mFrom.setText(from);
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
Alias fromAlias = getDecoderState().getFromAlias();
|
|
||||||
|
|
||||||
if(fromAlias != null)
|
|
||||||
{
|
|
||||||
mFromAlias.setText(fromAlias.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromAlias.setText(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String to = getDecoderState().getTo();
|
|
||||||
|
|
||||||
if(to != null)
|
|
||||||
{
|
|
||||||
mToLabel.setText("TO:");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToLabel.setText(" ");
|
|
||||||
}
|
|
||||||
mTo.setText(to);
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias toAlias = getDecoderState().getToAlias();
|
|
||||||
|
|
||||||
if(toAlias != null)
|
|
||||||
{
|
|
||||||
mToAlias.setText(toAlias.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToAlias.setText(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MESSAGE:
|
|
||||||
mMessage.setText(getDecoderState().getMessage());
|
|
||||||
break;
|
|
||||||
case MESSAGE_TYPE:
|
|
||||||
mMessageType.setText(getDecoderState().getMessageType());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting) setting;
|
|
||||||
|
|
||||||
if(color.getColorSettingName() ==
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
|
||||||
{
|
|
||||||
mFromLabel.setForeground(color.getColor());
|
|
||||||
mFrom.setForeground(color.getColor());
|
|
||||||
mFromAlias.setForeground(color.getColor());
|
|
||||||
mToLabel.setForeground(color.getColor());
|
|
||||||
mTo.setForeground(color.getColor());
|
|
||||||
mToAlias.setForeground(color.getColor());
|
|
||||||
mProtocol.setForeground(color.getColor());
|
|
||||||
mMessageType.setForeground(color.getColor());
|
|
||||||
mMessage.setForeground(color.getColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,23 +14,26 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.mdc1200;
|
package module.decode.mdc1200;
|
||||||
|
|
||||||
|
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 util.StringUtils;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
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.State;
|
|
||||||
import channel.state.DecoderStateEvent.Event;
|
|
||||||
import alias.Alias;
|
|
||||||
import alias.AliasList;
|
|
||||||
|
|
||||||
public class MDCDecoderState extends DecoderState
|
public class MDCDecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||||
@@ -43,9 +46,9 @@ public class MDCDecoderState extends DecoderState
|
|||||||
private String mMessage;
|
private String mMessage;
|
||||||
private String mMessageType;
|
private String mMessageType;
|
||||||
|
|
||||||
public MDCDecoderState( AliasList aliasList )
|
public MDCDecoderState(AliasList aliasList)
|
||||||
{
|
{
|
||||||
super( aliasList );
|
super(aliasList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -55,7 +58,7 @@ public class MDCDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,67 +78,67 @@ public class MDCDecoderState extends DecoderState
|
|||||||
|
|
||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
setFrom( null );
|
mFrom = null;
|
||||||
setFromAlias( null );
|
mFromAlias = null;
|
||||||
setTo( null);
|
mTo = null;
|
||||||
setToAlias( null );
|
mToAlias = null;
|
||||||
setMessage( null );
|
mMessage = null;
|
||||||
setMessageType( null );
|
mMessageType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if( message instanceof MDCMessage )
|
if(message instanceof MDCMessage)
|
||||||
{
|
{
|
||||||
MDCMessage mdc = (MDCMessage)message;
|
MDCMessage mdc = (MDCMessage) message;
|
||||||
|
|
||||||
mIdents.add( mdc.getUnitID() );
|
mIdents.add(mdc.getUnitID());
|
||||||
|
|
||||||
if( mdc.isEmergency() )
|
if(mdc.isEmergency())
|
||||||
{
|
{
|
||||||
mEmergencyIdents.add( mdc.getUnitID() );
|
mEmergencyIdents.add(mdc.getUnitID());
|
||||||
}
|
}
|
||||||
|
|
||||||
setFrom( mdc.getFromID() );
|
setFrom(mdc.getFromID());
|
||||||
setFromAlias( mdc.getFromIDAlias() );
|
setFromAlias(mdc.getFromIDAlias());
|
||||||
|
|
||||||
MDCMessageType type = mdc.getMessageType();
|
MDCMessageType type = mdc.getMessageType();
|
||||||
|
|
||||||
setMessageType( type.getLabel() );
|
setMessageType(type.getLabel());
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "OPCODE " );
|
sb.append("OPCODE ");
|
||||||
sb.append( String.valueOf( mdc.getOpcode() ) );
|
sb.append(String.valueOf(mdc.getOpcode()));
|
||||||
|
|
||||||
if( mdc.isBOT() )
|
if(mdc.isBOT())
|
||||||
{
|
{
|
||||||
sb.append( " TYPE:BOT" );
|
sb.append(" TYPE:BOT");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mdc.isEOT() )
|
if(mdc.isEOT())
|
||||||
{
|
{
|
||||||
sb.append( " TYPE:EOT" );
|
sb.append(" TYPE:EOT");
|
||||||
}
|
}
|
||||||
|
|
||||||
setMessage( sb.toString() );
|
setMessage(sb.toString());
|
||||||
|
|
||||||
MDCCallEvent event = MDCCallEvent.getMDCCallEvent( mdc );
|
MDCCallEvent event = MDCCallEvent.getMDCCallEvent(mdc);
|
||||||
event.setAliasList( getAliasList() );
|
event.setAliasList(getAliasList());
|
||||||
broadcast( event );
|
broadcast(event);
|
||||||
|
|
||||||
switch( type )
|
switch(type)
|
||||||
{
|
{
|
||||||
case ANI:
|
case ANI:
|
||||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.CALL ) );
|
broadcast(new DecoderStateEvent(this, Event.DECODE, State.CALL));
|
||||||
break;
|
break;
|
||||||
case ACKNOWLEDGE:
|
case ACKNOWLEDGE:
|
||||||
case EMERGENCY:
|
case EMERGENCY:
|
||||||
case PAGING:
|
case PAGING:
|
||||||
case STATUS:
|
case STATUS:
|
||||||
default:
|
default:
|
||||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,10 +150,13 @@ public class MDCDecoderState extends DecoderState
|
|||||||
return mFrom;
|
return mFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrom( String from )
|
public void setFrom(String from)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mFrom, from))
|
||||||
{
|
{
|
||||||
mFrom = from;
|
mFrom = from;
|
||||||
broadcast( Attribute.FROM_TALKGROUP );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, mFrom, mFromAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getFromAlias()
|
public Alias getFromAlias()
|
||||||
@@ -158,10 +164,13 @@ public class MDCDecoderState extends DecoderState
|
|||||||
return mFromAlias;
|
return mFromAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFromAlias( Alias alias )
|
public void setFromAlias(Alias alias)
|
||||||
|
{
|
||||||
|
if(mFromAlias == null || (alias != null && mFromAlias != alias))
|
||||||
{
|
{
|
||||||
mFromAlias = alias;
|
mFromAlias = alias;
|
||||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, mFrom, mFromAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTo()
|
public String getTo()
|
||||||
@@ -169,10 +178,13 @@ public class MDCDecoderState extends DecoderState
|
|||||||
return mTo;
|
return mTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTo( String to )
|
public void setTo(String to)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mTo, to))
|
||||||
{
|
{
|
||||||
mTo = to;
|
mTo = to;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mTo, mToAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getToAlias()
|
public Alias getToAlias()
|
||||||
@@ -180,10 +192,13 @@ public class MDCDecoderState extends DecoderState
|
|||||||
return mToAlias;
|
return mToAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToAlias( Alias alias )
|
public void setToAlias(Alias alias)
|
||||||
|
{
|
||||||
|
if(mToAlias == null || (alias != null && mToAlias != alias))
|
||||||
{
|
{
|
||||||
mToAlias = alias;
|
mToAlias = alias;
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mTo, mToAlias));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
public String getMessage()
|
||||||
@@ -191,10 +206,13 @@ public class MDCDecoderState extends DecoderState
|
|||||||
return mMessage;
|
return mMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage( String message )
|
public void setMessage(String message)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessage, message))
|
||||||
{
|
{
|
||||||
mMessage = message;
|
mMessage = message;
|
||||||
broadcast( Attribute.MESSAGE );
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, mMessage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessageType()
|
public String getMessageType()
|
||||||
@@ -202,10 +220,13 @@ public class MDCDecoderState extends DecoderState
|
|||||||
return mMessageType;
|
return mMessageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageType( String type )
|
public void setMessageType(String type)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessageType, type))
|
||||||
{
|
{
|
||||||
mMessageType = type;
|
mMessageType = type;
|
||||||
broadcast( Attribute.MESSAGE_TYPE );
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, "MDC:" + mMessageType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -213,69 +234,69 @@ public class MDCDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "=============================\n" );
|
sb.append("=============================\n");
|
||||||
sb.append( "Decoder:\tMDC-1200\n\n" );
|
sb.append("Decoder:\tMDC-1200\n\n");
|
||||||
sb.append( "MDC-1200 Idents\n" );
|
sb.append("MDC-1200 Idents\n");
|
||||||
|
|
||||||
if( mIdents.isEmpty() )
|
if(mIdents.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Iterator<String> it = mIdents.iterator();
|
Iterator<String> it = mIdents.iterator();
|
||||||
|
|
||||||
while( it.hasNext() )
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String ident = it.next();
|
String ident = it.next();
|
||||||
|
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( ident );
|
sb.append(ident);
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getMDC1200Alias( ident );
|
Alias alias = getAliasList().getMDC1200Alias(ident);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "MDC-1200 Emergency Idents\n" );
|
sb.append("MDC-1200 Emergency Idents\n");
|
||||||
|
|
||||||
if( mEmergencyIdents.isEmpty() )
|
if(mEmergencyIdents.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Iterator<String> it = mEmergencyIdents.iterator();
|
Iterator<String> it = mEmergencyIdents.iterator();
|
||||||
|
|
||||||
while( it.hasNext() )
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String ident = it.next();
|
String ident = it.next();
|
||||||
|
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( ident );
|
sb.append(ident);
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getMDC1200Alias( ident );
|
Alias alias = getAliasList().getMDC1200Alias(ident);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,9 +313,9 @@ public class MDCDecoderState extends DecoderState
|
|||||||
* Responds to reset events issued by the channel state
|
* Responds to reset events issued by the channel state
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case RESET:
|
case RESET:
|
||||||
resetState();
|
resetState();
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.mpt1327;
|
|
||||||
|
|
||||||
import controller.channel.Channel.ChannelType;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class MPT1327DecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel("");
|
|
||||||
private JLabel mSiteOrToTalkgroup = new JLabel("");
|
|
||||||
private JLabel mSiteOrToTalkgroupAlias = new JLabel("");
|
|
||||||
|
|
||||||
private JLabel mFromTalkgroupLabel = new JLabel("");
|
|
||||||
private JLabel mFromTalkgroup = new JLabel("");
|
|
||||||
private JLabel mFromTalkgroupAliasLabel = new JLabel("");
|
|
||||||
|
|
||||||
public MPT1327DecoderPanel(IconManager iconManager, SettingsManager settingsManager, MPT1327DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MPT1327DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (MPT1327DecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setText("MPT1327");
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
MPT1327DecoderState mptState = getDecoderState();
|
|
||||||
|
|
||||||
mSiteOrToTalkgroup.setFont(mFontDecoder);
|
|
||||||
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mSiteOrToTalkgroupAlias.setFont(mFontDecoder);
|
|
||||||
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromTalkgroupLabel.setFont(mFontDetails);
|
|
||||||
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
|
|
||||||
|
|
||||||
mFromTalkgroup.setFont(mFontDecoder);
|
|
||||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
|
|
||||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
|
|
||||||
switch(mptState.getChannelType())
|
|
||||||
{
|
|
||||||
case STANDARD:
|
|
||||||
mSiteOrToTalkgroup.setText(mptState.getSite());
|
|
||||||
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getSiteAlias());
|
|
||||||
break;
|
|
||||||
case TRAFFIC:
|
|
||||||
mSiteOrToTalkgroup.setText(mptState.getToTalkgroup());
|
|
||||||
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getToTalkgroupAlias());
|
|
||||||
|
|
||||||
mFromTalkgroupLabel.setText("From:");
|
|
||||||
mFromTalkgroup.setText(getDecoderState().getFromTalkgroup());
|
|
||||||
setAliasLabel(mFromTalkgroupAliasLabel, mptState.getFromTalkgroupAlias());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unrecognized channel "
|
|
||||||
+ "type in MPT1327 Decoder [" + getDecoderState()
|
|
||||||
.getChannelType().name() + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mSiteOrToTalkgroup);
|
|
||||||
add(mSiteOrToTalkgroupAlias, "wrap");
|
|
||||||
|
|
||||||
if(mptState.getChannelType() == ChannelType.TRAFFIC)
|
|
||||||
{
|
|
||||||
add(mFromTalkgroupLabel);
|
|
||||||
add(mFromTalkgroup);
|
|
||||||
add(mFromTalkgroupAliasLabel, "wrap");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
final MPT1327DecoderState state = getDecoderState();
|
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case CHANNEL_SITE_NUMBER:
|
|
||||||
mSiteOrToTalkgroup.setText(String.valueOf(state.getSite()));
|
|
||||||
setAliasLabel(mSiteOrToTalkgroupAlias, state.getSiteAlias(), false);
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
mSiteOrToTalkgroup.setText(state.getToTalkgroup());
|
|
||||||
setAliasLabel(mSiteOrToTalkgroupAlias, state.getToTalkgroupAlias());
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
mFromTalkgroup.setText(state.getFromTalkgroup());
|
|
||||||
setAliasLabel(mFromTalkgroupAliasLabel, state.getFromTalkgroupAlias());
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
if(mProtocol != null)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mSiteOrToTalkgroup != null)
|
|
||||||
{
|
|
||||||
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mSiteOrToTalkgroupAlias != null)
|
|
||||||
{
|
|
||||||
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mFromTalkgroup != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mFromTalkgroupAliasLabel != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
|
||||||
if(mFromTalkgroupLabel != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,32 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.mpt1327;
|
package module.decode.mpt1327;
|
||||||
|
|
||||||
|
import alias.Alias;
|
||||||
|
import alias.AliasList;
|
||||||
|
import channel.metadata.Attribute;
|
||||||
|
import channel.metadata.AttributeChangeRequest;
|
||||||
|
import channel.state.ChangeChannelTimeoutEvent;
|
||||||
|
import channel.state.DecoderState;
|
||||||
|
import channel.state.DecoderStateEvent;
|
||||||
|
import channel.state.DecoderStateEvent.Event;
|
||||||
|
import channel.state.State;
|
||||||
|
import channel.traffic.TrafficChannelAllocationEvent;
|
||||||
|
import controller.channel.Channel.ChannelType;
|
||||||
|
import controller.channel.map.ChannelMap;
|
||||||
|
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 org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -25,33 +48,9 @@ import java.util.List;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
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 channel.state.ChangeChannelTimeoutEvent;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import channel.state.DecoderStateEvent;
|
|
||||||
import channel.state.DecoderStateEvent.Event;
|
|
||||||
import channel.state.State;
|
|
||||||
import channel.traffic.TrafficChannelAllocationEvent;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class MPT1327DecoderState extends DecoderState
|
public class MPT1327DecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( MPT1327DecoderState.class );
|
private final static Logger mLog = LoggerFactory.getLogger(MPT1327DecoderState.class);
|
||||||
|
|
||||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||||
private HashMap<String,ArrayList<String>> mGroups = new HashMap<String,ArrayList<String>>();
|
private HashMap<String,ArrayList<String>> mGroups = new HashMap<String,ArrayList<String>>();
|
||||||
@@ -67,12 +66,9 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
private long mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
private long mCallTimeout;
|
private long mCallTimeout;
|
||||||
|
|
||||||
public MPT1327DecoderState( AliasList aliasList,
|
public MPT1327DecoderState(AliasList aliasList, ChannelMap channelMap, ChannelType channelType, long callTimeout)
|
||||||
ChannelMap channelMap,
|
|
||||||
ChannelType channelType,
|
|
||||||
long callTimeout )
|
|
||||||
{
|
{
|
||||||
super( aliasList );
|
super(aliasList);
|
||||||
|
|
||||||
mChannelMap = channelMap;
|
mChannelMap = channelMap;
|
||||||
mChannelType = channelType;
|
mChannelType = channelType;
|
||||||
@@ -86,7 +82,7 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,122 +102,114 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if( message.isValid() )
|
if(message.isValid())
|
||||||
{
|
{
|
||||||
if( message instanceof MPT1327Message )
|
if(message instanceof MPT1327Message)
|
||||||
{
|
{
|
||||||
MPT1327Message mpt = ((MPT1327Message)message);
|
MPT1327Message mpt = ((MPT1327Message) message);
|
||||||
|
|
||||||
switch( mpt.getMessageType() )
|
switch(mpt.getMessageType())
|
||||||
{
|
{
|
||||||
case ACK:
|
case ACK:
|
||||||
mIdents.add( mpt.getFromID() );
|
mIdents.add(mpt.getFromID());
|
||||||
|
|
||||||
IdentType identType = mpt.getIdent1Type();
|
IdentType identType = mpt.getIdent1Type();
|
||||||
|
|
||||||
if( identType == IdentType.REGI )
|
if(identType == IdentType.REGI)
|
||||||
{
|
{
|
||||||
broadcast( new MPT1327CallEvent.Builder( CallEventType.REGISTER )
|
broadcast(new MPT1327CallEvent.Builder(CallEventType.REGISTER)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.details( "REGISTERED ON NETWORK" )
|
.details("REGISTERED ON NETWORK")
|
||||||
.frequency( mFrequency )
|
.frequency(mFrequency)
|
||||||
.from( mpt.getToID() )
|
.from(mpt.getToID())
|
||||||
.to( mpt.getFromID() )
|
.to(mpt.getFromID())
|
||||||
.build() );
|
.build());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
broadcast( new MPT1327CallEvent.Builder( CallEventType.RESPONSE )
|
broadcast(new MPT1327CallEvent.Builder(CallEventType.RESPONSE)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.details( "ACK " + identType.getLabel() )
|
.details("ACK " + identType.getLabel())
|
||||||
.frequency( mFrequency )
|
.frequency(mFrequency)
|
||||||
.from( mpt.getFromID() )
|
.from(mpt.getFromID())
|
||||||
.to( mpt.getToID() )
|
.to(mpt.getToID())
|
||||||
.build() );
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.CONTROL ) );
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CONTROL));
|
||||||
break;
|
break;
|
||||||
case ACKI:
|
case ACKI:
|
||||||
mIdents.add( mpt.getFromID() );
|
mIdents.add(mpt.getFromID());
|
||||||
mIdents.add( mpt.getToID() );
|
mIdents.add(mpt.getToID());
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.CONTROL ) );
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CONTROL));
|
||||||
break;
|
break;
|
||||||
case AHYC:
|
case AHYC:
|
||||||
mIdents.add( mpt.getToID() );
|
mIdents.add(mpt.getToID());
|
||||||
|
|
||||||
broadcast( new MPT1327CallEvent.Builder( CallEventType.COMMAND )
|
broadcast(new MPT1327CallEvent.Builder(CallEventType.COMMAND)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.details( ( (MPT1327Message) message ).getRequestString() )
|
.details(((MPT1327Message) message).getRequestString())
|
||||||
.frequency( mFrequency )
|
.frequency(mFrequency)
|
||||||
.from( mpt.getFromID() )
|
.from(mpt.getFromID())
|
||||||
.to( mpt.getToID() )
|
.to(mpt.getToID())
|
||||||
.build() );
|
.build());
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.CONTROL ) );
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CONTROL));
|
||||||
break;
|
break;
|
||||||
case AHYQ:
|
case AHYQ:
|
||||||
broadcast( new MPT1327CallEvent.Builder( CallEventType.STATUS )
|
broadcast(new MPT1327CallEvent.Builder(CallEventType.STATUS)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.details( mpt.getStatusMessage() )
|
.details(mpt.getStatusMessage())
|
||||||
.frequency( mFrequency )
|
.frequency(mFrequency)
|
||||||
.from( mpt.getFromID() )
|
.from(mpt.getFromID())
|
||||||
.to( mpt.getToID() )
|
.to(mpt.getToID())
|
||||||
.build() );
|
.build());
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.CONTROL ) );
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CONTROL));
|
||||||
break;
|
break;
|
||||||
case ALH:
|
case ALH:
|
||||||
String site = mpt.getSiteID();
|
setSite(mpt.getSiteID());
|
||||||
|
broadcast(new DecoderStateEvent(this, Event.START, State.CONTROL));
|
||||||
if( site != null && ( mSite == null || !site.contentEquals( mSite ) ) )
|
|
||||||
{
|
|
||||||
mSite = site;
|
|
||||||
broadcast( Attribute.CHANNEL_SITE_NUMBER );
|
|
||||||
}
|
|
||||||
mSite = mpt.getSiteID();
|
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.START, State.CONTROL ) );
|
|
||||||
break;
|
break;
|
||||||
case GTC:
|
case GTC:
|
||||||
String from = mpt.getFromID();
|
String from = mpt.getFromID();
|
||||||
String to = mpt.getToID();
|
String to = mpt.getToID();
|
||||||
|
|
||||||
if( from != null )
|
if(from != null)
|
||||||
{
|
{
|
||||||
mIdents.add( from );
|
mIdents.add(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( to != null )
|
if(to != null)
|
||||||
{
|
{
|
||||||
mIdents.add( to );
|
mIdents.add(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Capture the idents that talk to each group */
|
/* Capture the idents that talk to each group */
|
||||||
if( from != null && to != null )
|
if(from != null && to != null)
|
||||||
{
|
{
|
||||||
if( mGroups.containsKey( to ) )
|
if(mGroups.containsKey(to))
|
||||||
{
|
{
|
||||||
ArrayList<String> talkgroups = mGroups.get( to );
|
ArrayList<String> talkgroups = mGroups.get(to);
|
||||||
|
|
||||||
if( !talkgroups.contains( from ) )
|
if(!talkgroups.contains(from))
|
||||||
{
|
{
|
||||||
talkgroups.add( from );
|
talkgroups.add(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ArrayList<String> talkgroups = new ArrayList<String>();
|
ArrayList<String> talkgroups = new ArrayList<String>();
|
||||||
talkgroups.add( from );
|
talkgroups.add(from);
|
||||||
|
|
||||||
mGroups.put( to, talkgroups );
|
mGroups.put(to, talkgroups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,43 +217,43 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
|
|
||||||
long frequency = 0;
|
long frequency = 0;
|
||||||
|
|
||||||
if( getChannelMap() != null )
|
if(getChannelMap() != null)
|
||||||
{
|
{
|
||||||
frequency = getChannelMap().getFrequency( channel );
|
frequency = getChannelMap().getFrequency(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallEvent event = new MPT1327CallEvent.Builder( CallEventType.CALL )
|
CallEvent event = new MPT1327CallEvent.Builder(CallEventType.CALL)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( channel ) )
|
.channel(String.valueOf(channel))
|
||||||
.details( "GTC" )
|
.details("GTC")
|
||||||
.frequency( frequency )
|
.frequency(frequency)
|
||||||
.from( mpt.getFromID() )
|
.from(mpt.getFromID())
|
||||||
.to( mpt.getToID() )
|
.to(mpt.getToID())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
broadcast( new TrafficChannelAllocationEvent( this, event ) );
|
broadcast(new TrafficChannelAllocationEvent(this, event));
|
||||||
break;
|
break;
|
||||||
case HEAD_PLUS1:
|
case HEAD_PLUS1:
|
||||||
case HEAD_PLUS2:
|
case HEAD_PLUS2:
|
||||||
case HEAD_PLUS3:
|
case HEAD_PLUS3:
|
||||||
case HEAD_PLUS4:
|
case HEAD_PLUS4:
|
||||||
broadcast( new MPT1327CallEvent.Builder( CallEventType.SDM )
|
broadcast(new MPT1327CallEvent.Builder(CallEventType.SDM)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.details( mpt.getMessage() )
|
.details(mpt.getMessage())
|
||||||
.from( mpt.getFromID() )
|
.from(mpt.getFromID())
|
||||||
.to( mpt.getToID() )
|
.to(mpt.getToID())
|
||||||
.build() );
|
.build());
|
||||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.CONTROL ) );
|
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CONTROL));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Traffic Channel Events */
|
/* Traffic Channel Events */
|
||||||
case CLEAR:
|
case CLEAR:
|
||||||
mChannelNumber = mpt.getChannel();
|
mChannelNumber = mpt.getChannel();
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
broadcast(new DecoderStateEvent(this, Event.END, State.FADE));
|
||||||
break;
|
break;
|
||||||
case MAINT:
|
case MAINT:
|
||||||
if( mChannelType == ChannelType.STANDARD )
|
if(mChannelType == ChannelType.STANDARD)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* When we receive a MAINT message and we're configured
|
* When we receive a MAINT message and we're configured
|
||||||
@@ -273,28 +261,25 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
* timeout specified by the user. Otherwise we'll
|
* timeout specified by the user. Otherwise we'll
|
||||||
* be using the shorter default call timeout
|
* be using the shorter default call timeout
|
||||||
*/
|
*/
|
||||||
broadcast( new ChangeChannelTimeoutEvent( this,
|
broadcast(new ChangeChannelTimeoutEvent(this,
|
||||||
mChannelType, mCallTimeout ) );
|
mChannelType, mCallTimeout));
|
||||||
|
|
||||||
if( mCurrentCallEvent == null )
|
if(mCurrentCallEvent == null)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new MPT1327CallEvent.Builder( CallEventType.CALL )
|
mCurrentCallEvent = new MPT1327CallEvent.Builder(CallEventType.CALL)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.details( "MONITORED TRAFFIC CHANNEL" )
|
.details("MONITORED TRAFFIC CHANNEL")
|
||||||
.frequency( mFrequency )
|
.frequency(mFrequency)
|
||||||
.to( mpt.getToID() )
|
.to(mpt.getToID())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast(new Metadata(MetadataType.TO,
|
setToTalkgroup(mpt.getToID());
|
||||||
mpt.getToID(), mpt.getToIDAlias(), true));
|
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.START, State.CALL ) );
|
broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
|
||||||
|
|
||||||
setToTalkgroup( mpt.getToID() );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -314,10 +299,7 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
mFromTalkgroup = null;
|
mFromTalkgroup = null;
|
||||||
broadcast( Attribute.FROM_TALKGROUP );
|
|
||||||
|
|
||||||
mToTalkgroup = null;
|
mToTalkgroup = null;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is a standard channel, reset the fade timeout to the default
|
* If this is a standard channel, reset the fade timeout to the default
|
||||||
@@ -325,15 +307,15 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
* this indicates we're processing a traffic channel as a standard
|
* this indicates we're processing a traffic channel as a standard
|
||||||
* channel, so we'll issue a different call timeout then.
|
* channel, so we'll issue a different call timeout then.
|
||||||
*/
|
*/
|
||||||
if( mChannelType == ChannelType.STANDARD )
|
if(mChannelType == ChannelType.STANDARD)
|
||||||
{
|
{
|
||||||
broadcast( new ChangeChannelTimeoutEvent( this, mChannelType,
|
broadcast(new ChangeChannelTimeoutEvent(this, mChannelType,
|
||||||
DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS * 1000 ) );
|
DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS * 1000));
|
||||||
|
|
||||||
if( mCurrentCallEvent != null )
|
if(mCurrentCallEvent != null)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.end();
|
mCurrentCallEvent.end();
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,11 +326,24 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
return mSite;
|
return mSite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the site number.
|
||||||
|
*/
|
||||||
|
public void setSite(String site)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mSite, site))
|
||||||
|
{
|
||||||
|
mSite = site;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.NETWORK_ID_1, "SITE:" + getSite(),
|
||||||
|
getSiteAlias()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Alias getSiteAlias()
|
public Alias getSiteAlias()
|
||||||
{
|
{
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
return getAliasList().getSiteID( mSite );
|
return getAliasList().getSiteID(mSite);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -359,7 +354,7 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
return mChannelMap;
|
return mChannelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChannelMap( ChannelMap channelMap )
|
public void setChannelMap(ChannelMap channelMap)
|
||||||
{
|
{
|
||||||
mChannelMap = channelMap;
|
mChannelMap = channelMap;
|
||||||
}
|
}
|
||||||
@@ -374,18 +369,21 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
* the talkgroup will already have been identified prior to the traffic
|
* the talkgroup will already have been identified prior to the traffic
|
||||||
* channel being created.
|
* channel being created.
|
||||||
*/
|
*/
|
||||||
public void setFromTalkgroup( String fromTalkgroup )
|
public void setFromTalkgroup(String fromTalkgroup)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mFromTalkgroup, fromTalkgroup))
|
||||||
{
|
{
|
||||||
mFromTalkgroup = fromTalkgroup;
|
mFromTalkgroup = fromTalkgroup;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||||
broadcast( Attribute.FROM_TALKGROUP );
|
getFromTalkgroupAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getFromTalkgroupAlias()
|
public Alias getFromTalkgroupAlias()
|
||||||
{
|
{
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
return getAliasList().getMPT1327Alias( mFromTalkgroup );
|
return getAliasList().getMPT1327Alias(mFromTalkgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -401,18 +399,21 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
* the talkgroup will already have been identified prior to the traffic
|
* the talkgroup will already have been identified prior to the traffic
|
||||||
* channel being created.
|
* channel being created.
|
||||||
*/
|
*/
|
||||||
public void setToTalkgroup( String toTalkgroup )
|
public void setToTalkgroup(String toTalkgroup)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mToTalkgroup, toTalkgroup))
|
||||||
{
|
{
|
||||||
mToTalkgroup = toTalkgroup;
|
mToTalkgroup = toTalkgroup;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup,
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
getToTalkgroupAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getToTalkgroupAlias()
|
public Alias getToTalkgroupAlias()
|
||||||
{
|
{
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
return getAliasList().getMPT1327Alias( mToTalkgroup );
|
return getAliasList().getMPT1327Alias(mToTalkgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -423,16 +424,19 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
return mChannelNumber;
|
return mChannelNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the channel number. This is used primarily for traffic channels since
|
* Set the channel number. This is used primarily for traffic channels since
|
||||||
* the channel will already have been identified prior to the traffic
|
* the channel will already have been identified prior to the traffic
|
||||||
* channel being created.
|
* channel being created.
|
||||||
*/
|
*/
|
||||||
public void setChannelNumber( int channel )
|
public void setChannelNumber(int channel)
|
||||||
|
{
|
||||||
|
if(mChannelNumber != channel)
|
||||||
{
|
{
|
||||||
mChannelNumber = channel;
|
mChannelNumber = channel;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, String.valueOf(mChannelNumber)));
|
||||||
broadcast( Attribute.CHANNEL_NUMBER );
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -440,118 +444,118 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "Activity Summary\n" );
|
sb.append("Activity Summary\n");
|
||||||
sb.append( "Decoder:\tMPT-1327\n" );
|
sb.append("Decoder:\tMPT-1327\n");
|
||||||
sb.append( "Site:\t" );
|
sb.append("Site:\t");
|
||||||
|
|
||||||
if( mSite != null )
|
if(mSite != null)
|
||||||
{
|
{
|
||||||
sb.append( mSite );
|
sb.append(mSite);
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias siteAlias = getAliasList().getSiteID( mSite );
|
Alias siteAlias = getAliasList().getSiteID(mSite);
|
||||||
|
|
||||||
if( siteAlias != null )
|
if(siteAlias != null)
|
||||||
{
|
{
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( siteAlias.getName() );
|
sb.append(siteAlias.getName());
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append( "Unknown\n" );
|
sb.append("Unknown\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n\n" );
|
sb.append("\n\n");
|
||||||
|
|
||||||
sb.append( "Talkgroups\n\n" );
|
sb.append("Talkgroups\n\n");
|
||||||
|
|
||||||
if( mGroups.isEmpty() )
|
if(mGroups.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<String> talkgroups = new ArrayList<String>( mGroups.keySet() );
|
List<String> talkgroups = new ArrayList<String>(mGroups.keySet());
|
||||||
Collections.sort( talkgroups );
|
Collections.sort(talkgroups);
|
||||||
|
|
||||||
for( String talkgroup: talkgroups )
|
for(String talkgroup : talkgroups)
|
||||||
{
|
{
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( talkgroup );
|
sb.append(talkgroup);
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getMPT1327Alias( talkgroup );
|
Alias alias = getAliasList().getMPT1327Alias(talkgroup);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
|
|
||||||
ArrayList<String> members = mGroups.get( talkgroup );
|
ArrayList<String> members = mGroups.get(talkgroup);
|
||||||
Collections.sort( members );
|
Collections.sort(members);
|
||||||
|
|
||||||
for( String member: members )
|
for(String member : members)
|
||||||
{
|
{
|
||||||
sb.append( " >" );
|
sb.append(" >");
|
||||||
sb.append( member );
|
sb.append(member);
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getMPT1327Alias( member );
|
Alias alias = getAliasList().getMPT1327Alias(member);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
|
|
||||||
sb.append( "Individual Idents\n" );
|
sb.append("Individual Idents\n");
|
||||||
if( mIdents.isEmpty() )
|
if(mIdents.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Iterator<String> it = mIdents.iterator();
|
Iterator<String> it = mIdents.iterator();
|
||||||
|
|
||||||
while( it.hasNext() )
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String ident = it.next();
|
String ident = it.next();
|
||||||
|
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( ident );
|
sb.append(ident);
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getMPT1327Alias( ident );
|
Alias alias = getAliasList().getMPT1327Alias(ident);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,47 +569,45 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case RESET:
|
case RESET:
|
||||||
resetState();
|
resetState();
|
||||||
break;
|
break;
|
||||||
case SOURCE_FREQUENCY:
|
case SOURCE_FREQUENCY:
|
||||||
mFrequency = event.getFrequency();
|
mFrequency = event.getFrequency();
|
||||||
|
broadcast(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, event.getFrequency()));
|
||||||
break;
|
break;
|
||||||
case TRAFFIC_CHANNEL_ALLOCATION:
|
case TRAFFIC_CHANNEL_ALLOCATION:
|
||||||
if( event.getSource() != MPT1327DecoderState.this )
|
if(event.getSource() != MPT1327DecoderState.this)
|
||||||
{
|
{
|
||||||
if( event instanceof TrafficChannelAllocationEvent )
|
if(event instanceof TrafficChannelAllocationEvent)
|
||||||
{
|
{
|
||||||
TrafficChannelAllocationEvent allocationEvent =
|
TrafficChannelAllocationEvent allocationEvent =
|
||||||
(TrafficChannelAllocationEvent)event;
|
(TrafficChannelAllocationEvent) event;
|
||||||
|
|
||||||
String channel = allocationEvent.getCallEvent().getChannel();
|
String channel = allocationEvent.getCallEvent().getChannel();
|
||||||
|
|
||||||
if( channel != null )
|
if(channel != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mChannelNumber = Integer.valueOf( channel );
|
setChannelNumber(Integer.valueOf(channel));
|
||||||
broadcast( Attribute.CHANNEL_NUMBER );
|
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
//Do nothing, we couldn't parse the channel number
|
//Do nothing, we couldn't parse the channel number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mFrequency = allocationEvent.getCallEvent().getFrequency();
|
mFrequency = allocationEvent.getCallEvent().getFrequency();
|
||||||
broadcast( Attribute.SOURCE );
|
broadcast(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY,
|
||||||
|
allocationEvent.getCallEvent().getFrequency()));
|
||||||
|
|
||||||
mFromTalkgroup = allocationEvent.getCallEvent().getFromID();
|
setFromTalkgroup(allocationEvent.getCallEvent().getFromID());
|
||||||
broadcast( Attribute.FROM_TALKGROUP );
|
setToTalkgroup(allocationEvent.getCallEvent().getToID());
|
||||||
|
|
||||||
mToTalkgroup = allocationEvent.getCallEvent().getToID();
|
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,179 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.mpt1327;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class MPT1327TrafficPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocolLabel;
|
|
||||||
private JLabel mFromTalkgroupLabel;
|
|
||||||
private JLabel mFromTalkgroupAliasLabel;
|
|
||||||
|
|
||||||
private JLabel mToLabel;
|
|
||||||
private JLabel mToTalkgroupLabel;
|
|
||||||
private JLabel mToTalkgroupAliasLabel;
|
|
||||||
|
|
||||||
public MPT1327TrafficPanel(IconManager iconManager, SettingsManager settingsManager,
|
|
||||||
MPT1327DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MPT1327DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (MPT1327DecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
mProtocolLabel = new JLabel("MPT1327");
|
|
||||||
mProtocolLabel.setFont(mFontDecoder);
|
|
||||||
mProtocolLabel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromTalkgroupLabel = new JLabel();
|
|
||||||
mFromTalkgroupLabel.setFont(mFontDecoder);
|
|
||||||
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromTalkgroupAliasLabel = new JLabel();
|
|
||||||
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
|
|
||||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mToLabel = new JLabel("TO:");
|
|
||||||
mToLabel.setFont(mFontDetails);
|
|
||||||
mToLabel.setForeground(mColorLabelDetails);
|
|
||||||
|
|
||||||
mToTalkgroupLabel = new JLabel(getDecoderState().getFromTalkgroup());
|
|
||||||
mToTalkgroupLabel.setFont(mFontDecoder);
|
|
||||||
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mToTalkgroupAliasLabel = new JLabel();
|
|
||||||
mToTalkgroupAliasLabel.setFont(mFontDecoder);
|
|
||||||
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocolLabel);
|
|
||||||
add(mFromTalkgroupLabel);
|
|
||||||
add(mFromTalkgroupAliasLabel, "wrap");
|
|
||||||
|
|
||||||
add(mToLabel);
|
|
||||||
add(mToTalkgroupLabel);
|
|
||||||
add(mToTalkgroupAliasLabel, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
final MPT1327DecoderState state = getDecoderState();
|
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
String talkgroup = state.getFromTalkgroup();
|
|
||||||
|
|
||||||
mFromTalkgroupLabel.setText(talkgroup);
|
|
||||||
|
|
||||||
Alias alias = state.getFromTalkgroupAlias();
|
|
||||||
|
|
||||||
if(alias != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroupAliasLabel.setText(alias.getName());
|
|
||||||
|
|
||||||
String icon = alias.getIconName();
|
|
||||||
|
|
||||||
mFromTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String toTalkgroup = state.getToTalkgroup();
|
|
||||||
|
|
||||||
mToTalkgroupLabel.setText(toTalkgroup);
|
|
||||||
|
|
||||||
Alias toAlias = state.getToTalkgroupAlias();
|
|
||||||
|
|
||||||
if(toAlias != null)
|
|
||||||
{
|
|
||||||
mToTalkgroupAliasLabel.setText(toAlias.getName());
|
|
||||||
|
|
||||||
String icon = toAlias.getIconName();
|
|
||||||
|
|
||||||
if(icon != null)
|
|
||||||
{
|
|
||||||
mToTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
mProtocolLabel.setForeground(mColorLabelDecoder);
|
|
||||||
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
|
|
||||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
|
||||||
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
|
|
||||||
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
|
||||||
mToLabel.setForeground(mColorLabelDetails);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.nbfm;
|
|
||||||
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class NBFMDecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel("NBFM");
|
|
||||||
|
|
||||||
public NBFMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(Attribute t)
|
|
||||||
{
|
|
||||||
/* Not implemented */
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting) setting;
|
|
||||||
|
|
||||||
if(color.getColorSettingName() ==
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(color.getColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.p25;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class P25DecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol;
|
|
||||||
private JLabel mTo = new JLabel(" ");
|
|
||||||
private JLabel mToAlias = new JLabel(" ");
|
|
||||||
|
|
||||||
private JLabel mNAC = new JLabel("NAC:");
|
|
||||||
private JLabel mFrom = new JLabel(" ");
|
|
||||||
private JLabel mFromAlias = new JLabel(" ");
|
|
||||||
|
|
||||||
private JLabel mSystem = new JLabel("SYS:");
|
|
||||||
private JLabel mSite = new JLabel("Site:");
|
|
||||||
private JLabel mSiteAlias = new JLabel("");
|
|
||||||
|
|
||||||
|
|
||||||
public P25DecoderPanel(IconManager iconManager, SettingsManager settingsManager, P25DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
mProtocol = new JLabel("P25-1 " + decoderState.getModulation().getShortLabel());
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mTo.setFont(mFontDecoder);
|
|
||||||
mTo.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mToAlias.setFont(mFontDecoder);
|
|
||||||
mToAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mNAC.setFont(mFontDetails);
|
|
||||||
mNAC.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFrom.setFont(mFontDecoder);
|
|
||||||
mFrom.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromAlias.setFont(mFontDecoder);
|
|
||||||
mFromAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mSystem.setFont(mFontDetails);
|
|
||||||
mSystem.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mSiteAlias.setFont(mFontDecoder);
|
|
||||||
mSiteAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mSite.setFont(mFontDetails);
|
|
||||||
mSite.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mTo);
|
|
||||||
add(mToAlias, "wrap");
|
|
||||||
|
|
||||||
add(mNAC);
|
|
||||||
add(mFrom);
|
|
||||||
add(mFromAlias, "wrap");
|
|
||||||
|
|
||||||
add(mSystem);
|
|
||||||
add(mSite);
|
|
||||||
add(mSiteAlias, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
public P25DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (P25DecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
final P25DecoderState state = getDecoderState();
|
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case NAC:
|
|
||||||
mNAC.setText("NAC:" + state.getNAC());
|
|
||||||
break;
|
|
||||||
case SYSTEM:
|
|
||||||
mSystem.setText("SYS:" + state.getSystem());
|
|
||||||
break;
|
|
||||||
case SITE:
|
|
||||||
mSite.setText("SITE:" + state.getSite());
|
|
||||||
break;
|
|
||||||
case SITE_ALIAS:
|
|
||||||
mSiteAlias.setText(state.getSiteAlias());
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
if(state.getFromTalkgroup() == null)
|
|
||||||
{
|
|
||||||
mFrom.setText(" ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrom.setText(state.getFromTalkgroup());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
Alias from = state.getFromAlias();
|
|
||||||
|
|
||||||
if(from != null)
|
|
||||||
{
|
|
||||||
mFromAlias.setText(from.getName());
|
|
||||||
|
|
||||||
final String icon = from.getIconName();
|
|
||||||
|
|
||||||
if(icon != null && mIconManager != null)
|
|
||||||
{
|
|
||||||
mFromAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromAlias.setText(" ");
|
|
||||||
mFromAlias.setIcon(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
if(state.getToTalkgroup() == null)
|
|
||||||
{
|
|
||||||
mTo.setText(" ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTo.setText(state.getToTalkgroup());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
final Alias to = state.getToAlias();
|
|
||||||
|
|
||||||
if(to != null)
|
|
||||||
{
|
|
||||||
mToAlias.setText(to.getName());
|
|
||||||
|
|
||||||
final String icon = to.getIconName();
|
|
||||||
|
|
||||||
if(icon != null && mIconManager != null)
|
|
||||||
{
|
|
||||||
mToAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToAlias.setText(" ");
|
|
||||||
mToAlias.setIcon(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
if(mProtocol != null)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,8 +21,14 @@ import alias.Alias;
|
|||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import alias.PatchGroupAlias;
|
import alias.PatchGroupAlias;
|
||||||
import alias.id.talkgroup.TalkgroupID;
|
import alias.id.talkgroup.TalkgroupID;
|
||||||
import audio.metadata.Metadata;
|
import channel.metadata.Attribute;
|
||||||
import audio.metadata.MetadataType;
|
import channel.metadata.AttributeChangeRequest;
|
||||||
|
import channel.state.ChangeChannelTimeoutEvent;
|
||||||
|
import channel.state.DecoderState;
|
||||||
|
import channel.state.DecoderStateEvent;
|
||||||
|
import channel.state.DecoderStateEvent.Event;
|
||||||
|
import channel.state.State;
|
||||||
|
import channel.traffic.TrafficChannelAllocationEvent;
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.decode.DecoderType;
|
import module.decode.DecoderType;
|
||||||
@@ -123,13 +129,6 @@ import module.decode.p25.reference.IPProtocol;
|
|||||||
import module.decode.p25.reference.LinkControlOpcode;
|
import module.decode.p25.reference.LinkControlOpcode;
|
||||||
import module.decode.p25.reference.Response;
|
import module.decode.p25.reference.Response;
|
||||||
import module.decode.p25.reference.Vendor;
|
import module.decode.p25.reference.Vendor;
|
||||||
import channel.state.ChangeChannelTimeoutEvent;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import channel.state.DecoderStateEvent;
|
|
||||||
import channel.state.DecoderStateEvent.Event;
|
|
||||||
import channel.state.State;
|
|
||||||
import channel.traffic.TrafficChannelAllocationEvent;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -159,10 +158,10 @@ public class P25DecoderState extends DecoderState
|
|||||||
private Set<module.decode.p25.message.tsbk.osp.control.SecondaryControlChannelBroadcast> mSecondaryControlChannels =
|
private Set<module.decode.p25.message.tsbk.osp.control.SecondaryControlChannelBroadcast> mSecondaryControlChannels =
|
||||||
new TreeSet<>();
|
new TreeSet<>();
|
||||||
|
|
||||||
private Map<Integer, IdentifierUpdate> mBands = new HashMap<>();
|
private Map<Integer,IdentifierUpdate> mBands = new HashMap<>();
|
||||||
private Map<String, Long> mRegistrations = new HashMap<>();
|
private Map<String,Long> mRegistrations = new HashMap<>();
|
||||||
private Map<String, IAdjacentSite> mNeighborMap = new HashMap<>();
|
private Map<String,IAdjacentSite> mNeighborMap = new HashMap<>();
|
||||||
private Map<String, List<String>> mPatchGroupMap = new HashMap<>();
|
private Map<String,List<String>> mPatchGroupMap = new HashMap<>();
|
||||||
|
|
||||||
private String mLastCommandEventID;
|
private String mLastCommandEventID;
|
||||||
private String mLastPageEventID;
|
private String mLastPageEventID;
|
||||||
@@ -188,7 +187,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
|
|
||||||
private P25CallEvent mCurrentCallEvent;
|
private P25CallEvent mCurrentCallEvent;
|
||||||
private List<String> mCallDetectTalkgroups = new ArrayList<>();
|
private List<String> mCallDetectTalkgroups = new ArrayList<>();
|
||||||
private Map<String, P25CallEvent> mChannelCallMap = new HashMap<>();
|
private Map<String,P25CallEvent> mChannelCallMap = new HashMap<>();
|
||||||
|
|
||||||
public P25DecoderState(AliasList aliasList,
|
public P25DecoderState(AliasList aliasList,
|
||||||
ChannelType channelType,
|
ChannelType channelType,
|
||||||
@@ -225,9 +224,10 @@ public class P25DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
resetState();
|
resetState();
|
||||||
|
|
||||||
updateNAC(null);
|
mNAC = null;
|
||||||
updateSite(null);
|
mSite = null;
|
||||||
updateSystem(null);
|
mSiteAlias = null;
|
||||||
|
mSystem = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -236,16 +236,9 @@ public class P25DecoderState extends DecoderState
|
|||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
mFromTalkgroup = null;
|
mFromTalkgroup = null;
|
||||||
broadcast(Attribute.FROM_TALKGROUP);
|
|
||||||
|
|
||||||
mFromAlias = null;
|
mFromAlias = null;
|
||||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
mToTalkgroup = null;
|
mToTalkgroup = null;
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
mToAlias = null;
|
mToAlias = null;
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
mCallDetectTalkgroups.clear();
|
mCallDetectTalkgroups.clear();
|
||||||
|
|
||||||
@@ -2843,7 +2836,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
patchedTalkgroups = new ArrayList<>();
|
patchedTalkgroups = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String talkgroupToAdd: talkgroupsToAdd)
|
for(String talkgroupToAdd : talkgroupsToAdd)
|
||||||
{
|
{
|
||||||
//Exclude the patch group ID if it is included in the patched talkgroup list so that we don't have
|
//Exclude the patch group ID if it is included in the patched talkgroup list so that we don't have
|
||||||
//an infinite loop situation
|
//an infinite loop situation
|
||||||
@@ -2887,7 +2880,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
|
|
||||||
if(patchedTalkgroups != null)
|
if(patchedTalkgroups != null)
|
||||||
{
|
{
|
||||||
for(String talkgroupToRemove: talkgroupsToRemove)
|
for(String talkgroupToRemove : talkgroupsToRemove)
|
||||||
{
|
{
|
||||||
if(patchedTalkgroups.contains(talkgroupToRemove))
|
if(patchedTalkgroups.contains(talkgroupToRemove))
|
||||||
{
|
{
|
||||||
@@ -2929,7 +2922,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
|
|
||||||
if(existingAlias instanceof PatchGroupAlias)
|
if(existingAlias instanceof PatchGroupAlias)
|
||||||
{
|
{
|
||||||
patchGroupAlias = (PatchGroupAlias)existingAlias;
|
patchGroupAlias = (PatchGroupAlias) existingAlias;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2953,7 +2946,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
|
|
||||||
patchGroupAlias.clearPatchedAliases();
|
patchGroupAlias.clearPatchedAliases();
|
||||||
|
|
||||||
for(String patchedTalkgroup: patchedTalkgroups)
|
for(String patchedTalkgroup : patchedTalkgroups)
|
||||||
{
|
{
|
||||||
Alias patchedAlias = getAliasList().getTalkgroupAlias(patchedTalkgroup);
|
Alias patchedAlias = getAliasList().getTalkgroupAlias(patchedTalkgroup);
|
||||||
|
|
||||||
@@ -2974,7 +2967,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
|
|
||||||
if(alias instanceof PatchGroupAlias)
|
if(alias instanceof PatchGroupAlias)
|
||||||
{
|
{
|
||||||
PatchGroupAlias patchGroupAlias = (PatchGroupAlias)alias;
|
PatchGroupAlias patchGroupAlias = (PatchGroupAlias) alias;
|
||||||
|
|
||||||
getAliasList().removeAlias(patchGroupAlias);
|
getAliasList().removeAlias(patchGroupAlias);
|
||||||
|
|
||||||
@@ -3372,8 +3365,6 @@ public class P25DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
mToTalkgroup = to;
|
mToTalkgroup = to;
|
||||||
|
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
if(hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
mToAlias = getAliasList().getTalkgroupAlias(mToTalkgroup);
|
mToAlias = getAliasList().getTalkgroupAlias(mToTalkgroup);
|
||||||
@@ -3383,14 +3374,10 @@ public class P25DecoderState extends DecoderState
|
|||||||
mToAlias = null;
|
mToAlias = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToAlias));
|
||||||
|
|
||||||
/* Send audio metadata update */
|
|
||||||
broadcast(new Metadata(MetadataType.TO, mToTalkgroup, mToAlias, true));
|
|
||||||
|
|
||||||
if(mCurrentCallEvent != null &&
|
if(mCurrentCallEvent != null &&
|
||||||
(mCurrentCallEvent.getToID() == null ||
|
(mCurrentCallEvent.getToID() == null || !mCurrentCallEvent.getToID().contentEquals(to)))
|
||||||
!mCurrentCallEvent.getToID().contentEquals(to)))
|
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.setToID(to);
|
mCurrentCallEvent.setToID(to);
|
||||||
broadcast(mCurrentCallEvent);
|
broadcast(mCurrentCallEvent);
|
||||||
@@ -3409,7 +3396,6 @@ public class P25DecoderState extends DecoderState
|
|||||||
if(mFromTalkgroup == null || !mFromTalkgroup.contentEquals(from))
|
if(mFromTalkgroup == null || !mFromTalkgroup.contentEquals(from))
|
||||||
{
|
{
|
||||||
mFromTalkgroup = from;
|
mFromTalkgroup = from;
|
||||||
broadcast(Attribute.FROM_TALKGROUP);
|
|
||||||
|
|
||||||
if(hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
@@ -3420,14 +3406,11 @@ public class P25DecoderState extends DecoderState
|
|||||||
mFromAlias = null;
|
mFromAlias = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||||
|
mFromAlias));
|
||||||
/* Send audio metadata update */
|
|
||||||
broadcast(new Metadata(MetadataType.FROM, mFromTalkgroup, mFromAlias, true));
|
|
||||||
|
|
||||||
if(mCurrentCallEvent != null &&
|
if(mCurrentCallEvent != null &&
|
||||||
(mCurrentCallEvent.getFromID() == null ||
|
(mCurrentCallEvent.getFromID() == null || !mCurrentCallEvent.getFromID().contentEquals(from)))
|
||||||
!mCurrentCallEvent.getFromID().contentEquals(from)))
|
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.setFromID(from);
|
mCurrentCallEvent.setFromID(from);
|
||||||
broadcast(mCurrentCallEvent);
|
broadcast(mCurrentCallEvent);
|
||||||
@@ -3437,19 +3420,6 @@ public class P25DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcasts an update to the NAC
|
|
||||||
*/
|
|
||||||
private void updateNAC(String nac)
|
|
||||||
{
|
|
||||||
if(mNAC == null || (nac != null && !mNAC.contentEquals(nac)))
|
|
||||||
{
|
|
||||||
mNAC = nac;
|
|
||||||
|
|
||||||
broadcast(Attribute.NAC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the site information
|
* Updates the site information
|
||||||
*/
|
*/
|
||||||
@@ -3459,8 +3429,6 @@ public class P25DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
mSite = site;
|
mSite = site;
|
||||||
|
|
||||||
broadcast(Attribute.SITE);
|
|
||||||
|
|
||||||
if(hasAliasList())
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getSiteID(mSite);
|
Alias alias = getAliasList().getSiteID(mSite);
|
||||||
@@ -3475,7 +3443,7 @@ public class P25DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
broadcast(Attribute.SITE_ALIAS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3484,11 +3452,28 @@ public class P25DecoderState extends DecoderState
|
|||||||
if(mSystem == null || (system != null && !mSystem.contentEquals(system)))
|
if(mSystem == null || (system != null && !mSystem.contentEquals(system)))
|
||||||
{
|
{
|
||||||
mSystem = system;
|
mSystem = system;
|
||||||
|
broadcastSystemAndNACUpdate();
|
||||||
broadcast(Attribute.SYSTEM);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Broadcasts an update to the NAC
|
||||||
|
*/
|
||||||
|
private void updateNAC(String nac)
|
||||||
|
{
|
||||||
|
if(mNAC == null || (nac != null && !mNAC.contentEquals(nac)))
|
||||||
|
{
|
||||||
|
mNAC = nac;
|
||||||
|
broadcastSystemAndNACUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcastSystemAndNACUpdate()
|
||||||
|
{
|
||||||
|
String label = String.format("SYS:%s NAC:%s", mSystem, mNAC);
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.NETWORK_ID_1, label));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a unit paging event message
|
* Process a unit paging event message
|
||||||
*/
|
*/
|
||||||
@@ -3816,27 +3801,24 @@ public class P25DecoderState extends DecoderState
|
|||||||
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
|
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
|
||||||
|
|
||||||
mCurrentChannel = allocationEvent.getCallEvent().getChannel();
|
mCurrentChannel = allocationEvent.getCallEvent().getChannel();
|
||||||
broadcast(Attribute.CHANNEL_NUMBER);
|
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, mCurrentChannel));
|
||||||
|
|
||||||
mCurrentChannelFrequency = allocationEvent.getCallEvent().getFrequency();
|
mCurrentChannelFrequency = allocationEvent.getCallEvent().getFrequency();
|
||||||
broadcast(Attribute.SOURCE);
|
broadcast(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, mCurrentChannelFrequency));
|
||||||
|
|
||||||
mFromTalkgroup = allocationEvent.getCallEvent().getFromID();
|
mFromTalkgroup = allocationEvent.getCallEvent().getFromID();
|
||||||
broadcast(Attribute.FROM_TALKGROUP);
|
|
||||||
|
|
||||||
mToTalkgroup = allocationEvent.getCallEvent().getToID();
|
mToTalkgroup = allocationEvent.getCallEvent().getToID();
|
||||||
broadcast(Attribute.TO_TALKGROUP);
|
|
||||||
|
|
||||||
if(allocationEvent.getCallEvent().hasAliasList())
|
if(allocationEvent.getCallEvent().hasAliasList())
|
||||||
{
|
{
|
||||||
AliasList aliasList = allocationEvent.getCallEvent().getAliasList();
|
AliasList aliasList = allocationEvent.getCallEvent().getAliasList();
|
||||||
|
|
||||||
mFromAlias = aliasList.getTalkgroupAlias(mFromTalkgroup);
|
mFromAlias = aliasList.getTalkgroupAlias(mFromTalkgroup);
|
||||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
|
||||||
|
|
||||||
mToAlias = aliasList.getTalkgroupAlias(mToTalkgroup);
|
mToAlias = aliasList.getTalkgroupAlias(mToTalkgroup);
|
||||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup, mFromAlias));
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToAlias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,56 +1,42 @@
|
|||||||
package module.decode.p25.audio;
|
package module.decode.p25.audio;
|
||||||
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import audio.AudioFormats;
|
||||||
|
import audio.AudioPacket;
|
||||||
|
import audio.IAudioPacketProvider;
|
||||||
|
import audio.squelch.ISquelchStateListener;
|
||||||
|
import audio.squelch.SquelchState;
|
||||||
|
import channel.metadata.Metadata;
|
||||||
|
import dsp.gain.NonClippingGain;
|
||||||
import jmbe.iface.AudioConversionLibrary;
|
import jmbe.iface.AudioConversionLibrary;
|
||||||
import jmbe.iface.AudioConverter;
|
import jmbe.iface.AudioConverter;
|
||||||
import message.IMessageListener;
|
import message.IMessageListener;
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
import module.decode.p25.message.ldu.LDUMessage;
|
import module.decode.p25.message.ldu.LDUMessage;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import audio.AudioFormats;
|
|
||||||
import audio.AudioPacket;
|
|
||||||
import audio.IAudioPacketProvider;
|
|
||||||
import audio.metadata.AudioMetadata;
|
|
||||||
import audio.metadata.IMetadataListener;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.squelch.ISquelchStateListener;
|
|
||||||
import audio.squelch.SquelchState;
|
|
||||||
import controller.channel.ChannelEvent;
|
|
||||||
import controller.channel.IChannelEventListener;
|
|
||||||
import dsp.gain.NonClippingGain;
|
|
||||||
|
|
||||||
public class P25AudioModule extends Module implements Listener<Message>,
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
IAudioPacketProvider, IMessageListener, IChannelEventListener,
|
|
||||||
IMetadataListener, ISquelchStateListener
|
public class P25AudioModule extends Module implements Listener<Message>, IAudioPacketProvider, IMessageListener,
|
||||||
|
ISquelchStateListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(P25AudioModule.class);
|
private final static Logger mLog = LoggerFactory.getLogger(P25AudioModule.class);
|
||||||
|
|
||||||
private static final String IMBE_CODEC = "IMBE";
|
private static final String IMBE_CODEC = "IMBE";
|
||||||
|
|
||||||
/* Provides a unique identifier for this audio module instance to use as a
|
|
||||||
* source identifier for all audio packets */
|
|
||||||
private static int UNIQUE_ID = 0;
|
|
||||||
private int mSourceID;
|
|
||||||
private static boolean mLibraryLoadStatusLogged = false;
|
private static boolean mLibraryLoadStatusLogged = false;
|
||||||
private boolean mCanConvertAudio = false;
|
private boolean mCanConvertAudio = false;
|
||||||
private AudioConverter mAudioConverter;
|
private AudioConverter mAudioConverter;
|
||||||
private Listener<AudioPacket> mAudioPacketListener;
|
private Listener<AudioPacket> mAudioPacketListener;
|
||||||
private AudioMetadata mAudioMetadata;
|
|
||||||
private ChannelEventListener mChannelEventListener = new ChannelEventListener();
|
|
||||||
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
||||||
private NonClippingGain mGain = new NonClippingGain(5.0f, 0.95f);
|
private NonClippingGain mGain = new NonClippingGain(5.0f, 0.95f);
|
||||||
|
private Metadata mMetadata;
|
||||||
|
|
||||||
public P25AudioModule(boolean record)
|
public P25AudioModule(Metadata metadata)
|
||||||
{
|
{
|
||||||
mSourceID = ++UNIQUE_ID;
|
mMetadata = metadata;
|
||||||
mAudioMetadata = new AudioMetadata(mSourceID, record);
|
|
||||||
|
|
||||||
loadConverter();
|
loadConverter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +61,6 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
|||||||
@Override
|
@Override
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
mAudioMetadata.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,8 +98,7 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
|||||||
|
|
||||||
audio = mGain.apply(audio);
|
audio = mGain.apply(audio);
|
||||||
|
|
||||||
mAudioPacketListener.receive(
|
mAudioPacketListener.receive(new AudioPacket(audio, mMetadata.copyOf()));
|
||||||
new AudioPacket(audio, mAudioMetadata.copyOf()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,41 +195,6 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
|||||||
mAudioPacketListener = null;
|
mAudioPacketListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Listener<Metadata> getMetadataListener()
|
|
||||||
{
|
|
||||||
return mAudioMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Listener<ChannelEvent> getChannelEventListener()
|
|
||||||
{
|
|
||||||
return mChannelEventListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper for channel event listener. Responds to channel state reset
|
|
||||||
* events to remove/cleanup current audio metadata
|
|
||||||
*/
|
|
||||||
public class ChannelEventListener implements Listener<ChannelEvent>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void receive(ChannelEvent event)
|
|
||||||
{
|
|
||||||
switch (event.getEvent())
|
|
||||||
{
|
|
||||||
case NOTIFICATION_STATE_RESET:
|
|
||||||
mAudioMetadata.reset();
|
|
||||||
break;
|
|
||||||
case NOTIFICATION_SELECTION_CHANGE:
|
|
||||||
mAudioMetadata.setSelected(event.getChannel().isSelected());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for squelch state listener. Internally, the P25 audio module
|
* Wrapper for squelch state listener. Internally, the P25 audio module
|
||||||
* doesn't have a squelch state. If there are IMBE audio frames, we have
|
* doesn't have a squelch state. If there are IMBE audio frames, we have
|
||||||
@@ -259,10 +208,7 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
|||||||
{
|
{
|
||||||
if (state == SquelchState.SQUELCH && mAudioPacketListener != null)
|
if (state == SquelchState.SQUELCH && mAudioPacketListener != null)
|
||||||
{
|
{
|
||||||
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END,
|
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END, mMetadata.copyOf()));
|
||||||
mAudioMetadata.copyOf()));
|
|
||||||
|
|
||||||
mAudioMetadata.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,225 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.passport;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class PassportDecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel("Passport");
|
|
||||||
private JLabel mToTalkgroup = new JLabel();
|
|
||||||
private JLabel mToTalkgroupAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mSiteAndChannel = new JLabel("Site:");
|
|
||||||
private JLabel mFromTalkgroup = new JLabel();
|
|
||||||
private JLabel mFromTalkgroupAlias = new JLabel();
|
|
||||||
|
|
||||||
public PassportDecoderPanel(IconManager iconManager, SettingsManager settingsManager, PassportDecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
mProtocol.setFont(mFontDecoder);
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mToTalkgroup.setFont(mFontDecoder);
|
|
||||||
mToTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mToTalkgroupAlias.setFont(mFontDecoder);
|
|
||||||
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mSiteAndChannel.setFont(mFontDecoder);
|
|
||||||
mSiteAndChannel.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromTalkgroup.setFont(mFontDecoder);
|
|
||||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
mFromTalkgroupAlias.setFont(mFontDecoder);
|
|
||||||
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mToTalkgroup);
|
|
||||||
add(mToTalkgroupAlias, "wrap");
|
|
||||||
|
|
||||||
add(mSiteAndChannel);
|
|
||||||
add(mFromTalkgroup);
|
|
||||||
add(mFromTalkgroupAlias, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
public PassportDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (PassportDecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
PassportDecoderState state = getDecoderState();
|
|
||||||
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String tg = state.getTalkgroup();
|
|
||||||
|
|
||||||
if(tg != null)
|
|
||||||
{
|
|
||||||
mToTalkgroup.setText("TG:" + tg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToTalkgroup.setText(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias toAlias = state.getTalkgroupAlias();
|
|
||||||
|
|
||||||
if(toAlias != null)
|
|
||||||
{
|
|
||||||
mToTalkgroupAlias.setText(toAlias.getName());
|
|
||||||
|
|
||||||
mToTalkgroupAlias.setIcon(mIconManager.getIcon(toAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToTalkgroupAlias.setText(null);
|
|
||||||
mToTalkgroupAlias.setIcon(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
String mid = state.getMobileID();
|
|
||||||
|
|
||||||
if(mid != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroup.setText("MIN:" + mid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromTalkgroup.setText(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
Alias fromAlias = state.getMobileIDAlias();
|
|
||||||
|
|
||||||
if(fromAlias != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroupAlias.setText(fromAlias.getName());
|
|
||||||
|
|
||||||
mFromTalkgroupAlias.setIcon(mIconManager
|
|
||||||
.getIcon(fromAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromTalkgroupAlias.setText(null);
|
|
||||||
mFromTalkgroupAlias.setIcon(null);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CHANNEL_NUMBER:
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Site: ");
|
|
||||||
sb.append(state.getSiteNumber());
|
|
||||||
sb.append("/");
|
|
||||||
sb.append(state.getChannelNumber());
|
|
||||||
|
|
||||||
mSiteAndChannel.setText(sb.toString());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting colorSetting = (ColorSetting) setting;
|
|
||||||
|
|
||||||
switch(colorSetting.getColorSettingName())
|
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
|
||||||
if(mColorLabelDecoder != null)
|
|
||||||
{
|
|
||||||
if(mProtocol != null)
|
|
||||||
{
|
|
||||||
mProtocol.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mToTalkgroup != null)
|
|
||||||
{
|
|
||||||
mToTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mToTalkgroupAlias != null)
|
|
||||||
{
|
|
||||||
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mSiteAndChannel != null)
|
|
||||||
{
|
|
||||||
mSiteAndChannel.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mFromTalkgroup != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
if(mFromTalkgroupAlias != null)
|
|
||||||
{
|
|
||||||
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,9 +14,26 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.passport;
|
package module.decode.passport;
|
||||||
|
|
||||||
|
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 module.decode.event.CallEvent;
|
||||||
|
import module.decode.event.CallEvent.CallEventType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -25,28 +42,10 @@ import java.util.Iterator;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import module.decode.event.CallEvent;
|
|
||||||
import module.decode.event.CallEvent.CallEventType;
|
|
||||||
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;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
|
|
||||||
public class PassportDecoderState extends DecoderState
|
public class PassportDecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( PassportDecoderState.class );
|
LoggerFactory.getLogger(PassportDecoderState.class);
|
||||||
|
|
||||||
private HashSet<String> mTalkgroupsFirstHeard = new HashSet<String>();
|
private HashSet<String> mTalkgroupsFirstHeard = new HashSet<String>();
|
||||||
private TreeSet<String> mTalkgroups = new TreeSet<String>();
|
private TreeSet<String> mTalkgroups = new TreeSet<String>();
|
||||||
@@ -64,9 +63,9 @@ public class PassportDecoderState extends DecoderState
|
|||||||
private HashMap<Integer,String> mActiveCalls = new HashMap<Integer,String>();
|
private HashMap<Integer,String> mActiveCalls = new HashMap<Integer,String>();
|
||||||
private long mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public PassportDecoderState( AliasList aliasList )
|
public PassportDecoderState(AliasList aliasList)
|
||||||
{
|
{
|
||||||
super( aliasList );
|
super(aliasList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,7 +75,7 @@ public class PassportDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,308 +89,283 @@ public class PassportDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logTalkgroup( String talkgroup )
|
private void logTalkgroup(String talkgroup)
|
||||||
{
|
{
|
||||||
if( mTalkgroupsFirstHeard.contains( talkgroup ) )
|
if(mTalkgroupsFirstHeard.contains(talkgroup))
|
||||||
{
|
{
|
||||||
mTalkgroups.add( talkgroup );
|
mTalkgroups.add(talkgroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTalkgroupsFirstHeard.add( talkgroup );
|
mTalkgroupsFirstHeard.add(talkgroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PassportCallEvent getCurrentCallEvent()
|
private PassportCallEvent getCurrentCallEvent()
|
||||||
{
|
{
|
||||||
return (PassportCallEvent)mCurrentCallEvent;
|
return (PassportCallEvent) mCurrentCallEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the talkgroup is different than the talkgroup specified in
|
* Indicates if the talkgroup is different than the talkgroup specified in
|
||||||
* the current call event
|
* the current call event
|
||||||
*/
|
*/
|
||||||
private boolean isDifferentTalkgroup( String talkgroup )
|
private boolean isDifferentTalkgroup(String talkgroup)
|
||||||
{
|
{
|
||||||
return talkgroup != null &&
|
return talkgroup != null &&
|
||||||
mCurrentCallEvent != null &&
|
mCurrentCallEvent != null &&
|
||||||
mCurrentCallEvent.getToID() != null &&
|
mCurrentCallEvent.getToID() != null &&
|
||||||
!mCurrentCallEvent.getToID().contentEquals( talkgroup );
|
!mCurrentCallEvent.getToID().contentEquals(talkgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if( message instanceof PassportMessage )
|
if(message instanceof PassportMessage)
|
||||||
{
|
{
|
||||||
PassportMessage passport = (PassportMessage)message;
|
PassportMessage passport = (PassportMessage) message;
|
||||||
|
|
||||||
if( passport.isValid() )
|
if(passport.isValid())
|
||||||
{
|
{
|
||||||
switch( passport.getMessageType() )
|
switch(passport.getMessageType())
|
||||||
{
|
{
|
||||||
case CA_STRT:
|
case CA_STRT:
|
||||||
mSiteLCNs.put( passport.getLCN(),
|
mSiteLCNs.put(passport.getLCN(),
|
||||||
passport.getLCNFrequencyFormatted() );
|
passport.getLCNFrequencyFormatted());
|
||||||
|
|
||||||
String talkgroup =
|
String talkgroup =
|
||||||
String.valueOf( passport.getTalkgroupID() );
|
String.valueOf(passport.getTalkgroupID());
|
||||||
|
|
||||||
logTalkgroup( talkgroup );
|
logTalkgroup(talkgroup);
|
||||||
|
|
||||||
if( mChannelNumber == 0 )
|
if(mChannelNumber == 0)
|
||||||
{
|
{
|
||||||
mChannelNumber = passport.getLCN();
|
setChannelNumber(passport.getLCN());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call on this channel */
|
/* Call on this channel */
|
||||||
if( passport.getLCN() == mChannelNumber )
|
if(passport.getLCN() == mChannelNumber)
|
||||||
{
|
{
|
||||||
setTalkgroup( talkgroup );
|
setTalkgroup(talkgroup);
|
||||||
|
|
||||||
setTalkgroupAlias( passport.getTalkgroupIDAlias() );
|
|
||||||
|
|
||||||
PassportCallEvent current = getCurrentCallEvent();
|
PassportCallEvent current = getCurrentCallEvent();
|
||||||
|
|
||||||
/* If we're already in a call event, add the message
|
/* If we're already in a call event, add the message
|
||||||
* to the current call event ... if false, then we
|
* to the current call event ... if false, then we
|
||||||
* have a different call ... cleanup the old one. */
|
* have a different call ... cleanup the old one. */
|
||||||
if( current != null && isDifferentTalkgroup( talkgroup ) )
|
if(current != null && isDifferentTalkgroup(talkgroup))
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.end();
|
mCurrentCallEvent.end();
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mCurrentCallEvent == null )
|
if(mCurrentCallEvent == null)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new PassportCallEvent
|
mCurrentCallEvent = new PassportCallEvent
|
||||||
.Builder( CallEventType.CALL )
|
.Builder(CallEventType.CALL)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.frequency( passport.getLCNFrequency() )
|
.frequency(passport.getLCNFrequency())
|
||||||
.to( String.valueOf( passport.getTalkgroupID() ) )
|
.to(String.valueOf(passport.getTalkgroupID()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
|
|
||||||
broadcast( new Metadata( MetadataType.TO,
|
broadcast(new DecoderStateEvent(this,
|
||||||
mTalkgroup, mTalkgroupAlias, true ) );
|
Event.START, State.CALL));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this,
|
|
||||||
Event.START, State.CALL ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
broadcast( new DecoderStateEvent( this,
|
broadcast(new DecoderStateEvent(this,
|
||||||
Event.CONTINUATION, State.CALL ) );
|
Event.CONTINUATION, State.CALL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Call Detection
|
//Call Detection
|
||||||
int lcn = passport.getLCN();
|
int lcn = passport.getLCN();
|
||||||
String tg = String.valueOf( passport.getTalkgroupID() );
|
String tg = String.valueOf(passport.getTalkgroupID());
|
||||||
|
|
||||||
if( !mActiveCalls.containsKey( lcn ) ||
|
if(!mActiveCalls.containsKey(lcn) ||
|
||||||
!mActiveCalls.get( lcn ).contentEquals( tg ) )
|
!mActiveCalls.get(lcn).contentEquals(tg))
|
||||||
{
|
{
|
||||||
mActiveCalls.put( lcn, tg );
|
mActiveCalls.put(lcn, tg);
|
||||||
|
|
||||||
broadcast( new PassportCallEvent
|
broadcast(new PassportCallEvent
|
||||||
.Builder( CallEventType.CALL_DETECT )
|
.Builder(CallEventType.CALL_DETECT)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( lcn ) )
|
.channel(String.valueOf(lcn))
|
||||||
.details( "Site: " + passport.getSite() )
|
.details("Site: " + passport.getSite())
|
||||||
.frequency( passport.getLCNFrequency() )
|
.frequency(passport.getLCNFrequency())
|
||||||
.to( tg )
|
.to(tg)
|
||||||
.build() );
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CA_ENDD:
|
case CA_ENDD:
|
||||||
String endTalkgroup =
|
String endTalkgroup =
|
||||||
String.valueOf( passport.getTalkgroupID() );
|
String.valueOf(passport.getTalkgroupID());
|
||||||
|
|
||||||
logTalkgroup( endTalkgroup );
|
logTalkgroup(endTalkgroup);
|
||||||
setTalkgroup( endTalkgroup );
|
setTalkgroup(endTalkgroup);
|
||||||
|
|
||||||
setTalkgroupAlias( passport.getTalkgroupIDAlias() );
|
broadcast(new DecoderStateEvent(this,
|
||||||
|
Event.END, State.CALL));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this,
|
if(mCurrentCallEvent != null)
|
||||||
Event.END, State.CALL ) );
|
|
||||||
|
|
||||||
if( mCurrentCallEvent != null )
|
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.end();
|
mCurrentCallEvent.end();
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.RESET, State.FADE ) );
|
broadcast(new DecoderStateEvent(this, Event.RESET, State.FADE));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DA_STRT:
|
case DA_STRT:
|
||||||
mSiteLCNs.put( passport.getLCN(),
|
mSiteLCNs.put(passport.getLCN(),
|
||||||
passport.getLCNFrequencyFormatted() );
|
passport.getLCNFrequencyFormatted());
|
||||||
|
|
||||||
String dataTalkgroup =
|
String dataTalkgroup =
|
||||||
String.valueOf( passport.getTalkgroupID() );
|
String.valueOf(passport.getTalkgroupID());
|
||||||
|
|
||||||
logTalkgroup( dataTalkgroup );
|
logTalkgroup(dataTalkgroup);
|
||||||
|
|
||||||
if( mChannelNumber == 0 )
|
if(mChannelNumber == 0)
|
||||||
{
|
{
|
||||||
mChannelNumber = passport.getLCN();
|
setChannelNumber(passport.getLCN());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data call on this channel */
|
/* Data call on this channel */
|
||||||
if( passport.getLCN() == mChannelNumber )
|
if(passport.getLCN() == mChannelNumber)
|
||||||
{
|
{
|
||||||
setTalkgroup( dataTalkgroup );
|
setTalkgroup(dataTalkgroup);
|
||||||
|
|
||||||
setTalkgroupAlias( passport.getTalkgroupIDAlias() );
|
|
||||||
|
|
||||||
PassportCallEvent current = getCurrentCallEvent();
|
PassportCallEvent current = getCurrentCallEvent();
|
||||||
|
|
||||||
/* If we're already in a call event, add the message
|
/* If we're already in a call event, add the message
|
||||||
* to the current call event ... if false, then we
|
* to the current call event ... if false, then we
|
||||||
* have a different call ... cleanup the old one. */
|
* have a different call ... cleanup the old one. */
|
||||||
if( current != null && isDifferentTalkgroup( dataTalkgroup ) )
|
if(current != null && isDifferentTalkgroup(dataTalkgroup))
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.end();
|
mCurrentCallEvent.end();
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mCurrentCallEvent == null )
|
if(mCurrentCallEvent == null)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new PassportCallEvent
|
mCurrentCallEvent = new PassportCallEvent
|
||||||
.Builder( CallEventType.DATA_CALL )
|
.Builder(CallEventType.DATA_CALL)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( mChannelNumber ) )
|
.channel(String.valueOf(mChannelNumber))
|
||||||
.frequency( passport.getLCNFrequency() )
|
.frequency(passport.getLCNFrequency())
|
||||||
.to( String.valueOf( passport.getTalkgroupID() ) )
|
.to(String.valueOf(passport.getTalkgroupID()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
|
|
||||||
broadcast( new Metadata( MetadataType.TO,
|
broadcast(new DecoderStateEvent(this,
|
||||||
mTalkgroup, mTalkgroupAlias, true ) );
|
Event.START, State.DATA));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this,
|
|
||||||
Event.START, State.DATA ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
broadcast( new DecoderStateEvent( this,
|
broadcast(new DecoderStateEvent(this,
|
||||||
Event.CONTINUATION, State.DATA ) );
|
Event.CONTINUATION, State.DATA));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Call Detection
|
//Call Detection
|
||||||
int lcn = passport.getLCN();
|
int lcn = passport.getLCN();
|
||||||
String tg = String.valueOf( passport.getTalkgroupID() );
|
String tg = String.valueOf(passport.getTalkgroupID());
|
||||||
|
|
||||||
if( !mActiveCalls.containsKey( lcn ) ||
|
if(!mActiveCalls.containsKey(lcn) ||
|
||||||
!mActiveCalls.get( lcn ).contentEquals( tg ) )
|
!mActiveCalls.get(lcn).contentEquals(tg))
|
||||||
{
|
{
|
||||||
mActiveCalls.put( lcn, tg );
|
mActiveCalls.put(lcn, tg);
|
||||||
|
|
||||||
broadcast( new PassportCallEvent
|
broadcast(new PassportCallEvent
|
||||||
.Builder( CallEventType.DATA_CALL )
|
.Builder(CallEventType.DATA_CALL)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( lcn ) )
|
.channel(String.valueOf(lcn))
|
||||||
.details( "Site: " + passport.getSite() )
|
.details("Site: " + passport.getSite())
|
||||||
.frequency( passport.getLCNFrequency() )
|
.frequency(passport.getLCNFrequency())
|
||||||
.to( tg )
|
.to(tg)
|
||||||
.build() );
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DA_ENDD:
|
case DA_ENDD:
|
||||||
String dataEndTalkgroup =
|
String dataEndTalkgroup =
|
||||||
String.valueOf( passport.getTalkgroupID() );
|
String.valueOf(passport.getTalkgroupID());
|
||||||
|
|
||||||
logTalkgroup( dataEndTalkgroup );
|
logTalkgroup(dataEndTalkgroup);
|
||||||
setTalkgroup( dataEndTalkgroup );
|
setTalkgroup(dataEndTalkgroup);
|
||||||
|
|
||||||
setTalkgroupAlias( passport.getTalkgroupIDAlias() );
|
broadcast(new DecoderStateEvent(this,
|
||||||
|
Event.END, State.DATA));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this,
|
if(mCurrentCallEvent != null)
|
||||||
Event.END, State.DATA ) );
|
|
||||||
|
|
||||||
if( mCurrentCallEvent != null )
|
|
||||||
{
|
{
|
||||||
mCurrentCallEvent.end();
|
mCurrentCallEvent.end();
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.RESET, State.FADE ) );
|
broadcast(new DecoderStateEvent(this, Event.RESET, State.FADE));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_RDIO:
|
case ID_RDIO:
|
||||||
String min = passport.getMobileID();
|
String min = passport.getMobileID();
|
||||||
|
|
||||||
if( min != null )
|
if(min != null)
|
||||||
{
|
{
|
||||||
mMobileIDs.add( min );
|
mMobileIDs.add(min);
|
||||||
}
|
}
|
||||||
|
|
||||||
setMobileID( min );
|
setMobileID(min);
|
||||||
setMobileIDAlias( passport.getMobileIDAlias() );
|
|
||||||
|
|
||||||
broadcast( new Metadata( MetadataType.FROM,
|
|
||||||
mMobileID, mMobileIDAlias, true ) );
|
|
||||||
|
|
||||||
final CallEvent current = getCurrentCallEvent();
|
final CallEvent current = getCurrentCallEvent();
|
||||||
|
|
||||||
if( current != null )
|
if(current != null)
|
||||||
{
|
{
|
||||||
current.setFromID( min );
|
current.setFromID(min);
|
||||||
broadcast( current );
|
broadcast(current);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RA_REGI:
|
case RA_REGI:
|
||||||
if( mCurrentCallEvent == null ||
|
if(mCurrentCallEvent == null ||
|
||||||
mCurrentCallEvent.getCallEventType() != CallEventType.REGISTER )
|
mCurrentCallEvent.getCallEventType() != CallEventType.REGISTER)
|
||||||
{
|
{
|
||||||
mCurrentCallEvent = new PassportCallEvent
|
mCurrentCallEvent = new PassportCallEvent
|
||||||
.Builder( CallEventType.REGISTER )
|
.Builder(CallEventType.REGISTER)
|
||||||
.aliasList( getAliasList() )
|
.aliasList(getAliasList())
|
||||||
.channel( String.valueOf( passport.getLCN() ) )
|
.channel(String.valueOf(passport.getLCN()))
|
||||||
.frequency( passport.getLCNFrequency() )
|
.frequency(passport.getLCNFrequency())
|
||||||
.to( passport.getToID() )
|
.to(passport.getToID())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast(mCurrentCallEvent);
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this,
|
broadcast(new DecoderStateEvent(this,
|
||||||
Event.START, State.DATA ) );
|
Event.START, State.DATA));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
broadcast( new DecoderStateEvent( this,
|
broadcast(new DecoderStateEvent(this,
|
||||||
Event.CONTINUATION, State.DATA ) );
|
Event.CONTINUATION, State.DATA));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SY_IDLE:
|
case SY_IDLE:
|
||||||
if( passport.getFree() != 0 )
|
if(passport.getFree() != 0)
|
||||||
{
|
{
|
||||||
mNeighborLCNs.put( passport.getFree(),
|
mNeighborLCNs.put(passport.getFree(),
|
||||||
passport.getFreeFrequencyFormatted() );
|
passport.getFreeFrequencyFormatted());
|
||||||
}
|
}
|
||||||
|
setSiteNumber(passport.getSite());
|
||||||
|
|
||||||
PassportBand band = passport.getSiteBand();
|
PassportBand band = passport.getSiteBand();
|
||||||
|
setSiteBand(band);
|
||||||
if( mSiteBand == null || mSiteBand != band )
|
setChannelNumber(getSiteBand().getChannel(mFrequency));
|
||||||
{
|
|
||||||
mSiteBand = band;
|
|
||||||
|
|
||||||
mSiteNumber = passport.getSite();
|
|
||||||
|
|
||||||
mChannelNumber = mSiteBand.getChannel( mFrequency );
|
|
||||||
|
|
||||||
broadcast( Attribute.CHANNEL_NUMBER );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -400,17 +374,17 @@ public class PassportDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatTalkgroup( String talkgroup )
|
public static String formatTalkgroup(String talkgroup)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if( talkgroup.length() == 6 )
|
if(talkgroup.length() == 6)
|
||||||
{
|
{
|
||||||
sb.append( talkgroup.substring( 0, 1 ) );
|
sb.append(talkgroup.substring(0, 1));
|
||||||
sb.append( "-" );
|
sb.append("-");
|
||||||
sb.append( talkgroup.substring( 1, 3 ) );
|
sb.append(talkgroup.substring(1, 3));
|
||||||
sb.append( "-" );
|
sb.append("-");
|
||||||
sb.append( talkgroup.substring( 3, 6 ) );
|
sb.append(talkgroup.substring(3, 6));
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@@ -425,107 +399,107 @@ public class PassportDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "Activity Summary\n" );
|
sb.append("Activity Summary\n");
|
||||||
sb.append( "Decoder:\tPassport\n\n" );
|
sb.append("Decoder:\tPassport\n\n");
|
||||||
sb.append( "Site Channels\n" );
|
sb.append("Site Channels\n");
|
||||||
|
|
||||||
if( mSiteLCNs.isEmpty() )
|
if(mSiteLCNs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ArrayList<Integer> channels = new ArrayList<>( mSiteLCNs.keySet() );
|
ArrayList<Integer> channels = new ArrayList<>(mSiteLCNs.keySet());
|
||||||
Collections.sort( channels );
|
Collections.sort(channels);
|
||||||
|
|
||||||
for( Integer channel: channels )
|
for(Integer channel : channels)
|
||||||
{
|
{
|
||||||
sb.append( " " + channel );
|
sb.append(" " + channel);
|
||||||
sb.append( "\t" + mSiteLCNs.get( channel ) );
|
sb.append("\t" + mSiteLCNs.get(channel));
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\nNeighbor Channels\n" );
|
sb.append("\nNeighbor Channels\n");
|
||||||
|
|
||||||
if( mNeighborLCNs.isEmpty() )
|
if(mNeighborLCNs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ArrayList<Integer> channels = new ArrayList<>( mNeighborLCNs.keySet() );
|
ArrayList<Integer> channels = new ArrayList<>(mNeighborLCNs.keySet());
|
||||||
Collections.sort( channels );
|
Collections.sort(channels);
|
||||||
|
|
||||||
for( Integer channel: channels )
|
for(Integer channel : channels)
|
||||||
{
|
{
|
||||||
sb.append( " " + channel );
|
sb.append(" " + channel);
|
||||||
sb.append( "\t" + mNeighborLCNs.get( channel ) );
|
sb.append("\t" + mNeighborLCNs.get(channel));
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\nTalkgroups\n" );
|
sb.append("\nTalkgroups\n");
|
||||||
|
|
||||||
if( mTalkgroups.isEmpty() )
|
if(mTalkgroups.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Iterator<String> it = mTalkgroups.iterator();
|
Iterator<String> it = mTalkgroups.iterator();
|
||||||
|
|
||||||
while( it.hasNext() )
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String tgid = it.next();
|
String tgid = it.next();
|
||||||
|
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( tgid );
|
sb.append(tgid);
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getTalkgroupAlias( tgid );
|
Alias alias = getAliasList().getTalkgroupAlias(tgid);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\nMobile ID Numbers\n" );
|
sb.append("\nMobile ID Numbers\n");
|
||||||
|
|
||||||
if( mMobileIDs.isEmpty() )
|
if(mMobileIDs.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( " None\n" );
|
sb.append(" None\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Iterator<String> it = mMobileIDs.iterator();
|
Iterator<String> it = mMobileIDs.iterator();
|
||||||
|
|
||||||
while( it.hasNext() )
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
String min = it.next();
|
String min = it.next();
|
||||||
|
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
sb.append( min );
|
sb.append(min);
|
||||||
sb.append( " " );
|
sb.append(" ");
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getMobileIDNumberAlias( min );
|
Alias alias = getAliasList().getMobileIDNumberAlias(min);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,11 +519,10 @@ public class PassportDecoderState extends DecoderState
|
|||||||
|
|
||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
setTalkgroup( null );
|
mTalkgroup = null;
|
||||||
setTalkgroupAlias( null );
|
mTalkgroupAlias = null;
|
||||||
|
mMobileID = null;
|
||||||
setMobileID( null );
|
mMobileIDAlias = null;
|
||||||
setMobileIDAlias( null );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getChannelNumber()
|
public int getChannelNumber()
|
||||||
@@ -557,20 +530,58 @@ public class PassportDecoderState extends DecoderState
|
|||||||
return mChannelNumber;
|
return mChannelNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setChannelNumber(int channel)
|
||||||
|
{
|
||||||
|
if(mChannelNumber != channel)
|
||||||
|
{
|
||||||
|
mChannelNumber = channel;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, "CHAN:" + mChannelNumber));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getSiteNumber()
|
public int getSiteNumber()
|
||||||
{
|
{
|
||||||
return mSiteNumber;
|
return mSiteNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setSiteNumber(int site)
|
||||||
|
{
|
||||||
|
if(mSiteNumber != site)
|
||||||
|
{
|
||||||
|
mSiteNumber = site;
|
||||||
|
Alias alias = hasAliasList() ? getAliasList().getSiteID(String.valueOf(getSiteNumber())) : null;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.NETWORK_ID_1, "SITE:" + mSiteNumber, alias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PassportBand getSiteBand()
|
||||||
|
{
|
||||||
|
return mSiteBand;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSiteBand(PassportBand band)
|
||||||
|
{
|
||||||
|
if(mSiteBand == null)
|
||||||
|
{
|
||||||
|
mSiteBand = band;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.NETWORK_ID_2, "BAND:" + band.getDescription()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getTalkgroup()
|
public String getTalkgroup()
|
||||||
{
|
{
|
||||||
return mTalkgroup;
|
return mTalkgroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTalkgroup( String talkgroup )
|
public void setTalkgroup(String talkgroup)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mTalkgroup, talkgroup))
|
||||||
{
|
{
|
||||||
mTalkgroup = talkgroup;
|
mTalkgroup = talkgroup;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
mTalkgroupAlias = hasAliasList() ? getAliasList().getTalkgroupAlias(getTalkgroup()) : null;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, getTalkgroup(),
|
||||||
|
getTalkgroupAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getTalkgroupAlias()
|
public Alias getTalkgroupAlias()
|
||||||
@@ -578,21 +589,20 @@ public class PassportDecoderState extends DecoderState
|
|||||||
return mTalkgroupAlias;
|
return mTalkgroupAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTalkgroupAlias( Alias alias )
|
|
||||||
{
|
|
||||||
mTalkgroupAlias = alias;
|
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobileID()
|
public String getMobileID()
|
||||||
{
|
{
|
||||||
return mMobileID;
|
return mMobileID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMobileID( String id )
|
public void setMobileID(String id)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMobileID, id))
|
||||||
{
|
{
|
||||||
mMobileID = id;
|
mMobileID = id;
|
||||||
broadcast( Attribute.FROM_TALKGROUP );
|
mMobileIDAlias = hasAliasList() ? getAliasList().getMobileIDNumberAlias(getMobileID()) : null;
|
||||||
|
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, getMobileID(),
|
||||||
|
getMobileIDAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getMobileIDAlias()
|
public Alias getMobileIDAlias()
|
||||||
@@ -600,22 +610,17 @@ public class PassportDecoderState extends DecoderState
|
|||||||
return mMobileIDAlias;
|
return mMobileIDAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMobileIDAlias( Alias alias )
|
|
||||||
{
|
|
||||||
mMobileIDAlias = alias;
|
|
||||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case RESET:
|
case RESET:
|
||||||
resetState();
|
resetState();
|
||||||
break;
|
break;
|
||||||
case SOURCE_FREQUENCY:
|
case SOURCE_FREQUENCY:
|
||||||
mFrequency = event.getFrequency();
|
mFrequency = event.getFrequency();
|
||||||
|
broadcast(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, mFrequency));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,180 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* 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.tait;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import icon.IconManager;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderPanel;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.Setting;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class Tait1200DecoderPanel extends DecoderPanel
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private static final String PROTOCOL = "TAIT-1200";
|
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel(" ");
|
|
||||||
private JLabel mFrom = new JLabel();
|
|
||||||
private JLabel mFromAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel();
|
|
||||||
private JLabel mTo = new JLabel(" ");
|
|
||||||
private JLabel mToAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel(PROTOCOL);
|
|
||||||
private JLabel mMessage = new JLabel();
|
|
||||||
private JLabel mMessageType = new JLabel();
|
|
||||||
|
|
||||||
public Tait1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, Tait1200DecoderState decoderState)
|
|
||||||
{
|
|
||||||
super(iconManager, settingsManager, decoderState);
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tait1200DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (Tait1200DecoderState) super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
|
||||||
|
|
||||||
add(mFromLabel);
|
|
||||||
add(mFrom);
|
|
||||||
add(mFromAlias, "wrap");
|
|
||||||
|
|
||||||
add(mToLabel);
|
|
||||||
add(mTo);
|
|
||||||
add(mToAlias, "wrap");
|
|
||||||
|
|
||||||
add(mProtocol);
|
|
||||||
add(mMessageType);
|
|
||||||
add(mMessage, "wrap");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive(final Attribute attribute)
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
switch(attribute)
|
|
||||||
{
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
String from = getDecoderState().getFromID();
|
|
||||||
|
|
||||||
if(from != null)
|
|
||||||
{
|
|
||||||
mFromLabel.setText("FM:");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromLabel.setText(" ");
|
|
||||||
}
|
|
||||||
mFrom.setText(from);
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
Alias fromAlias = getDecoderState().getFromIDAlias();
|
|
||||||
|
|
||||||
if(fromAlias != null)
|
|
||||||
{
|
|
||||||
mFromAlias.setText(fromAlias.getName());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String to = getDecoderState().getToID();
|
|
||||||
|
|
||||||
if(to != null)
|
|
||||||
{
|
|
||||||
mToLabel.setText("TO:");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToLabel.setText(" ");
|
|
||||||
}
|
|
||||||
mTo.setText(to);
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias toAlias = getDecoderState().getToIDAlias();
|
|
||||||
|
|
||||||
if(toAlias != null)
|
|
||||||
{
|
|
||||||
mToAlias.setText(toAlias.getName());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MESSAGE:
|
|
||||||
mMessage.setText(getDecoderState().getMessage());
|
|
||||||
break;
|
|
||||||
case MESSAGE_TYPE:
|
|
||||||
mMessageType.setText(getDecoderState().getMessageType());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged(Setting setting)
|
|
||||||
{
|
|
||||||
super.settingChanged(setting);
|
|
||||||
|
|
||||||
if(setting instanceof ColorSetting)
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting) setting;
|
|
||||||
|
|
||||||
if(color.getColorSettingName() ==
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
|
||||||
{
|
|
||||||
mFromLabel.setForeground(color.getColor());
|
|
||||||
mFrom.setForeground(color.getColor());
|
|
||||||
mFromAlias.setForeground(color.getColor());
|
|
||||||
mToLabel.setForeground(color.getColor());
|
|
||||||
mTo.setForeground(color.getColor());
|
|
||||||
mToAlias.setForeground(color.getColor());
|
|
||||||
mProtocol.setForeground(color.getColor());
|
|
||||||
mMessageType.setForeground(color.getColor());
|
|
||||||
mMessage.setForeground(color.getColor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,28 +14,30 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.tait;
|
package module.decode.tait;
|
||||||
|
|
||||||
|
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 module.decode.event.CallEvent.CallEventType;
|
||||||
|
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||||
|
import util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import module.decode.event.CallEvent.CallEventType;
|
|
||||||
import channel.metadata.Attribute;
|
|
||||||
import channel.state.DecoderState;
|
|
||||||
import channel.state.DecoderStateEvent;
|
|
||||||
import channel.state.State;
|
|
||||||
import channel.state.DecoderStateEvent.Event;
|
|
||||||
import alias.Alias;
|
|
||||||
import alias.AliasList;
|
|
||||||
|
|
||||||
public class Tait1200DecoderState extends DecoderState
|
public class Tait1200DecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||||
@@ -49,9 +51,9 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
private String mMessage;
|
private String mMessage;
|
||||||
private String mMessageType;
|
private String mMessageType;
|
||||||
|
|
||||||
public Tait1200DecoderState( AliasList aliasList )
|
public Tait1200DecoderState(AliasList aliasList)
|
||||||
{
|
{
|
||||||
super( aliasList );
|
super(aliasList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -61,7 +63,7 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start( ScheduledExecutorService executor )
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,63 +82,63 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
|
|
||||||
private void resetState()
|
private void resetState()
|
||||||
{
|
{
|
||||||
setFromID( null );
|
mFrom = null;
|
||||||
setFromIDAlias( null );
|
mFromAlias = null;
|
||||||
setToID( null );
|
mTo = null;
|
||||||
setToIDAlias( null );
|
mToAlias = null;
|
||||||
setMessage( null );
|
mMessage = null;
|
||||||
setMessageType( null );
|
mMessageType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive(Message message)
|
||||||
{
|
{
|
||||||
if( message instanceof Tait1200GPSMessage )
|
if(message instanceof Tait1200GPSMessage)
|
||||||
{
|
{
|
||||||
Tait1200GPSMessage gps = (Tait1200GPSMessage)message;
|
Tait1200GPSMessage gps = (Tait1200GPSMessage) message;
|
||||||
|
|
||||||
setFromID( gps.getFromID() );
|
setFromID(gps.getFromID());
|
||||||
setFromIDAlias( gps.getFromIDAlias() );
|
setFromIDAlias(gps.getFromIDAlias());
|
||||||
mIdents.add( gps.getFromID() );
|
mIdents.add(gps.getFromID());
|
||||||
|
|
||||||
setToID( gps.getToID() );
|
setToID(gps.getToID());
|
||||||
setToIDAlias( gps.getToIDAlias() );
|
setToIDAlias(gps.getToIDAlias());
|
||||||
mIdents.add( gps.getToID());
|
mIdents.add(gps.getToID());
|
||||||
|
|
||||||
GeoPosition position = gps.getGPSLocation();
|
GeoPosition position = gps.getGPSLocation();
|
||||||
|
|
||||||
if( position != null )
|
if(position != null)
|
||||||
{
|
{
|
||||||
setMessage( gps.getGPSLocation().toString().replace( "[", "" )
|
setMessage(gps.getGPSLocation().toString().replace("[", "")
|
||||||
.replace( "]", "" ) );
|
.replace("]", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
setMessageType( "GPS" );
|
setMessageType("GPS");
|
||||||
|
|
||||||
broadcast( new Tait1200CallEvent( CallEventType.GPS, getAliasList(),
|
broadcast(new Tait1200CallEvent(CallEventType.GPS, getAliasList(),
|
||||||
gps.getFromID(), gps.getToID(), gps.getGPSLocation().toString() ) );
|
gps.getFromID(), gps.getToID(), gps.getGPSLocation().toString()));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||||
}
|
}
|
||||||
else if( message instanceof Tait1200ANIMessage )
|
else if(message instanceof Tait1200ANIMessage)
|
||||||
{
|
{
|
||||||
Tait1200ANIMessage ani = (Tait1200ANIMessage)message;
|
Tait1200ANIMessage ani = (Tait1200ANIMessage) message;
|
||||||
|
|
||||||
setFromID( ani.getFromID() );
|
setFromID(ani.getFromID());
|
||||||
setFromIDAlias( ani.getFromIDAlias() );
|
setFromIDAlias(ani.getFromIDAlias());
|
||||||
mIdents.add( ani.getFromID() );
|
mIdents.add(ani.getFromID());
|
||||||
|
|
||||||
setToID( ani.getToID() );
|
setToID(ani.getToID());
|
||||||
setToIDAlias( ani.getToIDAlias() );
|
setToIDAlias(ani.getToIDAlias());
|
||||||
mIdents.add( ani.getToID());
|
mIdents.add(ani.getToID());
|
||||||
|
|
||||||
setMessage( null );
|
setMessage(null);
|
||||||
setMessageType( "ANI" );
|
setMessageType("ANI");
|
||||||
|
|
||||||
broadcast( new Tait1200CallEvent( CallEventType.ID_ANI, getAliasList(),
|
broadcast(new Tait1200CallEvent(CallEventType.ID_ANI, getAliasList(),
|
||||||
ani.getFromID(), ani.getToID(), "ANI" ) );
|
ani.getFromID(), ani.getToID(), "ANI"));
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.CALL ) );
|
broadcast(new DecoderStateEvent(this, Event.DECODE, State.CALL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,33 +147,33 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append( "=============================\n" );
|
sb.append("=============================\n");
|
||||||
sb.append( "Decoder:\tTait-1200I\n\n" );
|
sb.append("Decoder:\tTait-1200I\n\n");
|
||||||
|
|
||||||
if( !mIdents.isEmpty() )
|
if(!mIdents.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append( "Radio Identifiers:\n" );
|
sb.append("Radio Identifiers:\n");
|
||||||
|
|
||||||
List<String> idents = new ArrayList<String>( mIdents );
|
List<String> idents = new ArrayList<String>(mIdents);
|
||||||
|
|
||||||
Collections.sort( idents );
|
Collections.sort(idents);
|
||||||
|
|
||||||
for( String ident: idents )
|
for(String ident : idents)
|
||||||
{
|
{
|
||||||
sb.append( "\t" );
|
sb.append("\t");
|
||||||
sb.append( ident );
|
sb.append(ident);
|
||||||
|
|
||||||
if( hasAliasList() )
|
if(hasAliasList())
|
||||||
{
|
{
|
||||||
Alias alias = getAliasList().getTalkgroupAlias( ident );
|
Alias alias = getAliasList().getTalkgroupAlias(ident);
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
sb.append( "\t" );
|
sb.append("\t");
|
||||||
sb.append( alias.getName() );
|
sb.append(alias.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append( "\n" );
|
sb.append("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,9 +190,9 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
* Responds to reset events issued by the channel state
|
* Responds to reset events issued by the channel state
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
{
|
||||||
case RESET:
|
case RESET:
|
||||||
resetState();
|
resetState();
|
||||||
@@ -205,10 +207,13 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
return mFrom;
|
return mFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFromID( String from )
|
public void setFromID(String from)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mFrom, from))
|
||||||
{
|
{
|
||||||
mFrom = from;
|
mFrom = from;
|
||||||
broadcast( Attribute.FROM_TALKGROUP );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, getFromID(), getFromIDAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getFromIDAlias()
|
public Alias getFromIDAlias()
|
||||||
@@ -216,10 +221,13 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
return mFromAlias;
|
return mFromAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFromIDAlias( Alias alias )
|
public void setFromIDAlias(Alias alias)
|
||||||
|
{
|
||||||
|
if(mFromAlias == null || (alias != null && mFromAlias != alias))
|
||||||
{
|
{
|
||||||
mFromAlias = alias;
|
mFromAlias = alias;
|
||||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, getFromID(), getFromIDAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToID()
|
public String getToID()
|
||||||
@@ -227,10 +235,13 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
return mTo;
|
return mTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToID( String to )
|
public void setToID(String to)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mTo, to))
|
||||||
{
|
{
|
||||||
mTo = to;
|
mTo = to;
|
||||||
broadcast( Attribute.TO_TALKGROUP );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, getToID(), getToIDAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getToIDAlias()
|
public Alias getToIDAlias()
|
||||||
@@ -238,10 +249,13 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
return mToAlias;
|
return mToAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToIDAlias( Alias alias )
|
public void setToIDAlias(Alias alias)
|
||||||
|
{
|
||||||
|
if(mToAlias == null || (alias != null && mToAlias != alias))
|
||||||
{
|
{
|
||||||
mToAlias = alias;
|
mToAlias = alias;
|
||||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, getToID(), getToIDAlias()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage()
|
public String getMessage()
|
||||||
@@ -249,10 +263,13 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
return mMessage;
|
return mMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage( String message )
|
public void setMessage(String message)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessage, message))
|
||||||
{
|
{
|
||||||
mMessage = message;
|
mMessage = message;
|
||||||
broadcast( Attribute.MESSAGE );
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, getMessage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessageType()
|
public String getMessageType()
|
||||||
@@ -260,9 +277,12 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
return mMessageType;
|
return mMessageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageType( String type )
|
public void setMessageType(String type)
|
||||||
|
{
|
||||||
|
if(!StringUtils.isEqual(mMessageType, type))
|
||||||
{
|
{
|
||||||
mMessageType = type;
|
mMessageType = type;
|
||||||
broadcast( Attribute.MESSAGE_TYPE );
|
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, getMessageType()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,19 +17,6 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package playlist.version1;
|
package playlist.version1;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
|
||||||
|
|
||||||
import module.decode.lj1200.LJ1200Message.Function;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
import alias.action.AliasAction;
|
import alias.action.AliasAction;
|
||||||
import alias.action.beep.BeepAction;
|
import alias.action.beep.BeepAction;
|
||||||
@@ -48,9 +35,18 @@ import alias.id.siteID.SiteID;
|
|||||||
import alias.id.status.StatusID;
|
import alias.id.status.StatusID;
|
||||||
import alias.id.talkgroup.TalkgroupID;
|
import alias.id.talkgroup.TalkgroupID;
|
||||||
import alias.id.uniqueID.UniqueID;
|
import alias.id.uniqueID.UniqueID;
|
||||||
import audio.metadata.MetadataType;
|
import module.decode.lj1200.LJ1200Message.Function;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@XmlSeeAlso( { Alias.class,
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@XmlSeeAlso({Alias.class,
|
||||||
|
|
||||||
/* Alias ID's */
|
/* Alias ID's */
|
||||||
AliasID.class,
|
AliasID.class,
|
||||||
@@ -74,13 +70,13 @@ import audio.metadata.MetadataType;
|
|||||||
AliasAction.class,
|
AliasAction.class,
|
||||||
BeepAction.class,
|
BeepAction.class,
|
||||||
ClipAction.class,
|
ClipAction.class,
|
||||||
ScriptAction.class } )
|
ScriptAction.class})
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@XmlRootElement( name = "alias_list" )
|
@XmlRootElement(name = "alias_list")
|
||||||
public class AliasListOld implements Comparable<AliasListOld>
|
public class AliasListOld implements Comparable<AliasListOld>
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( AliasListOld.class );
|
private final static Logger mLog = LoggerFactory.getLogger(AliasListOld.class);
|
||||||
|
|
||||||
private String mName;
|
private String mName;
|
||||||
private ArrayList<Group> mGroups = new ArrayList<Group>();
|
private ArrayList<Group> mGroups = new ArrayList<Group>();
|
||||||
@@ -91,8 +87,8 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
private Map<String,Alias> mMDC1200 = new HashMap<>();
|
private Map<String,Alias> mMDC1200 = new HashMap<>();
|
||||||
private Map<String,Alias> mMobileID = new HashMap<>();
|
private Map<String,Alias> mMobileID = new HashMap<>();
|
||||||
private Map<String,Alias> mMPT1327 = new HashMap<>();
|
private Map<String,Alias> mMPT1327 = new HashMap<>();
|
||||||
private Map<String, Alias> mSiteID = new HashMap<>();
|
private Map<String,Alias> mSiteID = new HashMap<>();
|
||||||
private Map<Integer, Alias> mStatus = new HashMap<>();
|
private Map<Integer,Alias> mStatus = new HashMap<>();
|
||||||
private Map<String,Alias> mTalkgroup = new HashMap<>();
|
private Map<String,Alias> mTalkgroup = new HashMap<>();
|
||||||
private Map<Integer,Alias> mUniqueID = new HashMap<>();
|
private Map<Integer,Alias> mUniqueID = new HashMap<>();
|
||||||
|
|
||||||
@@ -106,10 +102,10 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
|
|
||||||
public AliasListOld()
|
public AliasListOld()
|
||||||
{
|
{
|
||||||
this( null );
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AliasListOld( String name )
|
public AliasListOld(String name)
|
||||||
{
|
{
|
||||||
mName = name;
|
mName = name;
|
||||||
update();
|
update();
|
||||||
@@ -132,127 +128,127 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
mTalkgroup.clear();
|
mTalkgroup.clear();
|
||||||
mUniqueID.clear();
|
mUniqueID.clear();
|
||||||
|
|
||||||
for( Group group: mGroups )
|
for(Group group : mGroups)
|
||||||
{
|
{
|
||||||
for( Alias alias: group.getAlias() )
|
for(Alias alias : group.getAlias())
|
||||||
{
|
{
|
||||||
for( AliasID id: alias.getId() )
|
for(AliasID id : alias.getId())
|
||||||
{
|
{
|
||||||
switch( id.getType() )
|
switch(id.getType())
|
||||||
{
|
{
|
||||||
case ESN:
|
case ESN:
|
||||||
Esn esn = (Esn)id;
|
Esn esn = (Esn) id;
|
||||||
if( esn.getEsn().contains( "*" ) )
|
if(esn.getEsn().contains("*"))
|
||||||
{
|
{
|
||||||
mESNWildcard = true;
|
mESNWildcard = true;
|
||||||
|
|
||||||
mESN.put( fixWildcard( esn.getEsn() ), alias );
|
mESN.put(fixWildcard(esn.getEsn()), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mESN.put( esn.getEsn(), alias );
|
mESN.put(esn.getEsn(), alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FLEETSYNC:
|
case FLEETSYNC:
|
||||||
FleetsyncID fs = (FleetsyncID)id;
|
FleetsyncID fs = (FleetsyncID) id;
|
||||||
|
|
||||||
if( fs.getIdent().contains( "*" ) )
|
if(fs.getIdent().contains("*"))
|
||||||
{
|
{
|
||||||
mFleetsyncWildcard = true;
|
mFleetsyncWildcard = true;
|
||||||
|
|
||||||
mFleetsync.put( fixWildcard( fs.getIdent() ), alias );
|
mFleetsync.put(fixWildcard(fs.getIdent()), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mFleetsync.put( fs.getIdent(), alias );
|
mFleetsync.put(fs.getIdent(), alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LOJACK:
|
case LOJACK:
|
||||||
mLoJack.put( (LoJackFunctionAndID)id, alias );
|
mLoJack.put((LoJackFunctionAndID) id, alias);
|
||||||
break;
|
break;
|
||||||
case MDC1200:
|
case MDC1200:
|
||||||
MDC1200ID mdc = (MDC1200ID)id;
|
MDC1200ID mdc = (MDC1200ID) id;
|
||||||
|
|
||||||
if( mdc.getIdent().contains( "*" ) )
|
if(mdc.getIdent().contains("*"))
|
||||||
{
|
{
|
||||||
mMDC1200Wildcard = true;
|
mMDC1200Wildcard = true;
|
||||||
|
|
||||||
//Replace (*) wildcard with regex wildcard (.)
|
//Replace (*) wildcard with regex wildcard (.)
|
||||||
mMDC1200.put( fixWildcard( mdc.getIdent() ), alias );
|
mMDC1200.put(fixWildcard(mdc.getIdent()), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMDC1200.put( mdc.getIdent(), alias );
|
mMDC1200.put(mdc.getIdent(), alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MPT1327:
|
case MPT1327:
|
||||||
MPT1327ID mpt = (MPT1327ID)id;
|
MPT1327ID mpt = (MPT1327ID) id;
|
||||||
|
|
||||||
String ident = mpt.getIdent();
|
String ident = mpt.getIdent();
|
||||||
|
|
||||||
if( ident != null )
|
if(ident != null)
|
||||||
{
|
{
|
||||||
if( ident.contains( "*" ) )
|
if(ident.contains("*"))
|
||||||
{
|
{
|
||||||
mMPT1327Wildcard = true;
|
mMPT1327Wildcard = true;
|
||||||
|
|
||||||
//Replace (*) wildcard with regex wildcard (.)
|
//Replace (*) wildcard with regex wildcard (.)
|
||||||
mMPT1327.put( fixWildcard( ident ), alias );
|
mMPT1327.put(fixWildcard(ident), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMPT1327.put( ident, alias );
|
mMPT1327.put(ident, alias);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MIN:
|
case MIN:
|
||||||
Min min = (Min)id;
|
Min min = (Min) id;
|
||||||
|
|
||||||
if( min.getMin().contains( "*" ) )
|
if(min.getMin().contains("*"))
|
||||||
{
|
{
|
||||||
mMobileIDWildcard = true;
|
mMobileIDWildcard = true;
|
||||||
mMobileID.put( fixWildcard( min.getMin() ), alias );
|
mMobileID.put(fixWildcard(min.getMin()), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMobileID.put( min.getMin(), alias );
|
mMobileID.put(min.getMin(), alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LTR_NET_UID:
|
case LTR_NET_UID:
|
||||||
UniqueID uid = (UniqueID)id;
|
UniqueID uid = (UniqueID) id;
|
||||||
|
|
||||||
mUniqueID.put( uid.getUid(), alias );
|
mUniqueID.put(uid.getUid(), alias);
|
||||||
break;
|
break;
|
||||||
case SITE:
|
case SITE:
|
||||||
SiteID siteID = (SiteID)id;
|
SiteID siteID = (SiteID) id;
|
||||||
|
|
||||||
if( siteID.getSite().contains( "*" ) )
|
if(siteID.getSite().contains("*"))
|
||||||
{
|
{
|
||||||
mSiteWildcard = true;
|
mSiteWildcard = true;
|
||||||
mSiteID.put( fixWildcard( siteID.getSite() ), alias );
|
mSiteID.put(fixWildcard(siteID.getSite()), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSiteID.put( siteID.getSite(), alias );
|
mSiteID.put(siteID.getSite(), alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case STATUS:
|
case STATUS:
|
||||||
mStatus.put( ((StatusID)id).getStatus(), alias );
|
mStatus.put(((StatusID) id).getStatus(), alias);
|
||||||
break;
|
break;
|
||||||
case TALKGROUP:
|
case TALKGROUP:
|
||||||
TalkgroupID tgid = (TalkgroupID)id;
|
TalkgroupID tgid = (TalkgroupID) id;
|
||||||
|
|
||||||
if( tgid.getTalkgroup().contains( "*" ) )
|
if(tgid.getTalkgroup().contains("*"))
|
||||||
{
|
{
|
||||||
mTalkgroupWildcard = true;
|
mTalkgroupWildcard = true;
|
||||||
|
|
||||||
//Replace (*) wildcard with regex wildcard (.)
|
//Replace (*) wildcard with regex wildcard (.)
|
||||||
mTalkgroup.put( fixWildcard( tgid.getTalkgroup() ), alias );
|
mTalkgroup.put(fixWildcard(tgid.getTalkgroup()), alias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTalkgroup.put( tgid.getTalkgroup(), alias );
|
mTalkgroup.put(tgid.getTalkgroup(), alias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NON_RECORDABLE:
|
case NON_RECORDABLE:
|
||||||
@@ -260,7 +256,7 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
//We don't maintain lookups for these items
|
//We don't maintain lookups for these items
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mLog.warn( "Unrecognized Alias ID Type:" + id.getType().name() );
|
mLog.warn("Unrecognized Alias ID Type:" + id.getType().name());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,66 +268,66 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
* Converts user wildcard character (*) to regex single character wildcard (.)
|
* Converts user wildcard character (*) to regex single character wildcard (.)
|
||||||
* but ignores a regex multi-character wildcard (.*)
|
* but ignores a regex multi-character wildcard (.*)
|
||||||
*/
|
*/
|
||||||
private String fixWildcard( String value )
|
private String fixWildcard(String value)
|
||||||
{
|
{
|
||||||
if( value.contains( "*" ) && !value.contains( ".*" ) )
|
if(value.contains("*") && !value.contains(".*"))
|
||||||
{
|
{
|
||||||
return value.replace( "*", "." );
|
return value.replace("*", ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getSiteID( String siteID )
|
public Alias getSiteID(String siteID)
|
||||||
{
|
{
|
||||||
if( siteID != null )
|
if(siteID != null)
|
||||||
{
|
{
|
||||||
if( mSiteWildcard )
|
if(mSiteWildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mSiteID.keySet() )
|
for(String regex : mSiteID.keySet())
|
||||||
{
|
{
|
||||||
if( siteID.matches( regex ) )
|
if(siteID.matches(regex))
|
||||||
{
|
{
|
||||||
return mSiteID.get( regex );
|
return mSiteID.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mSiteID.get( siteID );
|
return mSiteID.get(siteID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getStatus( int status )
|
public Alias getStatus(int status)
|
||||||
{
|
{
|
||||||
return mStatus.get( status );
|
return mStatus.get(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getUniqueID( int uniqueID )
|
public Alias getUniqueID(int uniqueID)
|
||||||
{
|
{
|
||||||
return mUniqueID.get( uniqueID );
|
return mUniqueID.get(uniqueID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getESNAlias( String esn )
|
public Alias getESNAlias(String esn)
|
||||||
{
|
{
|
||||||
if( esn != null )
|
if(esn != null)
|
||||||
{
|
{
|
||||||
if( mESNWildcard )
|
if(mESNWildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mESN.keySet() )
|
for(String regex : mESN.keySet())
|
||||||
{
|
{
|
||||||
if( esn.matches( regex ) )
|
if(esn.matches(regex))
|
||||||
{
|
{
|
||||||
return mESN.get( regex );
|
return mESN.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mESN.get( esn );
|
return mESN.get(esn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,38 +335,38 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Alias getFleetsyncAlias( String ident )
|
public Alias getFleetsyncAlias(String ident)
|
||||||
{
|
{
|
||||||
if( ident != null )
|
if(ident != null)
|
||||||
{
|
{
|
||||||
if( mFleetsyncWildcard )
|
if(mFleetsyncWildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mFleetsync.keySet() )
|
for(String regex : mFleetsync.keySet())
|
||||||
{
|
{
|
||||||
if( ident.matches( regex ) )
|
if(ident.matches(regex))
|
||||||
{
|
{
|
||||||
return mFleetsync.get( regex );
|
return mFleetsync.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mFleetsync.get( ident );
|
return mFleetsync.get(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getLoJackAlias( Function function, String id )
|
public Alias getLoJackAlias(Function function, String id)
|
||||||
{
|
{
|
||||||
if( id != null )
|
if(id != null)
|
||||||
{
|
{
|
||||||
for( LoJackFunctionAndID lojack: mLoJack.keySet() )
|
for(LoJackFunctionAndID lojack : mLoJack.keySet())
|
||||||
{
|
{
|
||||||
if( lojack.matches( function, id ) )
|
if(lojack.matches(function, id))
|
||||||
{
|
{
|
||||||
return mLoJack.get( lojack );
|
return mLoJack.get(lojack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,59 +374,59 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getMDC1200Alias( String ident )
|
public Alias getMDC1200Alias(String ident)
|
||||||
{
|
{
|
||||||
if( ident != null )
|
if(ident != null)
|
||||||
{
|
{
|
||||||
if( mMDC1200Wildcard )
|
if(mMDC1200Wildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mMDC1200.keySet() )
|
for(String regex : mMDC1200.keySet())
|
||||||
{
|
{
|
||||||
if( ident.matches( regex ) )
|
if(ident.matches(regex))
|
||||||
{
|
{
|
||||||
return mMDC1200.get( regex );
|
return mMDC1200.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mMDC1200.get( ident );
|
return mMDC1200.get(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getMPT1327Alias( String ident )
|
public Alias getMPT1327Alias(String ident)
|
||||||
{
|
{
|
||||||
if( ident != null )
|
if(ident != null)
|
||||||
{
|
{
|
||||||
if( mMPT1327Wildcard )
|
if(mMPT1327Wildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mMPT1327.keySet() )
|
for(String regex : mMPT1327.keySet())
|
||||||
{
|
{
|
||||||
if( ident.matches( regex ) )
|
if(ident.matches(regex))
|
||||||
{
|
{
|
||||||
return mMPT1327.get( regex );
|
return mMPT1327.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mMPT1327.get( ident );
|
return mMPT1327.get(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Group getGroup( Alias alias )
|
public Group getGroup(Alias alias)
|
||||||
{
|
{
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
for( Group group: mGroups )
|
for(Group group : mGroups)
|
||||||
{
|
{
|
||||||
if( group.contains( alias ) )
|
if(group.contains(alias))
|
||||||
{
|
{
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
@@ -440,46 +436,46 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getMobileIDNumberAlias( String ident )
|
public Alias getMobileIDNumberAlias(String ident)
|
||||||
{
|
{
|
||||||
if( ident != null )
|
if(ident != null)
|
||||||
{
|
{
|
||||||
if( mMobileIDWildcard )
|
if(mMobileIDWildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mMobileID.keySet() )
|
for(String regex : mMobileID.keySet())
|
||||||
{
|
{
|
||||||
if( ident.matches( regex ) )
|
if(ident.matches(regex))
|
||||||
{
|
{
|
||||||
return mMobileID.get( regex );
|
return mMobileID.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mMobileID.get( ident );
|
return mMobileID.get(ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getTalkgroupAlias( String tgid )
|
public Alias getTalkgroupAlias(String tgid)
|
||||||
{
|
{
|
||||||
if( tgid != null )
|
if(tgid != null)
|
||||||
{
|
{
|
||||||
if( mTalkgroupWildcard )
|
if(mTalkgroupWildcard)
|
||||||
{
|
{
|
||||||
for( String regex: mTalkgroup.keySet() )
|
for(String regex : mTalkgroup.keySet())
|
||||||
{
|
{
|
||||||
if( tgid.matches( regex ) )
|
if(tgid.matches(regex))
|
||||||
{
|
{
|
||||||
return mTalkgroup.get( regex );
|
return mTalkgroup.get(regex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mTalkgroup.get( tgid );
|
return mTalkgroup.get(tgid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +493,7 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName( String name )
|
public void setName(String name)
|
||||||
{
|
{
|
||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
@@ -507,77 +503,24 @@ public class AliasListOld implements Comparable<AliasListOld>
|
|||||||
return mGroups;
|
return mGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGroup( ArrayList<Group> groups )
|
public void setGroup(ArrayList<Group> groups)
|
||||||
{
|
{
|
||||||
mGroups = groups;
|
mGroups = groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGroup( Group group )
|
public void addGroup(Group group)
|
||||||
{
|
{
|
||||||
mGroups.add( group );
|
mGroups.add(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeGroup( Group group )
|
public void removeGroup(Group group)
|
||||||
{
|
{
|
||||||
mGroups.remove( group );
|
mGroups.remove(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo( AliasListOld otherAliasList )
|
public int compareTo(AliasListOld otherAliasList)
|
||||||
{
|
{
|
||||||
return getName().compareTo( otherAliasList.getName() );
|
return getName().compareTo(otherAliasList.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias getAlias( String value, MetadataType type )
|
|
||||||
{
|
|
||||||
switch( type )
|
|
||||||
{
|
|
||||||
case ESN:
|
|
||||||
return getESNAlias( value );
|
|
||||||
case FLEETSYNC:
|
|
||||||
return getFleetsyncAlias( value );
|
|
||||||
case MDC1200:
|
|
||||||
return getMDC1200Alias( value );
|
|
||||||
case MOBILE_ID:
|
|
||||||
return getMobileIDNumberAlias( value );
|
|
||||||
case MPT1327:
|
|
||||||
return getMPT1327Alias( value );
|
|
||||||
case SITE_ID:
|
|
||||||
return getSiteID( value );
|
|
||||||
case STATUS:
|
|
||||||
if( value != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return getStatus( Integer.valueOf( value ) );
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
//do nothing, we couldn't parse the int value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM:
|
|
||||||
case TO:
|
|
||||||
return getTalkgroupAlias( value );
|
|
||||||
case UNIQUE_ID:
|
|
||||||
if( value != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return getUniqueID( Integer.valueOf( value ) );
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
//do nothing, we couldn't parse the int value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package record;
|
|||||||
|
|
||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.IAudioPacketListener;
|
import audio.IAudioPacketListener;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -49,7 +49,7 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
private AtomicBoolean mRunning = new AtomicBoolean();
|
private AtomicBoolean mRunning = new AtomicBoolean();
|
||||||
|
|
||||||
protected Path mPath;
|
protected Path mPath;
|
||||||
protected AudioMetadata mAudioMetadata;
|
protected Metadata mMetadata;
|
||||||
protected long mTimeRecordingStart;
|
protected long mTimeRecordingStart;
|
||||||
protected long mTimeLastPacketReceived;
|
protected long mTimeLastPacketReceived;
|
||||||
private BufferProcessor mBufferProcessor;
|
private BufferProcessor mBufferProcessor;
|
||||||
@@ -79,9 +79,9 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
/**
|
/**
|
||||||
* Latest audio metadata received for this recording
|
* Latest audio metadata received for this recording
|
||||||
*/
|
*/
|
||||||
public AudioMetadata getMetadata()
|
public Metadata getMetadata()
|
||||||
{
|
{
|
||||||
return mAudioMetadata;
|
return mMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,7 +119,7 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes the audio packet and captures the latest AudioMetadata for the recording for easy access.
|
* Processes the audio packet and captures the latest Metadata for the recording for easy access.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void receive(AudioPacket audioPacket)
|
public void receive(AudioPacket audioPacket)
|
||||||
@@ -129,14 +129,14 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
mTimeRecordingStart = System.currentTimeMillis();
|
mTimeRecordingStart = System.currentTimeMillis();
|
||||||
mTimeLastPacketReceived = mTimeRecordingStart;
|
mTimeLastPacketReceived = mTimeRecordingStart;
|
||||||
|
|
||||||
if(audioPacket.hasAudioMetadata())
|
if(audioPacket.hasMetadata())
|
||||||
{
|
{
|
||||||
mAudioMetadata = audioPacket.getAudioMetadata();
|
mMetadata = audioPacket.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean success = mAudioPacketQueue.offer(audioPacket);
|
boolean success = mAudioPacketQueue.offer(audioPacket);
|
||||||
|
|
||||||
if (!success)
|
if(!success)
|
||||||
{
|
{
|
||||||
mLog.error("recorder buffer overflow - stopping recorder [" + getPath().toString() + "]");
|
mLog.error("recorder buffer overflow - stopping recorder [" + getPath().toString() + "]");
|
||||||
stop();
|
stop();
|
||||||
@@ -189,11 +189,11 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
*/
|
*/
|
||||||
public void start(ScheduledExecutorService executor)
|
public void start(ScheduledExecutorService executor)
|
||||||
{
|
{
|
||||||
if (mRunning.compareAndSet(false, true))
|
if(mRunning.compareAndSet(false, true))
|
||||||
{
|
{
|
||||||
mTimeLastPacketReceived = System.currentTimeMillis();
|
mTimeLastPacketReceived = System.currentTimeMillis();
|
||||||
|
|
||||||
if (mBufferProcessor == null)
|
if(mBufferProcessor == null)
|
||||||
{
|
{
|
||||||
mBufferProcessor = new BufferProcessor();
|
mBufferProcessor = new BufferProcessor();
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
/* Schedule the handler to run every half second */
|
/* Schedule the handler to run every half second */
|
||||||
mProcessorHandle = executor.scheduleAtFixedRate(mBufferProcessor, 0, 500, TimeUnit.MILLISECONDS);
|
mProcessorHandle = executor.scheduleAtFixedRate(mBufferProcessor, 0, 500, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
catch (IOException io)
|
catch(IOException io)
|
||||||
{
|
{
|
||||||
mLog.error("Error starting audio recorder [" + getPath().toString() + "]", io);
|
mLog.error("Error starting audio recorder [" + getPath().toString() + "]", io);
|
||||||
|
|
||||||
@@ -221,13 +221,13 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
{
|
{
|
||||||
mAudioPacketQueue.drainTo(mPacketsToProcess);
|
mAudioPacketQueue.drainTo(mPacketsToProcess);
|
||||||
|
|
||||||
if (!mPacketsToProcess.isEmpty())
|
if(!mPacketsToProcess.isEmpty())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
record(mPacketsToProcess);
|
record(mPacketsToProcess);
|
||||||
|
|
||||||
for(AudioPacket packet: mPacketsToProcess)
|
for(AudioPacket packet : mPacketsToProcess)
|
||||||
{
|
{
|
||||||
if(packet.getType() == AudioPacket.Type.AUDIO)
|
if(packet.getType() == AudioPacket.Type.AUDIO)
|
||||||
{
|
{
|
||||||
@@ -279,7 +279,7 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (mProcessing.compareAndSet(false, true))
|
if(mProcessing.compareAndSet(false, true))
|
||||||
{
|
{
|
||||||
processAudioPacketQueue();
|
processAudioPacketQueue();
|
||||||
|
|
||||||
@@ -290,14 +290,14 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
//Allow sub-classes to flush remaining audio frame data to disk.
|
//Allow sub-classes to flush remaining audio frame data to disk.
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
if (mFileOutputStream != null)
|
if(mFileOutputStream != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mFileOutputStream.flush();
|
mFileOutputStream.flush();
|
||||||
mFileOutputStream.close();
|
mFileOutputStream.close();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch(IOException e)
|
||||||
{
|
{
|
||||||
mLog.error("Error closing output stream", e);
|
mLog.error("Error closing output stream", e);
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@ public abstract class AudioRecorder extends Module implements Listener<AudioPack
|
|||||||
mRecordingClosedListener.receive(AudioRecorder.this);
|
mRecordingClosedListener.receive(AudioRecorder.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mProcessorHandle != null)
|
if(mProcessorHandle != null)
|
||||||
{
|
{
|
||||||
mProcessorHandle.cancel(false);
|
mProcessorHandle.cancel(false);
|
||||||
mProcessorHandle = null;
|
mProcessorHandle = null;
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
package record;
|
package record;
|
||||||
|
|
||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.metadata.Metadata;
|
import channel.metadata.Metadata;
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -38,7 +37,7 @@ public class RecorderManager implements Listener<AudioPacket>
|
|||||||
|
|
||||||
public static final int AUDIO_SAMPLE_RATE = 8000;
|
public static final int AUDIO_SAMPLE_RATE = 8000;
|
||||||
|
|
||||||
private Map<String, RealBufferWaveRecorder> mRecorders = new HashMap<>();
|
private Map<String,RealBufferWaveRecorder> mRecorders = new HashMap<>();
|
||||||
|
|
||||||
private ThreadPoolManager mThreadPoolManager;
|
private ThreadPoolManager mThreadPoolManager;
|
||||||
|
|
||||||
@@ -61,10 +60,10 @@ public class RecorderManager implements Listener<AudioPacket>
|
|||||||
@Override
|
@Override
|
||||||
public void receive(AudioPacket audioPacket)
|
public void receive(AudioPacket audioPacket)
|
||||||
{
|
{
|
||||||
if(audioPacket.hasAudioMetadata() &&
|
if(audioPacket.hasMetadata() &&
|
||||||
audioPacket.getAudioMetadata().isRecordable())
|
audioPacket.getMetadata().isRecordable())
|
||||||
{
|
{
|
||||||
String identifier = audioPacket.getAudioMetadata().getIdentifier();
|
String identifier = audioPacket.getMetadata().getUniqueIdentifier();
|
||||||
|
|
||||||
if(mRecorders.containsKey(identifier))
|
if(mRecorders.containsKey(identifier))
|
||||||
{
|
{
|
||||||
@@ -125,37 +124,18 @@ public class RecorderManager implements Listener<AudioPacket>
|
|||||||
|
|
||||||
sb.append(File.separator);
|
sb.append(File.separator);
|
||||||
|
|
||||||
Metadata systemMetadata = packet.getAudioMetadata().getMetadata(MetadataType.SYSTEM);
|
Metadata metadata = packet.getMetadata();
|
||||||
|
|
||||||
sb.append(systemMetadata != null ? systemMetadata.getValue() : "UNKNOWN_SYSTEM");
|
sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() + "_" : "SYSTEM-SITE");
|
||||||
|
sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() : "CHANNEL");
|
||||||
|
|
||||||
Metadata toMetadata = packet.getAudioMetadata().getMetadata(MetadataType.TO);
|
if(metadata.getPrimaryAddressTo().hasIdentifier())
|
||||||
|
|
||||||
if(toMetadata != null)
|
|
||||||
{
|
{
|
||||||
sb.append("_TO_").append(toMetadata.getValue());
|
sb.append("_TO_").append(metadata.getPrimaryAddressTo().getIdentifier());
|
||||||
|
|
||||||
Metadata fromMetadata = packet.getAudioMetadata().getMetadata(MetadataType.FROM);
|
if(metadata.getPrimaryAddressFrom().hasIdentifier())
|
||||||
|
|
||||||
if(fromMetadata != null)
|
|
||||||
{
|
{
|
||||||
sb.append("_FROM_").append(fromMetadata.getValue());
|
sb.append("_FROM_").append(metadata.getPrimaryAddressFrom().getIdentifier());
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Metadata siteMetadata = packet.getAudioMetadata().getMetadata(MetadataType.SITE_ID);
|
|
||||||
|
|
||||||
if(siteMetadata != null)
|
|
||||||
{
|
|
||||||
sb.append("_").append(siteMetadata.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
Metadata channelMetadata = packet.getAudioMetadata().getMetadata(MetadataType.CHANNEL_NAME);
|
|
||||||
|
|
||||||
if(channelMetadata != null)
|
|
||||||
{
|
|
||||||
sb.append("_").append(channelMetadata.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* sdrtrunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +20,7 @@ package record.wave;
|
|||||||
|
|
||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.IAudioPacketListener;
|
import audio.IAudioPacketListener;
|
||||||
import audio.metadata.AudioMetadata;
|
import channel.metadata.Metadata;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.real.RealBuffer;
|
import sample.real.RealBuffer;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ import java.nio.file.Path;
|
|||||||
|
|
||||||
public class AudioPacketMonoWaveReader extends MonoWaveReader implements Listener<RealBuffer>
|
public class AudioPacketMonoWaveReader extends MonoWaveReader implements Listener<RealBuffer>
|
||||||
{
|
{
|
||||||
private AudioMetadata mMetadata = new AudioMetadata(0, false);
|
private Metadata mMetadata = new Metadata();
|
||||||
|
|
||||||
private IAudioPacketListener mListener;
|
private IAudioPacketListener mListener;
|
||||||
|
|
||||||
@@ -40,7 +40,6 @@ public class AudioPacketMonoWaveReader extends MonoWaveReader implements Listene
|
|||||||
* @param realTime causes the read() method to read and dispatch audio packets in real time. Note: when using
|
* @param realTime causes the read() method to read and dispatch audio packets in real time. Note: when using
|
||||||
* real time playback, the thread calling the read() method will sleep as needed to effect real-time playback,
|
* real time playback, the thread calling the read() method will sleep as needed to effect real-time playback,
|
||||||
* therefore you should invoke read() on a separate thread if this will impact the calling thread.
|
* therefore you should invoke read() on a separate thread if this will impact the calling thread.
|
||||||
*
|
|
||||||
* @throws IOException on any file IO errors
|
* @throws IOException on any file IO errors
|
||||||
*/
|
*/
|
||||||
public AudioPacketMonoWaveReader(Path path, boolean realTime) throws IOException
|
public AudioPacketMonoWaveReader(Path path, boolean realTime) throws IOException
|
||||||
@@ -49,7 +48,7 @@ public class AudioPacketMonoWaveReader extends MonoWaveReader implements Listene
|
|||||||
setListener(this);
|
setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMetadata(AudioMetadata metadata)
|
public void setMetadata(Metadata metadata)
|
||||||
{
|
{
|
||||||
mMetadata = metadata;
|
mMetadata = metadata;
|
||||||
}
|
}
|
||||||
|
|||||||
41
src/util/StringUtils.java
Normal file
41
src/util/StringUtils.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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 util;
|
||||||
|
|
||||||
|
public class StringUtils
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Compares string a to b and returns true if a is non-null and non-empty, b is non-null and non-empty, and
|
||||||
|
* a is equal to b.
|
||||||
|
* @param a string to compare
|
||||||
|
* @param b string to compare
|
||||||
|
*/
|
||||||
|
public static boolean isEqual(String a, String b)
|
||||||
|
{
|
||||||
|
return !isEmpty(a) && !isEmpty(b) && a.equals(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the string for null or empty condition
|
||||||
|
*/
|
||||||
|
public static boolean isEmpty(String a)
|
||||||
|
{
|
||||||
|
return a == null || a.isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user