init
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user