#299 - adds support for traffic channel event logging of binary or

decoded messages and event logging, as inherited from the parent
control channel's configuration.
This commit is contained in:
Denny
2017-12-11 21:07:30 -05:00
parent a3ecb339be
commit eef29d28da
4 changed files with 44 additions and 34 deletions

View File

@@ -18,8 +18,6 @@
******************************************************************************/ ******************************************************************************/
package channel.traffic; package channel.traffic;
import alias.Alias;
import alias.id.priority.Priority;
import channel.state.DecoderStateEvent; import channel.state.DecoderStateEvent;
import channel.state.IDecoderStateEventListener; import channel.state.IDecoderStateEventListener;
import controller.channel.Channel; import controller.channel.Channel;
@@ -27,13 +25,13 @@ import controller.channel.Channel.ChannelType;
import controller.channel.ChannelEvent; import controller.channel.ChannelEvent;
import controller.channel.ChannelEvent.Event; import controller.channel.ChannelEvent.Event;
import controller.channel.ChannelModel; import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import controller.channel.TrafficChannelEvent; import controller.channel.TrafficChannelEvent;
import module.Module; import module.Module;
import module.decode.config.DecodeConfiguration; import module.decode.config.DecodeConfiguration;
import module.decode.event.CallEvent; import module.decode.event.CallEvent;
import module.decode.event.CallEvent.CallEventType; import module.decode.event.CallEvent.CallEventType;
import module.decode.event.ICallEventProvider; import module.decode.event.ICallEventProvider;
import module.log.config.EventLogConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import record.config.RecordConfiguration; import record.config.RecordConfiguration;
@@ -64,6 +62,7 @@ public class TrafficChannelManager extends Module implements ICallEventProvider,
private ChannelModel mChannelModel; private ChannelModel mChannelModel;
private DecodeConfiguration mDecodeConfiguration; private DecodeConfiguration mDecodeConfiguration;
private EventLogConfiguration mEventLogConfiguration;
private RecordConfiguration mRecordConfiguration; private RecordConfiguration mRecordConfiguration;
private String mSystem; private String mSystem;
private String mSite; private String mSite;
@@ -77,6 +76,7 @@ public class TrafficChannelManager extends Module implements ICallEventProvider,
* @param channelModel containing channels currently in use * @param channelModel containing channels currently in use
* @param decodeConfiguration - decoder configuration to use for each * @param decodeConfiguration - decoder configuration to use for each
* traffic channel allocation. * traffic channel allocation.
* @param eventLogConfiguration - logging configuration to use for traffic channels
* @param recordConfiguration - recording options for each traffic channel * @param recordConfiguration - recording options for each traffic channel
* @param system label to use to describe the system * @param system label to use to describe the system
* @param site label to use to describe the site * @param site label to use to describe the site
@@ -86,6 +86,7 @@ public class TrafficChannelManager extends Module implements ICallEventProvider,
*/ */
public TrafficChannelManager(ChannelModel channelModel, public TrafficChannelManager(ChannelModel channelModel,
DecodeConfiguration decodeConfiguration, DecodeConfiguration decodeConfiguration,
EventLogConfiguration eventLogConfiguration,
RecordConfiguration recordConfiguration, RecordConfiguration recordConfiguration,
String system, String system,
String site, String site,
@@ -94,6 +95,7 @@ public class TrafficChannelManager extends Module implements ICallEventProvider,
{ {
mChannelModel = channelModel; mChannelModel = channelModel;
mDecodeConfiguration = decodeConfiguration; mDecodeConfiguration = decodeConfiguration;
mEventLogConfiguration = eventLogConfiguration;
mRecordConfiguration = recordConfiguration; mRecordConfiguration = recordConfiguration;
mSystem = system; mSystem = system;
mSite = site; mSite = site;
@@ -149,6 +151,8 @@ public class TrafficChannelManager extends Module implements ICallEventProvider,
channel.setDecodeConfiguration(mDecodeConfiguration); channel.setDecodeConfiguration(mDecodeConfiguration);
channel.setEventLogConfiguration(mEventLogConfiguration);
channel.setRecordConfiguration(mRecordConfiguration); channel.setRecordConfiguration(mRecordConfiguration);
channel.setAliasListName(mAliasListName); channel.setAliasListName(mAliasListName);

View File

@@ -222,7 +222,7 @@ public class DecoderFactory
if(channelType == ChannelType.STANDARD) if(channelType == ChannelType.STANDARD)
{ {
modules.add(new TrafficChannelManager(channelModel, decodeConfig, modules.add(new TrafficChannelManager(channelModel, decodeConfig, channel.getEventLogConfiguration(),
channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(), channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(),
(aliasList != null ? aliasList.getName() : null), mptConfig.getTrafficChannelPoolSize())); (aliasList != null ? aliasList.getName() : null), mptConfig.getTrafficChannelPoolSize()));
} }
@@ -263,7 +263,7 @@ public class DecoderFactory
if(channelType == ChannelType.STANDARD) if(channelType == ChannelType.STANDARD)
{ {
modules.add(new TrafficChannelManager(channelModel, decodeConfig, modules.add(new TrafficChannelManager(channelModel, decodeConfig, channel.getEventLogConfiguration(),
channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(), channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(),
(aliasList != null ? aliasList.getName() : null), p25Config.getTrafficChannelPoolSize())); (aliasList != null ? aliasList.getName() : null), p25Config.getTrafficChannelPoolSize()));
} }

View File

@@ -1,33 +1,38 @@
/******************************************************************************* /*******************************************************************************
* SDR Trunk * sdrtrunk
* Copyright (C) 2014 Dennis Sheirer * Copyright (C) 2014-2017 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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/>
* *
* 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 module.log; package module.log;
import module.Module;
import module.log.MessageEventLogger.Type;
import module.log.config.EventLogConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import properties.SystemProperties;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import module.Module;
import module.log.MessageEventLogger.Type;
import module.log.config.EventLogConfiguration;
import properties.SystemProperties;
public class EventLogManager public class EventLogManager
{ {
private final static Logger mLog = LoggerFactory.getLogger(EventLogManager.class);
private Path mDirectory; private Path mDirectory;
public EventLogManager() public EventLogManager()

View File

@@ -80,8 +80,6 @@ public abstract class EventLogger extends Module
mLogFileName = sb.toString(); mLogFileName = sb.toString();
mLog.info("Creating log file:" + mLogFileName);
mLogFile = new OutputStreamWriter(new FileOutputStream(mLogFileName)); mLogFile = new OutputStreamWriter(new FileOutputStream(mLogFileName));
write(getHeader()); write(getHeader());
@@ -125,14 +123,17 @@ public abstract class EventLogger extends Module
protected void write(String eventLogEntry) protected void write(String eventLogEntry)
{ {
try if(mLogFile != null)
{ {
mLogFile.write(eventLogEntry + "\n"); try
mLogFile.flush(); {
} mLogFile.write(eventLogEntry + "\n");
catch(IOException e) mLogFile.flush();
{ }
mLog.error("Error writing entry to event log file", e); catch(IOException e)
{
mLog.error("Error writing entry to event log file", e);
}
} }
} }
} }