#864 Updates radio reference service library to resolve issue where the library wasn't parsing the system information object correctly and was assuming a singular bandplan object versus an array of bandplans. (#865)

Updating the service library prompted some minor changes with the way that county info objects are handled for each site.

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-06-13 08:16:37 -04:00
committed by GitHub
parent 706ada2940
commit 7395f02fb8
7 changed files with 231 additions and 69 deletions

View File

@@ -65,7 +65,7 @@ dependencies {
implementation 'com.miglayout:miglayout-swing:5.2' implementation 'com.miglayout:miglayout-swing:5.2'
implementation 'com.mpatric:mp3agic:0.9.1' implementation 'com.mpatric:mp3agic:0.9.1'
implementation 'eu.hansolo:charts:1.0.5' implementation 'eu.hansolo:charts:1.0.5'
implementation 'io.github.dsheirer:radio-reference-api:15.1.4' implementation 'io.github.dsheirer:radio-reference-api:15.1.6'
implementation 'javax.usb:usb-api:1.0.2' implementation 'javax.usb:usb-api:1.0.2'
implementation 'net.coderazzi:tablefilter-swing:5.4.0' implementation 'net.coderazzi:tablefilter-swing:5.4.0'
implementation 'org.apache.commons:commons-compress:1.20' implementation 'org.apache.commons:commons-compress:1.20'

View File

@@ -0,0 +1,131 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2020 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 io.github.dsheirer.gui.playlist.radioreference;
import io.github.dsheirer.rrapi.type.CountyInfo;
import io.github.dsheirer.rrapi.type.Site;
/**
* Wrapper class to join a Site and a corresponding County Info
*/
public class EnrichedSite
{
private Site mSite;
private CountyInfo mCountyInfo;
/**
* Constructs an instance
* @param site object
* @param countyInfo optional
*/
public EnrichedSite(Site site, CountyInfo countyInfo)
{
mSite = site;
mCountyInfo = countyInfo;
}
/**
* Site instance
* @return site or null
*/
public Site getSite()
{
return mSite;
}
/**
* Sets the site instance
* @param site or null
*/
public void setSite(Site site)
{
mSite = site;
}
/**
* County information
* @return county info or null
*/
public CountyInfo getCountyInfo()
{
return mCountyInfo;
}
/**
* Sets the county info
* @param countyInfo or null
*/
public void setCountyInfo(CountyInfo countyInfo)
{
mCountyInfo = countyInfo;
}
/**
* Optional site number
*/
public Integer getSiteNumber()
{
if(mSite != null)
{
return mSite.getSiteNumber();
}
return null;
}
/**
* Optional site RFSS value
*/
public Integer getRfss()
{
if(mSite != null)
{
return mSite.getRfss();
}
return null;
}
/**
* Optional county name
*/
public String getCountyName()
{
if(mCountyInfo != null)
{
return mCountyInfo.getName();
}
return null;
}
/**
* Optional description of the site
*/
public String getDescription()
{
if(mSite != null)
{
return mSite.getDescription();
}
return null;
}
}

View File

@@ -204,7 +204,7 @@ public class RadioReferenceDecoder
{ {
List<Tag> tags = new ArrayList<>(); List<Tag> tags = new ArrayList<>();
if(talkgroup.getTags() != null) if(talkgroup != null && talkgroup.getTags() != null)
{ {
for(Tag tag: talkgroup.getTags()) for(Tag tag: talkgroup.getTags())
{ {
@@ -220,7 +220,12 @@ public class RadioReferenceDecoder
*/ */
public Type getType(System system) public Type getType(System system)
{ {
return mTypeMap.get(system.getTypeId()); if(system != null)
{
return mTypeMap.get(system.getTypeId());
}
return null;
} }
/** /**
@@ -228,7 +233,12 @@ public class RadioReferenceDecoder
*/ */
public Flavor getFlavor(System system) public Flavor getFlavor(System system)
{ {
return mFlavorMap.get(system.getFlavorId()); if(system != null)
{
return mFlavorMap.get(system.getFlavorId());
}
return null;
} }
/** /**
@@ -236,7 +246,12 @@ public class RadioReferenceDecoder
*/ */
public Voice getVoice(System system) public Voice getVoice(System system)
{ {
return mVoiceMap.get(system.getVoiceId()); if(system != null)
{
return mVoiceMap.get(system.getVoiceId());
}
return null;
} }
/** /**
@@ -340,51 +355,54 @@ public class RadioReferenceDecoder
Flavor flavor = getFlavor(system); Flavor flavor = getFlavor(system);
Voice voice = getVoice(system); Voice voice = getVoice(system);
switch(type.getName()) if(type != null && flavor != null && voice != null)
{ {
case "LTR": switch(type.getName())
if(flavor.getName().contentEquals("Net")) {
{ case "LTR":
return DecoderType.LTR_NET; if(flavor.getName().contentEquals("Net"))
} {
else if(flavor.getName().contentEquals("Passport")) return DecoderType.LTR_NET;
{ }
return DecoderType.PASSPORT; else if(flavor.getName().contentEquals("Passport"))
} {
else return DecoderType.PASSPORT;
{ }
return DecoderType.LTR; else
} {
case "MPT-1327": return DecoderType.LTR;
return DecoderType.MPT1327; }
case "Project 25": case "MPT-1327":
if(flavor.getName().contentEquals("Phase II")) return DecoderType.MPT1327;
{ case "Project 25":
return DecoderType.P25_PHASE2; if(flavor.getName().contentEquals("Phase II"))
} {
else if(flavor.getName().contentEquals("Phase I")) return DecoderType.P25_PHASE2;
{ }
return DecoderType.P25_PHASE1; else if(flavor.getName().contentEquals("Phase I"))
} {
break; return DecoderType.P25_PHASE1;
case "Motorola": }
if(voice.getName().contentEquals("Analog and APCO-25 Common Air Interface") || break;
voice.getName().contentEquals("APCO-25 Common Air Interface Exclusive")) case "Motorola":
{ if(voice.getName().contentEquals("Analog and APCO-25 Common Air Interface") ||
return DecoderType.P25_PHASE1; voice.getName().contentEquals("APCO-25 Common Air Interface Exclusive"))
} {
break; return DecoderType.P25_PHASE1;
case "DMR": }
case "NXDN": break;
case "DMR":
case "NXDN":
case "EDACS": case "EDACS":
case "TETRA": case "TETRA":
case "Midland CMS": case "Midland CMS":
case "OpenSky": case "OpenSky":
case "iDEN": case "iDEN":
case "SmarTrunk": case "SmarTrunk":
case "Other": case "Other":
default: default:
}
} }
return null; return null;

View File

@@ -30,10 +30,13 @@ public class RadioReferenceUnavailableAlert extends Alert
{ {
public RadioReferenceUnavailableAlert(Node ownerNode) public RadioReferenceUnavailableAlert(Node ownerNode)
{ {
super(AlertType.INFORMATION, "Check network connection or see details in sdrtrunk log.", ButtonType.OK); super(AlertType.INFORMATION, "This may be caused by a network outage or there was an error " +
"accessing the service. If this problem occurs each time you attempt to access a " +
"specific system or agency, please notify the developer. Details for this issue " +
"are located in the sdrtrunk application log.", ButtonType.OK);
setTitle("Service Unavailable"); setTitle("Service Unavailable");
setHeaderText("Radio Reference Is Currently Unavailable"); setHeaderText("Radio Reference Error or Service Is Currently Unavailable");
initOwner(ownerNode.getScene().getWindow()); initOwner(ownerNode.getScene().getWindow());
} }
} }

View File

@@ -108,7 +108,7 @@ public class SiteEditor extends GridPane
private CheckBox mGoToChannelEditorCheckBox; private CheckBox mGoToChannelEditorCheckBox;
private Label mProtocolNotSupportedLabel; private Label mProtocolNotSupportedLabel;
private RadioReferenceDecoder mRadioReferenceDecoder; private RadioReferenceDecoder mRadioReferenceDecoder;
private Site mCurrentSite; private EnrichedSite mCurrentSite;
private System mCurrentSystem; private System mCurrentSystem;
private SystemInformation mCurrentSystemInformation; private SystemInformation mCurrentSystemInformation;
private ComboBox mAliasListNameComboBox; private ComboBox mAliasListNameComboBox;
@@ -290,7 +290,7 @@ public class SiteEditor extends GridPane
} }
} }
public void setSite(Site site, System system, SystemInformation systemInformation, RadioReferenceDecoder decoder) public void setSite(EnrichedSite site, System system, SystemInformation systemInformation, RadioReferenceDecoder decoder)
{ {
mCurrentSite = site; mCurrentSite = site;
mCurrentSystem = system; mCurrentSystem = system;
@@ -299,7 +299,7 @@ public class SiteEditor extends GridPane
getSiteFrequencyTableView().getItems().clear(); getSiteFrequencyTableView().getItems().clear();
boolean disable = site == null || site.getSiteFrequencies().isEmpty(); boolean disable = site == null || site.getSite().getSiteFrequencies().isEmpty();
boolean supported = decoder.hasSupportedProtocol(system); boolean supported = decoder.hasSupportedProtocol(system);
getFrequenciesSegmentedButton().setDisable(disable || !supported); getFrequenciesSegmentedButton().setDisable(disable || !supported);
@@ -318,7 +318,7 @@ public class SiteEditor extends GridPane
if(site != null) if(site != null)
{ {
List<SiteFrequency> siteFrequencies = site.getSiteFrequencies(); List<SiteFrequency> siteFrequencies = site.getSite().getSiteFrequencies();
for(SiteFrequency siteFrequency: siteFrequencies) for(SiteFrequency siteFrequency: siteFrequencies)
{ {
if(siteFrequency.getFrequency() > 0.01) if(siteFrequency.getFrequency() > 0.01)
@@ -340,7 +340,7 @@ public class SiteEditor extends GridPane
getCreateChannelConfigurationButton().setVisible(true); getCreateChannelConfigurationButton().setVisible(true);
getGoToChannelEditorCheckBox().setVisible(true); getGoToChannelEditorCheckBox().setVisible(true);
getSystemTextField().setText(system.getName()); getSystemTextField().setText(system.getName());
getSiteTextField().setText(site.getCountyName()); getSiteTextField().setText(mCurrentSite.getCountyName());
getNameTextField().setText("Control"); getNameTextField().setText("Control");
if(!siteFrequencies.isEmpty()) if(!siteFrequencies.isEmpty())
@@ -456,7 +456,8 @@ public class SiteEditor extends GridPane
Channel channel = getChannelTemplate(); Channel channel = getChannelTemplate();
channel.setName("LCN " + siteFrequency.getLogicalChannelNumber()); channel.setName("LCN " + siteFrequency.getLogicalChannelNumber());
DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem); DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem);
channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite, mCurrentSystemInformation)); channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite.getSite(),
mCurrentSystemInformation));
SourceConfigTuner sourceConfigTuner = new SourceConfigTuner(); SourceConfigTuner sourceConfigTuner = new SourceConfigTuner();
sourceConfigTuner.setFrequency(getFrequency(siteFrequency)); sourceConfigTuner.setFrequency(getFrequency(siteFrequency));
channel.setSourceConfiguration(sourceConfigTuner); channel.setSourceConfiguration(sourceConfigTuner);
@@ -511,7 +512,7 @@ public class SiteEditor extends GridPane
decoderType = DecoderType.P25_PHASE1; decoderType = DecoderType.P25_PHASE1;
} }
channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite, mCurrentSystemInformation)); channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite.getSite(), mCurrentSystemInformation));
SourceConfigTuner sourceConfigTuner = new SourceConfigTuner(); SourceConfigTuner sourceConfigTuner = new SourceConfigTuner();
sourceConfigTuner.setFrequency((long)(control.getFrequency() * 1E6)); sourceConfigTuner.setFrequency((long)(control.getFrequency() * 1E6));
@@ -569,7 +570,8 @@ public class SiteEditor extends GridPane
decoderType = DecoderType.P25_PHASE1; decoderType = DecoderType.P25_PHASE1;
} }
channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite, mCurrentSystemInformation)); channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite.getSite(),
mCurrentSystemInformation));
if(siteFrequencies.size() == 1) if(siteFrequencies.size() == 1)
{ {
@@ -605,7 +607,8 @@ public class SiteEditor extends GridPane
Channel channel = getChannelTemplate(); Channel channel = getChannelTemplate();
channel.setName("LCN " + siteFrequency.getLogicalChannelNumber()); channel.setName("LCN " + siteFrequency.getLogicalChannelNumber());
DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem); DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem);
channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite, mCurrentSystemInformation)); channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite.getSite(),
mCurrentSystemInformation));
SourceConfigTuner sourceConfigTuner = new SourceConfigTuner(); SourceConfigTuner sourceConfigTuner = new SourceConfigTuner();
sourceConfigTuner.setFrequency(getFrequency(siteFrequency)); sourceConfigTuner.setFrequency(getFrequency(siteFrequency));
channel.setSourceConfiguration(sourceConfigTuner); channel.setSourceConfiguration(sourceConfigTuner);
@@ -659,7 +662,8 @@ public class SiteEditor extends GridPane
Channel channel = getChannelTemplate(); Channel channel = getChannelTemplate();
DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem); DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem);
channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite, mCurrentSystemInformation)); channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite.getSite(),
mCurrentSystemInformation));
if(siteFrequencies.size() == 1) if(siteFrequencies.size() == 1)
{ {
@@ -695,7 +699,8 @@ public class SiteEditor extends GridPane
Channel channel = getChannelTemplate(); Channel channel = getChannelTemplate();
channel.setName("LCN " + siteFrequency.getLogicalChannelNumber()); channel.setName("LCN " + siteFrequency.getLogicalChannelNumber());
DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem); DecoderType decoderType = mRadioReferenceDecoder.getDecoderType(mCurrentSystem);
channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite, mCurrentSystemInformation)); channel.setDecodeConfiguration(getDecodeConfiguration(decoderType, mCurrentSite.getSite(),
mCurrentSystemInformation));
SourceConfigTuner sourceConfigTuner = new SourceConfigTuner(); SourceConfigTuner sourceConfigTuner = new SourceConfigTuner();
sourceConfigTuner.setFrequency(getFrequency(siteFrequency)); sourceConfigTuner.setFrequency(getFrequency(siteFrequency));

View File

@@ -54,6 +54,7 @@ import jiconfont.javafx.IconNode;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@@ -281,13 +282,14 @@ public class SystemEditor extends VBox
List<Site> sites = mRadioReference.getService().getSites(system.getSystemId()); List<Site> sites = mRadioReference.getService().getSites(system.getSystemId());
//The service api doesn't provide the county name, so we run a separate query to update each value //The service api doesn't provide the county name, so we run a separate query to update each value
List<EnrichedSite> enrichedSites = new ArrayList<>();
for(Site site: sites) for(Site site: sites)
{ {
CountyInfo countyInfo = mRadioReference.getService().getCountyInfo(site.getCountyId()); CountyInfo countyInfo = mRadioReference.getService().getCountyInfo(site.getCountyId());
site.setCountyName(countyInfo.getName()); enrichedSites.add(new EnrichedSite(site, countyInfo));
} }
Platform.runLater(() -> getSystemSiteSelectionEditor().setSystem(system, sites, mRadioReferenceDecoder, Platform.runLater(() -> getSystemSiteSelectionEditor().setSystem(system, enrichedSites, mRadioReferenceDecoder,
systemInformation)); systemInformation));
//Query and load the talkgroup view second //Query and load the talkgroup view second

View File

@@ -25,7 +25,6 @@ package io.github.dsheirer.gui.playlist.radioreference;
import io.github.dsheirer.playlist.PlaylistManager; import io.github.dsheirer.playlist.PlaylistManager;
import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.rrapi.type.Flavor; import io.github.dsheirer.rrapi.type.Flavor;
import io.github.dsheirer.rrapi.type.Site;
import io.github.dsheirer.rrapi.type.System; import io.github.dsheirer.rrapi.type.System;
import io.github.dsheirer.rrapi.type.SystemInformation; import io.github.dsheirer.rrapi.type.SystemInformation;
import io.github.dsheirer.rrapi.type.Type; import io.github.dsheirer.rrapi.type.Type;
@@ -60,7 +59,7 @@ public class SystemSiteSelectionEditor extends GridPane
private Label mProtocolLabel; private Label mProtocolLabel;
private Label mFlavorLabel; private Label mFlavorLabel;
private Label mVoiceLabel; private Label mVoiceLabel;
private TableView<Site> mSiteTableView; private TableView<EnrichedSite> mSiteTableView;
private SiteEditor mSiteEditor; private SiteEditor mSiteEditor;
private RadioReferenceDecoder mRadioReferenceDecoder; private RadioReferenceDecoder mRadioReferenceDecoder;
private System mCurrentSystem; private System mCurrentSystem;
@@ -113,7 +112,8 @@ public class SystemSiteSelectionEditor extends GridPane
* Updates this view with the specified system * Updates this view with the specified system
* @param system to view * @param system to view
*/ */
public void setSystem(System system, List<Site> sites, RadioReferenceDecoder decoder, SystemInformation systemInformation) public void setSystem(System system, List<EnrichedSite> sites, RadioReferenceDecoder decoder,
SystemInformation systemInformation)
{ {
mCurrentSystem = system; mCurrentSystem = system;
mCurrentSystemInformation = systemInformation; mCurrentSystemInformation = systemInformation;
@@ -205,7 +205,7 @@ public class SystemSiteSelectionEditor extends GridPane
return mPlaceholderLabel; return mPlaceholderLabel;
} }
private TableView<Site> getSiteTableView() private TableView<EnrichedSite> getSiteTableView()
{ {
if(mSiteTableView == null) if(mSiteTableView == null)
{ {
@@ -235,8 +235,11 @@ public class SystemSiteSelectionEditor extends GridPane
mSiteTableView.getColumns().addAll(numberColumn, rfssColumn, countyColumn, descriptionColumn); mSiteTableView.getColumns().addAll(numberColumn, rfssColumn, countyColumn, descriptionColumn);
mSiteTableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); mSiteTableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
mSiteTableView.getSelectionModel().selectedItemProperty() mSiteTableView.getSelectionModel().selectedItemProperty()
.addListener((observable, oldValue, selected) -> getSiteEditor() .addListener((observable, oldValue, selected) ->
.setSite(selected, mCurrentSystem, mCurrentSystemInformation, mRadioReferenceDecoder)); {
getSiteEditor().setSite(selected, mCurrentSystem, mCurrentSystemInformation,
mRadioReferenceDecoder);
});
} }
return mSiteTableView; return mSiteTableView;