This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <inheritdoc />
/// <summary>
/// allows a input range in mV to send to firmware based on a gain
/// this is a right now just the middle between the given gain and the next gain, however
/// we can control this a bit more in the future if we wish.
/// we don't send directly the input range based on the gain because calibration factors could affect
/// what range is actually achieved at each gain step
/// but we want to make sure we don't change gain steps [so we can avoid certain gains]
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
public class FirmwareInputRangeAttribute : Attribute
{
/// <summary>
/// input range to send to firmware for the given gain
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static double GetFirmwareInputRangemV(object o)
{
if (o == null) return 0D;
var mi = o.GetType().GetMember(o.ToString());
if (mi.Length <= 0) return 0D;
var attr = GetCustomAttribute(mi[0], typeof(FirmwareInputRangeAttribute)) as FirmwareInputRangeAttribute;
return attr?._firmwareInputRangeAttribute ?? 0D;
}
private readonly double _firmwareInputRangeAttribute;
public FirmwareInputRangeAttribute(double firmwareInputRangemV)
{
_firmwareInputRangeAttribute = firmwareInputRangemV;
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <inheritdoc />
/// <summary>
/// This attribute is used to control whether a gain is available to unmodified gen 3 SPS
/// http://fogbugz/fogbugz/default.asp?10080
/// the gain should still be available for modified SPS
/// this attribute is optional, it is assumed to be available unless explicitly marked as
/// unavailable
/// </summary>
public class GainAvailableUnmodifiedAttribute : Attribute
{
/// <summary>
/// returns whether gain is available to unmodified SPS gen 3 or not
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static bool IsGainAvailableToUnmodified(object o)
{
if (o == null) return true;
var mi = o.GetType().GetMember(o.ToString());
if (mi.Length <= 0) return true;
return !(GetCustomAttribute(mi[0], typeof(GainAvailableUnmodifiedAttribute)) is GainAvailableUnmodifiedAttribute attr) || attr._bAvailable;
}
private readonly bool _bAvailable;
public GainAvailableUnmodifiedAttribute(bool available)
{
_bAvailable = available;
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <summary>
/// this attribute controls whether a gain is disabled or not
/// this was done for
/// http://fogbugz/fogbugz/default.asp?10080
/// to prevent the higher range gains which were considered just not useful
/// this attribute is optional, it is assume the gain is not disabled
/// unless it's explicitly marked as disabled
/// </summary>
public class GainDisabledAttribute : Attribute
{
/// <summary>
/// returns whether the gain is disabled or not
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static bool IsGainDisabled(object o)
{
if (o == null) return false;
var mi = o.GetType().GetMember(o.ToString());
if (mi.Length <= 0) return false;
return GetCustomAttribute(mi[0], typeof(GainDisabledAttribute)) is GainDisabledAttribute attr && attr._bDisabled;
}
private readonly bool _bDisabled;
public GainDisabledAttribute(bool disabled)
{
_bDisabled = disabled;
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <inheritdoc />
/// <summary>
/// this attribute allows us to associate a max input range in mV for a gain
/// note that this can be computed using the gain itself and the input range
/// but this allows us to more tightly control things (say by using 2450 instead of 2500 for full range or something similar)
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
public class MaxInputRangeAttribute : Attribute
{
/// <summary>
/// returns the max input range in mV for gain
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static double GetMaxInputRangemV(object o)
{
if (o == null) return 0D;
var mi = o.GetType().GetMember(o.ToString());
if (mi.Length <= 0) return 0D;
return GetCustomAttribute(mi[0], typeof(MaxInputRangeAttribute)) is MaxInputRangeAttribute attr ? attr._maximumInputRangemV : 0D;
}
private readonly double _maximumInputRangemV;
public MaxInputRangeAttribute(double maxInputRangemV)
{
_maximumInputRangemV = maxInputRangemV;
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
/// <inheritdoc />
/// <summary>
/// this attribute controls the minimum input range for a gain
/// note that we could calculate this, but this allows us some flexibility
/// in real life there are calibration and other factors that can affect what actually
/// is achievable at a given gain step, so this minimum input could be a theoretical one
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
public class MinInputRangeAttribute : Attribute
{
/// <summary>
/// returns the minimum input range for a gain
/// http://fogbugz/fogbugz/default.asp?10080
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
public static double GetMinInputRangemV(object o)
{
if (o == null) return 0D;
var mi = o.GetType().GetMember(o.ToString());
if (mi.Length <= 0) return 0D;
return GetCustomAttribute(mi[0], typeof(MinInputRangeAttribute)) is MinInputRangeAttribute attr ? attr._minimumInputRangemV : 0D;
}
private readonly double _minimumInputRangemV;
public MinInputRangeAttribute(double minInputRangemV)
{
_minimumInputRangemV = minInputRangemV;
}
}
}