Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decode event type to other DecoderStates to support filtering. #1099

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a8a13e3
Added DecodeEventType to decode event objects.
VolFFProCoder Nov 11, 2021
0920dcb
Refactor of P25 models to accommodate adding event type to P25 event …
VolFFProCoder Nov 11, 2021
c507228
Create new filters for Events. Created EventFilter base class.
VolFFProCoder Nov 11, 2021
2266b2b
Update DecodeEvent panel to show filter button
VolFFProCoder Nov 11, 2021
6f1ddb4
Fixed filtering bug that only checked the first IFilter in a FilterSet.
VolFFProCoder Nov 11, 2021
34e9d3a
Added Clear button to Events.
VolFFProCoder Nov 11, 2021
9e27f72
Removed old test code accidentally pushed.
VolFFProCoder Nov 11, 2021
3c12828
Added event types to other TrafficChannelManagers.
VolFFProCoder Nov 11, 2021
c315795
Added event types to DMR states.
VolFFProCoder Nov 11, 2021
39cfada
Added event type to FleetSync states.
VolFFProCoder Nov 11, 2021
0220892
Added event type to LTRNet states.
VolFFProCoder Nov 11, 2021
7dcc5eb
Added event type to MTP1327 states.
VolFFProCoder Nov 11, 2021
63aba70
Fixed missing event type call in DecodeEvent builder.
VolFFProCoder Nov 11, 2021
413de04
Added event type to LJ1200 states.
VolFFProCoder Nov 11, 2021
87ef810
Added event type to LTRStandard states.
VolFFProCoder Nov 11, 2021
a03c637
Added event type to MDC1200 states.
VolFFProCoder Nov 11, 2021
8d8db9a
Added ACKKNOWLEDGE to DecodeEventType.
VolFFProCoder Nov 11, 2021
c912532
Added event type to MPT1327 states.
VolFFProCoder Nov 11, 2021
cbcb207
Added event type to Passport states.
VolFFProCoder Nov 11, 2021
788bcec
Added event type to Tait1200 states.
VolFFProCoder Nov 11, 2021
cf0f1fc
Added event type to P25 Phase 2 states.
VolFFProCoder Nov 11, 2021
3de3ccf
Cleaned up code docs.
VolFFProCoder Nov 11, 2021
a6de45b
Add filter button to messages (#1)
VolFFProCoder Nov 11, 2021
2b53358
Create last seen and heard event filters (#2)
VolFFProCoder Nov 17, 2021
bb6cf3a
Merge branch 'DSheirer:master' into master
VolFFProCoder Nov 17, 2021
5dec1cc
Merge branch 'DSheirer:master' into master
VolFFProCoder Nov 29, 2021
cbb6bb5
Added event types to other TrafficChannelManagers.
VolFFProCoder Nov 11, 2021
68373ca
Added event types to DMR states.
VolFFProCoder Nov 11, 2021
8512ebf
Added event type to FleetSync states.
VolFFProCoder Nov 11, 2021
1317d58
Added event type to LTRNet states.
VolFFProCoder Nov 11, 2021
cbe8627
Added event type to MTP1327 states.
VolFFProCoder Nov 11, 2021
b35c998
Fixed missing event type call in DecodeEvent builder.
VolFFProCoder Nov 11, 2021
00391c9
Added event type to LJ1200 states.
VolFFProCoder Nov 11, 2021
f4a9c8a
Added event type to LTRStandard states.
VolFFProCoder Nov 11, 2021
13a2e96
Added event type to MDC1200 states.
VolFFProCoder Nov 11, 2021
f3877aa
Added ACKKNOWLEDGE to DecodeEventType.
VolFFProCoder Nov 11, 2021
e46e9c6
Added event type to MPT1327 states.
VolFFProCoder Nov 11, 2021
7902c25
Added event type to Passport states.
VolFFProCoder Nov 11, 2021
55fbb46
Added event type to Tait1200 states.
VolFFProCoder Nov 11, 2021
6fc24e1
Added event type to P25 Phase 2 states.
VolFFProCoder Nov 11, 2021
39293f7
Cleaned up code docs.
VolFFProCoder Nov 11, 2021
38ae0cd
Merge remote-tracking branch 'origin/add_decode_event_type_to_other_d…
VolFFProCoder May 4, 2022
116c228
Merge branch 'master' into add_decode_event_type_to_other_decoderstates
VolFFProCoder Jan 14, 2023
dd6f8c5
Remove duplicated method.
VolFFProCoder Jan 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,24 @@
import io.github.dsheirer.icon.IconModel;
import io.github.dsheirer.module.decode.event.DecodeEventPanel;
import io.github.dsheirer.module.decode.event.MessageActivityPanel;
import io.github.dsheirer.module.decode.event.filter.lastheard.LastHeardPanel;
import io.github.dsheirer.module.decode.event.filter.lastseen.LastSeenPanel;
import io.github.dsheirer.playlist.PlaylistManager;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.settings.SettingsManager;
import java.awt.Color;
import net.miginfocom.swing.MigLayout;

import javax.swing.JPanel;
import java.awt.Color;

public class NowPlayingPanel extends JPanel
{
private ChannelMetadataPanel mChannelMetadataPanel;
private ChannelDetailPanel mChannelDetailPanel;
private DecodeEventPanel mDecodeEventPanel;
private LastSeenPanel mLastSeenPanel;
private LastHeardPanel mLastHeardPanel;
private MessageActivityPanel mMessageActivityPanel;
private ChannelPowerPanel mChannelPowerPanel;

Expand All @@ -50,6 +55,8 @@ public NowPlayingPanel(PlaylistManager playlistManager, IconModel iconModel, Use
{
mChannelDetailPanel = new ChannelDetailPanel(playlistManager.getChannelProcessingManager());
mDecodeEventPanel = new DecodeEventPanel(iconModel, userPreferences, playlistManager.getAliasModel());
mLastSeenPanel = new LastSeenPanel(iconModel, userPreferences, playlistManager.getAliasModel());
mLastHeardPanel = new LastHeardPanel(iconModel, userPreferences, playlistManager.getAliasModel());
mMessageActivityPanel = new MessageActivityPanel(userPreferences);
mChannelMetadataPanel = new ChannelMetadataPanel(playlistManager, iconModel, userPreferences);
mChannelPowerPanel = new ChannelPowerPanel(playlistManager, settingsManager);
Expand All @@ -64,6 +71,8 @@ private void init()
JideTabbedPane tabbedPane = new JideTabbedPane();
tabbedPane.addTab("Details", mChannelDetailPanel);
tabbedPane.addTab("Events", mDecodeEventPanel);
tabbedPane.addTab("Last Seen", mLastSeenPanel);
tabbedPane.addTab("Last Heard", mLastHeardPanel);
tabbedPane.addTab("Messages", mMessageActivityPanel);
tabbedPane.addTab("Channel", mChannelPowerPanel);
tabbedPane.setFont(this.getFont());
Expand All @@ -81,6 +90,8 @@ private void init()

mChannelMetadataPanel.addProcessingChainSelectionListener(mChannelDetailPanel);
mChannelMetadataPanel.addProcessingChainSelectionListener(mDecodeEventPanel);
mChannelMetadataPanel.addProcessingChainSelectionListener(mLastSeenPanel);
mChannelMetadataPanel.addProcessingChainSelectionListener(mLastHeardPanel);
mChannelMetadataPanel.addProcessingChainSelectionListener(mMessageActivityPanel);
mChannelMetadataPanel.addProcessingChainSelectionListener(mChannelPowerPanel);
}
Expand Down
164 changes: 45 additions & 119 deletions src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoderState.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,14 @@ public void processChannelGrant(DMRChannel channel, IdentifierCollection identif
int lsn = channel.getLogicalSlotNumber();

DMRChannelGrantEvent event = mLSNGrantEventMap.get(lsn);
DecodeEventType decodeEventType = getEventType(opcode, identifierCollection, encrypted);

if(isStale(event, timestamp, identifierCollection)) //Create new event
{
event = DMRChannelGrantEvent.channelGrantBuilder(timestamp)
.channel(channel)
.eventDescription(getEventType(opcode, identifierCollection, encrypted).toString())
.eventType(decodeEventType)
.eventDescription(decodeEventType.toString())
.details("CHANNEL GRANT" + (encrypted ? " ENCRYPTED" : ""))
.identifiers(identifierCollection)
.build();
Expand All @@ -352,7 +354,8 @@ public void processChannelGrant(DMRChannel channel, IdentifierCollection identif

event = DMRChannelGrantEvent.channelGrantBuilder(timestamp)
.channel(channel)
.eventDescription(getEventType(opcode, identifierCollection, encrypted).toString() + " - Continue")
.eventType(decodeEventType)
.eventDescription(decodeEventType.toString() + " - Continue")
.details("CHANNEL GRANT" + (encrypted ? " ENCRYPTED" : ""))
.identifiers(identifierCollection)
.build();
Expand Down Expand Up @@ -392,7 +395,7 @@ else if(!event.getDetails().endsWith(NO_FREQUENCY))
{
if(event.getEventDescription() == null)
{
event.setEventDescription(getEventType(opcode, identifierCollection, encrypted) + IGNORED);
event.setEventDescription(decodeEventType + IGNORED);
}
else if(!event.getEventDescription().endsWith(IGNORED))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import io.github.dsheirer.identifier.IdentifierCollection;
import io.github.dsheirer.module.decode.dmr.channel.DMRChannel;
import io.github.dsheirer.module.decode.event.DecodeEventType;

/**
* DMR Channel Grant Event.
Expand Down Expand Up @@ -74,6 +75,7 @@ public static class DMRChannelGrantDecodeEventBuilder
{
protected long mTimeStart;
protected long mDuration;
protected DecodeEventType mDecodeEventType;
protected String mEventDescription;
protected IdentifierCollection mIdentifierCollection;
protected DMRChannel mChannel;
Expand Down Expand Up @@ -121,14 +123,23 @@ public DMRChannelGrantDecodeEventBuilder end(long timestamp)

/**
* Sets the channel descriptor for this event
* @param channelDescriptor
* @param channel
*/
public DMRChannelGrantDecodeEventBuilder channel(DMRChannel channel)
{
mChannel = channel;
return this;
}

/**
* Sets the Decode Event type for this event.
* @param eventType
*/
public DMRChannelGrantDecodeEventBuilder eventType(DecodeEventType eventType) {
mDecodeEventType = eventType;
return this;
}

/**
* Sets the event description text
* @param description of the event
Expand Down Expand Up @@ -170,6 +181,7 @@ public DMRChannelGrantEvent build()
decodeEvent.setTimeslot(mChannel.getTimeslot());
decodeEvent.setDetails(mDetails);
decodeEvent.setDuration(mDuration);
decodeEvent.setEventType(mDecodeEventType);
decodeEvent.setEventDescription(mEventDescription);
decodeEvent.setIdentifierCollection(mIdentifierCollection);
return decodeEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ public DecodeEventBuilder channel(IChannelDescriptor channelDescriptor)
return this;
}

/**
* Sets the Decode Event type for this event.
* @param eventType
*/
public DecodeEventBuilder eventType(DecodeEventType eventType) {
mDecodeEventType = eventType;
return this;
Expand Down Expand Up @@ -374,6 +378,7 @@ public DecodeEvent build()
decodeEvent.setChannelDescriptor(mChannelDescriptor);
decodeEvent.setDetails(mDetails);
decodeEvent.setDuration(mDuration);
decodeEvent.setEventType(mDecodeEventType);
decodeEvent.setEventDescription(mEventDescription);
decodeEvent.setIdentifierCollection(mIdentifierCollection);
decodeEvent.setProtocol(mProtocol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,10 @@ public void setMaxMessageCount(int count)
*/
public void receive(final IDecodeEvent event)
{
//Disabled until #1368 decode event is fully implemented
// if (!mEventFilterSet.passes(event))
// {
// return;
// }

if (!mEventFilterSet.passes(event))
{
return;
}
if(!mEvents.contains(event))
{
mEvents.add(0, event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.Color;
import java.awt.Component;
import java.awt.EventQueue;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;

public class DecodeEventPanel extends JPanel implements Listener<ProcessingChain>
{
Expand Down Expand Up @@ -97,8 +105,7 @@ public DecodeEventPanel(IconModel iconModel, UserPreferences userPreferences, Al
mTableColumnWidthMonitor = new JTableColumnWidthMonitor(mUserPreferences, mTable, TABLE_PREFERENCE_KEY);
updateCellRenderers();

//Disabled until #1368 decode event is fully implemented
// add(mEventManagementPanel, "span,growx");
add(mEventManagementPanel, "span,growx");

mEmptyScroller = new JScrollPane(mTable);
add(mEmptyScroller);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum DecodeEventType
{
AFFILIATE("Affiliate"),
ANNOUNCEMENT("Announcement"),
ACKNOWLEDGE("Acknowledge"),
AUTOMATIC_REGISTRATION_SERVICE("Motorola ARS"),
CALL("Call"),
CALL_ENCRYPTED("Encrypted Call"),
Expand All @@ -33,6 +34,7 @@ public enum DecodeEventType
CALL_PATCH_GROUP_ENCRYPTED("Encrypted Patch Call"),
CALL_ALERT("Call Alert"),
CALL_DETECT("Call Detect"),
CALL_IN_PROGRESS("Call In Progress"),
CALL_DO_NOT_MONITOR("Call-Do Not Monitor"),
CALL_END("Call End"),
CALL_INTERCONNECT("Telephone Call"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static class PlottableDecodeEventBuilder
private long mTimeStart;
private long mDuration;
private String mEventDescription;
private DecodeEventType mDecodeEventType;
private IdentifierCollection mIdentifierCollection;
private IChannelDescriptor mChannelDescriptor;
private String mDetails;
Expand Down Expand Up @@ -190,6 +191,15 @@ public PlottableDecodeEventBuilder protocol(Protocol protocol)
return this;
}

/**
* Sets the Decode Event type for this event.
* @param eventType
*/
public PlottableDecodeEventBuilder eventType(DecodeEventType eventType) {
mDecodeEventType = eventType;
return this;
}

/**
* Sets the location for the plottable event
*/
Expand Down Expand Up @@ -226,6 +236,7 @@ public PlottableDecodeEvent build()
decodeEvent.setChannelDescriptor(mChannelDescriptor);
decodeEvent.setDetails(mDetails);
decodeEvent.setDuration(mDuration);
decodeEvent.setEventType(mDecodeEventType);
decodeEvent.setEventDescription(mEventDescription);
decodeEvent.setIdentifierCollection(mIdentifierCollection);
decodeEvent.setProtocol(mProtocol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ public DecodedCallEventFilter()
{
super("Voice Calls", Arrays.asList(
DecodeEventType.CALL_GROUP,
DecodeEventType.CALL_ENCRYPTED,
DecodeEventType.CALL_GROUP_ENCRYPTED,
DecodeEventType.CALL_PATCH_GROUP,
DecodeEventType.CALL_PATCH_GROUP_ENCRYPTED,
DecodeEventType.CALL_ALERT,
DecodeEventType.CALL_DETECT,
DecodeEventType.CALL_DO_NOT_MONITOR,
DecodeEventType.CALL_END,
DecodeEventType.CALL_INTERCONNECT,
DecodeEventType.CALL_INTERCONNECT_ENCRYPTED,
DecodeEventType.CALL_UNIQUE_ID,
DecodeEventType.CALL_UNIT_TO_UNIT,
DecodeEventType.CALL_UNIT_TO_UNIT_ENCRYPTED,
DecodeEventType.CALL_NO_TUNER,
DecodeEventType.CALL_TIMEOUT
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public DecodedCommandEventFilter()
{
super("Commands", Arrays.asList(
DecodeEventType.ANNOUNCEMENT,
DecodeEventType.ACKNOWLEDGE,
DecodeEventType.STATION_ID,
DecodeEventType.PAGE,
DecodeEventType.QUERY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public DecodedRegistrationEventFilter()
DecodeEventType.DEREGISTER,
DecodeEventType.REQUEST,
DecodeEventType.RESPONSE,
DecodeEventType.RESPONSE_PACKET
DecodeEventType.RESPONSE_PACKET,
DecodeEventType.STATION_ID
));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.github.dsheirer.module.decode.event.filter.lastheard;

import io.github.dsheirer.alias.AliasModel;
import io.github.dsheirer.filter.FilterSet;
import io.github.dsheirer.icon.IconModel;
import io.github.dsheirer.module.decode.event.IDecodeEvent;

public class LastHeardFilterSet extends FilterSet<IDecodeEvent>
{

public LastHeardFilterSet(AliasModel aliasModel, IconModel iconModel)
{
super("Last Heard To Channel");

addFilter(new LastHeardIconFilter("Icon", aliasModel, iconModel));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* *****************************************************************************
* 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.module.decode.event.filter.lastheard;

import com.google.common.eventbus.Subscribe;
import io.github.dsheirer.module.HistoryModule;
import io.github.dsheirer.module.decode.event.DecodeEventHistoryPreloadData;
import io.github.dsheirer.module.decode.event.IDecodeEvent;
import io.github.dsheirer.module.decode.event.IDecodeEventListener;
import io.github.dsheirer.sample.Listener;

/**
* Decode event history module. Maintains a history of decode events and constrains the total history size.
*/
public class LastHeardHistory extends HistoryModule<IDecodeEvent> implements IDecodeEventListener
{
/**
* Constructs an instance
*/
public LastHeardHistory(int historySize)
{
super(historySize);
}

/**
* Implements the IDecodeEventListener interface - delegates to receive(event) method.
*/
@Override
public Listener<IDecodeEvent> getDecodeEventListener()
{
return this;
}

/**
* Process preload data
*/
@Subscribe
public void process(DecodeEventHistoryPreloadData preloadData)
{
for(IDecodeEvent decodeEvent: preloadData.getData())
{
receive(decodeEvent);
}
}

/**
* Processes a request for decode event history and posts the response back
* to the processing chain event bus so that any of the modules can receive that history.
*
* Note: this is principally used by the DMR decoder for Capacity+ REST channel rotation to transfer the decode
* event history from a traffic channel conversion to the new rest channel.
*
* @param request for decode event history
*/
@Subscribe
public void process(LastHeardHistoryRequest request)
{
getInterModuleEventBus().post(new LastHeardHistoryResponse(this));
}
}