diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 9c276ab9..cb7eff95 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -2,8 +2,8 @@ - - + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d5d79e0c..df60b677 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 537533ff..6ddb9dc1 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,6 @@ * along with this program. If not, see * ***************************************************************************** */ - buildscript { repositories { jcenter() @@ -27,8 +26,13 @@ buildscript { } } -apply plugin: 'java' -apply plugin: 'idea' +plugins { + id 'application' + id 'java' + id 'idea' + id 'org.openjfx.javafxplugin' version '0.0.6' + id 'org.beryx.runtime' version '1.1.1' +} repositories { jcenter() @@ -36,13 +40,58 @@ repositories { } version = '0.4.0-alpha.6' -sourceCompatibility = 1.8 +sourceCompatibility = '11' sourceSets { main.java.srcDirs 'src/main' test.java.srcDirs 'src/test' } +dependencies { + testCompile 'junit:junit:4.12' + testCompile 'org.assertj:assertj-core:3.8.0' + compile fileTree(dir: 'imports', include: '*.jar') + compile 'ch.qos.logback:logback-core:1.2.3' + compile 'ch.qos.logback:logback-classic:1.2.3' + compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8' + compile 'com.github.jiconfont:jiconfont-font_awesome:4.7.0.1' + compile 'com.github.jiconfont:jiconfont-javafx:1.0.0' + compile 'com.github.jiconfont:jiconfont-swing:1.0.1' + compile 'com.github.wendykierp:JTransforms:3.1' + compile 'com.google.guava:guava:27.0.1-jre' + compile 'com.jidesoft:jide-oss:3.6.18' + compile 'com.miglayout:miglayout-swing:5.2' + compile 'javax.usb:usb-api:1.0.2' + compile 'net.coderazzi:tablefilter-swing:5.4.0' + compile 'org.apache.axis:axis:1.4' + compile 'org.apache.axis:axis-jaxrpc:1.4' + compile 'org.apache.commons:commons-lang3:3.8.1' + compile 'org.apache.commons:commons-io:1.3.2' + compile 'org.apache.mina:mina-core:2.0.19' + compile 'org.apache.mina:mina-http:2.0.19' + compile "org.openjfx:javafx-base:11:win" + compile "org.openjfx:javafx-base:11:linux" + compile "org.openjfx:javafx-base:11:mac" + compile "org.openjfx:javafx-controls:11:win" + compile "org.openjfx:javafx-controls:11:linux" + compile "org.openjfx:javafx-controls:11:mac" + compile "org.openjfx:javafx-graphics:11:win" + compile "org.openjfx:javafx-graphics:11:linux" + compile "org.openjfx:javafx-graphics:11:mac" + compile "org.openjfx:javafx-swing:11:win" + compile "org.openjfx:javafx-swing:11:linux" + compile "org.openjfx:javafx-swing:11:mac" + compile 'org.slf4j:slf4j-api:1.7.25' + compile 'org.usb4java:libusb4java:1.3.0' + compile 'org.usb4java:usb4java:1.3.0' + compile 'org.usb4java:usb4java-javax:1.3.0' + compile 'pl.edu.icm:JLargeArrays:1.6' +} + +application { + mainClassName = "io.github.dsheirer.gui.SDRTrunk" +} + idea { module { downloadJavadoc = true @@ -50,48 +99,15 @@ idea { } } -dependencies { - testCompile 'junit:junit:4.12' - testCompile 'org.assertj:assertj-core:3.8.0' - compile fileTree(dir: 'imports', include: '*.jar') - compile 'org.apache.commons:commons-lang3:3.7' - compile 'org.apache.commons:commons-io:1.3.2' - compile 'org.slf4j:slf4j-api:1.7.25' - compile 'ch.qos.logback:logback-core:1.2.3' - compile 'ch.qos.logback:logback-classic:1.2.3' - compile 'com.miglayout:miglayout-swing:5.0' - - compile 'org.usb4java:usb4java-javax:1.3.0' - compile 'org.usb4java:usb4java:1.3.0' - compile 'org.usb4java:libusb4java:1.3.0' - compile 'javax.usb:usb-api:1.0.2' - compile 'com.github.wendykierp:JTransforms:3.1' - compile 'pl.edu.icm:JLargeArrays:1.6' - compile 'net.coderazzi:tablefilter-swing:5.3.1' - compile 'com.jidesoft:jide-oss:3.6.18' - compile 'org.apache.mina:mina-core:2.0.16' - compile 'org.apache.mina:mina-http:2.0.16' - compile 'org.apache.axis:axis-jaxrpc:1.4' - compile 'org.apache.axis:axis:1.4' - compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.3' - compile 'com.google.guava:guava:27.0-jre' - compile group: 'com.github.jiconfont', name: 'jiconfont-font_awesome', version: '4.7.0.1' - compile group: 'com.github.jiconfont', name: 'jiconfont-javafx', version: '1.0.0' - compile group: 'com.github.jiconfont', name: 'jiconfont-swing', version: '1.0.1' +javafx { + modules = ['javafx.base', 'javafx.controls', 'javafx.graphics', 'javafx.swing'] } -task wrapper(type: Wrapper) { - gradleVersion = '4.3.1' -} - -task buildSdr(type: Jar) { - manifest { - attributes 'Implementation-Title': 'SdrTrunk project', - 'Implementation-Version': version, - 'Main-Class': 'io.github.dsheirer.gui.SDRTrunk', - 'Class-Path': 'jmbe-0.3.2.jar jmbe-0.3.3.jar' - } - baseName = project.name + '-all' - from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } - with jar +runtime { + targetPlatform('linux-x64', '/media/denny/WD250GB/java/linux/jdk-11.0.1') + targetPlatform('osx-x64', '/media/denny/WD250GB/java/osx/jdk-11.0.1.jdk/Contents/Home') + targetPlatform('windows-x64', '/media/denny/WD250GB/java/windows/jdk-11.0.1') + options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + modules = ['java.desktop', 'java.naming', 'jdk.unsupported', 'jdk.unsupported.desktop'] + imageZip = file("$buildDir/image/sdr-trunk-" + version + ".zip") } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 6b6ea3ab..87b738cb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ec178c54..f0d05de5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,25 @@ -#Sun Nov 25 05:28:28 EST 2018 +# +# ******************************************************************************* +# sdrtrunk +# Copyright (C) 2014-2019 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 +# ****************************************************************************** +# + distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip diff --git a/gradlew b/gradlew index cccdd3d5..af6708ff 100755 --- a/gradlew +++ b/gradlew @@ -28,7 +28,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index e95643d6..0f8d5937 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupEditor.java b/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupEditor.java index 72f1203d..8f50a5cc 100644 --- a/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupEditor.java +++ b/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupEditor.java @@ -29,15 +29,11 @@ import org.slf4j.LoggerFactory; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFormattedTextField; -import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; -import javax.swing.JPanel; import javax.swing.text.MaskFormatter; import java.awt.Color; import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -229,29 +225,4 @@ public class TalkgroupEditor extends DocumentListenerEditor setModified(false); } - - public static void main(String[] args) - { - Talkgroup talkgroup = new Talkgroup(); - talkgroup.setProtocol(Protocol.APCO25); - talkgroup.setValue(12345678 ); - - JFrame frame = new JFrame("Talkgroup Editor"); - frame.setSize(new Dimension(500, 400)); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel panel = new JPanel(); - TalkgroupEditor talkgroupEditor = new TalkgroupEditor(null); - panel.add(talkgroupEditor); - frame.setContentPane(panel); - - EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - frame.setVisible(true); - talkgroupEditor.setItem(talkgroup); - } - }); - } } diff --git a/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupRangeEditor.java b/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupRangeEditor.java index 1e00361e..312e5676 100644 --- a/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupRangeEditor.java +++ b/src/main/java/io/github/dsheirer/alias/id/talkgroup/TalkgroupRangeEditor.java @@ -1,7 +1,7 @@ /* * ****************************************************************************** * sdrtrunk - * Copyright (C) 2014-2019 Dennis Sheirer + * Copyright (C) 2014-2018 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 diff --git a/src/main/java/io/github/dsheirer/channel/state/DecoderState.java b/src/main/java/io/github/dsheirer/channel/state/DecoderState.java index 3c1211f3..68267a96 100644 --- a/src/main/java/io/github/dsheirer/channel/state/DecoderState.java +++ b/src/main/java/io/github/dsheirer/channel/state/DecoderState.java @@ -35,7 +35,6 @@ import io.github.dsheirer.message.IMessageListener; import io.github.dsheirer.module.Module; import io.github.dsheirer.module.decode.DecoderType; import io.github.dsheirer.module.decode.event.ActivitySummaryProvider; -import io.github.dsheirer.module.decode.event.CallEvent; import io.github.dsheirer.module.decode.event.IDecodeEvent; import io.github.dsheirer.module.decode.event.IDecodeEventProvider; import io.github.dsheirer.sample.Broadcaster; @@ -64,7 +63,6 @@ public abstract class DecoderState extends Module implements ActivitySummaryProv private ConfigurationIdentifierListener mConfigurationIdentifierListener = new ConfigurationIdentifierListener(); private IChannelDescriptor mCurrentChannel; - protected CallEvent mCurrentCallEvent; public DecoderState() { @@ -107,7 +105,7 @@ public abstract class DecoderState extends Module implements ActivitySummaryProv } /** - * Provides subclass reference to the call event broadcaster + * Provides subclass reference to the decode event broadcaster */ protected Broadcaster getDecodeEventBroadcaster() { diff --git a/src/main/java/io/github/dsheirer/dsp/filter/halfband/real/HalfBandFilter.java b/src/main/java/io/github/dsheirer/dsp/filter/halfband/real/HalfBandFilter.java index 9f944f1e..6b1bf893 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/halfband/real/HalfBandFilter.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/halfband/real/HalfBandFilter.java @@ -1,27 +1,28 @@ -/******************************************************************************* - * SDR Trunk - * Copyright (C) 2014,2015 Dennis Sheirer +/* + * ****************************************************************************** + * sdrtrunk + * Copyright (C) 2014-2019 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 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. + * 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 - ******************************************************************************/ + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * ***************************************************************************** + */ package io.github.dsheirer.dsp.filter.halfband.real; import io.github.dsheirer.sample.buffer.ReusableBufferQueue; import io.github.dsheirer.sample.buffer.ReusableFloatBuffer; import org.apache.commons.lang3.Validate; -@Deprecated public class HalfBandFilter { private float[] mBuffer; diff --git a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java index bc02ca44..35e8bbdc 100644 --- a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java +++ b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java @@ -19,6 +19,7 @@ */ package io.github.dsheirer.gui; +import com.jidesoft.plaf.LookAndFeelFactory; import com.jidesoft.swing.JideSplitPane; import io.github.dsheirer.alias.AliasModel; import io.github.dsheirer.audio.AudioPacketManager; @@ -71,6 +72,8 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JSeparator; import javax.swing.KeyStroke; +import javax.swing.UIManager; +import javax.swing.plaf.metal.MetalLookAndFeel; import java.awt.AWTException; import java.awt.Desktop; import java.awt.Dimension; @@ -87,6 +90,7 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Locale; public class SDRTrunk implements Listener { @@ -118,6 +122,21 @@ public class SDRTrunk implements Listener mApplicationLog = new ApplicationLog(mUserPreferences); mApplicationLog.start(); + String operatingSystem = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); + + if(operatingSystem.contains("mac") || operatingSystem.contains("nux")) + { + try + { + UIManager.setLookAndFeel(MetalLookAndFeel.class.getName()); + LookAndFeelFactory.installJideExtension(); + } + catch(Exception e) + { + mLog.error("Error trying to set Metal look and feel for OS [" + operatingSystem + "]"); + } + } + //Setup the application home directory Path home = getHomePath(); diff --git a/src/main/java/io/github/dsheirer/gui/control/MultipleFrequencyEditor.java b/src/main/java/io/github/dsheirer/gui/control/MultipleFrequencyEditor.java index 01772e3f..3bac4fab 100644 --- a/src/main/java/io/github/dsheirer/gui/control/MultipleFrequencyEditor.java +++ b/src/main/java/io/github/dsheirer/gui/control/MultipleFrequencyEditor.java @@ -451,7 +451,7 @@ public class MultipleFrequencyEditor extends JPanel } catch(Exception exc) { - return new Double(0); + return 0.0d; } } } diff --git a/src/main/java/io/github/dsheirer/module/decode/event/CallEvent.java b/src/main/java/io/github/dsheirer/module/decode/event/CallEvent.java deleted file mode 100644 index 73ee4a5a..00000000 --- a/src/main/java/io/github/dsheirer/module/decode/event/CallEvent.java +++ /dev/null @@ -1,359 +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 - * - ******************************************************************************/ -package io.github.dsheirer.module.decode.event; - -import io.github.dsheirer.alias.Alias; -import io.github.dsheirer.alias.AliasList; -import io.github.dsheirer.channel.IChannelDescriptor; -import io.github.dsheirer.identifier.Identifier; -import io.github.dsheirer.module.decode.DecoderType; - -import java.text.SimpleDateFormat; -import java.util.Collection; -import java.util.Date; - -public abstract class CallEvent implements Comparable -{ - protected long mEventStart = System.currentTimeMillis(); - protected long mEventEnd; - - private SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd"); - private SimpleDateFormat TIME_FORMATTER = new SimpleDateFormat("HHmmss"); - - protected DecoderType mDecoderType; - protected CallEventType mCallEventType; - protected AliasList mAliasList; - protected String mFromID; - protected String mToID; - protected String mDetails; - - //New call event format member variables - protected IChannelDescriptor mChannelDescriptor; - protected Collection mIdentifiers; - - private boolean mValid = true; - - /** - * Constructs a call event - * @param decoder type - * @param callEventType description - * @param channelDescriptor that identifies the channel and frequency value(s) - * @param identifiers for to, from, comments, etc. - */ - public CallEvent(DecoderType decoder, CallEventType callEventType, IChannelDescriptor channelDescriptor, Collection identifiers) - { - mDecoderType = decoder; - mCallEventType = callEventType; - mChannelDescriptor = channelDescriptor; - mIdentifiers = identifiers; - } - - /** - * Legacy call event constructor - */ - @Deprecated //Remove once all decoder states have been updated to new constructor - public CallEvent(DecoderType decoder, CallEventType callEventType, AliasList aliasList, String fromID, - String toID, String details) - { - mDecoderType = decoder; - mCallEventType = callEventType; - mAliasList = aliasList; - mFromID = fromID; - mToID = toID; - mDetails = details; - } - - /** - * Identifier collection for this call event - */ - public Collection getIdentifiers() - { - return mIdentifiers; - } - - /** - * Indicates if this event is valid. Use this method to mark a previously - * dispatched event as invalid and resend it so that any downstream - * processing can remove the invalid event. - */ - public void setValid(boolean valid) - { - mValid = valid; - } - - public boolean isValid() - { - return mValid; - } - - public void setEnd(long end) - { - mEventEnd = end; - } - - public void end() - { - setEnd(System.currentTimeMillis()); - } - - public DecoderType getDecoderType() - { - return mDecoderType; - } - - public CallEventType getCallEventType() - { - return mCallEventType; - } - - public void setCallEventType(CallEventType type) - { - mCallEventType = type; - } - - public AliasList getAliasList() - { - return mAliasList; - } - - public void setAliasList(AliasList aliasList) - { - mAliasList = aliasList; - } - - public boolean hasAliasList() - { - return mAliasList != null; - } - - public long getEventStartTime() - { - return mEventStart; - } - - public long getEventEndTime() - { - return mEventEnd; - } - - public String getFromID() - { - return mFromID; - } - - public boolean hasFromID() - { - return mFromID != null; - } - - public void setFromID(String id) - { - mFromID = id; - } - - public String getToID() - { - return mToID; - } - - public boolean hasToID() - { - return mToID != null; - } - - public void setToID(String id) - { - mToID = id; - } - - public String getDetails() - { - return mDetails; - } - - public void setDetails(String details) - { - mDetails = details; - } - - public abstract Alias getFromIDAlias(); - - public abstract Alias getToIDAlias(); - - public abstract String getChannel(); - - public abstract long getFrequency(); - - public static String getCSVHeader() - { - return "START_DATE,START_TIME,END_DATE,END_TIME,DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,CHANNEL_NUMBER," + - "FREQUENCY,DETAILS"; - } - - public String toCSV() - { - StringBuilder sb = new StringBuilder(); - - sb.append("'"); - - Date eventStart = new Date(getEventStartTime()); - sb.append(DATE_FORMATTER.format(eventStart)); - sb.append("','"); - sb.append(TIME_FORMATTER.format(eventStart)); - sb.append("','"); - if(mEventEnd != 0) - { - Date eventEnd = new Date(getEventEndTime()); - sb.append(DATE_FORMATTER.format(eventEnd)); - sb.append("','"); - sb.append(TIME_FORMATTER.format(eventEnd)); - sb.append("','"); - } - else - { - sb.append("','',"); - } - sb.append("','"); - sb.append(getDecoderType().toString()); - sb.append("','"); - sb.append(getCallEventType().toString()); - sb.append("',"); - if(getFromID() != null) - { - sb.append("'"); - sb.append(getFromID()); - sb.append("'"); - } - sb.append(","); - - Alias fromAlias = getFromIDAlias(); - - if(fromAlias != null) - { - sb.append("'"); - sb.append(fromAlias.getName()); - sb.append("'"); - } - sb.append(","); - - if(getToID() != null) - { - sb.append("'"); - sb.append(getToID()); - sb.append("'"); - } - sb.append(","); - - Alias toAlias = getToIDAlias(); - - if(toAlias != null) - { - sb.append("'"); - sb.append(toAlias.getName()); - sb.append("'"); - } - sb.append(",'"); - sb.append(getChannel()); - sb.append("','"); - sb.append(getFrequency()); - sb.append("',"); - if(getDetails() != null) - { - sb.append("'"); - sb.append(getDetails()); - sb.append("'"); - } - - return sb.toString(); - } - - public enum CallEventType - { - ANNOUNCEMENT("Announcement"), - AUTOMATIC_REGISTRATION_SERVICE("Motorola ARS"), - CALL("Call"), - CALL_ALERT("Call Alert"), - CALL_DETECT("Call Detect"), - CALL_DO_NOT_MONITOR("Call-Do Not Monitor"), - CALL_END("Call End"), - CALL_UNIQUE_ID("UID Call"), - CALL_NO_TUNER("Call - No Tuner"), - CALL_TIMEOUT("Call Timeout"), - COMMAND("Command"), - DATA_CALL("Data Call"), - DATA_PACKET("Data Packet"), - DEREGISTER("Deregister"), - EMERGENCY("EMERGENCY"), - ENCRYPTED_CALL("Encrypted Call"), - FUNCTION("Function"), - GPS("GPS"), - GROUP_CALL("Group Call"), - ID_ANI("ANI"), - ID_UNIQUE("Unique ID"), - IP_PACKET("IP Packet"), - NOTIFICATION("Notification"), - PAGE("Page"), - PATCH_GROUP_ADD("Patch Group Add"), - PATCH_GROUP_CALL("Patch Group Call"), - PATCH_GROUP_DELETE("Patch Group Delete"), - QUERY("Query"), - REGISTER("Register"), - REGISTER_ESN("ESN"), - RESPONSE("Response"), - RESPONSE_PACKET("Response Packet"), - SDM("Short Data Message"), - SNDCP_PACKET("SNDCP Packet"), - STATION_ID("Station ID"), - STATUS("Status"), - TCP_PACKET("TCP/IP Packet"), - TELEPHONE_INTERCONNECT("Telephone Interconnect"), - UDP_PACKET("UDP/IP Packet"), - UNIT_TO_UNIT_CALL("Unit To Unit Call"), - UNKNOWN("Unknown"), - INVALID("Invalid"); - - private String mLabel; - - private CallEventType(String label) - { - mLabel = label; - } - - public String getLabel() - { - return mLabel; - } - - public String toString() - { - return mLabel; - } - } - - @Override - public int compareTo(CallEvent other) - { - if(other != null && other == this) - { - return 0; - } - - return Long.compare(mEventStart, other.getEventStartTime()); - } -} diff --git a/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200CallEvent.java b/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200CallEvent.java deleted file mode 100644 index 15713a3b..00000000 --- a/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200CallEvent.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * ****************************************************************************** - * sdrtrunk - * Copyright (C) 2014-2018 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 - * ***************************************************************************** - */ -package io.github.dsheirer.module.decode.lj1200; - -import io.github.dsheirer.alias.Alias; -import io.github.dsheirer.alias.AliasList; -import io.github.dsheirer.module.decode.DecoderType; -import io.github.dsheirer.module.decode.event.CallEvent; - -public class LJ1200CallEvent extends CallEvent -{ - public LJ1200CallEvent(CallEventType callEventType, AliasList aliasList, String fromID, String toID, String details) - { - super(DecoderType.LJ_1200, callEventType, aliasList, fromID, toID, details); - } - - private Alias getAlias(String ident) - { - return null; - } - - @Override - public Alias getFromIDAlias() - { - return getAlias(getFromID()); - } - - @Override - public Alias getToIDAlias() - { - return getAlias(getToID()); - } - - @Override - public String getChannel() - { - return null; - } - - @Override - public long getFrequency() - { - return 173075000; - } - - public static class Builder - { - /* Required parameters */ - private CallEventType mCallEventType; - - /* Optional parameters */ - private AliasList mAliasList; - private String mFromID; - private String mToID; - private String mDetails; - - public Builder(CallEventType callEventType) - { - mCallEventType = callEventType; - } - - public Builder aliasList(AliasList aliasList) - { - mAliasList = aliasList; - return this; - } - - public Builder from(String val) - { - mFromID = val; - return this; - } - - public Builder details(String details) - { - mDetails = details; - return this; - } - - public Builder to(String toID) - { - mToID = toID; - return this; - } - - public LJ1200CallEvent build() - { - return new LJ1200CallEvent(this); - } - } - - /** - * Private constructor for the builder - */ - private LJ1200CallEvent(Builder builder) - { - this(builder.mCallEventType, - builder.mAliasList, - builder.mFromID, - builder.mToID, - builder.mDetails); - } - - public static LJ1200CallEvent getLJ1200Event(LJ1200Message message) - { - CallEventType type = CallEventType.COMMAND; - return new LJ1200CallEvent.Builder(type).to(message.getAddress()).details(message.toString()).build(); - } -} diff --git a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderState.java b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderState.java index 7cd67fd3..b4280602 100644 --- a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderState.java +++ b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderState.java @@ -1,7 +1,7 @@ /* * ****************************************************************************** * sdrtrunk - * Copyright (C) 2014-2018 Dennis Sheirer + * Copyright (C) 2014-2019 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 @@ -307,12 +307,6 @@ public class MPT1327DecoderState extends DecoderState { broadcast(new ChangeChannelTimeoutEvent(this, mChannelType, DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS * 1000)); - - if(mCurrentCallEvent != null) - { - mCurrentCallEvent.end(); - mCurrentCallEvent = null; - } } } diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/audio/P25AudioModule.java b/src/main/java/io/github/dsheirer/module/decode/p25/audio/P25AudioModule.java index ab8dc38e..48be471c 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/audio/P25AudioModule.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/audio/P25AudioModule.java @@ -222,6 +222,11 @@ public class P25AudioModule extends AbstractAudioModule implements Listener - * - ******************************************************************************/ + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * ***************************************************************************** + */ package io.github.dsheirer.module.decode.p25.message.pdu; import io.github.dsheirer.bits.CorrectedBinaryMessage; @@ -22,6 +26,7 @@ import io.github.dsheirer.module.decode.p25.identifier.talkgroup.APCO25ToTalkgro import io.github.dsheirer.module.decode.p25.message.P25Message; import io.github.dsheirer.module.decode.p25.message.tsbk.Opcode; import io.github.dsheirer.module.decode.p25.reference.DataUnitID; +import io.github.dsheirer.module.decode.p25.reference.Direction; import io.github.dsheirer.module.decode.p25.reference.PDUFormat; import io.github.dsheirer.module.decode.p25.reference.ServiceAccessPoint; import io.github.dsheirer.module.decode.p25.reference.Vendor; @@ -196,7 +201,7 @@ public class PDUMessage extends P25Message { if(getFormat() == PDUFormat.ALTERNATE_MULTI_BLOCK_TRUNKING_CONTROL) { - return Opcode.fromValue(getMessage().getInt(OPCODE)); + return Opcode.fromValue(getMessage().getInt(OPCODE), Direction.OUTBOUND, getVendor()); } return Opcode.OSP_UNKNOWN; diff --git a/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200CallEvent.java b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200CallEvent.java deleted file mode 100644 index 5cbf898c..00000000 --- a/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200CallEvent.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * ****************************************************************************** - * sdrtrunk - * Copyright (C) 2014-2018 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 - * ***************************************************************************** - */ -package io.github.dsheirer.module.decode.tait; - -import io.github.dsheirer.alias.Alias; -import io.github.dsheirer.alias.AliasList; -import io.github.dsheirer.module.decode.DecoderType; -import io.github.dsheirer.module.decode.event.CallEvent; - -public class Tait1200CallEvent extends CallEvent -{ - public Tait1200CallEvent(CallEventType callEventType, - AliasList aliasList, - String fromID, - String toID, - String details) - { - super(DecoderType.TAIT_1200, callEventType, - aliasList, fromID, toID, details); - } - - private Alias getAlias(String ident) - { - return null; - } - - @Override - public Alias getFromIDAlias() - { - return getAlias(getFromID()); - } - - @Override - public Alias getToIDAlias() - { - return getAlias(getToID()); - } - - @Override - public String getChannel() - { - return null; - } - - @Override - public long getFrequency() - { - return 0; - } - - public static class Builder - { - /* Required parameters */ - private CallEventType mCallEventType; - - /* Optional parameters */ - private AliasList mAliasList; - private String mFromID; - private String mToID; - private String mDetails; - - public Builder(CallEventType callEventType) - { - mCallEventType = callEventType; - } - - public Builder aliasList(AliasList aliasList) - { - mAliasList = aliasList; - return this; - } - - public Builder from(String val) - { - mFromID = val; - return this; - } - - public Builder details(String details) - { - mDetails = details; - return this; - } - - public Builder to(String toID) - { - mToID = toID; - return this; - } - - public Tait1200CallEvent build() - { - return new Tait1200CallEvent(this); - } - } - - /** - * Private constructor for the builder - */ - private Tait1200CallEvent(Builder builder) - { - this(builder.mCallEventType, builder.mAliasList, builder.mFromID, builder.mToID, builder.mDetails); - } - - public static Tait1200CallEvent getLJ1200Event(Tait1200GPSMessage message) - { - CallEventType type = CallEventType.COMMAND; - - return new Tait1200CallEvent.Builder(type).details(message.toString()).build(); - } -} diff --git a/src/main/java/io/github/dsheirer/record/wave/WaveWriter.java b/src/main/java/io/github/dsheirer/record/wave/WaveWriter.java index 826af177..ff4796fa 100644 --- a/src/main/java/io/github/dsheirer/record/wave/WaveWriter.java +++ b/src/main/java/io/github/dsheirer/record/wave/WaveWriter.java @@ -1,6 +1,7 @@ -/******************************************************************************* +/* + * ****************************************************************************** * sdrtrunk - * Copyright (C) 2014-2017 Dennis Sheirer + * Copyright (C) 2014-2019 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 @@ -14,8 +15,8 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see - * - ******************************************************************************/ + * ***************************************************************************** + */ package io.github.dsheirer.record.wave; import org.apache.commons.lang3.Validate; @@ -171,14 +172,6 @@ public class WaveWriter implements AutoCloseable } } - @Override - protected void finalize() throws IOException - { - mFileChannel.force(true); - mFileChannel.close(); - mFileChannel = null; - } - /** * Writes the buffer contents to the file. Assumes that the buffer is full * and the first byte of data is at position 0. diff --git a/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacket.java b/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacket.java index c9daf6a0..f6a3b128 100644 --- a/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacket.java +++ b/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacket.java @@ -1,18 +1,22 @@ -/******************************************************************************* - * sdr-trunk - * Copyright (C) 2014-2018 Dennis Sheirer +/* + * ****************************************************************************** + * sdrtrunk + * Copyright (C) 2014-2019 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 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. + * 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 - * - ******************************************************************************/ + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * ***************************************************************************** + */ package io.github.dsheirer.sample.buffer; import io.github.dsheirer.alias.id.broadcast.BroadcastChannel; @@ -255,7 +259,6 @@ public class ReusableAudioPacket extends AbstractReusableBuffer * * @param audio to load */ - @Deprecated public void loadAudioFrom(float[] audio) { mAudioSamples = audio; diff --git a/src/main/java/io/github/dsheirer/spectrum/ChannelSpectrumPanel.java b/src/main/java/io/github/dsheirer/spectrum/ChannelSpectrumPanel.java index 9314bf98..c8b8de57 100644 --- a/src/main/java/io/github/dsheirer/spectrum/ChannelSpectrumPanel.java +++ b/src/main/java/io/github/dsheirer/spectrum/ChannelSpectrumPanel.java @@ -1,18 +1,22 @@ -/******************************************************************************* - * sdr-trunk - * Copyright (C) 2014-2018 Dennis Sheirer +/* + * ****************************************************************************** + * sdrtrunk + * Copyright (C) 2014-2019 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 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. + * 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 - * - ******************************************************************************/ + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * ***************************************************************************** + */ package io.github.dsheirer.spectrum; import io.github.dsheirer.controller.channel.Channel; @@ -145,8 +149,8 @@ public class ChannelSpectrumPanel extends JPanel implements ChannelEventListener mOverlayPanel.addMouseListener(mouser); mOverlayPanel.addMouseMotionListener(mouser); - mLayeredPane.add(mSpectrumPanel, new Integer(0), 0); - mLayeredPane.add(mOverlayPanel, new Integer(1), 0); + mLayeredPane.add(mSpectrumPanel, 0, 0); + mLayeredPane.add(mOverlayPanel, 1, 0); add(mLayeredPane); } diff --git a/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java b/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java index 20b73a8e..a2973638 100644 --- a/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java +++ b/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java @@ -365,8 +365,8 @@ public class SpectralDisplayPanel extends JPanel implements Listener labels = new Hashtable<>(); - labels.put(new Integer(0), new JLabel("1x")); - labels.put(new Integer(1), new JLabel("2x")); - labels.put(new Integer(2), new JLabel("4x")); - labels.put(new Integer(3), new JLabel("8x")); - labels.put(new Integer(4), new JLabel("16x")); - labels.put(new Integer(5), new JLabel("32x")); - labels.put(new Integer(6), new JLabel("64x")); + labels.put(0, new JLabel("1x")); + labels.put(1, new JLabel("2x")); + labels.put(2, new JLabel("4x")); + labels.put(3, new JLabel("8x")); + labels.put(4, new JLabel("16x")); + labels.put(5, new JLabel("32x")); + labels.put(6, new JLabel("64x")); setLabelTable(labels); diff --git a/src/main/java/io/github/dsheirer/spectrum/menu/SmoothingItem.java b/src/main/java/io/github/dsheirer/spectrum/menu/SmoothingItem.java index f99436ca..71d60273 100644 --- a/src/main/java/io/github/dsheirer/spectrum/menu/SmoothingItem.java +++ b/src/main/java/io/github/dsheirer/spectrum/menu/SmoothingItem.java @@ -1,9 +1,30 @@ +/* + * ****************************************************************************** + * sdrtrunk + * Copyright (C) 2014-2019 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 + * ***************************************************************************** + */ + package io.github.dsheirer.spectrum.menu; import io.github.dsheirer.dsp.filter.smoothing.SmoothingFilter; import io.github.dsheirer.spectrum.SpectralDisplayAdjuster; -import javax.swing.*; +import javax.swing.JLabel; +import javax.swing.JSlider; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.event.MouseEvent; @@ -16,60 +37,71 @@ public class SmoothingItem extends JSlider implements ChangeListener private SpectralDisplayAdjuster mAdjuster; private int mDefaultValue; - - public SmoothingItem( SpectralDisplayAdjuster adjuster, int defaultValue ) - { - super( JSlider.HORIZONTAL, - SmoothingFilter.SMOOTHING_MINIMUM, - SmoothingFilter.SMOOTHING_MAXIMUM, - adjuster.getSmoothing() ); - - mDefaultValue = defaultValue; - mAdjuster = adjuster; - - setSnapToTicks( true ); - setMajorTickSpacing( 6 ); - setMinorTickSpacing( 2 ); - setPaintTicks( true ); - setPaintLabels( true ); - - Hashtable labels = new Hashtable<>(); - labels.put( new Integer( 3 ), new JLabel( "3" ) ); - labels.put( new Integer( 9 ), new JLabel( "9" ) ); - labels.put( new Integer( 15 ), new JLabel( "15" ) ); - labels.put( new Integer( 21 ), new JLabel( "21" ) ); - labels.put( new Integer( 27 ), new JLabel( "27" ) ); - - setLabelTable( labels ); - - addChangeListener( this ); - addMouseListener( new MouseListener() - { - @Override - public void mouseClicked( MouseEvent event ) - { - if( event.getClickCount() == 2 ) - { - SmoothingItem.this.setValue( mDefaultValue ); - } - } - - public void mouseReleased( MouseEvent arg0 ) {} - public void mousePressed( MouseEvent arg0 ) {} - public void mouseExited( MouseEvent arg0 ) {} - public void mouseEntered( MouseEvent arg0 ) {} - } ); + public SmoothingItem(SpectralDisplayAdjuster adjuster, int defaultValue) + { + super(JSlider.HORIZONTAL, + SmoothingFilter.SMOOTHING_MINIMUM, + SmoothingFilter.SMOOTHING_MAXIMUM, + adjuster.getSmoothing()); + + mDefaultValue = defaultValue; + mAdjuster = adjuster; + + setSnapToTicks(true); + setMajorTickSpacing(6); + setMinorTickSpacing(2); + setPaintTicks(true); + setPaintLabels(true); + + Hashtable labels = new Hashtable<>(); + labels.put(3, new JLabel("3")); + labels.put(9, new JLabel("9")); + labels.put(15, new JLabel("15")); + labels.put(21, new JLabel("21")); + labels.put(27, new JLabel("27")); + + setLabelTable(labels); + + addChangeListener(this); + + addMouseListener(new MouseListener() + { + @Override + public void mouseClicked(MouseEvent event) + { + if(event.getClickCount() == 2) + { + SmoothingItem.this.setValue(mDefaultValue); + } + } + + public void mouseReleased(MouseEvent arg0) + { + } + + public void mousePressed(MouseEvent arg0) + { + } + + public void mouseExited(MouseEvent arg0) + { + } + + public void mouseEntered(MouseEvent arg0) + { + } + }); } - @Override - public void stateChanged( ChangeEvent event ) + @Override + public void stateChanged(ChangeEvent event) { - int value = ((JSlider)event.getSource()).getValue(); + int value = ((JSlider)event.getSource()).getValue(); - if( value % 2 == 1 ) - { - mAdjuster.setSmoothing( value ); - } + if(value % 2 == 1) + { + mAdjuster.setSmoothing(value); + } } }