diff --git a/dvmconsole/CallHistoryWindow.xaml.cs b/dvmconsole/CallHistoryWindow.xaml.cs
index 7569995..6a7a723 100644
--- a/dvmconsole/CallHistoryWindow.xaml.cs
+++ b/dvmconsole/CallHistoryWindow.xaml.cs
@@ -101,7 +101,8 @@ namespace dvmconsole
///
public partial class CallHistoryWindow : Window
{
- private const int MAX_CALL_HISTORY = 200;
+ public const int MAX_CALL_HISTORY = 200;
+ private int maxCallHistory = MAX_CALL_HISTORY;
private SettingsManager settingsManager;
/*
@@ -120,10 +121,20 @@ namespace dvmconsole
///
/// Initializes a new instance of the class.
///
- public CallHistoryWindow(SettingsManager settingsManager)
+ ///
+ ///
+ public CallHistoryWindow(SettingsManager settingsManager, int maxCallHistory)
{
InitializeComponent();
this.settingsManager = settingsManager;
+ this.maxCallHistory = maxCallHistory;
+
+ // clamp max call history count
+ if (this.maxCallHistory > MAX_CALL_HISTORY)
+ this.maxCallHistory = MAX_CALL_HISTORY;
+ if (this.maxCallHistory < 5)
+ this.maxCallHistory = 5;
+
ViewModel = new CallHistoryViewModel();
DataContext = ViewModel;
}
@@ -148,8 +159,8 @@ namespace dvmconsole
{
Dispatcher.Invoke(() =>
{
- if (ViewModel.CallHistory.Count == MAX_CALL_HISTORY)
- ViewModel.CallHistory.RemoveAt(MAX_CALL_HISTORY - 1);
+ if (ViewModel.CallHistory.Count == maxCallHistory)
+ ViewModel.CallHistory.RemoveAt(maxCallHistory - 1);
ViewModel.CallHistory.Insert(0, new CallEntry
{
diff --git a/dvmconsole/Controls/ChannelBox.xaml.cs b/dvmconsole/Controls/ChannelBox.xaml.cs
index d70334b..e393527 100644
--- a/dvmconsole/Controls/ChannelBox.xaml.cs
+++ b/dvmconsole/Controls/ChannelBox.xaml.cs
@@ -32,6 +32,8 @@ namespace dvmconsole.Controls
///
public partial class ChannelBox : UserControl, INotifyPropertyChanged
{
+ public const int MAX_CALL_HISTORY = 10;
+
public readonly static Border BORDER_DEFAULT;
public readonly static Border BORDER_GREEN;
@@ -91,6 +93,8 @@ namespace dvmconsole.Controls
private bool isPrimary = false;
+ private CallHistoryWindow callHistoryWindow;
+
/*
** Properties
*/
@@ -422,6 +426,8 @@ namespace dvmconsole.Controls
flashingBackgroundManager = new FlashingBackgroundManager(this);
+ callHistoryWindow = new CallHistoryWindow(SettingsManager.Instance, MAX_CALL_HISTORY);
+
ChannelName = channelName;
ChannelMode = "P25";
DstId = dstId;
@@ -589,6 +595,17 @@ namespace dvmconsole.Controls
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void AddCall(string channel, int srcId, int dstId, string timestamp)
+ {
+ callHistoryWindow.AddCall(channel, srcId, dstId, timestamp);
+ }
+
/** WPF Events */
///
diff --git a/dvmconsole/MainWindow.DMR.cs b/dvmconsole/MainWindow.DMR.cs
index 4b4f2c8..ce2122b 100644
--- a/dvmconsole/MainWindow.DMR.cs
+++ b/dvmconsole/MainWindow.DMR.cs
@@ -270,6 +270,19 @@ namespace dvmconsole
continue;
}
+ // is the Rx stream ID any of our Tx stream IDs?
+ List txChannels = new List();
+ foreach (ChannelBox other in selectedChannelsManager.GetSelectedChannels())
+ if (other.TxStreamId > 0 && other.TxStreamId == channel.RxStreamId)
+ txChannels.Add(true);
+
+ // if we have a count of Tx channels this means we're sourcing traffic for the incoming stream ID
+ if (txChannels.Count() > 0)
+ {
+ Log.WriteLine($"({system.Name}) DMRD: Traffic *IGNORE TX TRAF * PEER {e.PeerId} CALL_START PEER ID {channel.PeerId} SRC_ID {e.SrcId} TGID {e.DstId} ALGID {channel.algId} KID {channel.kId} [STREAM ID {e.StreamId}]");
+ continue;
+ }
+
// is this a new call stream?
if (e.StreamId != systemStatuses[cpgChannel.Name + e.Slot].RxStreamId)
{
@@ -297,6 +310,7 @@ namespace dvmconsole
Log.WriteLine($"({system.Name}) TS {e.Slot + 1} [STREAM ID {e.StreamId}] RX_LC {FneUtils.HexDump(systemStatuses[cpgChannel.Name + e.Slot].DMR_RxLC.GetBytes())}");
callHistoryWindow.AddCall(cpgChannel.Name, (int)e.SrcId, (int)e.DstId, DateTime.Now.ToString());
+ channel.AddCall(cpgChannel.Name, (int)e.SrcId, (int)e.DstId, DateTime.Now.ToString());
callHistoryWindow.ChannelKeyed(cpgChannel.Name, (int)e.SrcId, false); // TODO: Encrypted state
channel.Background = ChannelBox.GREEN_GRADIENT;
diff --git a/dvmconsole/MainWindow.P25.cs b/dvmconsole/MainWindow.P25.cs
index c7d0613..a767687 100644
--- a/dvmconsole/MainWindow.P25.cs
+++ b/dvmconsole/MainWindow.P25.cs
@@ -486,6 +486,19 @@ namespace dvmconsole
continue;
}
+ // is the Rx stream ID any of our Tx stream IDs?
+ List txChannels = new List();
+ foreach (ChannelBox other in selectedChannelsManager.GetSelectedChannels())
+ if (other.TxStreamId > 0 && other.TxStreamId == channel.RxStreamId)
+ txChannels.Add(true);
+
+ // if we have a count of Tx channels this means we're sourcing traffic for the incoming stream ID
+ if (txChannels.Count() > 0)
+ {
+ Log.WriteLine($"({system.Name}) P25D: Traffic *IGNORE TX TRAF * PEER {e.PeerId} CALL_START PEER ID {channel.PeerId} SRC_ID {e.SrcId} TGID {e.DstId} ALGID {channel.algId} KID {channel.kId} [STREAM ID {e.StreamId}]");
+ continue;
+ }
+
// is this a new call stream?
if (e.StreamId != slot.RxStreamId && ((e.DUID != P25DUID.TDU) && (e.DUID != P25DUID.TDULC)))
{
@@ -503,6 +516,7 @@ namespace dvmconsole
channel.algId = P25Defines.P25_ALGO_UNENCRYPT;
callHistoryWindow.AddCall(cpgChannel.Name, (int)e.SrcId, (int)e.DstId, DateTime.Now.ToString());
+ channel.AddCall(cpgChannel.Name, (int)e.SrcId, (int)e.DstId, DateTime.Now.ToString());
callHistoryWindow.ChannelKeyed(cpgChannel.Name, (int)e.SrcId, encrypted);
if (channel.algId != P25Defines.P25_ALGO_UNENCRYPT)
diff --git a/dvmconsole/MainWindow.xaml.cs b/dvmconsole/MainWindow.xaml.cs
index 7cb14a9..a5d1a1f 100644
--- a/dvmconsole/MainWindow.xaml.cs
+++ b/dvmconsole/MainWindow.xaml.cs
@@ -111,7 +111,7 @@ namespace dvmconsole
private ChannelBox playbackChannelBox;
- CallHistoryWindow callHistoryWindow;
+ private CallHistoryWindow callHistoryWindow;
public static string PLAYBACKTG = "LOCPLAYBACK";
public static string PLAYBACKSYS = "Local Playback";
@@ -158,7 +158,7 @@ namespace dvmconsole
settingsManager.LoadSettings();
InitializeKeyboardShortcuts();
- callHistoryWindow = new CallHistoryWindow(settingsManager);
+ callHistoryWindow = new CallHistoryWindow(settingsManager, CallHistoryWindow.MAX_CALL_HISTORY);
selectedChannelsManager = new SelectedChannelsManager();
flashingManager = new FlashingBackgroundManager(null, channelsCanvas, null, this);
@@ -2427,6 +2427,8 @@ namespace dvmconsole
}
}
+ /** Keyboard Shortcuts */
+
///
/// Sets the global PTT keybind
/// Hooks a listener to listen for a keypress, then saves that as the global PTT keybind
@@ -2471,8 +2473,6 @@ namespace dvmconsole
settingsManager.SaveSettings();
MessageBox.Show("Global PTT shortcut set to " + keyPress.ToString(), "Success", MessageBoxButton.OK, MessageBoxImage.Information);
}
-
-
///
/// Initializes global keyboard shortcut listener
@@ -2487,6 +2487,11 @@ namespace dvmconsole
keyboardManager.OnKeyEvent += KeyboardManagerOnKeyEvent;
}
+ ///
+ ///
+ ///
+ ///
+ ///
private void KeyboardManagerOnKeyEvent(Keys pressedKey,GlobalKeyboardHook.KeyboardState state)
{
if (pressedKey == settingsManager.GlobalPTTShortcut)
@@ -2504,6 +2509,11 @@ namespace dvmconsole
}
}
+ ///
+ ///
+ ///
+ ///
+ ///
private void ToggleGlobalPTTAllChannels_Click(object sender, RoutedEventArgs e)
{
settingsManager.GlobalPTTKeysAllChannels = !settingsManager.GlobalPTTKeysAllChannels;
diff --git a/dvmconsole/SettingsManager.cs b/dvmconsole/SettingsManager.cs
index b565310..d423919 100644
--- a/dvmconsole/SettingsManager.cs
+++ b/dvmconsole/SettingsManager.cs
@@ -37,10 +37,17 @@ namespace dvmconsole
private static string SettingsFilePath = UserAppDataPath + Path.DirectorySeparatorChar + "UserSettings.json";
+ private static SettingsManager _instance = null;
+
/*
** Properties
*/
+ ///
+ /// Singleton instance.
+ ///
+ public static SettingsManager Instance { get { return _instance; } }
+
///
/// Flag indicating whether or not system status widgets will be displayed.
///
@@ -137,17 +144,29 @@ namespace dvmconsole
///
public bool SaveTraceLog { get; set; }
-
+ ///
+ ///
+ ///
public Keys GlobalPTTShortcut { get; set; } = Keys.None;
-
-
+ ///
+ ///
+ ///
public bool GlobalPTTKeysAllChannels { get; set; }
+
/*
** Methods
*/
///
- ///
+ /// Initializes a new instance of the class.
+ ///
+ public SettingsManager()
+ {
+ _instance = this;
+ }
+
+ ///
+ /// Load user settings.
///
public bool LoadSettings()
{
@@ -244,7 +263,7 @@ namespace dvmconsole
}
///
- ///
+ /// Save user settings.
///
public void SaveSettings()
{
@@ -264,7 +283,7 @@ namespace dvmconsole
}
///
- ///
+ /// Reset user settings.
///
public void Reset()
{