using Microsoft.VisualBasic;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using fnecore.DMR;
using fnecore;
using NAudio.Wave;
namespace WhackerLinkConsoleV2
{
///
/// Implements a FNE system base.
///
public abstract partial class FneSystemBase : fnecore.FneSystemBase
{
public const int AMBE_BUF_LEN = 9;
public const int DMR_AMBE_LENGTH_BYTES = 27;
public const int AMBE_PER_SLOT = 3;
public const int P25_FIXED_SLOT = 2;
public const int SAMPLE_RATE = 8000;
public const int BITS_PER_SECOND = 16;
public const int MBE_SAMPLES_LENGTH = 160;
public const int AUDIO_BUFFER_MS = 20;
public const int AUDIO_NO_BUFFERS = 2;
public const int AFSK_AUDIO_BUFFER_MS = 60;
public const int AFSK_AUDIO_NO_BUFFERS = 4;
public new const int DMR_PACKET_SIZE = 55;
public new const int DMR_FRAME_LENGTH_BYTES = 33;
/*
** Methods
*/
///
/// Callback used to validate incoming DMR data.
///
/// Peer ID
/// Source Address
/// Destination Address
/// Slot Number
/// Call Type (Group or Private)
/// Frame Type
/// DMR Data Type
/// Stream ID
/// Raw message data
/// True, if data stream is valid, otherwise false.
protected override bool DMRDataValidate(uint peerId, uint srcId, uint dstId, byte slot, fnecore.CallType callType, FrameType frameType, DMRDataType dataType, uint streamId, byte[] message)
{
return true;
}
///
/// Creates an DMR frame message.
///
///
///
///
///
///
///
///
public void CreateDMRMessage(ref byte[] data, uint srcId, uint dstId, byte slot, FrameType frameType, byte seqNo, byte n)
{
RemoteCallData callData = new RemoteCallData()
{
SrcId = srcId,
DstId = dstId,
FrameType = frameType,
Slot = slot,
};
CreateDMRMessage(ref data, callData, seqNo, n);
}
///
/// Helper to send a DMR terminator with LC message.
///
public void SendDMRTerminator(uint srcId, uint dstId, byte slot, int dmrSeqNo, byte dmrN, EmbeddedData embeddedData)
{
RemoteCallData callData = new RemoteCallData()
{
SrcId = srcId,
DstId = dstId,
FrameType = FrameType.DATA_SYNC,
Slot = slot
};
SendDMRTerminator(callData, ref dmrSeqNo, ref dmrN, embeddedData);
}
///
/// Event handler used to process incoming DMR data.
///
///
///
protected override void DMRDataReceived(object sender, DMRDataReceivedEvent e)
{
return;
}
} // public abstract partial class FneSystemBase : fnecore.FneSystemBase
}