Skip to content

Commit

Permalink
#864 Updates radio reference service library to resolve issue where t…
Browse files Browse the repository at this point in the history
…he 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>
  • Loading branch information
DSheirer and Denny authored Jun 13, 2020
1 parent 706ada2 commit 7395f02
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 70 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
implementation 'com.miglayout:miglayout-swing:5.2'
implementation 'com.mpatric:mp3agic:0.9.1'
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 'net.coderazzi:tablefilter-swing:5.4.0'
implementation 'org.apache.commons:commons-compress:1.20'
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public List<Tag> getTags(Talkgroup talkgroup)
{
List<Tag> tags = new ArrayList<>();

if(talkgroup.getTags() != null)
if(talkgroup != null && talkgroup.getTags() != null)
{
for(Tag tag: talkgroup.getTags())
{
Expand All @@ -220,23 +220,38 @@ public List<Tag> getTags(Talkgroup talkgroup)
*/
public Type getType(System system)
{
return mTypeMap.get(system.getTypeId());
if(system != null)
{
return mTypeMap.get(system.getTypeId());
}

return null;
}

/**
* Provides the radio reference Flavor for the system
*/
public Flavor getFlavor(System system)
{
return mFlavorMap.get(system.getFlavorId());
if(system != null)
{
return mFlavorMap.get(system.getFlavorId());
}

return null;
}

/**
* Provides the radio reference voice/traffic channel protocol for the system
*/
public Voice getVoice(System system)
{
return mVoiceMap.get(system.getVoiceId());
if(system != null)
{
return mVoiceMap.get(system.getVoiceId());
}

return null;
}

/**
Expand Down Expand Up @@ -340,51 +355,54 @@ public DecoderType getDecoderType(System system)
Flavor flavor = getFlavor(system);
Voice voice = getVoice(system);

switch(type.getName())
if(type != null && flavor != null && voice != null)
{
case "LTR":
if(flavor.getName().contentEquals("Net"))
{
return DecoderType.LTR_NET;
}
else if(flavor.getName().contentEquals("Passport"))
{
return DecoderType.PASSPORT;
}
else
{
return DecoderType.LTR;
}
case "MPT-1327":
return DecoderType.MPT1327;
case "Project 25":
if(flavor.getName().contentEquals("Phase II"))
{
return DecoderType.P25_PHASE2;
}
else if(flavor.getName().contentEquals("Phase I"))
{
return DecoderType.P25_PHASE1;
}
break;
case "Motorola":
if(voice.getName().contentEquals("Analog and APCO-25 Common Air Interface") ||
voice.getName().contentEquals("APCO-25 Common Air Interface Exclusive"))
{
return DecoderType.P25_PHASE1;
}
break;
case "DMR":
case "NXDN":

case "EDACS":
case "TETRA":
case "Midland CMS":
case "OpenSky":
case "iDEN":
case "SmarTrunk":
case "Other":
default:
switch(type.getName())
{
case "LTR":
if(flavor.getName().contentEquals("Net"))
{
return DecoderType.LTR_NET;
}
else if(flavor.getName().contentEquals("Passport"))
{
return DecoderType.PASSPORT;
}
else
{
return DecoderType.LTR;
}
case "MPT-1327":
return DecoderType.MPT1327;
case "Project 25":
if(flavor.getName().contentEquals("Phase II"))
{
return DecoderType.P25_PHASE2;
}
else if(flavor.getName().contentEquals("Phase I"))
{
return DecoderType.P25_PHASE1;
}
break;
case "Motorola":
if(voice.getName().contentEquals("Analog and APCO-25 Common Air Interface") ||
voice.getName().contentEquals("APCO-25 Common Air Interface Exclusive"))
{
return DecoderType.P25_PHASE1;
}
break;
case "DMR":
case "NXDN":

case "EDACS":
case "TETRA":
case "Midland CMS":
case "OpenSky":
case "iDEN":
case "SmarTrunk":
case "Other":
default:
}
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ public class RadioReferenceUnavailableAlert extends Alert
{
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");
setHeaderText("Radio Reference Is Currently Unavailable");
setHeaderText("Radio Reference Error or Service Is Currently Unavailable");
initOwner(ownerNode.getScene().getWindow());
}
}
Loading

0 comments on commit 7395f02

Please sign in to comment.