0
mirror of https://github.com/gusmanb/logicanalyzer.git synced 2025-02-05 10:08:06 +00:00
gusmanb-logicanalyzer/Software/LogicAnalyzer/SharedDriver/CaptureSession.cs
2025-01-26 11:58:42 +01:00

62 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedDriver
{
public class CaptureSession
{
public int Frequency { get; set; }
public int PreTriggerSamples { get; set; }
public int PostTriggerSamples { get; set; }
public int TotalSamples
{
get
{
return PostTriggerSamples * (LoopCount + 1) + PreTriggerSamples;
}
}
public int LoopCount { get; set; }
public bool MeasureBursts { get; set; }
public AnalyzerChannel[] CaptureChannels { get; set; } = [];
public BurstInfo[]? Bursts { get; set; }
public TriggerType TriggerType { get; set; }
public int TriggerChannel { get; set; }
public bool TriggerInverted { get; set; }
public int TriggerBitCount { get; set; }
public ushort TriggerPattern { get; set; }
public CaptureSession Clone()
{
var newInst = (CaptureSession)MemberwiseClone();
for (int i = 0; i < CaptureChannels.Length; i++)
{
newInst.CaptureChannels[i] = CaptureChannels[i].Clone();
}
return newInst;
}
public CaptureSession CloneSettings()
{
var newInst = (CaptureSession)MemberwiseClone();
for (int i = 0; i < CaptureChannels.Length; i++)
{
newInst.CaptureChannels[i] = CaptureChannels[i].Clone();
newInst.CaptureChannels[i].Samples = null;
}
return newInst;
}
}
public enum TriggerType
{
Edge,
Complex,
Fast,
Blast
}
}