From cbe9c79498466c82cd5354034a685dcc46e9a9db Mon Sep 17 00:00:00 2001 From: Dennis Sheirer Date: Mon, 24 Jul 2023 04:30:16 -0400 Subject: [PATCH] #1612 Enhance aliasing to support DCS tones --- .../github/dsheirer/alias/AliasFactory.java | 82 ++----------- .../io/github/dsheirer/alias/AliasList.java | 36 ++++-- .../io/github/dsheirer/alias/id/AliasID.java | 31 +++-- .../github/dsheirer/alias/id/AliasIDType.java | 30 +++-- .../io/github/dsheirer/alias/id/dcs/Dcs.java | 111 ++++++++++++++++++ .../gui/playlist/alias/AliasItemEditor.java | 60 ++++++---- .../playlist/alias/identifier/DcsEditor.java | 98 ++++++++++++++++ .../identifier/IdentifierEditorFactory.java | 4 +- .../io/github/dsheirer/identifier/Form.java | 1 + .../dsheirer/module/decode/dcs/DCSCode.java | 7 +- .../module/decode/dcs/DCSMessage.java | 2 +- 11 files changed, 323 insertions(+), 139 deletions(-) create mode 100644 src/main/java/io/github/dsheirer/alias/id/dcs/Dcs.java create mode 100644 src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/DcsEditor.java diff --git a/src/main/java/io/github/dsheirer/alias/AliasFactory.java b/src/main/java/io/github/dsheirer/alias/AliasFactory.java index 12c40e47b..c89071605 100644 --- a/src/main/java/io/github/dsheirer/alias/AliasFactory.java +++ b/src/main/java/io/github/dsheirer/alias/AliasFactory.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2022 Dennis Sheirer + * Copyright (C) 2014-2023 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 @@ -19,22 +19,15 @@ package io.github.dsheirer.alias; import io.github.dsheirer.alias.action.AliasAction; -import io.github.dsheirer.alias.action.AliasActionType; import io.github.dsheirer.alias.action.beep.BeepAction; import io.github.dsheirer.alias.action.clip.ClipAction; import io.github.dsheirer.alias.action.script.ScriptAction; import io.github.dsheirer.alias.id.AliasID; -import io.github.dsheirer.alias.id.AliasIDType; import io.github.dsheirer.alias.id.broadcast.BroadcastChannel; +import io.github.dsheirer.alias.id.dcs.Dcs; import io.github.dsheirer.alias.id.esn.Esn; -import io.github.dsheirer.alias.id.legacy.fleetsync.FleetsyncID; -import io.github.dsheirer.alias.id.legacy.mdc.MDC1200ID; import io.github.dsheirer.alias.id.legacy.mobileID.Min; -import io.github.dsheirer.alias.id.legacy.mpt1327.MPT1327ID; -import io.github.dsheirer.alias.id.legacy.nonrecordable.NonRecordable; import io.github.dsheirer.alias.id.legacy.siteID.SiteID; -import io.github.dsheirer.alias.id.legacy.talkgroup.LegacyTalkgroupID; -import io.github.dsheirer.alias.id.legacy.uniqueID.UniqueID; import io.github.dsheirer.alias.id.lojack.LoJackFunctionAndID; import io.github.dsheirer.alias.id.priority.Priority; import io.github.dsheirer.alias.id.radio.Radio; @@ -45,11 +38,10 @@ import io.github.dsheirer.alias.id.talkgroup.Talkgroup; import io.github.dsheirer.alias.id.talkgroup.TalkgroupRange; import io.github.dsheirer.alias.id.tone.TonesID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AliasFactory { @@ -64,6 +56,11 @@ public static AliasID copyOf(AliasID id) BroadcastChannel copyBroadcast = new BroadcastChannel(); copyBroadcast.setChannelName(originalBroadcast.getChannelName()); return copyBroadcast; + case DCS: + Dcs originalDcs = (Dcs)id; + Dcs copyDcs = new Dcs(); + copyDcs.setDCSCode(originalDcs.getDCSCode()); + return copyDcs; case ESN: Esn originalESN = (Esn)id; Esn copyESN = new Esn(); @@ -234,65 +231,4 @@ public static Alias copyOf(Alias original) return copy; } - - public static AliasID getAliasID(AliasIDType type) - { - switch(type) - { - case BROADCAST_CHANNEL: - return new BroadcastChannel(); - case ESN: - return new Esn(); - case FLEETSYNC: - return new FleetsyncID(); - case LTR_NET_UID: - return new UniqueID(); - case LOJACK: - return new LoJackFunctionAndID(); - case MDC1200: - return new MDC1200ID(); - case MIN: - return new Min(); - case MPT1327: - return new MPT1327ID(); - case NON_RECORDABLE: - return new NonRecordable(); - case PRIORITY: - return new Priority(); - case RADIO_ID: - return new Radio(); - case RADIO_ID_RANGE: - return new RadioRange(); - case RECORD: - return new Record(); - case TALKGROUP: - return new Talkgroup(); - case TALKGROUP_RANGE: - return new TalkgroupRange(); - case SITE: - return new SiteID(); - case STATUS: - return new UserStatusID(); - case LEGACY_TALKGROUP: - return new LegacyTalkgroupID(); - default: - throw new IllegalArgumentException("Unrecognized Alias ID type: " + type); - } - } - - public static AliasAction getAliasAction(AliasActionType type) - { - switch(type) - { - case BEEP: - return new BeepAction(); - case CLIP: - return new ClipAction(); - case SCRIPT: - return new ScriptAction(); - default: - throw new IllegalArgumentException("Unrecognized Alias Action type: " + type); - } - } - } diff --git a/src/main/java/io/github/dsheirer/alias/AliasList.java b/src/main/java/io/github/dsheirer/alias/AliasList.java index 144cd9bbd..fc2115513 100644 --- a/src/main/java/io/github/dsheirer/alias/AliasList.java +++ b/src/main/java/io/github/dsheirer/alias/AliasList.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2022 Dennis Sheirer + * Copyright (C) 2014-2023 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 @@ -21,6 +21,7 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import io.github.dsheirer.alias.id.AliasID; import io.github.dsheirer.alias.id.broadcast.BroadcastChannel; +import io.github.dsheirer.alias.id.dcs.Dcs; import io.github.dsheirer.alias.id.esn.Esn; import io.github.dsheirer.alias.id.priority.Priority; import io.github.dsheirer.alias.id.radio.Radio; @@ -32,6 +33,7 @@ import io.github.dsheirer.alias.id.tone.TonesID; import io.github.dsheirer.identifier.Identifier; import io.github.dsheirer.identifier.IdentifierCollection; +import io.github.dsheirer.identifier.dcs.DCSIdentifier; import io.github.dsheirer.identifier.esn.ESNIdentifier; import io.github.dsheirer.identifier.patch.PatchGroup; import io.github.dsheirer.identifier.patch.PatchGroupIdentifier; @@ -41,12 +43,8 @@ import io.github.dsheirer.identifier.talkgroup.TalkgroupIdentifier; import io.github.dsheirer.identifier.tone.ToneIdentifier; import io.github.dsheirer.identifier.tone.ToneSequence; +import io.github.dsheirer.module.decode.dcs.DCSCode; import io.github.dsheirer.protocol.Protocol; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -57,6 +55,10 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * List of aliases that share the same alias list name and provides convenient methods for looking up alias @@ -67,6 +69,7 @@ public class AliasList private final static Logger mLog = LoggerFactory.getLogger(AliasList.class); private Map mTalkgroupProtocolMap = new EnumMap<>(Protocol.class); private Map mRadioProtocolMap = new EnumMap<>(Protocol.class); + private Map mDCSCodeAliasMap = new EnumMap<>(DCSCode.class); private Map mESNMap = new HashMap<>(); private Map mUnitStatusMap = new HashMap<>(); private Map mUserStatusMap = new HashMap<>(); @@ -178,6 +181,12 @@ private void addAliasID(AliasID id, Alias alias) radioRangeAliasList.add(radioRange, alias); break; + case DCS: + if(id instanceof Dcs dcs) + { + mDCSCodeAliasMap.put(dcs.getDCSCode(), alias); + } + break; case ESN: String esn = ((Esn)id).getEsn(); @@ -418,7 +427,7 @@ public List getAliases(Identifier identifier) return toList(radioAliasList.getAlias(radio)); } break; - case ESN: + case DCS: if(identifier instanceof ESNIdentifier) { return toList(getESNAlias(((ESNIdentifier)identifier).getValue())); @@ -439,9 +448,9 @@ public List getAliases(Identifier identifier) } break; case TONE: - if(identifier instanceof ToneIdentifier) + if(identifier instanceof ToneIdentifier toneIdentifier) { - ToneSequence toneSequence = ((ToneIdentifier)identifier).getValue(); + ToneSequence toneSequence = toneIdentifier.getValue(); if(toneSequence != null && toneSequence.hasTones()) { @@ -454,6 +463,15 @@ public List getAliases(Identifier identifier) } } } + else if(identifier instanceof DCSIdentifier dcsIdentifier) + { + DCSCode dcsCode = dcsIdentifier.getValue(); + + if(dcsCode != null) + { + return toList(mDCSCodeAliasMap.get(dcsCode)); + } + } break; } } diff --git a/src/main/java/io/github/dsheirer/alias/id/AliasID.java b/src/main/java/io/github/dsheirer/alias/id/AliasID.java index f8b09ea72..a54223919 100644 --- a/src/main/java/io/github/dsheirer/alias/id/AliasID.java +++ b/src/main/java/io/github/dsheirer/alias/id/AliasID.java @@ -1,23 +1,20 @@ /* + * ***************************************************************************** + * Copyright (C) 2014-2023 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 - * * 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 - * * ***************************************************************************** + * 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.alias.id; @@ -26,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.github.dsheirer.alias.id.broadcast.BroadcastChannel; +import io.github.dsheirer.alias.id.dcs.Dcs; import io.github.dsheirer.alias.id.esn.Esn; import io.github.dsheirer.alias.id.legacy.fleetsync.FleetsyncID; import io.github.dsheirer.alias.id.legacy.mdc.MDC1200ID; @@ -54,6 +52,7 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = BroadcastChannel.class, name = "broadcastChannel"), + @JsonSubTypes.Type(value = Dcs.class, name = "dcs"), @JsonSubTypes.Type(value = Esn.class, name = "esn"), @JsonSubTypes.Type(value = FleetsyncID.class, name = "fleetsyncID"), @JsonSubTypes.Type(value = LegacyTalkgroupID.class, name = "talkgroupID"), diff --git a/src/main/java/io/github/dsheirer/alias/id/AliasIDType.java b/src/main/java/io/github/dsheirer/alias/id/AliasIDType.java index 77a913378..06061a9cb 100644 --- a/src/main/java/io/github/dsheirer/alias/id/AliasIDType.java +++ b/src/main/java/io/github/dsheirer/alias/id/AliasIDType.java @@ -1,23 +1,20 @@ /* + * ***************************************************************************** + * Copyright (C) 2014-2023 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 - * * 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 - * * ***************************************************************************** + * 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.alias.id; @@ -26,6 +23,7 @@ public enum AliasIDType { BROADCAST_CHANNEL("Audio Broadcast Channel"), + DCS("Digital Coded Squelch (DCS)"), ESN("ESN"), INVERT("Audio Inversion"), LOJACK("LoJack"), diff --git a/src/main/java/io/github/dsheirer/alias/id/dcs/Dcs.java b/src/main/java/io/github/dsheirer/alias/id/dcs/Dcs.java new file mode 100644 index 000000000..c35c5eeb3 --- /dev/null +++ b/src/main/java/io/github/dsheirer/alias/id/dcs/Dcs.java @@ -0,0 +1,111 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2023 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.alias.id.dcs; + +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import io.github.dsheirer.alias.id.AliasID; +import io.github.dsheirer.alias.id.AliasIDType; +import io.github.dsheirer.module.decode.dcs.DCSCode; + +/** + * Digital Coded Squelch (DCS) tone identifier + */ +public class Dcs extends AliasID implements Comparable +{ + private DCSCode mDCSCode; + + @Override + public AliasIDType getType() + { + return AliasIDType.DCS; + } + + @Override + public boolean matches(AliasID id) + { + if(isValid() && id instanceof Dcs other) + { + return other.isValid() && getDCSCode().equals(other.getDCSCode()); + } + + return false; + } + + /** + * DCS code + * @return DCS code or null. + */ + @JacksonXmlProperty(isAttribute = true, localName = "code") + public DCSCode getDCSCode() + { + return mDCSCode; + } + + /** + * Sets the DCS code value. + * @param dcsCode to set + */ + public void setDCSCode(DCSCode dcsCode) + { + mDCSCode = dcsCode; + updateValueProperty(); + } + + @Override + public boolean isValid() + { + return mDCSCode != null; + } + + @Override + public boolean isAudioIdentifier() + { + return false; + } + + @Override + public String toString() + { + if(isValid()) + { + return getDCSCode().toString(); + } + + return "DCS-Invalid - No Tone Selected"; + } + + @Override + public int compareTo(Dcs o) + { + if(isValid()) + { + if(o.isValid()) + { + return getDCSCode().compareTo(o.getDCSCode()); + } + else + { + return 1; + } + } + + return -1; + } +} diff --git a/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasItemEditor.java b/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasItemEditor.java index 0ac8dca32..6fd0130a8 100644 --- a/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasItemEditor.java +++ b/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasItemEditor.java @@ -1,23 +1,20 @@ /* + * ***************************************************************************** + * Copyright (C) 2014-2023 Dennis Sheirer * - * * ****************************************************************************** - * * 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 - * * ***************************************************************************** + * 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.gui.playlist.alias; @@ -37,6 +34,7 @@ import io.github.dsheirer.alias.id.AliasID; import io.github.dsheirer.alias.id.AliasIDType; import io.github.dsheirer.alias.id.broadcast.BroadcastChannel; +import io.github.dsheirer.alias.id.dcs.Dcs; import io.github.dsheirer.alias.id.esn.Esn; import io.github.dsheirer.alias.id.lojack.LoJackFunctionAndID; import io.github.dsheirer.alias.id.radio.Radio; @@ -63,6 +61,11 @@ import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.preference.identifier.IntegerFormat; import io.github.dsheirer.protocol.Protocol; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.value.ChangeListener; @@ -106,12 +109,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - /** * Editor for configuring individual aliases */ @@ -717,6 +714,7 @@ private MenuButton getAddIdentifierButton() Menu nbfmMenu = new ProtocolMenu(Protocol.NBFM); nbfmMenu.getItems().add(new AddTalkgroupItem(Protocol.NBFM)); nbfmMenu.getItems().add(new AddTalkgroupRangeItem(Protocol.NBFM)); + nbfmMenu.getItems().add(new AddDcsItem()); Menu passportMenu = new ProtocolMenu(Protocol.PASSPORT); passportMenu.getItems().add(new AddTalkgroupItem(Protocol.PASSPORT)); @@ -1281,6 +1279,24 @@ public AddTonesItem(String label) } } + /** + * Add Digital Coded Squelch (DCS) alias identifier menu item + */ + public class AddDcsItem extends MenuItem + { + public AddDcsItem() + { + super("Digital Coded Squelch (DCS)"); + setOnAction(event -> { + Dcs dcs = new Dcs(); + getIdentifiersList().getItems().add(dcs); + getIdentifiersList().getSelectionModel().select(dcs); + getIdentifiersList().scrollTo(dcs); + modifiedProperty().set(true); + }); + } + } + /** * Menu Item for adding a new protocol-specific Radio ID alias identifier */ diff --git a/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/DcsEditor.java b/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/DcsEditor.java new file mode 100644 index 000000000..3579ebc28 --- /dev/null +++ b/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/DcsEditor.java @@ -0,0 +1,98 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2023 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.gui.playlist.alias.identifier; + +import io.github.dsheirer.alias.id.dcs.Dcs; +import io.github.dsheirer.module.decode.dcs.DCSCode; +import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; +import javafx.scene.layout.GridPane; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Editor for Digital Coded Squelch (DCS) alias identifiers + */ +public class DcsEditor extends IdentifierEditor +{ + private static final Logger mLog = LoggerFactory.getLogger(DcsEditor.class); + private ComboBox mDCSCodeComboBox; + + /** + * Constructs an instance + */ + public DcsEditor() + { + GridPane gridPane = new GridPane(); + gridPane.setHgap(5); + + Label typeLabel = new Label("DCS Code"); + GridPane.setConstraints(typeLabel, 0, 0); + gridPane.getChildren().add(typeLabel); + + GridPane.setConstraints(getDCSCodeComboBox(), 1, 0); + gridPane.getChildren().add(getDCSCodeComboBox()); + + getChildren().add(gridPane); + } + + @Override + public void setItem(Dcs item) + { + super.setItem(item); + if(item.isValid()) + { + getDCSCodeComboBox().getSelectionModel().select(item.getDCSCode()); + } + modifiedProperty().set(false); + } + + @Override + public void save() + { + //no-op + } + + @Override + public void dispose() + { + //no-op + } + + /** + * Combo-box loaded with DCS codes + * @return + */ + private ComboBox getDCSCodeComboBox() + { + if(mDCSCodeComboBox == null) + { + mDCSCodeComboBox = new ComboBox<>(); + mDCSCodeComboBox.getItems().addAll(DCSCode.STANDARD_CODES); + mDCSCodeComboBox.getItems().addAll(DCSCode.INVERTED_CODES); + mDCSCodeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> { + getItem().setDCSCode(getDCSCodeComboBox().getSelectionModel().getSelectedItem()); + modifiedProperty().set(true); + }); + } + + return mDCSCodeComboBox; + } +} diff --git a/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/IdentifierEditorFactory.java b/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/IdentifierEditorFactory.java index 3f294f82d..cb7f775e6 100644 --- a/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/IdentifierEditorFactory.java +++ b/src/main/java/io/github/dsheirer/gui/playlist/alias/identifier/IdentifierEditorFactory.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2020 Dennis Sheirer + * Copyright (C) 2014-2023 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 @@ -35,6 +35,8 @@ public static IdentifierEditor getEditor(AliasIDType type, UserPreferences userP { switch(type) { + case DCS: + return new DcsEditor(); case ESN: return new EsnEditor(); case LOJACK: diff --git a/src/main/java/io/github/dsheirer/identifier/Form.java b/src/main/java/io/github/dsheirer/identifier/Form.java index 1505e3ead..989228d4d 100644 --- a/src/main/java/io/github/dsheirer/identifier/Form.java +++ b/src/main/java/io/github/dsheirer/identifier/Form.java @@ -32,6 +32,7 @@ public enum Form CHANNEL_DESCRIPTOR, CHANNEL_NAME, CHANNEL_FREQUENCY, + DCS, DECODER_TYPE, DTMF, ENCRYPTION_KEY, diff --git a/src/main/java/io/github/dsheirer/module/decode/dcs/DCSCode.java b/src/main/java/io/github/dsheirer/module/decode/dcs/DCSCode.java index 822b1b84c..218c764e2 100644 --- a/src/main/java/io/github/dsheirer/module/decode/dcs/DCSCode.java +++ b/src/main/java/io/github/dsheirer/module/decode/dcs/DCSCode.java @@ -213,7 +213,12 @@ public enum DCSCode /** * Inverted DCS codes */ - private static final EnumSet INVERTED_CODES = EnumSet.range(I023, I754); + public static final EnumSet INVERTED_CODES = EnumSet.range(I023, I754); + + /** + * Standard DCS codes + */ + public static final EnumSet STANDARD_CODES = EnumSet.range(N023,N754); /** * Lookup map for quickly finding a DCS code from the transmitted value. diff --git a/src/main/java/io/github/dsheirer/module/decode/dcs/DCSMessage.java b/src/main/java/io/github/dsheirer/module/decode/dcs/DCSMessage.java index e8107d527..70fd35b41 100644 --- a/src/main/java/io/github/dsheirer/module/decode/dcs/DCSMessage.java +++ b/src/main/java/io/github/dsheirer/module/decode/dcs/DCSMessage.java @@ -47,7 +47,7 @@ public DCSMessage(DCSCode code, long timestamp) @Override public String toString() { - return "Digital Coded Squelch (DCS) Detected: " + mDCSCode.name(); + return "Digital Coded Squelch (DCS) Detected: " + mDCSCode.toString(); } /**