Files
DP44/docs/ai/DataPRO/IService/Classes/InputRangeAttributes.md
2026-04-17 14:55:32 -04:00

59 lines
4.0 KiB
Markdown

---
source_files:
- DataPRO/IService/Classes/InputRangeAttributes/GainDisabledAttribute.cs
- DataPRO/IService/Classes/InputRangeAttributes/MaxInputRangeAttribute.cs
- DataPRO/IService/Classes/InputRangeAttributes/GainAvailableUnmodifiedAttribute.cs
- DataPRO/IService/Classes/InputRangeAttributes/MinInputRangeAttribute.cs
- DataPRO/IService/Classes/InputRangeAttributes/FirmwareInputRangeAttribute.cs
generated_at: "2026-04-17T16:03:17.836512+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "75434fd7a99fb627"
---
# InputRangeAttributes
### Purpose
This module provides a set of custom attributes used to annotate gain-related enum values with metadata controlling input range behavior for data acquisition hardware. The attributes allow fine-grained control over gain availability, disabled states, and input range boundaries (min/max/firmware values) in millivolts, supporting different hardware configurations including modified vs unmodified Gen 3 SPS devices.
### Public Interface
**GainDisabledAttribute** : Attribute
- `GainDisabledAttribute(bool disabled)` - Constructor; marks a gain as disabled when `disabled` is true.
- `static bool IsGainDisabled(object o)` - Returns true if the object (typically an enum value) has `GainDisabledAttribute` with `_bDisabled = true`. Returns false if null, no member found, or attribute not present.
**MaxInputRangeAttribute** : Attribute
- `MaxInputRangeAttribute(double maxInputRangemV)` - Constructor; sets maximum input range in mV.
- `static double GetMaxInputRangemV(object o)` - Returns the maximum input range in mV for the given object. Returns 0D if null, no member found, or attribute not present.
**GainAvailableUnmodifiedAttribute** : Attribute
- `GainAvailableUnmodifiedAttribute(bool available)` - Constructor; marks availability for unmodified Gen 3 SPS.
- `static bool IsGainAvailableToUnmodified(object o)` - Returns true if gain is available to unmodified Gen 3 SPS. Returns true by default (if attribute not present). Returns false only if attribute is present with `available = false`.
**MinInputRangeAttribute** : Attribute
- `MinInputRangeAttribute(double minInputRangemV)` - Constructor; sets minimum input range in mV.
- `static double GetMinInputRangemV(object o)` - Returns the minimum input range in mV for the given object. Returns 0D if null, no member found, or attribute not present.
**FirmwareInputRangeAttribute** : Attribute
- `FirmwareInputRangeAttribute(double firmwareInputRangemV)` - Constructor; sets the input range value to send to firmware.
- `static double GetFirmwareInputRangemV(object o)` - Returns the firmware input range in mV for the given object. Returns 0D if null, no member found, or attribute not present.
### Invariants
- All static retrieval methods accept `object` (intended for enum values) and use reflection via `GetMember(o.ToString())`.
- Default behaviors:
- `IsGainDisabled`: returns `false` (gains are enabled by default)
- `IsGainAvailableToUnmodified`: returns `true` (available by default)
- Range getters: return `0D` if attribute not present
- All attributes are in namespace `DTS.DASLib.Service` despite folder location suggesting otherwise.
### Dependencies
- **Depends on**: `System` (for Attribute and reflection APIs)
- **Depended on by**: Unclear from source alone - likely gain-related enums in the data acquisition service layer.
### Gotchas
- **Namespace mismatch**: The namespace `DTS.DASLib.Service` does not match the folder path `DataPRO/IService/Classes/InputRangeAttributes`. A ReSharper comment suppresses namespace check.
- **FogBugz references**: Comments reference internal bug tracker URLs (e.g., `http://fogbugz/fogbugz/default.asp?10080`) which are inaccessible externally.
- **Reflection assumption**: The static methods assume `o.ToString()` returns a valid member name; if `o` is not an enum or the string doesn't match a member, methods return default values silently.
- **Typo in field name**: `FirmwareInputRangeAttribute._firmwareInputRangeAttribute` - the field name repeats the class name rather than describing the value.
---