// SPDX-License-Identifier: AGPL-3.0-only
/**
* Digital Voice Modem - Desktop Dispatch Console
* AGPLv3 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / Desktop Dispatch Console
* @license AGPLv3 License (https://opensource.org/licenses/AGPL-3.0)
*
* Copyright (C) 2022-2024 Bryan Biedenkapp, N2PLL
* Copyright (C) 2025 Caleb, K4PHP
*
*/
using fnecore;
using fnecore.DMR;
using fnecore.P25.kmm;
namespace dvmconsole
{
///
/// Represents the individual timeslot data status.
///
public class SlotStatus
{
///
/// Rx Start Time
///
public DateTime RxStart = DateTime.Now;
///
///
///
public uint RxSeq = 0;
///
/// Rx RF Source
///
public uint RxRFS = 0;
///
/// Tx RF Source
///
public uint TxRFS = 0;
///
/// Rx Stream ID
///
public uint RxStreamId = 0;
///
/// Tx Stream ID
///
public uint TxStreamId = 0;
///
/// Rx TG ID
///
public uint RxTGId = 0;
///
/// Tx TG ID
///
public uint TxTGId = 0;
///
/// Tx Privacy TG ID
///
public uint TxPITGId = 0;
///
/// Rx Time
///
public DateTime RxTime = DateTime.Now;
///
/// Tx Time
///
public DateTime TxTime = DateTime.Now;
///
/// Rx Type
///
public FrameType RxType = FrameType.TERMINATOR;
/** DMR Data */
///
/// Rx Link Control Header
///
public LC DMR_RxLC = null;
///
/// Rx Privacy Indicator Link Control Header
///
public PrivacyLC DMR_RxPILC = null;
///
/// Tx Link Control Header
///
public LC DMR_TxHLC = null;
///
/// Tx Privacy Link Control Header
///
public PrivacyLC DMR_TxPILC = null;
///
/// Tx Terminator Link Control
///
public LC DMR_TxTLC = null;
} // public class SlotStatus
///
/// Implements a FNE system.
///
public abstract partial class FneSystemBase : fnecore.FneSystemBase
{
private Random rand;
internal MainWindow mainWindow;
public List processedChunks = new List();
/*
** Methods
*/
///
/// Initializes a new instance of the class.
///
/// Instance of or
public FneSystemBase(FnePeer fne, MainWindow mainWindow) : base(fne, 0)
{
this.fne = fne;
this.mainWindow = mainWindow;
this.rand = new Random(Guid.NewGuid().GetHashCode());
// hook logger callback
this.fne.Logger = (LogLevel level, string message) =>
{
switch (level)
{
case LogLevel.WARNING:
Console.WriteLine(message);
break;
case LogLevel.ERROR:
Console.WriteLine(message);
break;
case LogLevel.DEBUG:
Console.WriteLine(message);
break;
case LogLevel.FATAL:
Console.WriteLine(message);
break;
case LogLevel.INFO:
default:
Console.WriteLine(message);
break;
}
};
}
///
/// Stops the main execution loop for this .
///
public override void Stop()
{
base.Stop();
}
///
/// Callback used to process whether or not a peer is being ignored for traffic.
///
/// Peer ID
/// Source Address
/// Destination Address
/// Slot Number
/// Call Type (Group or Private)
/// Frame Type
/// DMR Data Type
/// Stream ID
/// True, if peer is ignored, otherwise false.
protected override bool PeerIgnored(uint peerId, uint srcId, uint dstId, byte slot, fnecore.CallType callType, FrameType frameType, DMRDataType dataType, uint streamId)
{
return false;
}
///
/// Event handler used to handle a peer connected event.
///
///
///
protected override void PeerConnected(object sender, PeerConnectedEvent e)
{
return;
}
///
///
///
///
///
protected override void KeyResponse(object sender, KeyResponseEvent e)
{
byte[] payload = e.Data.Skip(11).ToArray();
//Console.WriteLine(FneUtils.HexDump(payload));
if (e.MessageId == (byte)KmmMessageType.MODIFY_KEY_CMD)
mainWindow.KeyResponseReceived(e);
}
///
/// Returns a new stream ID
///
///
public uint NewStreamId()
{
return (uint)rand.Next(int.MinValue, int.MaxValue);
}
} // public abstract partial class FneSystemBase : fnecore.FneSystemBase
} // namespace dvmconsole