init
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.CommonCore/Events/Sensors/CalibrationBehaviorSettingChangedEvent.cs
|
||||
- Common/DTS.CommonCore/Events/Sensors/SensorFilterTypeChangedEvent.cs
|
||||
generated_at: "2026-04-16T02:47:19.043189+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6c4242c9e13326a0"
|
||||
---
|
||||
|
||||
# Sensors
|
||||
|
||||
## Documentation: Sensor Event Definitions
|
||||
|
||||
### 1. Purpose
|
||||
This module defines Prism-based pub/sub events used to propagate changes in sensor configuration and filtering behavior across the application. Specifically, it enables decoupled components to react to changes in calibration behavior settings (`CalibrationBehaviorSettingChangedEvent`) and sensor filter type selections (`SensorFilterTypeChangedEvent`), which may involve ISO code mappings or filter class assignments. These events support dynamic UI updates and state synchronization in sensor data processing pipelines.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `CalibrationBehaviorSettingChangedEvent`
|
||||
- **Type**: `class` (inherits from `CompositePresentationEvent<CalibrationBehaviors>`)
|
||||
- **Generic Payload**: `DTS.Common.Enums.Sensors.CalibrationBehaviors`
|
||||
- **Behavior**: Publishes when the global or context-specific calibration behavior setting changes. Subscribers receive the new `CalibrationBehaviors` enum value.
|
||||
|
||||
#### `SensorFilterTypeChangedEvent`
|
||||
- **Type**: `class` (inherits from `CompositePresentationEvent<SensorFilterTypeChangedEventArgs>`)
|
||||
- **Payload**: `SensorFilterTypeChangedEventArgs`
|
||||
- **Behavior**: Publishes when the sensor filter type (either ISO code character or filter class) is modified. Triggers updates to ISO code lists or filter logic.
|
||||
|
||||
##### `SensorFilterTypeChangedEventArgs`
|
||||
- **Properties**:
|
||||
- `char ISOCodeChar`: Set only when `EventType == EventTypes.ISOCodeChar`. Represents the selected ISO code character (e.g., `'A'`, `'B'`).
|
||||
- `enum EventTypes { ISOCodeChar, FilterClass }`: Indicates which constructor was used to initialize the instance.
|
||||
- `FilterClassType FilterClass`: Set only when `EventType == EventTypes.FilterClass`. Represents the selected filter class.
|
||||
- `ISensorCalibration Calibration`: The calibration object associated with the sensor at the time of change.
|
||||
- `ISensorData Sensor`: The sensor instance whose filter type is changing.
|
||||
- `bool UseISOCodeFilterMapping`: Flag indicating whether ISO code–based filtering is enabled.
|
||||
- `bool UseZeroForUnfiltered`: Flag indicating whether unfiltered readings should be represented as `0`.
|
||||
- **Constructors**:
|
||||
- `SensorFilterTypeChangedEventArgs(char code, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)`
|
||||
Initializes for ISO code changes (`EventType = ISOCodeChar`).
|
||||
- `SensorFilterTypeChangedEventArgs(FilterClassType filterClassType, ISensorData sensor, ISensorCalibration sensorCalibration, bool useISOCodeFilterMapping, bool bUseZeroForUnfiltered)`
|
||||
Initializes for filter class changes (`EventType = FilterClass`).
|
||||
|
||||
### 3. Invariants
|
||||
- `SensorFilterTypeChangedEventArgs` must be constructed using **exactly one** of its two constructors—never both parameters sets.
|
||||
- `EventType` is set at construction time and **never changes**; it determines which of `ISOCodeChar` or `FilterClass` is valid.
|
||||
- `ISOCodeChar` is only meaningful when `EventType == EventTypes.ISOCodeChar`; otherwise, its value is undefined (but not null-checked, as `char` is non-nullable).
|
||||
- `FilterClass` is only meaningful when `EventType == EventTypes.FilterClass`.
|
||||
- `Calibration`, `Sensor`, `UseISOCodeFilterMapping`, and `UseZeroForUnfiltered` are always set in both constructors and must be non-null (except `Calibration`/`Sensor` could be `null` if passed as such—no explicit validation is present in the source).
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>` (for event infrastructure).
|
||||
- `DTS.Common.Enums.Sensors` (for `CalibrationBehaviors` and `SensorFilterTypeChangedEventArgs.EventTypes`).
|
||||
- `DTS.Common.Interface.Sensors` (for `ISensorCalibration` and `ISensorData` interfaces).
|
||||
- **Used by**:
|
||||
- Components that subscribe to `CalibrationBehaviorSettingChangedEvent` to adjust calibration logic.
|
||||
- Components that subscribe to `SensorFilterTypeChangedEvent` to recompute ISO code mappings, filter tables, or UI filter controls.
|
||||
- Likely consumed by sensor UI modules, data processing pipelines, or configuration managers (inferred from event semantics).
|
||||
|
||||
### 5. Gotchas
|
||||
- `SensorFilterTypeChangedEventArgs` does not validate that `ISOCodeChar` is a valid ISO code character (e.g., range or allowed set). Consumers must enforce this.
|
||||
- The `FilterClass` property is of type `FilterClassType`, but its definition is not included in the provided source—its valid values and semantics are unknown here.
|
||||
- `Calibration` and `Sensor` are passed as interfaces but may be `null` if passed as such in the constructor; no null-checking is evident in this class.
|
||||
- The namespace `DTS.Common.Events.Sensors` is used for `SensorFilterTypeChangedEvent`, while `CalibrationBehaviorSettingChangedEvent` resides in the parent `DTS.Common.Events` namespace—this may cause discoverability issues.
|
||||
- The `bUseZeroForUnfiltered` parameter name uses Hungarian notation (`b` prefix), inconsistent with C# naming conventions (though preserved in the source).
|
||||
Reference in New Issue
Block a user