init
This commit is contained in:
456
docs/ImprovementOpportunities.md
Normal file
456
docs/ImprovementOpportunities.md
Normal file
@@ -0,0 +1,456 @@
|
||||
# DataPRO Improvement Opportunities
|
||||
|
||||
**Status:** Analysis Complete
|
||||
**Date:** 2026-04-17
|
||||
**Analysis Scope:** Architecture, Stability, Performance
|
||||
|
||||
---
|
||||
|
||||
## Methodology
|
||||
|
||||
Items ranked by **Effort vs. Impact** matrix. priority is triage order (1 = most urgent).
|
||||
|
||||
- **Low Effort:** < 1 week
|
||||
- **Medium Effort:** 1-3 weeks
|
||||
- **High Effort:** 3+ weeks
|
||||
|
||||
- **High Impact:** Major architectural improvement, significantly improves stability/performance/testability
|
||||
- **Medium Impact:** Noticeable improvement but not critical
|
||||
- **Low Impact:** Minor cleanup, nice to have
|
||||
|
||||
---
|
||||
|
||||
## Immediate Priority (Triage 1-5)
|
||||
|
||||
### #1. Refactor RunTestVariables to Injectables (Low Effort, High Impact)
|
||||
|
||||
**Category:** State Management
|
||||
|
||||
**Problem:**
|
||||
- `RunTestVariables.cs` is an `abstract class` with 40+ static properties
|
||||
- Located in two locations (`Common/DTS.Common/Enums/` and `Common/DTS.CommonCore/Enums/`)
|
||||
- Creates hidden dependencies throughout codebase
|
||||
- Difficult to test, impossible to mock
|
||||
- Lines 287-294 show redundancy: `TOMExcitationWarmupTimeMS = TOM_EXCITATIONWARMUPTIME_MS;` (static field initialized from const)
|
||||
|
||||
**Solution:**
|
||||
- Create `IRunTestVariables` interface
|
||||
- Implement concrete `RunTestVariablesService` class
|
||||
- Register with Unity DI container as singleton
|
||||
- Inject into consumers instead of static access
|
||||
- Consolidate to single definition (remove `Common/DTS.CommonCore/Enums/RunTestVariables.cs`)
|
||||
|
||||
**Effort:** Low (3-5 days)
|
||||
**Impact:** High
|
||||
**Risks:**
|
||||
- Breaking change across 40+ usages (grep shows widespread use in App.xaml.cs, services, ViewModels)
|
||||
- **Mitigation:** Step-by-step refactoring with compiler-guided updates
|
||||
|
||||
**Related Files:**
|
||||
- `/Users/noise/Code/BRANCH_MAINT_4_04/Common/DTS.Common/Enums/RunTestVariables.cs:1-315`
|
||||
- `/Users/noise/Code/BRANCH_MAINT_4_04/Common/DTS.CommonCore/Enums/RunTestVariables.cs`
|
||||
|
||||
---
|
||||
|
||||
### #2. Create IDbAPI Interface (Low Effort, High Impact)
|
||||
|
||||
**Category:** Database Layer
|
||||
|
||||
**Problem:**
|
||||
- `DbAPI.cs:237-373` exposes 15+ static properties (Connections, Database, DAS, Sensors, etc.)
|
||||
- No interface abstraction (`IDbAPI` doesn't exist)
|
||||
- Lines 229-240 show `_instance` singleton pattern with static wrappers
|
||||
- Tight coupling: ALL modules depend on static DbAPI, making testing nearly impossible
|
||||
- Violates Dependency Inversion Principle
|
||||
|
||||
**Solution:**
|
||||
- Create `IDbAPI` interface with all current static property getters
|
||||
- Implement `DbApiService` class that wraps singleton instance
|
||||
- Register with Unity: `container.RegisterType<IDbAPI, DbApiService>(new ContainerControlledLifetimeManager())`
|
||||
- Gradually refactor modules to inject `IDbAPI` instead of static `DbAPI.XXX`
|
||||
|
||||
**Effort:** Low (5-7 days)
|
||||
**Impact:** High
|
||||
**Risks:**
|
||||
- Massive refactoring (15+ properties used across 40+ modules)
|
||||
- **Mitigation:** Keep static wrappers during transition, deprecate gradually
|
||||
|
||||
**Related Files:**
|
||||
- `/Users/noise/Code/BRANCH_MAINT_4_04/DataPRO/DbAPI/DbAPI.cs:229-373`
|
||||
|
||||
---
|
||||
|
||||
### #3. Extract Test State Management from App.xaml.cs (Medium Effort, High Impact)
|
||||
|
||||
**Category:** Architecture / God Class Refactoring
|
||||
|
||||
**Problem:**
|
||||
- `App.xaml.cs:128-235` contains `StartTest()` and `EndTest()` methods with 150+ lines each
|
||||
- Mixed concerns: licensing (line 307), DB initialization (line 328), test state (lines 128-235), UI operations
|
||||
- Lines 103, 119 show static `RunTestVariables` modifications alongside UI thread marshaling
|
||||
- God class (4620 lines total, only first 500 read but structure evident)
|
||||
|
||||
**Solution:**
|
||||
- Extract `ITestStateService` with methods:
|
||||
- `StartTest(TestConfiguration config)`
|
||||
- `EndTest()`
|
||||
- `SetRunTestRealtimeVariables()`
|
||||
- Extract `ILicensingService` (lines 300-340)
|
||||
- Extract `IDatabaseInitializer` (lines 328-400)
|
||||
- Register services with Unity, inject into App.xaml.cs
|
||||
|
||||
**Effort:** Medium (2-3 weeks)
|
||||
**Impact:** High
|
||||
**Risks:**
|
||||
- Disrupts architectural foundation
|
||||
- **Mitigation:** Incremental extraction, keep backward compatibility
|
||||
|
||||
**Related Files:**
|
||||
- `/Users/noise/Code/BRANCH_MAINT_4_04/DataPRO/DataPRO/App.xaml.cs:1-4620`
|
||||
|
||||
---
|
||||
|
||||
### #4. Add Unit Test Scaffolding (Low Effort, High Impact)
|
||||
|
||||
**Category:** Testing
|
||||
|
||||
**Problem:**
|
||||
- Only database tests exist in `DataPRO/UnitTest/`
|
||||
- No ViewModel tests (MVVM pattern but untested)
|
||||
- No service layer tests
|
||||
- Lines 22-30 of Architecture.md note "Limited test coverage"
|
||||
|
||||
**Solution:**
|
||||
- Create test project structure:
|
||||
- `DataPRO.Tests.ViewModels/`
|
||||
- `DataPRO.Tests.Services/`
|
||||
- `DataPRO.Tests.Modules/`
|
||||
- Add NUnit/Xunit + Moq setup
|
||||
- Write 5-10 high-value tests for critical paths:
|
||||
- `RunTestVariablesService` initialization
|
||||
- `TestStateService.StartTest()` flow
|
||||
- Database connection pooling
|
||||
|
||||
**Effort:** Low (1 week)
|
||||
**Impact:** High
|
||||
**Risks:**
|
||||
- Low risk, high reward
|
||||
**Mitigation:** Start small, expand coverage iteratively
|
||||
|
||||
---
|
||||
|
||||
### #5. Fix Async Context in App.xaml.cs (Medium Effort, High Impact)
|
||||
|
||||
**Category:** Threading / Stability
|
||||
|
||||
**Problem:**
|
||||
- Lines 128-161 `StartTest()` calls `DbOperations.LogDBCaching()`, `SetRunTestRealtimeVariables()` on UI thread
|
||||
- Line 459: `TabPageSource.GetGroups("AllGroups")` blocks UI thread for 3-4 seconds
|
||||
- Line 399-406: Database initialization on UI thread during startup
|
||||
- No async/await pattern anywhere (Architecture.md line 380 notes "BackgroundWorker instead of async/await")
|
||||
- Lines 238-242, 254-262, 266-274 show Dispatcher marshaling boilerplate
|
||||
|
||||
**Solution:**
|
||||
- Convert sync DB calls to async:
|
||||
```csharp
|
||||
public async Task StartTestAsync()
|
||||
{
|
||||
await LoadTestConfigurationAsync();
|
||||
await InitializeDatabaseAsync();
|
||||
uiContext.Send(_ => RaiseTestStarted(), null);
|
||||
}
|
||||
```
|
||||
- Replace `BackgroundWorker` with async/await throughout codebase
|
||||
- Use `IHostBuilder` for background services
|
||||
|
||||
**Effort:** Medium (2-3 weeks)
|
||||
**Impact:** High
|
||||
**Risks:**
|
||||
- Breaking changes to synchronous call chains
|
||||
- **Mitigation:** Async-avoid pattern, add overloads during transition
|
||||
|
||||
---
|
||||
|
||||
## Medium Priority (Triage 6-12)
|
||||
|
||||
### #6. Improve DASFactory BlockingCollection Threading (Medium Effort, Medium Impact)
|
||||
|
||||
**Category:** Threading / DASFactory
|
||||
|
||||
**Problem:**
|
||||
- Line 127 of `DASFactory.cs`: `private BlockingCollection<Tuple<QueueActions, DeviceHandling>> _queueActionPerDevice;`
|
||||
- No visible async consumer pattern (read up to line 139, full file 1712 lines)
|
||||
- Mixed threading model: UI thread produces, worker threads consume
|
||||
- Lines 156-160 show `StartMulticastAutoDiscovery()` without cancellation support
|
||||
|
||||
**Solution:**
|
||||
- Implement proper async consumer pattern:
|
||||
```csharp
|
||||
private readonly Channel<(QueueActions, DeviceHandling)> _deviceChannel = Channel.CreateBounded<(QueueActions, DeviceHandling)>(new BoundedChannelOptions(100) { FullMode = BoundedChannelFullMode.Wait });
|
||||
```
|
||||
- Add cancellation tokens to long-running Discovery operations
|
||||
- Use `IHostedService` for background device monitoring
|
||||
|
||||
**Effort:** Medium (1-2 weeks)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Device discovery timing changes
|
||||
- **Mitigation:** Thorough integration testing with actual hardware
|
||||
|
||||
---
|
||||
|
||||
### #7. Database Connection Pooling Optimization (Low Effort, Medium Impact)
|
||||
|
||||
**Category:** Database / Performance
|
||||
|
||||
**Problem:**
|
||||
- Lines 108-138 in `DbAPI.cs` create new `SqlCommand` for every call
|
||||
- Lines 137, 194: `cmd.Connection.Dispose()` on every operation
|
||||
- No connection pooling configuration visible
|
||||
- Stored procedure version negotiation (lines 34-97) executes during runtime path
|
||||
|
||||
**Solution:**
|
||||
- Configure SQL Connection Pooling in connection string
|
||||
- Reuse `SqlCommand` objects where possible
|
||||
- Cache SP version results longer (currently cached per invocation)
|
||||
- Add connection health checks
|
||||
|
||||
**Effort:** Low (1 week)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Low risk
|
||||
**Mitigation:** Benchmark before/after
|
||||
|
||||
---
|
||||
|
||||
### #8. Module Dependency Audit (Medium Effort, Medium Impact)
|
||||
|
||||
**Category:** Architecture
|
||||
|
||||
**Problem:**
|
||||
- 40+ Prism modules (Architecture.md line 37 notes "30+")
|
||||
- Lines 68-75 of Architecture.md show module registration chaos
|
||||
- Mixed initialization: `Initialize()` vs `RegisterTypes()`
|
||||
- Tight coupling between modules (e.g., SensorsList → HardwareList → GroupList)
|
||||
|
||||
**Solution:**
|
||||
- Audit module dependencies with dependency graph tool
|
||||
- Create module dependency rules (e.g., "Viewers depend on Services but not vice versa")
|
||||
- Introduce module-level interfaces (`ISensorsModule`, `IHardwareModule`)
|
||||
- Document module contract boundaries
|
||||
|
||||
**Effort:** Medium (2 weeks)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Refactoring module initialization patterns
|
||||
- **Mitigation:** Document before/after patterns
|
||||
|
||||
---
|
||||
|
||||
### #9. Replace Static Abstract RunTestVariables with Instance Pattern (Low Effort, Medium Impact)
|
||||
|
||||
**Category:** State Management
|
||||
|
||||
**Problem:**
|
||||
- `RunTestVariables.cs:9`: `public abstract class RunTestVariables` with static properties
|
||||
- Line 287-294: Redundant pattern `public static int Property = CONSTANT;`
|
||||
- Inheritance hierarchy unnecessary for data holder
|
||||
- Makes DI impossible
|
||||
|
||||
**Solution:**
|
||||
- Convert to `sealed class RunTestVariables : IRunTestVariables`
|
||||
- Use constructor injection for configuration
|
||||
- Add `Reset()` method for test isolation
|
||||
|
||||
**Effort:** Low (3-5 days)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Breaking change (100+ usages inferred)
|
||||
- **Mitigation:** Same as #1, step-by-step
|
||||
|
||||
---
|
||||
|
||||
### #10. Consolidate Logging Infrastructure (Medium Effort, Medium Impact)
|
||||
|
||||
**Category:** Architecture
|
||||
|
||||
**Problem:**
|
||||
- Architecture.md line 380: "Mixed logging - custom APILogger and TextLogger classes"
|
||||
- Two logger types: `APILogger` (custom) and `TextLogger` (file-based)
|
||||
- Lines 78-82 of App.xaml.cs: `_loggers.Add(new TextLogger(...))` mixed with `APILogger.Writer = LogStuff` (line 324)
|
||||
- No structured logging, no log levels per module
|
||||
|
||||
**Solution:**
|
||||
- Adopt Serilog or Microsoft.Extensions.Logging
|
||||
- Configure per-module log levels
|
||||
- Structured logging for searchability
|
||||
- Migration plan: wrapper adapters → direct usage
|
||||
|
||||
**Effort:** Medium (2-3 weeks)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Log message formatting changes
|
||||
- **Mitigation:** Backward compatible adapter layer
|
||||
|
||||
---
|
||||
|
||||
### #11. Optimize RunTest Real-time Database Calls (Low Effort, Medium Impact)
|
||||
|
||||
**Category:** Performance
|
||||
|
||||
**Problem:**
|
||||
- Comment at lines 163-165 of App.xaml.cs: "http://manuscript.dts.local/f/cases/33110/Eliminate-DB-communication-while-in-realtime"
|
||||
- Prepopulation already done (lines 166-218) but still query `Defaults.GetUserSettingValue*()` (lines 169-206)
|
||||
- Lines 452-459 of App.xaml.cs: `SettingsDB.GetAllGlobalValues()` blocks startup
|
||||
|
||||
**Solution:**
|
||||
- Cache all settings in `RunTestVariables` at test start
|
||||
- Add runtime settings change listener (if needed)
|
||||
- Lazy-load non-critical settings
|
||||
|
||||
**Effort:** Low (5-7 days)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Settings changes during test not reflected (acceptable tradeoff)
|
||||
- **Mitigation:** Document setting freeze at test start
|
||||
|
||||
---
|
||||
|
||||
### #12. Add Configuration Validation (Medium Effort, Medium Impact)
|
||||
|
||||
**Category:** Stability
|
||||
|
||||
**Problem:**
|
||||
- No validation of DB connection strings
|
||||
- No validation of hardware configuration before test start
|
||||
- Lines 391-411 of App.xaml.cs: Command line args parsed but minimal validation
|
||||
- Line 349-358: License validation only checks DB type for license type, not actual DB connectivity
|
||||
|
||||
**Solution:**
|
||||
- Add `IConfigurationValidator` interface
|
||||
- Validate:
|
||||
- Database connectivity before bootstrapper
|
||||
- Hardware configuration completeness before test start
|
||||
- User permissions
|
||||
- Fail fast with helpful error messages
|
||||
|
||||
**Effort:** Medium (1-2 weeks)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- User workflow changes (earlier failures)
|
||||
- **Mitigation:** Clear error messages, rollback options
|
||||
|
||||
---
|
||||
|
||||
## Low Priority (Triage 13+)
|
||||
|
||||
### #13. Upgrade .NET Framework to .NET 6/8 (High Effort, High Impact)
|
||||
|
||||
**Category:** Architecture / Modernization
|
||||
|
||||
**Problem:**
|
||||
- Architecture.md line 316: ".NET Framework 4.8"
|
||||
- Legacy platform, no long-term support
|
||||
- Missing modern features (native DI, async-streaming, improved threading)
|
||||
|
||||
**Effort:** High (3-4 months)
|
||||
**Impact:** High
|
||||
**Risks:**
|
||||
- Major breaking changes
|
||||
- Dependency compatibility
|
||||
- **Mitigation:** Phased migration, test automation
|
||||
|
||||
---
|
||||
|
||||
### #14. Add Error Handling Patterns (Medium Effort, Medium Impact)
|
||||
|
||||
**Category:** Stability
|
||||
|
||||
**Problem:**
|
||||
- Lines 129-133, 186-190 of `DbAPI.cs`: Generic `catch (Exception ex)` with `return ErrorCodes.ERROR_UNKNOWN`
|
||||
- No structured error handling across modules
|
||||
- Stack traces lost in translation to error codes
|
||||
|
||||
**Solution:**
|
||||
- Define error hierarchy: `ApplicationException`, `DatabaseException`, `HardwareException`
|
||||
- Use `Result<T>` pattern instead of out params + error codes
|
||||
- Central error handling with DI
|
||||
|
||||
**Effort:** Medium (2 weeks)
|
||||
**Impact:** Medium
|
||||
**Risks:**
|
||||
- Breaking change to API contracts
|
||||
- **Mitigation:** Gradual adoption
|
||||
|
||||
---
|
||||
|
||||
### #15. Build Performance Optimization (Low Effort, Low Impact)
|
||||
|
||||
**Category:** Build / CI
|
||||
|
||||
**Problem:**
|
||||
- 100+ projects in solution (solution file 440+ lines)
|
||||
- No indication of parallel builds
|
||||
- Rebuilds entire solution on any change
|
||||
|
||||
**Solution:**
|
||||
- Project dependency graph optimization
|
||||
- Precompiled headers for common libraries
|
||||
- Incremental builds
|
||||
|
||||
**Effort:** Low (3-5 days)
|
||||
**Impact:** Low
|
||||
**Risks:**
|
||||
- Low risk
|
||||
**Mitigation:** Measure build times before/after
|
||||
|
||||
---
|
||||
|
||||
## Summary Matrix
|
||||
|
||||
| Triage | # | Effort | Impact | Category |
|
||||
|--------|---|--------|--------|----------|
|
||||
| **1** | #1 | Low | High | State Management |
|
||||
| **2** | #2 | Low | High | Database Layer |
|
||||
| **3** | #3 | Medium | High | Architecture |
|
||||
| **4** | #4 | Low | High | Testing |
|
||||
| **5** | #5 | Medium | High | Threading |
|
||||
| 6 | #6 | Medium | Medium | Threading |
|
||||
| 7 | #7 | Low | Medium | Database |
|
||||
| 8 | #8 | Medium | Medium | Architecture |
|
||||
| 9 | #9 | Low | Medium | State Management |
|
||||
| 10 | #10 | Medium | Medium | Architecture |
|
||||
| 11 | #11 | Low | Medium | Performance |
|
||||
| 12 | #12 | Medium | Medium | Stability |
|
||||
| 13 | #13 | High | High | Modernization |
|
||||
| 14 | #14 | Medium | Medium | Stability |
|
||||
| 15 | #15 | Low | Low | Build |
|
||||
|
||||
---
|
||||
|
||||
## Recommended Immediate Action Plan
|
||||
|
||||
### Week 1-2: Quick Wins
|
||||
1. **#4: Add Unit Test Scaffolding** - Establish test infrastructure, write 5-10 tests
|
||||
2. **#1: Refactor RunTestVariables** - Create interface, inject into 1-2 modules as proof-of-concept
|
||||
|
||||
### Week 3-6: High Impact Refactoring
|
||||
3. **#2: Create IDbAPI Interface** - Replace static DbAPI usage in 5 key modules
|
||||
4. **#11: Optimize Real-time DB Calls** - Cache remaining settings, measure test initialization time
|
||||
|
||||
### Month 2-3: Architecture Modernization
|
||||
5. **#5: Fix Async Context** - Replace BackgroundWorker with async/await in App.xaml.cs
|
||||
6. **#3: Extract Test State** - Create `ITestStateService`, refactor StartTest/EndTest
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- **Static DbAPI** is the root cause of most testability issues (#1, #2, #3 should be grouped)
|
||||
- **RunTestVariables** duplication (two files) suggests merging or clear separation needed
|
||||
- No CI/CD pipeline visible in codebase - recommend adding GitHub Actions/Azure DevOps
|
||||
- Architecture.md shows "God Class" concerns already identified in prior analysis (GLM5)
|
||||
|
||||
---
|
||||
|
||||
**Document generated by Qwen3-Coder-Next analysis agent**
|
||||
150
docs/QWEN3CoderNext.md
Normal file
150
docs/QWEN3CoderNext.md
Normal file
@@ -0,0 +1,150 @@
|
||||
# QWEN3CoderNext - DataPRO Codebase Onboarding Guide
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Build & Run
|
||||
```bash
|
||||
# Build solution (Windows/Visual Studio required)
|
||||
msbuild DataPRO/DataPRO.sln /p:Configuration=Debug
|
||||
|
||||
# Run tests (NUnit-based)
|
||||
# Tests located in DataPRO/UnitTest/
|
||||
```
|
||||
|
||||
### Critical Files
|
||||
- **Solution**: `DataPRO.sln` (440+ lines, 100+ projects)
|
||||
- **Main App**: `DataPRO/App.xaml.cs` (4620+ lines - god class warning)
|
||||
- **Database**: `DataPRO/DbAPI/DbAPI.cs` (static facade, no interface)
|
||||
- **Constants**: `Common/DTS.Common.Core/DTSConstants.cs` (hardcoded dev paths)
|
||||
|
||||
## Architecture Summary
|
||||
|
||||
### Tech Stack
|
||||
- **UI Framework**: WPF (.NET Framework 4.8)
|
||||
- **Architecture**: MVVM + Prism 8.x Modularity
|
||||
- **DI Container**: Unity
|
||||
- **State Machine**: Stateless library ( IService )
|
||||
|
||||
### High-Level Layers
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ UI Layer (Prism Modules) │
|
||||
│ Sensors, Hardware, Groups, Realtime, Reports, ISO Settings│
|
||||
│ 30+ modules, each with ViewModels, Views, Services │
|
||||
└───────────────────────┬───────────────────────────────────────┘
|
||||
│ EventAggregator (IEventAggregator)
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Services Layer (IService, DASFactory) │
|
||||
│ - Hardware discovery & command execution │
|
||||
│ - State machine (Prepare→Configure→Arm→Realtime→...) │
|
||||
│ - UDP streaming for real-time data │
|
||||
└───────────────────────┬───────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Data Layer (DbAPI, SensorDB) │
|
||||
│ Static DbAPI facade → IConnections, ISensors, IGroups │
|
||||
│ SQLite database with hardware-specific schemas │
|
||||
└───────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Data Flow Patterns
|
||||
|
||||
1. **Hardware Discovery**: Hardware → DASFactory → EventBus → Modules
|
||||
2. **Test Configuration**: Sensors → Groups → TestSetups → DbAPI
|
||||
3. **Real-time Data**: IService → UDP → Charts + Database Storage
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Adding a New Module
|
||||
1. Follow pattern in `DataPRO/Modules/Sensors/` or `DataPRO/Modules/Hardware/`
|
||||
2. Module must implement `IModule.Initialize()`
|
||||
3. Register views/services in `RegisterTypes()` (Unity container)
|
||||
4. Subscribe to events via `IEventAggregator` (avoid staticDbAPI where possible)
|
||||
|
||||
### Adding Hardware Support
|
||||
1. **Hardware Commands**: Add command library in `HardwareCommands/` (e.g., `RibeyeCommands/`)
|
||||
2. **Hardware Type**: Add enum to `DTS.Common.Core/DASHardwareType.cs`
|
||||
3. **Factory Registration**: Register in `DASFactory` (see `DASFactory.cs` hardware discovery logic)
|
||||
4. **Module**: Create or extend Prism module for UI support
|
||||
|
||||
### Event Aggregator Patterns
|
||||
- **Hardware Events**: `HardwareConnectedEvent`, `HardwareDisconnectedEvent`
|
||||
- **Data Events**: `TestDataUpdatedEvent`, `RealtimeDataAvailableEvent`
|
||||
- **State Events**: `SystemStateChangedEvent`
|
||||
- Use `PubSubEvent<T>` for cross-module communication
|
||||
- **Avoid**: Direct coupling, static DbAPI access in ViewModels
|
||||
|
||||
### Import/Export Workflow
|
||||
1. **Template**: See `GLM5Analysis/PatternLibrary/ImportExport.md`
|
||||
2. **Data Format**: CSV, XML, or custom binary
|
||||
3. **Validation**: Run through `DbAPI` layer (don't bypass)
|
||||
4. **Error Handling**: Use `IEventAggregator` to publish导入 errors
|
||||
|
||||
## Key Gotchas & Tech Debt
|
||||
|
||||
### Critical
|
||||
1. **Static DbAPI** (`DbAPI.cs:237-373`): No interface abstraction, hard to test
|
||||
2. **God Class**: `App.xaml.cs` contains 4620+ lines of mixed logic (licensing, test state, DB ops, UI)
|
||||
3. **Mixed Patterns**: BackgroundWorker (legacy) vs async/await (newer code)
|
||||
4. **Hardcoded Paths**: `DTSConstants.cs` contains dev environment paths
|
||||
5. **Module initialization**: Some use `Initialize()`, others `RegisterTypes()` - inconsistent
|
||||
|
||||
### Testing
|
||||
- **UnitTest**: NUnit-based tests in `DataPRO/UnitTest/`
|
||||
- **Test Scaffolds**: See `GLM5Analysis/TestScaffolds/`
|
||||
- **Mocking**: Use Moq for `IEventAggregator`, `IService`, `IDbConnection`
|
||||
|
||||
### Build Issues
|
||||
- **Windows Only**: Requires Visual Studio (WPF, .NET Framework 4.8)
|
||||
- **Dependencies**: SQLite runtime, National Instruments drivers (if applicable)
|
||||
|
||||
## Tooling & Documentation
|
||||
|
||||
### AI-Powered Search (Recommended)
|
||||
```python
|
||||
# Use these tools before grep:
|
||||
retrieval_vector_search("how does hardware discovery work")
|
||||
retrieval_get_module_summary("DataPRO/Modules/Sensors")
|
||||
retrieval_list_enriched_modules()
|
||||
```
|
||||
|
||||
### Existing Documentation
|
||||
| Location | Purpose |
|
||||
|----------|---------|
|
||||
| `GLM5Analysis/Architecture.md` | System architecture (420-line master guide) |
|
||||
| `GLM5Analysis/PromptTemplates/` | Task-specific guides (AddUnitTest, AddHardware, etc.) |
|
||||
| `GLM5Analysis/PatternLibrary/` | Reusable patterns (MVVM, Prism, ImportExport) |
|
||||
| `GLM5Analysis/TestScaffolds/` | Test templates |
|
||||
| `enriched-qwen3-coder-next/` | AI-generated module docs |
|
||||
| `GIT Migration.md` | SVN → Git migration plan |
|
||||
|
||||
## Further Reading
|
||||
|
||||
1. **Core Modules** (use `retrieval_get_module_summary()`):
|
||||
- `Common/DTS.Common.Core/` - Constants, base classes
|
||||
- `DataPRO/DbAPI/` - Database access layer
|
||||
- `DataPRO/Modules/Sensors/` - Sensor management module
|
||||
- `DataPRO/Modules/Hardware/` - Hardware discovery module
|
||||
|
||||
2. **Critical Files**:
|
||||
- `DataPRO/App.xaml.cs` - Main application initialization
|
||||
- `DataPRO/DbAPI/DbAPI.cs` - Database facade (static, no interface)
|
||||
- `DataPRO/Modules/ModuleBase.cs` - Prism module base class
|
||||
|
||||
3. **Patterns** (see `GLM5Analysis/PatternLibrary/`):
|
||||
- MVVM Pattern (ViewModel, View, Model separation)
|
||||
- Prism Module Pattern (<IModule> interface, registration)
|
||||
- Event Aggregator Pattern (cross-module communication)
|
||||
- Service Pattern (IDataService, ISensorService)
|
||||
- DataAccess Pattern (DbAPI facade pattern)
|
||||
|
||||
---
|
||||
|
||||
**Remember**:
|
||||
- Use `retrieval` tools first for code exploration
|
||||
- Avoid static DbAPI access in new code
|
||||
- Follow Prism module patterns consistently
|
||||
- Check `AGENTS.md` for opencode-specific workflow configuration
|
||||
52
docs/ai/Common/DTS.Common.CPU.md
Normal file
52
docs/ai/Common/DTS.Common.CPU.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.CPU/CPUModule.cs
|
||||
generated_at: "2026-04-17T16:38:14.448540+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "4fa44b6762649f96"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.CPU Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides CPU-related functionality within a Prism-modular WPF application. It serves as a plugin module that registers CPU engine services with the Unity dependency injection container at runtime. The module also defines assembly-level metadata attributes (`CPUNameAttribute` and `CUPImageAttribute`) that expose the module's name and visual representation for display in the application's main screen component list.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### CPUModule Class
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "CPU")]
|
||||
public class CPUModule : IModule
|
||||
```
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `CPUModule(IUnityContainer unityContainer)` | Accepts a Unity container instance via constructor injection. Stores it in a readonly field `_unityContainer`. |
|
||||
| Initialize | `void Initialize()` | Registers `ICPUEngine` mapped to `CPUEngine` with the Unity container. Contains commented-out registration for `IPropertyViewModel`. |
|
||||
|
||||
### CPUNameAttribute Class
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class CPUNameAttribute : TextAttribute
|
||||
```
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `CPUNameAttribute()` | Default constructor, delegates to `CPUNameAttribute(null)`. |
|
||||
| Constructor | `CPUNameAttribute(string s)` | Initializes `_assemblyName` to the literal string `"CPUAsssembly"`. The parameter `s` is unused. |
|
||||
| AssemblyName | `override string AssemblyName { get; }` | Returns `_assemblyName` (`"CPUAsssembly"`). |
|
||||
| GetAttributeType | `override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
|
||||
| GetAssemblyName | `override string GetAssemblyName()` | Returns the `AssemblyName` property value. |
|
||||
|
||||
### CUPImageAttribute Class
|
||||
|
||||
**Signature:**
|
||||
22
docs/ai/Common/DTS.Common.CPU/Classes.md
Normal file
22
docs/ai/Common/DTS.Common.CPU/Classes.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.CPU/Classes/BREngine.cs
|
||||
- Common/DTS.Common.CPU/Classes/CPUEngine.cs
|
||||
generated_at: "2026-04-17T16:07:30.416613+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "8cdbe4973343fdb5"
|
||||
---
|
||||
|
||||
# Classes
|
||||
|
||||
### Purpose
|
||||
This module contains engine classes for CPU-related functionality. `CPUEngine` serves as a central coordinator that integrates Prism's event aggregation, region management, and Unity dependency injection to handle notifications and status changes. `BREngine` is currently an empty placeholder class.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**BREngine**
|
||||
- `public BREngine()` — Default constructor. Class has no members.
|
||||
|
||||
**CPUEngine** (implements `ICPUEngine`)
|
||||
- `public CPUEngine()` — Constructor that resolves `IUnityContainer` from `ServiceLocator.Current`, then resolves `IEventAggregator` and `IServiceLocator`. Initializes `
|
||||
192
docs/ai/Common/DTS.Common.CPU/Properties.md
Normal file
192
docs/ai/Common/DTS.Common.CPU/Properties.md
Normal file
@@ -0,0 +1,192 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.CPU/Properties/AssemblyInfo.cs
|
||||
- Common/DTS.Common.CPU/Properties/Annotations.cs
|
||||
generated_at: "2026-04-17T15:42:18.019490+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "42a5c903cb87b2e6"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.CPU
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a comprehensive set of code annotation attributes for static analysis and IDE tooling support within the DTS.Common.CPU assembly. The attributes are derived from JetBrains ReSharper annotations (MIT licensed, 2016) and enable enhanced nullability analysis, contract annotations, MVC/Razor development support, and various code quality inspections. The module exists to improve developer productivity and catch potential bugs at compile-time through rich metadata annotations rather than providing runtime functionality.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Nullability Attributes
|
||||
|
||||
| Attribute | Targets | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `CanBeNullAttribute` | Method, Parameter, Property, Delegate, Field, Event, Class, Interface, GenericParameter | Indicates the marked element's value could be `null` sometimes, requiring null checks before usage. |
|
||||
| `NotNullAttribute` | Method, Parameter, Property, Delegate, Field, Event, Class, Interface, GenericParameter | Indicates the marked element's value can never be `null`. |
|
||||
| `ItemNotNullAttribute` | Method, Parameter, Property, Delegate, Field | Applied to IEnumerable, Task, or Lazy types to indicate collection items, Task.Result, or Lazy.Value can never be null. |
|
||||
| `ItemCanBeNullAttribute` | Method, Parameter, Property, Delegate, Field | Applied to IEnumerable, Task, or Lazy types to indicate collection items, Task.Result, or Lazy.Value can be null. |
|
||||
| `ImplicitNotNullAttribute` | Class, Struct, Interface, Assembly | Implicitly applies `[NotNull]`/`[ItemNotNull]` to all type members and parameters in scope. |
|
||||
|
||||
### String and Parameter Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `StringFormatMethodAttribute` | `ctor(string formatParameterName)` | Indicates a method builds strings by format pattern. `FormatParameterName` property identifies which parameter contains the format string. |
|
||||
| `ValueProviderAttribute` | `ctor(string name)` | Indicates a parameter expects values from a limited set, specified by the `Name` property. |
|
||||
| `InvokerParameterNameAttribute` | Parameter | Indicates the function argument should be a string literal matching one of the caller function's parameters. |
|
||||
| `PathReferenceAttribute` | `ctor()` / `ctor(string basePath)` | Indicates a parameter is a path to a file/folder within a web project. Optional `BasePath` property for relative paths. |
|
||||
| `RegexPatternAttribute` | Parameter | Indicates the parameter is a regular expression pattern. |
|
||||
|
||||
### Property Change Notification
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `NotifyPropertyChangedInvocatorAttribute` | `ctor()` / `ctor(string parameterName)` | Marks a method in an `INotifyPropertyChanged` implementation used to notify property changes. Optional `ParameterName` property. |
|
||||
|
||||
### Contract Annotations
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `ContractAnnotationAttribute` | `ctor(string contract)` / `ctor(string contract, bool forceFullStates)` | Describes dependencies between method input and output using Function Definition Table syntax. Properties: `Contract` (string), `ForceFullStates` (bool). |
|
||||
|
||||
### Localization and Equality
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `LocalizationRequiredAttribute` | `ctor()` / `ctor(bool required)` | Indicates whether marked element should be localized. `Required` property defaults to `true`. |
|
||||
| `CannotApplyEqualityOperatorAttribute` | Interface, Class, Struct | Indicates the type cannot be compared using `==` or `!=` operators; `Equals()` must be used instead. Comparison with `null` remains permitted. |
|
||||
|
||||
### Implicit Usage Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `UsedImplicitlyAttribute` | `ctor()` / `ctor(ImplicitUseKindFlags)` / `ctor(ImplicitUseTargetFlags)` / `ctor(ImplicitUseKindFlags, ImplicitUseTargetFlags)` | Marks a symbol as used implicitly (e.g., via reflection). Properties: `UseKindFlags`, `TargetFlags`. |
|
||||
| `MeansImplicitUseAttribute` | `ctor()` / `ctor(ImplicitUseKindFlags)` / `ctor(ImplicitUseTargetFlags)` / `ctor(ImplicitUseKindFlags, ImplicitUseTargetFlags)` | Applied to attributes; prevents symbols marked with such attributes from being flagged as unused. Properties: `UseKindFlags`, `TargetFlags`. |
|
||||
| `PublicAPIAttribute` | `ctor()` / `ctor(string comment)` | Marks publicly available API that should not be removed. Inherits `MeansImplicitUseAttribute` behavior with `WithMembers` target. |
|
||||
|
||||
### Enums for Implicit Usage
|
||||
|
||||
| Enum | Values | Description |
|
||||
|------|--------|-------------|
|
||||
| `ImplicitUseKindFlags` | `Default` (Access\|Assign\|InstantiatedWithFixedConstructorSignature), `Access` (1), `Assign` (2), `InstantiatedWithFixedConstructorSignature` (4), `InstantiatedNoFixedConstructorSignature` (8) | Flags specifying how a symbol is implicitly used. |
|
||||
| `ImplicitUseTargetFlags` | `Default` (Itself), `Itself` (1), `Members` (2), `WithMembers` (Itself\|Members) | Flags specifying what is considered used implicitly. |
|
||||
|
||||
### Method Behavior Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `InstantHandleAttribute` | Parameter | Indicates a parameter is completely handled during method execution (delegate executed, enumerable enumerated). |
|
||||
| `PureAttribute` | Method | Indicates a method makes no observable state changes. |
|
||||
| `MustUseReturnValueAttribute` | `ctor()` / `ctor(string justification)` | Indicates the return value of a method invocation must be used. Optional `Justification` property. |
|
||||
| `TerminatesProgramAttribute` | Method | **[Obsolete: Use `[ContractAnnotation("=> halt")]` instead]** Indicates a method unconditionally terminates control flow. |
|
||||
| `LinqTunnelAttribute` | Method | Indicates a pure LINQ method with postponed enumeration (like `Select`, `Where`). |
|
||||
| `NoEnumerationAttribute` | Parameter | Indicates an IEnumerable parameter is not enumerated. |
|
||||
|
||||
### Context and Base Type
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `ProvidesContextAttribute` | Field, Property, Parameter, Method, Class, Interface, Struct, GenericParameter | Indicates a member that should be used instead of other ways to obtain that type's value. |
|
||||
| `BaseTypeRequiredAttribute` | `ctor(Type baseType)` | When applied to an attribute, requires types marked with that attribute to implement/inherit `BaseType`. Must be applied to `Attribute`-derived classes. |
|
||||
|
||||
### Source Templates
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `SourceTemplateAttribute` | Method | Marks an extension method as a source template for code completion expansion. |
|
||||
| `MacroAttribute` | Parameter, Method (AllowMultiple) | Specifies macros for source template parameters. Properties: `Expression` (string), `Editable` (int), `Target` (string). |
|
||||
|
||||
### ASP.NET MVC Attributes
|
||||
|
||||
| Attribute | Targets | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `AspMvcActionAttribute` | Parameter, Method | Indicates a parameter is an MVC action name. Optional `AnonymousProperty` property. |
|
||||
| `AspMvcAreaAttribute` | Parameter | Indicates a parameter is an MVC area. Optional `AnonymousProperty` property. |
|
||||
| `AspMvcControllerAttribute` | Parameter, Method | Indicates a parameter is an MVC controller. Optional `AnonymousProperty` property. |
|
||||
| `AspMvcMasterAttribute` | Parameter | Indicates a parameter is an MVC Master. |
|
||||
| `AspMvcModelTypeAttribute` | Parameter | Indicates a parameter is an MVC model type. |
|
||||
| `AspMvcPartialViewAttribute` | Parameter, Method | Indicates a parameter is an MVC partial view. |
|
||||
| `AspMvcViewAttribute` | Parameter, Method | Indicates a parameter is an MVC view component. |
|
||||
| `AspMvcViewComponentAttribute` | Parameter | Indicates a parameter is an MVC view component name. |
|
||||
| `AspMvcViewComponentViewAttribute` | Parameter, Method | Indicates a parameter is an MVC view component view. |
|
||||
| `AspMvcActionSelectorAttribute` | Parameter, Property | Applied to attribute parameters to indicate MVC action name. |
|
||||
| `AspMvcDisplayTemplateAttribute` | Parameter | Indicates a parameter is an MVC display template. |
|
||||
| `AspMvcEditorTemplateAttribute` | Parameter | Indicates a parameter is an MVC editor template. |
|
||||
| `AspMvcTemplateAttribute` | Parameter | Indicates a parameter is an MVC template. |
|
||||
| `AspMvcSuppressViewErrorAttribute` | Class, Method | Disables MVC view inspections within a class or method. |
|
||||
|
||||
### ASP.NET MVC Location Format Attributes (Assembly-level)
|
||||
|
||||
| Attribute | Signature |
|
||||
|-----------|-----------|
|
||||
| `AspMvcAreaMasterLocationFormatAttribute` | `ctor(string format)` |
|
||||
| `AspMvcAreaPartialViewLocationFormatAttribute` | `ctor(string format)` |
|
||||
| `AspMvcAreaViewLocationFormatAttribute` | `ctor(string format)` |
|
||||
| `AspMvcMasterLocationFormatAttribute` | `ctor(string format)` |
|
||||
| `AspMvcPartialViewLocationFormatAttribute` | `ctor(string format)` |
|
||||
| `AspMvcViewLocationFormatAttribute` | `ctor(string format)` |
|
||||
|
||||
### HTML Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `HtmlElementAttributesAttribute` | `ctor()` / `ctor(string name)` | Applied to parameters/properties/fields for HTML element attributes. Optional `Name` property. |
|
||||
| `HtmlAttributeValueAttribute` | `ctor(string name)` | Indicates an HTML attribute value. `Name` property is required. |
|
||||
|
||||
### Razor Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `RazorSectionAttribute` | Parameter, Method | Indicates a parameter or method is a Razor section. |
|
||||
| `RazorImportNamespaceAttribute` | Assembly | `ctor(string name)` - Imports a namespace in Razor. |
|
||||
| `RazorInjectionAttribute` | Assembly | `ctor(string type, string fieldName)` - Configures Razor injection. Properties: `Type`, `FieldName`. |
|
||||
| `RazorDirectiveAttribute` | Assembly | `ctor(string directive)` - Specifies a Razor directive. |
|
||||
| `RazorHelperCommonAttribute` | Method | Marks Razor helper methods. |
|
||||
| `RazorLayoutAttribute` | Property | Marks Razor layout properties. |
|
||||
| `RazorWriteLiteralMethodAttribute` | Method | Marks Razor write literal methods. |
|
||||
| `RazorWriteMethodAttribute` | Method | Marks Razor write methods. |
|
||||
| `RazorWriteMethodParameterAttribute` | Parameter | Marks Razor write method parameters. |
|
||||
|
||||
### ASP.NET Web Forms Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `AspChildControlTypeAttribute` | Class | `ctor(string tagName, Type controlType)` - Specifies child control types. Properties: `TagName`, `ControlType`. |
|
||||
| `AspDataFieldAttribute` | Property, Method | Marks ASP.NET data fields. |
|
||||
| `AspDataFieldsAttribute` | Property, Method | Marks multiple ASP.NET data fields. |
|
||||
| `AspMethodPropertyAttribute` | Property | Marks ASP.NET method properties. |
|
||||
| `AspRequiredAttributeAttribute` | Class | `ctor(string attribute)` - Specifies required attributes. `Attribute` property. |
|
||||
| `AspTypePropertyAttribute` | Property | `ctor(bool createConstructorReferences)` - Marks ASP.NET type properties. `CreateConstructorReferences` property. |
|
||||
|
||||
### Collection Access
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `CollectionAccessAttribute` | `ctor(CollectionAccessType)` | Indicates how a method/constructor/property affects collection content. `CollectionAccessType` property. |
|
||||
|
||||
| Enum | Values |
|
||||
|------|--------|
|
||||
| `CollectionAccessType` | `None` (0), `Read` (1), `ModifyExistingContent` (2), `UpdatedContent` (ModifyExistingContent\|4) |
|
||||
|
||||
### Assertion Attributes
|
||||
|
||||
| Attribute | Signature | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `AssertionMethodAttribute` | Method | Marks a method as an assertion method that halts control flow if conditions are satisfied. |
|
||||
| `AssertionConditionAttribute` | `ctor(AssertionConditionType)` | Marks the condition parameter of an assertion method. `ConditionType` property. |
|
||||
|
||||
| Enum | Values |
|
||||
|------|--------|
|
||||
| `AssertionConditionType` | `IS_TRUE` (0), `IS_FALSE` (1), `IS_NULL` (2), `IS_NOT_NULL` (3) |
|
||||
|
||||
### XAML Attributes
|
||||
|
||||
| Attribute | Targets | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `XamlItemsControlAttribute` | Class | Indicates a type with `ItemsSource` property should be treated as `ItemsControl`-derived. |
|
||||
| `XamlItemBindingOfItemsControlAttribute` | Property | Indicates a `BindingBase`-derived property used to bind items in an `ItemsControl`. |
|
||||
|
||||
### Utility
|
||||
|
||||
| Attribute | Targets | Description |
|
||||
|-----------|---------|-------------|
|
||||
| `NoReorder` | All | Prevents Member Reordering feature from re
|
||||
49
docs/ai/Common/DTS.Common.Calculations.md
Normal file
49
docs/ai/Common/DTS.Common.Calculations.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Calculations/ChannelData.cs
|
||||
- Common/DTS.Common.Calculations/Integral.cs
|
||||
- Common/DTS.Common.Calculations/Resultant.cs
|
||||
- Common/DTS.Common.Calculations/HeadInjuryCriterion.cs
|
||||
generated_at: "2026-04-17T16:03:17.838159+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f8b0959de0ed6cde"
|
||||
---
|
||||
|
||||
# DTS.Common.Calculations
|
||||
|
||||
### Purpose
|
||||
This module provides mathematical calculation utilities for signal processing and injury analysis. It supports integration of time-series data, generation of resultant vectors from multi-axis inputs, and computation of the Head Injury Criterion (HIC) used in impact analysis. The module is designed to work with filtered engineering unit data from sensor channels.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**ChannelData**
|
||||
- `string Units { get; }` - Engineering units of the data (read-only, set via constructor).
|
||||
- `double[] FilteredEU { get; set; }` - Pre-filtered engineering unit data array.
|
||||
- `ChannelData(string units)` - Constructor accepting engineering units string.
|
||||
|
||||
**Integral** (static class)
|
||||
- `static double DefiniteIntegral(double[] input, int start, int end, double SPS)` - Computes definite integral using trapezoidal summation. Parameters: input data array, start index (inclusive), end index (inclusive), samples per second. Returns integrated value.
|
||||
|
||||
**Resultant** (static class)
|
||||
- `static ChannelData GenerateResultantChannel(List<ChannelData> channels)` - Generates a resultant vector channel from input channels using sum-of-squares method. Returns new `ChannelData` with sqrt(Σxi²) values. Asserts all channels have same length and units.
|
||||
|
||||
**HeadInjuryCriterion**
|
||||
- `static HICResult GetHeadInjuryCriterion(ChannelData resultant, double SPS, int clipLengthMS)` - Calculates maximum HIC over the input data for the specified clip length. Returns `HICResult` with max HIC value and sample indices.
|
||||
- **HICResult** (nested class)
|
||||
- `int StartSample { get; }` - Start sample index of max HIC window.
|
||||
- `int EndSample { get; }` - End sample index of max HIC window.
|
||||
- `int HicLengthMS { get; }` - HIC window length in milliseconds.
|
||||
- `double HIC { get; }` - The HIC value.
|
||||
- `HICResult(double hic, int hicLength, int startSample, int endSample)` - Constructor.
|
||||
|
||||
### Invariants
|
||||
- `DefiniteIntegral` assumes input data is tightly time-aligned (uniform sampling interval).
|
||||
- `GenerateResultantChannel` asserts all input channels have identical `FilteredEU.Length` and identical `Units`.
|
||||
- `GetHeadInjuryCriterion` requires `SPS > 0` and `clipLengthMS > 0` (asserted).
|
||||
- `GetHeadInjuryCriterion` asserts data length is at least `clipLengthMS` worth of samples.
|
||||
- HIC calculation uses the formula: `hic = clipInSeconds * (integral / clipInSeconds)^2.5`
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System`, `System.Collections.Generic`, `System.Linq`
|
||||
- **Depended on by**: Unc
|
||||
38
docs/ai/Common/DTS.Common.Calculations/Properties.md
Normal file
38
docs/ai/Common/DTS.Common.Calculations/Properties.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Calculations/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:11:03.086458+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1d50c5abc26a5607"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata configuration for the `DTS.Common.Calculations` library. It is a standard .NET Framework assembly information file that defines versioning, copyright, and COM interoperability settings. The internal assembly title is "HeadInjuryCriterion", suggesting this library provides calculations related to head injury criteria (likely for impact testing/analysis).
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are exposed. This file only contains assembly-level attributes:
|
||||
- `AssemblyTitle`: "HeadInjuryCriterion"
|
||||
- `AssemblyVersion`: "1.0.0.0"
|
||||
- `AssemblyFileVersion`: "1.0.0.0"
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: "a83e3800-290f-4513-9756-d37168152099"
|
||||
|
||||
### Invariants
|
||||
- The assembly version is fixed at "1.0.0.0" in source; actual deployed versions may differ if built with wildcard versioning.
|
||||
- COM visibility is disabled for all types in this assembly.
|
||||
|
||||
### Dependencies
|
||||
**This module depends on:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this module:** Unclear from source alone—this is a leaf configuration file with no exports.
|
||||
|
||||
### Gotchas
|
||||
- The assembly title "HeadInjuryCriterion" does not match the module path "DTS.Common.Calculations". This naming inconsistency may cause confusion when searching for the library by name. The actual purpose of the library cannot be determined from this file alone.
|
||||
|
||||
---
|
||||
31
docs/ai/Common/DTS.Common.Core.md
Normal file
31
docs/ai/Common/DTS.Common.Core.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/DTSConstants.cs
|
||||
generated_at: "2026-04-17T16:38:12.526303+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e70970525f89bace"
|
||||
---
|
||||
|
||||
# Documentation: DTSConstants.cs
|
||||
|
||||
## 1. Purpose
|
||||
This module provides a centralized container for compile-time constant values used within the `DTS.Common.Core` namespace. Its primary role is to define hardcoded file paths for application configuration files, specifically targeting the `DTS.Viewer` application environment.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
**Class: `DTSConstants`**
|
||||
* **Type:** `public static class`
|
||||
* **Namespace:** `DTS.Common.Core`
|
||||
|
||||
**Members:**
|
||||
|
||||
* **`CustomConfigPath`**
|
||||
* **Signature:** `public const string`
|
||||
* **Value:** `C:\dev\DTS.Viewer\bin\Debug\DTS.Viewer.exe.config`
|
||||
* **Description:** Defines a constant path to a specific configuration file.
|
||||
|
||||
* **`ViewerConfigPath`**
|
||||
* **Signature:** `public const string`
|
||||
* **Value:** `C:\dev\DTS.Viewer\bin\Debug\DTS.Viewer.exe.config`
|
||||
* **Description:** Defines a constant path to the viewer's configuration file. Note that the value is currently identical to `
|
||||
56
docs/ai/Common/DTS.Common.Core/Config.md
Normal file
56
docs/ai/Common/DTS.Common.Core/Config.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/Config/DTSConfig.cs
|
||||
generated_at: "2026-04-17T16:08:08.424741+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "20e6632b3b560005"
|
||||
---
|
||||
|
||||
# Config
|
||||
|
||||
### Purpose
|
||||
Provides centralized, thread-safe access to an alternate configuration file for the application. This module exists to allow the system to read settings and configuration sections from a dynamically-specified config file path rather than the default application configuration, supporting scenarios where configuration needs to be externalized or swapped at runtime.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`DTSConfig` (static class)**
|
||||
|
||||
- `static void DTSConfigInit(string path)` — Initializes the configuration system with the specified config file path. Internally calls `SetAltConfigPath`.
|
||||
|
||||
- `static void AltConfigPathSet(string path)` — Thread-safe setter for the alternate config file path. Acquires lock on `MyLock` before assigning.
|
||||
|
||||
- `static string AltConfigPathGet()` — Thread-safe getter for the alternate config file path. Acquires lock on `MyLock` before returning.
|
||||
|
||||
- `static void SetAltConfigPath(string path)` — Sets the alternate config path and opens the mapped configuration file. If `path` is null or empty, falls back to `DTSConstants.CustomConfigPath`. Creates a new `Configuration` object via `ConfigurationManager.OpenMappedExeConfiguration`.
|
||||
|
||||
- `static Configuration GetAltConfig()` — Thread-safe getter returning the current `Configuration` object for the alternate config file.
|
||||
|
||||
- `static string GetAppSetting(string key)` — Retrieves an app setting value by key from the alternate configuration. Returns `string.Empty` if the key is not found (logs a message via `APILogger.Log` in that case).
|
||||
|
||||
- `static object GetSection(string sectionName)` — Retrieves a configuration section by name from the alternate configuration. Returns `null` if the section is not found (logs a message via `APILogger.Log` in that case).
|
||||
|
||||
### Invariants
|
||||
|
||||
- All access to static fields (`AltConfigPath`, `AltConfig`) is protected by a lock on `MyLock` for thread safety.
|
||||
- `SetAltConfigPath` must be called before `GetAppSetting` or `GetSection` can return meaningful results; otherwise, `AltConfig` may be null.
|
||||
- `GetAppSetting` always returns a non-null string (empty string if key not found).
|
||||
- `GetSection` may return null if the section does not exist.
|
||||
|
||||
### Dependencies
|
||||
|
||||
**Depends on:**
|
||||
- `DTS.Common.Utilities.Logging` (uses `APILogger.Log`)
|
||||
- `System.Configuration` (uses `Configuration`, `ConfigurationManager`, `ExeConfigurationFileMap`, `KeyValueConfigurationElement`, `ConfigurationUserLevel`)
|
||||
- `DTSConstants.CustomConfigPath` (referenced constant, defined elsewhere in the codebase)
|
||||
|
||||
**Dependents:** Unknown from source alone.
|
||||
|
||||
### Gotchas
|
||||
|
||||
- The static constructor is empty, meaning `AltConfig` is not initialized until `SetAltConfigPath` is explicitly called. Calling `GetAppSetting` or `GetSection` before initialization will result in a `NullReferenceException`.
|
||||
- `DTSConfigInit` and `SetAltConfigPath` appear to be redundant; `DTSConfigInit` simply delegates to `SetAltConfigPath` with no additional logic.
|
||||
- `AltConfigPathGet` and `AltConfigPathSet` are separate methods rather than a property, which is unconventional for C#.
|
||||
- The `GetAppSetting` method uses LINQ to cast and search settings, which is less efficient than using the `AppSettings.Settings[key]` indexer, but handles the case where the key might not exist gracefully.
|
||||
|
||||
---
|
||||
31
docs/ai/Common/DTS.Common.Core/EventManager.md
Normal file
31
docs/ai/Common/DTS.Common.Core/EventManager.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/EventManager/EventManager.cs
|
||||
generated_at: "2026-04-17T16:08:08.426285+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1537aca27bc7a4d4"
|
||||
---
|
||||
|
||||
# EventManager
|
||||
|
||||
### Purpose
|
||||
Implements a lightweight, in-process publish/subscribe event system that allows components to communicate without direct coupling. Publishers emit events by type, and subscribers register callbacks to receive specific event types, optionally with filtering predicates. The module also supports diagnostic listeners for monitoring event system activity.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`SubscriberCallbackDelegate<in T>` (delegate)**
|
||||
- `void SubscriberCallbackDelegate<in T>(T item) where T : class` — Delegate signature for event listeners.
|
||||
|
||||
**`DiagnosticCallbackDelegate` (delegate)**
|
||||
- `void DiagnosticCallbackDelegate(EventDiagnosticType eventType, Type t, object eventData, string listener)` — Delegate signature for diagnostic event listeners.
|
||||
|
||||
**`EventManager` (static class)**
|
||||
|
||||
- `static void Publish<T>(T eventData) where T : class` — Publishes an event to all subscribers of type `T`. If no subscribers exist for the type, returns immediately. For each subscriber, evaluates the `EventFilter` predicate (if present) before invoking the callback.
|
||||
|
||||
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Subscribes a callback to events of type `T` without filtering.
|
||||
|
||||
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener, Predicate<T> eventFilter) where T : class` — Subscribes a callback to events of type `T` with an optional filter predicate. If the filter returns `false` for a given event, the callback is not invoked.
|
||||
|
||||
- `static void UnSubscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Removes a subscriber callback from the subscriber
|
||||
43
docs/ai/Common/DTS.Common.Core/PluginLib.md
Normal file
43
docs/ai/Common/DTS.Common.Core/PluginLib.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/PluginLib/PluginConfigData.cs
|
||||
- Common/DTS.Common.Core/PluginLib/PluginConfig.cs
|
||||
- Common/DTS.Common.Core/PluginLib/PluginConfigSectionHandler.cs
|
||||
- Common/DTS.Common.Core/PluginLib/PluginManager.cs
|
||||
generated_at: "2026-04-17T15:36:54.153860+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9804f9dd2a12c0c7"
|
||||
---
|
||||
|
||||
# PluginLib Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `PluginLib` module provides a Managed Extensibility Framework (MEF)-based plugin system for the DTS application. It handles discovery, loading, and retrieval of plugins from configurable directories, supporting both single-plugin resolution and multiple implementations of the same contract. The module implements a thread-safe singleton pattern to manage the plugin catalog and container lifecycle.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### PluginManager (Class)
|
||||
The primary entry point for plugin operations.
|
||||
|
||||
**Properties:**
|
||||
- `AggregateCatalog PluginCatalog { get; set; }` — The MEF aggregate catalog containing all loaded plugin catalogs.
|
||||
|
||||
**Methods:**
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `public static T GetPlugin<T>() where T : class` | Retrieves a single MEF export of type `T`. Returns `null` if no export exists. |
|
||||
| `public static T GetPlugin<T>(string configPluginSetting) where T : class` | Retrieves a specific plugin from multiple exports by matching `configPluginSetting` against the plugin's `ToString()` value. |
|
||||
| `public static IEnumerable<Lazy<T>> GetPlugins<T>() where T : class` | Returns all MEF exports of type `T` as lazy-initialized references. |
|
||||
| `public static PluginManager GetPluginManager(string appPath)` | Returns the singleton instance of `PluginManager`. Initializes the manager on first call with the provided `appPath`. |
|
||||
| `public List<Assembly> GetPluginList<T>() where T : class` | Returns a list of distinct assemblies from all loaded directory catalogs. |
|
||||
|
||||
### PluginConfig (Static Class)
|
||||
Stores plugin configuration constants and helpers.
|
||||
|
||||
**Constants:**
|
||||
- `public const string DTSPlugins = "DTSPlugins"`
|
||||
13
docs/ai/Common/DTS.Common.Core/Properties.md
Normal file
13
docs/ai/Common/DTS.Common.Core/Properties.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:26:29.253325+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "237c2df86524839a"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the
|
||||
61
docs/ai/Common/DTS.Common.Core/ServiceManager.md
Normal file
61
docs/ai/Common/DTS.Common.Core/ServiceManager.md
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/ServiceManager/IServicePublishedEvent.cs
|
||||
- Common/DTS.Common.Core/ServiceManager/ServicePublishedEvent.cs
|
||||
- Common/DTS.Common.Core/ServiceManager/ServiceManager.cs
|
||||
generated_at: "2026-04-17T16:35:08.366069+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "97facc88d83d9155"
|
||||
---
|
||||
|
||||
# ServiceManager Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The ServiceManager module provides a service locator pattern implementation that enables loose coupling between components. It allows a component to publish an implementation of a singleton interface (service) that other components can retrieve without knowing the publisher. The module includes an event system (`IServicePublishedEvent`/`ServicePublishedEvent`) that notifies subscribers when services are published or unpublished, enabling reactive dependency management across the application.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `IServicePublishedEvent` (interface)
|
||||
**File:** `IServicePublishedEvent.cs`
|
||||
|
||||
Event contract fired when a service interface is published or unpublished.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ServiceType` | `Type` | Returns the type of service being published/unpublished. |
|
||||
| `IsPublished` | `bool` | Returns `true` if the service is being published, `false` if being unpublished. |
|
||||
|
||||
---
|
||||
|
||||
### `ServicePublishedEvent` (class)
|
||||
**File:** `ServicePublishedEvent.cs`
|
||||
|
||||
Concrete implementation of `IServicePublishedEvent`.
|
||||
|
||||
| Property | Type | Accessor | Description |
|
||||
|----------|------|----------|-------------|
|
||||
| `ServiceType` | `Type` | `get; internal set;` | The type of service being published/unpublished. |
|
||||
| `IsPublished` | `bool` | `get; internal set;` | `true` if publishing, `false` if unpublishing. |
|
||||
|
||||
---
|
||||
|
||||
### `ServiceManager` (static class)
|
||||
**File:** `ServiceManager.cs`
|
||||
|
||||
Static service locator that manages publication and retrieval of singleton services.
|
||||
|
||||
#### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void Publish<T>(T item) where T : class` | Publishes a service implementation for interface type `T`. Throws `ArgumentException` if `T` is already published. |
|
||||
| `void Publish(object item, IEnumerable<Type> interfaceList, bool skipPublishedInterfaces)` | Publishes a single object as the implementation for multiple interfaces. If `skipPublishedInterfaces` is `false`, throws `ArgumentException` for any already-published interface; if `true`, silently skips already-published interfaces. |
|
||||
| `bool Exists<T>() where T : class` | Returns `true` if interface type `T` has been published; otherwise `false`. |
|
||||
| `bool Exists(Type t)` | Returns `true` if the specified interface type has been published; otherwise `false`. |
|
||||
| `T Get<T>() where T : class` | Returns the published service for interface type `T`. Throws `ArgumentException` if `T` has not been published. |
|
||||
| `void Clear<T>() where T : class` | Unpublishes the service for interface type `T` if it exists. Fires an unpublish event. |
|
||||
| `void Clear(IEnumerable
|
||||
39
docs/ai/Common/DTS.Common.Core/Settings.md
Normal file
39
docs/ai/Common/DTS.Common.Core/Settings.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/Settings/SettingsChangedEventArgs.cs
|
||||
- Common/DTS.Common.Core/Settings/SettingsCollection.cs
|
||||
generated_at: "2026-04-17T15:40:38.741606+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a2f3cb745d88ce73"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Core.Settings
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides an observable dictionary implementation for managing application settings. The `SettingsCollection<TKey, TItem>` class wraps a standard `Dictionary<TKey, TItem>` and raises events when items are added, removed, modified, or when the collection is cleared. This enables consumers to react to configuration changes in real-time. The module exists to provide change-notification semantics for settings management, allowing dependent components to synchronize state when settings are mutated.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `SettingsCollection<TKey, TItem>`
|
||||
|
||||
A generic dictionary implementation that implements `IDictionary<TKey, TItem>` with change notification support.
|
||||
|
||||
#### Event
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `event EventHandler<SettingsChangedEventArgs<TKey, TItem>> CollectionItemPropertyChanged` | Fired after any mutation operation (add, remove, modify, clear) on the collection. |
|
||||
|
||||
#### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void Add(TKey key, TItem value)` | Adds a key-value pair to the collection and fires `CollectionItemPropertyChanged` with `ChangeSettingType.Add`. |
|
||||
| `void Add(KeyValuePair<TKey, TItem> item)` | Adds a key-value pair via `KeyValuePair` and fires `CollectionItemPropertyChanged` with `ChangeSettingType.Add`. |
|
||||
| `bool Remove(TKey key)` | Removes the item with the specified key. Returns `true` if removed; fires `CollectionItemPropertyChanged` with `ChangeSettingType.Remove` only on successful removal. |
|
||||
| `bool Remove(KeyValuePair<TKey, TItem> item)` | Removes by key (value is ignored). Returns `true` if removed; fires `CollectionItemPropertyChanged` with `ChangeSettingType.Remove` only on successful removal. |
|
||||
| `void Clear()` | Clears all items and fires `CollectionItemPropertyChanged` with `ChangeSetting
|
||||
379
docs/ai/Common/DTS.Common.DAS.Concepts.md
Normal file
379
docs/ai/Common/DTS.Common.DAS.Concepts.md
Normal file
@@ -0,0 +1,379 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/AvailableArmModes.cs
|
||||
- Common/DTS.Common.DAS.Concepts/ArmStatus.cs
|
||||
- Common/DTS.Common.DAS.Concepts/ITriggerable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/IDataCollectionEnabled.cs
|
||||
- Common/DTS.Common.DAS.Concepts/ILargeDataAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/ICalibratable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/IGpioEnabled.cs
|
||||
- Common/DTS.Common.DAS.Concepts/IRealtimeable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DataScaler.InvalidExcitationVoltageException.cs
|
||||
- Common/DTS.Common.DAS.Concepts/ShuntModeType.cs
|
||||
- Common/DTS.Common.DAS.Concepts/TsrEvent.cs
|
||||
- Common/DTS.Common.DAS.Concepts/IDownloadEnabled.cs
|
||||
- Common/DTS.Common.DAS.Concepts/IArmable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/LinearizationFormula.cs
|
||||
generated_at: "2026-04-17T15:29:37.643636+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9bfb99ec27f09c88"
|
||||
---
|
||||
|
||||
# DTS.Common.DAS.Concepts Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines core interfaces, enums, and classes that represent fundamental Data Acquisition System (DAS) concepts for DTS hardware. It provides the abstract contracts for device capabilities including arming, triggering, calibration, GPIO control, real-time data capture, event downloading, and sensor linearization. The module serves as the foundational abstraction layer for various TSR (Test System Recorder) and HEADS device implementations, enabling polymorphic treatment of different hardware models while maintaining type-safe contracts.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enums
|
||||
|
||||
#### `AvailableArmModes`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts` (also defined in `DTS.DAS.Concepts`)
|
||||
|
||||
| Member | Value |
|
||||
|--------|-------|
|
||||
| `LowPower` | 0 |
|
||||
| `CircularBuffer` | 1 |
|
||||
|
||||
#### `ArmStatus`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts` (also defined in `DTS.DAS.Concepts`)
|
||||
|
||||
| Member | Value |
|
||||
|--------|-------|
|
||||
| `Disarming` | 0 |
|
||||
| `Disarmed` | 1 |
|
||||
| `Arming` | 2 |
|
||||
| `Armed` | 3 |
|
||||
| `Recording` | 4 |
|
||||
|
||||
#### `GPIOPin.Directions`
|
||||
**Namespace:** `DTS.DAS.Concepts.GPIOPin`
|
||||
|
||||
| Member | Value |
|
||||
|--------|-------|
|
||||
| `Output` | 0x00 |
|
||||
| `Peripheral` | 0x01 |
|
||||
| `Input` | 0x02 |
|
||||
| `InputPulledUp` | 0x03 |
|
||||
| `InputPulledDown` | 0x04 |
|
||||
|
||||
#### `Test.Module.Channel.Sensor.ShuntModeType`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts`
|
||||
|
||||
| Member | Description |
|
||||
|--------|-------------|
|
||||
| `Internal` | "Internal" |
|
||||
| `External` | "External" |
|
||||
| `Emulation` | "Emulation" |
|
||||
| `None` | "None" |
|
||||
|
||||
---
|
||||
|
||||
### Interfaces
|
||||
|
||||
#### `ITriggerable`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface ITriggerable
|
||||
{
|
||||
void Trigger();
|
||||
}
|
||||
```
|
||||
Defines a contract for objects that can be triggered.
|
||||
|
||||
---
|
||||
|
||||
#### `IArmable`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface IArmable
|
||||
{
|
||||
void Arm();
|
||||
void Disarm();
|
||||
ArmStatus ArmStatus { get; }
|
||||
AvailableArmModes ArmMode { get; }
|
||||
}
|
||||
```
|
||||
Defines the contract for objects that can be armed and disarmed.
|
||||
|
||||
---
|
||||
|
||||
#### `IDownloadEnabled`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface IDownloadEnabled
|
||||
{
|
||||
TsrEvent[] EventList { get; }
|
||||
double[][] GetEventData(TsrEvent Event, UInt64 FirstSample, UInt64 LastSample);
|
||||
bool DataHasBeenDownloaded { get; }
|
||||
}
|
||||
```
|
||||
Defines the contract for objects that support downloading event data.
|
||||
|
||||
---
|
||||
|
||||
#### `IDataCollectionEnabled`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface IDataCollectionEnabled : IArmable, ITriggerable, IDownloadEnabled
|
||||
{
|
||||
double[] AvailableSampleRates { get; }
|
||||
double SampleRate { get; set; }
|
||||
}
|
||||
```
|
||||
Aggregates `IArmable`, `ITriggerable`, and `IDownloadEnabled` with sample rate properties for rudimentary data collection.
|
||||
|
||||
---
|
||||
|
||||
#### `ICalibratable`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface ICalibratable
|
||||
{
|
||||
string SerialNumber { get; set; }
|
||||
double Sensitivity { get; set; }
|
||||
double BatteryVolts { get; set; }
|
||||
double VddVolts { get; set; }
|
||||
double SignalConditioningVolts { get; set; }
|
||||
}
|
||||
```
|
||||
Defines properties required for rudimentary calibration.
|
||||
|
||||
---
|
||||
|
||||
#### `IGpioEnabled`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface IGpioEnabled
|
||||
{
|
||||
void SetGpio(uint Port, uint Pin, GPIOPin.Directions Direction, bool State);
|
||||
bool GetGpio(uint Port, uint Pin);
|
||||
}
|
||||
```
|
||||
Defines GPIO control functionality.
|
||||
|
||||
---
|
||||
|
||||
#### `IRealtimeable`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface IRealtimeable
|
||||
{
|
||||
void StartRealtime(double sampleRate);
|
||||
void StopRealtime();
|
||||
RealtimeSample[] GetRealtimeSamples();
|
||||
}
|
||||
```
|
||||
Defines real-time data capture capability.
|
||||
|
||||
---
|
||||
|
||||
#### `ILargeDataAware`
|
||||
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
|
||||
|
||||
```csharp
|
||||
public interface ILargeDataAware
|
||||
{
|
||||
bool IsDataArraySized { get; }
|
||||
}
|
||||
```
|
||||
Indicates whether a data set is small enough to safely fit into an array for slice applications.
|
||||
|
||||
---
|
||||
|
||||
### Classes
|
||||
|
||||
#### `RealtimeSample`
|
||||
**Namespace:** `DTS.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public class RealtimeSample
|
||||
{
|
||||
public double[] DataEU; // Indexes by channel
|
||||
public UInt64 SampleNumber;
|
||||
}
|
||||
```
|
||||
Represents a real-time data sample with engineering unit data per channel.
|
||||
|
||||
---
|
||||
|
||||
#### `TsrEvent`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts` and `DTS.DAS.Concepts` (defined in both)
|
||||
|
||||
```csharp
|
||||
public abstract class TsrEvent : Exceptional, ICloneable
|
||||
{
|
||||
public virtual UInt64 EventId { get; protected set; }
|
||||
public virtual DateTime TimeStamp { get; protected set; }
|
||||
public virtual string SerialNumber { get; protected set; }
|
||||
public virtual string AlternateSerialNumber { get; protected set; }
|
||||
public virtual double DurationSeconds { get; protected set; }
|
||||
public virtual double MaxSampleRate { get; protected set; }
|
||||
public virtual float TemperatureC { get; protected set; }
|
||||
public virtual double PreTriggerSeconds { get; protected set; }
|
||||
public abstract object Clone();
|
||||
}
|
||||
```
|
||||
Abstract base class representing TSR event data and metadata. Inherits from `Exceptional` (defined externally) and implements `ICloneable`.
|
||||
|
||||
---
|
||||
|
||||
#### `DataScaler.InvalidExcitationVoltageException`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public partial class DataScaler
|
||||
{
|
||||
public class InvalidExcitationVoltageException : Exception
|
||||
{
|
||||
public InvalidExcitationVoltageException();
|
||||
public InvalidExcitationVoltageException(string msg);
|
||||
public InvalidExcitationVoltageException(string msg, Exception innerEx);
|
||||
protected InvalidExcitationVoltageException(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context);
|
||||
}
|
||||
}
|
||||
```
|
||||
Exception class for invalid excitation voltage conditions. Part of a partial `DataScaler` class.
|
||||
|
||||
---
|
||||
|
||||
#### `LinearizationFormula`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public class LinearizationFormula
|
||||
{
|
||||
// Properties
|
||||
public NonLinearSLICEWareStyles NonLinearSliceWareStyle { get; set; }
|
||||
public NonLinearStyles NonLinearStyle { get; set; }
|
||||
public double PolynomialSensitivity { get; set; }
|
||||
public double LinearizationExponent { get; set; }
|
||||
public double MMPerV { get; set; }
|
||||
public double MVAt0MM { get; set; }
|
||||
public double Slope { get; set; }
|
||||
public double Intercept { get; set; }
|
||||
public double CalibrationFactor { get; set; }
|
||||
public double ZeroPositionIntercept { get; set; }
|
||||
public bool UsemVOverVForPolys { get; set; }
|
||||
public double[] PolynomialCoefficients { get; set; }
|
||||
public double[] PolynomialExponents { get; set; }
|
||||
|
||||
// Methods
|
||||
public bool IsValid();
|
||||
public void MarkValid(bool bValid);
|
||||
public double GetCoefficient(double exponent);
|
||||
public void SetCoefficient(double exponent, double coefficient);
|
||||
public double GetLinearizedValue(double input, double excitation);
|
||||
public string ToSLICEWareSerializeString();
|
||||
public string ToSerializeString();
|
||||
public void FromSerializeString(string s);
|
||||
public void FromSerializeString(string s, CultureInfo culture);
|
||||
public void FromTDCSerializeString();
|
||||
public string ToDisplayString();
|
||||
public string ToDisplayString(string nonlinearFormat);
|
||||
|
||||
// Serialization helpers (partial list)
|
||||
public string ToIRTraccDiagnosticZeroString();
|
||||
public string ToIRTraccCalFactorString();
|
||||
public string ToIRTraccManualString();
|
||||
public string ToIRTraccZeroMMmVString();
|
||||
public string ToIRTraccAverageOverTimeString();
|
||||
public string ToPolynomialString();
|
||||
public string ToSLICEWarePolynomialString();
|
||||
public void FromIRTraccCalFactorString(string s, CultureInfo culture);
|
||||
public void FromIRTraccDiagnosticZeroString(string s, CultureInfo culture);
|
||||
public void FromIRTraccManualString(string s, CultureInfo culture);
|
||||
public void FromIRTraccZeroMMmVString(string s, CultureInfo culture);
|
||||
public void FromIRTraccAverageOverTimeString(string s, CultureInfo culture);
|
||||
public void FromPolynomialString(string s, CultureInfo culture);
|
||||
}
|
||||
```
|
||||
Handles sensor linearization with support for multiple `NonLinearStyles` including Polynomial, IRTracc variants, and calibration factors. Supports serialization to/from SLICEWare and internal formats.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **EventId is 1-based**: The `TsrEvent.EventId` property documentation explicitly states it is a 1-based identifier.
|
||||
|
||||
2. **Protected setters on TsrEvent**: All properties on `TsrEvent` have `protected set` accessors, meaning derived classes can modify them but external code cannot.
|
||||
|
||||
3. **LinearizationFormula default style**: `NonLinearStyle` defaults to `NonLinearStyles.Polynomial` to avoid locking a specific zero-method (per comment referencing FB 10323).
|
||||
|
||||
4. **LinearizationFormula input handling**: When `NonLinearStyle` is not `Polynomial` and input is ≤ 0, the input is treated as 0.001 to handle noise/negative readings for IR-Tracc sensors.
|
||||
|
||||
5. **LinearizationFormula coefficient/exponent lists**: Initialized with 4 elements (indices 0-3) by default, with exponents pre-set to [0, 1, 2, 3].
|
||||
|
||||
6. **Shallow clone requirement**: `TsrEvent.Clone()` is documented to return a shallow copy.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (Inferred from imports)
|
||||
|
||||
| Dependency | Used By |
|
||||
|------------|---------|
|
||||
| `System` | `IRealtimeable`, `TsrEvent`, `IDownloadEnabled`, `LinearizationFormula`, `DataScaler.InvalidExcitationVoltageException` |
|
||||
| `System.Collections.Generic` | `LinearizationFormula` |
|
||||
| `System.ComponentModel` | `ShuntModeType` (for `[Description]` attribute) |
|
||||
| `System.Text` | `LinearizationFormula` |
|
||||
| `System.Globalization` | `LinearizationFormula` (via inline usage) |
|
||||
| `System.Runtime.Serialization` | `DataScaler.InvalidExcitationVoltageException` |
|
||||
| `DTS.Common.Utilities` | `TsrEvent` (inherits from `Exceptional`) |
|
||||
| `DTS.Utilities` | `IDownloadEnabled` (inherits from `Exceptional`) |
|
||||
| `DTS.Common.Enums.Sensors` | `LinearizationFormula` (for `NonLinearStyles` and `NonLinearSLICEWareStyles` enums) |
|
||||
|
||||
### Consumers
|
||||
|
||||
Unknown from source alone. This module defines foundational interfaces and types that would be implemented by concrete device classes and consumed by higher-level application code.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
### Duplicate Definitions
|
||||
- **`AvailableArmModes` enum** is defined in both `DTS.Common.DAS.Concepts` (file: `AvailableArmModes.cs`) and `DTS.DAS.Concepts` (file: `IArmable.cs`).
|
||||
- **`ArmStatus` enum** is defined in both `DTS.Common.DAS.Concepts` (file: `ArmStatus.cs`) and `DTS.DAS.Concepts` (file: `IArmable.cs`).
|
||||
- **`TsrEvent` class** is defined in both `DTS.Common.DAS.Concepts` (file: `TsrEvent.cs`) and `DTS.DAS.Concepts` (file: `IDownloadEnabled.cs`).
|
||||
|
||||
These duplicates may cause ambiguity or require extern alias configuration if both namespaces are imported.
|
||||
|
||||
### Namespace Inconsistency
|
||||
The module uses multiple root namespaces:
|
||||
- `DTS.Common.DAS.Concepts`
|
||||
- `DTS.DAS.Concepts`
|
||||
- `DTS.DAS.Concepts.DAS.Channel`
|
||||
- `DTS.DAS.Concepts.GPIOPin`
|
||||
|
||||
This suggests an incomplete refactoring or historical naming drift.
|
||||
|
||||
### Incomplete GPIO Implementation Note
|
||||
`IGpioEnabled` contains a TODO comment: *"Well have to bring these in as soon as we figure out where to get that enum from."* The `GPIOPin.Directions` enum is defined in a separate namespace (`DTS.DAS.Concepts.GPIOPin`), which may or may not resolve this.
|
||||
|
||||
### Commented-Out Interface Members
|
||||
`IDownloadEnabled` contains commented-out properties (`MaximumStoredEventSizeSeconds`, `DownloadIncrementSamples`, `ChannelDescription`, `TimeOffsetMilliseconds`) with a TODO questioning their universal applicability.
|
||||
|
||||
### Historical Email Comments
|
||||
`IArmable.cs` contains extensive historical email discussions about device types (NASCAR, TSRPRO, BlastTestTSR, TSRBasic, HEADSII, NGI) and multi-sample-rate handling. This is technical debt that should be removed from production code.
|
||||
|
||||
### LinearizationFormula Serialization Format Changes
|
||||
The polynomial serialization format differs between `ToSLICEWarePolynomialString()` (reverse order) and `ToPolynomialString()` (standard order). Additionally, `IRTraccCalFactor` is explicitly not supported in SLICEWare serialization.
|
||||
|
||||
### Partial Class Dependencies
|
||||
- `DataScaler.InvalidExcitationVoltageException` is a nested class within a partial `DataScaler` class. The main `DataScaler` implementation is not present in these files.
|
||||
- `ShuntModeType` is nested within `Test.Module.Channel.Sensor`, which are all partial class containers. The main implementations are elsewhere.
|
||||
80
docs/ai/Common/DTS.Common.DAS.Concepts/DAS.md
Normal file
80
docs/ai/Common/DTS.Common.DAS.Concepts/DAS.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IIsoCodeAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.ISerialNumberAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IEngineeringUnitAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DecimationMethod.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IInversionAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DTS.DAS.Concepts.IVoltageInsertAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.ILevelTriggerable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.Data.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.DAS.Concepts.IShuntAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Channel.IDecimatable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/DAS.Id.cs
|
||||
generated_at: "2026-04-17T15:30:10.771807+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "699480c930d40828"
|
||||
---
|
||||
|
||||
# Documentation: DTS.DAS.Concepts.DAS
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the core abstract representations and interfaces for Data Acquisition System (DAS) channels within the DTS framework. It defines the conceptual building blocks for channel metadata awareness (serial numbers, ISO codes, engineering units, inversion state), calibration concepts (shunt and cal signal awareness, voltage insertion), data handling (decimation, channel data storage), and channel identification. The module serves as a contract layer that concrete DAS implementations must satisfy, enabling polymorphic treatment of different data acquisition hardware.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Classes
|
||||
|
||||
#### `Channel<DataType>` (abstract)
|
||||
**Namespace:** `DTS.DAS.Concepts.DAS`
|
||||
**File:** `DAS.Channel.cs`
|
||||
**Base:** `DTS.Utilities.Exceptional`
|
||||
|
||||
An abstract generic representation of a DAS channel. The generic type parameter `DataType` specifies the data type contained by channels of this DAS.
|
||||
|
||||
```csharp
|
||||
public abstract class Channel<DataType> : Exceptional
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `Data<DatumType>` (abstract)
|
||||
**Namespace:** `DTS.DAS.Concepts.DAS.Channel`
|
||||
**File:** `DAS.Channel.Data.cs`
|
||||
**Base:** `DTS.Utilities.ExceptionalList<DatumType>`
|
||||
|
||||
Abstract representation of a list of channel data.
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
protected Data()
|
||||
protected Data(int capacity)
|
||||
protected Data(IEnumerable<DatumType> collection)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### `Id` (sealed)
|
||||
**Namespace:** `DTS.Common.DAS.Concepts.DAS`
|
||||
**File:** `DAS.Id.cs`
|
||||
**Base:** `DTS.Common.Utilities.Exceptional`
|
||||
**Implements:** `IComparable<Id>`, `IEquatable<Id>`
|
||||
|
||||
A string-based identifier type with case-insensitive comparison semantics.
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public Id(string value)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
// No public properties; value is accessed via ToString() or implicit conversion
|
||||
```
|
||||
|
||||
**Operators
|
||||
39
docs/ai/Common/DTS.Common.DAS.Concepts/DAS/Channel.md
Normal file
39
docs/ai/Common/DTS.Common.DAS.Concepts/DAS/Channel.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/Channel/LevelTriggerTypes.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/Channel/Channel.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/Channel/TimestampPartTypes.cs
|
||||
- Common/DTS.Common.DAS.Concepts/DAS/Channel/Data.cs
|
||||
generated_at: "2026-04-17T16:02:26.602478+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f01712407c9d73cd"
|
||||
---
|
||||
|
||||
# Channel
|
||||
|
||||
### Purpose
|
||||
This module provides core abstractions and type definitions for Data Acquisition System (DAS) channels. It defines the fundamental building blocks for representing channel data, trigger conditions, and timestamp parsing within the DTS DAS architecture. The module serves as a conceptual foundation layer that other DAS components build upon.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`LevelTriggerTypes`** (enum, Flags)
|
||||
- A bitwise flag enumeration defining trigger condition types for level-based triggering.
|
||||
- Values:
|
||||
- `NONE = 0x00` - No trigger condition
|
||||
- `OutsideWindow = 0x01` - Trigger when outside a defined window
|
||||
- `InsideWindow = 0x02` - Trigger when inside a defined window
|
||||
- `LessThan = 0x04` - Trigger when value is less than threshold
|
||||
- `GreaterThan = 0x08` - Trigger when value is greater than threshold
|
||||
|
||||
**`TimestampPartTypes`** (enum, Flags)
|
||||
- A bitwise flag enumeration identifying components of a timestamp, with `TypeConverter` support for UI binding.
|
||||
- Values:
|
||||
- `Marker = 1 << 0` - Marker bit
|
||||
- `Seconds_High = 1 << 1` - High bits of seconds field
|
||||
- `Seconds_Low = 1 << 2` - Low bits of seconds field
|
||||
- `Nanoseconds_High = 1 << 3` - High bits of nanoseconds field
|
||||
- `Nanoseconds_Low = 1 << 4` - Low bits of nanoseconds field
|
||||
- `Reserved = 1 << 5` - Reserved bits
|
||||
|
||||
**`Channel<TDataType>`
|
||||
56
docs/ai/Common/DTS.Common.DAS.Concepts/Interfaces.md
Normal file
56
docs/ai/Common/DTS.Common.DAS.Concepts/Interfaces.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/ITriggerable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/IDataCollectionEnabled.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/ICalibratable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/ILargeDataAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/IRealtimeable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/IGpioEnabled.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/IDownloadEnabled.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/IArmable.cs
|
||||
generated_at: "2026-04-17T15:32:37.442181+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1681496bcdfa352d"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.DAS.Concepts Interfaces
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines a set of interfaces that describe the core capabilities of Data Acquisition System (DAS) hardware devices. These interfaces model behaviors such as arming, triggering, calibration, data collection, real-time sampling, GPIO control, and data download. The design enables polymorphic treatment of different hardware models (TSR, HEADS, NASCAR variants) while allowing type-specific implementations where necessary. The interfaces are intended to be composed together to describe complete device capabilities.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interfaces
|
||||
|
||||
#### `ITriggerable`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface ITriggerable
|
||||
{
|
||||
void Trigger();
|
||||
}
|
||||
```
|
||||
A minimal interface describing an object that can be triggered. The `Trigger()` method initiates the trigger action on the implementing object.
|
||||
|
||||
---
|
||||
|
||||
#### `IArmable`
|
||||
**Namespace:** `DTS.Common.DAS.Concepts`
|
||||
|
||||
```csharp
|
||||
public interface IArmable
|
||||
{
|
||||
void Arm();
|
||||
void Disarm();
|
||||
ArmStatus ArmStatus { get; }
|
||||
AvailableArmModes ArmMode { get; }
|
||||
}
|
||||
```
|
||||
Describes an object that can be armed and disarmed. Implementers must provide:
|
||||
- `Arm()` — transitions the device to an armed state
|
||||
- `Disarm()` — transitions the device to a
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/ITimestampAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/ILinearized.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/IIsoCodeAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/ISerialNumberAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/IInversionAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/IEngineeringUnitAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/ICalSignalAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/IVoltageInsertAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/IShuntAware.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/ILevelTriggerable.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Interfaces/DAS/Channel/IDecimatable.cs
|
||||
generated_at: "2026-04-17T16:22:35.617754+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fda666571e5cc4ab"
|
||||
---
|
||||
|
||||
# Channel
|
||||
|
||||
1. **Purpose**
|
||||
This module defines a set of fine-grained interfaces (mixins) used to compose data acquisition system (DAS) channel behaviors. It allows channels to opt into specific capabilities—such as linearization, triggering, decimation, and calibration checks—without enforcing a rigid monolithic class hierarchy. These interfaces define the "awareness" of a channel regarding specific hardware or configuration concepts.
|
||||
|
||||
2. **Public Interface**
|
||||
* `ITimestampAware`: Defines timestamp configuration.
|
||||
* `TimestampPartTypes TimestampPartType { get; set; }`
|
||||
* `ILinearized`: Defines linearization capabilities.
|
||||
* `DTS.Common.Classes.Sensors.LinearizationFormula LinearizationFormula { get; set; }`
|
||||
* `IIsoCodeAware`: Defines ISO code association.
|
||||
* `string IsoCode { get; set; }`
|
||||
* `ISerialNumberAware`: Defines serial number association.
|
||||
* `string SerialNumber { get; set; }`
|
||||
* `IInversionAware`: Defines signal inversion state.
|
||||
* `bool IsInverted { get; set; }`
|
||||
* `IEngineeringUnitAware`: Defines engineering unit description.
|
||||
* `string EngineeringUnits { get; set; }`
|
||||
* `ICalSignalAware`: Defines calibration signal measurements.
|
||||
* `double MeasuredCalSignalMv { get; set; }`
|
||||
* `double TargetCalSignalM
|
||||
38
docs/ai/Common/DTS.Common.DAS.Concepts/Properties.md
Normal file
38
docs/ai/Common/DTS.Common.DAS.Concepts/Properties.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:26:29.249568+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cac7441424bad40e"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `DTS.DAS.Concepts` assembly. It is a build-time configuration file that defines version information, copyright, and COM visibility settings for the assembly. It does not contain executable logic or types.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this module. The file contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: Set to `"DTS.DAS.Concepts"`
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: `"DTS"`
|
||||
- `AssemblyProduct`: `"DTS.DAS.Concepts"`
|
||||
- `AssemblyCopyright`: `"Copyright © DTS 2008"`
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: `"9b6f7402-27d3-4cc9-9ff3-3cfe16e0b429"`
|
||||
- `AssemblyVersion`: `"1.06.0081"`
|
||||
- `AssemblyFileVersion`: `"1.06.0081"`
|
||||
|
||||
### Invariants
|
||||
- COM visibility is explicitly set to `false`, meaning types in this assembly are not visible to COM components by default.
|
||||
- The assembly version and file version are synchronized at `"1.06.0081"`.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Reflection`, `System.Runtime.InteropServices` (standard .NET Framework assemblies).
|
||||
- **Depended on by**: Cannot be determined from this file alone.
|
||||
|
||||
### Gotchas
|
||||
- The `AssemblyTitle` attribute value (`"DTS.DAS.Concepts"`) differs from the module path name (`DTS.Common.DAS.Concepts`). This discrepancy may cause confusion when referencing the assembly.
|
||||
|
||||
---
|
||||
124
docs/ai/Common/DTS.Common.DAS.Concepts/Test.md
Normal file
124
docs/ai/Common/DTS.Common.DAS.Concepts/Test.md
Normal file
@@ -0,0 +1,124 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.Bridge.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.SensorUnits.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.ZeroMethod.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.RecordingMode.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Test.Module.Channel.Sensor.ExcitationVoltage.cs
|
||||
generated_at: "2026-04-17T15:32:50.545450+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b632931e43678d7e"
|
||||
---
|
||||
|
||||
# Documentation: DTS.DAS.Concepts Test Module Hierarchy
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a hierarchical container structure for Data Acquisition System (DAS) concepts related to test configuration. It defines enumerations and utility methods for sensor configuration (bridge types, coupling modes, excitation voltages, sensitivity units, zero methods) and module recording modes. The structure follows a nested partial class pattern where `Test.Module.Channel.Sensor` serves as the primary namespace for sensor-related concepts, while `Test.Module` contains module-level configuration. All container classes are designed as static containers with private constructors and are not intended for instantiation.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Test.Module (sealed partial class)
|
||||
Container for DTS generic module concepts. Not instantiable.
|
||||
|
||||
#### Methods
|
||||
- **`public static RecordingMode GetRecordingModeFromString(string recordingMode)`**
|
||||
- Converts a string representation of a recording mode enumeration into its corresponding `RecordingMode` enum value.
|
||||
- Throws `Exception` if the string cannot be parsed.
|
||||
|
||||
#### Enums
|
||||
- **`RecordingMode`** - All available recording mode options.
|
||||
- `InvalidArmMode = 0` - Invalid mode, cannot be used
|
||||
- `CircularBuffer = 1` - Circular buffer mode (constant recording, trigger)
|
||||
- `RecorderMode = 2` - Recorder mode (start, trigger)
|
||||
- `AutoCircularBufferMode = 4` - Constant recording, trigger, rearm after data collected
|
||||
- `AutoRecorderMode = 5` - Recorder mode (start, trigger) rearm after data collected
|
||||
- `ImmediateMode = 0x06` - Purpose unclear from source
|
||||
- `HighPowerRecorderMode = 0x07` - Purpose unclear from source
|
||||
- `LowPowerRecorderMode = 0x08` - Purpose unclear from source
|
||||
- `ContinuousRecorderMode = 0x09` - Purpose unclear from source
|
||||
- `HybridRecorderMode = 0x0A` - Purpose unclear from source
|
||||
- `MultiHybridRecorderMode = 0x0B` - Purpose unclear from source
|
||||
|
||||
---
|
||||
|
||||
### Test.Module.Channel (sealed partial class)
|
||||
Container for DTS generic channel concepts. Not instantiable.
|
||||
|
||||
---
|
||||
|
||||
### Test.Module.Channel.Sensor (sealed partial class)
|
||||
Container for DTS generic sensor concepts. Not instantiable.
|
||||
|
||||
#### Enums
|
||||
- **`CouplingModes`** - IEPE Coupling modes
|
||||
- `AC` - Description: "AC"
|
||||
- `DC` - Description: "AC/DC"
|
||||
|
||||
- **`BridgeType`** - All available bridge types (bit-shifted values)
|
||||
- `IEPE = 1 << 0` - Sensor uses IEPE setup
|
||||
- `QuarterBridge = 1 << 1` - Sensor uses quarter bridge setup
|
||||
- `HalfBridge = 1 << 2` - Sensor uses half bridge setup
|
||||
- `FullBridge = 1 << 3` - Sensor has full bridge setup
|
||||
- `DigitalInput = 1 << 4`
|
||||
- `SQUIB = 1 << 5`
|
||||
- `TOMDigital = 1 << 6`
|
||||
|
||||
- **`SensUnits`** - All available Sensitivity Unit types
|
||||
- `NONE = 0` - No Sensitivity Units (Polynomial Sensor)
|
||||
- `mV = 1` - Sensitivity expressed in mV with output at Capacity EU
|
||||
- `mVperV = 2` - Excitation proportional sensitivity expressed in mV/V with output at Capacity EU
|
||||
- `mVperVperEU = 3` - Excitation proportional sensitivity expressed in mV/V/EU
|
||||
- `mVperEU = 4` - Sensitivity expressed in mV/EU
|
||||
|
||||
- **`ZeroMethodType`** - All available zero method types
|
||||
- `AverageOverTime = 0` - Calculate electrical zero using an average over time
|
||||
- `UsePreEventDiagnosticsZero = 1` - Calculate zero using time in pre-event
|
||||
- `None = 2` - Calculate zero using injected value
|
||||
|
||||
- **`OriginalZeroMethodType`** - Original version of zero method types (for legacy compatibility)
|
||||
- `AverageOverTime` - Calculate electrical zero using an average over time
|
||||
- `UsePreCalZero` - Calculate zero using time in pre-event
|
||||
- `None` - Calculate zero using injected value
|
||||
|
||||
- **`ExcitationVoltageOption`** - All available excitation voltages
|
||||
- `Undefined = 1` - Undefined excitation voltage (0.0V)
|
||||
- `Volt2 = 2` - 2.0V
|
||||
- `Volt2_5 = 4` - 2.5V
|
||||
- `Volt3 = 8` - 3.0V
|
||||
- `Volt5 = 16` - 5.0V
|
||||
- `Volt10 = 32` - 10.0V
|
||||
- `Volt1 = 64` - 1.0V
|
||||
|
||||
#### Methods
|
||||
- **`public static double GetExcitationVoltageMagnitudeFromEnum(ExcitationVoltageOption target)`**
|
||||
- Converts an `ExcitationVoltageOption` enum value to its associated numeric voltage magnitude.
|
||||
- Throws `Exception` on failure.
|
||||
|
||||
- **`public static ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(double magnitude)`**
|
||||
- Converts a voltage magnitude (double) to the corresponding `ExcitationVoltageOption` enum value.
|
||||
- Throws `NotSupportedException` if the magnitude doesn't match a known option.
|
||||
|
||||
#### Nested Classes
|
||||
- **`VoltageMagnitudeAttribute`** (extends `System.Attribute`)
|
||||
- Attribute for specifying the numerical magnitude of an enum field's representation.
|
||||
- Constructor: `VoltageMagnitudeAttribute(double value)`
|
||||
- Property: `Value` (double) - Returns the voltage magnitude.
|
||||
|
||||
- **`VoltageMagnitudeAttributeCoder`** (extends `AttributeCoder<ExcitationVoltageOption, VoltageMagnitudeAttribute, double>`)
|
||||
- Utility class for manipulating voltage option enumeration-attached magnitude values.
|
||||
- Constructor: `VoltageMagnitudeAttributeCoder()`
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Container Non-Instantiability**: `Module`, `Channel`, and `Sensor` classes all have private constructors and are not intended for instantiation. They serve solely as static containers for nested types.
|
||||
|
||||
2
|
||||
218
docs/ai/Common/DTS.Common.DAS.Concepts/Test/Module.md
Normal file
218
docs/ai/Common/DTS.Common.DAS.Concepts/Test/Module.md
Normal file
@@ -0,0 +1,218 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Module/RecordingMode.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Module/TiltAxes.cs
|
||||
generated_at: "2026-04-17T15:41:18.940422+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "db7767b693a54948"
|
||||
---
|
||||
|
||||
# Documentation: Test.Module (TiltAxes & RecordingMode)
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides utilities for managing tilt sensor configuration and recording mode conversions within the DTS DAS (Data Acquisition System) Concepts framework. It handles the translation of raw ADC tilt sensor data into engineering units (degrees), manages axis orientation configurations (including axis inversion and ordering), and provides string-to-enum conversion for recording modes. The module is part of a larger `Test` partial class hierarchy and serves as a bridge between hardware-level sensor readings and application-level tilt calculations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### RecordingMode.cs
|
||||
|
||||
#### `Test.Module.GetRecordingModeFromString`
|
||||
```csharp
|
||||
public static DFConstantsAndEnums.RecordingMode GetRecordingModeFromString(string recordingMode)
|
||||
```
|
||||
Converts a string representation of a recording mode enumeration into its corresponding `DFConstantsAndEnums.RecordingMode` enum value. Throws an `Exception` with a descriptive message if parsing fails (including handling for null input).
|
||||
|
||||
---
|
||||
|
||||
### TiltAxes.cs
|
||||
|
||||
#### Nested Classes
|
||||
|
||||
##### `TiltAxis`
|
||||
A data container class with the following properties:
|
||||
| Property | Type | Default |
|
||||
|----------|------|---------|
|
||||
| `AxisNumber` | `int` | - |
|
||||
| `CurrentTilt` | `double` | - |
|
||||
| `Label` | `string` | - |
|
||||
| `Inversion` | `int` | `1` |
|
||||
| `IsIgnored` | `bool` | `false` |
|
||||
| `MountedOffset` | `double` | `0.0` |
|
||||
| `TargetOffset` | `double` | `0.0` |
|
||||
|
||||
##### `TiltAxesHelper`
|
||||
A helper class for managing tilt axis configurations.
|
||||
|
||||
**Constructors:**
|
||||
```csharp
|
||||
public TiltAxesHelper() // Default constructor, initializes 3 axes
|
||||
public TiltAxesHelper(string TiltAxes, double MountOffsetAxisOne, double MountOffsetAxisTwo,
|
||||
double TargetAxisOne, double TargetAxisTwo, double LevelTolerance,
|
||||
int AxisIgnored, bool UseForTiltCalculation)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
- `Dictionary<int, TiltAxis> AxisConfigurations` - Dictionary of axis configurations
|
||||
- `TiltAxis AxisOne` / `TiltAxis AxisTwo` - References to the two active axes
|
||||
- `double LevelTolerance` - Default: `0.5`
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public string AxesToString() // Returns string representation of axes with polarity
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Enumerations
|
||||
|
||||
##### `TiltAxesSimple`
|
||||
```csharp
|
||||
public enum TiltAxesSimple { XYZ = 0, XZY = 1, YXZ = 2, YZX = 3, ZXY = 4, ZYX = 5 }
|
||||
```
|
||||
|
||||
##### `TiltAxesPolarity`
|
||||
```csharp
|
||||
public enum TiltAxesPolarity { PPP = 0, PPN = 1, PNP = 2, PNN = 3, NPP = 4, NPN = 5, NNP = 6, NNN = 7 }
|
||||
```
|
||||
|
||||
##### `TiltSensorCalAttributes`
|
||||
Enumeration with 18 calibration attributes for tilt sensors (indices 0-17), including gains, zeros, and dominant axis calibration values.
|
||||
|
||||
##### `AxisLabel`
|
||||
```csharp
|
||||
public enum AxisLabel { X = 0, Y = 1, Z = 2 }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Static Methods
|
||||
|
||||
##### `SimplifyTiltAxes`
|
||||
```csharp
|
||||
public static TiltAxesSimple SimplifyTiltAxes(TiltAxes axes)
|
||||
```
|
||||
Removes 'I' (inversion) markers from a `TiltAxes` enum value and returns the simplified `TiltAxesSimple` equivalent.
|
||||
|
||||
##### `GetTiltAxesFromString`
|
||||
```csharp
|
||||
public static TiltAxes GetTiltAxesFromString(string tiltAxes)
|
||||
```
|
||||
Converts a string representation to a `TiltAxes` enum value. Throws an `Exception` on parse failure.
|
||||
|
||||
##### `GetPolaritiesFromTiltAxes`
|
||||
```csharp
|
||||
public static int[] GetPolaritiesFromTiltAxes(TiltAxes ta)
|
||||
```
|
||||
Returns an `int[3]` where each element is `-1` (inverted) or `1` (not inverted) based on the 'I' markers in the enum name.
|
||||
|
||||
##### `GetBoolPolaritiesFromTiltAxes`
|
||||
```csharp
|
||||
public static bool[] GetBoolPolaritiesFromTiltAxes(TiltAxes tiltAxes)
|
||||
```
|
||||
Returns a `bool[3]` where `true` indicates an inverted axis.
|
||||
|
||||
##### `GetTiltDegreesEU`
|
||||
```csharp
|
||||
public static double[] GetTiltDegreesEU(short[] tiltSensorADC, double[] tiltSensorCals)
|
||||
public static double[] GetTiltDegreesEU(short[] tiltSensorADC, double[] tiltSensorCals,
|
||||
TiltAxes axes, int ignoredAxis, float[] mountOffsetAxis)
|
||||
```
|
||||
Converts raw ADC values to tilt degrees in engineering units. Returns `double[3]` with X, Y, Z tilt values. Ignored axis values are set to `double.NaN`. Uses 3 decimal places of precision (`SIGNIFICANT_DIGITS = 1000`).
|
||||
|
||||
##### `GetTiltZeroData`
|
||||
```csharp
|
||||
public static double[] GetTiltZeroData(short[] tiltSensorADC, double[] tiltSensorCals, int dominantAxis)
|
||||
```
|
||||
Retrieves zero calibration data based on the dominant axis and its polarity.
|
||||
|
||||
##### `GetDominantTiltAxis`
|
||||
```csharp
|
||||
public static int GetDominantTiltAxis(short[] tiltSensorADC)
|
||||
```
|
||||
Returns the index of the axis with the largest absolute ADC value.
|
||||
|
||||
##### `GetTiltGains`
|
||||
```csharp
|
||||
public static double[] GetTiltGains(double[] tiltSensorCals)
|
||||
```
|
||||
Returns gain values for all three axes. Defaults to `1.0` if gain is `0`.
|
||||
|
||||
##### `GetAxisLabelFromTiltAxes`
|
||||
```csharp
|
||||
public static AxisLabel[] GetAxisLabelFromTiltAxes(TiltAxes tiltAxes)
|
||||
public static AxisLabel[] GetAxisLabelFromTiltAxes(string tiltAxes)
|
||||
```
|
||||
Extracts axis labels from a `TiltAxes` configuration.
|
||||
|
||||
##### `ConvertBoolToInvertString`
|
||||
```csharp
|
||||
public static string ConvertBoolToInvertString(bool isInverted)
|
||||
```
|
||||
Returns `"I"` if inverted, empty string otherwise.
|
||||
|
||||
##### `GetOrientationLabelFromAxisInfo`
|
||||
```csharp
|
||||
public static string GetOrientationLabelFromAxisInfo(string[] axisLabels, bool[] invertAxis)
|
||||
```
|
||||
Builds an orientation label string from axis labels and inversion flags.
|
||||
|
||||
##### `GetTiltAxesFromAxisInfo`
|
||||
```csharp
|
||||
public static TiltAxes GetTiltAxesFromAxisInfo(string[] axisLabels, bool[] invertAxis)
|
||||
```
|
||||
Constructs a `TiltAxes` enum from axis labels and inversion flags.
|
||||
|
||||
##### `GetMountOffsetsOrTargetsFromAxisInfo`
|
||||
```csharp
|
||||
public static float[] GetMountOffsetsOrTargetsFromAxisInfo(float[] perAxisValue, int axisToIgnore)
|
||||
```
|
||||
Extracts mount offsets or targets for the two non-ignored axes. Returns `float[2]`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Array Sizes**: `tiltSensorADC` must contain exactly 3 elements. `tiltSensorCals` must contain at least 18 elements (indexed by `TiltSensorCalAttributes`).
|
||||
- **Ignored Axis Values**: Valid values are `1`, `2`, or `3`. A value of `0` is treated as `3`.
|
||||
- **Precision**: Tilt degree calculations are rounded to 3 decimal places using `SIGNIFICANT_DIGITS = 1000`.
|
||||
- **Gain Default**: If a gain calibration value is `0`, it defaults to `1.0` to prevent division by zero.
|
||||
- **Dictionary Keys**: `TiltAxesHelper.AxisConfigurations` uses keys `1`, `2`, and `3` (1-indexed), not `0`, `1`, `2`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Enums.DASFactory` - For `DFConstantsAndEnums.RecordingMode` and `TiltAxes` enum
|
||||
- `DTS.Common.Utilities` - For `DegreesFromADC.GetDegrees()` method
|
||||
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`
|
||||
|
||||
### Consumers:
|
||||
- Unknown from source alone. The partial class structure (`Test.Module`) suggests this is consumed by other components within the `DTS.Common.DAS.Concepts` namespace.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
### Critical Bugs in `TiltAxesHelper` Constructor
|
||||
|
||||
1. **Bug: `AxisTwo` never assigned in default case**
|
||||
```csharp
|
||||
else
|
||||
{
|
||||
AxisOne = AxisConfigurations[1];
|
||||
AxisOne = AxisConfigurations[2]; // BUG: Should be AxisTwo
|
||||
}
|
||||
```
|
||||
When `AxisIgnored` is not `1` or `2`, `AxisTwo` remains `null` and `AxisOne` is assigned twice.
|
||||
|
||||
2. **Bug: `TargetAxisTwo` assigned to wrong property**
|
||||
```csharp
|
||||
AxisOne.TargetOffset = TargetAxisOne;
|
||||
AxisOne.TargetOffset = TargetAxisTwo; // BUG: Should be AxisTwo.TargetOffset
|
||||
```
|
||||
`AxisTwo.TargetOffset` is never set; `Axis
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Module/Channel/Sensor/SensorUnits.cs
|
||||
- Common/DTS.Common.DAS.Concepts/Test/Module/Channel/Sensor/ExcitationVoltage.cs
|
||||
generated_at: "2026-04-17T15:40:36.715938+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "383041d9dd8bd8c1"
|
||||
---
|
||||
|
||||
# Documentation: Test.Module.Channel.Sensor (SensorUnits & ExcitationVoltage)
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines sensor-related enumerations and conversion utilities within the `DTS.Common.DAS.Concepts` namespace. It provides the `SensUnits` enumeration for specifying sensitivity unit types (e.g., mV, mV/V, mV/V/EU) used in sensor configurations, and offers static helper methods for converting between `ExcitationVoltageOptions.ExcitationVoltageOption` enum values and their associated numeric voltage magnitudes. This is part of a larger partial class hierarchy modeling test module channel configurations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Enum: `Test.Module.Channel.Sensor.SensUnits`
|
||||
|
||||
Defined in `SensorUnits.cs`:
|
||||
|
||||
| Member | Value | Description Attribute | Purpose |
|
||||
|--------|-------|----------------------|---------|
|
||||
| `NONE` | 0 | "NONE" | No Sensitivity Units (Polynomial Sensor) |
|
||||
| `mV` | 1 | "mV" | Sensitivity expressed in mV with output at Capacity EU |
|
||||
| `mVperV` | 2 | "mV/V" | Excitation proportional sensitivity expressed in mV/V with output at Capacity EU |
|
||||
| `mVperVperEU` | 3 | "mV/V/EU" | Excitation proportional sensitivity expressed in mV/V/EU |
|
||||
| `mVperEU` | 4 | "mV/EU" | Sensitivity expressed in mV/EU |
|
||||
|
||||
---
|
||||
|
||||
### Static Methods (defined in `ExcitationVoltage.cs`)
|
||||
|
||||
#### `GetExcitationVoltageMagnitudeFromEnum`
|
||||
|
||||
```csharp
|
||||
public static double GetExcitationVoltageMagnitudeFromEnum(
|
||||
ExcitationVoltageOptions.ExcitationVoltageOption target)
|
||||
```
|
||||
|
||||
Converts an `ExcitationVoltageOptions.ExcitationVoltageOption` enum value to its associated numeric voltage magnitude (in volts). Uses `ExcitationVoltageOptions.VoltageMagnitudeAttributeCoder.DecodeAttributeValue()` internally.
|
||||
|
||||
**Returns:** The `double` magnitude associated with the specified voltage option.
|
||||
|
||||
**Throws:** `ArgumentException` with message "encountered problem attempting to get excitation voltage magnitude from enum" if decoding fails.
|
||||
|
||||
---
|
||||
|
||||
#### `GetExcitationVoltageEnumFromMagnitude`
|
||||
|
||||
```csharp
|
||||
public static ExcitationVoltageOptions.ExcitationVoltageOption GetExcitationVoltageEnumFromMagnitude(
|
||||
double magnitude)
|
||||
```
|
||||
|
||||
Converts a numeric voltage magnitude to the corresponding `ExcitationVoltageOptions.ExcitationVoltageOption
|
||||
69
docs/ai/Common/DTS.Common.DASResource.md
Normal file
69
docs/ai/Common/DTS.Common.DASResource.md
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DASResource/Settings.Designer.cs
|
||||
generated_at: "2026-04-17T15:40:33.231691+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "34b2c2a98e62face"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.DASResource.Settings
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module is an auto-generated settings class created by Visual Studio's Settings Designer (`SettingsSingleFileGenerator`). It provides strongly-typed access to user-scoped application settings for the `DTS.Common.DASResource` namespace. The class serves as a persistent configuration store, allowing the application to read and write user preferences that survive between application sessions.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `Settings`
|
||||
**Signature:** `public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase`
|
||||
|
||||
A singleton-based settings class that provides access to configured application values.
|
||||
|
||||
---
|
||||
|
||||
### Property: `Default`
|
||||
**Signature:** `public static Settings Default { get; }`
|
||||
|
||||
Returns the synchronized singleton instance of the `Settings` class. This is the primary entry point for accessing settings throughout the application.
|
||||
|
||||
---
|
||||
|
||||
### Property: `Samplerate2AAFrequency`
|
||||
**Signature:** `public global::System.Collections.Specialized.OrderedDictionary Samplerate2AAFrequency { get; set; }`
|
||||
|
||||
A user-scoped setting that stores an `OrderedDictionary` mapping sample rates to anti-aliasing frequency values. Marked with `[UserScopedSettingAttribute]`.
|
||||
|
||||
---
|
||||
|
||||
### Property: `abcd`
|
||||
**Signature:** `public string abcd { get; set; }`
|
||||
|
||||
A user-scoped string setting with a default value of `"hdsa askjhsad kjhsad"`. Marked with `[UserScopedSettingAttribute]` and `[DefaultSettingValueAttribute("hdsa askjhsad kjhsad")]`.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The `Settings` class is `sealed` and cannot be inherited.
|
||||
- The singleton instance returned by `Default` is thread-safe, created via `ApplicationSettingsBase.Synchronized()`.
|
||||
- All settings in this class are user-scoped, meaning they are writable and stored per-user.
|
||||
- The `OrderedDictionary` returned by `Samplerate2AAFrequency` maintains insertion order of key-value pairs.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System.Configuration.ApplicationSettingsBase` - Base class providing settings persistence infrastructure
|
||||
- `System.Collections.Specialized.OrderedDictionary` - Collection type for the `Samplerate2AAFrequency` setting
|
||||
- `System.Runtime.CompilerServices.CompilerGeneratedAttribute`
|
||||
- `System.CodeDom.Compiler.GeneratedCodeAttribute`
|
||||
- `System.Diagnostics.DebuggerNonUserCodeAttribute`
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone. Any component requiring access to these user settings would reference `Settings.Default`.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Auto-generated code:** This file is tool-generated. Manual changes will be overwritten if the settings are regenerated from the Visual Studio designer. The actual settings schema is defined in a `.settings` file (not shown) that drives this generation.
|
||||
|
||||
- **Suspicious default value:** The `abcd` property has a default value of `"hdsa askjhsad kjhsad"` which appears to be placeholder or test data rather than a meaningful default. The property name itself is non-descriptive.
|
||||
|
||||
- **Naming inconsistency:** The property `Samplerate2AAFrequency` uses lowercase 'r' in "rate" (should conventionally be "SampleRate"). This may cause confusion or require careful attention when referencing
|
||||
48
docs/ai/Common/DTS.Common.DASResource/Properties.md
Normal file
48
docs/ai/Common/DTS.Common.DASResource/Properties.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DASResource/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:08:48.737006+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fc6dbfff8e040367"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `DASResource` assembly. It is a standard .NET AssemblyInfo file that defines version information, copyright, and COM visibility settings. The actual implementation code for DASResource is not present in this file—only assembly-level attributes.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this file. The following assembly-level attributes are declared:
|
||||
|
||||
- `AssemblyTitle("DASResource")` - Sets the assembly title
|
||||
- `AssemblyDescription("")` - Empty description
|
||||
- `AssemblyConfiguration("")` - Empty configuration
|
||||
- `AssemblyCompany("")` - Empty company name
|
||||
- `AssemblyProduct("DASResource")` - Product name
|
||||
- `AssemblyCopyright("Copyright © 2008 - 2009")` - Copyright notice
|
||||
- `AssemblyTrademark("")` - Empty trademark
|
||||
- `AssemblyCulture("")` - Neutral culture (not a satellite assembly)
|
||||
- `ComVisible(false)` - Types not visible to COM by default
|
||||
- `Guid("E20CF41A-9884-40f4-AD18-4F06A42FE36D")` - COM typelib GUID
|
||||
- `AssemblyVersion("1.06.0081")` - Assembly version
|
||||
- `AssemblyFileVersion("1.06.0081")` - File version
|
||||
|
||||
### Invariants
|
||||
- AssemblyVersion and AssemblyFileVersion are synchronized at "1.06.0081"
|
||||
- ComVisible is set to false, meaning no types are exposed to COM by default
|
||||
- AssemblyCulture is empty, indicating this is not a satellite assembly
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this:** Cannot be determined from source alone. The actual DASResource implementation files would reference this assembly, but they are not provided.
|
||||
|
||||
### Gotchas
|
||||
- The actual DASResource types and functionality are not visible in this file; only assembly metadata is present.
|
||||
- The copyright date range (2008 - 2009) suggests this assembly was actively developed during that period.
|
||||
- The description, company, and trademark fields are empty—typical of internal/proprietary projects.
|
||||
|
||||
---
|
||||
52
docs/ai/Common/DTS.Common.DBSyncService.md
Normal file
52
docs/ai/Common/DTS.Common.DBSyncService.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DBSyncService/ProjectInstaller.cs
|
||||
- Common/DTS.Common.DBSyncService/Program.cs
|
||||
- Common/DTS.Common.DBSyncService/DBSyncService.Designer.cs
|
||||
- Common/DTS.Common.DBSyncService/DBSyncService.cs
|
||||
- Common/DTS.Common.DBSyncService/ProjectInstaller.Designer.cs
|
||||
generated_at: "2026-04-17T16:02:06.149303+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cb5636bf23f23ea0"
|
||||
---
|
||||
|
||||
# DTS.Common.DBSyncService
|
||||
|
||||
### Purpose
|
||||
This module implements a Windows Service application for database synchronization monitoring. It provides a service infrastructure that can be installed and run as a system service, with configurable monitoring intervals and event logging capabilities. The service supports custom commands for triggering synchronization operations and is designed to run continuously in the background.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**ProjectInstaller** (class)
|
||||
- `ProjectInstaller()` - Constructor that initializes the service installer components. Marked with `[RunInstaller(true)]` for InstallUtil.exe deployment.
|
||||
|
||||
**Program** (static class)
|
||||
- `static void Main()` - Application entry point that creates and runs a `DBSyncService` instance via `ServiceBase.Run()`.
|
||||
|
||||
**DBSyncService** (class, inherits `ServiceBase`)
|
||||
- `DBSyncService()` - Constructor that initializes the event log source, configures logging to `Settings.Default.Service` log, and optionally starts a monitoring timer if `Settings.Default.Monitoring` is enabled.
|
||||
- `void OnTimer(object sender, ElapsedEventArgs args)` - Timer callback that writes "Monitoring the System" to the event log. Contains a TODO comment for monitoring activities.
|
||||
- `protected override void OnStart(string[] args)` - Writes a service started entry to the event log.
|
||||
- `protected override void OnStop()` - Writes a service stopped entry to the event log.
|
||||
- `protected override void OnCustomCommand(int command)` - Handles custom service commands. Supports `SyncDb` (128), `Command2` (129), and `Command3` (130) via the `CustomCommands` enum.
|
||||
- `CustomCommands` (enum) - Defines custom command values: `SyncDb = 128`, `Command2 = 129`, `Command3 = 130`.
|
||||
- `eventLog` (public field, `System.Diagnostics.EventLog`) - Event log instance for writing service entries.
|
||||
|
||||
### Invariants
|
||||
- The event log source must exist before being used; the constructor creates it via `EventLog.CreateEventSource()` if it doesn't exist.
|
||||
- The timer is only created and started if `Settings.Default.Monitoring` is `true`.
|
||||
- Custom commands use values starting at 128 (Windows service custom command convention).
|
||||
- The `ServiceName` in the designer is initially set to "Service1" but is overridden at runtime from `Settings.Default.ServiceName`.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Configuration.Install`, `System.ServiceProcess`, `System.Diagnostics`, `System.Timers`, `DTS.Common.DBSyncService.Properties` (Settings).
|
||||
- **Depended on by**: Not evident from source alone; this is a top-level executable service application.
|
||||
|
||||
### Gotchas
|
||||
- The `OnTimer` method contains only a TODO comment and event log write; actual monitoring logic is not implemented.
|
||||
- The `OnCustomCommand` switch cases are empty—no actual command handling logic exists.
|
||||
- The designer file sets `ServiceName = "Service1"` which is a placeholder; the actual service name comes from settings at runtime.
|
||||
- The timer variable in the constructor is a local variable, not a class field, which could lead to garbage collection issues if the service runs for extended periods (timer could be collected).
|
||||
|
||||
---
|
||||
86
docs/ai/Common/DTS.Common.DBSyncService/Properties.md
Normal file
86
docs/ai/Common/DTS.Common.DBSyncService/Properties.md
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DBSyncService/Properties/AssemblyInfo.cs
|
||||
- Common/DTS.Common.DBSyncService/Properties/Settings.Designer.cs
|
||||
generated_at: "2026-04-17T16:36:20.363880+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "dc85acc67b289cb1"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.DBSyncService
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides configuration and assembly metadata for the DTS Database Synchronization Service, a Windows service component. It defines application-level settings that control service behavior, including monitoring enablement, execution interval, and service identification. The module serves as the configuration layer for a database synchronization service that appears to operate on a timed interval basis.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DTS.Common.DBSyncService.Properties.Settings`
|
||||
|
||||
An internal sealed partial class that provides strongly-typed access to application configuration settings. Inherits from `global::System.Configuration.ApplicationSettingsBase`.
|
||||
|
||||
#### Static Property: `Default`
|
||||
|
||||
```csharp
|
||||
public static Settings Default { get; }
|
||||
```
|
||||
|
||||
Returns the singleton instance of the `Settings` class, synchronized for thread-safe access.
|
||||
|
||||
#### Property: `Monitoring`
|
||||
|
||||
```csharp
|
||||
public bool Monitoring { get; }
|
||||
```
|
||||
|
||||
Application-scoped setting indicating whether monitoring is enabled. Default value: `False`.
|
||||
|
||||
#### Property: `Interval`
|
||||
|
||||
```csharp
|
||||
public int Interval { get; }
|
||||
```
|
||||
|
||||
Application-scoped setting defining the execution interval. Default value: `60000` (presumed milliseconds, equating to 60 seconds).
|
||||
|
||||
#### Property: `ServiceName`
|
||||
|
||||
```csharp
|
||||
public string ServiceName { get; }
|
||||
```
|
||||
|
||||
Application-scoped setting for the service display name. Default value: `"DTS DB Sync Service"`.
|
||||
|
||||
#### Property: `Service`
|
||||
|
||||
```csharp
|
||||
public string Service { get; }
|
||||
```
|
||||
|
||||
Application-scoped setting for the service identifier. Default value: `"DB Sync Service"`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Singleton Pattern**: The `Settings` class maintains exactly one synchronized instance accessible via `Settings.Default`.
|
||||
- **Application-Scoped Settings**: All four settings (`Monitoring`, `Interval`, `ServiceName`, `Service`) are application-scoped, meaning they are read-only at runtime and must be configured at the application level (e.g., via `app.config` or `web.config`).
|
||||
- **COM Visibility**: All types in this assembly are not visible to COM components (`ComVisible(false)`).
|
||||
- **Assembly Identity**: The assembly GUID `5f8e95eb-e89c-4fdc-9bde-3e78dd56ad6f` uniquely identifies this assembly's type library if exposed to COM.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System.Reflection` - For assembly metadata attributes
|
||||
- `System.Runtime.CompilerServices` - For compiler-generated attributes
|
||||
- `System.Runtime.InteropServices` - For COM interop attributes (`ComVisible`, `Guid`)
|
||||
- `System.Configuration` - For `ApplicationSettingsBase` base class and configuration attributes
|
||||
- `System.Diagnostics` - For `DebuggerNonUserCodeAttribute`
|
||||
|
||||
### What depends on this module:
|
||||
- **Cannot be determined from source alone.** The consuming components would be
|
||||
281
docs/ai/Common/DTS.Common.DataModel.md
Normal file
281
docs/ai/Common/DTS.Common.DataModel.md
Normal file
@@ -0,0 +1,281 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/ApplicationProperties.cs
|
||||
- Common/DTS.Common.DataModel/CollectDataProcess.cs
|
||||
- Common/DTS.Common.DataModel/SysBuiltObjectType.cs
|
||||
- Common/DTS.Common.DataModel/DataModelSettings.cs
|
||||
- Common/DTS.Common.DataModel/DataFiles.cs
|
||||
- Common/DTS.Common.DataModel/ChannelRepresentation.cs
|
||||
- Common/DTS.Common.DataModel/DASFactory.cs
|
||||
generated_at: "2026-04-17T15:32:07.033417+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "666ebf3a34293f35"
|
||||
---
|
||||
|
||||
# DTS.Common.DataModel Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the core data model and application-wide state management for the DTS (Data Acquisition System) application. It contains global application properties, configuration settings, hardware abstraction representations, data file management, and device discovery orchestration. The module serves as the central hub connecting UI components to underlying hardware communication layers, test data storage, and ISO standard compliance data.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ApplicationProperties (static class)
|
||||
Global application state container.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `CurrentUser` | `User` | The currently logged-in user. |
|
||||
| `DASFactory` | `DASFactory` | Factory instance for DAS device management. |
|
||||
| `CurrentView` | `User` | Current view context (distinct from CurrentUser). |
|
||||
| `IsoDb` | `ISO13499FileDb` | ISO 13499 database reference. |
|
||||
| `LicenseValidationResult` | `ValidationResult` | Result of license validation. |
|
||||
| `CanCurrentUserCommitChannelCodes` | `bool` | Permission flag for channel code commits. |
|
||||
|
||||
---
|
||||
|
||||
### DataModelSettings (static class)
|
||||
Application-wide configuration with default values.
|
||||
|
||||
**Key Properties:**
|
||||
- `UseISOCodeForDiadem200` (bool, default: `false`)
|
||||
- `SampleRateAAFilterRatio` (byte, default: `5`)
|
||||
- `SupportedSquibFireModes` (string, default: `"CAP,CONSTANT"`)
|
||||
- `ShowCompactHardware` (bool, default: `true`)
|
||||
- `AllowedVoltageInsertionErrorPercent` (double, default: `1`)
|
||||
- `AllowedExcitationErrorPercent` (double, default: `2`)
|
||||
- `AllowedShuntErrorPercent` (double, default: `5`)
|
||||
- `AllowedGainErrorPercent` (double, default: `2`)
|
||||
- `AllowedGainErrorPercent_SLICE6andSLICE6A` (double, default: `5`)
|
||||
- `DownloadFolder` (string, default: `"..\\..\\Data"`)
|
||||
- `RequireXCrashCompatibilityForISOExports` (bool, default: `true`)
|
||||
- `SLICETurnOffAAFRealtime` (bool, default: `true`)
|
||||
- `ArmChecklistRequiredIfTOM` (bool, default: `true`)
|
||||
- `CheckUnitsIntervalMillisecond` (int, default: `50`)
|
||||
- `SemaphoreDelay` (double, default: `10`)
|
||||
- `SemaphoreSpots` (int, default: `3`)
|
||||
- `SLICEConcurrentSpots` (int, default: `999`)
|
||||
- `MulticastAutoDiscoveryReceiveTimeoutMS` (int, default: `1500`)
|
||||
- `LocalKeepAliveRetryIntervalMS` (uint, default: `1000`)
|
||||
- `LocalKeepAliveTimeOutMS` (uint, default: `5000`)
|
||||
- `RemoteKeepAliveRetryIntervalSeconds` (uint, default: `5`)
|
||||
- `RemoteKeepAliveSeconds` (uint, default: `60`)
|
||||
- `ReceiveBufferSizeBytes` / `SendBufferSizeBytes` (int, default: `65536`)
|
||||
- `HeartbeatAsyncConnectTimeoutMS` (int, default: `10000`)
|
||||
- `DefaultTDCSensorDatabaseFolder` / `DefaultTDCSensorDatabaseFile` (string defaults for sensor database)
|
||||
|
||||
---
|
||||
|
||||
### CollectDataProcess
|
||||
Represents a data collection process with visual properties. Inherits from `BasePropertyChanged`.
|
||||
|
||||
```csharp
|
||||
public CollectDataProcess(string name, Color color)
|
||||
```
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Name` | `string` | Process name (notifies property change). |
|
||||
| `BackgroundColor` | `Color` | Display color for the process. |
|
||||
| `IsEnabled` | `bool` | Enablement state. |
|
||||
|
||||
---
|
||||
|
||||
### SysBuiltObjectType
|
||||
Container for Dynamic Groups of a given test object type (Vehicle 1, Vehicle 2, Sled, etc.).
|
||||
|
||||
```csharp
|
||||
public SysBuiltObjectType(string testObjectType)
|
||||
```
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `TestObject` | `MMETestObjects` | Resolved test object from `ApplicationProperties.IsoDb`. Setter stores `Test_Object` string internally. |
|
||||
| `ISOTestObjectType` | `string` | Returns `TestObject.Text_L1`. |
|
||||
|
||||
**Methods:**
|
||||
- `ToString()` - Returns `TestObject.Text_L1`.
|
||||
|
||||
---
|
||||
|
||||
### DataFiles
|
||||
Metadata container for test data files.
|
||||
|
||||
```csharp
|
||||
public DataFiles(string expandCollapse, string testName, string id, string allOrROI,
|
||||
string lab, string customer, DateTime dateCreated, string description,
|
||||
string numberOfChannels, string testEngineer, bool isTSRAIR, string roiSuffix = "")
|
||||
```
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ExpandCollapse` | `string` | UI expansion state (`"+"`, `"-"`, or empty). |
|
||||
| `TestId` | `string` | Test identifier. |
|
||||
| `TestName` | `string` | Test name. |
|
||||
| `AllOrROI` | `string` | "All" or "ROI" designation. |
|
||||
| `Lab` / `Customer` / `TestEngineer` | `string` | Test metadata. |
|
||||
| `DateCreated` | `DateTime` | Creation timestamp. |
|
||||
| `Description` | `string` | Test description. |
|
||||
| `NumberOfChannels` | `string` | Channel count. |
|
||||
| `ROISuffix` | `string` | ROI suffix identifier. |
|
||||
| `DTSFile` | `string` | Location of DTS file (populated in export tab). |
|
||||
| `IsTSRAIR` | `bool` | TSR AIR test flag. |
|
||||
| `TestSelected` | `bool` | Selection state. |
|
||||
| `LongString` | `string` | Extended description. |
|
||||
|
||||
---
|
||||
|
||||
### DataFilesList
|
||||
Manages discovery and listing of test data files. Singleton pattern.
|
||||
|
||||
```csharp
|
||||
public static DataFilesList DataFileList { get; } // Singleton accessor
|
||||
```
|
||||
|
||||
**Key Methods:**
|
||||
- `DataFiles[] GetAllFiles(string testName)` - Returns all data files for a given test name, recursively searching for folders containing both `.dts` and `.chn` files.
|
||||
- `DataFiles[] GetAllDataFiles()` - Returns top-level test folder summaries.
|
||||
- `DataFiles[] Contract(DataFiles df)` - Collapses expanded test entries in the list.
|
||||
- `DataFiles[] DataFiles` (property) - Gets/sets the current file list.
|
||||
|
||||
**Private Methods:**
|
||||
- `string[] GetFoldersWithData(string folder)` - Recursively finds folders with both `.dts` and `.chn` files.
|
||||
- `bool GetTestInfo(string dtsFilePath, out string lab, out string customer, out string description, out string testEngineer, out DateTime dt, out string name)` - Parses test metadata from DTS file using streaming XML parsing.
|
||||
- `int GetFileCount(string binaryFolder, string testId)` - Counts test data sets in a binary folder.
|
||||
|
||||
---
|
||||
|
||||
### ChannelRepresentation
|
||||
Converts internal channel numbers to display-friendly representations for various hardware types.
|
||||
|
||||
```csharp
|
||||
public ChannelRepresentation(DASHardware h, DTS.DASLib.Service.DASChannel c, int startingChannelNumber)
|
||||
public ChannelRepresentation(HardwareChannel c, int startingChannelNumber, IDASHardware[] hardwares = null)
|
||||
```
|
||||
|
||||
**Nested Enum:**
|
||||
```csharp
|
||||
public enum ChannelTypeEnum { SQUIB, TOMDigital, DigitalInput, Other }
|
||||
```
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `DASSerialNumber` | `string` | DAS device serial number. |
|
||||
| `SerialNumber` | `string` | Module serial number. |
|
||||
| `ChannelNumberString` | `string` | Formatted display string (e.g., "CH01", "SQ02"). |
|
||||
| `ChannelNumber` | `int` | Numeric channel number. |
|
||||
|
||||
**Behavior:** Handles channel number conversion for hardware types including:
|
||||
- TDAS_Pro_Rack, TDAS_LabRack
|
||||
- SLICE variants (SLICE2_TOM, SLICE2_SLT, SLICE6_AIR, SLICE_PRO_CAN_FD, etc.)
|
||||
- G5VDS, G5INDUMMY
|
||||
- EMB devices (EMB_ANG_ARS, EMB_ATM, EMB_LIN_ACC_HI, EMB_LIN_ACC_LO)
|
||||
- TSR_AIR, TSR_AIR_RevB, DIR, DKR
|
||||
- SLICE6_AIR_TC (thermocouple handling)
|
||||
|
||||
---
|
||||
|
||||
### DASFactory
|
||||
Wrapper around `DTS.DASLib.DASFactory.DASFactory` for device discovery and management.
|
||||
|
||||
```csharp
|
||||
public DASFactory() // Constructor initializes semaphores, keep-alive settings, and performs initial refresh
|
||||
```
|
||||
|
||||
**Events:**
|
||||
- `DASFactoryEventHandler OnDeviceArrived` - Fired when a device is discovered.
|
||||
- `DASFactoryEventHandler OnFactoryChanged` - Fired on device arrival, failure, or removal.
|
||||
- `DiscoveredDASEventHandler DiscoveredDAS` - Fired during discovery thread iterations.
|
||||
|
||||
**Key Methods:**
|
||||
- `void StartMulticastAutoDiscovery()` / `void StopMulticastAutoDiscovery()` - Control auto-discovery process.
|
||||
- `IDiscoveredDevice[] GetDiscoveredDevices()` - Returns discovered devices.
|
||||
- `IDASFactory GetDASFactory()` - Returns underlying factory interface.
|
||||
- `void TakeOwnership()` - Takes ownership of devices.
|
||||
- `void DetachAllDevices(bool detachUSB = false)` - Detaches devices (USB detach conditional).
|
||||
- `void DisposeFactory()` - Disposes the underlying factory.
|
||||
- `void Refresh(bool wait)` - Refreshes device list; prevents overlapping refresh calls.
|
||||
- `List<IDASCommunication> GetActiveDevices()` - Returns active DAS devices.
|
||||
- `string[] GetReportedConnections()` - Returns connections reported by ECM/SDB/S6DB.
|
||||
- `SortableBindingList<IDiscoveredDevice> AutoDiscoverMulticast()` - Performs multicast discovery.
|
||||
- `void DiscoveryThread(DFConstantsAndEnums.MultiCastDeviceClasses[] deviceFilter, CancellationToken ct, bool discoverParents = true)` - Background discovery thread.
|
||||
- `void AutoDiscoverIfNecessary()` - Runs auto-discovery for SLICE6/SLICE6Db downstream MAC addresses.
|
||||
- `void StartQATSListening()` / `void StopQATSListening()` / `void SendQATSRequest()` / `IUDPQATSEntry[] GetQATS()` - QATS (Query Arm Trigger Status) operations.
|
||||
|
||||
**Static Methods:**
|
||||
- `bool IsStreaming(IDASCommunication das)` - Returns true if SLICE6 Air is streaming.
|
||||
- `bool IsInRealtime(IDASCommunication das)` - Returns true if unit is in realtime or streaming.
|
||||
- `bool AnyInRealtime(List<IDASCommunication> das)` - Returns true if any unit is in realtime.
|
||||
|
||||
**Properties:**
|
||||
- `TDASHostNames`, `SPFDHostNames`, `SDBHostNames` (string arrays) - Host name configurations.
|
||||
- `MulticastAutoDiscoveryReceiveTimeoutMS`, `MulticastAutoDiscoveryAddress`, `MulticastAutoDiscoveryPort`, `MulticastAutoDiscoveryResponsePort` - Multicast configuration.
|
||||
- `S6ConnectNewTimeout` (double) - SLICE6 connection timeout.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **ApplicationProperties singleton state**: All properties are static and globally accessible; consumers must ensure thread-safe access patterns.
|
||||
|
||||
2. **DataFilesList singleton**: The `DataFileList` property uses lazy initialization and returns a single shared instance.
|
||||
|
||||
3. **DASFactory refresh concurrency**: The `_bInRefresh` flag guards against overlapping `Refresh()` calls. If `Refresh()` is called while already refreshing, the second call is silently ignored.
|
||||
|
||||
4. **ChannelRepresentation hardware type handling**: The `ConvertChannelNumbers` method must receive a valid `HardwareTypes` enum value; unhandled types fall through to a default case that uses the starting channel number directly.
|
||||
|
||||
5. **Data folder structure expectation**: `DataFilesList` expects a folder hierarchy of `TestName/TestId/Binary/[All|ROI]` for proper parsing of `AllOrROI` values.
|
||||
|
||||
6. **DTS file uniqueness**: `GetFileCount` and `GetAllFiles` assume exactly one `.dts` file per data folder; folders with zero or multiple DTS files are skipped.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Slice.Users` - User types
|
||||
- `DTS.Common.Base` - `BasePropertyChanged` for INPC
|
||||
- `DTS.Common.ISO` - ISO 13499 database types (`ISO13499FileDb`, `MMETestObjects`)
|
||||
- `DTS.Common.Licensing.Messages` - `ValidationResult`
|
||||
- `DTS.Common.Enums.Hardware` - `HardwareTypes` enum
|
||||
- `DTS.Common.Enums.Sensors` - Sensor enums
|
||||
- `DTS.Common.Interface.DataRecorders` - `IDASHardware`
|
||||
- `DTS.Common.Interface.DASFactory` - `IDASFactory`, `IDiscoveredDevice`
|
||||
- `DTS.Common.Enums.DASFactory` - `DFConstantsAndEnums`
|
||||
- `DTS.Common.Converters` - `EnumDescriptionTypeConverter`
|
||||
- `DTS.Common.Constant.DASSpecific` - `SensorConstants`
|
||||
- `DTS.Common.SharedResource.Strings` - Localized strings
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger`
|
||||
- `DTS.Common.Utils` - Utility functions
|
||||
- `DTS.Common.DataModel.Classes.TestTemplate` - `TSRAIRGoTestSetup`
|
||||
- `DTS.Serialization` - Serialization utilities
|
||||
- `DTS.DASLib.DASFactory` - Underlying DAS factory implementation
|
||||
- `DTS.DASLib.Service` - DAS channel types
|
||||
- `DTS.DASLib.Command` - Command infrastructure
|
||||
- `System.Windows.Media` - `Color` type
|
||||
|
||||
### What depends on this module:
|
||||
- Unclear from source alone; `ApplicationProperties` is a global state container likely used throughout the application.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **ApplicationProperties mutable global state**: All properties are get/set with no validation or change notification. Setting `CurrentUser`, `DASFactory`, or `IsoDb` to null could cause null reference exceptions in consumers like `SysBuiltObjectType.TestObject` which accesses `ApplicationProperties.IsoDb.GetTestObjectByIso()`.
|
||||
|
||||
2. **SysBuiltObjectType null handling**: The `TestObject` getter calls `IsoDb.GetTestObjectByIso(_testObject)` without null-checking `IsoDb`. If `ApplicationProperties.IsoDb` is null, this will throw.
|
||||
|
||||
3. **DASFactory TDASHostNames/SDBHostNames setters have side effects**: Setting these properties triggers refresh logic in the underlying factory. The setter includes a check to avoid redundant updates but only after checking `_bInRefresh` flag with conditional compilation logging.
|
||||
|
||||
4. **ChannelRepresentation casting without validation**: The constructor casts `c` to `DTS.DASLib.Service.AnalogInputDASChannel` without type checking when determining `DigitalInput` channel type. This could throw if `c` is not an `AnalogInputDASChannel`.
|
||||
|
||||
5. **DataFilesList.GetTestInfo XML parsing fragility**: The method manually constructs XML by appending `"</Test>"` to incomplete tags. Malformed DTS files could cause `XElement.Parse` to throw.
|
||||
|
||||
6. **DASFactory.Refresh wait behavior**: When `wait` is `false`, the `_bInRefresh` flag is set to `false` inside the callback, but if the callback never fires (exception case), `_bInRefresh` remains `true`, blocking future refreshes.
|
||||
|
||||
7. **ChannelRepresentation.DoSquibConversion returns 0 for unexpected remainders**: Squib channel numbers with remainders 0, 2, 4, 6 return 0, which may represent an error state but is not documented.
|
||||
|
||||
8. **Conditional compilation LOG_DEBUG_REFRESH**: Debug logging for refresh overlap detection is controlled by `#define LOG_DEBUG_REFRESH` and is not compiled into release builds.
|
||||
17
docs/ai/Common/DTS.Common.DataModel/Classes.md
Normal file
17
docs/ai/Common/DTS.Common.DataModel/Classes.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Enums.cs
|
||||
generated_at: "2026-04-17T16:11:03.088050+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0de057f879229b98"
|
||||
---
|
||||
|
||||
# Classes
|
||||
|
||||
### Purpose
|
||||
This module defines core enumeration types used throughout the DTS data model layer. It provides standardized options for export formats, ISO channel sensor compatibility validation levels, and strictness modes for data operations. These enums serve as shared constants across the application.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`IsoChannelSensorCompatibilityLevels`** (enum)
|
||||
129
docs/ai/Common/DTS.Common.DataModel/Classes/Arming.md
Normal file
129
docs/ai/Common/DTS.Common.DataModel/Classes/Arming.md
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Arming/Arming.cs
|
||||
generated_at: "2026-04-17T15:43:00.640638+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f820a35e3a0ae97a"
|
||||
---
|
||||
|
||||
# Documentation: Arming Class
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `Arming` class orchestrates the complete arming sequence for Data Acquisition System (DAS) devices. It manages configuration application, flash memory clearing, pre-arm validation (including level trigger checks), and the final arm execution. This class serves as the primary controller for transitioning DAS hardware from an idle state to an armed, trigger-ready state in test measurement scenarios.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `Arming()`
|
||||
**Signature:** `public Arming()`
|
||||
|
||||
Default constructor. Initializes a new instance with a `Configuration` object.
|
||||
|
||||
---
|
||||
|
||||
### `SetConfigAndFlashClear`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public bool SetConfigAndStartFlashClear(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
Dictionary<string, int> dasSampleRateList,
|
||||
double duration,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction,
|
||||
ServiceBase.ServiceCallbackErrorEventHandler onError)
|
||||
```
|
||||
|
||||
**Behavior:** Entry point for the arming workflow. Configures DAS modules with test parameters (post-trigger duration, pre-trigger seconds, number of events, wake-up motion timeout), applies configuration via `Configuration.SetConfig()`, and initiates the flash clear sequence. Returns `true` on success, `false` on failure.
|
||||
|
||||
---
|
||||
|
||||
### `SoftwareTrigger`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public void SoftwareTrigger(List<IDASCommunication> dasList)
|
||||
```
|
||||
|
||||
**Behavior:** Sends a software trigger command to all DAS devices in the list. Executes within the `DASHardware.GetArmStatusLock`. Logs failures via `APILogger.Log()`.
|
||||
|
||||
---
|
||||
|
||||
### `DisarmAsync`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public void DisarmAsync(List<IDASCommunication> dasList)
|
||||
```
|
||||
|
||||
**Behavior:** Public entry point for disarming DAS devices. Delegates to `DisarmSync()` internally (despite the async naming).
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Thread Safety:** All hardware operations (`FlashErase`, `PrepareArmFunc`, `ArmNowFunc`, `SoftwareTrigger`, `DisarmSync`) execute within a lock on `DASHardware.GetArmStatusLock`.
|
||||
- **Pre-trigger Calculation:** Pre-trigger seconds is always calculated as `TSRAIR.TSRAIR_MAX_PRE_TRIGGER_SAMPLES / sampleRate` for each DAS.
|
||||
- **Flash Clear Prerequisite:** Flash memory must be successfully erased before proceeding to `PrepareArmFunc`.
|
||||
- **Level Trigger Validation:** If `currentTest.LevelTriggerChannels.Count > 0`, the system checks for already-level-triggered channels and fails if any are detected.
|
||||
- **Failure Propagation:** Any failure during the arming sequence results in `false` return and invocation of the `onError` callback.
|
||||
- **Disarm on Partial Failure:** If some devices arm successfully while others fail, all devices are disarmed for safety (per FogBugz 4527).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
| Dependency | Usage |
|
||||
|------------|-------|
|
||||
| `DTS.Common.Interface.DASFactory.IDASCommunication` | DAS device abstraction |
|
||||
| `DTS.Common.Utilities.Logging.APILogger` | Logging |
|
||||
| `DTS.DASLib.Service.ArmingService` | Service layer for arming operations |
|
||||
| `DTS.DASLib.Service.ServiceBase` | Callback infrastructure |
|
||||
| `DTS.Common.SharedResource.Strings.StringResources` | Localized error messages |
|
||||
| `DTS.Common.DataModel.Common.StatusHelpers` | Progress reporting helpers |
|
||||
| `DTS.Common.DataModel.Common.DASHardware` | Hardware lock singleton |
|
||||
| `DTS.Common.Enums.TSRAIRGo.TSRAIRGoStatus` | Status type enums |
|
||||
| `DTS.Common.Constant.DASSpecific.TSRAIR` | Constants including `TSRAIR_MAX_PRE_TRIGGER_SAMPLES` |
|
||||
| `DTS.Common.DataModel.Classes.TSRAIRGo.Configuration` | Configuration application |
|
||||
|
||||
### Data Types Referenced:
|
||||
- `DataModel.TestTemplate` - Test configuration container
|
||||
- `AnalogInputDASChannel` - Channel type with `AlreadyLevelTriggered` property
|
||||
- `ArmStatus` - Arm state tracking object
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
### Namespace Mismatch
|
||||
The file path indicates `DTS.Common.DataModel` but the namespace is declared as `DataPROWin7.DataModel.Classes`. This may cause confusion or require external aliasing.
|
||||
|
||||
### Misleading Async Naming
|
||||
`DisarmAsync()` is **not asynchronous**—it calls `DisarmSync()` which blocks on a `ManualResetEvent`. The naming is misleading.
|
||||
|
||||
### Magic Numbers
|
||||
- `ARM_NOW_TIMEOUT = 30000` (30 seconds)
|
||||
- `600000` (10 minutes) passed to `ReadyForArm()`
|
||||
- `50` ms polling interval used throughout
|
||||
- Hardcoded `30000` and `dasList.Count > 1` in `PreparedArmNowFunc` with a TODO comment: `"///////////fix the 30000 and 1 (at least)"`
|
||||
|
||||
### Historical Bug Fixes Referenced
|
||||
- **FB 26980:** Override `mod.NumberOfEvents` to ensure correct value
|
||||
- **39345:** Don't hang if Flash Erase fails
|
||||
- **4527:** Disarm all devices if any fail during arm (safety measure)
|
||||
- **15630:** Limit `EnableFaultChecking` to single unit at a time for TDAS with rack
|
||||
- **15267:** Stop on ERR response from TDAS ARM RF
|
||||
|
||||
### Unused Code Path
|
||||
In `ArmNowFunc()`, there is an empty conditional block:
|
||||
```csharp
|
||||
if (Common.SerializedSettings.StoreTestHistoryInDb)
|
||||
{
|
||||
//add code here?
|
||||
}
|
||||
```
|
||||
This suggests incomplete implementation.
|
||||
|
||||
### Polling Pattern
|
||||
The code uses a busy-wait polling pattern with `ManualResetEvent.WaitOne(50, false)` in multiple places. This is not ideal for performance but appears intentional for the hardware communication layer.
|
||||
70
docs/ai/Common/DTS.Common.DataModel/Classes/Configuration.md
Normal file
70
docs/ai/Common/DTS.Common.DataModel/Classes/Configuration.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Configuration/Configuration.cs
|
||||
generated_at: "2026-04-17T15:42:37.313288+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bbafb2fe040fef50"
|
||||
---
|
||||
|
||||
# Documentation: Configuration Class
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `Configuration` class is responsible for configuring Data Acquisition System (DAS) hardware devices by applying voltage threshold settings, resetting hardware lines, and persisting configuration files. It serves as a bridge between test templates and physical DAS hardware, ensuring devices are properly configured for either diagnostic or armed operational modes. The class handles the complete configuration lifecycle including threshold application, hardware line reset, configuration upload, and local file backup.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `Configuration()` (Constructor)
|
||||
**Signature:** `public Configuration()`
|
||||
|
||||
Default parameterless constructor. Performs no initialization.
|
||||
|
||||
---
|
||||
|
||||
### `SetConfig`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public void SetConfig(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
bool calledDuringDiagnostics,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction)
|
||||
```
|
||||
|
||||
**Behavior:** Configures all DAS devices in `dasList` with voltage thresholds and hardware settings. The method:
|
||||
1. Acquires a lock on `DASHardware.GetArmStatusLock`
|
||||
2. Sets minimum/maximum valid input and battery voltage thresholds for each DAS
|
||||
3. Applies either diagnostic or armed voltage thresholds based on `calledDuringDiagnostics` parameter
|
||||
4. Resets hardware lines via `ConfigurationService.ResetHardwareLines`
|
||||
5. Calls `ConfigurationService.SetConfiguration` with multiple parameters including AAF rates and DSP settings
|
||||
6. Copies configuration files to the test directory via `CopyGlobalConfigsToLocalFolder`
|
||||
|
||||
---
|
||||
|
||||
### `ErrorCallback`
|
||||
**Signature:**
|
||||
```csharp
|
||||
public static DialogResult ErrorCallback(string errorString, string units)
|
||||
```
|
||||
|
||||
**Behavior:** Static callback method that logs configuration errors via `APILogger.Log` and returns `DialogResult.OK`. The `units` parameter is not used in the implementation.
|
||||
|
||||
---
|
||||
|
||||
### `CopyGlobalConfigsToLocalFolder` (Private)
|
||||
**Signature:**
|
||||
```csharp
|
||||
private void CopyGlobalConfigsToLocalFolder(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList)
|
||||
```
|
||||
|
||||
**Behavior:** Copies DAS and module configuration XML files from the current directory's `Constants.DAS_CONFIGS` subfolder to the test directory. Creates the destination directory if it does not exist. Catches and logs exceptions without re-throwing.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Thread Safety:** All configuration operations within `SetConfig` are protected by a lock on `DASHardware.GetArmStatusLock`.
|
||||
- **Voltage Threshold Ordering:** The code does not explicitly validate that minimum thresholds are less than maximum thresholds.
|
||||
- **Configuration File Naming:** DAS config files are named `{OwningDAS}.xml`; module config files are named `{SerialNumber}.xml`.
|
||||
- **Callback Completion:** Both `ResetHardwareLines` and `SetConfiguration` operations block
|
||||
240
docs/ai/Common/DTS.Common.DataModel/Classes/Diagnostics.md
Normal file
240
docs/ai/Common/DTS.Common.DataModel/Classes/Diagnostics.md
Normal file
@@ -0,0 +1,240 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Diagnostics/Diagnostics.cs
|
||||
generated_at: "2026-04-17T15:43:31.698963+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7b5c8f5df247c453"
|
||||
---
|
||||
|
||||
# Documentation: Diagnostics Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module manages diagnostic operations and hardware configuration for Data Acquisition System (DAS) devices in a test environment. It handles the complete lifecycle of test setup configuration including: exporting test setups to XML, storing configurations on DAS hardware, configuring individual channel types (analog, squib, TOM digital, CAN), managing level trigger settings, and preparing hardware for diagnostic runs. The module serves as the bridge between test template definitions and the actual hardware configuration required to execute tests.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `LevelTriggerCapableChannel`
|
||||
|
||||
A wrapper class for managing level trigger configuration on hardware channels.
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public LevelTriggerCapableChannel(
|
||||
HardwareChannel hwch,
|
||||
SensorData sd,
|
||||
SensorCalibration sc,
|
||||
IGroup group,
|
||||
IGroupChannel groupChannel)
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `HardwareChannel` | `HardwareChannel` | Read-only access to the underlying hardware channel |
|
||||
| `DASOrModuleSerialNumber` | `string` | Returns module serial number for TDAS_Pro_Rack/TDAS_LabRack, otherwise hardware serial number |
|
||||
| `LessThanValue` | `double` | Threshold value for "less than" trigger (default: 0D) |
|
||||
| `GreaterThanValue` | `double` | Threshold value for "greater than" trigger (default: 0D) |
|
||||
| `IsLessThanThresholdEnabled` | `bool` | Enables/disables less-than threshold trigger |
|
||||
| `IsGreatherThanThresholdEnabled` | `bool` | Enables/disables greater-than threshold trigger (note: typo in property name) |
|
||||
| `InsideUpperBoundValue` | `double` | Upper bound for inside-window trigger |
|
||||
| `InsideLowerBoundValue` | `double` | Lower bound for inside-window trigger |
|
||||
| `OutsideUpperBoundValue` | `double` | Upper bound for outside-window trigger |
|
||||
| `OutsideLowerBoundValue` | `double` | Lower bound for outside-window trigger |
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public DTS.Common.ISO.LevelTriggerChannel ToISOLevelTriggerChannel()
|
||||
```
|
||||
Converts this configuration to an ISO-compatible `LevelTriggerChannel` object. TSR Air High G channels receive special handling for trigger enablement.
|
||||
|
||||
```csharp
|
||||
public void FromISOLevelTriggerChannel(DTS.Common.ISO.LevelTriggerChannel channel)
|
||||
```
|
||||
Populates this object's properties from an ISO `LevelTriggerChannel`. TSR Air High G channels have inverted logic for threshold enablement.
|
||||
|
||||
---
|
||||
|
||||
### Class: `Diagnostics`
|
||||
|
||||
Main class for diagnostic operations and configuration management.
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public Diagnostics()
|
||||
```
|
||||
|
||||
**Public Methods:**
|
||||
|
||||
```csharp
|
||||
public bool Reset(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
Dictionary<string, int> dasSampleRateList,
|
||||
DASHardware[] hardware,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction,
|
||||
DTS.Slice.Users.User currentUser)
|
||||
```
|
||||
Initiates a reset operation. Marks all DAS as unclean, attempts partial connection, and returns `true` if data has never been downloaded, `false` otherwise.
|
||||
|
||||
```csharp
|
||||
public void ContinueReset(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> dasList,
|
||||
Dictionary<string, int> dasSampleRateList,
|
||||
DASHardware[] hardware,
|
||||
StatusHelpers.SetProgressValueDelegate setProgressFunction,
|
||||
DTS.Slice.Users.User currentUser)
|
||||
```
|
||||
Continues the reset process by updating configuration and running diagnostics.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfig(
|
||||
DataModel.TestTemplate currentTest,
|
||||
List<IDASCommunication> ldas,
|
||||
bool clearDiagnostics,
|
||||
DASHardware[] allHardware,
|
||||
DTS.Slice.Users.User currentUser)
|
||||
```
|
||||
Main configuration orchestration method. Sets DAS order indices, builds channel lookups, and configures all DAS devices.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigDAS(
|
||||
IDASCommunication das,
|
||||
DTS.Slice.Users.User currentUser,
|
||||
SortOutConfigParams soParams,
|
||||
ReportErrorsDelegate reportErrors = null)
|
||||
```
|
||||
Configures a single DAS device, iterating through all modules and channels.
|
||||
|
||||
```csharp
|
||||
public static bool SortOutConfigAnalog(
|
||||
AnalogInputDASChannel dasChannel,
|
||||
string key,
|
||||
int moduleChannelNumber,
|
||||
IDASCommunication das,
|
||||
DASHardware h,
|
||||
IDASModule mod,
|
||||
SortOutConfigParams soParams,
|
||||
ReportErrorsDelegate ReportErrors = null)
|
||||
```
|
||||
Configures analog input channels. Returns `false` if calibration cannot be found. Sets extensive properties including sensitivity, engineering units, excitation, level triggers, and IEPE configuration.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigCAN(
|
||||
IDASChannel c,
|
||||
int moduleChannelNumber,
|
||||
SortOutConfigParams soParams)
|
||||
```
|
||||
Configures CAN input channels with FD settings, bitrates, and file type.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigSquib(
|
||||
ref int currentChannelIdx,
|
||||
IDASModule mod,
|
||||
string key,
|
||||
ref int moduleChannelNumber,
|
||||
IDASChannel c,
|
||||
IDASCommunication das,
|
||||
SortOutConfigParams soParams)
|
||||
```
|
||||
Configures squib output channels. Handles both Voltage (VO) and Current (CU) channels as a pair. Throws `NotSupportedException` if both channels are not present.
|
||||
|
||||
```csharp
|
||||
public static void SortOutConfigTOMDigitalChannel(
|
||||
IDASChannel c,
|
||||
string key,
|
||||
int moduleChannelNumber,
|
||||
SortOutConfigParams soParams)
|
||||
```
|
||||
Configures TOM digital output channels with delay, duration, and output mode settings.
|
||||
|
||||
**Delegate:**
|
||||
```csharp
|
||||
public delegate void ReportErrorsDelegate(List<string> errors);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Class: `SortOutConfigParams` (nested in `Diagnostics`)
|
||||
|
||||
Parameter container for configuration operations.
|
||||
|
||||
**Public Members:**
|
||||
| Member | Type | Description |
|
||||
|--------|------|-------------|
|
||||
| `TestTemplate` | `DataModel.TestTemplate` | The test template being configured |
|
||||
| `FilterLookup` | `Dictionary<string, double>` | Lookup for filter settings |
|
||||
| `AllHardware` | `DASHardware[]` | Array of all hardware (setter appears truncated) |
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public int GetHardwareChannelToAbsoluteDisplayOrderCount()
|
||||
public bool ContainsHardwareChannelDisplayOrder(string key)
|
||||
public int GetHardwareChannelAbsoluteDisplayOrder(string key)
|
||||
public int GetMaxAbsoluteDisplayOrder()
|
||||
public void AddGroupChannels(IGroupChannel[] channels)
|
||||
public void SetAbsoluteDisplayOrderFromIndex(string key, IGroupChannel ch)
|
||||
public HardwareChannel GetHardwareChannel(string key)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Channel Key Format**: Channel keys are constructed as `"{DASId}_{ChannelNumber}"` and must be unique within a test setup.
|
||||
|
||||
2. **Squib Channel Pairing**: Squib channels must exist as adjacent pairs (Voltage then Current). The method throws `NotSupportedException` with message "require both VO and CU channels" if the second channel is missing.
|
||||
|
||||
3. **Calibration Requirement**: `SortOutConfigAnalog` returns `false` if no valid calibration can be found for the sensor's supported excitation types.
|
||||
|
||||
4. **TSR Air High G Special Handling**:
|
||||
- Greater-than and less-than threshold triggers are always disabled for TSR Air High G channels
|
||||
- Trigger outside bounds is always enabled for TSR Air High G channels
|
||||
|
||||
5. **IEPE Configuration**: If a channel's IEPE status disagrees with the sensor's bridge type, the system attempts to reprogram the DAS. If reprogramming fails, errors are reported via the `ReportErrors` delegate.
|
||||
|
||||
6. **DAS Inclusion**: DAS devices not part of the current test have all their channels disabled via `DisableChannel()`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `DTS.Common.Classes.Hardware` - `DASHardware`, `HardwareChannel`
|
||||
- `DTS.Common.Interface.DASFactory` - `IDASCommunication`, `IDASModule`, `IDASChannel`
|
||||
- `DTS.Common.Interface.Channels` - Channel interfaces
|
||||
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`, `IGroupChannel`
|
||||
- `DTS.DASLib.Service` - `ConfigurationService`, `ServiceBase`
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger`
|
||||
- `DTS.Slice.Users.UserSettings` - `SerializedSettings`, `Defaults`
|
||||
- `DTS.SensorDB` - `SensorData`, `SensorCalibration`, `SensorModel`
|
||||
- `DTS.Common.Classes.Sensors` - Sensor-related classes
|
||||
- `DTS.Common.Classes.Groups` - `GroupChannel`
|
||||
- `DTS.Common.Enums` - Various enumerations
|
||||
- `DTS.Common.ISO` - ISO-related data structures
|
||||
- `DataPROWin7.Common` - `StatusHelpers`, `ExportTestSetup`
|
||||
|
||||
**What depends on this module:**
|
||||
- Cannot be determined from source alone (no callers visible in this file)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Typo in Property Name**: `IsGreatherThanThresholdEnabled` contains a typo ("Greather" instead of "Greater"). This is part of the public API and cannot be changed without breaking compatibility.
|
||||
|
||||
2. **TSR Air Go Timeout**: The constant `TSRAIRGO_QUERYCONFIG_TIMEOUT` is set to 150000ms (2.5 minutes), which is significantly longer than standard query timeouts.
|
||||
|
||||
3. **Legacy TOM Filter Behavior**: When `SerializedSettings.UseLegacyTOMCFC` is true and sample rate exceeds `TestObjectHelper.TDC_LEGACY_TOM_CUTOFF_SPS`, squib channels use a hardcoded legacy filter frequency (`TestObjectHelper.TDC_LEGACY_TOM_HIGH_FILTER`).
|
||||
|
||||
4. **Filter Class ISO Default**: If `sensor.FilterClassIso` is `"?"`, it is silently replaced with `"P"` (Prefiltered > CFC 1000).
|
||||
|
||||
5. **Squib Description Suffix Handling**: If a squib description ends with ".1", the paired current channel's description is modified to end with ".2".
|
||||
|
||||
6. **Non-Linear Calibration Gain Selection**: For non-linear sensors, the code performs "guesswork" to select an appropriate input range, explicitly noting in comments that it ignores "a whole bunch of problems, like negative or inverted outputs."
|
||||
|
||||
7. **File Truncated**: The source file is truncated mid-method (`SetHard...`), indicating there may be additional public members not visible in the provided source.
|
||||
108
docs/ai/Common/DTS.Common.DataModel/Classes/Export.md
Normal file
108
docs/ai/Common/DTS.Common.DataModel/Classes/Export.md
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Export/ExportHeader.cs
|
||||
- Common/DTS.Common.DataModel/Classes/Export/ExportTestSetup.cs
|
||||
generated_at: "2026-04-17T15:42:08.031759+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ef0e1195e993a581"
|
||||
---
|
||||
|
||||
# Documentation: Export Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data export functionality for test configurations. `ExportHeader` represents a selectable column header for export operations, implementing property change notification for UI binding. `ExportTestSetup` is a static utility class that aggregates test-related entities (tests, groups, sensors, hardware, calibrations, and ISO details) into dictionaries and serializes them to XML format for file export or data transfer.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ExportHeader Class
|
||||
|
||||
**Namespace:** `DataPROWin7.DataModel.Classes.Export`
|
||||
**Implements:** `IExportHeader`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `ExportHeader()` | Initializes a new instance with default values. |
|
||||
| Constructor | `ExportHeader(string headerName)` | Initializes with the specified `headerName`. |
|
||||
| Constructor | `ExportHeader(string headerName, bool isSelected)` | Initializes with `headerName` and `isSelected` state; chains to the headerName constructor. |
|
||||
| Property | `string HeaderName { get; set; }` | Gets or sets the header name; raises `PropertyChanged` on set. |
|
||||
| Property | `bool IsSelected { get; set; }` | Gets or sets selection state; defaults to `false`; raises `PropertyChanged` on set. |
|
||||
| Event | `PropertyChangedEventHandler PropertyChanged` | Event raised when a property value changes. |
|
||||
| Method | `void OnPropertyChanged(string propertyName = null)` | Protected method that invokes the `PropertyChanged` event. |
|
||||
|
||||
---
|
||||
|
||||
### ExportTestSetup Class
|
||||
|
||||
**Namespace:** `DataPROWin7.DataModel.Classes`
|
||||
**Modifiers:** `public static`
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| PrepareForExport | `void PrepareForExport(DataModel.TestTemplate t, Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, IGroup> includedGroups, Dictionary<string, DataModel.DASHardware> includedDAS, Dictionary<string, SensorData> includedSensors, HashSet<int> sensorsAlreadyAdded, Dictionary<string, SensorModel> includedSensorModels, Dictionary<string, SensorCalibration[]> includedCalibration, Dictionary<string, DTS.Common.ISO.CustomerDetails> includedCustomerDetails, Dictionary<string, DTS.Common.ISO.TestEngineerDetails> includedTestEngineerDetails, Dictionary<string, DTS.Common.ISO.LabratoryDetails> includedLabDetails, bool savingRunningTest, bool savingTTSImport)` | Populates the provided dictionaries with all entities referenced by the test template `t`, including sensors, hardware, groups, calibrations, and ISO-related details. Handles embedded and non-embedded groups. |
|
||||
| ExportToFile | `string ExportToFile(Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, IGroup> includedGroups, Dictionary<string, DataModel.DASHardware> includedDAS, Dictionary<string, SensorData> includedSensors, Dictionary<string, SensorModel> includedSensorModels, Dictionary<string, SensorCalibration[]> includedCalibration, Dictionary<string, DTS.Common.ISO.CustomerDetails> includedCustomerDetails, Dictionary<string, DTS.Common.ISO.TestEngineerDetails> includedTestEngineerDetails, Dictionary<string, DTS.Common.ISO.LabratoryDetails> includedLabDetails, Dictionary<string, DTS.Slice.Users.User> includedUsers, Dictionary<string, string> includedGlobalSettings, string exportFile, string originalImportFile, bool bUseFirstUseDate = true)` | Serializes all provided dictionaries to XML format using `TopLevelFields` enum ordering. Returns the XML string; writes to `exportFile` if non-null. Returns empty string on exception. |
|
||||
| PrepareForExportFields | `void PrepareForExportFields(DataModel.TestTemplate t, Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, DataModel.DASHardware> includedDAS)` | Simplified preparation that only extracts tests and DAS hardware; does not process sensors, calibrations, or ISO details. Removes DAS entries from `t.DASSampleRateList` if not in `includedDAS`. |
|
||||
| ExportToFileFields | `string ExportToFileFields(Dictionary<string, DataModel.TestTemplate> includedTests, Dictionary<string, DataModel.DASHardware> includedDAS, string originalImportFile)` | Simplified export that only writes `DASList` and `TestSetups` elements to XML. Returns empty string on exception. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Dictionary Key Uniqueness:** All `included*` dictionary parameters must use unique keys appropriate to their type (e.g., `SerialNumber` for sensors/hardware, `Name` for tests/groups/customers).
|
||||
- **Thread Affinity:** `PrepareForExport` and `PrepareForExportFields` access `Application.Current.Dispatcher` for retrieving non-embedded groups; they handle both UI thread and background thread scenarios via `CheckAccess()` and `ManualResetEvent`.
|
||||
- **Sensor Deduplication:** `sensorsAlreadyAdded` (a `HashSet<int>`) is used to prevent duplicate sensor entries across multiple groups or channels within a single export operation.
|
||||
- **Calibration Exclusion:** Sensors flagged as `IsTestSpecificDigitalOutput`, `IsTestSpecificSquib`, or `IsTestSpecificDigitalIn` are excluded from `includedCalibration` but still added to `includedSensors`.
|
||||
- **XML Element Ordering:** `ExportToFile` and `ExportToFileFields` iterate over `TopLevelFields` enum values, ensuring consistent element ordering in output XML.
|
||||
- **Static Group Validation:** If an embedded group's `StaticGroupId` references a non-existent or mismatched static group, `embeddedGroup.StaticGroupId` is set to `null` and processing continues.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Imports (this module depends on):
|
||||
|
||||
| Namespace | Purpose |
|
||||
|-----------|---------|
|
||||
| `DTS.Common.Interface.ExportData` | `IExportHeader` interface |
|
||||
| `DTS.Common.Interface.Groups.GroupList` | `IGroup`, `IGroupListViewModel` |
|
||||
| `DTS.SensorDB` | `SensorsCollection`, `SensorData`, `SensorCalibration`, `SensorModel`, `SensorModelCollection` |
|
||||
| `DTS.Common.Interface.Sensors` | `ISensorData` |
|
||||
| `DTS.Common.Interface.Channels` | `IGroupChannel` |
|
||||
| `DTS.Common.Interface.DataRecorders` | `IDASHardware` |
|
||||
| `DTS.Common.Storage` | `DbOperations` |
|
||||
| `DTS.Common.ISO` | `CustomerDetails`, `TestEngineerDetails`, `LabratoryDetails`, `Hardware` |
|
||||
| `DTS.Common.Utils` | `FileUtils` |
|
||||
| `DTS.Common.Utilities.Logging` | `APILogger` |
|
||||
| `DTS.Common.Enums.DBExport` | `TopLevelFields` enum |
|
||||
| `DTS.Slice.Users` | `User` class |
|
||||
| `Prism.Ioc` | `ContainerLocator` |
|
||||
| `Unity` | `IUnityContainer` |
|
||||
| `System.Windows` | `Application` for dispatcher access |
|
||||
| `System.Xml` | `XmlWriter` for XML serialization |
|
||||
| `System.ComponentModel` | `INotifyPropertyChanged` pattern |
|
||||
|
||||
### Dependents (inferred):
|
||||
|
||||
- Callers of `ExportTestSetup.PrepareForExport*` and `ExportTestSetup.ExportToFile*` methods (exact modules unclear from source alone).
|
||||
- Consumers of `ExportHeader` for UI data binding scenarios.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Unused Parameter:** The `savingRunningTest` parameter in `PrepareForExport` is never referenced in the method body. Its intended purpose is unclear from source alone.
|
||||
|
||||
2. **Dispatcher Blocking:** Both `PrepareForExport` and `PrepareForExportFields` use `ManualResetEvent.WaitOne()` to block when called from a non-UI thread while waiting for dispatcher operations. This could cause deadlocks if the UI thread is blocked waiting on the calling thread.
|
||||
|
||||
3. **Namespace Mismatch:** The namespace `DataPROWin7.DataModel.Classes.Export` and `DataPROWin7.DataModel.Classes` suggests legacy naming (referencing "Win7") that may not reflect current platform targets.
|
||||
|
||||
4. **Partial Export Handling:** `ExportToFileFields` does not write to a file despite accepting `originalImportFile`; it only returns the XML string. Contrast with `ExportToFile` which writes to `exportFile` when non-null.
|
||||
|
||||
5. **Null Return Ambiguity:** `GetDAS` returns `null` if no matching DAS is found in `dasList`. Callers do not appear to null-check the result before accessing properties (e.g., `h.SerialNumber`), which could cause `NullReferenceException`.
|
||||
|
||||
6. **Early Exit in PrepareForExport:** The method returns early if `!savingTTSImport`, skipping the final loop that adds all sensors with calibrations. This conditional behavior may be unexpected.
|
||||
|
||||
7. **Empty Calibration Handling:** When `SensorCalibration.GetCalibrationsBySerialNumber` returns null or empty, the sensor is still added to `includedSensors` but calibration data is omitted. A `Trace.WriteLine` diagnostic is emitted in one code path but not others.
|
||||
173
docs/ai/Common/DTS.Common.DataModel/Classes/Hardware.md
Normal file
173
docs/ai/Common/DTS.Common.DataModel/Classes/Hardware.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/Hardware/DASSettings.cs
|
||||
- Common/DTS.Common.DataModel/Classes/Hardware/DASHardwareList.cs
|
||||
- Common/DTS.Common.DataModel/Classes/Hardware/BatteryAndInputVoltageDefaults.cs
|
||||
generated_at: "2026-04-17T15:37:11.649380+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c98b9bdc3b18b6bf"
|
||||
---
|
||||
|
||||
# Hardware Data Model Documentation
|
||||
|
||||
## Purpose
|
||||
|
||||
This module provides the data model layer for Data Acquisition System (DAS) hardware management within the DTS system. It encompasses three distinct concerns: `DASSettings` captures test-specific DAS configuration parameters (sample rates, trigger timing, voltage thresholds) for serialization into `tblTestSetupDASSettings`; `DASHardwareList` serves as a singleton registry for DAS hardware instances with caching and database persistence operations; and `DasBatteryInputSettings`/`InputAndBatterySettings` manage hardware-type-specific battery and input voltage threshold defaults with serialization support.
|
||||
|
||||
---
|
||||
|
||||
## Public Interface
|
||||
|
||||
### DASSettings (DataPROWin7.DataModel)
|
||||
|
||||
**Constructors:**
|
||||
- `DASSettings()` — Default parameterless constructor.
|
||||
- `DASSettings(DASSettings setting)` — Copy constructor that clones all property values from another instance.
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `DASSerialNumber` | `string` | Serial number identifier for the DAS unit. |
|
||||
| `SampleRate` | `double` | Data acquisition sample rate. |
|
||||
| `ExcitationWarmupTimeMS` | `int` | Excitation warmup time in milliseconds. |
|
||||
| `HardwareAAF` | `double` | Hardware Anti-Aliasing Filter setting. |
|
||||
| `PreTriggerSeconds` | `double` | Pre-trigger duration in seconds. |
|
||||
| `PostTriggerSeconds` | `double` | Post-trigger duration in seconds. |
|
||||
| `StatusLineCheck` | `bool` | Flag indicating whether status line checking is enabled. |
|
||||
| `BatteryCheck` | `bool` | Flag indicating whether battery checking is enabled. |
|
||||
| `InputVoltageMin` | `double` | Minimum input voltage threshold. |
|
||||
| `InputVoltageMax` | `double` | Maximum input voltage threshold. |
|
||||
| `BatteryVoltageMin` | `double` | Minimum battery voltage threshold. |
|
||||
| `BatteryVoltageMax` | `double` | Maximum battery voltage threshold. |
|
||||
|
||||
---
|
||||
|
||||
### DASHardwareList (DataPROWin7.DataModel.Classes.Hardware)
|
||||
|
||||
**Static Properties:**
|
||||
- `Cache` (`bool`) — Enables/disables cached data mode. Setting to `false` clears `_cachedDASHardware`.
|
||||
|
||||
**Static Methods:**
|
||||
- `DASHardwareList GetList()` — Returns the singleton instance, creating it if necessary.
|
||||
- `DASHardware[] GetAllHardware()` — Retrieves all DAS hardware, using cache if `Cache` is `true`.
|
||||
- `List<int> GetEmbeddedModules(IDASHardware[] hardware, int id)` — Returns module IDs for embedded hardware matching the given DAS ID.
|
||||
- `Dictionary<string, double> GetEmbeddedModuleInfo(DASHardware[] hardware, int id)` — Returns a dictionary of serial number to max sample rate for embedded modules.
|
||||
- `void UnassociateParentDAS(string distributorSerialNumber)` — Calls stored procedure `sp_DASChildrenUnAssociate` to unassociate child DAS units from a parent.
|
||||
|
||||
**Instance Methods:**
|
||||
- `void ReloadAll()` — Intended to repopulate hardware (currently commented out).
|
||||
- `void SetCache(ICachedContainer container)` — Sets an `ICachedContainer` for hardware caching.
|
||||
- `void ClearCache()` — Clears the `_cachedHardware` reference.
|
||||
- `string GetDASSerialNumberFromId(int id)` — Queries database for serial number by DAS ID using `DbOperations.DASGet`.
|
||||
- `DASHardware GetHardware(int id)` — Retrieves hardware by integer ID.
|
||||
- `DASHardware GetHardware(string id, bool bUseCache = true)` — Retrieves hardware by serial number string.
|
||||
- `DASHardware[] GetHardware(string[] ids, bool bUseCache = true)` — Retrieves multiple hardware instances by serial number array.
|
||||
- `DASHardware GetHardware(string id, bool bThrowExceptionIfChanged, out bool changed, bool bUseCache = true)` — Full retrieval method with change detection output parameter.
|
||||
- `DASHardware GetHardware(string serialNumber, string ipaddress)` — Retrieves hardware by serial number (ipaddress parameter is unused).
|
||||
- `void UpdateMaxMemory(DASHardware h, long newMaxMemory)` — Updates the `MaxMemory` property and persists to database.
|
||||
- `DASHardware GetPrototypeHardware(string serial, int type)` — Retrieves prototype hardware using `DbOperations.DAS.PROTOTYPE_POSITION`.
|
||||
- `void Commit(DASHardware hardware, bool bExisting = false, bool bCheckExisting = true, bool Unassociate = true)` — Persists hardware to database via `DTS.Common.ISO.Hardware` insertion or update.
|
||||
- `void Delete(IHardware hardware)` — Deletes hardware implementing `IISOHardware`.
|
||||
- `void Delete(DASHardware hardware)` — Deletes a `DASHardware` instance, unassociating children if pseudo-rack.
|
||||
- `void Delete(IHardware[] hardware)` — Batch delete for `IHardware` array.
|
||||
- `void Delete(DASHardware[] hardware)` — Batch delete for `DASHardware` array.
|
||||
|
||||
**Nested Types:**
|
||||
- `HardwareTypeChangedException` — Inner exception class extending `Exception`.
|
||||
- `enum Tags` — Contains `Hardware` value for property change notification.
|
||||
|
||||
---
|
||||
|
||||
### DasBatteryInputSettings (DataPROWin7.DataModel.BatteryAndInputVoltageDefaults)
|
||||
|
||||
**Nested Enum:**
|
||||
- `Settings` — Enum defining 16 threshold types. **Order is significant for serialization.**
|
||||
|
||||
**Constructors:**
|
||||
- `DasBatteryInputSettings(string s)` — Deserializes from comma-separated string; parses values in enum order.
|
||||
- `DasBatteryInputSettings(DasBatteryInputSettings copy)` — Copy constructor.
|
||||
- `DasBatteryInputSettings()` — Default constructor initializing all thresholds to hardcoded defaults.
|
||||
|
||||
**Properties:**
|
||||
All 16 properties corresponding to `Settings` enum values, typed as `double`:
|
||||
- `BatteryLowDiagnosticsThreshold`, `BatteryHighDiagnosticsThreshold`
|
||||
- `BatteryLowArmedThreshold`, `BatteryHighArmedThreshold`
|
||||
- `InputLowDiagnosticsThreshold`, `InputHighDiagnosticsThreshold`
|
||||
- `InputLowArmedThreshold`, `InputHighArmedThreshold`
|
||||
- `MinimumValidBatteryThreshold`, `MinimumValidInputThreshold`
|
||||
- `MaximumValidBatteryThreshold`, `MaximumValidInputThreshold`
|
||||
- `BatteryMediumDiagnosticsThreshold`, `BatteryMediumArmedThreshold`
|
||||
- `InputMediumDiagnosticsThreshold`, `InputMediumArmedThreshold`
|
||||
|
||||
**Instance Methods:**
|
||||
- `string ToSerializedString()` — Serializes all settings to comma-separated string using invariant culture.
|
||||
- `double GetValue(Settings setting)` — Retrieves value from `SettingsProperty` dictionary.
|
||||
- `void SetValue(Settings setting, double d)` — Sets value in `SettingsProperty` dictionary.
|
||||
|
||||
---
|
||||
|
||||
### InputAndBatterySettings (Static Class)
|
||||
|
||||
**Static Methods:**
|
||||
- `void ClearCache()` — Clears the internal `_cache` dictionary.
|
||||
- `double GetValue(string DasType, DasBatteryInputSettings.Settings setting)` — Gets threshold value by DAS type string.
|
||||
- `double GetValue(HardwareTypes type, DasBatteryInputSettings.Settings setting)` — Gets threshold value by `HardwareTypes` enum.
|
||||
- `DasBatteryInputSettings GetDefaultSettingForHWType(HardwareTypes type)` — Returns default settings for hardware type, caching if `RunTestVariables.InRunTest` and `RunTestVariables.CacheVoltageSettingsInRunTest` are true.
|
||||
- `DasBatteryInputSettings GetSettingForHWType(HardwareTypes type)` — Returns current settings for hardware type from `Common.SerializedSettings`.
|
||||
- `void SetSettingForHWType(HardwareTypes type, DasBatteryInputSettings setting)` — Persists settings to `Common.SerializedSettings` for the specified hardware type.
|
||||
|
||||
---
|
||||
|
||||
## Invariants
|
||||
|
||||
1. **DASSettings**: All property setters use `SetProperty` from `BasePropertyChanged`, implying property change notification is raised on every assignment regardless of value equality.
|
||||
|
||||
2. **DASHardwareList Singleton**: The `GetList()` method returns a lazily-initialized singleton. The `_list` field is never reset to null except implicitly by the runtime.
|
||||
|
||||
3. **DASHardwareList Cache Consistency**: When `Cache` is set to `false`, `_cachedDASHardware` is cleared. The `_cachedHardware` (instance) and `_cachedDASHardware` (static) are separate caching mechanisms.
|
||||
|
||||
4. **DasBatteryInputSettings Serialization Order**: The `Settings` enum order must remain unchanged; serialization/deserialization relies on enum integer values as array indices.
|
||||
|
||||
5. **Hardware Type Mapping**: Multiple `HardwareTypes` values map to the same settings (e.g., `SLICE2_SIM` and `SLICE2_Base` share settings; `TDAS_Pro_Rack` and `TDAS_LabRack` share settings).
|
||||
|
||||
6. **Commit Versioning**: When updating existing hardware, `h.Version` is incremented by 1 before calling `Update()`.
|
||||
|
||||
---
|
||||
|
||||
## Dependencies
|
||||
|
||||
### Direct Dependencies (Imports):
|
||||
|
||||
| Module | Depends On |
|
||||
|--------|------------|
|
||||
| `DASSettings` | `DTS.Common.Base` (`BasePropertyChanged`) |
|
||||
| `DASHardwareList` | `DTS.Common.Base`, `DTS.Common.DataModel`, `DTS.Common.Interface.DASFactory.Diagnostics`, `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList`, `DTS.Common.Interface.DataRecorders`, `DTS.Common.Storage`, `System.Windows`, `DataPROWin7.DataModel.Classes.TestTemplate` |
|
||||
| `BatteryAndInputVoltageDefaults` | `DTS.Common.Enums`, `DTS.Common.Enums.Hardware`, `System.Configuration` |
|
||||
|
||||
### External System Dependencies:
|
||||
- `DbOperations` — Database access layer for DAS queries and stored procedures.
|
||||
- `DTS.Common.ISO.Hardware` — ISO hardware abstraction for persistence operations.
|
||||
- `Common.SerializedSettings` — Persistent settings storage for battery/input thresholds.
|
||||
- `RunTestVariables` — Runtime configuration flags (`InRunTest`, `CacheVoltageSettingsInRunTest`).
|
||||
- `ApplicationProperties.CurrentUser` — Current user context for audit fields.
|
||||
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
1. **DASHardwareList.GetHardware(string, string) Ignores IP Address**: The `ipaddress` parameter in `GetHardware(string serialNumber, string ipaddress)` is passed but never used—the method simply calls `GetHardware(serialNumber)`.
|
||||
|
||||
2. **ReloadAll() is a No-Op**: The `ReloadAll()` method body is entirely commented out. Calling it has no effect.
|
||||
|
||||
3. **Cache Flag Scope Confusion**: `DASHardwareList` has two separate caching mechanisms—static `Cache` property controls `_cachedDASHardware`, while instance method `SetCache` controls `_cachedHardware`. These operate independently.
|
||||
|
||||
4. **Hardware Type Settings Fallthrough**: In `GetSettingForHWType`, several hardware types (e.g., `DIM`, `SIM`, `TOM`, `Ribeye`, `SLICE_Base`) fall through to defaults with comments indicating they're "not expected" to reach that code path. This may mask configuration errors.
|
||||
|
||||
5. **GetHardware ID Parsing**: When using `_cachedHardware`, the `id` parameter is split on underscore (`tokens = id.Split('_')`) and only `tokens[0]` is used. This implies IDs may contain additional underscore-delimited metadata.
|
||||
|
||||
6. **Commit Order Dependency for SLICE6Db**: The comment in `Commit()` notes that when committing hardware groups containing SLICE6Db, the parent must be committed before children to avoid association issues.
|
||||
|
||||
7. **Prototype Hardware CalDate Reset**: `GetPrototypeHardware` explicitly sets `CalDate = DateTime.MinValue` for prototypes, which may affect calibration status checks elsewhere.
|
||||
|
||||
8. **DasBatteryInputSettings Default Constructor Throws on Unknown**: The default constructor's switch statement throws `NotSupportedException` for any enum value not explicitly handled, making it fragile to enum extensions.
|
||||
39
docs/ai/Common/DTS.Common.DataModel/Classes/TSRAIRGo.md
Normal file
39
docs/ai/Common/DTS.Common.DataModel/Classes/TSRAIRGo.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TSRAIRGo/TSRAIRGoStatus.cs
|
||||
generated_at: "2026-04-17T16:44:00.741985+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b413c3f7dc7c89c9"
|
||||
---
|
||||
|
||||
# Documentation: TSRAIRGoStatus.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines the `TSRAIRGoStatus` class, which serves as a container for the `StatusTypes` enum. This enum represents the complete lifecycle states for a TSRAIRGo hardware device (likely a Data Acquisition System or "DAS"), covering hardware discovery, connection establishment, health validation, arming/streaming operations, and data retrieval. It exists to provide a standardized, localized set of status codes that can be displayed to users via resource lookup keys.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `TSRAIRGoStatus`
|
||||
- **Namespace:** `DTS.Common.DataModel.Classes.TSRAIRGo`
|
||||
- **Description:** A non-inheritable container class (implicit sealed) that exposes a single nested enum. The class itself has no instance members or methods.
|
||||
|
||||
### Enum: `TSRAIRGoStatus.StatusTypes`
|
||||
- **Signature:** `public enum StatusTypes`
|
||||
- **Type Converter:** `EnumDescriptionTypeConverterShared` (applied via `[TypeConverter]` attribute)
|
||||
- **Description:** Defines 49 discrete status states for TSRAIRGo device lifecycle management. Each value (except three noted below) is decorated with a `[Description]` attribute containing a resource lookup key for UI localization.
|
||||
|
||||
**Enum Values (grouped by operational domain):**
|
||||
|
||||
| Value | Description Attribute | Notes |
|
||||
|-------|----------------------|-------|
|
||||
| **Discovery/Connection** | | |
|
||||
| `UNKNOWN` | `"Table_NA"` | Default/unknown state |
|
||||
| `PING_FAILED` | `"HardwareDiscoveryControl_PingFailed"` | |
|
||||
| `PINGING` | `"AutoDetectDASControl_Pinging"` | |
|
||||
| `PING_SUCCESS` | `"AutoDetectDASControl_Ping_Good"` | |
|
||||
| `CONNECT_FAILED` | `"HardwareDiscoveryControl_FailedToConnect"` | |
|
||||
| `CONNECTING` | `"AutoDetectDASControl_Connecting"` | |
|
||||
| `QUERY_FAILED` | `"AutoDetectDASControl_QueryFailed"` | |
|
||||
| `
|
||||
59
docs/ai/Common/DTS.Common.DataModel/Classes/TestMetaData.md
Normal file
59
docs/ai/Common/DTS.Common.DataModel/Classes/TestMetaData.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TestMetaData/CustomerDetails.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestMetaData/LabratoryDetails.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestMetaData/TestEngineerDetails.cs
|
||||
generated_at: "2026-04-17T15:40:07.281803+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cadfbac004011276"
|
||||
---
|
||||
|
||||
# Documentation: Test Metadata Data Models
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides UI-facing data model wrappers for test metadata entities—`CustomerDetails`, `LabratoryDetails`, and `TestEngineerDetails`—that encapsulate underlying `DTS.Common.ISO` data objects. These classes implement property change notification via `BasePropertyChanged` to support WPF data binding, track modification state through a `_blank` flag, and expose static list management classes for CRUD operations against the ISO persistence layer. The module serves as an adapter between raw ISO data objects and the presentation layer.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `CustomerDetails` (class, inherits `BasePropertyChanged`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Fields` | `public enum Fields` | Enum values: `Name`, `CustomerName`, `CustomerTestRefNumber`, `ProjectRefNumber`, `CustomerOrderNumber`, `CustomerCostUnit` |
|
||||
| `Name` | `public string Name { get; set; }` | Gets/sets `_customerDetails.Name`; sets `_blank = false` on set; raises `OnPropertyChanged` |
|
||||
| `CustomerName` | `public string CustomerName { get; set; }` | Gets/sets `_customerDetails.CustomerName` |
|
||||
| `CustomerTestRefNumber` | `public string CustomerTestRefNumber { get; set; }` | Gets/sets `_customerDetails.CustomerTestRefNumber` |
|
||||
| `ProjectRefNumber` | `public string ProjectRefNumber { get; set; }` | Gets/sets `_customerDetails.ProjectRefNumber` |
|
||||
| `CustomerOrderNumber` | `public string CustomerOrderNumber { get; set; }` | Gets/sets `_customerDetails.CustomerOrderNumber` |
|
||||
| `CustomerCostUnit` | `public string CustomerCostUnit { get; set; }` | Gets/sets `_customerDetails.CustomerCostUnit` |
|
||||
| `LocalOnly` | `public bool LocalOnly { get; }` | Returns `_customerDetails.LocalOnly` |
|
||||
| `LastModified` | `public DateTime LastModified { get; }` | Returns `_customerDetails.LastModified` |
|
||||
| `LastModifiedBy` | `public string LastModifiedBy { get; }` | Returns `_customerDetails.LastModifiedBy` |
|
||||
| `Version` | `public int Version { get; }` | Returns `_customerDetails.Version` |
|
||||
| `IsBlank` | `public bool IsBlank()` | Returns `_blank` field |
|
||||
| `HasBlankName` | `public bool HasBlankName()` | Returns `true` if `Name == StringResources.TestTemplate_EmptyListName` |
|
||||
| `CustomerDetails()` | `public CustomerDetails()` | Default constructor; initializes new `DTS.Common.ISO.CustomerDetails` with `Name` set to `StringResources.TestTemplate_EmptyListName` |
|
||||
| `CustomerDetails(DTS.Common.ISO.CustomerDetails)` | `public CustomerDetails(DTS.Common.ISO.CustomerDetails customerDetails)` | Copy constructor; sets `_blank = false` |
|
||||
| `GetISOCustomer` | `public DTS.Common.ISO.CustomerDetails GetISOCustomer()` | Returns the wrapped ISO object |
|
||||
| `ToString` | `public override string ToString()` | Returns `Name` |
|
||||
|
||||
### `CustomerDetailsList` (class, inherits `BasePropertyChanged`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Delete` | `public static void Delete(CustomerDetails customer)` | Calls `customer.GetISOCustomer().Delete(ApplicationProperties.CurrentUser.UserName)` |
|
||||
| `Delete` | `public static void Delete(CustomerDetails[] customers)` | Iterates and calls `Delete` on each |
|
||||
| `GetAllCustomers` | `public static CustomerDetails[] GetAllCustomers()` | Retrieves all customers via `DTS.Common.ISO.CustomerDetails.GetAllCustomerDetails()`, wraps them, sorts by `Name` (ordinal comparison) |
|
||||
| `DeleteAll` | `public static void DeleteAll()` | Calls `DTS.Common.ISO.CustomerDetails.DeleteCustomerDetails()` |
|
||||
| `GetCustomerDetail` | `public static CustomerDetails GetCustomerDetail(string name)` | Returns `null` if name is null/empty; otherwise retrieves via `DTS.Common.ISO.CustomerDetails.GetCustomerDetails(name)` |
|
||||
| `AddCustomer` | `public static void AddCustomer(CustomerDetails customer)` | Calls `customer.GetISOCustomer().Commit(ApplicationProperties.CurrentUser.UserName)` |
|
||||
|
||||
### `LabratoryDetails` (class, inherits `BasePropertyChanged`)
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Tags` | `public enum Tags` | Enum values: `LabratoryName`, `Labr
|
||||
161
docs/ai/Common/DTS.Common.DataModel/Classes/TestObject.md
Normal file
161
docs/ai/Common/DTS.Common.DataModel/Classes/TestObject.md
Normal file
@@ -0,0 +1,161 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TemplateChannelUI.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestObjectTemplateCollection.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestObjectList.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestTestObject.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestObject/TestObjectTemplate.cs
|
||||
generated_at: "2026-04-17T15:35:53.685336+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "03815d4f910aa842"
|
||||
---
|
||||
|
||||
# Test Object Data Model Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data model layer for managing test objects and their templates within the DataPRO/DTS system. It implements a hierarchy of classes that handle test object configuration, template management with channel definitions, and the relationship between test objects and their associated templates. The module supports both standalone test object definitions and test-specific variants (`TestTestObject`) that include additional runtime settings such as position assignments, timing parameters (excitation warmup, pre/post trigger), and the ability to convert templates to embedded copies for test isolation.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### TemplateChannelUI
|
||||
|
||||
A GUI wrapper class for template channels, providing property change notification for UI binding.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TemplateChannelUI(DTS.Common.ISO.TestObjectTemplateChannel channel)` | Initializes the wrapper with an ISO template channel |
|
||||
| Channel | `DTS.Common.ISO.TestObjectTemplateChannel Channel { get; set; }` | Gets or sets the wrapped ISO template channel, raising property change notifications |
|
||||
|
||||
### TestObjectTemplateCollection
|
||||
|
||||
A singleton collection manager for test object templates.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| TemplateCollection | `static TestObjectTemplateCollection TemplateCollection { get; }` | Lazy-initialized singleton instance accessor |
|
||||
| SysBuiltTestObjectTemplate | `TestObjectTemplate SysBuiltTestObjectTemplate { get; }` | Returns a static readonly system-built template |
|
||||
| GetTemplate | `TestObjectTemplate GetTemplate(string templateId)` | Retrieves a template by ID from the ISO database; returns `null` if not found |
|
||||
|
||||
### TestObjectList
|
||||
|
||||
A thread-safe singleton list that holds test object groups.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| TestObjectsList | `static TestObjectList TestObjectsList { get; }` | Thread-safe singleton instance accessor using lock pattern |
|
||||
| Add | `void Add(TestObject to, bool bNotify)` | Adds a test object, sets `LastModifiedBy` to current user, sets `LastModified` to `DateTime.Now`, commits the object, and optionally notifies listeners |
|
||||
| UpdateAll | `void UpdateAll()` | Raises `OnPropertyChanged("TestObjects")` to notify all listeners |
|
||||
| Tags | `enum Tags { TestObjects }` | Tag enumeration for property change notification |
|
||||
|
||||
### TestTestObject
|
||||
|
||||
A test object belonging to a test, with test-specific settings. Inherits from `TestObject` and implements `IComparable<TestTestObject>`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TestTestObject(TestObject obj)` | Creates from a base `TestObject` |
|
||||
| Constructor | `TestTestObject(TestTestObject obj)` | Copy constructor with metadata |
|
||||
| Constructor | `TestTestObject(TestTestObject obj, bool convertToEmbedded)` | Copy constructor with optional embedded conversion and metadata |
|
||||
| Constructor | `TestTestObject(TestObject obj, bool convertToEmbedded)` | Creates with optional embedded template conversion |
|
||||
| Position | `DTS.Common.ISO.MMEPositions Position { get; set; }` | Gets or sets the group position; setting cascades position to all required sensors with serial numbers |
|
||||
| TestObject | `DTS.Common.ISO.MMETestObjects TestObject { get; set; }` | Gets or sets the ISO test object reference; cascades to all sensors |
|
||||
| ExcitationWarmupTimeMS | `int ExcitationWarmupTimeMS { get; set; }` | Excitation warmup time in milliseconds |
|
||||
| TargetSampleRate | `double TargetSampleRate { get; set; }` | Target sample rate |
|
||||
| PreTriggerSeconds | `double PreTriggerSeconds { get; set; }` | Pre-trigger duration in seconds |
|
||||
| PostTriggerSeconds | `double PostTriggerSeconds { get; set; }` | Post-trigger duration in seconds |
|
||||
| GroupPositionComboBoxVisible | `Visibility GroupPositionComboBoxVisible { get; set; }` | Controls visibility of position combo box |
|
||||
| GroupPositionButtonVisible | `Visibility GroupPositionButtonVisible { get; set; }` | Controls visibility of position button |
|
||||
| AvailablePositions | `DTS.Common.ISO.MMEPositions[] AvailablePositions { get; }` | Gets available positions from ISO database |
|
||||
| AvailableGroupPositions | `DTS.Common.ISO.MMEPositions[] AvailableGroupPositions { get; }` | Gets positions including synthetic "(channel defaults)" entry |
|
||||
| AddedGroups | `TestObject[] AddedGroups { get; set; }` | Array of added test object groups |
|
||||
| ChannelTypes | `string[] ChannelTypes { get; }` | Gets unique channel types including "(no channels)" placeholder |
|
||||
| DisplayOrder | `int DisplayOrder { get; set; }` | Sort order, defaults to -1 |
|
||||
| IsAdd | `bool IsAdd { get; set; }` | Flag indicating add operation |
|
||||
| SetTestObject | `void SetTestObject(string s)` | Sets internal test object string and raises property change |
|
||||
| SetPosition | `void SetPosition(string s)` | Sets internal position string and updates visibility states |
|
||||
| Rename | `void Rename(string oldName, string newName)` | Renames serial number, original serial number, original template, test setup name, and generates new GUID-based template names |
|
||||
| CompareTo | `int CompareTo(TestTestObject other)` | Compares by `DisplayOrder`, falling back to base comparison on tie |
|
||||
| ChannelDefaultsKey | `const string ChannelDefaultsKey = "#"` | Key for channel defaults position |
|
||||
| UserSetKey | `const string UserSetKey = "@"` | Key for user-set position |
|
||||
|
||||
### TestObjectTemplate
|
||||
|
||||
A template definition for test objects with channel configurations. Implements `IComparable<TestObjectTemplate>`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TestObjectTemplate()` | Default constructor; initializes empty strings and first available test object |
|
||||
| Constructor | `TestObjectTemplate(DTS.Common.ISO.TestObjectTemplate template, ref ISO13499FileDb db)` | Creates from ISO template |
|
||||
| Constructor | `TestObjectTemplate(DTS.Common.ISO.TestObjectTemplate template, ref ISO13499FileDb db, List<MMETestObjects> testObjects)` | Creates from ISO template with provided test objects list |
|
||||
| Constructor | `TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)` | Copy constructor |
|
||||
| TemplateName | `string TemplateName { get; set; }` | Template name identifier |
|
||||
| TemplateDescription | `string TemplateDescription { get; set; }` | Human-readable description |
|
||||
| TemplateParent | `string TemplateParent { get; set; }` | Parent template reference |
|
||||
| TestObject | `MMETestObjects TestObject { get; set; }` | Associated ISO test object; setting updates available test object types |
|
||||
| TestObjectType | `string TestObjectType { get; set; }` | Type of test object; setting rebuilds all channels from database |
|
||||
| TestObjectTypeIndex | `int TestObjectTypeIndex { get; set; }` | Index into `AvailableTestObjectTypes` |
|
||||
| AvailableTestObjectTypes | `string[] AvailableTestObjectTypes { get; set; }` | Available types for the current test object |
|
||||
| TemplateAllChannels | `TestObjectTemplateChannel[] TemplateAllChannels { get; set; }` | All template channels (wraps UI channels) |
|
||||
| TemplateAllUIChannels | `TemplateChannelUI[] TemplateAllUIChannels { get; set; }` | UI-wrapped channel collection |
|
||||
| RequiredChannels | `List<TestObjectTemplateChannel> RequiredChannels { get; set; }` | List of required channels |
|
||||
| Embedded | `bool Embedded { get; set; }` | Whether template is embedded; syncs with underlying ISO template |
|
||||
| OriginalTemplateName | `string OriginalTemplateName { get; set; }` | Original name for embedded templates |
|
||||
| SysBuilt | `bool SysBuilt { get; set; }` | System-built flag |
|
||||
| IsLocalOnly | `bool IsLocalOnly { get; set; }` | Local-only flag |
|
||||
| LastModifiedBy | `string LastModifiedBy { get; set; }` | User who last modified; defaults to "N/A" |
|
||||
| LastModified | `DateTime LastModified { get; set; }` | Last modification timestamp; defaults to `SqlDateTime.MinValue` |
|
||||
| MarkChanged | `void MarkChanged(string tag)` | Raises property change for specified tag |
|
||||
| AssignOrders | `void AssignOrders()` | Assigns display orders to channels with -1 order |
|
||||
| ToISOTestObjectTemplate | `DTS.Common.ISO.TestObjectTemplate ToISOTestObjectTemplate()` | Converts to ISO template object |
|
||||
| CompareTo | `int CompareTo(TestObjectTemplate rhs)` | Compares by `TemplateName` using ordinal comparison |
|
||||
| ToString | `override string ToString()` | Returns `OriginalTemplateName` if embedded, otherwise `TemplateName` |
|
||||
| ReadXML | `static DTS.Common.ISO.TestObjectTemplate ReadXML(System.Xml.XmlElement root, Dictionary<long, MMEPossibleChannels> importChannels)` | Reads template from XML element |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Singleton Access**: `TestObjectTemplateCollection.TemplateCollection` and `TestObjectList.TestObjectsList` must be accessed through their static properties, never instantiated directly.
|
||||
- **Position Keys**: `TestTestObject._position` must be either `"#"` (channel defaults), `"@"` (user-set), or a valid position string from `AvailablePositions`.
|
||||
- **Embedded Template Names**: When a template is converted to embedded (`convertToEmbedded = true`), both `TemplateName` and `SerialNumber` are replaced with `Guid.NewGuid().ToString()`.
|
||||
- **Display Order Assignment**: Channels with `DisplayOrder == -1` are considered unassigned and will be assigned incremental orders starting from the current maximum + 1.
|
||||
- **Thread Safety**: `TestObjectList` uses a lock object for singleton access; `TestObjectTemplateCollection` uses `volatile` keyword but no lock.
|
||||
- **Property Synchronization**: Setting `Embedded` or `OriginalTemplateName` on `TestObjectTemplate` also sets the value on the underlying `_template` object if not null.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Base` - `BasePropertyChanged` base class for property change notification
|
||||
- `DTS.Common.ISO` - ISO 13499 data types including `TestObjectTemplateChannel`, `TestObjectTemplate`, `TestObject`, `MMEPositions`, `MMETestObjects`, `MMEPossibleChannels`, `ISO13499FileDb`
|
||||
- `DTS.Common.Utilities.Logging` - Logging utilities
|
||||
- `DTS.Common.DataModel` - Additional data model components
|
||||
- `System.Windows` - `Visibility` enum for UI state management
|
||||
- `System.Xml` - XML serialization support
|
||||
- `System.Data.SqlTypes` - `SqlDateTime` for default timestamp values
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone; the namespace `DataPROWin7.DataModel` suggests consumption by DataPRO Win7 UI components.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Method Name Typo**: `CommonCustructorItems` in `TestTestObject` is misspelled (should be "Constructor"). This is referenced in multiple constructors.
|
||||
|
||||
2. **Incomplete Thread Safety**: `TestObjectTemplateCollection` uses `volatile` on `_testObjectCollection` but does not use a lock in the singleton getter, unlike `TestObjectList` which uses a proper lock pattern. This could lead to race conditions.
|
||||
|
||||
3. **Template Property Reset Workaround**: In `TestTestObject.CommonCustructorItems`, there is a comment: "UGH, something resets the template properties. just change them back for now to the right values :/". This indicates a known but unresolved issue where template properties are being unexpectedly modified.
|
||||
|
||||
4. **TODO Comment**: Both `GroupPositionComboBoxVisible` and `GroupPositionButtonVisible` getters contain commented-out code with the note "TODO Remove Non-ISO Mode code", suggesting incomplete removal of legacy functionality.
|
||||
|
||||
5. **Static Readonly Field Usage**: `_sysBuiltTestObjectTemplate` in `TestObjectTemplateCollection` is declared `static readonly` but never initialized in any visible constructor or static constructor, meaning it will always be `null`.
|
||||
|
||||
6. **XML Field Handling**: `ProcessChannelXMLNode` silently skips channels that don't have both `MMEChannelId` and `MMEChannelType` fields, and silently skips if the channel cannot be found in the database or import dictionary.
|
||||
|
||||
7. **Position Cascading**: Setting `Position` on `TestTestObject` automatically modifies the `Position` property of all required sensors with non-empty serial numbers. This side effect may not be obvious to consumers.
|
||||
148
docs/ai/Common/DTS.Common.DataModel/Classes/TestTemplate.md
Normal file
148
docs/ai/Common/DTS.Common.DataModel/Classes/TestTemplate.md
Normal file
@@ -0,0 +1,148 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/ICachedContainer.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/HardwareInclusionInstruction.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/TSRAIRGoTestSetup.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/DownloadEvent.cs
|
||||
- Common/DTS.Common.DataModel/Classes/TestTemplate/BuildTestSetup.cs
|
||||
generated_at: "2026-04-17T15:34:34.420183+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f665cac25ac2572f"
|
||||
---
|
||||
|
||||
# Documentation: TestTemplate Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the data model components for test template configuration and execution within the DTS (Data Acquisition System) application. It defines interfaces for hardware/sensor caching, classes for managing hardware inclusion rules, test setup construction from XML or template sources, download event configuration, and specialized test setup singletons. The module serves as a bridge between raw configuration data (XML or database templates) and the runtime test execution environment.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ICachedContainer` (Interface)
|
||||
**Namespace:** `DataPROWin7.DataModel.Classes.TestTemplate`
|
||||
|
||||
| Method | Return Type | Description |
|
||||
|--------|-------------|-------------|
|
||||
| `GetCachedHardware(string serialNumber)` | `DASHardware` | Retrieves cached hardware by serial number. |
|
||||
| `GetCachedSensor(string serialNumber)` | `SensorData` | Retrieves cached sensor data by serial number. |
|
||||
| `GetCalibrations(string serialNumber)` | `SensorCalibration[]` | Retrieves calibration array for a sensor by serial number. |
|
||||
| `GetAllCachedHardware()` | `IISOHardware[]` | Retrieves all cached hardware items. |
|
||||
|
||||
---
|
||||
|
||||
### `HardwareInclusionInstruction` (Class)
|
||||
**Namespace:** `DataPROWin7.DataModel`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `HardwareId` | `public string HardwareId { get; }` | Read-only hardware identifier. |
|
||||
| `Actions` | `public enum Actions { Remove, Add }` | Enumeration defining inclusion action. `Remove` excludes hardware that would otherwise be included; `Add` includes hardware not in groups. |
|
||||
| `Action` | `public Actions Action { get; }` | Read-only action to perform. |
|
||||
| Constructor | `public HardwareInclusionInstruction(string hardwareId, Actions action)` | Creates new instruction with specified hardware ID and action. |
|
||||
| Copy Constructor | `public HardwareInclusionInstruction(HardwareInclusionInstruction copy)` | Creates a copy of an existing instruction. |
|
||||
|
||||
---
|
||||
|
||||
### `TSRAIRGoTestSetup` (Class)
|
||||
**Namespace:** `DTS.Common.DataModel.Classes.TestTemplate`
|
||||
**Base Class:** `DataPROWin7.DataModel.TestTemplate`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `TEST_NAME` | `public const string TEST_NAME = "TSRAIR_GO_TEST"` | Constant test name identifier. |
|
||||
| `Name` | `public override string Name { get; set; }` | Returns `TEST_NAME`; setter is no-op. |
|
||||
| `GetInstance` | `public static TSRAIRGoTestSetup GetInstance(int userId, bool useCache = true)` | Retrieves singleton instance. If cached instance exists and `useCache` is true, returns cached instance. Otherwise, loads template from `TestTemplatesList` or creates new from user defaults. |
|
||||
|
||||
---
|
||||
|
||||
### `DownloadEvent` (Class)
|
||||
**Namespace:** `DataPROWin7.DataModel`
|
||||
**Implements:** `IDownloadEvent`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public DownloadEvent()` | Initializes with `EventNumber = 0`, `IsEnabled = true`, `IsDefault = true`, `IsReadonly = true`. |
|
||||
| Constructor | `public DownloadEvent(bool isDefault = false)` | Initializes with specified `isDefault` value. |
|
||||
| Constructor | `public DownloadEvent(int eventNumber = 0, bool isDefault = false)` | Initializes with specified event number and default flag. |
|
||||
| `EventNumber` | `public int EventNumber { get; set; }` | Event number; setter updates `EventNumberDisplay`. |
|
||||
| `IsEnabled` | `public bool IsEnabled { get; set; }` | Whether event is enabled. |
|
||||
| `IsDefault` | `public bool IsDefault { get; }` | Read-only default flag. |
|
||||
| `EventNumberDisplay` | `public string EventNumberDisplay { get; set; }` | Formatted display string using `DTS.Common.Constants.EventNumber` format. |
|
||||
| `TestItem` | `public string TestItem { get; set; }` | Stores `<TestSetup>:<TestId>:("<All or ROI">)` for export (per issue 43387). |
|
||||
| `DTSFile` | `public string DTSFile { get; set; }` | Stores .DTS file path for export (per issue 43387). |
|
||||
| `IsReadonly` | `public bool IsReadonly { get; set; }` | Whether event is read-only. |
|
||||
| `EventLength` | `public TimeSpan EventLength { get; set; }` | Total time available for download event. |
|
||||
| `ShouldDisplayLength` | `public bool ShouldDisplayLength { get; set; }` | Whether `EventLength` should be displayed. |
|
||||
| `PropertyChanged` | `public event PropertyChangedEventHandler PropertyChanged` | INotifyPropertyChanged event. |
|
||||
|
||||
---
|
||||
|
||||
### `BuildTestSetup` (Class)
|
||||
**Namespace:** `DataPROWin7.DataModel`
|
||||
**Implements:** `IBuildTestSetup`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public BuildTestSetup(string dasSerialNumber, string testSetupName, ExportFileXMLClass exportFileXML)` | Constructs from XML configuration. Extracts test setup fields from `exportFileXML.TestSetupsOuter[0].TestSetups[0]`. |
|
||||
| Constructor | `public BuildTestSetup(string dasSerialNumber, string testSetupName, TestTemplate testTemplate)` | Constructs from `TestTemplate` object. Uses `StringResources.DefaultTestSetupName` if `testSetupName` is whitespace. |
|
||||
| `DASSerialNumber` | `public string DASSerialNumber { get; set; }` | DAS device serial number. |
|
||||
| `SetupName` | `public string SetupName { get; set; }` | Test setup name. |
|
||||
| `SetupDescription` | `public string SetupDescription { get; set; }` | Test setup description. |
|
||||
| `Groups` | `public List<GroupXMLClass> Groups { get; set; }` | List of groups with channels. |
|
||||
| `LevelTriggers` | `public List<LevelTriggerXMLClass> LevelTriggers { get; set; }` | List of level trigger configurations. |
|
||||
| `PropertyChanged` | `public event PropertyChangedEventHandler PropertyChanged` | INotifyPropertyChanged event. |
|
||||
|
||||
**Additional Properties (all `string` type):** `AutomaticMode`, `AutomaticModeDelay`, `WarnOnBatteryFail`, `ViewRealtime`, `RecordingMode`, `SamplesPerSecond`, `PreTriggerSeconds`, `PostTriggerSeconds`, `NumberOfEvents`, `WakeUpMotionTimeout`, `ScheduledStartDateTime`, `IntervalBetweenEventStartsMinutes`, `StartWithEvent`, `WakeUpWithMotion`, `StrictDiagnostics`, `RequireConfirmationOnErrors`, `AllowSensorIdToBlankChannel`, `PerformArmChecklist`, `CheckInputVoltage`, `CheckBatteryVoltage`, `CheckSquibResistance`, `CheckSensorIds`, `CheckStartEventLines`, `CheckTiltSensor`, `CheckTemperature`, `ExcitationWarmupTimeMS`, `RequireAllUnitsPassArmCheckList`, `ROIDownload`, `ViewROIDownload`, `DownloadAll`, `RealtimeCharts`, `ROIStart`, `ROIEnd`, `ViewDownloadAll`, `Export`, `ExportFolder`, `DownloadFolder`, `CommonStatusLine`, `UploadData`, `UploadDataFolder`, `UseLabDetails`, `UseCustomerDetails`, `AllowMissingSensors`, `LastModified`, `LastModifiedBy`, `PostTestDiagnostics`, `UserTags`, `CalibrationBehavior`, `SuppressMissingSensorsWarning`, `NotAllChannelsRealTime`, `NotAllChannelsViewer`, `TriggerCheckStep`, `QuitTestWithoutWarning`, `UseTestEngineerDetails`, `AutoArm`, `Streaming`, `MeasureSquibResistances`.
|
||||
|
||||
**Export Format Properties (all `string` type):** `ExportCh10FilteredEUDesired`, `ExportChryslerDDASDesired`, `ExportCSVADCDesired`, `ExportCSVFilteredDesired`, `ExportCSVMVDesired`, `ExportCSVUnfilteredDesired`, `ExportDiademADCDesired`, `ExportASCDesired`, `ExportHDFADCDesired`, `ExportHDFMVDesired`, `ExportHDFUnfilteredDesired`, `ExportISOFilteredDesired`, `ExportISOUnfilteredDesired`, `ExportRDFADCDesired`, `ExportTDASADCDesired`, `ExportTDMSADCDesired`, `ExportToyotaUnfilteredDesired`, `ExportTSVFilteredDesired`, `ExportTSVUnfilteredDesired`, `ExportXLSXFilteredDesired`, `ExportXLSXUnfilteredDesired`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **`TSRAIRGoTestSetup`**: The singleton instance (`_setup`) is protected by `MY_LOCK` for thread safety. The `Name` property always returns `TEST_NAME` regardless of setter calls.
|
||||
- **`HardwareInclusionInstruction`**: `HardwareId` and `Action` are immutable after construction (read-only properties).
|
||||
- **`DownloadEvent`**: `IsDefault` is read-only after construction. Setting `EventNumber` automatically updates `EventNumberDisplay` with format `"{Constants.EventNumber} {value:00}"`.
|
||||
- **`BuildTestSetup`**: All configuration properties are stored as `string` types regardless of original data types (e.g., booleans, integers, enums are converted to strings).
|
||||
- **`BuildTestSetup`**: When constructing from `TestTemplate`, if `testSetupName` is null or whitespace, `StringResources.DefaultTestSetupName` is used.
|
||||
- **`BuildTestSetup`**: Export format decoding via `DecodeExportFormats` uses bitwise AND operations against `SupportedExportFormatBitFlags` enum values.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (from imports):
|
||||
|
||||
| Module | Depends On |
|
||||
|--------|------------|
|
||||
| `ICachedContainer` | `DTS.Common.Interface.DASFactory.Diagnostics` (for `DASHardware`), `DTS.SensorDB` (for `SensorData`, `SensorCalibration`) |
|
||||
| `TSRAIRGoTestSetup` | `DTS.Slice.Users.UserSettings` (for `TestSetupDefaults`), `DataPROWin7.DataModel.TestTemplateList` |
|
||||
| `DownloadEvent` | `DTS.Common.Interface.DownloadEvent` (for `IDownloadEvent`), `System.ComponentModel` |
|
||||
| `BuildTestSetup` | `DTS.Common.Interface.BuildTestSetup` (for `IBuildTestSetup`), `DTS.Common.XMLUtils` (for `ExportFileXMLClass`, `GroupXMLClass`, `LevelTriggerXMLClass`, `ChannelXMLClass`, `HardwareListXMLClass`), `DTS.Common.Enums` (for `SupportedExportFormatBitFlags`), `DTS.Common.SharedResource.Strings` (for `StringResources`), `DTS.Common.Constants` |
|
||||
|
||||
### Inferred Dependents:
|
||||
- Modules consuming `IBuildTestSetup`, `IDownloadEvent`, or `ICachedContainer` interfaces depend on this module.
|
||||
- Code that creates test setups from templates or XML files depends on `BuildTestSetup`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`BuildTestSetup` stores all values as strings**: Despite source data being typed (int, bool, enum, TimeSpan), all properties in `BuildTestSetup` are `string`. Parsing/conversion is required when consuming these values.
|
||||
|
||||
2. **`BuildTestSetup` XML constructor assumes specific structure**: The constructor accesses `exportFileXML.TestSetupsOuter[0].TestSetups[0]` without null checks. If the XML structure differs, this will throw.
|
||||
|
||||
3. **`TSRAIRGoTestSetup.Name` setter is a no-op**: The setter `{ set {; } }` silently ignores assignments, which could cause confusion if code attempts to modify the name.
|
||||
|
||||
4. **`ParseSettings` uses magic number keys**: Settings are parsed using string prefixes like `"0="`, `"1="`, etc. The mapping between numbers and settings is not documented outside this method.
|
||||
|
||||
5. **`GetExports` has inconsistent case handling**: Export format string matching uses mixed case (e.g., `"csvunfiltered"` vs `"ChryslerDDAS"` vs `"CSVADC"`). The switch statement is case-sensitive.
|
||||
|
||||
6. **`DownloadEvent.EventNumberDisplay` references external constant**: The format string uses `DTS.Common.Constants.EventNumber`—the value of this constant is not visible in this source.
|
||||
|
||||
7. **`HardwareInclusionInstruction` comment mentions "dasless groups"**: The XML comment indicates this class exists to support groups without DAS hardware, but the mechanism for how this integrates with the broader system is not shown.
|
||||
|
||||
8. **`BuildTestSetup` has many commented-out property mappings**: Both constructors contain numerous commented assignments (e.g., `//InvertTrigger`, `//ViewDiagnostics`, `//ExportSomatFilteredDesired`). These may represent deprecated or unimplemented features.
|
||||
89
docs/ai/Common/DTS.Common.DataModel/Common.md
Normal file
89
docs/ai/Common/DTS.Common.DataModel/Common.md
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Common/StatusHelpers.cs
|
||||
- Common/DTS.Common.DataModel/Common/TestObjectHelper.cs
|
||||
- Common/DTS.Common.DataModel/Common/ChannelHelper.cs
|
||||
- Common/DTS.Common.DataModel/Common/TestSetupCollection.cs
|
||||
generated_at: "2026-04-17T15:36:25.187144+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5be6ced2d64c64b8"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.DataModel.Common
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides utility classes and helpers for managing test configurations, channel naming, status reporting, and test setup collections within the DTS data model layer. It serves as a common utility layer that bridges the data model with UI concerns (progress reporting), database operations (test setup persistence), and hardware abstraction (channel/sensor information). The module centralizes test setup caching with CRC-based staleness detection and provides formatting utilities for channel identification in warning messages.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### StatusHelpers
|
||||
|
||||
**Delegate:**
|
||||
```csharp
|
||||
public delegate void SetProgressValueDelegate(IDASCommunication idas, double progressValue, TSRAIRGoStatus.StatusTypes? status);
|
||||
```
|
||||
A delegate type for setting progress values on DAS communication objects.
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public static void SetStatus2(IDASCommunication das, int progressValue, TSRAIRGoStatus.StatusTypes? status, SetProgressValueDelegate setProgressValue)
|
||||
```
|
||||
Invokes the provided delegate with the given DAS object, progress value, and status. This is a pass-through method that delegates the actual status-setting logic to the caller-provided callback.
|
||||
|
||||
---
|
||||
|
||||
### TestObjectHelper
|
||||
|
||||
**Constants:**
|
||||
```csharp
|
||||
public const double TDC_LEGACY_TOM_CUTOFF_SPS = 8000;
|
||||
```
|
||||
The sample rate breakpoint (8000 SPS) for TDC software filters on TOM channels. Above this threshold, CFC 1000 filter is used; at or below, TDC uses 1/5 of SPS.
|
||||
|
||||
```csharp
|
||||
public const double TDC_LEGACY_TOM_HIGH_FILTER = 1650D;
|
||||
```
|
||||
The default filter value (CFC1000) in TDC for TOM channels recorded at sample rates greater than 8000 SPS.
|
||||
|
||||
---
|
||||
|
||||
### ChannelHelper (static class)
|
||||
|
||||
**Methods:**
|
||||
```csharp
|
||||
public static string GetWarningChannelName(IGroupChannel groupChannel)
|
||||
```
|
||||
Constructs a formatted warning channel name string. The format depends on `TestSetupOrder`:
|
||||
- If `TestSetupOrder >= 0`: uses `TestSetupOrder` as prefix
|
||||
- Otherwise: uses `GroupChannelOrder` as prefix
|
||||
|
||||
If `GetChannelName(SerializedSettings.ISOViewMode)` returns a non-empty name, appends `'name'`. Otherwise, appends `''` followed by `Sensor` (if `SensorValid`) and `Hardware` (if `HardwareValid`) in parentheses.
|
||||
|
||||
---
|
||||
|
||||
### TestSetupCollection
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
public static List<string> TestSetupIds { get; }
|
||||
```
|
||||
Returns a copy of the test setup ID list. Thread-safe via `TestSetupListLock`.
|
||||
|
||||
```csharp
|
||||
public static object TestSetupListLock { get; }
|
||||
```
|
||||
A static lock object for thread-safe access to internal collections. Initialized to `new object()`.
|
||||
|
||||
```csharp
|
||||
public static TestTemplate[] TestSetups { get; }
|
||||
```
|
||||
Returns a copy of the actual test templates array. Thread-safe via `TestSetupListLock`.
|
||||
|
||||
```csharp
|
||||
public static string[] TestSetupList { get; }
|
||||
```
|
||||
Returns an array of test setup names. Lazily initializes the internal list if null or empty. Filters templates by `IsComplete ==
|
||||
44
docs/ai/Common/DTS.Common.DataModel/Common/DbWrappers.md
Normal file
44
docs/ai/Common/DTS.Common.DataModel/Common/DbWrappers.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Common/DbWrappers/DASGet.cs
|
||||
- Common/DTS.Common.DataModel/Common/DbWrappers/TestSetupHardwareGet.cs
|
||||
generated_at: "2026-04-17T16:08:07.411025+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ada752c59bd61df1"
|
||||
---
|
||||
|
||||
# DbWrappers
|
||||
|
||||
### Purpose
|
||||
This module provides wrapper classes for retrieving and sanitizing Data Acquisition System (DAS) and Test Setup Hardware records from the database. It exists to centralize data repair logic—specifically addressing legacy data integrity issues (referenced as FB 17777)—ensuring that invalid or missing database values (such as `NaN` or `0`) are corrected to sensible defaults before being returned to the caller.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`DASGet` (inherits `DASDBRecord`)**
|
||||
* `DASGet()`: Default constructor.
|
||||
* `DASGet(IDASDBRecord record)`: Constructor that wraps an existing record. It automatically repairs `MaxAAFRate` if it is `NaN` by setting it to `MaxSampleRate / 5`.
|
||||
* `int Type { get; set; }`: Alias for `DASType`.
|
||||
* `bool Reprogrammable { get; set; }`: Alias for `IsProgrammable`.
|
||||
* `bool Reconfigurable { get; set; }`: Alias for `IsReconfigurable`.
|
||||
* `List<DASGet> DASGet_Wrapper(string serialNumber = null, string position = null)`: Retrieves a list of DAS records from the database via `DbOperations.DASGet`. It wraps the results in `DASGet` instances, triggering the data repair logic in the constructor.
|
||||
|
||||
**`TestSetupHardwareGet` (inherits `TestSetupHardwareRecord`)**
|
||||
* `TestSetupHardwareGet()`: Default constructor.
|
||||
* `TestSetupHardwareGet(ITestSetupHardwareRecord copy)`: Copy constructor.
|
||||
* `bool AddOrRemove { get; set; }`: Alias for `AddDAS` that raises `OnPropertyChanged`.
|
||||
* `List<TestSetupHardwareGet> TestSetupHardwareGet_Wrapper(int? testSetupId, Dictionary<int, IDASHardware> hardwareLookup)`: Retrieves hardware records for a specific test setup. It iterates through results to repair `AntiAliasFilterRate` if it is `0`. It accepts a lookup dictionary for performance but will fall back to database queries if the lookup is null or incomplete.
|
||||
|
||||
### Invariants
|
||||
* **MaxAAFRate Repair**: A `DASGet` instance will never have a `MaxAAFRate` of `NaN`; it will be defaulted to `MaxSampleRate / 5`.
|
||||
* **AntiAliasFilterRate Repair**: A `TestSetupHardwareGet` instance returned by the wrapper should never have an `AntiAliasFilterRate` of `0`, unless the hardware type is explicitly excluded from repair (e.g., `HardwareTypes.DIM`, `HardwareTypes.TDAS_Pro_Rack`).
|
||||
* **Filter Rate Logic**: The `RepairAntiAliasFilterRate` method defaults to `SLICE` type settings for undefined hardware types.
|
||||
|
||||
### Dependencies
|
||||
* **Dependencies**: `DTS.Common.Interface.DataRecorders`, `DTS.Common.Storage` (uses `DbOperations` static class), `DTS.Common.Classes.Hardware`, `DTS.Common.Enums.Hardware`, `DTS.Common.Classes.TestSetups`, `DataPROWin7.Common` (uses `SerializedSettings`), `DTS.Common.ISO.Hardware`.
|
||||
* **Dependents**: Unknown from source alone, but likely consumed by Test Setup management or Data Import logic.
|
||||
|
||||
### Gotchas
|
||||
* **Performance Issue**: In `TestSetupHardwareGet_Wrapper`, if `hardwareLookup` is null, the method calls `GetDASTypeEnumFromId` for every record. This method instantiates `DASGet` and calls `DASGet_Wrapper()`, which queries the database *inside* the loop. This creates an N+1 query problem.
|
||||
* **Hardcoded Logic**: `RepairAntiAliasFilterRate` contains a switch statement with specific hardware types. Adding new hardware types requires updating this method to ensure correct behavior.
|
||||
* **Namespace Incons
|
||||
38
docs/ai/Common/DTS.Common.DataModel/Properties.md
Normal file
38
docs/ai/Common/DTS.Common.DataModel/Properties.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:11:03.088988+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b69162c3aa548b10"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata configuration for the `DTS.Common.Calculations` library. It is a standard .NET Framework assembly information file that defines versioning, copyright, and COM interoperability settings. The internal assembly title is "HeadInjuryCriterion", suggesting this library provides calculations related to head injury criteria (likely for impact testing/analysis).
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are exposed. This file only contains assembly-level attributes:
|
||||
- `AssemblyTitle`: "HeadInjuryCriterion"
|
||||
- `AssemblyVersion`: "1.0.0.0"
|
||||
- `AssemblyFileVersion`: "1.0.0.0"
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: "a83e3800-290f-4513-9756-d37168152099"
|
||||
|
||||
### Invariants
|
||||
- The assembly version is fixed at "1.0.0.0" in source; actual deployed versions may differ if built with wildcard versioning.
|
||||
- COM visibility is disabled for all types in this assembly.
|
||||
|
||||
### Dependencies
|
||||
**This module depends on:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this module:** Unclear from source alone—this is a leaf configuration file with no exports.
|
||||
|
||||
### Gotchas
|
||||
- The assembly title "HeadInjuryCriterion" does not match the module path "DTS.Common.Calculations". This naming inconsistency may cause confusion when searching for the library by name. The actual purpose of the library cannot be determined from this file alone.
|
||||
|
||||
---
|
||||
96
docs/ai/Common/DTS.Common.DataModel/StateMachines.md
Normal file
96
docs/ai/Common/DTS.Common.DataModel/StateMachines.md
Normal file
@@ -0,0 +1,96 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.DataModel/StateMachines/OverallArmStatusStateMachine.cs
|
||||
generated_at: "2026-04-17T15:42:56.746110+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5d72a0ae768f3eb3"
|
||||
---
|
||||
|
||||
# Documentation: OverallArmStatusStateMachine
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `OverallArmStatusStateMachine` class manages the lifecycle and state transitions for a Data Acquisition System's (DAS) arm status. It encapsulates complex state logic for recording operations, data downloading, flash clearing, and various waiting states (trigger, schedule, interval). The class uses the Stateless library to define valid state transitions and notifies subscribers via an event when state changes occur. This state machine appears to be part of a larger test/recording system where equipment must be armed, configured, and monitored through various operational phases.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constructor
|
||||
```csharp
|
||||
public OverallArmStatusStateMachine()
|
||||
```
|
||||
Initializes the state machine by resolving an `IEventAggregator` from the Prism container and calling the private `Initialize()` method. The initial state is set to `ArmStateMachineStates.States.CheckingForDAS`.
|
||||
|
||||
### Enum: Triggers
|
||||
```csharp
|
||||
public enum Triggers
|
||||
```
|
||||
Defines 35 trigger values that cause state transitions, including:
|
||||
- `bFillingBuffer`, `CheckingForData`, `ConfigurationIsSet`, `DASNotFound`, `DataNeverDownloaded`, `Disarm`, `DoneRecording`, `Downloading`, `DownloadCleaningUp`, `DownloadFinished`, `Error`, `Faulted`, `FlashClear`, `GettingEventInfo`, `IDLE`, `IntervalRecording`, `NoDataToDownload`, `NonIntervalRecording`, `PostTestProcessing`, `ReadyForDownload`, `Rearming`, `Recording`, `RunButton`, `Streaming`, `WaitingForTrigger`, `WaitingForSchedule`, `WaitingForInterval`
|
||||
- Single-character values: `a`, `c`, `d`, `e`, `h`, `n`, `rr`, `tt`, `uu`, `yy`
|
||||
|
||||
### Event: OverallStatusStateChange
|
||||
```csharp
|
||||
public event OverallStatusStateChangeDelegate OverallStatusStateChange;
|
||||
```
|
||||
Event raised when the state machine transitions to a new state. The delegate signature is:
|
||||
```csharp
|
||||
public delegate void OverallStatusStateChangeDelegate(ArmStateMachineStates.States previousState, ArmStateMachineStates.States nextState);
|
||||
```
|
||||
|
||||
### Method: GetDASStatus
|
||||
```csharp
|
||||
public ArmStateMachineStates.States GetDASStatus()
|
||||
```
|
||||
Returns the current state stored in `CurrentOverallStatusState`.
|
||||
|
||||
### Method: FireTrigger
|
||||
```csharp
|
||||
public void FireTrigger(Triggers trigger, ArmStateMachineStates.States state)
|
||||
```
|
||||
Fires a trigger with an associated state parameter. Uses a switch statement to map triggers to their corresponding `TriggerWithParameters` instances and calls `overallArmStatusStateMachine.Fire()`. Catches and logs any exceptions without re-throwing.
|
||||
|
||||
**Handled triggers in switch:** `DASNotFound`, `NoDataToDownload`, `DataNeverDownloaded`, `DoneRecording`, `FlashClear`, `WaitingForTrigger`, `WaitingForSchedule`, `WaitingForInterval`, `Recording`, `PostTestProcessing`, `CheckingForData`, `GettingEventInfo`, `ReadyForDownload`, `Error`, `Streaming`, `Disarm`, `Rearming`
|
||||
|
||||
**Note:** `PostTestProcessing` trigger fires `DoneRecordingTrigger` internally.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The state machine always starts in `ArmStateMachineStates.States.CheckingForDAS`.
|
||||
- `CurrentOverallStatusState` is only updated via `SetOverallStatus()` and only when the new state differs from the current state.
|
||||
- State transitions are constrained by the Stateless configuration; invalid triggers will cause the Stateless library to throw (caught silently in `FireTrigger`).
|
||||
- `SetOverallStatus()` is only called from `OnEntryFrom` handlers configured in the state machine.
|
||||
- The `IEventAggregator` must be registered in the Prism container at construction time.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies
|
||||
- **Stateless** - Third-party state machine library used for state transition management
|
||||
- **Prism.Ioc** - `ContainerLocator` for service resolution
|
||||
- **Prism.Events** - `IEventAggregator` interface (resolved but not used in visible code)
|
||||
- **DTS.Common.Enums.TSRAIRGo** - Provides `ArmStateMachineStates.States` enum
|
||||
- **DTS.Common.Utilities.Logging** - `APILogger` for logging state transitions and errors
|
||||
|
||||
### Internal Dependencies
|
||||
- `ArmStateMachineStates.States` - External enum defining all possible states (referenced but not defined in this file)
|
||||
|
||||
### Consumers
|
||||
- Unknown from source alone; consumers would subscribe to `OverallStatusStateChange` event and call `FireTrigger()`.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Unused cryptic trigger values**: The `Triggers` enum contains unexplained single-character values (`a`, `c`, `d`, `e`, `h`, `n`, `rr`, `tt`, `uu`, `yy`) that are never referenced elsewhere in the code.
|
||||
|
||||
2. **Unimplemented trigger handling**: Several triggers in the enum are not handled in the `FireTrigger` switch statement, including: `bFillingBuffer`, `ConfigurationIsSet`, `DownloadCleaningUp`, `DownloadFinished`, `Faulted`, `IntervalRecording`, `NonIntervalRecording`, `RunButton`, and the single-character triggers. Firing these will silently do nothing (fall through to `default`).
|
||||
|
||||
3. **Error trigger not configured**: The `ErrorTrigger` field is initialized but no state configures transitions using it. Firing `Triggers.Error` will likely cause a Stateless exception (caught and logged silently).
|
||||
|
||||
4. **PostTestProcessing fires wrong trigger**: The `Triggers.PostTestProcessing` case fires `DoneRecordingTrigger` instead of a dedicated trigger. This appears to be a workaround or potential bug.
|
||||
|
||||
5. **Unused graph generation**: The `Initialize()` method generates a UML dot graph string but stores it in a local variable that is never used or exposed.
|
||||
|
||||
6. **Silent failure mode**: `FireTrigger()` catches all exceptions and only logs them; callers have no way to know if a trigger failed.
|
||||
|
||||
7. **Questionable parameter design**: As noted in the source comment, `FireTrigger` takes a `state` parameter, which the developer questioned: "why specify state here? shouldn't that be done based on current state/trigger?" This suggests potential confusion about the state machine's design intent.
|
||||
|
||||
8. **Unused IEventAggregator**: The `_eventAggregator` field is resolved but never used in the visible code.
|
||||
258
docs/ai/Common/DTS.Common.ICommunication.md
Normal file
258
docs/ai/Common/DTS.Common.ICommunication.md
Normal file
@@ -0,0 +1,258 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.ICommunication/IDASConnectedDevice.cs
|
||||
- Common/DTS.Common.ICommunication/ICommunication.cs
|
||||
- Common/DTS.Common.ICommunication/Communication.cs
|
||||
generated_at: "2026-04-17T15:39:44.338256+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f84cd76ebff4b497"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.ICommunication
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the core communication infrastructure for interacting with DAS (Data Acquisition System) hardware. It defines the abstract `Communication<T>` base class that implements asynchronous connect/disconnect operations, command execution with timeout handling, and a continuous receive loop for hardware communication. The module also defines `IDASConnectedDevice` for describing devices attached to a DAS (e.g., SLICE6 units on a SLICE6DB), and `Communication_DASInfo` for encapsulating DAS metadata such as serial numbers, firmware versions, and connected device information.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `IDASConnectedDevice` (interface)
|
||||
**Namespace:** `DTS.DASLib.Communication`
|
||||
|
||||
Describes a device connected to a DAS.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `DeviceType` | `HardwareTypes` | The device type of the connected device. |
|
||||
| `Port` | `int` | The port on the DAS which the device is on (0-based). |
|
||||
| `SpotOnPort` | `int` | The spot on the chain or port the device is on (0-based). |
|
||||
| `PhysicalAddress` | `PhysicalAddress` | MAC Address or physical address. |
|
||||
| `IPAddress` | `string` | The IP address of the device. |
|
||||
| `SerialNumber` | `string` | The serial number of the device. |
|
||||
| `Location` | `string` | The location of the device. |
|
||||
| `Version` | `string` | The version of the device. |
|
||||
|
||||
---
|
||||
|
||||
### `CanceledException` (class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
**Base:** `ApplicationException`
|
||||
|
||||
Marker exception thrown when operations are canceled.
|
||||
|
||||
---
|
||||
|
||||
### `Communication_DASInfo` (class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
**Implements:** `ICommunication_DASInfo`
|
||||
|
||||
Encapsulates metadata about a DAS device.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `FirstUseDate` | `DateTime?` | Date of first use; `null` indicates hardware not used since calibration. Only valid when `IsFirstUseDateSupported` is `true`. |
|
||||
| `IsFirstUseDateSupported` | `bool` | Indicates hardware supports first use dates. |
|
||||
| `IsStreamingSupported` | `bool` | Indicates whether streaming is supported. |
|
||||
| `ConnectedDevices` | `IDASConnectedDevice[]` | Devices connected to the DAS (currently only used by SLICE6DB). |
|
||||
| `SerialNumbers` | `string[]` | Array of serial numbers. |
|
||||
| `FirmwareVersions` | `string[]` | Array of firmware versions. |
|
||||
|
||||
**Methods:**
|
||||
|
||||
- `void SetConnectedDevices(IDASConnectedDevice[] devices)` — Sets the `ConnectedDevices` array.
|
||||
|
||||
- `string StackSerialNumber(int devid)` — Returns a stacked serial number string. Returns `"N/A"` if `SerialNumbers` is null or empty. Returns `SerialNumbers[0] + "::" + SerialNumbers[devid]` if `devid` is non-zero and within bounds; otherwise returns `SerialNumbers[0]`.
|
||||
|
||||
**Constructors:**
|
||||
|
||||
- `Communication_DASInfo()` — Default constructor.
|
||||
- `Communication_DASInfo(string[] serials, string[] fwnums)` — Constructs with cloned copies of serial and firmware arrays.
|
||||
|
||||
---
|
||||
|
||||
### `Communication<T>` (abstract class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
**Implements:** `Interface.DASFactory.ICommunication`
|
||||
**Generic constraint:** `where T : IConnection, new()`
|
||||
|
||||
Abstract base class for hardware communication.
|
||||
|
||||
**Properties:**
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `ErrorInSetup` | `bool` | get/set | Indicates an error occurred during setup. |
|
||||
| `ConnectString` | `string` | get | Returns `sock.ConnectString`. |
|
||||
| `Connected` | `bool` | get | Returns `sock.Connected`. |
|
||||
| `DASInfo` | `ICommunication_DASInfo` | get/set | DAS metadata. |
|
||||
| `Transport` | `IConnection` | get/set | Gets `sock`; setter throws `NotSupportedException`. |
|
||||
| `ReceiveBufferSize` | `int` | get/set | Receive buffer size; defaults to 65536. |
|
||||
| `SerialNumber` | `string` | get/set | Device serial number. |
|
||||
| `FirmwareVersion` | `string` | get/set | Firmware version; setter invokes `FirmwareVersionUpdated()`. |
|
||||
| `ProtocolVersion` | `byte` | get/set | Protocol version. |
|
||||
| `MinimumProtocols` | `Dictionary<DFConstantsAndEnums.ProtocolLimitedCommands, byte>` | get/set | Minimum protocol versions for commands. |
|
||||
| `FlushTimeoutMilliSec` | `int` | get/set | Flush timeout; defaults to 5. |
|
||||
| `ExecuteIsBusy` | `bool` | get/set | Thread-safe execution lock indicator. |
|
||||
| `CancelEvent` | `ManualResetEvent` | get | Event signaling cancel state. |
|
||||
|
||||
**Events:**
|
||||
|
||||
- `EventHandler OnDisconnected` — Raised when the connection is disconnected.
|
||||
|
||||
**Methods:**
|
||||
|
||||
- `int CompareTo(Interface.DASFactory.ICommunication dev)` — Compares `ConnectString` values (ordinal, case-insensitive).
|
||||
|
||||
- `int CompareTo(string conStr)` — Compares `ConnectString` to provided string (ordinal, case-insensitive).
|
||||
|
||||
- `abstract void InitMinProto()` — Must be implemented to initialize `MinimumProtocols`.
|
||||
|
||||
- `bool IsCommandSupported(DFConstantsAndEnums.ProtocolLimitedCommands command)` — Returns `true` if `ProtocolVersion >= GetMinProto(command)`.
|
||||
|
||||
- `byte GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands command)` — Returns minimum protocol for command, or `0xFF` if not found. Throws `NotSupportedException` if `MinimumProtocols` is null.
|
||||
|
||||
- `void Connect(string connectString, CommunicationCallback callback, object callbackObject, int callbackTimeout, string hostIPAddress)` — Initiates asynchronous connection. Throws if socket is null or already connected.
|
||||
|
||||
- `void Disconnect(bool reuseSocket, CommunicationCallback callback, object callbackObject, int callbackTimeout)` — Initiates asynchronous disconnect. Throws if socket is null.
|
||||
|
||||
- `void Cancel()` — Sets cancel state with 500ms sleep on clear.
|
||||
|
||||
- `void ForceCancel()` — Sets cancel state with 250ms sleep on clear.
|
||||
|
||||
- `bool IsCanceled()` — Returns current cancel state.
|
||||
|
||||
- `void ClearCancel()` — Clears cancel state after sleeping.
|
||||
|
||||
- `void Flush(int timeoutMs)` — Flushes `SockDataBuffer` until no data arrives within timeout.
|
||||
|
||||
- `byte[] SyncExecute(byte[] byteData, int cbTimeout)` — Throws `NotSupportedException`.
|
||||
|
||||
- `void Execute(byte[] byteData, CommunicationCallback cb, object cbObject, int cbTimeout)` — Sends data and processes responses asynchronously. Throws `CanceledException` if canceled; throws `NotConnectedException` if not connected.
|
||||
|
||||
- `void PseudoExecute(byte[] byteData, CommunicationCallback cb, object cbObject, int cbTimeout)` — For commands that only receive data without sending. Throws `CanceledException` if canceled; throws `NotConnectedException` if not connected.
|
||||
|
||||
- `void SetupReader()` — Initializes the asynchronous receive loop.
|
||||
|
||||
- `void Dispose()` — IDisposable implementation.
|
||||
|
||||
---
|
||||
|
||||
### `CommunicationReport` (class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
**Implements:** `ICommunicationReport`
|
||||
|
||||
Encapsulates the result of a communication operation.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `UserState` | `object` | User-provided state object. |
|
||||
| `Result` | `CommunicationResult` | Result of the operation. |
|
||||
| `Data` | `byte[]` | Received data (for read operations). |
|
||||
|
||||
**Constructor:**
|
||||
|
||||
- `CommunicationReport(object state, CommunicationResult res)`
|
||||
|
||||
---
|
||||
|
||||
### `Communication<T>.ActionData` (abstract class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
|
||||
Base class for tracking asynchronous operations with timeout handling.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `UserTimeout` | `int` | Timeout in milliseconds. |
|
||||
| `TimerExpired` | `bool` | Indicates if the timer fired. |
|
||||
|
||||
**Methods:**
|
||||
|
||||
- `void StartTimer()` — Starts the timeout timer.
|
||||
- `void KillTimer()` — Stops and disposes the timer.
|
||||
- `bool ReportCanceled()` — Invokes callback with `CommunicationResult.Canceled`.
|
||||
- `abstract bool ReportFailure()` — Must implement failure reporting.
|
||||
- `abstract bool ReportSuccess()` — Must implement success reporting.
|
||||
- `protected abstract CommunicationResult GetTimeoutResult()` — Must return the timeout-specific result.
|
||||
|
||||
---
|
||||
|
||||
### `Communication<T>.ExecuteActionData` (class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
|
||||
Extends `ActionData` for execute operations.
|
||||
|
||||
**Additional Methods:**
|
||||
|
||||
- `bool ReportReadSuccess(byte[] data)` — Reports successful read with data.
|
||||
- `bool ReportReadTimeout()` — Reports read timeout.
|
||||
- `bool ReportReadDisconnected()` — Reports disconnection during read.
|
||||
|
||||
---
|
||||
|
||||
### `Communication<T>.PseudoAsyncResult` (class)
|
||||
**Namespace:** `DTS.Common.ICommunication`
|
||||
**Implements:** `IAsyncResult`
|
||||
|
||||
Wraps `ExecuteActionData` for pseudo-execute operations.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `IsCompleted` | `bool` | Always `true`. |
|
||||
| `AsyncWaitHandle` | `WaitHandle` | Throws `NotImplementedException`. |
|
||||
| `AsyncState` | `object` | Returns the wrapped `ExecuteActionData`. |
|
||||
| `CompletedSynchronously` | `bool` | Always `true`. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Connection State Guards**: `Connect()` throws if `sock` is null or already connected. `Disconnect()` throws if `sock` is null.
|
||||
|
||||
2. **ExecuteIsBusy Thread Safety**: The `ExecuteIsBusy` property uses a lock (`_executeBusyMtLock`) and asserts on re-entry or extra unlock attempts.
|
||||
|
||||
3. **MinimumProtocols Initialization**: `GetMinProto()` throws `NotSupportedException` if `MinimumProtocols` is null. Derived classes must implement `InitMinProto()` to populate this dictionary.
|
||||
|
||||
4. **Transport Immutability**: The `Transport` property setter always throws `NotSupportedException`; the transport cannot be replaced after construction.
|
||||
|
||||
5. **Buffer Flushing Before Execute**: `Execute()` calls `CheckAndFlushBuffer()` to ensure `SockDataBuffer` is empty before sending.
|
||||
|
||||
6. **Cancel State Consistency**: `ClearCancel()` only performs sleep and reset if `_commandsAreCanceled` is `true`.
|
||||
|
||||
7. **SerialNumbers Bounds Check**: `StackSerialNumber(int devid)` returns `"N/A"` for null/empty arrays and `SerialNumbers[0]` for out-of-bounds `devid` values.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
|
||||
- `DTS.Common.Enums.Hardware` — `HardwareTypes` enum.
|
||||
- `DTS.Common.Enums.Communication` — `CommunicationConstantsAndEnums`, `CommunicationResult`.
|
||||
- `DTS.Common.Enums.DASFactory` — `DFConstantsAndEnums`.
|
||||
- `DTS.Common.Interface.Communication` — `ICommunication_DASInfo`, `CommunicationCallback` (delegate type inferred).
|
||||
- `DTS.Common.Interface.Connection` — `IConnection`.
|
||||
- `DTS.Common.Classes.Connection` — (referenced but specific types not visible in source).
|
||||
- `DTS.Common.Utilities.Logging` — `APILogger`.
|
||||
- `DTS.Common.Utilities` — `SecureQueue<T>`.
|
||||
- `DTS.Common.Utils` — `WaitWithCondition`.
|
||||
- `System.Net.NetworkInformation` — `PhysicalAddress`.
|
||||
- `System.Net.Sockets` — `SocketException`.
|
||||
- `System.Threading` — `ManualResetEvent`, `Timer`, `Timeout`.
|
||||
- `System.Threading.Tasks` — `Task`.
|
||||
|
||||
**Consumers of this module:**
|
||||
|
||||
- Not determinable from the provided source alone. The abstract `Communication<T>` class is designed to be extended by concrete implementations.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **SyncExecute Not Supported**: The `SyncExecute()` method throws `NotSupportedException` with a message referencing `DTS.DASLib.Communication.Communication`, suggesting a namespace mismatch or historical artifact.
|
||||
|
||||
2. **PseudoAsyncResult.AsyncWaitHandle Throws**: Accessing `AsyncWaitHandle` on `PseudoAsyncResult` throws `NotImplementedException`, which could surprise callers expecting a functional `IAsyncResult`.
|
||||
|
||||
3. **Thread ID Check in Receive Callbacks**: Both `ProcessReceivedData()` and `SRRecvCallback()` check that `Thread.CurrentThread.ManagedThreadId` remains consistent before and after `WaitWithCondition.Wait()`. If it changes, the method logs and returns without completing the operation
|
||||
39
docs/ai/Common/DTS.Common.ICommunication/Properties.md
Normal file
39
docs/ai/Common/DTS.Common.ICommunication/Properties.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.ICommunication/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:26:29.251867+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "20b8451d7fcc0a29"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `ICommunication` assembly. It defines version information, copyright, and COM visibility settings. Based on the naming convention, this assembly likely defines communication-related interfaces or abstractions, but the actual types are not present in this file.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this module. The file contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: `"ICommunication"`
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: Empty
|
||||
- `AssemblyProduct`: `"ICommunication"`
|
||||
- `AssemblyCopyright`: `"Copyright © 2008"`
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: `"11eb7c8b-d4b6-4121-8dcb-1b6ddfe1136f"`
|
||||
- `AssemblyVersion`: `"1.06.0081"`
|
||||
- `AssemblyFileVersion`: `"1.06.0081"`
|
||||
|
||||
### Invariants
|
||||
- COM visibility is explicitly set to `false`.
|
||||
- The assembly version and file version are synchronized at `"1.06.0081"`.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices` (standard .NET Framework assemblies).
|
||||
- **Depended on by**: Cannot be determined from this file alone.
|
||||
|
||||
### Gotchas
|
||||
- The `AssemblyCompany` attribute is empty, which may indicate incomplete metadata configuration.
|
||||
- The `AssemblyTitle` (`"ICommunication"`) suggests this assembly defines interfaces (hence the "I" prefix), but this cannot be confirmed from the source alone.
|
||||
|
||||
---
|
||||
26
docs/ai/Common/DTS.Common.IConnection.md
Normal file
26
docs/ai/Common/DTS.Common.IConnection.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/IConnection.cs
|
||||
generated_at: "2026-04-17T16:38:12.016436+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "05c4045d4535673f"
|
||||
---
|
||||
|
||||
# Documentation for `IConnection.cs`
|
||||
|
||||
## 1. Purpose
|
||||
This source file defines the namespace `DTS.Common.IConnection`. However, the file currently contains no type definitions, interfaces, classes, or implementation logic. While the namespace naming convention (`DTS.Common.IConnection`) suggests an intended role of defining connection-related abstractions (likely an interface named `IConnection`), the specific behavior and purpose cannot be determined from the provided source code as the namespace block is empty.
|
||||
|
||||
## 2. Public Interface
|
||||
None. The namespace `DTS.Common.IConnection` is empty in the provided source. There are no public classes, interfaces, methods, or properties defined.
|
||||
|
||||
## 3. Invariants
|
||||
None identified from source alone. The file contains no logic or data structures to enforce constraints.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Imports:** The file imports the `System` namespace.
|
||||
* **Consumers:** Unknown. No types are exported from this file for other modules to consume.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Empty Implementation:** The source file consists only of a namespace declaration with no content. It is unclear if this is a placeholder file, a mistake in the file structure, or if the definitions were expected to be present but are missing.
|
||||
76
docs/ai/Common/DTS.Common.IConnection/EthernetConnection.md
Normal file
76
docs/ai/Common/DTS.Common.IConnection/EthernetConnection.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/EthernetConnection/RESTConnection.cs
|
||||
- Common/DTS.Common.IConnection/EthernetConnection/EthernetConnection.cs
|
||||
generated_at: "2026-04-17T15:41:01.253739+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b30ad0e6e8a9dd7c"
|
||||
---
|
||||
|
||||
# Documentation: EthernetConnection and RESTConnection
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides two implementations of the `IConnection` interface for network communication within the DTS system. `EthernetConnection` is a full TCP socket wrapper that manages asynchronous socket operations including connect, disconnect, send, receive, and accept, with support for soft disconnect/reconnect functionality and TCP keepalive configuration. `RESTConnection` is a stub implementation that simulates synchronous completion of all operations without actual network I/O, designed to satisfy the `IConnection` interface for REST-based endpoints where traditional socket semantics do not apply.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### EthernetConnection (DTS.Common)
|
||||
|
||||
#### Properties
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `bool IsSoftDisconnected { get; }` | Returns `true` if the connection has been soft-disconnected. |
|
||||
| `bool RequiresKeepAliveReset { get; set; }` | When `true`, `SoftConnect()` performs a keepalive reset via a secondary command port before reconnecting. |
|
||||
| `Socket Sock` | Public field exposing the underlying `System.Net.Sockets.Socket`. |
|
||||
| `string ConnectString { get; }` | Returns the connection string (format: `"host:port"`). |
|
||||
| `bool Connected { get; }` | Returns `true` if `Sock` is non-null and `Sock.Connected` is `true`. |
|
||||
| `SocketFlags Flags { get; set; }` | Socket flags used for send/receive operations. |
|
||||
| `event EventHandler OnDisconnected` | Fired when `KeepAliveErrorReceived()` is called. |
|
||||
|
||||
#### Methods
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void SoftDisconnect()` | Disconnects and disposes the socket if connected and soft disconnects are allowed via `HardwareConstants.AllowSoftDisconnects`. Sets `IsSoftDisconnected = true`. |
|
||||
| `void SoftConnect()` | Reconnects a soft-disconnected socket. Optionally sends a keepalive reset message to port 8200 if `RequiresKeepAliveReset` is `true`. Retries connection up to 3 times on failure. |
|
||||
| `void KeepAliveErrorReceived()` | Shuts down, closes, and disposes the socket; fires `OnDisconnected` event. |
|
||||
| `string GetConnectionData()` | Returns a string with local and remote `EndPoint` information, or empty string on error. |
|
||||
| `Socket CreateSock(string connectString, string hostIPAddress)` | Factory method creating a TCP socket with `NoDelay`, `KeepAlive`, and custom keepalive timing configured. Optionally binds to `hostIPAddress`. |
|
||||
| `void Create(string connectString)` | **Note:** Contains a bug (commented-out recursive call). Does nothing. |
|
||||
| `void Create(string connectString, string hostIPAddress)` | Creates and configures the internal socket; stores connection parameters. |
|
||||
| `void Bind(int port)` | Binds the socket to a local endpoint on the specified port using the first IP address from `Dns.GetHostEntry`. |
|
||||
| `void Listen(int backlog)` | Places the socket in listening state. |
|
||||
| `IAsyncResult BeginConnect(AsyncCallback cb, object state)` | Begins an asynchronous connection. Validates socket exists and `Connect_String` format (`host:port`). |
|
||||
| `void EndConnect(IAsyncResult ar)` | Completes the asynchronous connect operation. |
|
||||
| `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback cb, object state)` | Begins asynchronous disconnect. Throws `SocketException(WSAEISCONN)` if socket is already disconnected. |
|
||||
| `void EndDisconnect(IAsyncResult asyncResult)` | Completes the asynchronous disconnect operation. |
|
||||
| `IAsyncResult BeginAccept(AsyncCallback callback, object state)` | Begins an asynchronous accept operation. |
|
||||
| `IConnection EndAccept(IAsyncResult asyncResult)` | Completes accept and returns a new `EthernetConnection` wrapping the accepted socket. |
|
||||
| `IAsyncResult BeginSend(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` | Begins asynchronous send. Throws if socket is null, callback is null, or socket is not connected. |
|
||||
| `int EndSend(IAsyncResult ar)` | Completes the asynchronous send; returns bytes sent. Sets `Sock = null` on exception. |
|
||||
| `Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend)` | Task-based async send wrapper using `FromAsync`. |
|
||||
| `IAsyncResult BeginReceive(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` | Begins asynchronous receive. Throws if socket is null or callback is null. |
|
||||
| `int EndReceive(IAsyncResult ar)` | Completes the asynchronous receive; returns bytes received. |
|
||||
| `void Dispose()` | Disposes the socket and suppresses finalization. |
|
||||
|
||||
---
|
||||
|
||||
### RESTConnection (DTS.DASLib.Connection)
|
||||
|
||||
#### Properties
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `bool IConnection.IsSoftDisconnected` | Always returns `false`. |
|
||||
| `SocketFlags IConnection.Flags { get; set; }` | Defaults to `SocketFlags.None`. |
|
||||
| `string IConnection.ConnectString` | Returns the stored connection string. |
|
||||
| `bool IConnection.Connected` | Returns the internal `_bConnected` flag. |
|
||||
| `event EventHandler OnDisconnected` | Event declared but never invoked in the source. |
|
||||
|
||||
#### Methods
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void IConnection.Create(string connectString)` | Stores `connectString` in `_ConnectString`. |
|
||||
| `void IConnection.Create(string connectString, string hostIPAddress)` | Stores both parameters in
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/EthernetConnection/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:08:48.739930+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bbe00a85a5e9455d"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `DASResource` assembly. It is a standard .NET AssemblyInfo file that defines version information, copyright, and COM visibility settings. The actual implementation code for DASResource is not present in this file—only assembly-level attributes.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this file. The following assembly-level attributes are declared:
|
||||
|
||||
- `AssemblyTitle("DASResource")` - Sets the assembly title
|
||||
- `AssemblyDescription("")` - Empty description
|
||||
- `AssemblyConfiguration("")` - Empty configuration
|
||||
- `AssemblyCompany("")` - Empty company name
|
||||
- `AssemblyProduct("DASResource")` - Product name
|
||||
- `AssemblyCopyright("Copyright © 2008 - 2009")` - Copyright notice
|
||||
- `AssemblyTrademark("")` - Empty trademark
|
||||
- `AssemblyCulture("")` - Neutral culture (not a satellite assembly)
|
||||
- `ComVisible(false)` - Types not visible to COM by default
|
||||
- `Guid("E20CF41A-9884-40f4-AD18-4F06A42FE36D")` - COM typelib GUID
|
||||
- `AssemblyVersion("1.06.0081")` - Assembly version
|
||||
- `AssemblyFileVersion("1.06.0081")` - File version
|
||||
|
||||
### Invariants
|
||||
- AssemblyVersion and AssemblyFileVersion are synchronized at "1.06.0081"
|
||||
- ComVisible is set to false, meaning no types are exposed to COM by default
|
||||
- AssemblyCulture is empty, indicating this is not a satellite assembly
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this:** Cannot be determined from source alone. The actual DASResource implementation files would reference this assembly, but they are not provided.
|
||||
|
||||
### Gotchas
|
||||
- The actual DASResource types and functionality are not visible in this file; only assembly metadata is present.
|
||||
- The copyright date range (2008 - 2009) suggests this assembly was actively developed during that period.
|
||||
- The description, company, and trademark fields are empty—typical of internal/proprietary projects.
|
||||
|
||||
---
|
||||
42
docs/ai/Common/DTS.Common.IConnection/Properties.md
Normal file
42
docs/ai/Common/DTS.Common.IConnection/Properties.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:08:48.738829+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fdac77f93f143db6"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `IConnection` assembly. Based on the assembly name, this appears to define an interface abstraction for connections. The actual interface and implementation code is not present in this file—only assembly-level attributes.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this file. The following assembly-level attributes are declared:
|
||||
|
||||
- `AssemblyTitle("IConnection")` - Sets the assembly title
|
||||
- `AssemblyDescription("")` - Empty description
|
||||
- `AssemblyConfiguration("")` - Empty configuration
|
||||
- `AssemblyCompany("")` - Empty company name
|
||||
- `AssemblyProduct("IConnection")` - Product name
|
||||
- `AssemblyCopyright("Copyright © 2008")` - Copyright notice
|
||||
- `AssemblyTrademark("")` - Empty trademark
|
||||
- `AssemblyCulture("")` - Neutral culture
|
||||
- `ComVisible(false)` - Types not visible to COM by default
|
||||
- `Guid("c8394d57-92d3-4ee1-b2f3-f8fabce0d487")` - COM typelib GUID
|
||||
- `AssemblyVersion("1.06.0081")` - Assembly version
|
||||
- `AssemblyFileVersion("1.06.0081")` - File version
|
||||
|
||||
### Invariants
|
||||
- AssemblyVersion and AssemblyFileVersion are synchronized at "1.06.0081"
|
||||
- ComVisible is set to false
|
||||
- AssemblyCulture is empty, indicating this is not a satellite assembly
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this:** Cannot be determined from source alone
|
||||
43
docs/ai/Common/DTS.Common.IConnection/SerialConnection.md
Normal file
43
docs/ai/Common/DTS.Common.IConnection/SerialConnection.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/SerialConnection/SerialConnection.cs
|
||||
generated_at: "2026-04-17T15:43:20.559385+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b99650f076547574"
|
||||
---
|
||||
|
||||
# Documentation: SerialConnection
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`SerialConnection` is an implementation of the `IConnection` interface that wraps `System.IO.Ports.SerialPort` to provide serial port communication capabilities. It exists to allow serial-based devices to be used within a connection abstraction layer that appears designed primarily around socket-based communication patterns (evidenced by the APM-style `Begin*`/`End*` methods and `SocketFlags` property). This class enables the system to treat serial connections uniformly alongside other connection types.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Properties
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `bool IsSoftDisconnected { get; }` | Returns `true` if the unit is soft disconnected. Initialized to `false`. |
|
||||
| `bool Connected { get; }` | Always returns `false`. Read-only property. |
|
||||
| `string ConnectString => _PortName` | Returns the port name. |
|
||||
| `System.Net.Sockets.SocketFlags Flags { get; set; }` | Socket flags property (inherited from interface, not used for serial). |
|
||||
| `event EventHandler OnDisconnected` | Event for disconnection notification. |
|
||||
|
||||
### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void SoftConnect()` | Empty implementation. Comment indicates soft disconnect is not implemented for serial. |
|
||||
| `void SoftDisconnect()` | Empty implementation. Comment indicates soft disconnect is not implemented for serial. |
|
||||
| `void Create(string connectString, string hostIPAddress)` | Does nothing. Parameters are ignored. |
|
||||
| `void Create(string PortName)` | Creates a new `SerialPort` instance with the provided port name and stores the name in `_PortName`. |
|
||||
| `string GetConnectionData()` | Returns empty string. |
|
||||
| `double GetCurrentDownloadRate()` | Returns `0D`. |
|
||||
| `double GetCurrentUploadRate()` | Returns `0D`. |
|
||||
| `void Dispose()` | Implements `IDisposable`. Calls `Dispose(true)` and suppresses finalization. |
|
||||
| `IAsyncResult BeginConnect(AsyncCallback cb, object state)` | Opens the serial port. Returns `null`. Throws if `Port` is null or `_PortName` is empty. |
|
||||
| `void EndConnect(IAsyncResult ar)` | Throws if `Port` is null. No other action. |
|
||||
| `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback cb, Object state)` | Returns `null`. Throws if `Port` is null. |
|
||||
| `void EndDisconnect
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/SerialConnection/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:08:48.740620+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e0115c791f240810"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `DASResource` assembly. It is a standard .NET AssemblyInfo file that defines version information, copyright, and COM visibility settings. The actual implementation code for DASResource is not present in this file—only assembly-level attributes.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this file. The following assembly-level attributes are declared:
|
||||
|
||||
- `AssemblyTitle("DASResource")` - Sets the assembly title
|
||||
- `AssemblyDescription("")` - Empty description
|
||||
- `AssemblyConfiguration("")` - Empty configuration
|
||||
- `AssemblyCompany("")` - Empty company name
|
||||
- `AssemblyProduct("DASResource")` - Product name
|
||||
- `AssemblyCopyright("Copyright © 2008 - 2009")` - Copyright notice
|
||||
- `AssemblyTrademark("")` - Empty trademark
|
||||
- `AssemblyCulture("")` - Neutral culture (not a satellite assembly)
|
||||
- `ComVisible(false)` - Types not visible to COM by default
|
||||
- `Guid("E20CF41A-9884-40f4-AD18-4F06A42FE36D")` - COM typelib GUID
|
||||
- `AssemblyVersion("1.06.0081")` - Assembly version
|
||||
- `AssemblyFileVersion("1.06.0081")` - File version
|
||||
|
||||
### Invariants
|
||||
- AssemblyVersion and AssemblyFileVersion are synchronized at "1.06.0081"
|
||||
- ComVisible is set to false, meaning no types are exposed to COM by default
|
||||
- AssemblyCulture is empty, indicating this is not a satellite assembly
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**What depends on this:** Cannot be determined from source alone. The actual DASResource implementation files would reference this assembly, but they are not provided.
|
||||
|
||||
### Gotchas
|
||||
- The actual DASResource types and functionality are not visible in this file; only assembly metadata is present.
|
||||
- The copyright date range (2008 - 2009) suggests this assembly was actively developed during that period.
|
||||
- The description, company, and trademark fields are empty—typical of internal/proprietary projects.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/USBConnection/HIDUSBConnection/HIDUSBConnection.cs
|
||||
generated_at: "2026-04-17T15:42:39.330640+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7d6d1a6f53e67671"
|
||||
---
|
||||
|
||||
# HIDUSBConnection Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`HIDUSBConnection` implements the `IConnection` interface to provide asynchronous communication with USB Human Interface Device (HID) hardware. It targets specific DTS devices identified by Vendor ID `0x1CB9` and Product ID `0x0003`. The class wraps Windows HID API calls for device discovery, connection management, and bidirectional data transfer using input/output reports.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Constants
|
||||
|
||||
| Name | Value | Description |
|
||||
|------|-------|-------------|
|
||||
| `HIDSLICE_PID` | `0x0003` | Product ID for target HID device |
|
||||
| `DTS_VID` | `0x1CB9` | Vendor ID for DTS devices |
|
||||
|
||||
### Properties
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `bool Connected { get; }` | Returns current connection state |
|
||||
| `string ConnectString { get; }` | Returns the device path name set via `Create()` |
|
||||
| `System.Net.Sockets.SocketFlags Flags { get; set; }` | Socket flags property (purpose unclear in HID context) |
|
||||
|
||||
### Events
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `event EventHandler OnDisconnected` | Event raised when device disconnects (defined but never invoked in source) |
|
||||
|
||||
### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void Create(string ConnectString)` | Stores device path in `Device_Name` |
|
||||
| `void Dispose()` | Public disposal method implementing IDisposable pattern |
|
||||
| `IAsyncResult BeginConnect(AsyncCallback cb, object state)` | Queues async connect operation via ThreadPool |
|
||||
| `void EndConnect(IAsyncResult ar)` | Opens handles to device, retrieves capabilities, initializes buffers |
|
||||
| `static string GetFirstConnectString()` | Enumerates HID devices to find first matching VID/PID; returns device path or empty string |
|
||||
| `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback cb, Object state)` | Queues async disconnect operation |
|
||||
| `void EndDisconnect(IAsyncResult asyncResult)` | Closes `_HIDHandle`, `_ReadHandle`, `_WriteHandle`; sets `_Connected = false` |
|
||||
| `IAsyncResult BeginSend(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` | Queues async send operation; validates handles first |
|
||||
| `int EndSend(IAsyncResult ar)` | Writes data to device via HID output reports; returns total bytes sent |
|
||||
| `IAsyncResult BeginReceive(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` | Queues async receive operation; validates handles first |
|
||||
| `int EndReceive(IAsyncResult ar)` | Reads HID input report; copies to buffer (skipping first byte); returns bytes read or 0 on failure |
|
||||
| `double GetCurrentDownloadRate()` | Returns `0D` (stub) |
|
||||
| `double GetCurrentUploadRate()` | Returns `0D` (stub) |
|
||||
| `string GetConnectionData()` | Returns empty string (stub) |
|
||||
| `void Bind(int port)` | Throws `NotSupportedException` |
|
||||
| `void Listen(int backlog)` | Throws `NotSupportedException` |
|
||||
| `IAsyncResult BeginAccept(AsyncCallback callback, Object state)`
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/USBConnection/HIDUSBConnection/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:07:59.588341+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2a1f4602e744c5de"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `WINUSBConnection` assembly. It is a standard .NET Framework assembly information file that defines versioning, copyright, and COM visibility settings for the WINUSB connection library, which appears to be part of a USB device communication subsystem.
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are defined in this module. It contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: "WINUSBConnection"
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: Empty
|
||||
- `AssemblyProduct`: "WINUSBConnection"
|
||||
- `AssemblyCopyright`: "Copyright © 2008"
|
||||
- `ComVisible`: `false` - Types in this assembly are not visible to COM components
|
||||
- `Guid`: "F3C369E6-BFFB-41bc-B8E8-A31094CED447" - Type library ID if exposed to COM
|
||||
- `AssemblyVersion`: "1.06.0081"
|
||||
- `AssemblyFileVersion`: "1.06.0081"
|
||||
|
||||
### Invariants
|
||||
- The assembly version and file version are kept synchronized (both "1.06.0081").
|
||||
- COM visibility is explicitly disabled at the assembly level.
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**Dependents:** Cannot be determined from this file alone. This assembly appears to be part of a larger USB connection framework.
|
||||
|
||||
### Gotchas
|
||||
- The copyright year is 2008, indicating this is legacy code that may not have been updated recently.
|
||||
- The version format "1.06.0081" uses a non-standard four-part scheme where the third component appears to be a build number (81) rather than following semantic versioning conventions.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,196 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/USBConnection/USBFramework/FileIODeclarations.cs
|
||||
- Common/DTS.Common.IConnection/USBConnection/USBFramework/HIDDeclarations.cs
|
||||
- Common/DTS.Common.IConnection/USBConnection/USBFramework/DeviceManagementDeclarations.cs
|
||||
- Common/DTS.Common.IConnection/USBConnection/USBFramework/DeviceManagement.cs
|
||||
generated_at: "2026-04-17T15:36:27.113042+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9419e177c65ead81"
|
||||
---
|
||||
|
||||
# USBFramework Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The USBFramework module provides low-level Windows API interoperability for USB device communication in the DTS system. It encapsulates P/Invoke declarations and helper logic for three distinct areas: file I/O operations (kernel32.dll), HID-class device communication (hid.dll), and device management/enumeration (setupapi.dll, user32.dll). The module enables the application to discover, connect to, and communicate with USB devices through their device paths and interface class GUIDs, while also supporting device arrival/removal notifications.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### FileIODeclarations (DTS.Common.USBFramework)
|
||||
|
||||
A static container class for Windows kernel32.dll file I/O P/Invoke declarations.
|
||||
|
||||
**Constants:**
|
||||
- `GENERIC_READ` (0x80000000), `GENERIC_WRITE` (0x40000000)
|
||||
- `FILE_SHARE_READ` (0x00000001), `FILE_SHARE_WRITE` (0x00000002)
|
||||
- `FILE_FLAG_OVERLAPPED` (0x40000000)
|
||||
- `INVALID_HANDLE_VALUE` (-1)
|
||||
- `OPEN_EXISTING` (3)
|
||||
- `WAIT_TIMEOUT` (0x102), `WAIT_OBJECT_0` (0), `WAIT_FAILED` (0xFFFFFFFF), `WAIT_ABANDONED` (0x00000080)
|
||||
- `FSCTL_SET_COMPRESSION` (0x9C040)
|
||||
|
||||
**Structures:**
|
||||
- `OVERLAPPED` - Sequential layout structure with `Internal`, `InternalHigh`, `Offset`, `OffsetHigh`, `hEvent` fields
|
||||
- `SECURITY_ATTRIBUTES` - Sequential layout structure with `nLength`, `lpSecurityDescriptor`, `bInheritHandle` fields (all `int`)
|
||||
|
||||
**P/Invoke Functions:**
|
||||
- `int CancelIo(int hFile)`
|
||||
- `int CloseHandle(int hObject)`
|
||||
- `int CreateEvent(ref SECURITY_ATTRIBUTES SecurityAttributes, int bManualReset, int bInitialState, string lpName)`
|
||||
- `int CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, ref SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, uint dwFlagsAndAttributes, int hTemplateFile)`
|
||||
- `int GetLastError()`
|
||||
- `int ReadFile(int hFile, ref byte lpBuffer, int nNumberOfBytesToRead, ref int lpNumberOfBytesRead, int lpOverlapped)`
|
||||
- `uint WaitForSingleObject(int hHandle, int dwMilliseconds)`
|
||||
- `int WriteFile(int hFile, ref byte lpBuffer, int nNumberOfBytesToWrite, ref int lpNumberOfBytesWritten, int lpOverlapped)`
|
||||
- `int DeviceIoControl(IntPtr hDevice, int dwIoControlCode, ref short lpInBuffer, int nInBufferSize, IntPtr lpOutBuffer, int nOutBufferSize, ref int lpBytesReturned, IntPtr lpOverlapped)`
|
||||
|
||||
---
|
||||
|
||||
### FileIO (DTS.Common.USBFramework)
|
||||
|
||||
A secondary file I/O declaration class with safer handle types.
|
||||
|
||||
**Constants:**
|
||||
- `FILE_ATTRIBUTE_NORMAL` (0x80), `FILE_FLAG_OVERLAPPED` (0x40000000)
|
||||
- `FILE_SHARE_READ` (0x1), `FILE_SHARE_WRITE` (0x2)
|
||||
- `GENERIC_READ` (0x80000000), `GENERIC_WRITE` (0x40000000)
|
||||
- `INVALID_HANDLE_VALUE` (-1), `OPEN_EXISTING` (3)
|
||||
|
||||
**Structure:**
|
||||
- `SECURITY_ATTRIBUTES` - Sequential layout with `nLength` (int), `lpSecurityDescriptor` (IntPtr), `bInheritHandle` (int)
|
||||
|
||||
**P/Invoke Functions:**
|
||||
- `bool CloseHandle(SafeFileHandle hObject)`
|
||||
- `SafeFileHandle CreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, ref SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile)`
|
||||
|
||||
---
|
||||
|
||||
### HIDDeclarations (DTS.DASLib.Connection.USBFramework)
|
||||
|
||||
A sealed class containing P/Invoke declarations for HID-class device communication via hid.dll.
|
||||
|
||||
**Constants:**
|
||||
- `HidP_Input` (0), `HidP_Output` (1), `HidP_Feature` (2)
|
||||
|
||||
**Structures:**
|
||||
- `HIDD_ATTRIBUTES` - Contains `Size` (int), `VendorID` (short), `ProductID` (short), `VersionNumber` (short)
|
||||
- `HIDP_CAPS` - Device capabilities including report byte lengths, usage info, and 17-element `Reserved` array
|
||||
- `HidP_Value_Caps` - Value capabilities structure with extensive fields for usage ranges, logical/physical min/max, bit sizes, etc.
|
||||
|
||||
**P/Invoke Functions:**
|
||||
- `bool HidD_FlushQueue(int HidDeviceObject)`
|
||||
- `bool HidD_FreePreparsedData(ref IntPtr PreparsedData)`
|
||||
- `int HidD_GetAttributes(int HidDeviceObject, ref HIDD_ATTRIBUTES Attributes)`
|
||||
- `bool HidD_GetFeature(int HidDeviceObject, ref byte lpReportBuffer, int ReportBufferLength)`
|
||||
- `bool HidD_GetInputReport(int HidDeviceObject, ref byte lpReportBuffer, int ReportBufferLength)`
|
||||
- `void HidD_GetHidGuid(ref System.Guid HidGuid)`
|
||||
- `bool HidD_GetNumInputBuffers(int HidDeviceObject, ref int NumberBuffers)`
|
||||
- `bool HidD_GetPreparsedData(int HidDeviceObject, ref IntPtr PreparsedData)`
|
||||
- `bool HidD_SetFeature(int HidDeviceObject, ref byte lpReportBuffer, int ReportBufferLength)`
|
||||
- `bool HidD_SetNumInputBuffers(int HidDeviceObject, int NumberBuffers)`
|
||||
- `bool HidD_SetOutputReport(int HidDeviceObject, ref byte lpReportBuffer, int ReportBufferLength)`
|
||||
- `int HidP_GetCaps(IntPtr PreparsedData, ref HIDP_CAPS Capabilities)`
|
||||
- `int HidP_GetValueCaps(short ReportType, ref byte ValueCaps, ref short ValueCapsLength, IntPtr PreparsedData)`
|
||||
|
||||
---
|
||||
|
||||
### DeviceManagementDeclarations (DTS.Common.USBFramework)
|
||||
|
||||
A class containing P/Invoke declarations for device management via setupapi.dll, user32.dll, and advapi32.dll.
|
||||
|
||||
**Constants:**
|
||||
- Device event types: `DBT_DEVICEARRIVAL` (0x8000), `DBT_DEVICEREMOVECOMPLETE` (0x8004)
|
||||
- Device types: `DBT_DEVTYP_DEVICEINTERFACE` (5), `DBT_DEVTYP_HANDLE` (6)
|
||||
- Notification flags: `DEVICE_NOTIFY_ALL_INTERFACE_CLASSES` (4), `DEVICE_NOTIFY_SERVICE_HANDLE` (1), `DEVICE_NOTIFY_WINDOW_HANDLE` (0)
|
||||
- `WM_DEVICECHANGE` (0x219)
|
||||
- Error codes: `ERROR_INSUFFICIENT_BUFFER` (122), `NO_ERROR` (0), `ERROR_NO_MORE_ITEMS` (259)
|
||||
- SetupAPI flags: `DIGCF_PRESENT` (0x00000002), `DIGCF_DEVICEINTERFACE` (0x00000010), `DIGCF_ALLCLASSES` (0x00000004)
|
||||
- Registry property constants: `SPDRP_FRIENDLYNAME`, `SPDRP_DEVICEDESC`, `SPDRP_DRIVER`
|
||||
|
||||
**Structures:**
|
||||
- `DEV_BROADCAST_DEVICEINTERFACE` - For registering device notifications
|
||||
- `DEV_BROADCAST_DEVICEINTERFACE_1` - For reading device name and class GUID
|
||||
- `DEV_BROADCAST_HANDLE`, `DEV_BROADCAST_HDR`
|
||||
- `SP_DEVICE_INTERFACE_DATA`, `SP_DEVICE_INTERFACE_DETAIL_DATA`, `SP_DEVINFO_DATA`
|
||||
|
||||
**Enum:**
|
||||
- `RegSAM` - Registry access mask flags
|
||||
|
||||
**P/Invoke Functions:**
|
||||
- `IntPtr RegisterDeviceNotification(IntPtr hRecipient, IntPtr NotificationFilter, int Flags)`
|
||||
- `int SetupDiCreateDeviceInfoList(ref System.Guid ClassGuid, int hwndParent)`
|
||||
- `int SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet)`
|
||||
- `int SetupDiEnumDeviceInterfaces(IntPtr DeviceInfoSet, IntPtr DeviceInfoData, ref System.Guid InterfaceClassGuid, int MemberIndex, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData)`
|
||||
- `IntPtr SetupDiGetClassDevs(ref System.Guid ClassGuid, string Enumerator, int hwndParent, uint Flags)`
|
||||
- `bool SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet, ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IntPtr DeviceInterfaceDetailData, int DeviceInterfaceDetailDataSize, ref int RequiredSize, IntPtr DeviceInfoData)`
|
||||
- `bool SetupDiEnumDeviceInfo(IntPtr DeviceInfoSet, uint MemberIndex, out SP_DEVINFO_DATA DeviceInfoData)`
|
||||
- `IntPtr SetupDiGetClassDevsA(ref Guid ClassGuid, uint Enumerator, IntPtr hwndParent, uint Flags)`
|
||||
- `bool SetupDiGetDeviceRegistryPropertyA(IntPtr DeviceInfoSet, SP_DEVINFO_DATA DeviceInfoData, uint Property, uint PropertyRegDataType, StringBuilder PropertyBuffer, uint PropertyBufferSize, IntPtr RequiredSize)`
|
||||
- `int SetupDiOpenDevRegKey(IntPtr DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, uint Scope, uint HwProfile, uint KeyType, RegSAM samDesired)`
|
||||
- `uint RegQueryValueEx(int hKey, string lpValueName, uint lpReserved, out uint lpType, ref byte[] lpData, ref uint lpcbData)`
|
||||
- `bool UnregisterDeviceNotification(IntPtr Handle)`
|
||||
- `int GetLastError()`
|
||||
|
||||
---
|
||||
|
||||
### DeviceManagement (DTS.Common.USBFramework)
|
||||
|
||||
A concrete class implementing `IDisposable` that provides high-level device management operations.
|
||||
|
||||
**Methods:**
|
||||
|
||||
- `void Dispose()` - Empty implementation; no resources released.
|
||||
|
||||
- `bool DeviceNameMatch(Message m, string mydevicePathName)` - Compares the device path name from a `WM_DEVICECHANGE` message against a known device path. Returns `true` if names match (case-insensitive), `false` otherwise. Only processes messages where `dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE`.
|
||||
|
||||
- `bool FindDeviceFromGuid(Guid myGuid, ref string[] devicePathName)` - Enumerates all present devices matching the specified interface class GUID. Populates `devicePathName` array with device paths. Returns `true` if at least one device found. Caller must pre-allocate the string array.
|
||||
|
||||
- `bool RegisterForDeviceNotifications(IntPtr formHandle, Guid classGuid, ref IntPtr deviceNotificationHandle)` - Registers a window to receive device arrival/removal notifications for a specific interface class. Returns `true` on success.
|
||||
|
||||
- `void StopReceivingDeviceNotifications(IntPtr deviceNotificationHandle)` - Unregisters device notifications. Failures are silently ignored.
|
||||
|
||||
- `bool GetDeviceRegistryProperty(Guid myGuid)` - Enumerates devices and logs their driver registry property (`SPDRP_DRIVER`) via `APILogger.Log()`. Returns `true` on success.
|
||||
|
||||
**Static Fields:**
|
||||
- `IS64_BIT_PROCESS` - Readonly boolean, computed as `(IntPtr.Size == 8)`
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Handle Validity**: All handle parameters passed to P/Invoke functions must be valid; the module does not validate handles before use.
|
||||
- **Array Pre-allocation**: `FindDeviceFromGuid` requires the caller to pre-allocate the `devicePathName` string array with sufficient size; the method does not resize the array.
|
||||
- **Structure Size**: `SP_DEVICE_INTERFACE_DATA.cbSize` and `SP_DEVICE_INTERFACE_DETAIL_DATA.cbSize` must be set before passing to API functions; `DeviceManagement` handles this internally.
|
||||
- **Memory Management**: `FindDeviceFromGuid` allocates unmanaged memory via `Marshal.AllocHGlobal` and must free it via `Marshal.FreeHGlobal`; the `finally` block ensures cleanup even on exceptions.
|
||||
- **32/64-bit Compatibility**: The code explicitly handles pointer size differences via `IS64_BIT_PROCESS` for structure marshaling in `FindDeviceFromGuid` and `RegisterForDeviceNotifications`.
|
||||
- **Device Path String Size**: In `DeviceNameMatch`, the device name string size is calculated as `(dbch_size - 28) / 2`, assuming 28 bytes for the header structure.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `System` (core types)
|
||||
- `System.Runtime.InteropServices` (P/Invoke, Marshal)
|
||||
- `System.Text` (StringBuilder)
|
||||
- `System.Diagnostics` (Debug - commented out but imported)
|
||||
- `System.Windows.Forms` (Message type)
|
||||
- `Microsoft.Win32.SafeHandles` (SafeFileHandle)
|
||||
- `DTS.Common.Utilities.Logging` (APILogger - used in `DeviceManagement.GetDeviceRegistryProperty`)
|
||||
|
||||
**What depends on this module:**
|
||||
- Not determinable from the provided source files alone.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Namespace Inconsistency**: `HIDDeclarations` resides in namespace `DTS.DASLib.Connection.USBFramework`, while all other classes are in `DTS.Common.USBFramework`. This may cause confusion or require multiple using directives.
|
||||
|
||||
2. **Duplicate Constants**: `FileIODeclarations` and `FileIO` both define the same constants (e.g., `GENERIC_READ`, `GENERIC_WRITE`, `FILE_FLAG_OVERLAPPED`, `INVALID_HANDLE_VALUE`, `OPEN_EXISTING`) with identical or similar values. The purpose of this duplication is unclear from source.
|
||||
|
||||
3. **Duplicate SECURITY_ATTRIBUTES**: Two different `SECURITY_ATTRIBUTES` structures exist—one in `FileIODeclarations` (with `int
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/USBConnection/USBFramework/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:07:59.587456+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "39b5c5af10b56ba5"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `HIDFramework` assembly (note: the module directory is named "USBFramework" but the assembly title is "HIDFramework"). It provides versioning and COM interop configuration for what appears to be a Human Interface Device (HID) framework library within the USB connection subsystem.
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are defined in this module. It contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: "HIDFramework"
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: Empty
|
||||
- `AssemblyProduct`: "HIDFramework"
|
||||
- `AssemblyCopyright`: "Copyright © 2008"
|
||||
- `ComVisible`: `false` - Types in this assembly are not visible to COM components
|
||||
- `Guid`: "c655f31f-ca6c-4e9b-9480-934762d20a8c" - Type library ID if exposed to COM
|
||||
- `AssemblyVersion`: "1.06.0081"
|
||||
- `AssemblyFileVersion`: "1.06.0081"
|
||||
|
||||
### Invariants
|
||||
- The assembly version and file version are kept synchronized (both "1.06.0081").
|
||||
- COM visibility is explicitly disabled at the assembly level.
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**Dependents:** Cannot be determined from this file alone.
|
||||
|
||||
### Gotchas
|
||||
- **Naming inconsistency:** The directory is named "USBFramework" but the `AssemblyTitle` and `AssemblyProduct` are set to "HIDFramework". This discrepancy could cause confusion when referencing the assembly or searching logs. It is unclear whether this is intentional or a historical oversight.
|
||||
- The copyright year is 2008, indicating legacy code.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,158 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/USBConnection/WINUSBConnection/WINUSBDeviceApi.cs
|
||||
- Common/DTS.Common.IConnection/USBConnection/WINUSBConnection/CDCUSBConnection.cs
|
||||
- Common/DTS.Common.IConnection/USBConnection/WINUSBConnection/WINUSBConnection.cs
|
||||
generated_at: "2026-04-17T15:37:40.541814+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ead3f24c8ac15de2"
|
||||
---
|
||||
|
||||
# USB Connection Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides USB connectivity for DTS hardware devices through two distinct implementations: `CDCUSBConnection` for CDC (Communications Device Class) USB devices that present as virtual serial ports, and `WINUSBConnection` for devices using the WinUSB driver for direct bulk/interrupt transfers. Both classes implement the `IConnection` interface, providing a unified async communication pattern (Begin/End and Task-based async) for sending and receiving data. The module also includes `WinUsbDevice` (partial class in `WINUSBDeviceApi.cs`) which provides low-level P/Invoke bindings to the Windows WinUSB API.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### CDCUSBConnection (CDCUSBConnection.cs)
|
||||
|
||||
A connection class for CDC USB devices that uses `System.IO.Ports.SerialPort` for communication.
|
||||
|
||||
**Properties:**
|
||||
- `bool IsSoftDisconnected { get; }` - Returns whether the device is soft-disconnected (always `false` for this implementation).
|
||||
- `bool Connected { get; }` - Returns the current connection state.
|
||||
- `string ConnectString { get; }` - Returns the device pathname.
|
||||
- `string PortName { get; set; }` - The serial port name (e.g., "COM3").
|
||||
- `System.Net.Sockets.SocketFlags Flags { get; set; }` - Socket flags (purpose unclear from source).
|
||||
- `static IList<string> RegKeys { get; }` - Registry keys for device discovery.
|
||||
|
||||
**Constants:**
|
||||
- `const int DTS_VENDOR_ID = 0x1CB9`
|
||||
- `const string DTS_VENDOR_ID_STR = "VID_1CB9"`
|
||||
- `const string DTS_TSR2_CDCUSB_PRODUCT_ID_STR = "PID_001A"`
|
||||
|
||||
**Methods:**
|
||||
- `void Create(string connectString, string hostIPAddress)` - Parses the connect string to extract the port name from registry.
|
||||
- `IAsyncResult BeginConnect(AsyncCallback cb, object state)` - Begins an async connection attempt.
|
||||
- `void EndConnect(IAsyncResult ar)` - Completes the connection; configures and opens the serial port with default settings (9600 baud, 8 data bits, no parity, one stop bit).
|
||||
- `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback cb, Object state)` - Begins an async disconnect.
|
||||
- `void EndDisconnect(IAsyncResult ar)` - Closes and disposes the serial port.
|
||||
- `IAsyncResult BeginSend(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` - Begins an async send operation.
|
||||
- `int EndSend(IAsyncResult ar)` - Completes the send; writes data to the serial port.
|
||||
- `Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend)` - Task-based async send wrapper.
|
||||
- `IAsyncResult BeginReceive(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` - Begins an async receive operation.
|
||||
- `int EndReceive(IAsyncResult ar)` - Completes the receive; blocks until data is available.
|
||||
- `void Dispose()` - Disposes the connection.
|
||||
- `void SoftConnect()` - No-op (empty body).
|
||||
- `void SoftDisconnect()` - No-op (empty body).
|
||||
- `double GetCurrentUploadRate()` - Returns `0D`.
|
||||
- `double GetCurrentDownloadRate()` - Returns `0D`.
|
||||
- `string GetConnectionData()` - Returns empty string.
|
||||
|
||||
**Events:**
|
||||
- `event EventHandler OnDisconnected` - Event for disconnection notification (never raised in source).
|
||||
|
||||
**Not Supported:**
|
||||
- `BeginAccept`, `EndAccept`, `Listen`, `Bind` - Throw `NotSupportedException`.
|
||||
|
||||
---
|
||||
|
||||
### WINUSBConnection (WINUSBConnection.cs)
|
||||
|
||||
A connection class for WinUSB devices using direct USB transfers via the WinUSB API.
|
||||
|
||||
**Properties:**
|
||||
- `bool IsSoftDisconnected { get; }` - Returns whether the device is soft-disconnected (always `false` for this implementation).
|
||||
- `bool Connected { get; }` - Returns the current connection state.
|
||||
- `string ConnectString { get; }` - Returns the device connection string.
|
||||
- `System.Net.Sockets.SocketFlags Flags { get; set; }` - Socket flags (purpose unclear from source).
|
||||
|
||||
**Methods:**
|
||||
- `void Create(string connectString, string hostIPAddress)` - Stores the connect string.
|
||||
- `IAsyncResult BeginConnect(AsyncCallback cb, object state)` - Begins an async connection; validates not already connected.
|
||||
- `void EndConnect(IAsyncResult ar)` - Completes the connection; creates `WinUsbDevice` instance, gets device handle, and initializes device.
|
||||
- `IAsyncResult BeginDisconnect(bool reuseSocket, AsyncCallback cb, Object state)` - Begins an async disconnect.
|
||||
- `void EndDisconnect(IAsyncResult ar)` - Disposes the `WinUsbDevice` via `DisposeSliceDev()`.
|
||||
- `IAsyncResult BeginSend(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` - Begins an async send; validates connection and parameters.
|
||||
- `int EndSend(IAsyncResult ar)` - Completes the send; uses `SendViaInterruptTransfer` or `SendViaBulkTransfer` based on `MyDevInfo.UseHybridBulkIntMode`.
|
||||
- `Task<int> SendAsync(byte[] sendBuffer, int bufferStartOffset, int bufferSizeToSend)` - Task-based async send wrapper.
|
||||
- `IAsyncResult BeginReceive(byte[] buffer, int offset, int size, AsyncCallback cb, object state)` - Begins an async receive.
|
||||
- `int EndReceive(IAsyncResult ar)` - Completes the receive; uses `ReadViaBulkTransfer` with a polling loop.
|
||||
- `void Dispose()` - Disposes the connection and device management resources.
|
||||
- `void SoftConnect()` - No-op (empty body).
|
||||
- `void SoftDisconnect()` - No-op (empty body).
|
||||
- `double GetCurrentUploadRate()` - Returns `0D`.
|
||||
- `double GetCurrentDownloadRate()` - Returns `0D`.
|
||||
- `string GetConnectionData()` - Returns empty string.
|
||||
|
||||
**Events:**
|
||||
- `event EventHandler OnDisconnected` - Event for disconnection notification (never raised in source).
|
||||
|
||||
**Not Supported:**
|
||||
- `BeginAccept`, `EndAccept`, `Listen`, `Bind` - Throw `NotSupportedException`.
|
||||
|
||||
**Nested Classes:**
|
||||
- `WinUSBRecAsyncResult` - Implements `IAsyncResult` with additional `Buffer`, `Offset`, `Size` properties.
|
||||
|
||||
---
|
||||
|
||||
### WinUsbDevice (WINUSBDeviceApi.cs) - Internal Partial Class
|
||||
|
||||
Low-level P/Invoke bindings to `winusb.dll`.
|
||||
|
||||
**Constants:**
|
||||
- `const uint DEVICE_SPEED = 1`
|
||||
- `const byte USB_ENDPOINT_DIRECTION_MASK = 0x80`
|
||||
|
||||
**Enums:**
|
||||
- `PolicyType` - Pipe policy types: `ShortPacketTerminate`, `AutoClearStall`, `PipeTransferTimeout`, `IgnoreShortPackets`, `AllowPartialReads`, `AutoFlush`, `RawIO`.
|
||||
- `USBDPipeTypes` - Pipe types: `UsbdPipeTypeControl`, `UsbdPipeTypeIsochronous`, `UsbdPipeTypeBulk`, `UsbdPipeTypeInterrupt`.
|
||||
- `USBDeviceSpeeds` - Device speeds: `UsbLowSpeed = 1`, `UsbFullSpeed`, `UsbHighSpeed`.
|
||||
|
||||
**Structs:**
|
||||
- `USBConfigurationDescriptor` - USB configuration descriptor with fields: `bLength`, `bDescriptorType`, `wTotalLength`, `bNumInterfaces`, `bConfigurationValue`, `iConfiguration`, `bmAttributes`, `MaxPower`.
|
||||
- `USBInterfaceDescriptor` - USB interface descriptor with fields: `bLength`, `bDescriptorType`, `bInterfaceNumber`, `bAlternateSetting`, `bNumEndpoints`, `bInterfaceClass`, `bInterfaceSubClass`, `bInterfaceProtocol`, `iInterface`.
|
||||
- `WinUSBPipeInformation` - Pipe information with fields: `PipeTypes`, `PipeId`, `MaximumPacketSize`, `Interval`.
|
||||
- `WinUSBSetupPacket` - Setup packet for control transfers with fields: `RequestType`, `Request`, `Value`, `Index`, `Length`.
|
||||
|
||||
**P/Invoke Functions (all from `winusb.dll`):**
|
||||
- `WinUsb_ControlTransfer(IntPtr interfaceHandle, WinUSBSetupPacket setupPacket, byte[] buffer, uint bufferLength, ref uint lengthTransferred, IntPtr overlapped)`
|
||||
- `WinUsb_Free(IntPtr interfaceHandle)`
|
||||
- `WinUsb_Initialize(SafeFileHandle deviceHandle, ref IntPtr interfaceHandle)`
|
||||
- `WinUsb_QueryDeviceInformation(IntPtr interfaceHandle, uint informationType, ref uint bufferLength, ref byte buffer)`
|
||||
- `WinUsb_QueryInterfaceSettings(IntPtr interfaceHandle, byte alternateInterfaceNumber, ref USBInterfaceDescriptor usbAltInterfaceDescriptor)`
|
||||
- `WinUsb_QueryPipe(IntPtr interfaceHandle, byte alternateInterfaceNumber, byte pipeIndex, ref WinUSBPipeInformation pipeInformation)`
|
||||
- `WinUsb_ReadPipe(IntPtr interfaceHandle, byte pipeId, byte[] buffer, uint bufferLength, ref uint lengthTransferred, IntPtr overlapped)`
|
||||
- `WinUsb_SetPipePolicy(IntPtr interfaceHandle, byte pipeId, uint policyType, uint valueLength, ref byte Value)` - For byte policy values.
|
||||
- `WinUsb_SetPipePolicy1(IntPtr interfaceHandle, byte pipeId, uint policyType, uint valueLength, ref uint Value)` - For `uint` policy values (alias for `WinUsb_SetPipePolicy`).
|
||||
- `WinUsb_WritePipe(IntPtr interfaceHandle, Byte pipeId, byte[] buffer, uint bufferLength, ref uint lengthTransferred, IntPtr overlapped)`
|
||||
|
||||
---
|
||||
|
||||
### UsbRecAsyncResult (CDCUSBConnection.cs)
|
||||
|
||||
Helper class implementing `IAsyncResult` for async operations.
|
||||
|
||||
**Properties:**
|
||||
- `object AsyncState { get; set; }`
|
||||
- `WaitHandle AsyncWaitHandle { get; set; }`
|
||||
- `bool CompletedSynchronously { get; set; }`
|
||||
- `bool IsCompleted { get; set; }`
|
||||
- `byte[] buffer { get; set; }`
|
||||
- `int Offset { get; set; }`
|
||||
- `int Size { get; set; }`
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Connection State Consistency**: `_Connected`/`Connected` must be `false` when `_sliceDev`/`_comPort` is `null` or disposed.
|
||||
2. **Single Connection**: `WINUSBConnection.BeginConnect` throws `NotConnectedException` if already connected (`_sliceDev != null || Connected`).
|
||||
3. **Thread Safety**: `WINUSBConnection` uses a `Mutex` named `"USBConnection"` to protect device initialization and disposal operations.
|
||||
4. **Dispose Guard**: Both connection classes use `Disposed` and `Disposing` flags to prevent double-disposal.
|
||||
5. **Parameter Validation**: `BeginSend` and `BeginReceive` validate that `buffer` is not null/empty
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.IConnection/USBConnection/WINUSBConnection/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:07:59.584637+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bc07a36281104a6a"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `WINUSBConnection` assembly. It is a standard .NET Framework assembly information file that defines versioning, copyright, and COM visibility settings for the WINUSB connection library, which appears to be part of a USB device communication subsystem.
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are defined in this module. It contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: "WINUSBConnection"
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: Empty
|
||||
- `AssemblyProduct`: "WINUSBConnection"
|
||||
- `AssemblyCopyright`: "Copyright © 2008"
|
||||
- `ComVisible`: `false` - Types in this assembly are not visible to COM components
|
||||
- `Guid`: "F3C369E6-BFFB-41bc-B8E8-A31094CED447" - Type library ID if exposed to COM
|
||||
- `AssemblyVersion`: "1.06.0081"
|
||||
- `AssemblyFileVersion`: "1.06.0081"
|
||||
|
||||
### Invariants
|
||||
- The assembly version and file version are kept synchronized (both "1.06.0081").
|
||||
- COM visibility is explicitly disabled at the assembly level.
|
||||
|
||||
### Dependencies
|
||||
**Imports:**
|
||||
- `System.Reflection`
|
||||
- `System.Runtime.CompilerServices`
|
||||
- `System.Runtime.InteropServices`
|
||||
|
||||
**Dependents:** Cannot be determined from this file alone. This assembly appears to be part of a larger USB connection framework.
|
||||
|
||||
### Gotchas
|
||||
- The copyright year is 2008, indicating this is legacy code that may not have been updated recently.
|
||||
- The version format "1.06.0081" uses a non-standard four-part scheme where the third component appears to be a build number (81) rather than following semantic versioning conventions.
|
||||
|
||||
---
|
||||
403
docs/ai/Common/DTS.Common.ISO.md
Normal file
403
docs/ai/Common/DTS.Common.ISO.md
Normal file
@@ -0,0 +1,403 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.ISO/IsoMDBFile.cs
|
||||
- Common/DTS.Common.ISO/ISerializableFile.cs
|
||||
- Common/DTS.Common.ISO/AbstractOLEDbWrapper.cs
|
||||
- Common/DTS.Common.ISO/HardwareChannel.cs
|
||||
- Common/DTS.Common.ISO/IsoCode.cs
|
||||
- Common/DTS.Common.ISO/TestObjectChannel.cs
|
||||
- Common/DTS.Common.ISO/CalculatedValueClass.cs
|
||||
- Common/DTS.Common.ISO/LevelTriggerChannel.cs
|
||||
- Common/DTS.Common.ISO/TestSetting.cs
|
||||
- Common/DTS.Common.ISO/TestObjectTemplate.cs
|
||||
- Common/DTS.Common.ISO/MMEFilterClasses.cs
|
||||
- Common/DTS.Common.ISO/MMEPositions.cs
|
||||
- Common/DTS.Common.ISO/MMEFineLocations2.cs
|
||||
generated_at: "2026-04-17T15:26:54.219712+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "02238b951afcf713"
|
||||
---
|
||||
|
||||
# DTS.Common.ISO Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data structures and utilities for working with ISO 13499 (MME) crash test data standards. It includes classes for managing test object templates, channels, hardware configurations, calculated values, and ISO metadata (positions, filter classes, fine locations). The module serves as a bridge between the database layer and the application's domain model for test setup and data acquisition, handling serialization, database persistence, and ISO code generation for channel identification.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### IsoMDBFile
|
||||
```csharp
|
||||
public class IsoMDBFile
|
||||
```
|
||||
Empty placeholder class. No members defined in source.
|
||||
|
||||
---
|
||||
|
||||
### ISerializableFile
|
||||
```csharp
|
||||
public interface ISerializableFile
|
||||
```
|
||||
Interface for serializable file operations.
|
||||
|
||||
| Method | Return Type | Description |
|
||||
|--------|-------------|-------------|
|
||||
| `GetDirectory()` | `string` | Returns the directory path for the file |
|
||||
| `GetExtension()` | `string` | Returns the file extension |
|
||||
| `GetFilter()` | `string` | Returns the file filter string |
|
||||
| `GetFileLocation()` | `string` | Returns the full file location |
|
||||
|
||||
---
|
||||
|
||||
### AbstractOLEDbWrapper
|
||||
```csharp
|
||||
public abstract class AbstractOLEDbWrapper
|
||||
```
|
||||
Base class providing helper methods for database reader operations.
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetLong` | `protected static long GetLong(IDataReader reader, string field)` | Returns `long.MinValue` if field is `DBNull`, otherwise converts to `Int64` |
|
||||
| `GetDate` | `protected static DateTime GetDate(IDataReader reader, string field)` | Returns `DateTime.MinValue` if field is `DBNull`, otherwise casts to `DateTime` |
|
||||
|
||||
---
|
||||
|
||||
### HardwareChannel
|
||||
```csharp
|
||||
public class HardwareChannel : DASChannelDBRecord, INotifyPropertyChanged
|
||||
```
|
||||
Represents a hardware channel associated with a DAS (Data Acquisition System).
|
||||
|
||||
**Constructors:**
|
||||
- `public HardwareChannel()`
|
||||
- `public HardwareChannel(IDASChannelDBRecord record, Hardware h)`
|
||||
- `public HardwareChannel(HardwareChannel copy, Hardware h)`
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ParentDAS` | `Hardware` | Parent hardware device, with `INotifyPropertyChanged` support |
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `PhysicalCompare` | `public static int PhysicalCompare(HardwareChannel left, HardwareChannel right)` | Compares two channels by `ChannelIdx`. Returns -1 if left is null, 1 if right is null, 0 if equal |
|
||||
| `Insert` | `public void Insert()` | Inserts this channel into database via `DbOperations.DASChannelsInsert` |
|
||||
| `IsSupported` | `public bool IsSupported(SensorConstants.BridgeType bridge)` | Checks if bridge type is supported using bitwise AND on `SupportedBridges` |
|
||||
|
||||
---
|
||||
|
||||
### IsoCodeStatics
|
||||
```csharp
|
||||
public class IsoCodeStatics
|
||||
```
|
||||
Static utility class for generating ISO code strings.
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetString` | `public static string GetString(MMEPossibleChannels channel, MMETestObjects container, MMEPositions position, MMEFilterClasses fc)` | Builds ISO code from channel, test object, position, and filter class |
|
||||
| `GetString` | `public static string GetString(MMEPossibleChannels channel, bool careAboutTestTimeFields)` | Builds ISO code, optionally masking test object and filter class with "??"/"?" |
|
||||
| `GetString` | `public static string GetString(string testObject, string position, string main, string floc1, string floc2, string floc3, string physdim, string dir, string fc)` | Concatenates all parts into ISO code string |
|
||||
|
||||
---
|
||||
|
||||
### TestObjectChannel
|
||||
```csharp
|
||||
public class TestObjectChannel : TestObjectTemplateChannel, IComparable<TestObjectChannel>, IGroupChannel
|
||||
```
|
||||
Represents a channel within a test object, extending template channel with metadata.
|
||||
|
||||
**Constants:**
|
||||
- `public const int CHANNEL_IDX_UNKNOWN = -1`
|
||||
- `private const char CHANNEL_SEPARATOR = 'x'`
|
||||
|
||||
**Enum:**
|
||||
```csharp
|
||||
public enum SquibChannelTypes { None, Voltage, Current }
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Default | Description |
|
||||
|----------|------|---------|-------------|
|
||||
| `Disabled` | `bool` | - | Controls whether channel is used in data collection |
|
||||
| `ChannelIdx` | `int` | `CHANNEL_IDX_UNKNOWN` | Channel index |
|
||||
| `SensorSerialNumber` | `string` | `""` | Serial number of associated sensor |
|
||||
| `HardwareId` | `string` | `""` | Physical hardware channel ID (setter parses and reformats) |
|
||||
| `SquibChannelType` | `SquibChannelTypes` | - | Type of squib channel |
|
||||
| `TestObject` | `TestObject` | - | Parent test object (read-only) |
|
||||
|
||||
**Constructors:**
|
||||
- `public TestObjectChannel(TestObjectTemplateChannel copy, TestObject testObject, TestObjectTemplate template)`
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CompareTo` | `public int CompareTo(TestObjectChannel right)` | Compares by: 1) `DisplayOrder`, 2) `Name`, 3) `TestObject.SerialNumberOrOriginalSerialNumber` |
|
||||
| `CompareTo` | `public int CompareTo(IGroupChannel other)` | Delegates to `CompareTo(TestObjectChannel)` |
|
||||
| `GetGraphId` | `public string GetGraphId()` | Returns ID with `Constants.CURRENT_SUFFIX` if `SquibChannelType.Current`, else `GetId()` |
|
||||
| `GetId` | `public string GetId()` | Returns `{SerialNumber}_{MMEChannelType}_{Channel.Id}` |
|
||||
| `GetIdWithSpecificChannelId` | `public string GetIdWithSpecificChannelId(long id)` | Returns `{SerialNumber}_{MMEChannelType}_{id}` |
|
||||
| `GetDASId` | `public string GetDASId()` | Extracts DAS ID from `HardwareId` (substring before first '_') |
|
||||
|
||||
---
|
||||
|
||||
### CalculatedValueClass
|
||||
```csharp
|
||||
public class CalculatedValueClass : CalculatedChannelRecord
|
||||
```
|
||||
Represents a calculated/derived channel value.
|
||||
|
||||
**Constructors:**
|
||||
- `public CalculatedValueClass()`
|
||||
- `public CalculatedValueClass(CalculatedValueClass copy)`
|
||||
- `public CalculatedValueClass(ICalculatedChannelRecord record)`
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `SupportsRealtime` | `bool` | Returns `ViewInRealtime` |
|
||||
| `Operation` | `Operations` | Newed property that raises `ViewInRealtime` and `CanChangeViewInRealtime` change notifications |
|
||||
| `ViewInRealtime` | `bool` | Returns `false` for `IRTRACC3D`, `IRTRACC3D_ABDOMEN`, `IRTRACC3D_LOWERTHORAX`, `HIC` operations |
|
||||
| `CanChangeViewInRealtime` | `bool` | Returns `false` for same operations as above |
|
||||
| `InputChannelIds` | `string[]` | Lazily builds from `_channels` list if populated |
|
||||
| `TestObjectChannels` | `List<TestObjectChannel>` | Associated test object channels |
|
||||
| `InputChannelIdsBlob` | `byte[]` | UTF-8 encoded, list-separator joined channel IDs |
|
||||
| `Attributes` | `CCAttributeBase[]` | Array of calculation attributes |
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `IsValid` | `public bool IsValid(Dictionary<string, bool> channelIdLookup)` | Validates: non-empty name, at least one input channel, all IDs exist in lookup |
|
||||
| `SetChannels` | `public void SetChannels(IGroupChannel[] groupChannels)` | Sets internal `_channels` list |
|
||||
| `SetTestObjectChannels` | `public void SetTestObjectChannels(TestObjectChannel[] testObjectChannels)` | Sets `TestObjectChannels` list |
|
||||
| `ReplaceInputChannelIdAtIndex` | `public void ReplaceInputChannelIdAtIndex(int index, string newId)` | Replaces channel ID at specified index |
|
||||
|
||||
---
|
||||
|
||||
### CCAttributeBase
|
||||
```csharp
|
||||
public abstract class CCAttributeBase
|
||||
```
|
||||
Abstract base for calculated channel attributes.
|
||||
|
||||
| Property | Signature | Description |
|
||||
|----------|-----------|-------------|
|
||||
| `AttributeId` | `public int AttributeId` | Returns protected `_attributeId` |
|
||||
| `_attributeValue` | `protected object` | Protected backing field |
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetSerializedValue` | `public abstract string GetSerializedValue()` | Abstract |
|
||||
| `GetDefaultValue` | `public abstract string GetDefaultValue()` | Abstract |
|
||||
| `GetNameResourceId` | `public abstract string GetNameResourceId { get; }` | Abstract property |
|
||||
| `Copy` | `public abstract CCAttributeBase Copy()` | Abstract |
|
||||
|
||||
---
|
||||
|
||||
### LevelTriggerChannel
|
||||
```csharp
|
||||
public class LevelTriggerChannel
|
||||
```
|
||||
Stores level trigger configuration for a channel.
|
||||
|
||||
**Constructors:**
|
||||
- `public LevelTriggerChannel(LevelTriggerChannel copy)`
|
||||
- `public LevelTriggerChannel(string groupChannelId, string hardwareChannelId, string sensorSerialNumber, bool greaterThanEnabled, double greaterThanEU, bool lessThanEnabled, double lessThanEU, double insideLowerLevelEU, double insideUpperLevelEU, double outsideLowerLevelEU, double outsideUpperLevelEU, bool triggerOutsideBounds, bool triggerInsideBounds)`
|
||||
- `public LevelTriggerChannel(System.Data.DataRow dr)` - Populates from database row using `DbOperations.LevelTriggers.Fields`
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Default | Description |
|
||||
|----------|------|---------|-------------|
|
||||
| `GroupChannel` | `IGroupChannel` | `null` | Associated group channel |
|
||||
| `GroupChannelId` | `string` | `"-1"` | Channel ID |
|
||||
| `HardwareChannelId` | `string` | `""` | Hardware channel ID |
|
||||
| `SensorSerialNumber` | `string` | `""` | Sensor serial |
|
||||
| `GreaterThanEnabled` | `bool` | `true` | Greater-than trigger enabled |
|
||||
| `GreaterThanThresholdEU` | `double` | - | Threshold in engineering units |
|
||||
| `LessThanEnabled` | `bool` | `false` | Less-than trigger enabled |
|
||||
| `LessThanThresholdEU` | `double` | - | Threshold in engineering units |
|
||||
| `TriggerBetweenBounds` | `bool` | `false` | Inside bounds trigger |
|
||||
| `TriggerOutsideBounds` | `bool` | `false` | Outside bounds trigger |
|
||||
| `InsideUpperLevelEU` | `double` | - | Upper bound for inside trigger |
|
||||
| `InsideLowerLevelEU` | `double` | - | Lower bound for inside trigger |
|
||||
| `OutsideUpperLevelEU` | `double` | - | Upper bound for outside trigger |
|
||||
| `OutsideLowerLevelEU` | `double` | - | Lower bound for outside trigger |
|
||||
| `LevelTriggerText` | `string` | - | Human-readable trigger description |
|
||||
|
||||
---
|
||||
|
||||
### TestSetting
|
||||
```csharp
|
||||
public class TestSetting
|
||||
```
|
||||
Represents a single test setting with ID, value, and default.
|
||||
|
||||
**Constants:**
|
||||
- `private const string SEPARATOR = "_x_"`
|
||||
|
||||
**Constructors:**
|
||||
- `public TestSetting(TestSetting copy, string value)`
|
||||
- `public TestSetting(TestSetting copy)`
|
||||
- `public TestSetting(int id, string value, string defaultValue)`
|
||||
- `public TestSetting(TestSettingsEnum id, string value, string defaultValue)`
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Id` | `int` | Setting identifier |
|
||||
| `Value` | `string` | Current value |
|
||||
| `DefaultValue` | `string` | Default value (read-only) |
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ToSerializeString` | `public string ToSerializeString()` | Returns `{Id}={Value}` with '=' replaced by `SEPARATOR` |
|
||||
| `TryParse` | `public static bool TryParse(string s, out TestSetting ts)` | Parses serialized string; tries `TestSettingsEnum` first, then `int` |
|
||||
|
||||
---
|
||||
|
||||
### TestSettingsEnum
|
||||
```csharp
|
||||
public enum TestSettingsEnum
|
||||
```
|
||||
Enumeration of test setting identifiers: `ArmCheckListStep`, `CheckListInputVoltageCheck`, `CheckListBatteryVoltageCheck`, `CheckListSquibResistanceCheck`, `CheckListSensorIDCheck`, `CheckListTriggerStartCheck`, `CheckListTiltSensorCheck`, `CheckListTemperatureCheck`, `CheckListClockSyncCheck`, `EW`, `CheckListMustPass`.
|
||||
|
||||
---
|
||||
|
||||
### TestSettingDictionary
|
||||
```csharp
|
||||
public class TestSettingDictionary
|
||||
```
|
||||
Dictionary container for test settings.
|
||||
|
||||
**Constructors:**
|
||||
- `public TestSettingDictionary()`
|
||||
- `public TestSettingDictionary(TestSettingDictionary copy)`
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetValue` | `public string GetValue(int id, string defaultValue)` | Returns value or default if not found |
|
||||
| `GetValue` | `public string GetValue(TestSettingsEnum id, string defaultValue)` | Overload for enum |
|
||||
| `SetValue` | `public void SetValue(TestSetting setting, string value)` | Creates new `TestSetting` with value |
|
||||
| `SetValue` | `public void SetValue(TestSetting setting)` | Sets setting directly |
|
||||
| `SetValue` | `public void SetValue(TestSettingsEnum id, string value)` | Overload for enum |
|
||||
| `SetValue` | `public void SetValue(int id, string value)` | Creates or updates setting |
|
||||
| `UnLoad` | `public void UnLoad()` | Clears internal dictionary |
|
||||
| `ToSerializeString` | `public string ToSerializeString()` | Serializes all settings |
|
||||
| `LoadSettings` | `public void LoadSettings(string s)` | Deserializes settings, preserving defaults |
|
||||
|
||||
---
|
||||
|
||||
### TestObjectTemplate
|
||||
```csharp
|
||||
public class TestObjectTemplate : ITestObjectTemplate
|
||||
```
|
||||
Lightweight wrapper for group templates from database.
|
||||
|
||||
**Constructors:**
|
||||
- `public TestObjectTemplate(string templateName, bool bLocalOnly)`
|
||||
- `public TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)`
|
||||
|
||||
**Properties:**
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `TemplateName` | `string` | Template name (GUID for embedded templates) |
|
||||
| `TemplateNameOrOriginalTemplateName` | `string` | Human-readable name |
|
||||
| `Icon` | `string` | Icon identifier |
|
||||
| `Description` | `string` | Template description |
|
||||
| `LocalOnly` | `bool` | Whether template is local-only |
|
||||
| `Version` | `int` | Version number |
|
||||
| `LastModifiedBy` | `string` | Last modifier |
|
||||
| `LastModified` | `DateTime` | Last modification date |
|
||||
| `CRC32` | `int` | Checksum (not currently used per comments) |
|
||||
| `TestObject` | `string` | ISO meta field |
|
||||
| `TestObjectType` | `string` | ISO meta field for channel type |
|
||||
| `TemplateParent` | `string` | Parent template (for composite templates) |
|
||||
| `SysBuilt` | `bool` | System-built flag |
|
||||
| `Channels` | `TestObjectTemplateChannel[]` | All channels |
|
||||
| `OriginalTemplateName` | `string` | Original name for embedded templates |
|
||||
| `Embedded` | `bool` | Whether embedded in test setup |
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `IsISOMode` | `public bool IsISOMode()` | Returns `false` if `TestObjectType` contains non-ISO markers |
|
||||
| `GetTemplate` | `public static TestObjectTemplate GetTemplate(ref ISO13499FileDb db, string name)` | Returns `null` (unimplemented) |
|
||||
|
||||
---
|
||||
|
||||
### MMEFilterClasses
|
||||
```csharp
|
||||
public class MMEFilterClasses : AbstractOLEDbWrapper
|
||||
```
|
||||
Represents ISO 13499 filter class metadata.
|
||||
|
||||
**Constructors:**
|
||||
- `public MMEFilterClasses(string sGuid, string filterClass, string textL1, string textL2, long version, DateTime date, string remarks, bool bExpired, string sortKey, DateTime lastChange, string lastChangeText, string history, MMEPossibleChannels.MMEChannelTypes type)`
|
||||
|
||||
**Properties:** `S_GUID`, `Filter_Class`, `Text_L1`, `Text_L2`, `Version`, `Date`, `Remarks`, `Expired`, `SortKey`, `Last_Change`, `Last_Change_Text`, `History`, `RecordType` (default: `ISO13499_106`).
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetFilterClasses` | `public static MMEFilterClasses[] GetFilterClasses()` | Queries database for all filter classes |
|
||||
| `ReadXML` | `public static MMEFilterClasses ReadXML(XmlElement node)` | Imports from XML using `CustomFilterFields` enum |
|
||||
| `ToString` | `public override string ToString()` | Returns `Text_L1` |
|
||||
|
||||
---
|
||||
|
||||
### MMEPositions
|
||||
```csharp
|
||||
public class MMEPositions : AbstractOLEDbWrapper
|
||||
```
|
||||
Represents ISO 13499 position metadata.
|
||||
|
||||
**Constructors:**
|
||||
- `public MMEPositions(string sGuid, string position, string textL1, string textL2, long version, DateTime date, string remarks, bool expired, string sortKey, DateTime lastChange, string lastChangeText, string history, MMEPossibleChannels.MMEChannelTypes type)`
|
||||
|
||||
**Properties:** `S_GUID`, `Position`, `Text_L1`, `Text_L2`, `Version`, `Date`, `Remarks`, `Expired`, `SortKey`, `Last_Change`, `Last_Change_Text`, `History`, `RecordType`.
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetPositions` | `public static MMEPositions[] GetPositions()` | Queries database for all positions |
|
||||
| `ReadXML` | `public static MMEPositions ReadXML(XmlElement node)` | Imports from XML using `PositionFields` enum |
|
||||
|
||||
---
|
||||
|
||||
### MMEFineLocations2
|
||||
```csharp
|
||||
public class MMEFineLocations2 : AbstractOLEDbWrapper
|
||||
```
|
||||
Represents ISO 13499 fine location 2 metadata.
|
||||
|
||||
**Constructors:**
|
||||
- `public MMEFineLocations2(string sGuid, string fineLoc2, string textL1, string textL2, long version, DateTime date, string remarks, bool expired, string sortKey, DateTime lastChange, string lastChangeText, string history, MMEPossibleChannels.MMEChannelTypes type)`
|
||||
|
||||
**Properties:** `S_GUID`, `FINE_LOC_2`, `Text_L1`, `Text_L2`, `Version`, `Date`, `Remarks`, `Expired`, `SortKey`, `Last_Change`, `Last_Change_Text`, `History`, `RecordType`.
|
||||
|
||||
**Methods:**
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetFineLocations2` | `public static MMEFineLocations2[] GetFineLocations2()` | Queries database for all fine locations 2 |
|
||||
| `ReadXML` | `public static MMEFineLocations2 ReadXML(XmlElement node)` | Imports from XML using `CustomFinLoc2Fields` enum |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **HardwareChannel.IsSupported**: Uses bitwise AND comparison - the bridge type value must be exactly matchable within `SupportedBridges` flags.
|
||||
- **TestObjectChannel.CompareTo**: Null right operand returns 1; null left operand (implicit in static compare) returns -1.
|
||||
- **TestObjectChannel.ChannelIdx**: Initialized to `CHANNEL_IDX_UNKNOWN` (-1).
|
||||
- **TestObjectChannel.HardwareId setter**: If value contains exactly 3 underscore-separated tokens, reformats to `{token0}_{token1}{suffix}` where suffix is everything after `CHANNEL_SEPARATOR` ('x') in token2.
|
||||
- **CalculatedValueClass.ViewInRealtime**: Always returns `false` for operations `IRTRACC3D`, `IRTRACC3D_ABDOMEN`, `IRTRACC3D_LOWERTHORAX`, and `HIC`.
|
||||
- **CalculatedValueClass.IsValid**: Requires non-whitespace `Name`, at least one `InputChannelId`, and all IDs present in lookup dictionary.
|
||||
- **AbstractOLEDbWrapper.GetLong**: Returns `long.MinValue` for `DBNull` values.
|
||||
- **AbstractOLEDbWrapper.GetDate**: Returns `DateTime.MinValue` for `DBNull` values.
|
||||
- **TestSettingDictionary.LoadSettings**: Preserves existing default settings; only updates `Value` for existing keys.
|
||||
- **TestObjectTemplate.GetTemplate**: Currently returns `null` (unimplemented).
|
||||
- **MMEFilterClasses/MMEPositions/MMEFine
|
||||
44
docs/ai/Common/DTS.Common.ISO/Properties.md
Normal file
44
docs/ai/Common/DTS.Common.ISO/Properties.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.ISO/Properties/AssemblyInfo.cs
|
||||
- Common/DTS.Common.ISO/Properties/Resources.Designer.cs
|
||||
generated_at: "2026-04-17T16:26:51.851586+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b4eff99fcf500a76"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module provides assembly-level metadata and embedded resources for the `DTS.Common.ISO` assembly. It contains standard .NET assembly information attributes and a strongly-typed resource accessor class for retrieving embedded bitmap images (logos) used within the ISO-related functionality.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**Assembly-level attributes** (in `AssemblyInfo.cs`)
|
||||
- `AssemblyTitle`: "ISO"
|
||||
- `AssemblyVersion`: "1.0.0.0"
|
||||
- `AssemblyFileVersion`: "1.0.0.0"
|
||||
- `ComVisible`: false
|
||||
- `Guid`: "566d4127-454b-42d1-8ac6-a9b94bd8c378"
|
||||
|
||||
**`Resources`** (internal class, auto-generated)
|
||||
- `ResourceManager ResourceManager { get; }` — Returns the cached ResourceManager instance for this assembly.
|
||||
- `CultureInfo Culture { get; set; }` — Gets or sets the current UI culture for resource lookups.
|
||||
- `System.Drawing.Bitmap DTS_2C_Logo { get; }` — Looks up a localized bitmap resource named "DTS_2C_Logo".
|
||||
- `System.Drawing.Bitmap DTS_2C_web_small { get; }` — Looks up a localized bitmap resource named "DTS_2C_web_small".
|
||||
|
||||
### Invariants
|
||||
- The `Resources` class is marked `internal`, limiting access to within the `DTS.Common.ISO` assembly.
|
||||
- The resource manager is initialized with base name `"ISO.Properties.Resources"`.
|
||||
- All code in `Resources.Designer.cs` is auto-generated; manual edits will be lost on regeneration.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Reflection`, `System.Runtime.InteropServices`, `System.Drawing`, `System.Resources`, `System.Globalization`.
|
||||
- **Depended on by**: Unclear from source alone—likely consumed internally by other classes in the `DTS.Common.ISO` assembly for logo display.
|
||||
|
||||
### Gotchas
|
||||
- The `Resources` class is auto-generated by `StronglyTypedResourceBuilder` version 17.0.0.0; any manual modifications will be overwritten.
|
||||
- The resource base name `"ISO.Properties.Resources"` may not match the namespace `DTS.Common.ISO` if the project's default namespace differs from the folder structure—this could cause runtime resource lookup failures.
|
||||
|
||||
---
|
||||
81
docs/ai/Common/DTS.Common.ISO/Strings.md
Normal file
81
docs/ai/Common/DTS.Common.ISO/Strings.md
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.ISO/Strings/StringResources.Designer.cs
|
||||
generated_at: "2026-04-17T15:42:54.174916+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0bdbaddad0c55f8b"
|
||||
---
|
||||
|
||||
# Documentation: StringResources.Designer.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a strongly-typed, auto-generated resource accessor class for localized string constants used throughout the ISO namespace. It centralizes user-facing messages, validation error strings, and device identification patterns for various Data Acquisition System (DAS) hardware products. The class enables culture-aware string lookups via .NET's resource management infrastructure, serving as the single source of truth for display strings in this component.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
**Note:** The class is marked `internal`, so it is only accessible within its assembly.
|
||||
|
||||
### Class: `StringResources` (internal)
|
||||
|
||||
**Static Properties:**
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ResourceManager` | `global::System.Resources.ResourceManager` | Returns the cached `ResourceManager` instance for this assembly. Lazily initialized with base name `"ISO.Strings.StringResources"`. Marked with `EditorBrowsableState.Advanced`. |
|
||||
| `Culture` | `global::System.Globalization.CultureInfo` | Gets or sets the current thread's `CurrentUICulture` for resource lookups. Marked with `EditorBrowsableState.Advanced`. |
|
||||
|
||||
**Resource String Properties (all `internal static string`, read-only):**
|
||||
|
||||
The following categories of string resources are exposed as static properties. Each calls `ResourceManager.GetString(stringName, resourceCulture)`:
|
||||
|
||||
- **Auto-Detection Messages** (~50 properties): Device serial number validation messages for hardware including:
|
||||
- `AutoDetectDas_DIMShouldStartWithSPD` — SLICE PRO DIM serial prefix validation
|
||||
- `AutoDetectDas_DIRShouldStartWithDI` — DIR serial prefix validation
|
||||
- `AutoDetectDas_DKRShouldStartWithDK` — DKR serial prefix validation
|
||||
- `AutoDetectDAS_G5ShouldStartWith5M` — TDAS G5 serial prefix validation
|
||||
- `AutoDetectDAS_IPAddressRequired` — IP address requirement message
|
||||
- `AutoDetectDAS_MICROBasePlusShouldStartWithBA0` — SLICE MICRO Base+ prefix validation
|
||||
- `AutoDetectDas_MicroSerialNumberShouldStartWithBA0` — SLICE MICRO prefix validation
|
||||
- `AutoDetectDAS_NANOBasePlusShouldStartWithBA5` — SLICE NANO Base+ prefix validation
|
||||
- `AutoDetectDas_PowerProShouldStartWithPPRO` — PowerPRO prefix validation
|
||||
- `AutoDetectDAS_SerialNumberBelongsToAG5` — Device identification message
|
||||
- `AutoDetectDAS_SerialNumberBelongsToAMicro` — Device identification message
|
||||
- `AutoDetectDas_SerialNumberBelongsToANano` — Device identification message
|
||||
- `AutoDetectDAS_SerialNumberBelongsToAPowerPRO` — Device identification message
|
||||
- `AutoDetectDas_SerialNumberBelongsToASLICEG5` — Device identification message
|
||||
- `AutoDetectDAS_SerialNumberBelongsToASLICEPROLabSIM` — Device identification message
|
||||
- `AutoDetectDAS_SerialNumberBelongsToASlicePROLabSLE` — Device identification message
|
||||
- `AutoDetectDas_SerialNumberBelongsToASLICEProSim` — Device identification message
|
||||
- `AutoDetectDAS_SerialNumberBelongsToATDASLabRack` — Device identification message
|
||||
- `AutoDetectDas_SerialNumberBelongsToATDASRack` — Device identification message
|
||||
- `AutoDetectDAS_SerialNumberRequired` — Serial number requirement message
|
||||
- `AutoDetectDas_SIMShouldStartWithSPS` — SLICE PRO SIM prefix validation
|
||||
- `AutoDetectDAS_SLDShouldStartWithSLD` — SLICE PRO Lab DIM prefix validation
|
||||
- `AutoDetectDAS_SLICE_SerialNumberBelongsToASLICELABDIM` — Device identification
|
||||
- `AutoDetectDAS_SLICE_SerialNumberBelongsToASLICELABTOM` — Device identification
|
||||
- `AutoDetectDas_SLICE_SerialNumberBelongsToASLICEProDIM` — Device identification
|
||||
- `AutoDetectDas_SLICE6AIRBRShouldStartWith` — SLICE 6 AIR-BR prefix validation
|
||||
- `AutoDetectDas_SLICE6AIRShouldStartWith` — SLICE 6 AIR prefix validation
|
||||
- `AutoDetectDas_SLICE6DB3ShouldStartWith` — SLICE 6 distributor 3 prefix validation
|
||||
- `AutoDetectDas_Slice6DBShouldStartWithS6DB` — SLICE 6 distributor prefix validation
|
||||
- `AutoDetectDas_SLICE6ShouldStartWith` — SLICE 6 prefix validation
|
||||
- `AutoDetectDas_SliceDBShouldStartWithSDB` — SLICE distributor prefix validation
|
||||
- `AutoDetectDas_SliceECM` — SLICE PRO Ethernet Control Module prefix validation
|
||||
- `AutoDetectDas_SliceG5ShouldStartWithSG5` — SLICE G5 prefix validation
|
||||
- `AutoDetectDAS_SliceLabEthernetShouldStartWithSLE` — SLICE Lab Ethernet prefix validation
|
||||
- `AutoDetectDas_SLICENanoShouldStartWithBA5` — SLICE NANO prefix validation
|
||||
- `AutoDetectDAS_SLICEPRODBShouldStartWithSPDB` — SLICE PRO Distributor prefix validation
|
||||
- `AutoDetectDas_SliceSPM` — SLICE Mini Distributor prefix validation
|
||||
- `AutoDetectDAS_SLSShouldStartWithSLS` — SLICE PRO Lab SIM prefix validation
|
||||
- `AutoDetectDAS_SLTShouldStartWithSLT` — SLICE PRO Lab TOM prefix validation
|
||||
- `AutoDetectDAS_TDASLabRackShouldStartWith` — TDAS PRO lab rack prefix validation
|
||||
- `AutoDetectDas_TDASRackShouldStartWith` — TDAS PRO rack prefix validation
|
||||
- `AutoDetectDas_TOMShouldStartWithSPT` — SLICE PRO TOM prefix validation
|
||||
- `AutoDetectDas_TSRAIRShouldStartWithTA` — TSR AIR prefix validation
|
||||
- `AutoDetectDas_TypeShouldStartWithPrepend` — Generic format string with placeholders `{0}` and `{1}`
|
||||
|
||||
- **Customer Details Messages:**
|
||||
- `CustomerDetails_FailedToCommit` — Commit failure message
|
||||
- `Customer
|
||||
285
docs/ai/Common/DTS.Common.Import.md
Normal file
285
docs/ai/Common/DTS.Common.Import.md
Normal file
@@ -0,0 +1,285 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/ImportError.cs
|
||||
- Common/DTS.Common.Import/ParseProcessor.cs
|
||||
- Common/DTS.Common.Import/TsetSetupImportSensorInfo.cs
|
||||
- Common/DTS.Common.Import/CsvUtil.cs
|
||||
- Common/DTS.Common.Import/ImportNotification.cs
|
||||
- Common/DTS.Common.Import/XMLParseProcessor.cs
|
||||
- Common/DTS.Common.Import/CalibrationImport.cs
|
||||
- Common/DTS.Common.Import/GroupHelper.cs
|
||||
- Common/DTS.Common.Import/ImportObject.cs
|
||||
generated_at: "2026-04-17T15:32:34.821158+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "148f67b9afc6f9fe"
|
||||
---
|
||||
|
||||
# DTS.Common.Import Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the core infrastructure for importing test configuration data into the DTS system. It handles parsing of CSV and XML files containing sensor definitions, calibrations, test setups, groups, hardware configurations, and related metadata. The module centralizes all imported data through the `ImportObject` container, provides progress notification via `IImportNotification`, and includes utilities for calibration processing and group management.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ImportError.cs
|
||||
|
||||
**Enum: `ImportSeverityError`**
|
||||
```csharp
|
||||
public enum ImportSeverityError
|
||||
{
|
||||
Critical,
|
||||
Error,
|
||||
Warning,
|
||||
Info
|
||||
}
|
||||
```
|
||||
|
||||
**Class: `ImportError`**
|
||||
```csharp
|
||||
public string Message { get; set; }
|
||||
public ImportSeverityError Severity { get; set; }
|
||||
public bool ContinueImportOnError { get; set; } = true; // defaults to true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### ParseProcessor.cs
|
||||
|
||||
**Class: `ParseProcessor`**
|
||||
|
||||
Constructor:
|
||||
```csharp
|
||||
public ParseProcessor(ImportObject importObject, IEnumerable<string> fileNames, IEnumerable<IParseVariant> parseVariants)
|
||||
```
|
||||
|
||||
Methods:
|
||||
```csharp
|
||||
public ImportObject Process()
|
||||
```
|
||||
Iterates through all file names and parse variants, invoking `variant.Parse(ref _importObject)` for each combination. Returns the modified `ImportObject`.
|
||||
|
||||
---
|
||||
|
||||
### TsetSetupImportSensorInfo.cs
|
||||
|
||||
**Class: `TsetSetupImportSensorInfo`** (sealed)
|
||||
|
||||
Constructors:
|
||||
```csharp
|
||||
public TsetSetupImportSensorInfo(string serialNumber, string isoCode, string isoChannelName,
|
||||
string userCode, string userChannelName, string dasSerialNumber, int dasChannelIdx)
|
||||
|
||||
public TsetSetupImportSensorInfo(string serialNumber, string isoCode)
|
||||
```
|
||||
|
||||
Properties (all read-only except `GroupType`):
|
||||
```csharp
|
||||
public string IsoCode { get; }
|
||||
public string IsoChannelName { get; }
|
||||
public string UserCode { get; }
|
||||
public string UserChannelName { get; }
|
||||
public string SerialNumber { get; }
|
||||
public string GroupType { get; set; } // read-write
|
||||
public string DASSerialNumber { get; }
|
||||
public int DASChannelIndex { get; }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### CsvUtil.cs
|
||||
|
||||
**Static Class: `CsvUtil`**
|
||||
|
||||
```csharp
|
||||
public static CsvReader CreateCsvReader(string filename)
|
||||
```
|
||||
Creates a `CsvReader` using `CultureInfo.InvariantCulture` with a `StreamReader` for the given filename.
|
||||
|
||||
```csharp
|
||||
public static List<string> ReadFields(CsvReader csvReader, bool readNextLine = true)
|
||||
```
|
||||
Reads fields from the CSV reader. If `readNextLine` is true, calls `csvReader.Read()` first. Returns a list of trimmed field values from all columns (index 0 to `ColumnCount - 1`).
|
||||
|
||||
---
|
||||
|
||||
### ImportNotification.cs
|
||||
|
||||
**Class: `ImportStatus`**
|
||||
```csharp
|
||||
public string Status { get; set; }
|
||||
public PossibleStatus PossibleStatus { get; set; }
|
||||
public ImportExtraStatus ExtraStatus { get; set; }
|
||||
```
|
||||
|
||||
**Interface: `IImportNotification`**
|
||||
```csharp
|
||||
Action ImportDone { get; }
|
||||
Action<List<string>> ReportErrors { get; }
|
||||
Action<double> SetProgress { get; }
|
||||
Action<ImportStatus> SetStatus { get; }
|
||||
```
|
||||
|
||||
**Class: `ImportNotification`** (implements `IImportNotification`)
|
||||
|
||||
Constructors:
|
||||
```csharp
|
||||
public ImportNotification(Action<List<string>> reportErrors, Action<ImportStatus> setStatus,
|
||||
Action<double> setProgress, Action importDone)
|
||||
|
||||
public ImportNotification() // creates no-op handlers for all actions
|
||||
```
|
||||
|
||||
Properties:
|
||||
```csharp
|
||||
public Action<List<string>> ReportErrors { get; private set; }
|
||||
public Action<ImportStatus> SetStatus { get; private set; }
|
||||
public Action<double> SetProgress { get; private set; }
|
||||
public Action ImportDone { get; private set; }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### XMLParseProcessor.cs
|
||||
|
||||
**Class: `XMLParseProcessor`**
|
||||
|
||||
Constructor:
|
||||
```csharp
|
||||
public XMLParseProcessor(ImportObject importObject, IImportNotification importNotification,
|
||||
IEnumerable<string> fileNames, Func<bool> isCancelled, bool skipNormalizing)
|
||||
```
|
||||
|
||||
Properties:
|
||||
```csharp
|
||||
public List<IUIItems> UIItems { get; set; }
|
||||
```
|
||||
|
||||
Methods:
|
||||
```csharp
|
||||
public ImportObject Process()
|
||||
```
|
||||
Processes XML files using parsers created by `XmlParserFactory`. Sets status to `ImportExtraStatus.ReadingXML`, calculates progress based on items completed vs. total items to complete.
|
||||
|
||||
---
|
||||
|
||||
### CalibrationImport.cs
|
||||
|
||||
**Class: `CalibrationImport`** (implements `ICalibrationImport`)
|
||||
|
||||
```csharp
|
||||
public SensorCalibration CheckForExcitationCalibration(SensorCalibration sc, double sensitivity,
|
||||
ExcitationVoltageOptions.ExcitationVoltageOption excitation, string EU)
|
||||
```
|
||||
Checks if the first calibration record has the specified excitation; if not, adds a new `CalibrationRecord` with the given parameters.
|
||||
|
||||
```csharp
|
||||
public SensorCalibration AddLinearCalRecordIfNeeded(SensorCalibration sc, bool savedIsProportional, bool savedRemoveOffset)
|
||||
```
|
||||
If `sc.Records.Records` has exactly one entry, adds a second linear calibration record and restores `IsProportional` and `RemoveOffset` flags.
|
||||
|
||||
```csharp
|
||||
public SensorCalibration AddLinearZeroMethodIfNeeded(SensorCalibration sc, ZeroMethodType zeroMethodType,
|
||||
double zeroMethodStart, double zeroMethodEnd)
|
||||
```
|
||||
If `sc.ZeroMethods.Methods` has exactly one entry, adds a second `ZeroMethod` with the specified parameters.
|
||||
|
||||
---
|
||||
|
||||
### GroupHelper.cs
|
||||
|
||||
**Static Class: `GroupHelper`**
|
||||
|
||||
```csharp
|
||||
public static IGroup CreateEmptyGroup()
|
||||
```
|
||||
Returns a new `GroupList.Model.Group(true)`.
|
||||
|
||||
```csharp
|
||||
public static void GetTestSensorParameters(out string isoCode, out string isoChannelName,
|
||||
out string userCode, out string userChannelName, ParseParameters pp, SensorData sd,
|
||||
out string dasSerialNumber, out int dasChannelIdx)
|
||||
```
|
||||
Extracts sensor parameters, preferring values from `ParseParameters` dictionaries when available.
|
||||
|
||||
```csharp
|
||||
public static IReadOnlyDictionary<string, int> GetDAS(
|
||||
Dictionary<string, List<TsetSetupImportSensorInfo>> groupSensorLookupgroupSensorLookup,
|
||||
DASHardware[] allDAS)
|
||||
```
|
||||
Builds a lookup dictionary mapping DAS serial numbers to DAS IDs.
|
||||
|
||||
```csharp
|
||||
public static int? GetGroupId(TestTestObject testObject, Dictionary<string, int> groupIdMapping,
|
||||
List<TestObject> groupList)
|
||||
```
|
||||
Finds the group ID for a test object by traversing group relationships.
|
||||
|
||||
```csharp
|
||||
public static List<string> ReverseChannelOrder(TestTemplate testTemplate,
|
||||
Dictionary<string, string> sensorGroupNameLookup, List<SensorData> sensors)
|
||||
```
|
||||
Returns a reversed list of channel order strings in format `{testTemplate.Name}_{groupName}_{comment}`.
|
||||
|
||||
```csharp
|
||||
public static List<SensorData> CleanUneededSensorDataPlaceHolder(
|
||||
Dictionary<string, List<SensorCalibration>> calibrationLookup, List<SensorData> sensorList)
|
||||
```
|
||||
Removes sensor data entries that are ISO-channel-only placeholders or have invalid default calibrations.
|
||||
|
||||
```csharp
|
||||
public static List<SensorData> NormalizeSensorIds(List<SensorData> sensorList)
|
||||
```
|
||||
Normalizes sensor database IDs: existing sensors get their real IDs; new sensors get negative IDs (-2, -3, etc.).
|
||||
|
||||
---
|
||||
|
||||
### ImportObject.cs
|
||||
|
||||
**Class: `ImportObject`**
|
||||
|
||||
This is the central data container for imports. Key properties and methods:
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
public ImportFormats SourceFormat { get; set; } = ImportFormats.NOT_SPECIFIED;
|
||||
public ImportFileFormat TestSetupImportFileFormat { get; set; } = ImportFileFormat.NoTestSetup;
|
||||
```
|
||||
|
||||
**Format Detection:**
|
||||
```csharp
|
||||
public ImportFileFormat GetImportFileFormat()
|
||||
public static ImportFileFormat GetImportFileFormat(int testSetupCount)
|
||||
```
|
||||
Returns `SingleTestSetup`, `MultipleTestSetup`, or `NoTestSetup` based on test setup count.
|
||||
|
||||
**Error Management:**
|
||||
```csharp
|
||||
public void ClearErrors()
|
||||
public void AddErrors(IEnumerable<ImportError> d)
|
||||
public void AddError(ImportError d)
|
||||
public IEnumerable<ImportError> Errors()
|
||||
```
|
||||
|
||||
**Data Collections (Add/Get methods for each):**
|
||||
- `Calibrations()` / `AddCalibration(SensorCalibration)` / `AddCalibrations(IEnumerable<SensorCalibration>)`
|
||||
- `TestSetups()` / `AddTestSetup(TestTemplate)` / `AddTestSetups(IEnumerable<TestTemplate>)` / `ClearTestSetups()`
|
||||
- `Sensors()` / `AddSensor(SensorData)` / `AddSensors(IEnumerable<SensorData>)` / `ClearSensors()`
|
||||
- `Groups()` / `AddGroup(TestObject)` / `AddGroups(IEnumerable<TestObject>)`
|
||||
- `GroupTemplates()` / `AddGroupTemplate(TestObjectTemplate)` / `AddGroupTemplates(IEnumerable<TestObjectTemplate>)`
|
||||
- `Hardware()` / `AddHardware(DASHardware)` / `AddHardwareList(IEnumerable<DASHardware>)`
|
||||
- `CustomChannels()` / `AddCustomChannel(MMEPossibleChannels)` / `AddCustomChannels(IEnumerable<MMEPossibleChannels>)`
|
||||
- `Users()` / `AddUser(User)` / `AddUsers(IEnumerable<User>)`
|
||||
- `CustomerDetails()` / `LabDetails()` / `TestEngineerDetails()`
|
||||
- `StaticGroups()` / `AddStaticGroup(IGroup)` / `AddStaticGroups(IEnumerable<IGroup>)`
|
||||
- `SensorModels()` / `AddSensorModel(SensorModel)` / `AddSensorModels(IEnumerable<SensorModel>)`
|
||||
- Various MME-related collections: `PhysicalDimensions()`, `CustomPositions()`, `CustomFilterClasses()`, `CustomFineLoc1s()`, `CustomFineLoc2s()`, `CustomFineLoc3s()`, `Directions()`, `CustomMainLocations()`, `TestObjects()`
|
||||
|
||||
**Lookup Dictionaries:**
|
||||
```csharp
|
||||
public void AssignSensorLookup(Dictionary<string, SensorData> sensorLookup)
|
||||
public void AddSensorLookup(string serial, SensorData sensorData)
|
||||
public Sensor
|
||||
65
docs/ai/Common/DTS.Common.Import/DatabaseLocks.md
Normal file
65
docs/ai/Common/DTS.Common.Import/DatabaseLocks.md
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/DatabaseLocks/LockImportGroups.cs
|
||||
- Common/DTS.Common.Import/DatabaseLocks/LockImportTestSetups.cs
|
||||
- Common/DTS.Common.Import/DatabaseLocks/LockImportSensors.cs
|
||||
generated_at: "2026-04-17T15:39:02.672881+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2421f56d39216d6a"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Import.DatabaseLocks
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides database locking mechanisms for import operations, ensuring that concurrent imports do not conflict by acquiring locks on Groups, TestSetups, and Sensors before import proceeds. It implements the `ILockImport` interface across three classes—`LockImportGroups`, `LockImportTestSetups`, and `LockImportSensors`—each managing locks for a specific entity type. The module handles lock acquisition, detection of contended locks (locks held by other users), automatic reclamation of expired "stranded" locks, and privileged lock stealing by administrators. All three classes reference FB 36740 in their namespace comments, suggesting they were created to address a specific feature request or bug fix.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interface: `ILockImport` (from `DTS.Common.Import.Interfaces`)
|
||||
|
||||
All three classes implement this interface with the following members:
|
||||
|
||||
#### `bool Contended { get; }`
|
||||
Returns `true` if any items could not be locked because another user holds the lock.
|
||||
|
||||
#### `void FreeLock(ref ImportObject importObject)`
|
||||
Releases all locks currently held by this instance. Iterates through the internal locked items list and calls `LockManager.FreeLock` for each. The `importObject` parameter is passed by reference but **is not used** in the implementation.
|
||||
|
||||
#### `void SetLock(ref ImportObject importObject, ref StringBuilder message)`
|
||||
Attempts to acquire locks on all relevant items from the `importObject`. Populates the `message` StringBuilder with details of any contended items. Clears internal lock tracking lists at the start of execution.
|
||||
|
||||
#### `bool StealLock(bool proceed)`
|
||||
Attempts to forcibly acquire contended locks. Returns `true` if no contention exists or if locks were successfully stolen; `false` if the user lacks admin privileges or `proceed` is `false`.
|
||||
|
||||
---
|
||||
|
||||
### Class: `LockImportGroups`
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public LockImportGroups(User currentUser, double strandedLockTimeoutMinutes)
|
||||
```
|
||||
|
||||
**Behavior:**
|
||||
- Locks items from `importObject.StaticGroups()`
|
||||
- Uses `LockManager.ItemCategories.Group` for lock operations
|
||||
- Tracks locks in `_lockedGroups` (successful) and `_contendedGroups` (failed due to contention)
|
||||
- Uses `StringResources.ImportTestSetup_GroupsLocked` for contention messages
|
||||
|
||||
---
|
||||
|
||||
### Class: `LockImportTestSetups`
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public LockImportTestSetups(User currentUser, double strandedLockTimeoutMinutes)
|
||||
```
|
||||
|
||||
**Behavior:**
|
||||
- Locks items from `importObject.TestSetups()`
|
||||
- Uses `LockManager.ItemCategories.TestSetup` for initial lock attempts
|
||||
- Tracks locks in `_lockedTests` (
|
||||
94
docs/ai/Common/DTS.Common.Import/Factories.md
Normal file
94
docs/ai/Common/DTS.Common.Import/Factories.md
Normal file
@@ -0,0 +1,94 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Factories/CSVTestParserFactory.cs
|
||||
- Common/DTS.Common.Import/Factories/DatabaseLocksFactory.cs
|
||||
- Common/DTS.Common.Import/Factories/CSVSensorParserFactory.cs
|
||||
- Common/DTS.Common.Import/Factories/SaveVariantFactory.cs
|
||||
- Common/DTS.Common.Import/Factories/XmlParserFactory.cs
|
||||
generated_at: "2026-04-17T15:35:40.559078+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "eef1e6fa8b308008"
|
||||
---
|
||||
|
||||
# DTS.Common.Import.Factories Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a collection of factory classes responsible for creating and configuring parsers, persisters, and database locks for the DTS import system. The factories abstract the instantiation logic for versioned CSV parsers (tests and sensors), XML parsers (with version-specific handling), save handlers for various import entity types, and database locking mechanisms. This design centralizes object creation, enabling consistent initialization and easier maintenance of the import pipeline.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### CSVTestParserFactory
|
||||
|
||||
**Class:** `DTS.Common.Import.Factories.CSVTestParserFactory`
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CreateCSVParsers` | `public static IParseCSVTest[] CreateCSVParsers()` | Creates and returns an array of CSV test parsers for versions 0, 5, and 6. Parsers are instantiated in order and returned as an array. |
|
||||
|
||||
---
|
||||
|
||||
### DatabaseLocksFactory
|
||||
|
||||
**Class:** `DTS.Common.Import.Factories.DatabaseLocksFactory` (static)
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Create` | `public static List<ILockImport> Create(ImportObject importObject, User user, double strandedLockTimeoutMinutes)` | Creates a list of lock import objects based on the contents of the provided `ImportObject`. Only creates locks for entity types that have data (TestSetups, Sensors, StaticGroups). |
|
||||
|
||||
---
|
||||
|
||||
### CSVSensorParserFactory
|
||||
|
||||
**Class:** `DTS.Common.Import.Factories.CSVSensorParserFactory`
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CreateCSVParsers` | `public static IReadOnlyDictionary<int, IParseCSVSensor> CreateCSVParsers(ICalibrationImport import, ZeroMethodOptions zmOptions, IImportNotification importNotification, bool importCreateDynamicGroups, bool useISOCodeFilterMapping, bool useZeroForUnfiltered)` | Creates a read-only dictionary mapping version numbers to CSV sensor parsers. Initializes parsers for versions 0, 2, 3, and 4 with the provided configuration parameters. |
|
||||
|
||||
---
|
||||
|
||||
### SaveVariantFactory
|
||||
|
||||
**Class:** `DTS.Common.Import.Factories.SaveVariantFactory` (static)
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CreateVariants` | `public static List<IPersistImport> CreateVariants(ImportObject importObject, ImportNotification importNotification, User user, Func<bool> isCanceled, bool showCheckoutButton)` | Creates a list of save handlers (`IPersistImport`) for all entity types present in the `ImportObject`. Handles CustomerDetails, TestEngineerDetails, LabDetails, SensorModels, Sensors, Users, GlobalSettings, Hardware, GroupTemplates, Groups, and TestSetups. Conditionally creates checkout test setups when `showCheckoutButton` is true. |
|
||||
|
||||
---
|
||||
|
||||
### XmlParserFactory
|
||||
|
||||
**Class:** `DTS.Common.Import.XmlParserFactory` (static)
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `UIItems` | `List<IUIItems>` | Static property for UI items used during XML parsing. |
|
||||
| `ImportNotification` | `IImportNotification` | Static property for import notifications. |
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CreateXMLParsers` | `public static IEnumerable<IParseVariant> CreateXMLParsers(string fileName, IImportNotification importNotification, Func<bool> isCanceled, bool skipNormalizing)` | Entry point for creating XML parsers. Reads the file to determine import version and delegates to version-specific factory methods. |
|
||||
| `LessThan20XMLVersion` | `private static List<IParseVariant> LessThan20XMLVersion(XmlElement node, double importVersion)` | Creates parsers for XML versions below 2.0. Handles CustomChannels, CustomMainLocs, DASList, Sensors, Calibrations, GroupTemplates, Groups, and TestSetups. |
|
||||
| `GreaterOrEqual20XMLVersion` | `private static List<IParseVariant> GreaterOrEqual20XMLVersion(XmlElement node, double importVersion, bool skipNormalizing)` | Creates parsers for XML versions 2.0 and above. Handles LabDetails, CustomerDetails, TestEngineerDetails, DASList, Sensors, Calibrations, GroupTemplates, Groups, TestSetups, and Users. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **CSVTestParserFactory**: Always returns parsers in the order: Version0, Version5, Version6. The array length is always 3.
|
||||
- **CSVSensorParserFactory**: The returned dictionary is keyed by the parser's `Version` property (accessed via `v0.Version`, `v2.Version`, etc.). Versions 0, 2, 3, and 4 are always included.
|
||||
- **DatabaseLocksFactory**: Only creates lock objects for entity types where `importObject.<Entities>().Any()` returns true. An empty list is returned if no entities are present.
|
||||
- **SaveVariantFactory**:
|
||||
- A single shared `PersistCalculator` instance is used across all save handlers.
|
||||
- `SaveCustomChannels` and `SaveHardware` are instantiated regardless of whether data exists, but only added to `saveHandlers` if `Hardware().Any()` is true for `SaveHardware`.
|
||||
- `SaveGroups` is only added to `saveHandlers` if `Groups().Any()` or `StaticGroups().Any()` is true.
|
||||
- When `showCheckoutButton` is true, both `SaveTestSetup` and `SaveCheckoutTestSetup` are created for test setups.
|
||||
- **XmlParserFactory**:
|
||||
- The version threshold is `FileUtils.DataPRO20XmlVersion`. Versions below this use `LessThan20XMLVersion`; versions at or above use `GreaterOrEqual20XMLVersion`.
|
||||
- `LessThan20XMLVersion` returns an empty list if `node` or `node.ChildNodes` is null.
|
||||
- Unknown XML element names
|
||||
70
docs/ai/Common/DTS.Common.Import/ImportOptions.md
Normal file
70
docs/ai/Common/DTS.Common.Import/ImportOptions.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/ImportOptions/EqxImportOptions.cs
|
||||
- Common/DTS.Common.Import/ImportOptions/CsvImportOptions.cs
|
||||
generated_at: "2026-04-17T16:36:19.520206+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "edba9a74df78fb33"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Import.ImportOptions
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines configuration option classes for the DTS import subsystem. It provides strongly-typed containers for import behavior settings, specifically for EQX-format imports and CSV-format imports. These classes serve as parameter objects that control how data is parsed, validated, and persisted during import operations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `EqxImportOptions`
|
||||
|
||||
A configuration class for EQX-format imports.
|
||||
|
||||
| Property | Type | Default | Description |
|
||||
|----------|------|---------|-------------|
|
||||
| `OverwriteExistingSensors` | `bool` | `true` | Controls whether existing sensors should be overwritten during import. |
|
||||
| `ImportSensorModels` | `bool` | `true` | Controls whether sensor models should be imported. |
|
||||
|
||||
---
|
||||
|
||||
### `CsvImportOptions`
|
||||
|
||||
A configuration class for CSV-format imports.
|
||||
|
||||
| Property | Type | Default | Description |
|
||||
|----------|------|---------|-------------|
|
||||
| `Encoding` | `string` | None (uninitialized) | Specifies the character encoding for parsing the CSV file. |
|
||||
| `FieldSeparator` | `string` | None (uninitialized) | Specifies the delimiter character(s) used to separate fields. |
|
||||
| `ImportCulture` | `CultureInfo` | None (uninitialized) | Specifies the culture settings for parsing culture-dependent values (e.g., number formats, dates). |
|
||||
| `StripBackSlash` | `bool` | None (uninitialized) | Controls whether backslash characters should be removed during import. |
|
||||
|
||||
---
|
||||
|
||||
### `ZeroMethodOptions`
|
||||
|
||||
A configuration class for zero method settings (appears related to sensor calibration/offset handling).
|
||||
|
||||
| Property | Type | Default | Description |
|
||||
|----------|------|---------|-------------|
|
||||
| `ZeroMethodType` | `ZeroMethodType` | None (uninitialized) | Specifies the type of zero method to apply. |
|
||||
| `ZeroMethodStart` | `double` | None (uninitialized) | Specifies the start value for the zero method range. |
|
||||
| `ZeroMethodEnd` | `double` | None (uninitialized) | Specifies the end value for the zero method range. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **EqxImportOptions**: Both boolean properties (`OverwriteExistingSensors`, `ImportSensorModels`) are always initialized to `true` by default.
|
||||
- **CsvImportOptions**: No default values are enforced by the class; properties may be `null` if not explicitly set.
|
||||
- **ZeroMethodOptions**: No default values are enforced by the class; properties may be `null` or `0` (for value types) if not explicitly set.
|
||||
- No validation logic is present in these classes; any constraints must be enforced by consumers.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` (core BCL types)
|
||||
- `
|
||||
87
docs/ai/Common/DTS.Common.Import/Interfaces.md
Normal file
87
docs/ai/Common/DTS.Common.Import/Interfaces.md
Normal file
@@ -0,0 +1,87 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Interfaces/IPersistImport.cs
|
||||
- Common/DTS.Common.Import/Interfaces/IParseImport.cs
|
||||
- Common/DTS.Common.Import/Interfaces/IParseVariant.cs
|
||||
- Common/DTS.Common.Import/Interfaces/IParseCSVTest.cs
|
||||
- Common/DTS.Common.Import/Interfaces/IParseCSVSensor.cs
|
||||
- Common/DTS.Common.Import/Interfaces/ICalibrationImport.cs
|
||||
- Common/DTS.Common.Import/Interfaces/ILockImport.cs
|
||||
- Common/DTS.Common.Import/Interfaces/IGroupImport.cs
|
||||
generated_at: "2026-04-17T16:02:47.396088+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "78f079bf5483238e"
|
||||
---
|
||||
|
||||
# Interfaces
|
||||
|
||||
### Purpose
|
||||
This module defines the core abstraction layer for the import subsystem, providing interfaces for parsing, persisting, locking, and grouping imported data. It establishes contracts for handling CSV-based test and sensor imports, calibration records, and database locking mechanisms during import operations. The interfaces enable a separation between import orchestration and concrete implementations.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**IPersistImport**
|
||||
- `void Save()` - Persists the current import state. No parameters; returns void.
|
||||
|
||||
**IParseImport**
|
||||
- `ImportObject Parse(IEnumerable<string> importFiles)` - Parses a collection of file paths into an `ImportObject`. Accepts `IEnumerable<string>` of file paths.
|
||||
|
||||
**IParseVariant**
|
||||
- `string FileName { get; set; }` - Property for the file name being parsed.
|
||||
- `void Parse(ref ImportObject importObject)` - Parses variant data into the provided `ImportObject`. Note: `importObject` is passed by reference.
|
||||
|
||||
**IParseCSVTest**
|
||||
- `int Version { get; }` - Read-only property indicating the parser version.
|
||||
- `void ParseVersion(CsvReader csvReader, TestSetupImportData tsid)` - Parses version-specific test data using a `CsvReader` into `TestSetupImportData`.
|
||||
|
||||
**IParseCSVSensor**
|
||||
- `int Version { get; }` - Read-only property indicating the parser version.
|
||||
- `void Initialize(ICalibrationImport import, ZeroMethodOptions zmOptions, IImportNotification importNotification, bool importCreateDynamicGroups, bool useIsoCodeFilterMapping, bool useZeroForUnfiltered)` - Initializes the parser with calibration import, zero method options, notification handler, and various import flags.
|
||||
- `void ParseVersion(CSVImportTags.Tags field, string val, ParseParameters pp)` - Parses a specific field/value pair for the current version.
|
||||
|
||||
**ICalibrationImport**
|
||||
- `SensorCalibration AddLinearCalRecordIfNeeded(SensorCalibration sc, bool savedIsProportional, bool savedRemoveOffset)` - Adds a linear calibration record if conditions are met.
|
||||
- `SensorCalibration AddLinearZeroMethodIfNeeded(SensorCalibration sc, ZeroMethodType zeroMethodType, double zeroMethodStart, double zeroMethodEnd)` - Adds a linear zero method to calibration if needed.
|
||||
- `SensorCalibration CheckForExcitationCalibration(SensorCalibration sc, double sensitivity, ExcitationVoltageOptions.ExcitationVoltageOption excitation, string EU)` - Checks and configures excitation calibration.
|
||||
|
||||
**ILockImport**
|
||||
- `bool Contended { get; }` - Returns true if the collection of contended locks has any items.
|
||||
- `void SetLock(ref ImportObject importObject, ref StringBuilder message)` - Sets a database lock for the import object; errors populate the `StringBuilder` message.
|
||||
- `void FreeLock(ref ImportObject importObject)` - Releases the database lock for the import object.
|
||||
- `bool StealLock(bool proceed)` - Steals the database lock; returns success status.
|
||||
|
||||
**IGroupImport**
|
||||
- `ParseParameters ParseParameters { get; set; }` - Property for parsing parameters.
|
||||
- `Tuple<TestTemplate, List<IGroup>> CreateGroups(List<SensorData> sensors, Dictionary<string, List<TsetSetupImportSensorInfo>> groupSensorLookup, TestTemplate testTemplate, bool createDynamicGroups, List<IGroup> staticGroups, Action<double> setProgress)` - Creates groups from sensor data with progress reporting.
|
||||
- `Dictionary<string, List<TsetSetupImportSensorInfo>> GetGroupSensorLookup(List<SensorData> sensors, Dictionary<string, string> sensorGroupNameLookup, Dictionary<string, List<string>> groupNameSensorListLookup)` - Builds a lookup dictionary mapping group names to sensor info.
|
||||
|
||||
### Invariants
|
||||
- `IParseVariant.Parse` modifies `ImportObject` via reference; the caller must expect mutation.
|
||||
- `ILockImport.SetLock` requires an empty `StringBuilder` to be passed in; it will be populated with errors if any occur.
|
||||
- `IParseCSVSensor.Initialize` must be called before `ParseVersion` (implied by initialization pattern).
|
||||
- `IUserDbRecord.UserName` must be unique (documented in interface comments, though this interface is in a different module).
|
||||
|
||||
### Dependencies
|
||||
**Depends on:**
|
||||
- `System.Collections.Generic` (IEnumerable, Dictionary, List)
|
||||
- `System.Text` (StringBuilder)
|
||||
- `CsvHelper` (CsvReader)
|
||||
- `DTS.Common.Classes` (TestSetupImportData)
|
||||
- `DTS.Common.Classes.Sensors` (SensorData)
|
||||
- `DTS.Common.Enums` (ZeroMethodType)
|
||||
- `DTS.Common.Enums.Sensors` (sensor-related enums)
|
||||
- `DTS.Common.Import.ImportOptions` (ZeroMethodOptions)
|
||||
- `DTS.Common.Interface.Groups.GroupList` (IGroup)
|
||||
- `DTS.SensorDB` (SensorCalibration)
|
||||
- `DataPROWin7.DataModel` (TestTemplate, TsetSetupImportSensorInfo)
|
||||
|
||||
**Depended on by:** Not determinable from source alone; these are interfaces consumed by implementations.
|
||||
|
||||
### Gotchas
|
||||
- `IParseVariant.Parse` uses `ref ImportObject` while `IParseImport.Parse` returns a new `ImportObject`. This inconsistency suggests different ownership models.
|
||||
- `ILockImport` has a comment referencing "FB 36740" indicating a feature request/bug tracking reference.
|
||||
- The `ILockImport.StealLock` method's `proceed` parameter purpose is unclear from the signature alone.
|
||||
- `IParseCSVSensor.ParseVersion` takes a `string val` parameter, suggesting string-based field values rather than typed parsing.
|
||||
|
||||
---
|
||||
52
docs/ai/Common/DTS.Common.Import/Parsers.md
Normal file
52
docs/ai/Common/DTS.Common.Import/Parsers.md
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Parsers/ParseVariantBase.cs
|
||||
- Common/DTS.Common.Import/Parsers/DefaultParseImport.cs
|
||||
- Common/DTS.Common.Import/Parsers/DTSXMLParseImport.cs
|
||||
generated_at: "2026-04-17T16:35:09.352474+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "98d94de856736199"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Import Parsers
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides parsing infrastructure for importing data files into the DTS system. It defines an abstract base class `ParseVariantBase` for creating file-specific parsers, and two concrete implementations of `IParseImport` (`DefaultParseImport` and `DTSXMLParseImport`) that orchestrate the parsing process using processor classes. The module supports extensibility through injected parse variants and handles specialized XML import scenarios including hardware relationship linking.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ParseVariantBase (Abstract Class)
|
||||
**Namespace:** `DTS.Common.Import.Parsers`
|
||||
**Implements:** `IParseVariant`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `FileName` | `string { get; set; }` | Property to store the name of the file being parsed. |
|
||||
| `Parse` | `abstract void Parse(ref ImportObject importObject)` | Abstract method that derived classes must implement to perform parsing logic. Receives `ImportObject` by reference. |
|
||||
|
||||
---
|
||||
|
||||
### DefaultParseImport (Class)
|
||||
**Namespace:** `DTS.Common.Import.Parsers`
|
||||
**Implements:** `IParseImport`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `DefaultParseImport(ImportObject importObject, IEnumerable<IParseVariant> parseVariants)` | Initializes the parser with an import object and a collection of parse variants. |
|
||||
| `Parse` | `ImportObject Parse(IEnumerable<string> importFiles)` | Orchestrates parsing by creating a `ParseProcessor` with the configured variants and files. Returns the processed `ImportObject`. |
|
||||
|
||||
---
|
||||
|
||||
### DTSXMLParseImport (Class)
|
||||
**Namespace:** `DTS.Common.Import`
|
||||
**Implements:** `IParseImport`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `DTSXMLParseImport(ImportObject importObject, IImportNotification importNotification, Func<bool> isCancelled = null, bool skipNormalizing = false)` | Initializes the XML parser with notification support, optional cancellation callback, and optional normalization skip. |
|
||||
| `UIItems` | `List<IUIItems> { get; set; }` | Property for UI items, assigned to the internal `XMLParseProcessor` during parsing. |
|
||||
| `Parse`
|
||||
182
docs/ai/Common/DTS.Common.Import/Parsers/CSV.md
Normal file
182
docs/ai/Common/DTS.Common.Import/Parsers/CSV.md
Normal file
@@ -0,0 +1,182 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Parsers/CSV/AbstractCSVParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/Version0CSVTestParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/CSVFile.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/Version6CSVTestParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/Version3CSVSensorParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/Version5CSVTestParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/Version4CSVSensorParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/CSVGroupImport.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/DTSCSVTestSetupParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/CSV/DTSCSVSensorsParser.cs
|
||||
generated_at: "2026-04-17T15:31:35.696653+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "82eec24579c17b93"
|
||||
---
|
||||
|
||||
# CSV Import Parsers Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides CSV parsing functionality for importing DTS sensor configurations and test setups. It implements a versioned parser architecture where different CSV format versions (0-6) are handled by specialized parser classes. The module reads CSV files containing sensor metadata, calibration data, group assignments, and test setup configurations, transforming them into domain objects for the DTS data acquisition system. The architecture separates sensor parsing from test setup parsing, with both feeding into a group import system that creates the final test template structure.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### AbstractCSVParser (Abstract Base Class)
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Version | `public abstract int Version { get; }` | Returns the parser version number this class handles |
|
||||
| Initialize | `public void Initialize(ICalibrationImport import, ZeroMethodOptions zmOptions, IImportNotification importNotification, bool importCreateDynamicGroups, bool useISOCodeFilterMapping, bool useZeroForUnfiltered)` | Initializes the parser with dependencies and configuration flags |
|
||||
| ParseVersion | `public abstract void ParseVersion(CSVImportTags.Tags field, string val, ParseParameters pp)` | Parses a specific field value for this parser's version |
|
||||
|
||||
### Version0CSVTestParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Version | `public int Version => 0` | Returns version 0 |
|
||||
| ParseVersion | `public void ParseVersion(CsvReader csvReader, TestSetupImportData tsid)` | Parses version 0 test setup data including PostTriggerSec, PreTriggerSec, RecordingMode, SampleRate, Description, Name, Version, and Tags |
|
||||
|
||||
### Version5CSVTestParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Version | `public int Version => 5` | Returns version 5 |
|
||||
| ParseVersion | `public void ParseVersion(CsvReader csvReader, TestSetupImportData tsid)` | Parses version 5 test setup data including clock configuration (ClockMasterInputType, ClockMasterOutputType, ClockSlaveInputType, ClockSlaveOutputType, ManageClocksOutsideDPMaster, ManageClocksOutsideDPSlave) |
|
||||
|
||||
### Version6CSVTestParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Version | `public int Version => 6` | Returns version 6 |
|
||||
| ParseVersion | `public void ParseVersion(CsvReader csvReader, TestSetupImportData tsid)` | Parses version 6 test setup data including DAS hardware info (DASSerial, DASSampleRate, PTPDomainId, ClockMaster) with multi-row body parsing |
|
||||
|
||||
### Version3CSVSensorParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Version | `public override int Version => 3` | Returns version 3 |
|
||||
| ParseVersion | `public override void ParseVersion(CSVImportTags.Tags field, string sVal, ParseParameters pp)` | Parses GroupName and GroupType fields with duplicate detection and test object validation |
|
||||
|
||||
### Version4CSVSensorParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Version | `public override int Version => 4` | Returns version 4 |
|
||||
| ParseVersion | `public override void ParseVersion(CSVImportTags.Tags field, string sVal, ParseParameters pp)` | Parses DAS assignment (DASSerialNumber, DASChannelIndex), UDP streaming (StreamProfile, UDPAddress, TimeChannelId, DataChannelId, TmNSConfig, IRIGTimeDataPacketIntervalMS, TMATSIntervalMS), UART configuration (BaudRate, DataBits, StopBits, Parity, DataFormat), and user codes (TestUserCode, TestUserChannelName, TestIsoCode, TestIsoChannelName) |
|
||||
|
||||
### CSVFile
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public CSVFile(string filename)` | Creates instance with specified filename |
|
||||
| IsInUse | `public static bool IsInUse(string filename)` | Returns true if file is locked/in use by another process |
|
||||
| IsCSVFileForTestSetupImport | `public static bool IsCSVFileForTestSetupImport(string filename, CsvImportOptions csvImportOptions)` | Validates if CSV file is formatted for test setup import (checks for "Version" header) |
|
||||
| GetCsvVersion | `public static int GetCsvVersion(string filename)` | Extracts and returns the version number from CSV file, returns 0 on error |
|
||||
| LineCount | `public int LineCount { get; }` | Returns the number of lines in the file |
|
||||
|
||||
### CSVGroupImport
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| ParseParameters | `public ParseParameters ParseParameters { get; set; }` | Gets or sets the parse parameters for import |
|
||||
| CreateGroups | `public Tuple<TestTemplate, List<IGroup>> CreateGroups(List<SensorData> sensors, Dictionary<string, List<TsetSetupImportSensorInfo>> groupSensorLookup, TestTemplate testTemplate, bool createDynamicGroups, List<IGroup> staticGroups, Action<double> setProgress)` | Creates groups and channels from sensor data, populating the test template |
|
||||
| GetGroupSensorLookup | `public Dictionary<string, List<TsetSetupImportSensorInfo>> GetGroupSensorLookup(List<SensorData> sensors, Dictionary<string, string> sensorGroupNameLookup, Dictionary<string, List<string>> groupNameSensorListLookup)` | Builds lookup dictionary mapping group names to sensor info lists |
|
||||
|
||||
### DTSCSVTestSetupParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public DTSCSVTestSetupParser(IImportNotification importNotification, CsvImportOptions csvImportOptions, TestSetupImportData testSetupImportData, IGroupImport groupImport, bool createDynamicGroups)` | Initializes parser with dependencies |
|
||||
| CreateTestSetup | `public static TestTemplate CreateTestSetup(TestSetupImportData tsid, DASHardware[] allDAS)` | Creates a TestTemplate from parsed import data |
|
||||
| UpdateDASSampleRate | `public static void UpdateDASSampleRate(TestTemplate t, TestSetupImportData tsid, DASHardware[] allDAS)` | Updates sample rates for DAS hardware in the test template |
|
||||
| Parse | `public override void Parse(ref ImportObject importObject)` | Main entry point - parses CSV file and populates ImportObject with test setup data |
|
||||
|
||||
### DTSCSVSensorsParser
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public DTSCSVSensorsParser(IImportNotification importNotification, User user, CsvImportOptions csvImportOptions, ICalibrationImport calibrationImport, ZeroMethodOptions zeroMethodOptions)` | Initializes parser with dependencies |
|
||||
| ImportCreateDynamicGroups | `public bool ImportCreateDynamicGroups { get; set; }` | Flag for dynamic group creation during import |
|
||||
| UseISOCodeFilterMapping | `public bool UseISOCodeFilterMapping { get; set; }` | Flag for ISO code filter mapping behavior |
|
||||
| UseZeroForUnfiltered | `public bool UseZeroForUnfiltered { get; set; }` | Flag for using zero values for unfiltered data |
|
||||
| Parse | `public override void Parse(ref ImportObject importObject)` | Main entry point - parses CSV file and populates ImportObject with sensor and calibration data |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Version Header Requirement**: CSV files must have "Version" as the first token in the first row to be recognized as valid for import.
|
||||
|
||||
2. **Version-Based Parser Selection**: The `CSVImportTags.GetVersionForTag()` determines which parser handles each field. Parsers only process fields matching their version.
|
||||
|
||||
3. **Version 6 Multi-Parser Execution**: When `tsid.Version == 6`, all parsers from index 1 through the array length are invoked sequentially (see `DTSCSVTestSetupParser.ParseTestSetup`).
|
||||
|
||||
4. **Duplicate Serial Number Detection**: `Version3CSVSensorParser` enforces unique sensor serial numbers within `SensorGroupNameLookup` and `SensorGroupTypeLookup` dictionaries.
|
||||
|
||||
5. **Non-Empty Group Names**: Group names must be non-empty and non-whitespace; empty values generate errors.
|
||||
|
||||
6. **Test Setup Name Uniqueness**: Import skips test setups with names that already exist in `importObject.TestSetups()`.
|
||||
|
||||
7. **Calibration Assignment Order**: Calibrations are sorted and the most recent (last element after sort) is assigned to each sensor.
|
||||
|
||||
8. **Analog Sensor Validation**: Analog sensors require non-zero sensitivity and capacity >= 1; violations generate errors.
|
||||
|
||||
9. **Excitation Validation**: Full/Half/Quarter bridge sensors require defined excitation voltage (not `Undefined`).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (Imports)
|
||||
|
||||
| Namespace | Purpose |
|
||||
|-----------|---------|
|
||||
| `CsvHelper` | CSV file reading via `CsvReader` |
|
||||
| `DTS.Common.Classes.Sensors` | `SensorData`, `SensorCalibration`, `ParseParameters` |
|
||||
| `DTS.Common.Enums.Sensors` | Sensor enumerations including `BridgeType`, `SensUnits`, `ExcitationVoltageOptions` |
|
||||
| `DTS.Common.Import.ImportOptions` | `CsvImportOptions`, `ZeroMethodOptions` |
|
||||
| `DTS.Common.Import.Interfaces` | `IParseCSVSensor`, `IParseCSVTest`, `ICalibrationImport`, `IImportNotification`, `IGroupImport` |
|
||||
| `DTS.Common.Import.Factories` | `CSVTestParserFactory`, `CSVSensorParserFactory` |
|
||||
| `DTS.Common.Import.Parsers` | `ParseVariantBase` base class |
|
||||
| `DTS.Common.Storage` | `DbOperations` for database access |
|
||||
| `DTS.SensorDB` | Database operations |
|
||||
| `DataPROWin7.DataModel.Classes.Hardware` | `DASHardwareList` for hardware enumeration |
|
||||
| `System.IO.Ports` | `StopBits`, `Parity` enumerations for UART configuration |
|
||||
| `DTS.Slice.Users` | `User` class for current user context |
|
||||
| `DTS.Common.Utilities.Logging` | `APILogger` for error logging |
|
||||
|
||||
### Consumers (Inferred)
|
||||
|
||||
The module implements interfaces (`IParseCSVSensor`, `IParseCSVTest`, `IGroupImport`) and extends `ParseVariantBase`, suggesting consumption via:
|
||||
- Factory patterns (`CSVTestParserFactory`, `CSVSensorParserFactory`)
|
||||
- Dependency injection through interface types
|
||||
- The `ImportObject` pattern which aggregates parsed results
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Version 6 Special Execution Path**: Unlike other versions, version 6 triggers iteration through all parsers starting at index 1:
|
||||
```csharp
|
||||
if (tsid.Version == 6)
|
||||
{
|
||||
for (var i = 1; i < parsers.Length; i++)
|
||||
{
|
||||
parsers[i].ParseVersion(parser, tsid);
|
||||
}
|
||||
}
|
||||
```
|
||||
This means version 6 files are processed by multiple parsers, not just `Version6CSVTestParser`.
|
||||
|
||||
2. **Silent Sensitivity Unit Correction**: Non-proportional sensors with `SensUnits.mVperVperEU` are silently corrected to `SensUnits.mVperEU`. Users are notified via `_importNotification.ReportErrors` but parsing continues.
|
||||
|
||||
3. **ISO Channel-Only Prefix Bypass**: Sensors with serial numbers starting with `Constants.ISO_CH_ONLY_PREFIX` are excluded from `AddSensorLookup` and `AddCalibrationLookup` calls, but still added via `AddSensor` and `AddCalibration`.
|
||||
|
||||
4. **Exception Swallowing in CSVFile**:
|
||||
- `IsInUse()` suppresses all non-IOException exceptions
|
||||
- `IsCSVFileForTestSetupImport()` and `GetCsvVersion()` catch all exceptions and return `false`/`0`
|
||||
|
||||
5. **Generic Exception in Version3CSVSensorParser**: Throws `new Exception("Parse error")` when a group maps to multiple test objects and `ImportCreateDynamicGroups` is false. This breaks the pattern of adding errors to `pp.Errors`.
|
||||
|
||||
6. **Dual Sample Rate Storage**: The comment in `UpdateDASSampleRate` explicitly notes uncertainty about why sample rates are stored in both `t.SetSampleRateForHardware()` and `t.DASSampleRateList[]`.
|
||||
|
||||
7. **Historical Bug References**: Comments reference "FB" tracking numbers (e.g., "FB 40598", "FB 36879", "FB 43815") indicating accumulated fixes. These may indicate areas with historical issues.
|
||||
|
||||
8. **Range Assignment Complexity**: The range assignment logic in `CSVGroupImport.CreateGroups` has specific conditions involving `ImportContainedSensorRanges`, `RangeHigh`, `RangeLow`, `RangeMedium`, and `Capacity` that may produce unexpected results if not fully understood.
|
||||
|
||||
9. **Version 6 Header Search Loop**: `Version6CSVTestParser` and `Version5CSVTestParser` both skip rows until finding a version-appropriate tag, but use different version checks (6 vs 5). This could cause confusion if tags overlap.
|
||||
175
docs/ai/Common/DTS.Common.Import/Parsers/EQX.md
Normal file
175
docs/ai/Common/DTS.Common.Import/Parsers/EQX.md
Normal file
@@ -0,0 +1,175 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Parsers/EQX/EQXTestSetupParser.cs
|
||||
- Common/DTS.Common.Import/Parsers/EQX/EQXGroupImport.cs
|
||||
- Common/DTS.Common.Import/Parsers/EQX/EQXSensorsParser.cs
|
||||
generated_at: "2026-04-17T15:39:25.870361+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "605a991ac1639306"
|
||||
---
|
||||
|
||||
# EQX Import Parsers Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides parsing functionality for importing Equipment Exchange (EQX) format files into the DTS system. It consists of three main components: `EQXTestSetupParser` for importing test setup configurations including groups and channel assignments, `EQXSensorsParser` for importing sensor definitions and calibration data, and `EQXGroupImport` for processing group-to-sensor mappings during test setup creation. The module bridges the proprietary EQX XML format with the internal DTS data model, handling version compatibility, calibration assignments, and group hierarchy construction.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### EQXTestSetupParser
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public EQXTestSetupParser(
|
||||
IImportNotification importNotification,
|
||||
EqxImportOptions eqxImportOptions,
|
||||
IGroupImport groupImport,
|
||||
EquipmentExchange.EQXSensorDatabase eqxSensorDatabase,
|
||||
bool createDynamicGroups)
|
||||
```
|
||||
Initializes the parser with notification services, import options, group import handler, sensor database reference, and a flag indicating whether dynamic groups should be created.
|
||||
|
||||
**Methods:**
|
||||
|
||||
```csharp
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
```
|
||||
Parses the EQX file specified by `FileName` (inherited from `ParseVariantBase`) and populates the `importObject` with test setup data. Validates that group name test object lookup exists; if not, adds a critical error and aborts. Assigns group lookups, creates test templates, fixes calibrations, assigns groups to test setup, and sets the `TestSetupImportFileFormat` on the import object.
|
||||
|
||||
---
|
||||
|
||||
### EQXGroupImport
|
||||
|
||||
**Implements:** `IGroupImport`
|
||||
|
||||
**Properties:**
|
||||
|
||||
```csharp
|
||||
public ParseParameters ParseParameters { get; set; }
|
||||
```
|
||||
|
||||
**Methods:**
|
||||
|
||||
```csharp
|
||||
public Tuple<TestTemplate, List<IGroup>> CreateGroups(
|
||||
List<SensorData> sensors,
|
||||
Dictionary<string, List<TsetSetupImportSensorInfo>> groupSensorLookup,
|
||||
TestTemplate testTemplate,
|
||||
bool createDynamicGroups,
|
||||
List<IGroup> staticGroups,
|
||||
Action<double> setProgress)
|
||||
```
|
||||
Creates groups from the provided sensor data and group-sensor lookup. Returns a tuple containing the populated `TestTemplate` and list of static groups. Returns `null` if `groupSensorLookup` is null or empty. Groups are sorted by sensor count (descending), then by name (ascending). Each group is populated with `GroupChannel` objects containing sensor data, calibration info, squib settings, and digital I/O configuration.
|
||||
|
||||
```csharp
|
||||
public Dictionary<string, List<TsetSetupImportSensorInfo>> GetGroupSensorLookup(
|
||||
List<SensorData> sensors,
|
||||
Dictionary<string, string> sensorGroupNameLookup,
|
||||
Dictionary<string, List<string>> groupNameSensorListLookup)
|
||||
```
|
||||
Builds a lookup dictionary mapping group names to lists of `TsetSetupImportSensorInfo`. Handles two mutually exclusive input formats: `sensorGroupNameLookup` (sensor → group name) or `groupNameSensorListLookup` (group name → list of sensor serial numbers).
|
||||
|
||||
---
|
||||
|
||||
### EQXSensorsParser
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public EQXSensorsParser(
|
||||
IImportNotification importNotification,
|
||||
User user,
|
||||
EqxImportOptions eqxImportOptions,
|
||||
EquipmentExchange.EQXSensorDatabase eqxSensorDatabase)
|
||||
```
|
||||
|
||||
**Constants:**
|
||||
```csharp
|
||||
const float MAX_EQX_VERSION_SUPPORT = 1.5F;
|
||||
```
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
public bool ImportCreateDynamicGroups { get; set; }
|
||||
public bool EQXUseSerialNumberFieldForSN { get; set; }
|
||||
public bool UseZeroForUnfiltered { get; set; }
|
||||
```
|
||||
|
||||
**Methods:**
|
||||
|
||||
```csharp
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
```
|
||||
Parses the EQX file for sensor data. Validates XML structure and EQX format version (must be ≤ 1.5). Delegates to `ParseSensor` for actual processing.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **EQX Version Compatibility:** The maximum supported EQX DataFormatEdition is `1.5F`. Files with higher versions will cause import rejection with an error message.
|
||||
- **Null ImportObject Handling:** Both `EQXTestSetupParser.Parse()` and `EQXSensorsParser.Parse()` throw `ArgumentNullException` if `importObject` is null.
|
||||
- **Empty FileName Handling:** Both parsers return immediately without processing if `FileName` is null or empty.
|
||||
- **Group Lookup Mutual Exclusivity:** In `EQXGroupImport.GetGroupSensorLookup()`, either `sensorGroupNameLookup` OR `groupNameSensorListLookup` will be populated, but not both (per comment FB 30358).
|
||||
- **Calibration Assignment:** In `FixCalibrations()`, calibrations are sorted and the first calibration (index 0) is assigned to each sensor.
|
||||
- **Test Setup Uniqueness:** `EQXTestSetupParser.Parse()` returns early without creating a test setup if a test setup with the same name already exists in `importObject.TestSetups()`.
|
||||
- **Group Sorting:** Groups are sorted by sensor count descending, then alphabetically by name ascending when equal.
|
||||
- **Channel Order:** `GroupChannelOrder` and `TestSetupOrder` are 1-indexed (1 + sensor index).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Direct Dependencies (Imports):
|
||||
|
||||
**EQXTestSetupParser:**
|
||||
- `DataPROWin7.DataModel` - `ImportObject`, `ImportError`, `ImportSeverityError`, `TestTemplate`, `SensorData`
|
||||
- `DTS.Common.Import.ImportOptions` - `EqxImportOptions`
|
||||
- `DTS.Common.Import.Parsers` - `ParseVariantBase`
|
||||
- `DTS.Common.Interface.Groups.GroupList` - `IGroupImport`, `IGroup`
|
||||
- `DTS.Common.SharedResource.Strings` - `StringResources`
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger`
|
||||
- `DTS.Common.Utils` - `GroupHelper`
|
||||
- `DTS.SensorDB` - `EquipmentExchange.EQXSensorDatabase`
|
||||
- `System.Xml.Linq` - XML parsing
|
||||
|
||||
**EQXGroupImport:**
|
||||
- `DataPROWin7.DataModel` - `SensorData`, `TestTemplate`, `TsetSetupImportSensorInfo`
|
||||
- `DTS.Common.Classes.Groups` - Group-related classes
|
||||
- `DTS.Common.Classes.Sensors` - `GroupChannel`
|
||||
- `DTS.Common.Interface.Groups.GroupList` - `IGroupImport`, `IGroup`
|
||||
- `DTS.Common.Storage` - `DbOperations`
|
||||
- `DTS.SensorDB` - Sensor database types
|
||||
|
||||
**EQXSensorsParser:**
|
||||
- `DataPROWin7.DataModel` - `ImportObject`, `SensorData`
|
||||
- `DTS.Common.Enums` - Enumerations including `BridgeType`, `ExcitationVoltageOptions`, `SquibMeasurementType`
|
||||
- `DTS.Common.Import.ImportOptions` - `EqxImportOptions`
|
||||
- `DTS.Common.Import.Parsers` - `ParseVariantBase`
|
||||
- `DTS.Common.Storage` - `DbOperations`
|
||||
- `DTS.Common.Classes.Sensors` - `FactorySensorModel`, `SensorsCollection`
|
||||
- `DTS.Common.Interface.Sensors` - `ISensorData`
|
||||
- `DTS.Common.SharedResource.Strings` - `StringResources`
|
||||
- `DTS.Slice.Users` - `User`
|
||||
- `DTS.SensorDB` - `EquipmentExchange.EQXSensorDatabase`
|
||||
- `System.Xml.Linq` - XML parsing
|
||||
|
||||
### Consumers:
|
||||
- The module is consumed by the DTS import system (exact consumers not visible in provided source).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
### Calibration Reset Issue (FB 44105 / Historical Bug)
|
||||
The comment in `EQXTestSetupParser.AssignGroupsToTestSetup()` references a bug where `GroupHelper.NormalizeSensorIds()` can reset calibrations for sensors. The workaround is calling `FixCalibrations(importObject)` immediately after normalization to restore calibrations from the import data.
|
||||
|
||||
### Duplicate Calibration Fix Calls
|
||||
`FixCalibrations()` is called twice in `EQXTestSetupParser.Parse()`: once early in the method, and again inside `AssignGroupsToTestSetup()` after `NormalizeSensorIds()`. This is intentional due to the normalization side-effect noted above.
|
||||
|
||||
### EID Preservation (Bug 18467)
|
||||
`EQXSensorsParser.ParseSensor()` contains special logic to preserve existing EID values when the EQX file has a NULL `IDModuleString`. Without this, importing an EQX file with missing IDModuleString would clear the EID on existing sensors.
|
||||
|
||||
### Null IDModule Handling
|
||||
The method `SensorHasNullIDModule()` and `GetSensorNullIdModuleValue()` are called on `_eq
|
||||
365
docs/ai/Common/DTS.Common.Import/Persist.md
Normal file
365
docs/ai/Common/DTS.Common.Import/Persist.md
Normal file
@@ -0,0 +1,365 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Persist/SaveServer.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveGroupTemplates.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveVariantBase.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveGlobalSettings.cs
|
||||
- Common/DTS.Common.Import/Persist/PersistCalculator.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveSensorModels.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveTestEngineerDetails.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveLabDetails.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveUsers.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveCustomerDetails.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveHardware.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveTestSetupHelper.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveGroups.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveCustomChannels.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveTestSetup.cs
|
||||
- Common/DTS.Common.Import/Persist/SaveCheckoutTestSetup.cs
|
||||
generated_at: "2026-04-17T15:28:30.641712+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "85e93f86bc467691"
|
||||
---
|
||||
|
||||
# DTS.Common.Import.Persist Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module implements the persistence layer for importing various data entities into the DTS (Data Test System). It provides a Strategy pattern implementation where each `SaveVariantBase` subclass handles persisting a specific entity type (hardware, users, test setups, groups, sensors, etc.) to the database. The module coordinates progress tracking, cancellation support, and ID remapping between old imported identifiers and newly assigned database identifiers.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### SaveVariantBase (Abstract Base Class)
|
||||
```csharp
|
||||
public abstract class SaveVariantBase : IPersistImport
|
||||
{
|
||||
protected ImportObject _importObject;
|
||||
protected readonly IPersistCalculator _persistCalculator;
|
||||
protected readonly IImportNotification _importNotification;
|
||||
protected readonly Func<bool> IsCancelled;
|
||||
|
||||
protected SaveVariantBase(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public abstract void Save();
|
||||
}
|
||||
```
|
||||
Base class for all save variants. Provides shared infrastructure for progress notification and cancellation.
|
||||
|
||||
---
|
||||
|
||||
### PersistCalculator
|
||||
```csharp
|
||||
public class PersistCalculator : IPersistCalculator
|
||||
{
|
||||
public double ProgressValue { get; } // Returns _done / _total
|
||||
|
||||
public void AddDone() // Increments _done by 1
|
||||
public void AddDone(double value) // Increments _done by value
|
||||
public void AddToTotal(double value) // Adds to _total (throws if value < 0)
|
||||
}
|
||||
```
|
||||
Calculates import progress as a ratio of completed work to total work.
|
||||
|
||||
---
|
||||
|
||||
### SaveHardware
|
||||
```csharp
|
||||
public class SaveHardware : SaveVariantBase
|
||||
{
|
||||
public Dictionary<int, int> OldDASIdToNewDASId { get; set; }
|
||||
public Dictionary<int, List<IISOHardware>> TestIdToHardware { get; set; }
|
||||
|
||||
public SaveHardware(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists hardware entities. Tracks DAS ID remapping and hardware-to-test relationships for downstream consumers.
|
||||
|
||||
---
|
||||
|
||||
### SaveGroups
|
||||
```csharp
|
||||
public class SaveGroups : SaveVariantBase
|
||||
{
|
||||
public bool CanCurrentUserCommitChannelCodes { get; set; } = true;
|
||||
public IChannelSetting DefaultZeroMethod { get; set; }
|
||||
public IChannelSetting DefaultZeroStart { get; set; }
|
||||
public IChannelSetting DefaultZeroEnd { get; set; }
|
||||
public IChannelSetting DefaultInitialOffset { get; set; }
|
||||
public Dictionary<int?, int> OldGroupIdToNewGroupId { get; set; }
|
||||
|
||||
public SaveGroups(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, SaveHardware saveHardware,
|
||||
Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists static groups. Requires `SaveHardware` instance for DAS ID remapping. Updates sensor IDs and fixes missing zero method parameters.
|
||||
|
||||
---
|
||||
|
||||
### SaveCustomChannels
|
||||
```csharp
|
||||
public class SaveCustomChannels : SaveVariantBase
|
||||
{
|
||||
public ISO13499FileDb IsoDb { get; set; }
|
||||
public Dictionary<string, string> CustomChannelTextIdToOldChannelId { get; set; }
|
||||
public Dictionary<string, TestObjectChannel> CustomChannelOldChannelIdToChannel { get; set; }
|
||||
|
||||
public SaveCustomChannels(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists custom channels with complex ID remapping logic. Maintains mappings for level trigger updates in test setups.
|
||||
|
||||
---
|
||||
|
||||
### SaveTestSetup
|
||||
```csharp
|
||||
public class SaveTestSetup : SaveVariantBase
|
||||
{
|
||||
public User CurrentUser { get; set; }
|
||||
public string TestSetupName { get; set; }
|
||||
|
||||
public SaveTestSetup(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, SaveCustomChannels saveCustomChannels,
|
||||
SaveHardware saveHardware, SaveGroups saveGroups, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists test setups. Requires `SaveCustomChannels`, `SaveHardware`, and `SaveGroups` for cross-entity ID resolution.
|
||||
|
||||
---
|
||||
|
||||
### SaveCheckoutTestSetup
|
||||
```csharp
|
||||
public class SaveCheckoutTestSetup : SaveVariantBase
|
||||
{
|
||||
public User CurrentUser { get; set; }
|
||||
|
||||
public SaveCheckoutTestSetup(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, SaveCustomChannels saveCustomChannels,
|
||||
SaveHardware saveHardware, SaveGroups saveGroups,
|
||||
Func<bool> isCancelled = null, string setupName = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists checkout-mode test setups with different default configuration than `SaveTestSetup`.
|
||||
|
||||
---
|
||||
|
||||
### SaveUsers
|
||||
```csharp
|
||||
public class SaveUsers : SaveVariantBase
|
||||
{
|
||||
public IUIItems[] UIItems { get; set; }
|
||||
public User CurrentUser { get; set; }
|
||||
|
||||
public SaveUsers(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists users. Requires `CurrentUser.IsAdmin` to be true (asserted via `Trace.Assert`).
|
||||
|
||||
---
|
||||
|
||||
### SaveSensorModels
|
||||
```csharp
|
||||
public class SaveSensorModels : SaveVariantBase
|
||||
{
|
||||
public User CurrentUser { get; set; }
|
||||
|
||||
public SaveSensorModels(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists sensor models via `SensorModelCollection.SensorModelList.Commit()`.
|
||||
|
||||
---
|
||||
|
||||
### SaveGlobalSettings
|
||||
```csharp
|
||||
public class SaveGlobalSettings : SaveVariantBase
|
||||
{
|
||||
public SaveGlobalSettings(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists global settings via `SettingsDB.SetGlobalValue()`.
|
||||
|
||||
---
|
||||
|
||||
### SaveTestEngineerDetails
|
||||
```csharp
|
||||
public class SaveTestEngineerDetails : SaveVariantBase
|
||||
{
|
||||
public SaveTestEngineerDetails(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists test engineer details via `TestEngineerDetailsList.TestEngineerList.AddTestEngineer()`.
|
||||
|
||||
---
|
||||
|
||||
### SaveLabDetails
|
||||
```csharp
|
||||
public class SaveLabDetails : SaveVariantBase
|
||||
{
|
||||
public SaveLabDetails(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists laboratory details. Skips invalid/blank entries via `IsInvalidBlank()` check.
|
||||
|
||||
---
|
||||
|
||||
### SaveCustomerDetails
|
||||
```csharp
|
||||
public class SaveCustomerDetails : SaveVariantBase
|
||||
{
|
||||
public SaveCustomerDetails(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Persists customer details. Skips invalid/blank entries via `IsInvalidBlank()` check.
|
||||
|
||||
---
|
||||
|
||||
### SaveGroupTemplates
|
||||
```csharp
|
||||
public class SaveGroupTemplates : SaveVariantBase
|
||||
{
|
||||
public SaveGroupTemplates(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save()
|
||||
}
|
||||
```
|
||||
Iterates group templates and updates progress. **Note: Does not appear to persist any data to database.**
|
||||
|
||||
---
|
||||
|
||||
### SaveServer
|
||||
```csharp
|
||||
class SaveServer : SaveVariantBase
|
||||
{
|
||||
public SaveServer(ImportObject importObject, IPersistCalculator persistCalculator,
|
||||
IImportNotification importNotification, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Save() // Throws NotImplementedException
|
||||
}
|
||||
```
|
||||
Stub implementation. **Not implemented.**
|
||||
|
||||
---
|
||||
|
||||
### SaveTestSetupHelper (Static Helper)
|
||||
```csharp
|
||||
public static class SaveTestSetupHelper
|
||||
{
|
||||
public static void AddHardwareFromEmbeddedGroups(TestTemplate t, SaveGroups saveGroups,
|
||||
List<int> hardwareRemoved, List<int> hardwareIncluded)
|
||||
|
||||
public static void FixDasAff(Dictionary<string, DASHardware> hardwareLookup, TestTemplate t)
|
||||
|
||||
public static Dictionary<string, DASHardware> PopulateHarwareLookup()
|
||||
|
||||
public static void DeleteExistingTestSetups(IEnumerable<TestTemplate> testSetups, string userName)
|
||||
|
||||
public static void UpdateLevelTriggers(ref Dictionary<string, string> oldIdToNewIdLookup,
|
||||
SaveCustomChannels saveCustomChannels, IEnumerable<TestTemplate> testSetups)
|
||||
}
|
||||
```
|
||||
Shared utility methods for test setup persistence operations.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Progress Calculation**: `ProgressValue` is calculated as `_done / _total`. If `_total` is 0, this will result in division by zero (not guarded against).
|
||||
|
||||
2. **AddToTotal Validation**: `PersistCalculator.AddToTotal(double value)` throws `ArgumentOutOfRangeException` if `value < 0`. The exception message states "value should not be less or equal to zero" but the check is only for `< 0`, not `<= 0`.
|
||||
|
||||
3. **Cancellation Default**: If `isCancelled` parameter is null, `IsCancelled` defaults to `() => false`, meaning the operation will never be cancelled.
|
||||
|
||||
4. **SaveUsers Admin Requirement**: `SaveUsers.Save()` asserts `CurrentUser.IsAdmin` must be true via `Trace.Assert`. This is a debug-only assertion, not a runtime exception.
|
||||
|
||||
5. **SaveHardware ID Tracking**: `OldDASIdToNewDASId` only contains entries when `h.DASId != oldId` after commit. Unchanged IDs are not tracked.
|
||||
|
||||
6. **SaveGroups Dependency**: `SaveGroups` requires a `SaveHardware` instance in its constructor to access `OldDASIdToNewDASId` for channel DAS ID remapping.
|
||||
|
||||
7. **SaveTestSetup/SaveCheckoutTestSetup Dependencies**: Both require `SaveCustomChannels`, `SaveHardware`, and `SaveGroups` instances for cross-entity ID resolution.
|
||||
|
||||
8. **Hardware Sort Order**: `SaveHardware.Save()` calls `.Sort()` on the hardware list before processing, implying hardware must implement `IComparable`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (Inferred from Imports)
|
||||
|
||||
| Module | Dependencies |
|
||||
|--------|--------------|
|
||||
| `SaveHardware` | `DataPROWin7.DataModel.Classes.Hardware`, `DTS.Common.Interface.DASFactory.Diagnostics`, `DTS.Common.SharedResource.Strings` |
|
||||
| `SaveGroups` | `DataPROWin7.DataModel.Classes.Hardware`, `DTS.Common.Classes.Groups.ChannelSettings`, `DTS.Common.Interface.Channels`, `DTS.Common.Interface.Groups.GroupList`, `DTS.Common.SharedResource.Strings`, `DTS.Common.Storage` |
|
||||
| `SaveCustomChannels` | `DataPROWin7.DataModel`, `DTS.Common.ISO` |
|
||||
| `SaveTestSetup`, `SaveCheckoutTestSetup` | `DataPROWin7.DataModel`, `DataPROWin7.DataModel.Classes.Hardware`, `DTS.SensorDB`, `DTS.Slice.Users` |
|
||||
| `SaveUsers` | `DTS.Slice.Users` |
|
||||
| `SaveSensorModels` | `DTS.SensorDB`, `DTS.Slice.Users` |
|
||||
| `SaveGlobalSettings` | `DTS.Common.Settings` |
|
||||
| `SaveTestEngineerDetails`, `SaveLabDetails`, `SaveCustomerDetails` | `DataPROWin7.DataModel`, `DTS.Common.Import.Enums` |
|
||||
| `SaveVariantBase` | `DTS.Common.Import.Interfaces` |
|
||||
|
||||
### Internal Dependencies
|
||||
|
||||
- All save variants depend on `ImportObject`, `IPersistCalculator`, and `IImportNotification`
|
||||
- `SaveTestSetup`, `SaveCheckoutTestSetup` depend on `SaveCustomChannels`, `SaveHardware`, `SaveGroups`
|
||||
- `SaveGroups` depends on `SaveHardware`
|
||||
- `SaveTestSetupHelper` depends on `SaveGroups`, `SaveCustomChannels`
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **SaveServer Not Implemented**: `SaveServer.Save()` throws `NotImplementedException`. This class should not be used in production.
|
||||
|
||||
2. **SaveGroupTemplates No Persistence**: `SaveGroupTemplates.Save()` iterates through group templates and updates progress but does not appear to commit any data to the database.
|
||||
|
||||
3. **Copy-Paste Error in SaveCustomerDetails**: The status is set to `ImportExtraStatus.ReadingLabDetails` instead of a customer-specific status. This appears to be a copy-paste error from `SaveLabDetails`.
|
||||
|
||||
4. **Division by Zero Risk**: `PersistCalculator.ProgressValue` does not guard against `_total` being zero, which would cause division by zero.
|
||||
|
||||
5. **Debug-Only Admin Check**: `SaveUsers` uses `Trace.Assert` for admin validation, which only fires in debug builds. In release builds, a non-admin user could attempt the import without exception.
|
||||
|
||||
6. **Invalid Details Tracking**: `SaveLabDetails` and `SaveCustomerDetails` set local `invalidLabDetails`/`invalidCustomerDetails` flags when encountering invalid entries, but these flags are never used or reported.
|
||||
|
||||
7. **Hardware List Mutation**: `SaveHardware.Save()` calls `.ToList().Sort()` on `_importObject.Hardware()`, which may have side effects on the underlying collection depending on implementation.
|
||||
|
||||
8. **Missing Error Reporting**: `SaveTestSetup.Save()` and `SaveCheckoutTestSetup.Save()` check `if (_importObject.Errors().Any())` but the body is empty with only a comment `//report errors`.
|
||||
|
||||
9. **Typo in Method Name**: `SaveTestSetupHelper.PopulateHarwareLookup()` is misspelled (should be "Hardware").
|
||||
|
||||
10. **GC.Collect Commented Out**: In `SaveCustomChannels.Save()`, there is a commented-out `GC.Collect()` with a comment acknowledging it as a "critical code smell" (referencing bug #11287 for out-of-memory exceptions with large CSV files).
|
||||
38
docs/ai/Common/DTS.Common.Import/Properties.md
Normal file
38
docs/ai/Common/DTS.Common.Import/Properties.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:26:29.254875+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c2705a8c6698fe06"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly metadata for the `DTS.DAS.Concepts` assembly. It is a build-time configuration file that defines version information, copyright, and COM visibility settings for the assembly. It does not contain executable logic or types.
|
||||
|
||||
### Public Interface
|
||||
No public types, functions, or methods are defined in this module. The file contains only assembly-level attributes:
|
||||
- `AssemblyTitle`: Set to `"DTS.DAS.Concepts"`
|
||||
- `AssemblyDescription`: Empty
|
||||
- `AssemblyCompany`: `"DTS"`
|
||||
- `AssemblyProduct`: `"DTS.DAS.Concepts"`
|
||||
- `AssemblyCopyright`: `"Copyright © DTS 2008"`
|
||||
- `ComVisible`: `false`
|
||||
- `Guid`: `"9b6f7402-27d3-4cc9-9ff3-3cfe16e0b429"`
|
||||
- `AssemblyVersion`: `"1.06.0081"`
|
||||
- `AssemblyFileVersion`: `"1.06.0081"`
|
||||
|
||||
### Invariants
|
||||
- COM visibility is explicitly set to `false`, meaning types in this assembly are not visible to COM components by default.
|
||||
- The assembly version and file version are synchronized at `"1.06.0081"`.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Reflection`, `System.Runtime.InteropServices` (standard .NET Framework assemblies).
|
||||
- **Depended on by**: Cannot be determined from this file alone.
|
||||
|
||||
### Gotchas
|
||||
- The `AssemblyTitle` attribute value (`"DTS.DAS.Concepts"`) differs from the module path name (`DTS.Common.DAS.Concepts`). This discrepancy may cause confusion when referencing the assembly.
|
||||
|
||||
---
|
||||
297
docs/ai/Common/DTS.Common.Import/XML.md
Normal file
297
docs/ai/Common/DTS.Common.Import/XML.md
Normal file
@@ -0,0 +1,297 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Import/XML/XMLPre20ParseGroupTemplates.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomDirections.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomTestObjects.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomPositions.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomFineLoc3s.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomFineLoc2s.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomFineLoc1s.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseSensorModels.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomFilterClasses.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomChannels.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomMainLocations.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseMMECustomPhysicalDimensions.cs
|
||||
- Common/DTS.Common.Import/XML/XMLPre20ParseSensors.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseUsers.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseBase.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseTestEngineerDetails.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseLabDetails.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseGlobalSettings.cs
|
||||
- Common/DTS.Common.Import/XML/XMLPre20ParseDASList.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseCustomerDetails.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseSensors.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseDASList.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseGroupTemplates.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseCalibrations.cs
|
||||
- Common/DTS.Common.Import/XML/XMLPre20ParseCalibrations.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseGroups.cs
|
||||
- Common/DTS.Common.Import/XML/XMLParseTestSetups.cs
|
||||
generated_at: "2026-04-17T15:26:52.176871+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "75086f6da3a24b58"
|
||||
---
|
||||
|
||||
# XML Import Parsers Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a collection of XML parsing classes for importing configuration data into the DTS system. Each parser handles a specific domain entity (sensors, calibrations, groups, test setups, hardware, etc.) and follows a strategy pattern via the `XMLParseBase` abstract class. The module supports versioned imports with migration logic for pre-2.0 data formats, ID normalization to avoid collisions with existing database records, and cancellation support for long-running operations. Parsers transform XML elements into domain objects and populate an `ImportObject` container for downstream processing.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### XMLParseBase (Abstract Base Class)
|
||||
|
||||
```csharp
|
||||
public abstract class XMLParseBase : IParseVariant
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public abstract void Parse(ref ImportObject importObject);
|
||||
|
||||
protected XMLParseBase(XmlElement root, double importedVersion, Func<bool> isCancelled = null, bool skipNormalizing = false)
|
||||
}
|
||||
```
|
||||
|
||||
**Behavior:** Base class for all XML parsers. Maintains static ID mapping dictionaries (`_dasIdMapping`, `_groupIdMapping`, `_sensorIdMapping`, `_channelIdMapping`) for cross-parser ID normalization. Provides protected helper methods `GetXmlElement()` and `IsCancelled()`. Initializes an internal `XmlWriter` for generating transformed XML.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseDASList
|
||||
|
||||
```csharp
|
||||
public XMLParseDASList(XmlElement root, double importedVersion, Func<bool> isCancelled = null, bool skipNormalizing = false)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
public List<DASHardware> ParseDASList(XmlElement root)
|
||||
```
|
||||
|
||||
**Behavior:** Parses DAS (Data Acquisition System) hardware from XML. Normalizes DAS IDs starting at -2 (preserving -1 for unassigned channels per FB 13544). Validates hardware types against `DTS.Common.Enums.Hardware.HardwareTypes`. Clears `_dasIdMapping` on construction.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseSensors
|
||||
|
||||
```csharp
|
||||
public XMLParseSensors(XmlElement root, double importedVersion, Func<bool> isCancelled = null, bool skipNormalizing = false)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
public XmlElement ConvertSensors(IEnumerable<SensorData> sensors)
|
||||
public IEnumerable<SensorData> ParseSensors(XmlElement root)
|
||||
```
|
||||
|
||||
**Behavior:** Parses sensor data. Normalizes sensor `DatabaseId` starting at -2 (preserving -1 for invalid). Populates `_sensorIdMapping` during conversion. Respects `_skipNormalizing` flag.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseGroups
|
||||
|
||||
```csharp
|
||||
public XMLParseGroups(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
public List<IGroup> ParseGroups(XmlElement root, ref ImportObject importObject)
|
||||
```
|
||||
|
||||
**Behavior:** Parses static groups. Clears `_groupIdMapping` on construction. Normalizes group IDs starting at -2. Maps group channels' DAS and Sensor IDs using `_dasIdMapping` and `_sensorIdMapping`. Handles deleted sensors gracefully (FB 14308) by setting `SensorId = 0`. Uses string-based group ID mapping for pre-2.1 exports, integer-based for 2.1+.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseTestSetups
|
||||
|
||||
```csharp
|
||||
public XMLParseTestSetups(XmlElement root, double importedVersion, Func<bool> isCancelled = null, bool skipNormalizing = false)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
public IEnumerable<TestTemplate> ParseTestTemplate(ImportObject importObject, XmlElement root)
|
||||
```
|
||||
|
||||
**Behavior:** Parses test setups/templates. Clears `_channelIdMapping` on construction. Normalizes channel IDs and group IDs within test templates. Maps hardware references using `_dasIdMapping`. Sets `TestSetupImportFileFormat` on the import object. Catches and records XML read errors as warnings (FB 36879). Handles deleted sensors (FB 14308) and orphaned static group references.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseCalibrations
|
||||
|
||||
```csharp
|
||||
public XMLParseCalibrations(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
public XmlElement ConvertCalibrations(IEnumerable<SensorCalibration> calibrations)
|
||||
public IEnumerable<SensorCalibration> ParseCalibrations(XmlElement root)
|
||||
```
|
||||
|
||||
**Behavior:** Parses sensor calibrations. Version-specific handling: for version 1.0, sets `AtCapacity = false` and derives `SensitivityUnits` from `NonLinear`/`IsProportional` flags. Uses `FileUtils.DataPROPre20XmlVersion` threshold.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseGroupTemplates
|
||||
|
||||
```csharp
|
||||
public XMLParseGroupTemplates(XmlElement root, double importedVersion, ISO.ISO13499FileDb iSO13499FileDb, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
public IEnumerable<DataPROWin7.DataModel.TestObjectTemplate> ParseGroupTemplates(ref ImportObject importObject, XmlElement root)
|
||||
```
|
||||
|
||||
**Behavior:** Parses group templates (test object templates). Requires `ISO13499FileDb` reference. Builds channel lookup from `importObject.CustomChannels()`. Sets `Embedded = true` for system-built or embedded templates. Throws `NotSupportedException` if referenced ISO test object is not found (FB 8790).
|
||||
|
||||
---
|
||||
|
||||
### XMLParseUsers
|
||||
|
||||
```csharp
|
||||
public XMLParseUsers(XmlElement root, double importedVersion, IEnumerable<IUIItems> uiItems, Func<bool> isCancelled = null)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
```
|
||||
|
||||
**Behavior:** Parses user records. Requires `IEnumerable<IUIItems>` for user construction. Sets import status to `ReadingUsers`.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseGlobalSettings
|
||||
|
||||
```csharp
|
||||
public XMLParseGlobalSettings(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; }
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
```
|
||||
|
||||
**Behavior:** Parses global settings into a `Dictionary<string, string>`. Extracts `SettingName` and `SettingValue` child elements.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseSensorModels
|
||||
|
||||
```csharp
|
||||
public XMLParseSensorModels(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
```
|
||||
|
||||
**Behavior:** Parses `SensorModel` objects. Creates new instances and calls `ReadXML` on each child element.
|
||||
|
||||
---
|
||||
|
||||
### XMLParseCustomerDetails, XMLParseLabDetails, XMLParseTestEngineerDetails
|
||||
|
||||
```csharp
|
||||
public XMLParseCustomerDetails(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
public XMLParseLabDetails(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
public XMLParseTestEngineerDetails(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
|
||||
public IImportNotification ImportNotification { get; set; } // All three
|
||||
public override void Parse(ref ImportObject importObject) // All three
|
||||
```
|
||||
|
||||
**Behavior:** Parse ISO entity details (customer, lab, test engineer). Each reads child elements, converts via internal `XmlWriter`, and re-parses. Sets specific import status (`ReadingCustomerDetails`, `ReadingLabDetails`).
|
||||
|
||||
---
|
||||
|
||||
### MME Custom Parsers (7 classes)
|
||||
|
||||
```csharp
|
||||
// All follow same pattern:
|
||||
public XMLParseMMECustom[Type](XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
public override void Parse(ref ImportObject importObject)
|
||||
|
||||
// Types: Directions, TestObjects, Positions, FineLoc3s, FineLoc2s, FineLoc1s, FilterClasses, Channels, MainLocations, PhysicalDimensions
|
||||
```
|
||||
|
||||
**Behavior:** Each parses ISO MME reference data types by iterating child nodes and calling `ReadXML` on each `XmlElement`. Most check `IsCancelled()` per iteration; `XMLParseMMECustomChannels` does not.
|
||||
|
||||
---
|
||||
|
||||
### Pre-20 Migration Parsers
|
||||
|
||||
```csharp
|
||||
// XMLPre20ParseGroupTemplates
|
||||
public XMLPre20ParseGroupTemplates(XmlElement root, double importedVersion, XMLParseGroupTemplates xmlParseGroupTemplates, Func<bool> isCancelled = null)
|
||||
|
||||
// XMLPre20ParseSensors
|
||||
public XMLPre20ParseSensors(XmlElement root, double importedVersion, XMLParseSensors xmlParseSensors, Func<bool> isCancelled = null)
|
||||
public XmlElement MigrateSensors(IEnumerable<SensorData> sensors)
|
||||
|
||||
// XMLPre20ParseDASList
|
||||
public XMLPre20ParseDASList(XmlElement root, double importedVersion, XMLParseDASList xmlParseDASList, Func<bool> isCancelled = null)
|
||||
public List<DASHardware> ParsePre20DASList(XmlElement root)
|
||||
|
||||
// XMLPre20ParseCalibrations
|
||||
public XMLPre20ParseCalibrations(XmlElement root, double importedVersion, XMLParseCalibrations xmlParseCalibrations, Func<bool> isCancelled = null)
|
||||
```
|
||||
|
||||
**Behavior:** Decorator-style parsers that delegate to their non-Pre20 counterparts after performing version-specific migration. `XMLPre20ParseSensors` assigns negative database IDs starting at -1. `XMLPre20ParseDASList` wraps ISO hardware in `DASHardware` instances.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **ID Normalization Range:** DAS, Sensor, Group, and Channel IDs are normalized to negative integers starting at -2 (or -1 for sensors in pre-20 migration), preserving -1 for "invalid/unassigned" semantics.
|
||||
|
||||
2. **Static Mapping Dictionaries:** `_dasIdMapping`, `_groupIdMapping`, `_sensorIdMapping`, and `_channelIdMapping` are `static readonly` and shared across all parser instances. Callers must ensure proper sequencing (DAS before Sensors before Groups before TestSetups).
|
||||
|
||||
3. **Group ID Mapping Key Type:** `_groupIdMapping` uses `string` keys to support both legacy name-based references (pre-2.1) and modern ID-based references (2.1+).
|
||||
|
||||
4. **Cancellation Contract:** If `isCancelled` parameter is null, `IsCancelled()` returns `false`. Parsers return partially-populated lists when cancelled mid-iteration.
|
||||
|
||||
5. **ImportObject Population:** All `Parse` methods modify the passed `ImportObject` via `ref` and call specific `Add*` methods (e.g., `AddSensors`, `AddHardwareList`, `AddStaticGroups`).
|
||||
|
||||
6. **Version Thresholds:**
|
||||
- `FileUtils.DataPROPre20XmlVersion` distinguishes pre-2.0 from modern formats
|
||||
- `FileUtils.DataPRO21XmlVersion` (2.1+) changes group ID reference semantics
|
||||
- Version 1.0 has special calibration sensitivity unit handling
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Import.Interfaces` - `ImportObject`, `IParseVariant`, `IImportNotification`, `ImportStatus`, `ImportError`, `ImportSeverityError`
|
||||
- `DTS.Common.Interface` - `IUIItems`, sensor interfaces
|
||||
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`, group interfaces
|
||||
- `DTS.Common.Interface.GroupTemplate` - Group template interfaces
|
||||
- `DTS.Common.SharedResource.Strings` - Localized error messages (`StringResources`)
|
||||
- `DTS.Common.Enums.DBExport` - `TopLevelFields` enum for XML element names
|
||||
- `DTS.Common.Enums` - Various enums
|
||||
- `DTS.Common.Enums.Sensors` - `SensorConstants.SensUnits`
|
||||
- `DTS.Common.Utils` - `FileUtils` with version constants
|
||||
- `DTS.SensorDB` - `SensorData`, `SensorCalibration`, `SensorModel`
|
||||
- `DTS.Slice.Users` - `User` class
|
||||
- `DataPROWin7.DataModel` - `DASHardware`, `TestObjectTemplate`, `TestObject`
|
||||
- `DTS.Common.Classes.TestSetups` - `TestTemplate`
|
||||
- `DTS.Common.ISO` or `ISO` namespace - MME types (`MMEDirections`, `MMETestObjects`, `MMEPositions`, `MMEFineLocations1/2/3`, `MMEFilterClasses`, `MMEPossibleChannels`, `MMETransducerMainLocation`, `MMEPhysicalDimensions`, `CustomerDetails`, `TestEngineerDetails`, `LabratoryDetails`)
|
||||
- `System.Xml` - `XmlElement`, `XmlDocument`, `XmlWriter`
|
||||
|
||||
### What depends on this module:
|
||||
- Not explicitly shown in source, but inferred: Import orchestration code that instantiates these parsers based on XML structure and version, then processes the populated `ImportObject`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Static Dictionary State:** The ID mapping dictionaries are static and shared. `XMLParseDASList`, `XMLParseGroups`, and `XMLParseTestSetups` clear their respective dictionaries in constructors, but if parsers are instantiated out of order or reused, mappings may be incorrect.
|
||||
|
||||
2. **Missing Cancellation Check:** `XMLParseMMECustomChannels.ParseCustomChannels` does not check `IsCancelled()` during iteration, unlike all other MME parsers.
|
||||
|
||||
3. **Unused ImportNotification Property:** `XMLParseMMECustomChannels` declares `ImportNotification` property but never uses it.
|
||||
|
||||
4. **Empty Error Handling:** In `XMLParseDASList.ParseDASList`, invalid DAS entries are collected into `invalidDAS` list but the subsequent `if (invalidDAS.Any()) { //??? }` block is empty—no error is reported.
|
||||
|
||||
5. **Pre-20 Sensor ID Collision:** `XMLPre20ParseSensors.MigrateSensors` starts IDs at -1, while `XMLParseSensors.ConvertSensors` starts at -2. This inconsistency could cause issues if both are used in the same import pipeline.
|
||||
|
||||
6. **Group Template Embedded Logic:** `XMLParseGroupTemplates` sets `template.Embedded = template.SysBuilt || template.Embedded` after reading XML, which may override the imported value unexpectedly.
|
||||
|
||||
7. **Orphaned Static Group Handling:** `XMLParseTestSetups.ConvertTestTemplates` silently sets `group.StaticGroupId = null` if the ID isn't found in `_groupIdMapping`, with only a comment explaining this is for buggy old exports.
|
||||
|
||||
8. **Version 1.0 Calibration Assumptions:** The calibration parser makes assumptions about sensitivity units for version 1.0 files based on `NonLinear` and `IsProportional` flags that may not be accurate for all legacy data.
|
||||
|
||||
9. **XmlWriter State Management:** `XMLParseBase.GetXmlElement()` calls `_writer.Close()`, which means it can only be called once per instance. Subsequent calls would fail.
|
||||
39
docs/ai/Common/DTS.Common.Licensing/Enums.md
Normal file
39
docs/ai/Common/DTS.Common.Licensing/Enums.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/Enums/DataProLicensingEnums.cs
|
||||
generated_at: "2026-04-17T16:27:42.024924+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "37dc0dceb52286dc"
|
||||
---
|
||||
|
||||
# Enums
|
||||
|
||||
### Purpose
|
||||
This module defines licensing-related enumerations for the DTS system. It exists to provide a centralized, strongly-typed definition of license types that can be referenced across the codebase for licensing validation and feature gating.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**Class: `DataProLicensingEnums`**
|
||||
- Container class for the `LicenseType` enum.
|
||||
|
||||
**Enum: `DataProLicensingEnums.LicenseType`**
|
||||
- `Standard = 0` - Basic license tier.
|
||||
- `Enterprise = 1` - Enterprise-level license.
|
||||
- `EnterpriseSite = 2` - Enterprise site license.
|
||||
- `TSRAir = 3` - TSR Air specific license.
|
||||
- `StandardSite = 4` - Standard site license (added per FB 30628).
|
||||
|
||||
### Invariants
|
||||
- Enum values are explicitly assigned starting from 0 with sequential integer values.
|
||||
- The enum is nested within a public class container.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on:** `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks` (imported but not utilized in the visible source).
|
||||
- **Depended on by:** Not determinable from source alone.
|
||||
|
||||
### Gotchas
|
||||
- The imports include several namespaces (`System.Linq`, `System.Threading.Tasks`, etc.) that are not used in the visible code—potential cleanup opportunity.
|
||||
- The comment `//FB 30628 Added StandardSite license type` references a ticket/issue tracking system for the `StandardSite` addition.
|
||||
|
||||
---
|
||||
59
docs/ai/Common/DTS.Common.Licensing/Messages.md
Normal file
59
docs/ai/Common/DTS.Common.Licensing/Messages.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/Messages/ValidationFailure.cs
|
||||
- Common/DTS.Common.Licensing/Messages/LicenseKey.cs
|
||||
- Common/DTS.Common.Licensing/Messages/ValidationResult.cs
|
||||
generated_at: "2026-04-17T16:36:18.677011+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ea10aa4d05a8b091"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Licensing Messages
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines data transfer objects (DTOs) used to communicate licensing validation results within the DTS licensing system. It provides three classes—`ValidationFailure`, `LicenseKey`, and `ValidationResult`—that encapsulate validation error details, license key identifiers, and comprehensive validation outcomes respectively. These message types serve as the contract between license validation logic and consumers that need to display or act upon licensing state.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `ValidationFailure` (namespace: `DTS.Common.Licensing.Messages`)
|
||||
|
||||
A simple POCO representing a single validation failure.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `Message` | `string` | Describes the validation failure. |
|
||||
| `HowToResolve` | `string` | Provides guidance on resolving the failure. |
|
||||
|
||||
---
|
||||
|
||||
### `LicenseKey` (namespace: `DTS.Common.Licensing`)
|
||||
|
||||
A POCO containing license key identifiers.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `KeyGuid` | `string` | A GUID identifier for the license key. |
|
||||
| `PublicKey` | `string` | The public key associated with the license. |
|
||||
|
||||
---
|
||||
|
||||
### `ValidationResult` (namespace: `DTS.Common.Licensing.Messages`)
|
||||
|
||||
A comprehensive result object aggregating all aspects of license validation.
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ValidationFailures` | `IEnumerable<ValidationFailure>` | Collection of validation failures encountered. |
|
||||
| `IsLicenseExpired` | `bool` | Indicates whether the license has expired. |
|
||||
| `IsLicenseVersionValid` | `bool` | Indicates whether the license version is valid for the product. |
|
||||
| `ProductVersion` | `Version` | The version of the product being validated. |
|
||||
| `LicenseVersion` | `string` | The version string from the license. |
|
||||
| `LicenseExpiration` | `DateTime?` | The expiration date of the license, or `null` if not applicable. |
|
||||
| `IsValid` | `bool` | Overall validity status of the license. |
|
||||
| `IsLicensed` | `bool` | Indicates whether a license file exists. Defaults to `true`. |
|
||||
| `LicensedTo` | `string` | The name of the licensee. |
|
||||
| `LicenseType` | `DataProLicensingEnums.LicenseType` | The type of license (enum value).
|
||||
43
docs/ai/Common/DTS.Common.Licensing/Properties.md
Normal file
43
docs/ai/Common/DTS.Common.Licensing/Properties.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:27:42.027646+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "0804390d2eb4102b"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly-level metadata for the `DTS.Common.Licensing` assembly. It provides versioning, COM visibility settings, and identification information for the licensing component.
|
||||
|
||||
### Public Interface
|
||||
No public types are exposed. This module consists solely of assembly-level attributes:
|
||||
|
||||
- `[assembly: AssemblyTitle("DTS.Common.Licensing")]`
|
||||
- `[assembly: AssemblyDescription("")]`
|
||||
- `[assembly: AssemblyConfiguration("")]`
|
||||
- `[assembly: AssemblyCompany("")]`
|
||||
- `[assembly: AssemblyProduct("DTS.Common.Licensing")]`
|
||||
- `[assembly: AssemblyCopyright("Copyright © 2021")]`
|
||||
- `[assembly: AssemblyTrademark("")]`
|
||||
- `[assembly: AssemblyCulture("")]`
|
||||
- `[assembly: ComVisible(false)]`
|
||||
- `[assembly: Guid("8b169b1c-37cb-4b7c-8071-385036b96faa")]`
|
||||
- `[assembly: AssemblyVersion("1.0.0.0")]`
|
||||
- `[assembly: AssemblyFileVersion("1.0.0.0")]`
|
||||
|
||||
### Invariants
|
||||
- COM visibility is explicitly set to `false`.
|
||||
- Assembly version and file version are both `1.0.0.0`.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on:** `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`.
|
||||
- **Depended on by:** Not applicable (assembly metadata).
|
||||
|
||||
### Gotchas
|
||||
- `AssemblyDescription`, `AssemblyCompany`, and `AssemblyConfiguration` are empty strings—may need population for production builds.
|
||||
- Version numbers are hardcoded and may require updating during release processes.
|
||||
|
||||
---
|
||||
51
docs/ai/Common/DTS.Common.Licensing/SystemInformation.md
Normal file
51
docs/ai/Common/DTS.Common.Licensing/SystemInformation.md
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Licensing/SystemInformation/MachineInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/ComputerSystemInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/MainBoardInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/ProcessorInfo.cs
|
||||
- Common/DTS.Common.Licensing/SystemInformation/SystemInformationXSD.cs
|
||||
generated_at: "2026-04-17T16:03:17.835094+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "39aefdb664565404"
|
||||
---
|
||||
|
||||
# SystemInformation
|
||||
|
||||
### Purpose
|
||||
This module provides hardware identification capabilities for licensing purposes by gathering unique system identifiers from the machine. It retrieves hardware-specific information such as machine name, system UUID, motherboard serial number, and processor ID using Windows Management Instrumentation (WMI), and provides an XSD schema for serializing this system information.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**MachineInfo** (static class)
|
||||
- `static string MachineName { get; }` - Returns the NetBIOS name of the local computer via `System.Environment.MachineName`. Returns empty string on exception.
|
||||
|
||||
**ComputerSystemInfo** (static class)
|
||||
- `static string SystemID { get; }` - Returns the UUID from `Win32_ComputerSystemProduct` WMI class. Returns empty string on exception.
|
||||
|
||||
**MainBoardInfo** (static class)
|
||||
- `static string SerialNumber { get; }` - Returns the serial number from `Win32_BaseBoard` WMI class. Returns empty string on exception.
|
||||
|
||||
**ProcessorInfo** (static class)
|
||||
- `static string ProcessorID { get; }` - Returns the ProcessorID from `Win32_processor` WMI class. Returns empty string on exception.
|
||||
|
||||
**SystemInformationXSD** (static class)
|
||||
- `static string XSD { get; }` - Returns an XSD schema string defining the structure for system information XML (elements: MainBoardSerialNumber, ProcessorID, SystemID, MachineName; attributes: Version, SystemInformationGuid).
|
||||
|
||||
### Invariants
|
||||
- All property getters return empty string (`""`) on any exception, never null.
|
||||
- `ManagementObjectSearcher` instances (`systemSearcher`, `baseboardSearcher`, `cpuSearcher`) are created once as static fields and reused.
|
||||
- WMI queries use `FirstOrDefault()` pattern; if no results are found, an exception will be caught and empty string returned.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `System.Management` (for WMI access), `System.Environment`
|
||||
- **Depended on by**: Unclear from source alone - likely licensing/validation components that need hardware fingerprints.
|
||||
|
||||
### Gotchas
|
||||
- **Platform limitation**: WMI queries (`System.Management`) are Windows-only; this module will not work on non-Windows platforms.
|
||||
- **Static searcher lifecycle**: The `ManagementObjectSearcher` instances are held as static fields and never disposed, which could cause resource issues in long-running applications.
|
||||
- **Silent failures**: All exceptions are swallowed and return empty string, making it difficult to diagnose WMI permission issues or service unavailability.
|
||||
- **First-result only**: When multiple processors or baseboards exist, only the first is considered.
|
||||
|
||||
---
|
||||
36
docs/ai/Common/DTS.Common.Property.md
Normal file
36
docs/ai/Common/DTS.Common.Property.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Property/PropertyModule.cs
|
||||
generated_at: "2026-04-17T16:38:14.339463+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6f33dd81b4b3a6c5"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Property Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module serves as a Prism-based modular component for property visualization within the DTS application framework. It registers property-related views and view models with the Unity dependency injection container and provides assembly-level metadata (name, image, region, and group) used by the main application shell to display and categorize available components. The module follows the Prism modularity pattern, allowing it to be dynamically loaded and discovered at runtime.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `PropertyModule` Class
|
||||
|
||||
**Signature:**
|
||||
```csharp
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "Property")]
|
||||
public class PropertyModule : IModule
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public PropertyModule(IUnityContainer unityContainer)
|
||||
```
|
||||
Accepts an `IUnityContainer` instance via constructor injection.
|
||||
|
||||
**Methods:**
|
||||
- `void Initialize()` — Registers `IPropertyView` → `PropertyView` and `IPropertyViewModel` → `PropertyViewModel` type mappings with
|
||||
39
docs/ai/Common/DTS.Common.Property/Model.md
Normal file
39
docs/ai/Common/DTS.Common.Property/Model.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Property/Model/GraphPropertyObject.cs
|
||||
generated_at: "2026-04-17T16:10:18.442473+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2d42a403a94ff001"
|
||||
---
|
||||
|
||||
# Model
|
||||
|
||||
### Purpose
|
||||
This module provides the abstract `BaseModel<TModel>` class, which serves as a foundational base class for creating model wrapper objects in the DTS system. It establishes a pattern for wrapping domain model objects with additional infrastructure (property change notification and persistence tracking) while maintaining type safety through generics.
|
||||
|
||||
### Public Interface
|
||||
|
||||
- **`BaseModel<TModel>`** (abstract class)
|
||||
- Inherits from: `BasePropertyChanged`, implements `IBaseModel`
|
||||
- Generic constraint: `TModel : class`
|
||||
|
||||
- **`TModel Model { get; set; }`** - Gets or sets the wrapped model object.
|
||||
|
||||
- **`bool IsSaved { get; }`** - Gets a value indicating whether the model has been saved. Has a private setter; no public method exists to set this to true.
|
||||
|
||||
- **`BaseModel()`** - Public parameterless constructor. Creates a new instance of the base class.
|
||||
|
||||
### Invariants
|
||||
- `TModel` must always be a reference type (class constraint).
|
||||
- `IsSaved` is initialized to `false` (default bool value) and can only be modified within the class itself.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on**: `BasePropertyChanged` (base class providing property change notification), `IBaseModel` (interface contract).
|
||||
- **Depended on by**: Unknown from this source alone, but designed as a base class for model wrappers throughout the system.
|
||||
|
||||
### Gotchas
|
||||
- The `IsSaved` property has a private setter but no method in this class ever sets it to `true`. Subclasses or external code cannot modify it, suggesting either incomplete implementation or that reflection/serialization is expected to set it.
|
||||
- The class is abstract but has a public constructor (suppressed ReSharper warning indicates this is intentional, possibly for serialization or reflection scenarios).
|
||||
|
||||
---
|
||||
16
docs/ai/Common/DTS.Common.Property/Properties.md
Normal file
16
docs/ai/Common/DTS.Common.Property/Properties.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Property/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:43:32.070182+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3af4d5be9e115cb2"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Property Assembly Configuration
|
||||
|
||||
## 1. Purpose
|
||||
This file provides assembly-level metadata and configuration for the `DTS.Common.Property` project (compiled as a .NET assembly). It defines identity attributes, version information, COM visibility settings, and copyright details that are embedded into the compiled binary. This module exists to establish the assembly's identity within the .NET runtime environment and control its exposure to COM components.
|
||||
|
||||
## 2. Public Interface
|
||||
This file does not
|
||||
51
docs/ai/Common/DTS.Common.Property/View.md
Normal file
51
docs/ai/Common/DTS.Common.Property/View.md
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Property/View/PropertyView.xaml.cs
|
||||
generated_at: "2026-04-17T16:43:29.037066+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5bc9e36e147fb721"
|
||||
---
|
||||
|
||||
# Documentation: PropertyView
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`PropertyView` is a WPF view component that provides interaction logic for a property display interface. It exists as part of the `DTS.Common.Property` namespace and implements the `IPropertyView` interface, suggesting it serves as a standard view for displaying or editing properties within the DTS system. This is a code-behind file paired with a XAML view.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `PropertyView` (class)
|
||||
**Signature:**
|
||||
```csharp
|
||||
public partial class PropertyView : IPropertyView
|
||||
```
|
||||
|
||||
**Constructor:**
|
||||
```csharp
|
||||
public PropertyView()
|
||||
```
|
||||
Initializes a new instance of the `PropertyView` class and calls `InitializeComponent()` to load the associated XAML layout.
|
||||
|
||||
**Implemented Interfaces:**
|
||||
- `IPropertyView` (from `DTS.Common.Interface`)
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The class is `partial`, indicating it must be paired with a corresponding XAML file (`PropertyView.xaml`) that defines the visual layout.
|
||||
- `InitializeComponent()` is invoked exactly once during construction, which is the standard WPF pattern for loading XAML-defined UI elements.
|
||||
- The class must fulfill any contract defined by `IPropertyView`, though the specific members of that interface are not visible in this source file.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `DTS.Common.Interface` — specifically the `IPropertyView` interface
|
||||
- WPF infrastructure (implicit via `InitializeComponent()` and partial class pattern)
|
||||
- Associated XAML file `PropertyView.xaml` (not provided)
|
||||
|
||||
**What depends on this module:**
|
||||
- Cannot be determined from this source file alone.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Documentation mismatch:** The XML documentation comment references `GraphPropertyView.xaml`, but the class is named `PropertyView`. This discrepancy suggests either a copy-paste error from another view or a historical rename that was not updated in the comments. The actual XAML file is likely `PropertyView.xaml` based on standard WPF naming conventions.
|
||||
29
docs/ai/Common/DTS.Common.Property/ViewModel.md
Normal file
29
docs/ai/Common/DTS.Common.Property/ViewModel.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Property/ViewModel/PropertyViewModel.cs
|
||||
generated_at: "2026-04-17T16:10:18.441707+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c44efa392e4e3d7a"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
### Purpose
|
||||
This module provides `PropertyViewModel`, a view model for displaying and managing graph property views. It integrates with the Prism framework for event aggregation, region management, and interaction requests (notifications/confirmations). It acts as a bridge between property views and the broader application infrastructure.
|
||||
|
||||
### Public Interface
|
||||
|
||||
- **`PropertyViewModel`** (class)
|
||||
- Inherits from: `BaseViewModel<IGraphPropertyViewModel>`, implements `IPropertyViewModel`
|
||||
|
||||
**Constructor:**
|
||||
- **`PropertyViewModel(IPropertyView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`** - Initializes the view model, sets up the view's DataContext, creates interaction requests, and subscribes to `RaiseNotification` events.
|
||||
|
||||
**Properties:**
|
||||
- **`IPropertyView View { get; }`** - Gets the associated view instance.
|
||||
- **`InteractionRequest<Notification> NotificationRequest { get; }`** - Interaction request for displaying notifications.
|
||||
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`** - Interaction request for displaying confirmations.
|
||||
- **`object Properties { get; set; }`** - Gets or sets the properties object. Raises `PropertyChanged` event when set.
|
||||
- **`string HeaderInfo { get; }`** - Returns the constant string "Graph Property".
|
||||
- **`bool IsBusy { get; set; }`** - Throws `NotImplementedException`
|
||||
55
docs/ai/Common/DTS.Common.Security.md
Normal file
55
docs/ai/Common/DTS.Common.Security.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Security/Encryption.cs
|
||||
generated_at: "2026-04-17T16:38:14.461744+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "47baa7f78b6a693b"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Common.Security.Encryption
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides symmetric AES encryption and decryption utilities for string data. It exists as a stateless helper class to encapsulate the complexity of cryptographic stream operations, allowing callers to encrypt plaintext strings into byte arrays and decrypt them back using a shared key and initialization vector (IV). It serves as a foundational security primitive within the `DTS.Common.Security` namespace.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `public static byte[] EncryptStringToBytes(string plainText, byte[] key, byte[] iv)`
|
||||
|
||||
Encrypts a UTF-8 encoded string into a cipher byte array using AES symmetric encryption.
|
||||
|
||||
- **Parameters:**
|
||||
- `plainText` (string): The clear-text string to encrypt.
|
||||
- `key` (byte[]): The secret key for the symmetric algorithm.
|
||||
- `iv` (byte[]): The initialization vector for the symmetric algorithm.
|
||||
- **Returns:** A byte array containing the encrypted cipher text.
|
||||
- **Throws:** `ArgumentNullException` if any argument is `null` or has a length of zero.
|
||||
|
||||
### `public static string DecryptStringFromBytes(byte[] cipherText, byte[] key, byte[] iv)`
|
||||
|
||||
Decrypts a cipher byte array back into a UTF-8 encoded string using AES symmetric decryption.
|
||||
|
||||
- **Parameters:**
|
||||
- `cipherText` (byte[]): The encrypted byte array to decrypt.
|
||||
- `key` (byte[]): The secret key used during encryption.
|
||||
- `iv` (byte[]): The initialization vector used during encryption.
|
||||
- **Returns:** The decrypted clear-text string.
|
||||
- **Throws:** `ArgumentNullException` if any argument is `null` or has a length of zero.
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Null/Empty Checks:** All parameters (`plainText`/`cipherText`, `key`, `iv`) must be non-null and have a length greater than zero; otherwise, an `ArgumentNullException` is thrown immediately.
|
||||
- **Key/IV Consistency:** The caller must provide the exact same `key` and `iv` byte arrays for decryption that were used for encryption; otherwise, decryption will fail or produce garbage output.
|
||||
- **Encoding:** Text encoding is implicitly UTF-8 (default behavior of `StreamWriter` and `StreamReader` used internally).
|
||||
- **Algorithm:** The implementation uses `AesCryptoServiceProvider` for the cryptographic transformation.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Direct Dependencies (Imports)
|
||||
- `System` - Core types, `ArgumentNullException`.
|
||||
- `System.IO` - `MemoryStream`, `StreamWriter`, `StreamReader` for stream-based processing.
|
||||
- `System.Security.Cryptography` - `AesCryptoServiceProvider`, `CryptoStream`.
|
||||
|
||||
### Consumers
|
||||
- Unknown from source alone. This is a utility class likely consumed by other modules within the `DTS.Common
|
||||
37
docs/ai/Common/DTS.Common.Security/Properties.md
Normal file
37
docs/ai/Common/DTS.Common.Security/Properties.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Security/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-17T16:10:52.942244+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "41d2cf231b13f1fd"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
### Purpose
|
||||
This module contains assembly-level metadata for the `DTS.Common.Security` assembly. It is a standard .NET AssemblyInfo file that defines the assembly's identity, version information, COM visibility settings, and copyright attributes. It exists to provide build system integration and assembly identification within the larger DTS codebase.
|
||||
|
||||
### Public Interface
|
||||
No public types or functions are defined. This module consists entirely of assembly-level attributes:
|
||||
- `AssemblyTitle`: "DTS.Common.Security"
|
||||
- `AssemblyProduct`: "DTS.Common.Security"
|
||||
- `AssemblyVersion`: "1.0.0.0"
|
||||
- `AssemblyFileVersion`: "1.0.0.0"
|
||||
- `ComVisible`: false
|
||||
- `Guid`: "8c99ed0f-c778-463d-bb0d-d72d1d791d47"
|
||||
|
||||
### Invariants
|
||||
- `AssemblyVersion` and `AssemblyFileVersion` are both fixed at "1.0.0.0".
|
||||
- `ComVisible` is set to false, meaning types in this assembly are not visible to COM components by default.
|
||||
- The assembly GUID is fixed at "8c99ed0f-c778-463d-bb0d-d72d1d791d47".
|
||||
|
||||
### Dependencies
|
||||
**Depends on**: `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices` (framework assemblies only).
|
||||
|
||||
**Depended on by**: Cannot be determined from source alone; this is a leaf metadata module.
|
||||
|
||||
### Gotchas
|
||||
None identified from source alone. This is auto-generated boilerplate code.
|
||||
|
||||
---
|
||||
292
docs/ai/Common/DTS.Common.Serialization.md
Normal file
292
docs/ai/Common/DTS.Common.Serialization.md
Normal file
@@ -0,0 +1,292 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/StringWriterWithEncoding.cs
|
||||
- Common/DTS.Common.Serialization/TickEventHandler.cs
|
||||
- Common/DTS.Common.Serialization/InvariantStreamWriter.cs
|
||||
- Common/DTS.Common.Serialization/BadCRCBypass.cs
|
||||
- Common/DTS.Common.Serialization/IProgressAware.cs
|
||||
- Common/DTS.Common.Serialization/ToyotaCsv.File.cs
|
||||
- Common/DTS.Common.Serialization/EventHandlers.cs
|
||||
- Common/DTS.Common.Serialization/Test.IConvertable.cs
|
||||
- Common/DTS.Common.Serialization/TestSetup.TestObject.Channel.cs
|
||||
- Common/DTS.Common.Serialization/Test.Module.IConvertable.cs
|
||||
- Common/DTS.Common.Serialization/Test.Module.Channel.IConvertable.cs
|
||||
- Common/DTS.Common.Serialization/TestSetup.TestObject.DASHardware.cs
|
||||
- Common/DTS.Common.Serialization/TestSetup.Sensor.cs
|
||||
- Common/DTS.Common.Serialization/File.Writer.cs
|
||||
- Common/DTS.Common.Serialization/IReadable.cs
|
||||
- Common/DTS.Common.Serialization/TestSetup.Graph.cs
|
||||
- Common/DTS.Common.Serialization/FilteredData.cs
|
||||
- Common/DTS.Common.Serialization/File.Writer.CharacterCountingStreamWriter.cs
|
||||
- Common/DTS.Common.Serialization/Diadem.File.cs
|
||||
- Common/DTS.Common.Serialization/TestSetup.TestObject.DASHardware.DASChannel.cs
|
||||
- Common/DTS.Common.Serialization/File.cs
|
||||
- Common/DTS.Common.Serialization/File.Reader.cs
|
||||
- Common/DTS.Common.Serialization/TestSetup.Graph.Channel.cs
|
||||
- Common/DTS.Common.Serialization/EventInfoAggregate.cs
|
||||
- Common/DTS.Common.Serialization/IWriteable.cs
|
||||
generated_at: "2026-04-17T15:26:29.501527+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fe2305d939ea2131"
|
||||
---
|
||||
|
||||
# DTS.Serialization Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
The `DTS.Serialization` namespace provides a framework for serializing and deserializing test data to various file formats (CSV, Diadem, etc.). It implements an abstract file-based architecture with reader/writer patterns, progress reporting via events, and support for converting domain objects to/from a canonical `Test` object model. The module handles data acquisition system (DAS) hardware configuration, sensor definitions, channel mappings, and filtered data representations for technical/scientific data exchange.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Core File Abstractions
|
||||
|
||||
#### `File` (abstract partial class)
|
||||
- **Signature:** `public abstract partial class File : Exceptional`
|
||||
- **Purpose:** Base class for all DTS export file types.
|
||||
- **Constructor:** `File(string formatName)` - Initializes with a format name.
|
||||
- **Properties:**
|
||||
- `string FormatName` - Gets the file format name (private setter).
|
||||
- `static string BaseExportDirectory` - Gets/sets the base export directory path.
|
||||
- `int DefaultEncoding` - Gets/sets the default encoding (defaults to UTF-8 code page).
|
||||
- `static bool UseLegacyTDCSoftwareFiltering` - Controls filtered data sample adjustment behavior.
|
||||
- `Common.Enums.IsoViewMode ISOViewMode` - Gets/sets ISO view mode.
|
||||
- **Methods:**
|
||||
- `string EnsureTrailingBackslashOnPathString(string path)` - Ensures path ends with backslash.
|
||||
- `virtual void SetEUData(string channelID, FilteredData fd)` - Stores EU data for linearized channels.
|
||||
- `virtual FilteredData GetEUData(string channelID)` - Retrieves EU data for a channel.
|
||||
- `virtual int GetChannelNumberFromChannelFileName(string channelFileName)` - Returns -1 by default; overridden in TDAS.File and SliceRaw.File.
|
||||
|
||||
#### `File.Reader<T>` (abstract class)
|
||||
- **Signature:** `public abstract class Reader<T> : Exceptional, IReader where T : File`
|
||||
- **Purpose:** Base class for file readers.
|
||||
- **Constructor:** `protected Reader(T fileType)` - Protected constructor; readers created by hosting File class.
|
||||
- **Properties:**
|
||||
- `protected T FileType` - The associated file type.
|
||||
- `protected ChannelFilenameComparer ChFileCompare` - Comparer for channel filenames.
|
||||
- **Nested Class:** `ChannelFilenameComparer` - Implements `IComparer<string>` for sorting channel files by channel number.
|
||||
|
||||
#### `File.Writer<T>` (abstract partial class)
|
||||
- **Signature:** `public abstract partial class Writer<T> : Exceptional, IWriter where T : File`
|
||||
- **Purpose:** Base class for file writers.
|
||||
- **Constructor:** `public Writer(T fileType, int encoding)`
|
||||
- **Properties:**
|
||||
- `protected T FileType` - The associated file type.
|
||||
- `virtual int DefaultEncoding` - Gets/sets the default encoding.
|
||||
- **Nested Class:** `CharacterCountingStreamWriter` - A `StreamWriter` that counts characters written via `WriteLine(string)`.
|
||||
|
||||
### Interfaces
|
||||
|
||||
#### `IReadable` / `IReadable<T>`
|
||||
- **Purpose:** Marker interface and typed interface for readable files.
|
||||
- **Property:** `IReader<T> Importer { get; }` - Gets the deserializer.
|
||||
|
||||
#### `IReader` / `IReader<T>`
|
||||
- **Purpose:** Defines requirements for file readers.
|
||||
- **Method:** `void Read(string pathname, out T target)` - Deserializes file into target object.
|
||||
|
||||
#### `IWritable` / `IWritable<T>`
|
||||
- **Purpose:** Marker interface and typed interface for writable files.
|
||||
- **Property:** `IWriter<T> Exporter { get; }` - Gets the serializer.
|
||||
|
||||
#### `IWriter` / `IWriter<T>`
|
||||
- **Purpose:** Defines requirements for file writers.
|
||||
- **Methods:**
|
||||
- `void Write(string pathname, string id, T target, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)`
|
||||
- `void Write(string pathname, string id, string dataFolder, T target, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler onBeginEvent, CancelEventHandler onCancelEvent, EndEventHandler onEndEvent, TickEventHandler onTickEvent, ErrorEventHandler onErrorEvent, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)`
|
||||
- `void Initialize(...)` - Same parameters as Write minus minStartTime and dataCollectionLength.
|
||||
|
||||
#### `IProgressAware`
|
||||
- **Purpose:** Interface for receiving progress updates from serialization objects.
|
||||
- **Events:**
|
||||
- `event BeginEventHandler OnBegin`
|
||||
- `event EndEventHandler OnEnd`
|
||||
- `event TickEventHandler OnTick`
|
||||
- `event CancelEventHandler OnCancel`
|
||||
- `event ErrorEventHandler OnError`
|
||||
|
||||
### Delegates
|
||||
|
||||
#### `BeginEventHandler`
|
||||
- **Signature:** `delegate void BeginEventHandler(object sender, uint numberOfTicks)`
|
||||
|
||||
#### `EndEventHandler`
|
||||
- **Signature:** `delegate void EndEventHandler(object sender)`
|
||||
|
||||
#### `TickEventHandler`
|
||||
- **Signature:** `delegate void TickEventHandler(object sender, double percentageComplete)`
|
||||
|
||||
#### `CancelEventHandler`
|
||||
- **Signature:** `delegate void CancelEventHandler(object sender)`
|
||||
|
||||
#### `ErrorEventHandler`
|
||||
- **Signature:** `delegate void ErrorEventHandler(object sender, Exception ex)`
|
||||
|
||||
#### `CancelRequested`
|
||||
- **Signature:** `delegate bool CancelRequested()`
|
||||
|
||||
### Utility Classes
|
||||
|
||||
#### `StringWriterWithEncoding`
|
||||
- **Signature:** `public sealed class StringWriterWithEncoding : StringWriter`
|
||||
- **Constructor:** `StringWriterWithEncoding(Encoding encoding)`
|
||||
- **Property:** `override Encoding Encoding` - Returns the encoding passed to constructor.
|
||||
|
||||
#### `InvariantStreamWriter`
|
||||
- **Signature:** `public class InvariantStreamWriter : System.IO.StreamWriter`
|
||||
- **Constructors:**
|
||||
- `InvariantStreamWriter(string path)`
|
||||
- `InvariantStreamWriter(string path, bool bAppend)`
|
||||
- **Property:** `override IFormatProvider FormatProvider` - Always returns `CultureInfo.InvariantCulture`.
|
||||
|
||||
#### `FilteredData`
|
||||
- **Signature:** `public class FilteredData : Exceptional, IComparable<FilteredData>`
|
||||
- **Constructor:** `FilteredData(string filterDescription, double filterFrequencyHz, double[] data, int absoluteDisplayOrder)`
|
||||
- **Properties:**
|
||||
- `string FilterDescription`
|
||||
- `double FilterFrequencyHz`
|
||||
- `double[] Data`
|
||||
- `int AbsoluteDisplayOrder` (read-only)
|
||||
- **Method:** `int CompareTo(FilteredData other)` - Compares by AbsoluteDisplayOrder.
|
||||
|
||||
#### `BadCRCBypass` (Windows Form)
|
||||
- **Signature:** `public partial class BadCRCBypass : Form`
|
||||
- **Properties:**
|
||||
- `string FileName` - Gets/sets `txtFileName.Text`.
|
||||
- `bool RememberChoice` - Gets/sets `cbRememberChoice.Checked`.
|
||||
- **Events:** OK and Cancel buttons set `DialogResult` and close the form.
|
||||
|
||||
### Domain Model Classes
|
||||
|
||||
#### `Test` (partial class)
|
||||
- **Nested Interface:** `Test.IConvertable` - Objects that can convert to/from `Test`.
|
||||
- `Test ToDtsSerializationTest()`
|
||||
- `void FromDtsSerializationTest(Test test, ReportErrors reportErrors)`
|
||||
- **Nested Delegate:** `delegate void ReportErrors(List<string> errors)`
|
||||
|
||||
#### `Test.Module` (partial class)
|
||||
- **Nested Interface:** `Test.Module.IConvertable`
|
||||
- `Test.Module ToDtsSerializationTestModule(DTS.Serialization.Test parentTest)`
|
||||
- `void FromDtsSerializationTestModule(Test.Module testModule, DTS.Serialization.Test.ReportErrors reportErrors)`
|
||||
|
||||
#### `Test.Module.Channel` (partial class)
|
||||
- **Nested Interface:** `Test.Module.Channel.IConvertable`
|
||||
- `Test.Module.Channel ToDtsSerializationTestModuleChannel()`
|
||||
- `void FromDtsSerializationTestModuleChannel(Test.Module.Channel channel)`
|
||||
|
||||
#### `TestSetup` (partial class hierarchy)
|
||||
- **Base:** `Exceptional`
|
||||
- **Nested Classes:**
|
||||
- `TestSetup.TestObject : Exceptional`
|
||||
- `TestSetup.TestObject.TOChannel : Exceptional` - Properties: `Name`, `SensorName`, `Version`
|
||||
- `TestSetup.TestObject.DASHardware : Exceptional` - Properties: `DASChannels`, `SampleRate`, `SerialNumber`, `Version`
|
||||
- `TestSetup.TestObject.DASHardware.DASChannel : Exceptional` - Properties: `Location`, `MeasurementUnits`, `Name`, `NumberOfSamples`, `SensorName`, `SerialNumber`, `Version`
|
||||
- `TestSetup.Sensor : Exceptional` - Properties: `FilterClass`, `Name`, `Polarity`, `Position`, `Range`, `Version`
|
||||
- `TestSetup.Graph : Exceptional`
|
||||
- Properties: `Channels`, `Name`, `HardwareChannelName`, `DisplayName`, `Version`, `IsSingleChannelGraph`, `FirstChannel`, `FirstTestChannel`, `Identifier`
|
||||
- Methods: `void UnSet()`, `override string ToString()`
|
||||
- Nested Class: `TestSetup.Graph.Channel : Exceptional`
|
||||
- Constructors: `Channel(DTS.Serialization.Test.Module.Channel channel)`, `Channel(string channelId)`
|
||||
- Properties: `ChannelId`, `ChannelGroupName`, `Name`, `SensorName`, `AxisUnit`, `SerialNumber`
|
||||
- Fields: `ParentTestModule`, `TestChannel` (both with `[System.Xml.Serialization.XmlIgnoreAttribute]`)
|
||||
|
||||
#### `EventInfoAggregate`
|
||||
- **Signature:** `public class EventInfoAggregate`
|
||||
- **Constructor:** `EventInfoAggregate(DownloadReport.EventInfo newEvent)`
|
||||
- **Properties:** `EventId`, `EventDescription`, `DurationSeconds`, `GUID`, `HasBeenDownloaded`, `WasTriggered`, `NumberOfChannels`, `NumberOfSamples`, `NumberOfBytes`, `Faulted`, `EventNumber`
|
||||
- **Methods:**
|
||||
- `Slice.Control.Event GetEvent(bool bClear)`
|
||||
- `Slice.Control.Event GetEvent()`
|
||||
- `int GetEventIndex(IDASCommunication idas)`
|
||||
- `List<IDASCommunication> GetDasList()`
|
||||
- `void Add(DownloadReport.EventInfo newEvent)` - Aggregates additional event info.
|
||||
|
||||
### File Format Implementations
|
||||
|
||||
#### `DTS.Serialization.ToyotaCsv.File`
|
||||
- **Signature:** `public partial class File : Serialization.File, IWritable<Test>`
|
||||
- **Constructor:** `File()` - Initializes with format name "Toyota CSV".
|
||||
- **Properties:**
|
||||
- `static string Extension` - Returns ".csv".
|
||||
- `IWriter<Test> Exporter` - Lazy-initialized `Writer` instance.
|
||||
|
||||
#### `DTS.Serialization.Diadem.File`
|
||||
- **Signature:** `public partial class File : Serialization.File, IWritable<Test>`
|
||||
- **Constructor:** `File(bool bUseEVG20, TestPlan plan)`
|
||||
- **Properties:**
|
||||
- `static string Extension` - Returns ".dat".
|
||||
- `bool UseIsoCodeForDiadem200` - Defaults to `true`.
|
||||
- `bool UseZeroForUnfiltered` - Defaults to `false`.
|
||||
- `DiademOptions ChannelName200Option`
|
||||
- `DiademOptions UserComment201Option`
|
||||
- `DiademOptionsReserved1 Reserved1_301Option`
|
||||
- `DiademOptionsReserved2 Reserved2_302Option`
|
||||
- `IWriter<Test> Exporter` - Lazy-initialized, configures `Writer` with all options.
|
||||
- **Enums:**
|
||||
- `DiademOptions`: `NONE`, `ISO_CODE`, `SENSOR_SERIAL_NUMBER`, `CHANNEL_NAME`
|
||||
- `DiademOptionsReserved1`: `NONE`, `AAF_RATE`, `GROUP_NAME`
|
||||
- `DiademOptionsReserved2`: `NONE`, `CHANNEL_SENSITIVITY`
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Reader/Writer Construction:** `File.Reader<T>` and `File.Writer<T>` instances must be created by their hosting `File` class via factory properties (`Importer`, `Exporter`), not directly instantiated by consumers.
|
||||
|
||||
2. **Encoding Defaults:** All file types default to UTF-8 encoding (`Encoding.UTF8.CodePage`) unless explicitly overridden.
|
||||
|
||||
3. **Property Pattern:** Domain model classes (e.g., `TestSetup.Graph`, `TestSetup.Sensor`) use a `Property<T>` wrapper pattern with namespace-qualified property names for identification.
|
||||
|
||||
4. **Version Defaults:** All version properties in `TestSetup` nested classes default to `"1.0.0.0"`.
|
||||
|
||||
5. **Channel Filename Comparison:** `ChannelFilenameComparer` relies on `GetChannelNumberFromChannelFileName()` returning -1 for non-SLICE/TDAS file types, resulting in standard string comparison.
|
||||
|
||||
6. **Event Aggregation:** `EventInfoAggregate.Add()` logs warnings but does not throw when encountering mismatched event data (TestId, Description, Duration, GUID, etc.); it takes minimum values for samples/duration on mismatch.
|
||||
|
||||
7. **Character Counting:** `CharacterCountingStreamWriter.CharactersCounted` only increments via `WriteLine(string)` override; other write methods do not update the count.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `System` (core .NET)
|
||||
- `System.IO` (stream operations)
|
||||
- `System.Text` (encoding)
|
||||
- `System.Collections.Generic` (collections)
|
||||
- `System.Linq` (LINQ operations)
|
||||
- `System.Globalization` (`CultureInfo.InvariantCulture`)
|
||||
- `System.Windows.Forms` (for `BadCRCBypass` form)
|
||||
- `System.Xml.Serialization` (`XmlIgnoreAttribute`)
|
||||
- `DTS.Common.Utilities` / `DTS.Utilities` - `Exceptional` base class, `Property<T>`
|
||||
- `DTS.Common.Utilities.DotNetProgrammingConstructs` / `DTS.Utilities.DotNetProgrammingConstructs` - `Property<T>`
|
||||
- `DTS.Common.ISO` - referenced in `Diadem.File`
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger` in `EventInfoAggregate`
|
||||
- `DTS.DASLib.Service` - `IDASCommunication`, `DownloadReport` in `EventInfoAggregate`
|
||||
- `Slice.Control` - `Event` class in `EventInfoAggregate`
|
||||
- `DTS.Common.Enums` - `IsoViewMode` enum
|
||||
|
||||
### What Depends On This Module:
|
||||
- Not determinable from source alone; this appears to be a core library consumed by higher-level application modules.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Typo in XML Documentation:** `IProgressAware.OnTick` documentation references `DTS.Seralization.EventHandler` (misspelled namespace - missing second 'i').
|
||||
|
||||
2. **CharacterCountingStreamWriter Incomplete Implementation:** Only `WriteLine(string)` updates `CharactersCounted`. Other `Write` overloads and `WriteLine` variants do not count characters, which could lead to incorrect progress reporting.
|
||||
|
||||
3. **Lazy Exporter Initialization with Side Effects:** `Diadem.File.Exporter` getter has side effects - it casts and sets `WriterParent` on the cached exporter on every access, not just first initialization.
|
||||
|
||||
4. **Exception Swallowing in Comparer:** `ChannelFilenameComparer.Compare` will throw `NullReferenceException` if `file` is null (when `fileType` passed to constructor is not a `File`), rather than handling gracefully.
|
||||
|
||||
5. **Hardcoded "EU" Fallback:** `TestSetup.Graph.Channel.AxisUnit` returns `"EU"` for non-AnalogInputChannel types and null TestChannel, which may not be appropriate for all channel types.
|
||||
|
||||
6. **DisplayName Concatenation:** `TestSetup.Graph.DisplayName` concatenates `Name` and `HardwareChannelName` with underscore, but if either is null, the result may be unexpected (e.g., `"_hardwareName"` or `"name_"`).
|
||||
|
||||
7. **EventInfoAggregate Mismatch Handling:** When aggregating events with mismatched properties, the class logs warnings but silently takes minimum values for `DurationSeconds` and `NumberOfSamples`, potentially losing data without caller awareness.
|
||||
|
||||
8. **Partial Class Sprawl:** Classes like `Test`, `TestSetup`, `File`, and their nested classes are spread across many files with `IConvertable` interfaces defined separately, making the complete type definition difficult to trace without IDE support.
|
||||
35
docs/ai/Common/DTS.Common.Serialization/Control.md
Normal file
35
docs/ai/Common/DTS.Common.Serialization/Control.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/Control/ReviewableAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/IntervalSec.cs
|
||||
generated_at: "2026-04-17T15:41:51.560483+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "cb4c6675adecfb5e"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Slice.Control
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides core data structures for the DTS Slice Control subsystem. It defines `ReviewableAttribute`, an abstract base class for attributes that can be displayed on a "review tab" with dynamically computed values, and `IntervalSec`, a simple value type representing time intervals in seconds with bidirectional implicit conversion to a serialization counterpart. Both classes extend `Exceptional`, indicating a pattern of comprehensive exception handling throughout the inheritance hierarchy.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ReviewableAttribute (abstract class)
|
||||
|
||||
**Namespace:** `DTS.Slice.Control`
|
||||
**Base Class:** `Exceptional`
|
||||
|
||||
Represents an attribute that can be displayed on a review tab, with its value computed on-demand via a delegate.
|
||||
|
||||
#### Constructor
|
||||
|
||||
```csharp
|
||||
public ReviewableAttribute(string name, DetermineValueString calculateValue)
|
||||
```
|
||||
Initializes a new instance with the specified name and value calculation delegate. Throws `ReviewableAttribute.Exception` on construction failure.
|
||||
|
||||
####
|
||||
26
docs/ai/Common/DTS.Common.Serialization/Control/DAS.md
Normal file
26
docs/ai/Common/DTS.Common.Serialization/Control/DAS.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/Control/DAS/IFilterable.cs
|
||||
- Common/DTS.Common.Serialization/Control/DAS/IFilter.cs
|
||||
generated_at: "2026-04-17T16:08:03.377171+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9a73128b86fcf306"
|
||||
---
|
||||
|
||||
# DAS
|
||||
|
||||
### 1. Purpose
|
||||
This module defines the core interfaces for filtering data within a Data Acquisition System (DAS) channel architecture. It establishes the contract for filterable channels (`IFilterable`) and the filters themselves (`IFilter`), enabling a strategy pattern where different filter implementations can be applied to channel data. It handles filter management, caching controls, and the application of filtering algorithms to raw or channel-based data.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
**`interface IFilterable`**
|
||||
* `bool UseFilterCaching { get; set; }` - Gets or sets a flag to enable or disable filter caching.
|
||||
* `List<IFilter> AvailableFilters { get; }` - Gets the list of `IFilter` objects available for this channel.
|
||||
* `IFilter CurrentFilter { get; set; }` - Gets or sets the currently active filter.
|
||||
* `double[] GetDataFilteredBy(IFilter filter, Event.Module.Channel.DataDisplayUnits displayUnits)` - Retrieves data filtered by the specified `filter` and converted to the specified `displayUnits`.
|
||||
|
||||
**`interface IFilter`**
|
||||
* `string Name { get; }` - Returns the descriptive name of the filter.
|
||||
* `bool IsCfc { get; }` - Indicates whether the filter represents a cardinal CFC (Channel Filter Class) value.
|
||||
158
docs/ai/Common/DTS.Common.Serialization/Control/Event.md
Normal file
158
docs/ai/Common/DTS.Common.Serialization/Control/Event.md
Normal file
@@ -0,0 +1,158 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/Control/Event/DasModuleAccessor.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/DasChannelAccessor.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/ChannelAccessor.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/ModuleChannelAccessor.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/DasModuleChannelAccessor.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/TestInformation.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Event.cs
|
||||
generated_at: "2026-04-17T15:34:59.374836+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "e395c2fc0bedf773"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Slice.Control.Event
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the core `Event` class for the Slice Control subsystem, representing all information related to a data acquisition system (DAS) event. It serves as the primary data structure for managing test events, including their modules, channels, and associated metadata. The module provides multiple nested accessor classes for efficient lookup of modules and channels by DAS identifiers, and supports bidirectional conversion between Slice Control event representations and `DTS.Serialization.Test` objects for persistence and interchange.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Event Class (`DTS.Slice.Control.Event`)
|
||||
|
||||
**Inheritance:** `Exceptional`, `Test.IConvertable`
|
||||
|
||||
#### Constructors
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `Event()` | Default constructor. |
|
||||
| `Event(string id, string description)` | Initializes with specified ID and description. |
|
||||
| `Event(string id, string description, List<Module> modules)` | Initializes with ID, description, and module list. |
|
||||
| `Event(Test test, Test.ReportErrors reportErrors)` | Initializes from a `DTS.Serialization.Test` object. |
|
||||
| `Event(List<IDASCommunication> dases, EventInfoAggregate info)` | Initializes from a list of connected DAS devices; builds internal accessor structures. |
|
||||
|
||||
#### Properties
|
||||
|
||||
| Name | Type | Access | Description |
|
||||
|------|------|--------|-------------|
|
||||
| `Id` | `string` | get/set | Event identifier string. |
|
||||
| `Description` | `string` | get/set | Event description string. |
|
||||
| `Guid` | `Guid` | get/set | Globally unique identifier; defaults to empty GUID. |
|
||||
| `FaultFlags` | `UInt16` | get/set | Global fault flags; defaults to `0`. |
|
||||
| `InceptionDate` | `DateTime` | get/private set | Creation date; defaults to `DateTime.Now`. |
|
||||
| `Modules` | `List<Module>` | get/set | List of modules associated with this event. |
|
||||
| `CalculatedChannels` | `List<Module.Channel>` | get/set | List of calculated channels. |
|
||||
| `DasModules` | `DasModuleAccessor` | get/private set | Accessor for modules keyed by DAS ID. |
|
||||
| `DasChannels` | `DasChannelAccessor` | get/private set | Accessor for channels keyed by DAS ID. |
|
||||
| `DasModuleChannels` | `DasModuleChannelAccessor` | get/private set | Accessor for channels keyed by DAS ID/module number/channel number triplet. |
|
||||
| `LastAbsoluteChannelNumberInEvent` | `int` | get | Highest absolute channel number in the event; returns `-1` if none found. |
|
||||
| `TooLargeFor32BitVisualizationBytesPerSampleThreshold` | `double` | get/private set | Threshold for 32-bit visualization check; defaults to `2.0`. |
|
||||
| `IsTooLargeFor32BitVisualization` | `bool` | get | Indicates if combined channel data exceeds 32-bit addressable memory. |
|
||||
| `ContainsChannelsActiveInvalidZeroingWindows` | `bool` | get | Indicates if any channels have active but invalid zeroing windows. |
|
||||
| `ChannelsWithActiveInvalidZeroingWindows` | `List<Module.Channel>` | get | List of channels with invalid zeroing window configurations. |
|
||||
| `BaseSerializationDirectory` | `string` | get/set (static) | Base path for event serialization directories. |
|
||||
|
||||
#### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `static bool IsG5(IDASCommunication idas)` | Returns `true` if DAS serial number starts with `"5M"`. |
|
||||
| `static bool IsSlice6DBModule(Module module)` | Returns `true` if module description equals `"slice6db module"` (case-insensitive). |
|
||||
| `Test ToDtsSerializationTest()` | Converts this event to a `DTS.Serialization.Test` object; purges unconfigured channels. |
|
||||
| `void FromDtsSerializationTest(Test that, Test.ReportErrors reportErrors)` | Populates this event from a `DTS.Serialization.Test` object. |
|
||||
| `static implicit operator Test(Event sliceControlEvent)` | Implicit conversion to `DTS.Serialization.Test`. |
|
||||
| `static string GetEventSerializationDirectory(string eventId)` | Returns the serialization directory path for a given event ID. |
|
||||
| `override bool Equals(object obj)` | Memberwise equality comparison. |
|
||||
| `override int GetHashCode()` | Returns base hash code. |
|
||||
|
||||
---
|
||||
|
||||
### Nested Accessor Classes
|
||||
|
||||
#### DasModuleAccessor
|
||||
```
|
||||
Inherits: ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module>>
|
||||
```
|
||||
- **Constructor:** `DasModuleAccessor()`
|
||||
- **Purpose:** Provides access to event modules by DAS ID/module number pair.
|
||||
|
||||
#### DasChannelAccessor
|
||||
```
|
||||
Inherits: ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, List<Module.Channel>>
|
||||
```
|
||||
- **Constructor:** `DasChannelAccessor()`
|
||||
- **Purpose:** Provides access to event channels by DAS ID/channel number pair.
|
||||
|
||||
#### ChannelAccessor
|
||||
```
|
||||
Inherits: ExceptionalDictionary<int, Module.Channel>
|
||||
```
|
||||
- **Constructor:** `ChannelAccessor()`
|
||||
- **Purpose:** Component of `DasModuleChannelAccessor`; maps channel numbers to channels.
|
||||
|
||||
#### ModuleChannelAccessor
|
||||
```
|
||||
Inherits: ExceptionalDictionary<int, ChannelAccessor>
|
||||
```
|
||||
- **Constructor:** `ModuleChannelAccessor()`
|
||||
- **Purpose:** Component of `DasModuleChannelAccessor`; maps module numbers to `ChannelAccessor` instances.
|
||||
|
||||
#### DasModuleChannelAccessor
|
||||
```
|
||||
Inherits: ExceptionalDictionary<Common.DAS.Concepts.DAS.Id, ModuleChannelAccessor>
|
||||
```
|
||||
- **Constructor:** `DasModuleChannelAccessor()`
|
||||
- **Purpose:** Provides access to channels by DAS ID/module number/channel number triplet.
|
||||
|
||||
---
|
||||
|
||||
### TestInformation (Private Nested Class)
|
||||
|
||||
- **Access:** `private`
|
||||
- **Inheritance:** `Exceptional`
|
||||
- **Properties:** `Id` (string), `Description` (string)
|
||||
- **Constructors:**
|
||||
- `TestInformation()` — leaves properties uninitialized
|
||||
- `TestInformation(string id, string description)`
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **GUID Default:** The `Guid` property initializes to `00000000-0000-0000-0000-000000000000` when unset.
|
||||
2. **FaultFlags Default:** The `FaultFlags` property initializes to `0`.
|
||||
3. **InceptionDate Default:** The `InceptionDate` property initializes to `DateTime.Now` at construction time.
|
||||
4. **Visualization Threshold:** `TooLargeFor32BitVisualizationBytesPerSampleThreshold` defaults to `2.0` bytes per sample.
|
||||
5. **Test ID Consistency:** When constructing from multiple DAS devices, all devices must report matching test IDs (case-insensitive comparison); otherwise an exception is thrown.
|
||||
6. **Module Array Alignment:** The constructor maintains the invariant `DasModules[das.SerialNumber].Count - 1 == dasModule.ModuleArrayIndex` (enforced via `Debug.Assert`).
|
||||
7. **Empty Slot Handling:** Empty slots in TDAS racks are filled with placeholder `Module` instances to maintain correct array indexing.
|
||||
8. **Invalid Window Average Sentinel:** The constant `InvalidWindowAverage = short.MinValue` is used to detect uninitialized window averages.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On
|
||||
|
||||
| Namespace/Assembly | Usage |
|
||||
|--------------------|-------|
|
||||
| `System` | Core types, `Guid`, `DateTime`, `InvalidOperationException` |
|
||||
| `System.Collections.Generic` | `List<T>` collections |
|
||||
| `System.Diagnostics` | `Debug.Assert` |
|
||||
| `DTS.DASLib.Service` | `IDASCommunication`, `DASModule`, `DASChannel`, `EthernetTDAS`, `OutputSquibChannel` |
|
||||
| `DTS.Serialization` | `Test` class, serialization types |
|
||||
| `DTS.Common.Utilities` | `Exceptional` base class, `Exception`, `UserException` |
|
||||
| `DTS.Common.Utilities.DotNetProgrammingConstructs` | `Property<T>` wrapper |
|
||||
| `DTS.Common.Utilities.Logging` | `APILogger.Log` |
|
||||
| `DTS.Serialization.StringResources` | Localized error strings (`Strings` class) |
|
||||
| `DTS.Common.DAS.Concepts` | `DAS.Id`, `Test.Module.Channel.Sensor.ZeroMethodType` |
|
||||
|
||||
### Consumers (Inferred)
|
||||
|
||||
- Test serialization/deserialization systems (via
|
||||
184
docs/ai/Common/DTS.Common.Serialization/Control/Event/Module.md
Normal file
184
docs/ai/Common/DTS.Common.Serialization/Control/Event/Module.md
Normal file
@@ -0,0 +1,184 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableDasSerialNumberAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/ReviewableSampleRateAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Module.cs
|
||||
generated_at: "2026-04-17T15:39:09.615523+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "474439030090ef0a"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Slice.Control.Event.Module
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the `Event.Module` class, which represents a data acquisition system (DAS) module within a Slice Control event. It serves as a container for channel configurations, timing information, sensor readings (tilt and temperature), and metadata about the recording hardware. The module also provides a set of reviewable attributes (`ReviewableAttribute` subclasses) that expose specific module properties in a standardized format for review/display purposes, and implements bidirectional conversion between runtime objects and serialization formats.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Event.Module Class
|
||||
|
||||
**Namespace:** `DTS.Slice.Control`
|
||||
|
||||
**Inheritance:** `Exceptional`, implements `Serialization.Test.Module.IConvertable`
|
||||
|
||||
#### Constructors
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `Module()` | Default constructor. Initializes a new instance with empty channels list. |
|
||||
| `Module(Event parentEvent)` | Initializes with a parent `Event` reference. |
|
||||
| `Module(Serialization.Test.Module that, Event parent, Serialization.Test.ReportErrors reportErrors)` | Initializes from a serialization object, populating all properties from the source. |
|
||||
|
||||
#### Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ParentEvent` | `Event` | The parent `Event` containing this module. Has `SetParentEvent(Event e)` setter method. |
|
||||
| `Channels` | `List<Channel>` | List of channels on this event module. |
|
||||
| `Number` | `int` | Module number identifier. |
|
||||
| `DasSerialNumber` | `string` | DAS serial number string. |
|
||||
| `Description` | `string` | Module description. |
|
||||
| `BaseSerialNumber` | `string` | Base serial number for this DAS. |
|
||||
| `RequestedPreTriggerSeconds` | `double` | Requested pre-trigger duration in seconds. |
|
||||
| `RequestedPostTriggerSeconds` | `double` | Requested post-trigger duration in seconds. |
|
||||
| `PreTriggerSeconds` | `double` | Actual pre-trigger duration in seconds. |
|
||||
| `PostTriggerSeconds` | `double` | Actual post-trigger duration in seconds. |
|
||||
| `NumberOfSamples` | `UInt64` | Number of samples in this module. |
|
||||
| `UnsubsampledNumberOfSamples` | `UInt64` | Number of unsubsampled samples. |
|
||||
| `TriggerSampleNumbers` | `List<UInt64>` | Trigger sample numbers. |
|
||||
| `UnsubsampledTriggerSampleNumbers` | `List<UInt64>` | Unsubsampled trigger sample numbers. |
|
||||
| `StartRecordSampleNumber` | `UInt64` | Start record sample number. |
|
||||
| `SampleRateHz` | `float` | Sample rate in Hz. |
|
||||
| `StartRecordTimestampSec` | `double` | Start record timestamp (seconds component). |
|
||||
| `StartRecordTimestampNanoSec` | `double` | Start record timestamp (nanoseconds component). |
|
||||
| `TriggerTimestampSec` | `double` | Trigger timestamp (seconds component). |
|
||||
| `TriggerTimestampNanoSec` | `double` | Trigger timestamp (nanoseconds component). |
|
||||
| `PTPMasterSync` | `bool` | Whether PTP master sync is used. |
|
||||
| `TiltSensorAxisXDegreesPre` / `TiltSensorAxisYDegreesPre` / `TiltSensorAxisZDegreesPre` | `double` | Pre-trigger tilt sensor axis values in degrees. |
|
||||
| `TiltSensorAxisXDegreesPost` / `TiltSensorAxisYDegreesPost` / `TiltSensorAxisZDegreesPost` | `double` | Post-trigger tilt sensor axis values in degrees. |
|
||||
| `TemperatureLocation1Pre` through `TemperatureLocation4Pre` | `float` | Pre-trigger temperature sensor values at 4 locations. |
|
||||
| `TemperatureLocation1Post` through `TemperatureLocation4Post` | `float` | Post-trigger temperature sensor values at 4 locations. |
|
||||
| `AaFilterRateHz` | `float` | Anti-aliasing filter rate in Hz. |
|
||||
| `NominalExcitationVoltage` | `Test.Module.Channel.Sensor.ExcitationVoltageOption` | Nominal excitation voltage (default: `Volt5`). |
|
||||
| `RecordingMode` | `Test.Module.RecordingMode` | Recording mode (default: `CircularBuffer`). |
|
||||
|
||||
#### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `void SetPropertyValuesFrom(DASLib.Service.DASModule that)` | Copies trigger sample numbers, number of samples, and fault flags from a `DASModule` object. |
|
||||
| `override bool Equals(object obj)` | Memberwise equality comparison of all major properties and child collections. |
|
||||
| `override int GetHashCode()` | Returns base hash code. |
|
||||
| `bool IsSlice6DBModule()` | Returns `true` if `Description` equals `"slice6db module"`. |
|
||||
| `Serialization.Test.Module ToDtsSerializationTestModule(Serialization.Test parentTest)` | Converts this object to a `Serialization.Test.Module`. Only includes channels where `IsConfigured` is `true`. |
|
||||
| `void FromDtsSerializationTestModule(Serialization.Test.Module that, Serialization.Test.ReportErrors reportErrors)` | Populates this object from a `Serialization.Test.Module`. Creates channels via `Channel.CreateChannel()`. |
|
||||
|
||||
---
|
||||
|
||||
### Event.Module.ReviewableAttribute Class
|
||||
|
||||
**Inheritance:** `Slice.Control.ReviewableAttribute` (abstract)
|
||||
|
||||
#### Constructors
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `public ReviewableAttribute(Event.Module channel)` | **Throws `NotImplementedException`** wrapped in `Module.ReviewableAttribute.Exception`. Documented as "concrete class should implement this constructor." |
|
||||
| `protected ReviewableAttribute(string name, DetermineValueString calculateValue)` | Protected constructor that passes name and value delegate to base class. |
|
||||
|
||||
---
|
||||
|
||||
### Event.Module.ReviewableDasSerialNumberAttribute Class
|
||||
|
||||
**Inheritance:** `Event.Module.ReviewableAttribute`
|
||||
|
||||
| Constructor | Description |
|
||||
|-------------|-------------|
|
||||
| `public ReviewableDasSerialNumberAttribute(Event.Module module)` | Initializes with name `"DAS Serial Number"` and a delegate returning `module.DasSerialNumber`. |
|
||||
|
||||
---
|
||||
|
||||
### Event.Module.ReviewableSampleRateAttribute Class
|
||||
|
||||
**Inheritance:** `Event.Module.ReviewableAttribute`
|
||||
|
||||
| Constructor | Description |
|
||||
|-------------|-------------|
|
||||
| `public ReviewableSampleRateAttribute(Event.Module module)` | Initializes with name `"Sample Rate"` and a delegate returning `module.SampleRateHz.ToString("N")`. |
|
||||
|
||||
---
|
||||
|
||||
### Event.Module.ReviewableTestDescriptionAttribute Class
|
||||
|
||||
**Inheritance:** `Event.Module.ReviewableAttribute`
|
||||
|
||||
| Constructor | Description |
|
||||
|-------------|-------------|
|
||||
| `public ReviewableTestDescriptionAttribute(Event.Module module)` | Initializes with name `"Test Description"` and a delegate returning `module.ParentEvent.Description`. |
|
||||
|
||||
---
|
||||
|
||||
### Event.Module.ReviewableHardwareFrequencyAttribute Class
|
||||
|
||||
**Inheritance:** `Event.Module.ReviewableAttribute`
|
||||
|
||||
| Constructor | Description |
|
||||
|-------------|-------------|
|
||||
| `public ReviewableHardwareFrequencyAttribute(Event.Module module)` | Initializes with name `"HW AAF"` and a delegate returning `module.AaFilterRateHz.ToString("N2")`. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Parent-Child Relationship**: A `Module` must have a valid `ParentEvent` reference for operations that access parent properties (e.g., `ReviewableTestDescriptionAttribute` accesses `module.ParentEvent.Description`).
|
||||
|
||||
2. **Channel Filtering in Serialization**: `ToDtsSerializationTestModule()` only serializes channels where `IsConfigured` is `true`.
|
||||
|
||||
3. **Channel Numbering**: When populating from a serialization module, channels are assigned sequential absolute channel numbers starting from `ParentEvent.LastAbsoluteChannelNumberInEvent + 1`.
|
||||
|
||||
4. **Equality Semantics**: `Equals()` performs memberwise comparison including all properties and child collections (`Channels`, `TriggerSampleNumbers`, `UnsubsampledTriggerSampleNumbers`).
|
||||
|
||||
5. **ReviewableAttribute Constructor Contract**: The public constructor taking `Event.Module` is explicitly designed to throw; subclasses must use the protected constructor with name and delegate.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `DTS.Common.DAS.Concepts`
|
||||
- `DTS.Serialization.StringResources`
|
||||
- `DTS.Common.Utilities`
|
||||
- `DTS.Common.Utilities.DotNetProgrammingConstructs`
|
||||
- `DTS.Common.Utilities.Logging` (for `APILogger`)
|
||||
- `DTS.Utilities` (referenced in `ReviewableDasSerialNumberAttribute.cs` and `ReviewableSampleRateAttribute.cs`)
|
||||
- `System`, `System.Collections.Generic`, `System.Linq`, `System.Diagnostics`
|
||||
- `DASLib.Service.DASModule` (external service type used in `SetPropertyValuesFrom`)
|
||||
- `Slice.Control.ReviewableAttribute` (base class for `Event.Module.ReviewableAttribute`)
|
||||
- `Slice.Control.Event` (parent container class)
|
||||
- `Serialization.Test.Module` and related serialization types
|
||||
|
||||
### What Depends On This Module:
|
||||
- Not explicitly shown in source, but `Channel` class is referenced extensively, implying `Event.Module.Channel` is a dependent nested class.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **ReviewableAttribute Constructor Throws by Design**: The public constructor `ReviewableAttribute(Event.Module channel)` always throws a `NotImplementedException`. This appears to be intentional guard code, but the pattern is unusual—subclasses should call the protected constructor directly.
|
||||
|
||||
2. **Inappropriate Exception Handling**: The `FromDtsSerializationTestModule()` method uses try/catch blocks around individual property assignments (e.g., `StartRecordTimestampSec`, `TriggerTimestampSec`, tilt sensor values, temperature values) with logging but no re-throw. This silently swallows errors and continues execution. Source contains TODO comments: `"//TODO: inappropriate using try/catch!!!"`.
|
||||
|
||||
3. **Incorrect Log Message**: In `FromDtsSerializationTestModule()`, the catch block for `TriggerTimestampNanoSec` logs `"failed to get TriggerTimestampSec"` instead of `"failed to get TriggerTimestampNanoSec"`.
|
||||
|
||||
4. **Wrong Property Assignment**: In `FromDtsSerializationTestModule()`, the line `TriggerTimestampNanoSec = that.StartRecordTimestampNanoSec` appears to copy from the wrong source property (should likely be `that.TriggerTimestampNanoSec`).
|
||||
|
||||
5. **Commented-Out Initialization**: In the default `Module()` constructor, the call to `InitializeReviewableAttributes` is commented out. It is unclear if this is intentional or dead code.
|
||||
|
||||
6. **Exception Swallowing in SetPropertyValuesFrom**: The method catches exceptions when reading `ParentEvent.FaultFlags` and silently ignores them with an empty catch block (`catch (System.Exception) { }`).
|
||||
|
||||
7. **Format String Inconsistency**: `ReviewableSampleRateAttribute` uses `"N"` format while `ReviewableHardwareFrequencyAttribute` uses `"N2"` format for numeric display.
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableShuntDeflectionAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableFilterFrequencyAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableIsoCodeAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableDescriptionAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableSerialNumberAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableUnitsAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableMinMaxEuAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableCfcAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableTargetShuntDeflectionAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableMeasuredShuntDeflectionAttribute.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/AnalogInputChannel/ReviewableShuntDeflectionPercentageAttribute.cs
|
||||
generated_at: "2026-04-17T15:31:14.276531+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "42e54499338ddc45"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Slice.Control.Event.Module.AnalogInputChannel Reviewable Attributes
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a collection of reviewable attribute classes for analog input channels within the DTS Slice Control event system. Each class encapsulates a specific channel property (e.g., shunt deflection, filter frequency, serial number, calibration values) that can be displayed or reviewed in a standardized format. These attributes follow a consistent pattern where each inherits from `Slice.Control.Event.Module.Channel.ReviewableAttribute` and uses a delegate-based deferred evaluation to retrieve formatted string values from channel data at runtime.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
All classes are nested within `DTS.Slice.Control.Event.Module.AnalogInputChannel` and inherit from `Slice.Control.Event.Module.Channel.ReviewableAttribute`.
|
||||
|
||||
### ReviewableShuntDeflectionAttribute
|
||||
```csharp
|
||||
public ReviewableShuntDeflectionAttribute(Event.Module.Channel channel)
|
||||
```
|
||||
Captures the measured shunt deflection in millivolts. The delegate casts `channel` to `DTS.DAS.Concepts.DAS.Channel.IShuntAware` and returns `MeasuredShuntDeflectionMv` formatted as `"F1"`. Label: `"Shunt Deflection (mV)"`.
|
||||
|
||||
---
|
||||
|
||||
### ReviewableFilterFrequencyAttribute
|
||||
```csharp
|
||||
public ReviewableFilterFrequencyAttribute(Event.Module.Channel channel)
|
||||
```
|
||||
Captures the filter cutoff frequency. The delegate casts `channel.CurrentFilter` to `SaeJ211Filter` and returns `CutoffFrequencyHz` as an integer formatted with `"N"`. Label: `"Filter Frequency"`.
|
||||
|
||||
---
|
||||
|
||||
### ReviewableIsoCodeAttribute
|
||||
```csharp
|
||||
public ReviewableIsoCodeAttribute(Event.Module.Channel channel)
|
||||
```
|
||||
Captures the ISO code. The delegate casts `channel` to `AnalogInputChannel` and returns `IsoCode.ToString()`. Label: `"ISO Code"`.
|
||||
|
||||
---
|
||||
|
||||
### ReviewableDescriptionAttribute
|
||||
```csharp
|
||||
public ReviewableDescriptionAttribute(Event.Module.Channel channel)
|
||||
```
|
||||
Captures the channel description. The delegate returns `channel.ChannelDescriptionString`. Label: `"Description"`.
|
||||
|
||||
---
|
||||
|
||||
### ReviewableSerialNumberAttribute
|
||||
```csharp
|
||||
public ReviewableSerialNumberAttribute(Event
|
||||
@@ -0,0 +1,220 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/DataValues.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/ReviewableAttribute.NotApplicableException.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/Filter.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/ChannelDefaultSaeJ211Filter.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/CalculatedChannel.cs
|
||||
- Common/DTS.Common.Serialization/Control/Event/Module/Channel/SaeJ211Filter.cs
|
||||
generated_at: "2026-04-17T15:34:47.007360+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ba30fc370955c9dd"
|
||||
---
|
||||
|
||||
# DTS.Slice.Control.Event.Module.Channel Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides the channel-level data structures and filtering mechanisms for the DTS Slice Control Event system. It defines classes for storing channel data values (with optional memory-mapped file support for large datasets), implements SAE J211-compliant digital filters for signal processing, and provides a hierarchy of calculated channel types for derived data operations such as integration, differentiation, FFT analysis, and vector mathematics. The module exists to support data acquisition and analysis workflows within the larger DTS Slice framework.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `Event.Module.Channel.DataValues`
|
||||
|
||||
A class representing a channel's data, inheriting from `Exceptional`.
|
||||
|
||||
**Constructors:**
|
||||
- `DataValues()` — Initializes with memory-mapped file support enabled by default.
|
||||
- `DataValues(bool useMemoryMappedFile)` — Initializes with explicit control over memory-mapped file usage.
|
||||
|
||||
**Properties:**
|
||||
- `bool UseMemoryMappedFile { get; set; }` — Controls whether the class uses memory-mapped files instead of in-memory lists for data storage.
|
||||
|
||||
---
|
||||
|
||||
### `Event.Module.Channel.ReviewableAttribute.NotApplicableException`
|
||||
|
||||
An exception class for attempts to use a channel attribute that is not applicable to the associated channel. Inherits from `ApplicationException`.
|
||||
|
||||
**Constructors:**
|
||||
- `NotApplicableException()`
|
||||
- `NotApplicableException(string msg)`
|
||||
- `NotApplicableException(string msg, System.Exception innerEx)`
|
||||
|
||||
---
|
||||
|
||||
### `Event.Module.Channel.Filter` (Abstract)
|
||||
|
||||
Abstract base class for channel filters. Implements `Exceptional` and `IFilter`.
|
||||
|
||||
**Abstract Properties:**
|
||||
- `string Name { get; }` — Descriptive designation for the filter.
|
||||
- `bool IsCfc { get; }` — Indicates whether the filter corresponds to a CFC (Channel Filter Class) value.
|
||||
- `ChannelFilter Type { get; }` — The `ChannelFilter` designation for this filter.
|
||||
- `double CutoffFrequencyHz { get; }` — The cutoff frequency in Hz.
|
||||
|
||||
**Abstract Methods:**
|
||||
- `double[] Apply(Channel input, DataDisplayUnits displayUnits, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to a channel.
|
||||
- `double[] Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to raw data.
|
||||
- `string ToBaseString()` — Returns the base name without decoration (contrast with `ToString()`).
|
||||
|
||||
---
|
||||
|
||||
### `Event.Module.Channel.SaeJ211Filter`
|
||||
|
||||
Concrete implementation of SAE J211-based filters. Inherits from `Filter`.
|
||||
|
||||
**Constructors:**
|
||||
- `SaeJ211Filter(SaeJ211Filter originalFilter)` — Copy constructor.
|
||||
- `SaeJ211Filter(ChannelFilter originalType)` — Initializes from a `ChannelFilter` enum value. Throws `Exception` if `ChannelFilter.AdHoc` is passed.
|
||||
- `SaeJ211Filter(double cutoffFrequencyHz)` — Initializes an ad hoc filter with a specific cutoff frequency.
|
||||
|
||||
**Properties:**
|
||||
- `override bool IsCfc { get; }` — Returns `true` if the filter is CFC-compliant (not `Unfiltered` and not `AdHoc`).
|
||||
- `override ChannelFilter Type { get; }` — Returns the best-fitting `ChannelFilter` value.
|
||||
- `char IsoDescription { get; }` — Returns the ISO description character.
|
||||
- `override double CutoffFrequencyHz { get; }` — The cutoff frequency.
|
||||
- `ChannelFilter OriginalType { get; }` — The original filter type specified at construction.
|
||||
- `override string Name { get; }` — The filter name (e.g., "1000Hz" for ad hoc, or the CFC description).
|
||||
|
||||
**Methods:**
|
||||
- `override double[] Apply(Channel channel, DataDisplayUnits displayUnits, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to channel data.
|
||||
- `override double[] Apply(double[] data, double sampleRate, bool bUseLegacyTDCSoftwareFilterAdjustment)` — Applies the filter to raw data.
|
||||
- `override string ToString()` — Returns `Name`.
|
||||
- `override string ToBaseString()` — Returns `Name`.
|
||||
- `override bool Equals(object obj)` — Compares filters by name (case-insensitive).
|
||||
- `override int GetHashCode()` — Returns hash based on lowercase name.
|
||||
- `static Filter Parse(string serialization)` — Creates a filter from a string representation.
|
||||
|
||||
---
|
||||
|
||||
### `Event.Module.Channel.DefaultSaeJ211Filter`
|
||||
|
||||
A default wrapper for SAE J211 filters. Inherits from `SaeJ211Filter`.
|
||||
|
||||
**Constructors:**
|
||||
- `DefaultSaeJ211Filter(SaeJ211Filter filter)` — Wraps an existing filter.
|
||||
- `DefaultSaeJ211Filter(ChannelFilter filterType)` — Creates a filter from a `ChannelFilter` type.
|
||||
- `DefaultSaeJ211Filter(double adHocFrequency)` — Creates an ad hoc filter with specified frequency.
|
||||
|
||||
**Properties:**
|
||||
- `override string Name { get; }` — Returns `"Default (" + base.Name + ")"`.
|
||||
|
||||
**Methods:**
|
||||
- `override string ToBaseString()` — Returns `base.Name`.
|
||||
- `override string ToString()` — Returns `Name`.
|
||||
|
||||
---
|
||||
|
||||
### `Event.Module.Channel.CalculatedChannel` (Abstract)
|
||||
|
||||
Abstract base class for calculated/derived channels. Inherits from `Channel` and implements `IEngineeringUnitAware`.
|
||||
|
||||
**Nested Enum:**
|
||||
- `Operation` — Values: `Integral`, `Derivative`, `HeadInjuryCriteria`, `FFT`, `ImportedCSV`, `Resultant`, `TSR`, `Scale`, `Offset`, `Sine`, `Cosine`.
|
||||
|
||||
**Nested Enum:**
|
||||
- `XUnits` — Values: `msec`, `sec`, `Hz`, `samples`.
|
||||
|
||||
**Properties:**
|
||||
- `Operation CalculationType { get; }` — The calculation type.
|
||||
- `double[] X { get; }` — X-axis values.
|
||||
- `double[] Y { get; }` — Y-axis values.
|
||||
- `XUnits XAxis { get; }` — X-axis unit type.
|
||||
- `string XUnitsString { get; }` — String representation of X units.
|
||||
- `string EngineeringUnits { get; set; }` — Y-axis engineering units.
|
||||
- `override bool SupportsADC { get; }` — Returns `false`.
|
||||
- `override bool SupportsEU { get; }` — Returns `true`.
|
||||
- `override bool SupportsmV { get; }` — Returns `false`.
|
||||
- `override double ActualMaxRangeEu { get; }` — Returns `Y.Max()`.
|
||||
- `override double ActualMinRangeEu { get; }` — Returns `Y.Min()`.
|
||||
- `override double DataHalfRangeValueEu { get; }`, `DataMaxEu { get; }`, `DataMinEu { get; }`, `DataRangeEu { get; }` — Statistical properties of Y data.
|
||||
- `override bool IsConfigured { get; set; }` — Always `true`; setter throws `NotSupportedException`.
|
||||
|
||||
**Constructor:**
|
||||
- `CalculatedChannel(string name, XUnits xAxis, string yAxis, double[] xValues, double[] yValues, Operation calcType, int number, Module parentModule)`
|
||||
|
||||
**Methods that throw `NotSupportedException` or `NotImplementedException`:**
|
||||
- `override void FromDtsSerializationTestModuleChannel(Serialization.Test.Module.Channel that)`
|
||||
- `override void SetPropertyValuesFrom(DASLib.Service.DASChannel dasChannel)`
|
||||
- `override void SetPropertyValuesFrom(DASLib.Service.DiagnosticsResult diagResults)`
|
||||
- `override Serialization.Test.Module.Channel ToDtsSerializationTestModuleChannel(Serialization.Test.Module parentModule)`
|
||||
- `override double ActualMaxRangeMv { get; }`
|
||||
- `override double ActualMinRangeMv { get; }`
|
||||
- `override double SensorCapacityEU { get; }`
|
||||
- `override double DesiredRangeEU { get; }`
|
||||
- `override List<double> GetUnfilteredDataMV()`
|
||||
|
||||
**Methods:**
|
||||
- `override List<double> GetUnfilteredDataEu()` — Returns a copy of Y values.
|
||||
- `override string ToString()` — Returns `ChannelDescriptionString` or `"N/A"`.
|
||||
|
||||
---
|
||||
|
||||
### Concrete Calculated Channel Types
|
||||
|
||||
All inherit from `CalculatedChannel` and have identical constructor signatures:
|
||||
|
||||
- `FFTCalculatedChannel` — Additional property: `double PeakFrequency { get; }`. Constructor includes extra `double peakFrequency` parameter.
|
||||
- `IntegralCalculatedChannel`
|
||||
- `DerivativeCalculatedChannel`
|
||||
- `ScaleCalculatedChannel`
|
||||
- `OffsetCalculatedChannel`
|
||||
- `ResultantCalculatedChannel`
|
||||
- `AdditiveVectorCalculatedChannel`
|
||||
- `SineCalculatedChannel`
|
||||
- `CosineCalculatedChannel`
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Filter Type Consistency**: `SaeJ211Filter.Type` will never return `ChannelFilter.AdHoc` if the cutoff frequency exactly matches a CFC value; it will return the matching CFC type instead.
|
||||
|
||||
2. **CFC Compliance**: `SaeJ211Filter.IsCfc` returns `true` only when `Type` is neither `Unfiltered` nor `AdHoc`.
|
||||
|
||||
3. **Filter Equality**: Two `SaeJ211Filter` instances are considered equal if their `Name` properties match case-insensitively. Consequently, `GetHashCode()` is based on the lowercase name.
|
||||
|
||||
4. **Calculated Channel Data Immutability**: X and Y data arrays in `CalculatedChannel` are stored in `readonly List<double>` fields and exposed as copies via `ToArray()`.
|
||||
|
||||
5. **Calculated Channel Capabilities**: All `CalculatedChannel` derivatives have `SupportsADC = false`, `SupportsEU = true`, and `SupportsmV = false`.
|
||||
|
||||
6. **Parse Round-Trip**: `SaeJ211Filter.Parse()` can parse filter names produced by `ToString()`; unrecognized strings return an `Unfiltered` filter.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Utilities` — Provides `Exceptional` base class, `Exception`, `Property<T>`, `APILogger`.
|
||||
- `DTS.Common.Utilities.DotNetProgrammingConstructs` — Provides `Property<T>`.
|
||||
- `DTS.Common.Utilities.SaeJ211` — Provides `FilterUtility`, `CfcValueAttributeCoder`, `DescriptionAttributeCoder<T>`, `IsoDescriptionAttributeCoder`.
|
||||
- `DTS.Common.Utilities.Logging` — Provides `APILogger`.
|
||||
- `DTS.Common.DAS.Concepts.DAS.Channel` — Provides `ChannelFilter`, `IFilter`, `IEngineeringUnitAware`.
|
||||
- `DTS.Slice.Control.DAS.Channel` — Referenced in `Filter.cs`.
|
||||
- `DASLib.Service` — Provides `DASChannel`, `DiagnosticsResult` (used in `CalculatedChannel`).
|
||||
- `System` namespaces — Standard .NET types.
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be fully determined from source alone, but the partial class structure (`Event.Module.Channel`) indicates this is part of a larger `DTS.Slice.Control` namespace hierarchy.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Empty Memory-Mapped File Implementation**: In `DataValues.DataValues(bool useMemoryMappedFile)`, the `if (UseMemoryMappedFile)` block is empty. The feature appears to be a stub or incomplete implementation.
|
||||
|
||||
2. **Legacy TDC Filter Adjustment**: The `Apply` methods on filters accept a `bool bUseLegacyTDCSoftwareFilterAdjustment` parameter (referenced as "8747" in comments) that adjusts filtered data by one sample to match legacy TDC behavior. This may produce unexpected results if not understood.
|
||||
|
||||
3. **NotSupportedException on CalculatedChannel**: Many methods on `CalculatedChannel` throw `NotSupportedException` or `NotImplementedException`. These include serialization methods, mV-related properties, and some range properties. Callers must handle these exceptions.
|
||||
|
||||
4. **AdHoc Filter Construction Restriction**: `SaeJ211Filter(ChannelFilter originalType)` throws an `Exception` if passed `ChannelFilter.AdHoc`. Use the `SaeJ211Filter(double cutoffFrequencyHz)` constructor instead.
|
||||
|
||||
5. **Large Data Handling in Filter.Apply**: When filtering ADC data, the method checks for `ILargeDataAware.IsDataArraySized` and throws `DataTooBigForArrayException` if data is too large. This is a runtime consideration for large datasets.
|
||||
|
||||
6. **Commented-Out Code**: Significant blocks of code are commented out in `CalculatedChannel.cs`, including the entire `HICCalculatedChannel` class and `InitializeReviewableAttributes` implementations. This suggests incomplete features or tech debt.
|
||||
|
||||
7. **Filter Name Ambiguity**: `DefaultSaeJ211Filter.Name` returns `"Default (" + base.Name + ")"`, while `ToBaseString()` returns just `base.Name`. The `ToString()` returns the decorated name. Use `ToBaseString()` when the undecorated name is needed.
|
||||
326
docs/ai/Common/DTS.Common.Serialization/DDAS (Chrysler).md
Normal file
326
docs/ai/Common/DTS.Common.Serialization/DDAS (Chrysler).md
Normal file
@@ -0,0 +1,326 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/ChannelDefinition.h
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASTestDefinition.h
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/DataFloat.h
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/DDAS.File.cs
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASTest.cs
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/DDAS.File.Writer.cs
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/TSVSettingsWindow.cs
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/TSVSettingsWindow.Designer.cs
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/DDASChannel.cs
|
||||
generated_at: "2026-04-17T15:32:53.691261+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "403f99d261310d3b"
|
||||
---
|
||||
|
||||
# DDAS Serialization Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides serialization and deserialization support for the DDAS (DaimlerChrysler Data Acquisition System) file format, a proprietary binary format used for storing crash test data. It bridges legacy C++ structures (originally from DDAS testplan.h) with a modern C# serialization framework, enabling export of test data including channel configurations, transducer metadata, and floating-point sample data. The module handles multiple data types (Raw/ADC, Processed/Filtered, and Converted/Engineering Units) and produces `.ddas` or `.fpd` files compatible with downstream analysis tools.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### C# Classes
|
||||
|
||||
#### `DTS.Serialization.DDAS.File`
|
||||
A partial class representing the DDAS file format, extending `Serialization.File` and implementing `IWritable<Test>`.
|
||||
|
||||
```csharp
|
||||
public File() // Constructor, initializes with "DDAS" format identifier
|
||||
public static string Extension // Returns ".ddas"
|
||||
public IWriter<Test> Exporter // Lazy-initialized property returning a Writer instance
|
||||
```
|
||||
|
||||
#### `DTS.Serialization.DDAS.File.Writer`
|
||||
Nested class for serializing `Test` objects to DDAS format.
|
||||
|
||||
```csharp
|
||||
internal Writer(File fileType, int encoding) // Constructor
|
||||
public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength) // Throws NotImplementedException
|
||||
public void Write(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength) // Main write method
|
||||
public void Initialize(...) // Empty initialization method
|
||||
public string ExtensionPrefix { get; set; } // Defaults to empty string
|
||||
public DDASTest MyTVTTest { get; set; } // Reference to DDASTest being written
|
||||
private int DataSamplesPerTick // Returns 1000
|
||||
private uint GetChannelTicks(Test.Module.Channel channel) // Calculates progress ticks
|
||||
```
|
||||
|
||||
#### `DTS.Serialization.DDAS.DDASTest`
|
||||
Represents a complete DDAS test with metadata and channel collection.
|
||||
|
||||
```csharp
|
||||
public enum Fields { LabName, POCName, POCPhoneAndEmail, TestDate, TestTime, TestNumber, TestType, TestObject, DataType, SensorMakeModelSerial, SensorLocation, SensorAxis, SensorMountType, EngineeringUnits, ChannelErrors, SamplingRate, AAFilterCutoffDescription, BitResolution, DigitalFilterType, Notes }
|
||||
|
||||
public string GetValue(Fields field) // Returns "#NOVALUE" if not set
|
||||
public void SetValue(Fields field, string value) // Sets value and propagates to all channels
|
||||
public DDASChannel[] Channels { get; set; } // Array of channel objects
|
||||
public Test Test { get; } // Reference to underlying Test object
|
||||
public FilteredData[] DataUnfilteredEU { get; } // Unfiltered engineering unit data
|
||||
public FilteredData[] DataADC { get; } // ADC/raw data
|
||||
public double[] ActualRangesEUFiltered { get; } // Filtered EU ranges
|
||||
public double[] ActualRangesEUUnfiltered { get; } // Unfiltered EU ranges
|
||||
public double[] ActualRangesADC { get; } // ADC ranges
|
||||
public bool FlatFolders { get; } // Folder structure option
|
||||
|
||||
public DDASTest(Test test, FilteredData[] adc, FilteredData[] euUnfiltered, string path, double[] actualRangesEUFiltered, double[] actualRangesEUUnfiltered, double[] actualRAngesADC, bool flatFolders) // Constructor
|
||||
```
|
||||
|
||||
#### `DTS.Serialization.DDAS.DDASChannel`
|
||||
Handles serialization of individual channel data to binary DDAS format.
|
||||
|
||||
```csharp
|
||||
public string GetValue(DDASTest.Fields field) // Returns "#NOVALUE" if not set
|
||||
public void SetValue(DDASTest.Fields field, string value) // Sets value; handles DataType side effects
|
||||
public string FileName { get; set; } // Output file path
|
||||
public int ChannelNumber { get; } // Returns 1 + _channelIndex
|
||||
public void Serialize(TickEventHandler tickHandler) // Writes binary DDAS file
|
||||
|
||||
public DDASChannel(DDASTest parentTest, int channelIndex, string path) // Constructor
|
||||
```
|
||||
|
||||
#### `DTS.Serialization.TSV.TSVSettingsWindow`
|
||||
Windows Forms dialog for configuring TSV export settings.
|
||||
|
||||
```csharp
|
||||
public TSVSettingsWindow(TSVTest test) // Constructor, populates grids from test data
|
||||
```
|
||||
|
||||
### C++ Structures
|
||||
|
||||
#### `CHANNEL` (ChannelDefinition.h)
|
||||
```c
|
||||
typedef struct tagCHANNEL {
|
||||
short Size; // Size of this object
|
||||
short Flags; // Channel Flags
|
||||
char Name[64]; // Channel Name
|
||||
char Sign[8]; // Sign +, -, or blank
|
||||
char Axis[8]; // X,Y,Z,FX,MX,AX,...
|
||||
float FilterFreq; // Channel Filter Class (in Hz)
|
||||
float SetGain; // Gain setting (1 - n)
|
||||
float ActGain; // Actual (measured?) gain setting
|
||||
float Rcal; // Shunt cal resistance
|
||||
float Excitation; // Excitation Voltage (when programable)
|
||||
byte byteSpares[4]; // Spare bytes (was Cal Date)
|
||||
TRANSDUCER Transducer; // "Snapshot" of transducer values
|
||||
} CHANNEL;
|
||||
|
||||
typedef CHANNEL *PCHANNEL;
|
||||
typedef CHANNEL *PCHAN;
|
||||
```
|
||||
|
||||
#### `FILEINFOBLOCK` (DDASTestDefinition.h)
|
||||
```c
|
||||
typedef struct tagFILEINFOBLOCK {
|
||||
UINT Size; // Block Size (including nSize)
|
||||
char FileTypeName[12]; // Software Type Name
|
||||
char FileTypeVers[12]; // File Version Name
|
||||
UINT FileTypeFlags; // Hardware Type in upper 16 bits, File Type in lower 16 bits
|
||||
char CreatedByName[16]; // Created by T-number
|
||||
char UpdatedByName[16]; // Updated by T-number
|
||||
} FILEINFOBLOCK;
|
||||
```
|
||||
|
||||
#### `TESTINFO` (DataFloat.h)
|
||||
```c
|
||||
typedef struct tagTESTINFO {
|
||||
unsigned long Size; // Block Size (including Size)
|
||||
unsigned long DeviceID; // DAQ device ID
|
||||
long ChannelNo; // Channel number (1-32)
|
||||
long SampleRate; // Samples per second
|
||||
long TotalSamples; // Total samples in data record
|
||||
long PreEventSamples; // Samples before event
|
||||
short ChanNumInSys; // Channel Number (1-128) in system
|
||||
short NumPreCalPts; // Number of preCal points
|
||||
short NumPostCalPts; // Number of postCal points
|
||||
char TestCreation[128]; // Test path and date
|
||||
char TimeAxisTitle[32]; // Time axis title
|
||||
byte SpareBytes[2]; // 2 bytes of spare (for 4 byte alignment)
|
||||
} TESTINFO;
|
||||
```
|
||||
|
||||
#### `ACQUISITIONBLOCK` (DDASTestDefinition.h)
|
||||
```c
|
||||
typedef struct tagACQUISITIONBLOCK {
|
||||
long nSize; // Block Size (including nSize)
|
||||
long nRecordMode; // Enumerated constant data mode
|
||||
long SampleRate; // Samples per second
|
||||
long TotalSamples; // Total samples in record
|
||||
long PreEventSamples; // Pre-Event samples (Rec Mode only!)
|
||||
long TapeModeChannels; // No of Channels (Tape Mode only!)
|
||||
long nTrigBlock; // Number of trigger entries (can be 0)
|
||||
} ACQUISITIONBLOCK;
|
||||
```
|
||||
|
||||
#### `TRIGCHANDEF` and `TRIGCHANBLOCK` (DDASTestDefinition.h)
|
||||
```c
|
||||
typedef struct tagTRIGCHANDEF {
|
||||
BYTE ChanNo; // Channel number to use as trigger
|
||||
BYTE LevelPct; // Trig level in % full scale (0=off)
|
||||
} TRIGCHANDEF;
|
||||
|
||||
#define MAXTRIGCHANS 4
|
||||
#define TRIGCHANDSBL 0x80
|
||||
|
||||
typedef struct tagTRIGCHANBLOCK {
|
||||
unsigned short SizeBlock;
|
||||
unsigned short NumTrigs;
|
||||
TRIGCHANDEF TrigChan[MAXTRIGCHANS];
|
||||
} TRIGCHANBLOCK;
|
||||
```
|
||||
|
||||
### C++ Class: `CDataFloat` (DataFloat.h)
|
||||
```c
|
||||
CDataFloat(unsigned int nSize);
|
||||
CDataFloat();
|
||||
virtual ~CDataFloat();
|
||||
|
||||
int GetChannelNumberInBox();
|
||||
bool VerifyAndCoerceAxis(bool bNegativeSign, const char* szAxis, BOOL bVerbose);
|
||||
void SetEngrgUnits(char *szNewEngrgUnits);
|
||||
void SetChannelName(char* szNewChannelName);
|
||||
int CalcSampIn3mSecInt();
|
||||
int ConvertTimeToIndex(float fTime);
|
||||
float ConvertIndexToTime(int nIndex);
|
||||
const CString GetFileName();
|
||||
int AppendArrayFloat(CArray<float, float&>* srcArray);
|
||||
CArray<float, float&>* GetDataArray();
|
||||
bool GetTimeAtValue(float fValue, float *pTvalue);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, float* pTStart, float* pTEnd, float* pTMin, float* pDMin, float* pTMax, float* pDMax);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, float* pTMin, float* pDMin, float* pTMax, float* pDMax);
|
||||
bool GetDataPeaks(int nPkType, int nVerbose, int *pXMin, float *pTMin, float *pDMin, int *pXMax, float *pTMax, float *pDMax);
|
||||
int GetChannelNumber();
|
||||
float GetStartTime(bool bmSec);
|
||||
float GetStartTimeData(bool bmSec);
|
||||
float GetStopTime(bool bmSec);
|
||||
float GetStopTimeData(bool bmSec);
|
||||
const char* GetFileExt();
|
||||
const char* GetFileTitle();
|
||||
long GetSampleRate();
|
||||
const char* GetFilePathAndName();
|
||||
int SetFilePathAndName(char* szNewFileSpec);
|
||||
int ClearAll(long NewNumberElements);
|
||||
TESTINFO* GetTestInfo();
|
||||
FILEINFOBLOCK* GetFileInfo();
|
||||
CHANNEL* GetChannel();
|
||||
float GetFilterClass();
|
||||
int GetEventOffset();
|
||||
CString GetDataSetName(CString &csName);
|
||||
FILEHEADER* GetFileHeader();
|
||||
bool WriteToFile(const char *lpFilename, bool bPrint);
|
||||
bool ReadFromFile(const char *lpFilename);
|
||||
float* GetDataBuffer();
|
||||
bool SetSize(long lNumberElements);
|
||||
long GetSize();
|
||||
bool GetDataNext(float* fData);
|
||||
bool StoreDataNext(float fData);
|
||||
bool SetIndexToStart();
|
||||
void operator=(const CDataFloat &src);
|
||||
```
|
||||
|
||||
### Macros and Constants
|
||||
|
||||
```c
|
||||
// Channel state macros (ChannelDefinition.h)
|
||||
#define ISCHANACTIVE(pChan) (pChan->Flags&(1<<CHANFLAG_ACTIVE)?1:0)
|
||||
#define SETCHANACTIVE(pChan) (pChan->Flags|=(1<<CHANFLAG_ACTIVE))
|
||||
#define CLRCHANACTIVE(pChan) (pChan->Flags&=(~(1<<CHANFLAG_ACTIVE)))
|
||||
|
||||
// File type constants (DDASTestDefinition.h)
|
||||
#define TESTDEFEXT ".tdf"
|
||||
#define DDASTYPENAME "DDAS V5"
|
||||
#define DDASFILEVERS "Ver 500"
|
||||
|
||||
// Data file constants (DataFloat.h)
|
||||
#define FLOATDATANAME "DDAS FlPt"
|
||||
#define FLOATDATARAW "DDAS fpRAW"
|
||||
#define FLOATDATAVER "Ver 500"
|
||||
#define RawExt ".raw"
|
||||
#define FlPtExt ".fpd"
|
||||
|
||||
// Trigger constants (DDASTestDefinition.h)
|
||||
#define MAXTRIGCHANS 4
|
||||
#define TRIGCHANDSBL 0x80
|
||||
```
|
||||
|
||||
### Enumerations
|
||||
|
||||
```c
|
||||
// ChannelDefinition.h
|
||||
enum ChannelFlags { CHANFLAG_ACTIVE };
|
||||
|
||||
// DDASTestDefinition.h
|
||||
enum FileTypeFlags { FILETYPE_IMPORTED4X };
|
||||
enum HardwareType { HWTYPE_UNKNOWN, HWTYPE_DDAS3, HWTYPE_KAYSERTHREDE, HWTYPE_COUNT };
|
||||
enum AnalogOptionFlags { ANAOPT_CHANTRIGGERS };
|
||||
enum MemoryOptionFlags { MEMOPT_TAPEMODE, MEMOPT_PREEVENT, MEMOPT_PREEVENTXXX };
|
||||
enum RecordModes { RECORDMODE_EVENT, RECORDMODE_TAPE };
|
||||
|
||||
// DataFloat.h
|
||||
enum FileTypes { UNKNOWN, FLOATPOINT, PROCESSED };
|
||||
enum PeakTypes { PEAKS_MINMAX, PEAKS_3MSCONTIN, PEAKS_3MSCUMUL };
|
||||
enum FPDVerbosity { FPD_SILENT, FPD_ERRORS, FPD_STATUS, FPD_RESULTS, FPD_VERBOSE };
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Channel numbering**: Channels are 1-indexed in DDAS format. `ChannelNumber` returns `1 + _channelIndex`.
|
||||
|
||||
2. **Block size fields**: All binary structures include a `Size` field as the first member that must equal the total byte size of the structure (including the size field itself).
|
||||
|
||||
3. **Fixed-size string fields**: All character arrays in structures are fixed-width and must be null-padded to their full length when written (e.g., `FileTypeName[12]`, `Name[64]`).
|
||||
|
||||
4. **File type/version strings**: DDAS files use `"DDAS FlPt"` as the file type name and `"Ver 500"` as the version string.
|
||||
|
||||
5. **Trigger enable condition**: To enable a trigger, `ChanNo` and `LevelPct` must be nonzero, and `TRIGCHANDSBL` (0x80) must not be set in `LevelPct`.
|
||||
|
||||
6. **Hardware type encoding**: `FileTypeFlags` stores Hardware Type in upper 16 bits and File Type in lower 16 bits.
|
||||
|
||||
7. **Calibration date epoch**: Transducer calibration dates are stored as seconds since January 1, 1971 (not the Unix epoch of 1970).
|
||||
|
||||
8. **Data samples per tick**: Progress reporting uses 1000 samples per tick for granularity.
|
||||
|
||||
9. **Maximum trigger channels**: The system supports a maximum of 4 analog trigger channels (`MAXTRIGCHANS`).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `TransducerDefinition.h` (C++ header for `TRANSDUCER` structure - referenced but not provided)
|
||||
- `FilePath.h` (C++ header for `CFilePath` class - referenced but not provided)
|
||||
- `<Afxtempl.h>` (MFC template collections for `CArray`, `CList`)
|
||||
- `System.Windows.Forms` (for `TSVSettingsWindow`)
|
||||
- `C1.Win.C1FlexGrid` (third-party grid control)
|
||||
- `DTS.Serialization` namespace (base `Serialization.File`, `Test`, `FilteredData`, `IWriter<T>` types - not provided)
|
||||
|
||||
### What depends on this module:
|
||||
- Unclear from source alone; the module appears to be a serialization plugin that would be loaded by a parent serialization framework.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **NotImplementedException in Write overload**: The `Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)` method throws `NotImplementedException`. Callers must use the full overload with all parameters.
|
||||
|
||||
2. **Historical CalDate field removal**: The `CHANNEL` structure's `CalDate` field was removed and replaced with `byteSpares[4]` per revision dated 11/08/04. The calibration date is now stored in the `TRANSDUCER` substructure instead.
|
||||
|
||||
3. **Non-standard epoch for calibration dates**: The `DDASChannel.Serialize` method uses `new DateTime(1971, 1, 1, 0, 0, 0)` as the epoch, not the standard Unix epoch (1970). This differs from the C++ header comment which mentions "seconds since 1970."
|
||||
|
||||
4. **SLICE-specific channel numbering logic**: In `DDASChannel` constructor, there is a comment indicating SLICE-specific logic for determining `numberOfChannelsPerModule` using the formula `(channel.ParentModule.NumberOfChannels + 2) / 3 * 3`, which assumes 3 channels per bridge module.
|
||||
|
||||
5. **Typo in constructor parameter**: `DDASTest` constructor has a parameter named `actualRAngesADC` (typo: "RAnges" instead of "Ranges").
|
||||
|
||||
6. **Unused Write method in TSVSettingsWindow**: The `c1GridGlobal_CellChanged` and `gridChannels_CellChanged` methods are empty event handlers.
|
||||
|
||||
7. **Hardcoded manufacturer**: In `DDASChannel.Serialize`, the manufacturer is hardcoded as `"CHRYSLER"` and sensor type as `"UNKNOWN"`.
|
||||
|
||||
8. **Commented-out code in DDASChannel.Serialize**: There is commented-out code for CFC frequency calculation that was apparently replaced with direct use of `channel.ParentModule.AaFilterRateHz`.
|
||||
|
||||
9. **File extension inconsistency**: The `File` class defines `Extension` as `".ddas"`, but `DDASChannel` generates `.fpd` files (floating point data) in its default path construction.
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/FromChrysler/ChannelDefinition.h
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/FromChrysler/FilePath.h
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/FromChrysler/DDASTestDefinition.h
|
||||
- Common/DTS.Common.Serialization/DDAS (Chrysler)/FromChrysler/DataFloat.h
|
||||
generated_at: "2026-04-17T15:36:51.829395+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "39b9f7039a4c0cc0"
|
||||
---
|
||||
|
||||
# DDAS (Chrysler) Serialization Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides data structures and utilities for the DaimlerChrysler DDAS (Dynamic Data Acquisition System) file format. It defines the binary layout for test definitions, channel configurations, transducer data, and floating-point data files used in crash test data acquisition. The module handles serialization of test configurations, channel definitions, and acquired data, serving as the bridge between proprietary DDAS hardware and software analysis tools.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### ChannelDefinition.h
|
||||
|
||||
**Structures:**
|
||||
|
||||
- `CHANNEL` / `PCHANNEL` / `PCHAN` — A 64-bit aligned structure representing a data acquisition channel.
|
||||
- `short Size` — Size of the object
|
||||
- `short Flags` — Channel flags (bitfield)
|
||||
- `char Name[64]` — Channel name
|
||||
- `char Sign[8]` — Sign indicator (+, -, or blank)
|
||||
- `char Axis[8]` — Axis identifier (X, Y, Z, FX, MX, AX, etc.)
|
||||
- `float FilterFreq` — Filter frequency in Hz
|
||||
- `float SetGain` — Configured gain setting
|
||||
- `float ActGain` — Actual/measured gain
|
||||
- `float Rcal` — Shunt calibration resistance
|
||||
- `float Excitation` — Excitation voltage
|
||||
- `byte byteSpares[4]` — Spare bytes (formerly `CalDate`)
|
||||
- `TRANSDUCER Transducer` — Embedded transducer snapshot
|
||||
|
||||
**Enumerations:**
|
||||
|
||||
- `ChannelFlags` — Contains `CHANFLAG_ACTIVE`
|
||||
|
||||
**Macros:**
|
||||
|
||||
- `ISCHANACTIVE(pChan)` — Returns 1 if channel active flag is set
|
||||
- `SETCHANACTIVE(pChan)` — Sets channel active flag
|
||||
- `CLRCHANACTIVE(pChan)` — Clears channel active flag
|
||||
|
||||
---
|
||||
|
||||
### FilePath.h
|
||||
|
||||
**Class: `CFilePath`**
|
||||
|
||||
File path manipulation utility with the following public methods:
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `CFilePath` | `()` | Constructor |
|
||||
| `~CFilePath` | `() virtual` | Virtual destructor |
|
||||
| `operator=` | `(const CFilePath &src)` | Assignment operator |
|
||||
| `Clear` | `void ()` | Clears all path components |
|
||||
| `SetDrive` | `int (int nDriveAis1)` | Sets drive by number (A=1) |
|
||||
| `SetDriveOrResource` | `int (char *szNewDrive, int* nNext)` | Sets drive or network resource |
|
||||
| `SetDir` | `int (char *szNewDir, int* nNext)` | Sets directory component |
|
||||
| `SetFile` | `int (char *szNewFile, int *nNext)` | Sets filename component |
|
||||
| `SetExtension` | `int (char *szNewExt)` | Sets file extension |
|
||||
| `SetFullFilePathAndName` | `int (char* szPathAndName)` | Parses and sets complete path |
|
||||
| `ParseFilePathAndName` | `int (char *szPathAndName)` | Parses path into components |
|
||||
| `GetFullFilePathAndName` | `const char* ()` | Returns complete path string |
|
||||
| `GetFileName` | `const char* ()` | Returns filename without extension |
|
||||
| `GetFileNameExt` | `const CString ()` | Returns filename with extension |
|
||||
| `GetFileExtension` | `const char* ()` | Returns file extension |
|
||||
| `FileExists` | `BOOL ()` | Checks if file exists on disk |
|
||||
| `IsFileType` | `bool (char *szFileTypeExt)` | Validates file extension matches |
|
||||
| `IsPathComplete` | `bool (int *pFlgValid)` | Checks if path is fully specified |
|
||||
| `IsFileValid` | `bool (const char* szFileSpec, const char *szFileTypeExt, CString* pcsError)` | Validates file specification |
|
||||
| `IsAllValidChars` | `bool (char* szInString, int* pnPosBad)` | Validates characters in string |
|
||||
|
||||
**Enumerations:**
|
||||
|
||||
- `FileSpecOK` — Bitmask flags for path validation:
|
||||
- `FSPEC_EXTOK = 0x1` — Extension valid
|
||||
- `FSPEC_NAMEOK = 0x2` — Filename valid
|
||||
- `FSPEC_PATHOK = 0x4` — Path valid
|
||||
- `FSPEC_ROOTOK = 0x8` — Drive/computer valid
|
||||
- `FSPEC_REL
|
||||
106
docs/ai/Common/DTS.Common.Serialization/FIAT_ASC.md
Normal file
106
docs/ai/Common/DTS.Common.Serialization/FIAT_ASC.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/FIAT_ASC/FIAT_Asc.File.cs
|
||||
- Common/DTS.Common.Serialization/FIAT_ASC/FIAT_Asc.File.Writer.cs
|
||||
generated_at: "2026-04-17T15:42:04.516508+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "89485aa6a1ed05a2"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Serialization.FIAT_ASC
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides serialization support for exporting `DTS.Serialization.Test` objects to FIAT `.asc` file format. It creates one `.asc` file per channel, writing time-series data with headers containing start time, sample interval, and data collection length. The module handles data scaling (ADC to Engineering Units), optional subsampling, filtering, and provides progress reporting events for long-running export operations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DTS.Serialization.FIAT_ASC.File` (partial class)
|
||||
|
||||
**Inheritance:** `Serialization.File`, implements `IWritable<Test>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Extension` | `public static string Extension => ".asc"` | Static property returning the file extension for this format. |
|
||||
| `UseFlatExportFolders` | `public bool UseFlatExportFolders { get; set; }` | Controls whether exports use flat folder structure. Defaults to `false`. |
|
||||
| `File()` | `public File()` | Constructor initializing the file type with identifier "ASC". |
|
||||
| `Exporter` | `public IWriter<Test> Exporter { get; }` | Lazily initializes and returns a `Writer` instance for exporting tests. Creates the writer with `DefaultEncoding` and propagates `UseFlatExportFolders`. |
|
||||
|
||||
---
|
||||
|
||||
### `DTS.Serialization.FIAT_ASC.File.Writer` (nested partial class)
|
||||
|
||||
**Inheritance:** `Writer<File>`, implements `IWriter<Test>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `OnBegin` | `public event BeginEventHandler OnBegin` | Event raised when writing starts. |
|
||||
| `OnEnd` | `public event EndEventHandler OnEnd` | Event raised when writing completes. |
|
||||
| `OnTick` | `public event TickEventHandler OnTick` | Event raised for progress updates (every 1000 data samples). |
|
||||
| `OnCancel` | `public event CancelEventHandler OnCancel` | Event raised if the write is cancelled. |
|
||||
| `OnError` | `public event ErrorEventHandler OnError` | Event raised if a fatal error occurs during writing. |
|
||||
| `FilteredChannelData` | `public Dictionary<string, FilteredData> FilteredChannelData { get; set; }` | Dictionary mapping channel IDs to filtered data. Used when `Filtered` is `true`. |
|
||||
| `UseFlatExportFolder` | `public bool UseFlatExportFolder { get; set; }` | Controls flat folder export behavior. Defaults to `false`. |
|
||||
| `Start` | `public double Start { get; set; }` | Start time for export range. Defaults to `0D`. |
|
||||
| `Stop` | `public double Stop { get; set; }` | Stop time for export range. Defaults to `0D`. |
|
||||
| `SubSampleInterval` | `public ushort SubSampleInterval { get; set; }` | Interval for subsampling data. Defaults to `1` (no subsampling). |
|
||||
| `Filtered` | `public bool Filtered { get; set; }` | Whether to use filtered channel data. Defaults to `true`. |
|
||||
| `Write` (overload 1) | `public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)` | Simplified write method delegating to the full overload with null parameters. |
|
||||
| `Write` (overload 2) | `public void Write(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)` | Full write method that exports all channels to individual `.asc` files. Creates one file per channel named after the channel. |
|
||||
| `Initialize` | `public void Initialize(...)` | Empty implementation (no-op). |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **One file per channel:** The `Write` method creates a separate `.asc` file for each channel in `test.Channels`, named using the channel name (sanitized for filesystem compatibility).
|
||||
|
||||
2. **Progress tick granularity:** Progress events are dispatched every `DataSamplesPerTick` (1000) samples written.
|
||||
|
||||
3. **File format structure:** Each `.asc` file contains:
|
||||
- Line 1: `{minStartTime} {1/sampleRate}` (both formatted as `F8`)
|
||||
- Line 2: `{dataCollectionLength}` (integer)
|
||||
- Subsequent lines: Data values, one per sample
|
||||
|
||||
4. **Channel name resolution:** For `AnalogInputChannel`, the channel name is taken from `Description` property; otherwise `ChannelName2` is used.
|
||||
|
||||
5. **Encoding fallback:** If `GetEncoding(DefaultEncoding)` fails, the writer falls back to `Encoding.Default`.
|
||||
|
||||
6. **Subsampling only applies when `SubSampleInterval > 1`:** When this condition is met, data is subsampled using `NHTSASubSample<T>`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.DAS.Concepts` - For channel types and DAS concepts
|
||||
- `DTS.Common.Enums.Sensors` - For `SensorConstants.BridgeType`, `ZeroMethodType`, `IsoViewMode`
|
||||
- `DTS.Common.Utilities` - For `DiskUtility`, `DataScaler`
|
||||
- `DTS.Common.Utilities.DotNetProgrammingConstructs` - For `Property<T>` wrapper
|
||||
- `DTS.Common.Utilities.Logging` - For `APILogger`
|
||||
- `DTS.Serialization.Test` - The `Test` object model being serialized
|
||||
- `System.Windows.Forms` - For `Application.DoEvents()` during progress reporting
|
||||
|
||||
### What depends on this module:
|
||||
- Not determinable from source alone; consumers would reference `DTS.Serialization.FIAT_ASC` namespace and use `File.Exporter.Write(...)`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **`Initialize` is a no-op:** The `Initialize` method has an empty body despite accepting many parameters. It is unclear if this is intentional or incomplete.
|
||||
|
||||
2. **UI thread coupling:** The `WriteChannelInfo` method calls `System.Windows.Forms.Application.DoEvents()` during the write loop, creating a dependency on Windows Forms and potentially causing reentrancy issues.
|
||||
|
||||
3. **Unused parameters in `Write` overload 2:** Several parameters (`dataFolder`, `fd`, `tmChannel`, `channelNumber`) are passed to the full `Write` method but never used in the implementation.
|
||||
|
||||
4. **Channel name fallback logic:** The `OriginalChannelName` fallback for `AnalogInputChannel` depends on `ISOViewMode`, but the source of `WriterParent.ISOViewMode` is not defined in these files (likely defined in another partial file).
|
||||
|
||||
5. **Exception swallowed in `SetWindowAverageADC`:** The `WriteChannelInfo` method catches and silently ignores any exception from `scaler.SetWindowAverageADC(channel.WindowAverageADC)`.
|
||||
|
||||
6. **Hardcoded number format:** All numeric output uses `"F8"` format (8 decimal places), defined as a private constant `NUMBER_FORMAT`.
|
||||
|
||||
7. **Disk space check may silently fail:** If `GetDiskFreeSpaceEx` returns a non-zero error code, the method logs the error but proceeds with the write without validating available space.
|
||||
154
docs/ai/Common/DTS.Common.Serialization/FtssCsv.md
Normal file
154
docs/ai/Common/DTS.Common.Serialization/FtssCsv.md
Normal file
@@ -0,0 +1,154 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/FtssCsv/FtssCsv.File.cs
|
||||
- Common/DTS.Common.Serialization/FtssCsv/FtssTsv.File.cs
|
||||
- Common/DTS.Common.Serialization/FtssCsv/FtssTsv.File.Writer.cs
|
||||
generated_at: "2026-04-17T15:38:52.319168+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "75b02305d1c7a319"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Serialization.FtssCsv / FtssTsv
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides file serialization support for FTSS (presumably "Flight Test Data System" or similar) CSV and TSV (Tab-Separated Values) export formats. It enables writing `Test` objects to delimited text files with extensive metadata headers and channel data. The module implements a writer pattern with progress reporting events and supports features like data filtering, subsampling, and disk space verification before export.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### FtssCsv.File Class
|
||||
**Namespace:** `DTS.Serialization.FtssCsv`
|
||||
**Inheritance:** `Serialization.File`, `IWritable<Test>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `File()` | `public File()` | Constructor initializing the file with "CSV" format type. |
|
||||
| `Extension` | `public static string Extension` | Static property returning `".csv"`. |
|
||||
| `Exporter` | `public IWriter<Test> Exporter` | Lazily instantiates and returns a `Writer<Test>` for exporting test data. Uses `DefaultEncoding`. |
|
||||
|
||||
### FtssTsv.File Class
|
||||
**Namespace:** `DTS.Serialization.FtssTsv`
|
||||
**Inheritance:** `Serialization.File`, `IWritable<Test>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `File()` | `public File()` | Constructor initializing the file with "TSV" format type. |
|
||||
| `Extension` | `public static string Extension` | Static property returning `".tsv"`. |
|
||||
| `Exporter` | `public IWriter<Test> Exporter` | Lazily instantiates and returns a `Writer<Test>` for exporting test data. Uses `DefaultEncoding`. |
|
||||
|
||||
### FtssTsv.File.Writer Class
|
||||
**Namespace:** `DTS.Serialization.FtssTsv`
|
||||
**Inheritance:** `Writer<File>`, `IWriter<Test>`
|
||||
|
||||
#### Constructor
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `internal Writer(File fileType, int encoding)` | Internal constructor; requires associated `File` instance and encoding integer. |
|
||||
|
||||
#### Enum: ExportMode
|
||||
```csharp
|
||||
public enum ExportMode
|
||||
{
|
||||
FtssExcel,
|
||||
Ttc,
|
||||
Standard,
|
||||
}
|
||||
```
|
||||
|
||||
#### Events
|
||||
| Event | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `OnBegin` | `BeginEventHandler` | Notifies subscribers that write is starting. |
|
||||
| `OnEnd` | `EndEventHandler` | Notifies subscribers that write is finished. |
|
||||
| `OnTick` | `TickEventHandler` | Notifies subscribers of progress (one tick per 1000 data samples). |
|
||||
| `OnCancel` | `CancelEventHandler` | Notifies subscribers that write was cancelled. |
|
||||
| `OnError` | `ErrorEventHandler` | Notifies subscribers of fatal errors. |
|
||||
|
||||
#### Properties
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `CurrentExportMode` | `ExportMode` | Gets/sets the current export format. Defaults to `ExportMode.FtssExcel`. |
|
||||
| `FilteredChannelData` | `List<FilteredData>` | Filtered channel data to use instead of raw data. |
|
||||
| `DataChannelFilename` | `string` | Filename identifying the data channel to export. |
|
||||
| `LaboratoryName` | `string` | Laboratory metadata for header. |
|
||||
| `LaboratoryContactName` | `string` | Contact name for header. |
|
||||
| `LaboratoryContactPhone` | `string` | Contact phone for header. |
|
||||
| `LaboratoryContactEmail` | `string` | Contact email for header. |
|
||||
| `TestEngineerName` | `string` | Engineer name for header. |
|
||||
| `TestEngineerPhone` | `string` | Engineer phone for header. |
|
||||
| `TestEngineerEmail` | `string` | Engineer email for header. |
|
||||
| `NumChannelsWritten` | `int` | Counter for channels written. |
|
||||
| `UseISOCodeFilterMapping` | `bool` | Whether to adjust ISO codes based on filter class. |
|
||||
| `UseZeroForUnfiltered` | `bool` | Whether to use zero for unfiltered data in ISO code mapping. |
|
||||
| `Start` | `double` | Export start time (default: 0D). |
|
||||
| `Stop` | `double` | Export stop time (default: 0D). |
|
||||
| `SubSampleInterval` | `ushort` | Subsampling interval for data export. |
|
||||
| `Filtered` | `bool` | Whether filtered data is being exported. |
|
||||
|
||||
#### Methods
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Write` | `public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)` | Simplified write method delegating to the full overload. |
|
||||
| `Write` | `public void Write(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)` | Full write method with all parameters. Creates directory if needed, deletes existing file, writes header and data. Only `ExportMode.FtssExcel` is currently supported. |
|
||||
| `Initialize` | `public void Initialize(...)` | Empty implementation (no-op). |
|
||||
| `WriteChannelInfo` | `protected void WriteChannelInfo(StreamWriter fileWriter, string id, Test test, List<FilteredData> filteredData, string targetPath, TickEventHandler tickEventHandler, uint totalWriteTicksNeeded, ref uint totalWriteTicksDispatched, CancelRequested cancelRequested, int channelNumber, double minStartTime, int dataCollectionLength)` | Writes header lines and channel data to the stream. Handles subsampling, scaling, and filtering. |
|
||||
|
||||
#### Enum: FtssHeaderLine (Private)
|
||||
Defines 31 header line types including: `Headers`, `TestDate`, `TestTime`, `TestId`, `TestDescription`, `LaboratoryName`, `SampleRate`, `HardwareAntiAliasFilter`, `DataChannelName`, `IsoCode`, `ChannelDescription`, `ChannelLocation`, `SensorSerialNumber`, `SoftwareFilter`, `SoftwareFilterDb`, `EngineeringUnits`, `UserComment`, `PreZero`, `PostZero`, `DataZero`, `ScaleEu`, `ScaleMv`, `DataStart`, `Labels`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Exporter Lazy Initialization**: The `_Exporter` field is lazily initialized; once created, it is reused for subsequent accesses.
|
||||
2. **Only FtssExcel ExportMode Supported**: The `Write` method throws `NotSupportedException` for any `CurrentExportMode` other than `ExportMode.FtssExcel`.
|
||||
3. **Tab Separator**: The TSV format uses `"\t"` (TAB) as the list separator constant.
|
||||
4. **Number Format**: All numeric data values are formatted using `"F8"` (8 decimal places).
|
||||
5. **Progress Granularity**: Progress ticks are dispatched every 1000 data samples (`DataSamplesPerTick`).
|
||||
6. **Single Channel Export**: The `WriteChannelInfo` method exports only the channel whose filename matches `DataChannelFilename`; it breaks after finding the first match.
|
||||
7. **Directory Creation**: If the target directory does not exist, it will be created automatically during `Write`.
|
||||
8. **File Overwrite**: If the target file exists, it will be deleted (or moved if deletion fails) before writing.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `System` (Collections.Generic, ComponentModel, Linq, IO, Text)
|
||||
- `DTS.Common.DAS.Concepts` (including `DTS.Common.DAS.Concepts.DAS.Channel`)
|
||||
- `DTS.Common.Utilities`
|
||||
- `DTS.Common.Utilities.DotNetProgrammingConstructs`
|
||||
- `DTS.Common.Utilities.Logging`
|
||||
- `DTS.Common`
|
||||
- `DTS.Common.Enums.Sensors`
|
||||
- `DTS.Common.Utils`
|
||||
- `System.Windows.Forms.Application` (for `DoEvents()` during progress reporting)
|
||||
- Base class `Serialization.File` (inferred from inheritance)
|
||||
- Interface `IWritable<Test>` (inferred from implementation)
|
||||
- Types: `Test`, `Test.Module.Channel`, `Test.Module.AnalogInputChannel`, `FilteredData`, `DataScaler`, `NHTSASubSample<T>`, `Property<T>`, `DescriptionAttributeCoder<T>`, `DiskUtility`, `FileUtils`, `APILogger`, `UserException`, `Exception` (custom DTS type)
|
||||
|
||||
### What Depends On This Module:
|
||||
- Not determinable from the provided source alone.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **UI Thread Coupling**: The `WriteChannelInfo` method calls `System.Windows.Forms.Application.DoEvents()` during the write loop, creating a dependency on Windows Forms and implying the write may be intended to run on a UI thread.
|
||||
|
||||
2. **Empty Initialize Method**: The `Initialize` method has an empty body despite accepting numerous parameters. It is unclear if this is intentional or incomplete.
|
||||
|
||||
3. **Unused ExportMode Values**: `ExportMode.Ttc` and `ExportMode.Standard` are defined but throw `NotSupportedException` if used.
|
||||
|
||||
4. **Exception Wrapping**: All exceptions are caught and re-thrown wrapped in a custom `Exception` type with descriptive messages, potentially obscuring original stack traces.
|
||||
|
||||
5. **Hardcoded Channel Selection**: The `WriteChannelInfo` method filters channels by comparing `Path.GetFileName(((Test.Module.AnalogInputChannel)ch).FileName)` to `DataChannelFilename`. If no channel matches, the export proceeds with empty channel data.
|
||||
|
||||
6. **Subsampling Side Effect**: When `SubSampleInterval > 1`, the method modifies `FilteredChannelData[iChannel].Data` and `ChannelList[iChannel].PersistentChannelInfo.Data` in-place, mutating the input test data.
|
||||
|
||||
7. **PreZero/PostZero Calculation Edge Cases**: The code clamps `preTriggerSamples` to be non-negative, not exceed `NumberOfSamples`, and not exceed `Start * sampleRate`, but the logic may produce unexpected results if `Start` is not properly set.
|
||||
|
||||
8. **Missing CSV Writer Implementation**: The `FtssCsv.File` class references a `Writer` class, but no `FtssCsv.File.Writer.cs` is provided. It is unclear whether this shares the TSV writer or has a separate implementation.
|
||||
172
docs/ai/Common/DTS.Common.Serialization/HDF.md
Normal file
172
docs/ai/Common/DTS.Common.Serialization/HDF.md
Normal file
@@ -0,0 +1,172 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/HDF/HDF.File.cs
|
||||
- Common/DTS.Common.Serialization/HDF/HDF.File.Writer.cs
|
||||
generated_at: "2026-04-17T15:42:12.245646+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ac9e3ba44d6e91d0"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Serialization.HDF.File
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides HDF5 (Hierarchical Data Format) file export functionality for test data. It implements the `Serialization.File` abstraction for HDF5 format, enabling the serialization of `Test` objects—including channel data (ADC, mV, EU), metadata, and auxiliary files (logs, reports, setup files)—into `.h5` files. The module serves as the export layer for DTS data acquisition systems, supporting both standard and WIAMan-compliant output formats.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `DTS.Serialization.HDF.File`
|
||||
**Inheritance:** `Serialization.File`, `IWritable<Test>`
|
||||
|
||||
#### Constructor
|
||||
```csharp
|
||||
public File()
|
||||
```
|
||||
Initializes a new HDF file instance, passing `"HDF"` to the base class.
|
||||
|
||||
#### Property: `Exporter`
|
||||
```csharp
|
||||
public IWriter<Test> Exporter { get; }
|
||||
```
|
||||
Lazy-initialized property that returns the `IWriter<Test>` implementation. Creates and caches a new `Writer` instance on first access. Throws `Exception` wrapping any underlying failure.
|
||||
|
||||
#### Set-Only Properties (delegate to internal `Writer`)
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `ExportADC` | `bool` | Controls whether ADC (raw) data is exported |
|
||||
| `ExportEU` | `bool` | Controls whether Engineering Units data is exported |
|
||||
| `ExportMV` | `bool` | Controls whether millivolt data is exported |
|
||||
| `ExportLogs` | `bool` | Controls whether log files are included |
|
||||
| `ExportReports` | `bool` | Controls whether report files are included |
|
||||
| `ExportSetup` | `bool` | Controls whether setup files are included |
|
||||
| `ExportDTSFile` | `bool` | Controls whether `.dts` files are included |
|
||||
| `CustomerName` | `string` | Customer metadata for export |
|
||||
| `TestEngineerName` | `string` | Test engineer metadata for export |
|
||||
| `LabName` | `string` | Lab name metadata for export |
|
||||
| `IsWiamanData` | `bool` | Flag for WIAMan-format data |
|
||||
| `ISOToFineLocation3` | `Dictionary<string, string>` | ISO code to fine location mapping |
|
||||
| `ISOToPhysicalDimension` | `Dictionary<string, string>` | ISO code to physical dimension mapping |
|
||||
| `ISOToPosition` | `Dictionary<string, string>` | ISO code to position mapping |
|
||||
| `ISOToTransducerMainLocation` | `Dictionary<string, string>` | ISO code to transducer location mapping |
|
||||
|
||||
---
|
||||
|
||||
### Nested Class: `DTS.Serialization.HDF.File.Writer`
|
||||
**Inheritance:** `Writer<File>`, `IWriter<Test>`
|
||||
|
||||
#### Constructor
|
||||
```csharp
|
||||
internal Writer(File fileType, int encoding)
|
||||
```
|
||||
Internal constructor. Initializes all export flags to `true` by default and stores reference to parent `File`.
|
||||
|
||||
#### Method: `Write` (primary overload)
|
||||
```csharp
|
||||
public void Write(string pathname,
|
||||
string id,
|
||||
string dataFolder,
|
||||
Test test,
|
||||
bool bFiltering,
|
||||
bool includeGroupNameInISOExport,
|
||||
FilteredData fd,
|
||||
Test.Module.Channel tmChannel,
|
||||
int channelNumber,
|
||||
BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler,
|
||||
EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler,
|
||||
ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested,
|
||||
double minStartTime,
|
||||
int dataCollectionLength)
|
||||
```
|
||||
Main export method. Creates an HDF5 file at `{pathname}/{id}_{LabName}_1of1{ExtensionPrefix}.h5`, writes channel data (ADC/MV/EU based on export flags), includes auxiliary files, and invokes progress/event handlers throughout.
|
||||
|
||||
#### Method: `Write` (secondary overload)
|
||||
```csharp
|
||||
public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)
|
||||
```
|
||||
Empty implementation—does nothing.
|
||||
|
||||
#### Method: `Initialize`
|
||||
```csharp
|
||||
public void Initialize(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested)
|
||||
```
|
||||
Empty implementation—does nothing.
|
||||
|
||||
#### Property: `ExtensionPrefix`
|
||||
```csharp
|
||||
public string ExtensionPrefix { get; set; } = string.Empty
|
||||
```
|
||||
Optional prefix appended before `.h5` extension in output filename.
|
||||
|
||||
#### Enum: `ErrorLocation`
|
||||
```csharp
|
||||
public enum ErrorLocation { File, Group, SubGroup, DataSpace, DataSet, Write }
|
||||
```
|
||||
Identifies where HDF API calls fail for error reporting.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Exporter Lazy Initialization**: The `_exporter` field is lazily initialized; once set, the same instance is returned on subsequent accesses.
|
||||
|
||||
2. **Default Export Flags**: All export flags (`ExportADC`, `ExportEU`, `ExportMV`, `ExportLogs`, `ExportReports`, `ExportSetup`) default to `true` in the `Writer` constructor.
|
||||
|
||||
3. **Attribute Storage Format**: All attributes are stored as HDF5 string attributes when `ATTRIBUTE_STRING_DATATYPE_ONLY` is `true` (which is constant `true`). Integer, ulong, and double values are converted to strings via `ToString()` before storage.
|
||||
|
||||
4. **Channel Ordering**: Channels are sorted by `AbsoluteDisplayOrder` before export.
|
||||
|
||||
5. **Thread Safety**: The `H5WriteLock` object is used to synchronize HDF5 API calls for string attribute creation. The `_updateProgressLock` object synchronizes progress updates.
|
||||
|
||||
6. **HDF Export Version**: All exports include attribute `HDFExportVersion` set to `7.0D`.
|
||||
|
||||
7. **Dataset Group Names**:
|
||||
- EU data: `/Datasets_EU`
|
||||
- ADC data: `/Datasets`
|
||||
- MV data: `/Datasets_MV`
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `System` (core .NET)
|
||||
- `System.Collections.Generic`
|
||||
- `System.IO`
|
||||
- `System.Linq`
|
||||
- `System.Runtime.InteropServices`
|
||||
- `System.Threading.Tasks`
|
||||
- `DTS.Common.Enums.Sensors` - `SensorConstants.BridgeType.IEPE`
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger.Log()` for error logging
|
||||
- `HDF.PInvoke` - Low-level HDF5 API (`H5F`, `H5G`, `H5S`, `H5D`, `H5A`, `H5T`, `H5P`)
|
||||
- `DTS.Common.DAS.Concepts` - `DataScaler`, `Test`, `Test.Module`, `Test.Module.AnalogInputChannel`, `Test.Module.Channel.Sensor`
|
||||
|
||||
### Base Class:
|
||||
- `DTS.Serialization.File` (inferred from inheritance)
|
||||
- `DTS.Serialization.Writer<File>` (inferred from `Writer` inheritance)
|
||||
- `DTS.Serialization.IWriter<Test>` (interface implementation)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Set-Only Properties Cast to Concrete Type**: Properties like `ExportADC`, `ExportEU`, etc. on the `File` class cast `Exporter` to `(Writer)` on every set. This will throw if `_exporter` is somehow a different implementation.
|
||||
|
||||
2. **Empty Method Implementations**: The `Write` overload with fewer parameters and `Initialize` method are empty stubs. Calling them has no effect.
|
||||
|
||||
3. **WIAMan Dictionary Access Without Null Check**: In `CreateDataset()`, the code accesses ISO mapping dictionaries (e.g., `ISOToFineLocation3[aic.IsoCode]`) without null checks. If these dictionaries are not set or lack the key, a `KeyNotFoundException` or `NullReferenceException` will occur.
|
||||
|
||||
4. **Hardcoded Directory Traversal**: `AddDirectoryIfExists()` navigates up three parent directories from the binary path to find the root directory. This assumes a specific directory structure depth.
|
||||
|
||||
5. **Progress Update Threading**: Progress updates use a lock but the `_curProg` field is read outside the lock in `UpdateProgress()` before the comparison.
|
||||
|
||||
6. **Unused Parameters**: Several parameters in `Write()` are unused: `bFiltering`, `includeGroupNameInISOExport`, `fd`, `tmChannel`, `channelNumber`, `cancelEventHandler`, `cancelRequested`, `minStartTime`, `dataCollectionLength`.
|
||||
|
||||
7. **File Overwrite**: The HDF5 file is created with `H5F.ACC_TRUNC` which truncates (overwrites) any existing file with the same name.
|
||||
|
||||
8. **Channel Type Filtering**: Only `Test.Module.AnalogInputChannel` types are processed; other channel types are silently skipped in the `Parallel.ForEach` loop.
|
||||
182
docs/ai/Common/DTS.Common.Serialization/IRIGCH10.md
Normal file
182
docs/ai/Common/DTS.Common.Serialization/IRIGCH10.md
Normal file
@@ -0,0 +1,182 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Chapter10.File.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/WriteTest.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/CH10AnalogStreamDecode.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Chapter10File.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Chapter10.File.Writer.cs
|
||||
generated_at: "2026-04-17T15:37:12.585375+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1f5b2482ec8c69d4"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Serialization.IRIGCH10
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides serialization support for the IRIG 106 Chapter 10 (CH10) data format, enabling both parsing of CH10 binary files and writing new CH10 files from test data. It handles packet-level parsing with CRC validation, real-time UDP multicast stream decoding for live data acquisition, and TMATS (Telemetry Attributes Transfer Standard) document generation. The module supports both PCM and Analog data formats for export operations.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `File` (partial class) - `Chapter10.File.cs`
|
||||
A partial class extending `Serialization.File` that provides CH10 file handling capabilities.
|
||||
|
||||
```csharp
|
||||
public File() // Constructor - initializes base with "Chapter10" type
|
||||
public IWriter<Test> Exporter { get; } // Lazy-initialized writer instance
|
||||
```
|
||||
|
||||
### `CH10AnalogStreamDecode` - `CH10AnalogStreamDecode.cs`
|
||||
Listens for UDP multicast streams containing CH10 packet data and dispatches parsed packets to registered handlers.
|
||||
|
||||
```csharp
|
||||
// Properties
|
||||
public string MulticastReceiveAddress { get; set; } // Default: MulticastCommandBase.DEFAULT_RECEIVE_ADDRESS
|
||||
public int ResponsePort { get; set; } // Default: (int)MulticastCommandBase.Ports.Response
|
||||
public IPAddress BindToAdapterIPAddress { get; set; } // Default: IPAddress.Any
|
||||
|
||||
// Methods
|
||||
public void StartListening() // Starts UDP listener on background thread
|
||||
public void StopListening() // Signals listener to stop
|
||||
|
||||
// Delegate types
|
||||
public delegate void TimePacketDelegate(TimePacketFormat2 packet);
|
||||
public delegate void AnalogDataPacketDelegate(AnalogDataFormat1Packet packet);
|
||||
public delegate void TMATSPacketDelegate(TMATSPacket packet);
|
||||
public delegate void BadCRCDelegate(IPacketHeader packet);
|
||||
|
||||
// Event handlers (assign to receive callbacks)
|
||||
public BadCRCDelegate OnBadCRC;
|
||||
public TimePacketDelegate OnTimePacket;
|
||||
public AnalogDataPacketDelegate OnAnalogPacket;
|
||||
public TMATSPacketDelegate OnTMATSPacket;
|
||||
```
|
||||
|
||||
### `Chapter10File` - `Chapter10File.cs`
|
||||
Parses CH10 binary data and provides access to extracted headers and packets. Also contains static methods for writing CH10 files.
|
||||
|
||||
```csharp
|
||||
// Constructor - parses all packets from byte array
|
||||
public Chapter10File(byte[] bytes)
|
||||
|
||||
// Accessors for parsed data
|
||||
public ITransportStreamHeader[] GetTransportHeaders()
|
||||
public IPacketHeader[] GetPacketHeaders()
|
||||
public ISecondaryTimeFormatHeader[] GetSecondaryTimeHeaders()
|
||||
public byte[] GetBytesForPacket(IPacketHeader packet)
|
||||
|
||||
// Properties
|
||||
public int GoodPackets { get; } // Count of successfully parsed packets
|
||||
public int RejectedPackets { get; } // Count of packets failing validation
|
||||
|
||||
// Static methods
|
||||
public static long ReadChapter10PacketHeader(byte[] bytes, long startIndex, out IPacketHeader packetHeader)
|
||||
public static long GetIndexOfNextPacket(byte[] bytes, long startIndex)
|
||||
|
||||
// Static write methods
|
||||
public static void WriteFilePCM(string tmats, GetNextSampleDelegate getNextSample,
|
||||
GetChannelLengthDelegate getChannelLength, int totalChannels, int nanoseconds, int seconds,
|
||||
double sampleRate, bool includeSecondaryHeader, string fileName,
|
||||
TickEventHandler tickEventHandler, object tickObject)
|
||||
|
||||
public static void WriteFileAnalog(string tmats, GetNextSampleDelegate getNextSample,
|
||||
GetChannelLengthDelegate getChannelLength, int totalChannels, int nanoseconds, int seconds,
|
||||
double sampleRate, bool includeSecondaryHeader, string fileName,
|
||||
TickEventHandler tickEventHandler, object tickObject)
|
||||
|
||||
// Delegates for write operations
|
||||
public delegate short GetNextSampleDelegate(int channelIdx);
|
||||
public delegate long GetChannelLengthDelegate(int channelIndex);
|
||||
```
|
||||
|
||||
### `File.Writer` (nested class) - `Chapter10.File.Writer.cs`
|
||||
Implements `IWriter<Test>` for exporting test data to CH10 format.
|
||||
|
||||
```csharp
|
||||
// Constructor (internal)
|
||||
internal Writer(File fileType, int encoding)
|
||||
|
||||
// Properties
|
||||
public bool IncludeSecondaryHeader { get; set; } // Default: true
|
||||
public bool UseAnalogFormat { get; set; } // Default: true
|
||||
public bool UsePCMFormat { get; set; } // Default: false
|
||||
public double Start { get; set; }
|
||||
public double Stop { get; set; }
|
||||
public bool Filtered { get; set; }
|
||||
|
||||
// Constants
|
||||
public const long BASE_RTC = 141989612500056L;
|
||||
|
||||
// Methods
|
||||
public void Write(string pathname, string id, string dataFolder, Test test,
|
||||
bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd,
|
||||
Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)
|
||||
|
||||
public void Initialize(string pathname, string id, string dataFolder, Test test,
|
||||
bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd,
|
||||
Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler,
|
||||
CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler,
|
||||
TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler,
|
||||
CancelRequested cancelRequested)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Sync Pattern Validation**: All valid CH10 packets must have `PacketHeader.EXPECTED_SYNC_PATTERN` at their sync pattern field.
|
||||
- **Checksum Validation**: `packetHeader.CheckSum` must equal `packetHeader.ComputeCheckSum()` for a packet to be considered valid.
|
||||
- **RTC Frequency**: Relative Time Counter operates at 10MHz (`RTC_PER_SECOND = 10000000`).
|
||||
- **Time Packet Boundary**: `TimePacketFormat1` packets must always start on a second boundary.
|
||||
- **Packet Ordering**: Transport headers, packet headers, and secondary time headers are stored in the order they are read.
|
||||
- **Thread Safety**: `CH10AnalogStreamDecode` uses locks (`MyLock`, `LEFT_OVER_BYTES_LOCK`) for thread-safe operations.
|
||||
- **Packet Target Size**: Write operations target 100ms of data per packet (sample rate divided by 10).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Utilities.Logging` - `APILogger` for logging
|
||||
- `DTS.Common.Utils` - `FileUtils`, `NetworkUtils`, `PTP1588Timestamps`
|
||||
- `DTS.Common` - `Constants.NANOS_PER_SECOND`
|
||||
- `DTS.DASLib.Command.SLICE.MulticastCommands` - `MulticastCommandBase` for default multicast settings
|
||||
- `DTS.Serialization.IRIGCH10.Packets` - Packet types (`TMATSPacket`, `AnalogDataFormat1Packet`, `TimePacketFormat1`, `TimePacketFormat2`, `PCMDataPacket`, etc.)
|
||||
- `DTS.Common.DAS.Concepts` - `Channel`, `AnalogInputChannel`
|
||||
- `DTS.Common.Enums` - `IsoViewMode`
|
||||
- `IRIGCh10` - External library for CH10 types
|
||||
- `SliceRaw.File.Reader` - `GetDataScaler` method for channel data scaling
|
||||
- File system templates at `TMTTemplates\` directory
|
||||
|
||||
### What depends on this module:
|
||||
- Cannot be determined from source alone; no downstream consumers are visible in these files.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **NotImplementedException**: The `Write(string pathname, string id, Test test, ...)` overload in `File.Writer` throws `NotImplementedException`. Use the full overload with all parameters instead.
|
||||
|
||||
2. **Arbitrary RTC Base**: `BASE_RTC` (141989612500056L) is documented as "made up" and arbitrary. The comment states: "we don't really have an RTC, so we make up one with an arbitrary value."
|
||||
|
||||
3. **File Template Dependency**: TMATS generation depends on external template files:
|
||||
- `TMTTemplates\S6ATMTTemplate_PCM_ExportBase.tmt`
|
||||
- `TMTTemplates\S6ATMTTemplate_PCM_ExportChannel.tmt`
|
||||
- `TMTTemplates\S6ATMTTemplate_ANALOG_ExportBase.tmt`
|
||||
- `TMTTemplates\S6ATMTTemplate_ANALOG_ExportChannel.tmt`
|
||||
|
||||
These must exist at runtime or TMATS generation will fail.
|
||||
|
||||
4. **Channel Naming Side Effect**: `GetChannelName()` depends on `IsoViewModeStatic.ViewMode`, a static/global state that affects channel naming behavior.
|
||||
|
||||
5. **BinaryReader Cleanup**: The `Write` method opens `BinaryReader` instances per channel. If an exception occurs before `CloseAndDisposeReaders` is called, readers may leak. The method does attempt cleanup in a finally block via `endEventHandler` invocation, but explicit reader disposal is not guaranteed on all error paths.
|
||||
|
||||
6. **Leftover Bytes Handling**: `CH10AnalogStreamDecode.QueueBytes()` has a bug - it copies data into `newBytes` but then assigns `bytes` (the input parameter) to `_leftOvertBytes` instead of `newBytes`. This may cause data loss in stream parsing.
|
||||
|
||||
7. **WriteTest.cs is Commented Out**: The entire `WriteTest` class is commented out, suggesting it may be obsolete or under development.
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Attributes/DescriptionDecoder.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Attributes/PacketHeaderValueAttribute.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Attributes/DataTypeVersionValueAttribute.cs
|
||||
generated_at: "2026-04-17T15:40:03.278067+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "62884204c246cc16"
|
||||
---
|
||||
|
||||
# Documentation: IRIG Chapter 10 Attribute Utilities
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides attribute-based metadata extraction utilities for IRIG 106 Chapter 10 data serialization. It enables annotating enum values with descriptive strings, max lengths, packet header values, and data type version numbers—metadata used when generating TMATS (Telemetry Attributes Transfer Standard) files and processing Chapter 10 packet structures. The module serves as a bridge between .NET enum definitions and their corresponding binary protocol representations as defined in the IRIG 106 Chapter 10 specification.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DescriptionDecoder` (static class)
|
||||
**Namespace:** `IRIGCh10`
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetDescription` | `public static string GetDescription(Enum value)` | Retrieves the `DescriptionAttribute` value from an enum member. Returns the description string if the attribute is present; otherwise returns `value.ToString()`. |
|
||||
|
||||
### `MaxLengthDecoder` (static class)
|
||||
**Namespace:** `IRIGCh10`
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `GetMaxLength` | `public static int GetMaxLength(Enum value)` | Retrieves the `MaxLengthAttribute` length value from an enum member. Returns the length if the attribute is present; otherwise returns `0`. |
|
||||
|
||||
### `PacketHeaderValueAttribute`
|
||||
**Namespace:** `DTS.Serialization.IRIGCh10.Attributes`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Default` (static field) | `public static readonly PacketHeaderValueAttribute Default` | Default instance initialized with `0x00`. |
|
||||
| `PacketHeader` (property) | `public virtual byte PacketHeader { get; }` | Gets the packet header byte value. |
|
||||
| `GetPacketHeaderValue` (static method) | `public static byte GetPacketHeaderValue(Enum value)` | Retrieves the `PacketHeaderValueAttribute` byte from an enum member. Returns the attribute value if present; otherwise returns `Default.PacketHeaderValue` (`0x00`). |
|
||||
|
||||
**Constructors:**
|
||||
- `public PacketHeaderValueAttribute()` — Initializes with `0x00`.
|
||||
- `public PacketHeaderValueAttribute(byte packetHeader)` — Initializes with the specified byte value.
|
||||
|
||||
### `DataTypeVersionValueAttribute`
|
||||
**Namespace:** `DTS.Serialization.IRIGCh10.Attributes`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Default` (static field) | `public static readonly DataTypeVersionValueAttribute Default` | Default instance initialized with `0x00`. |
|
||||
| `DataTypeVersion` (
|
||||
87
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/Enums.md
Normal file
87
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/Enums.md
Normal file
@@ -0,0 +1,87 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Enums/Enums.cs
|
||||
generated_at: "2026-04-17T15:43:02.181959+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "c232b0142638d2a2"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Serialization.IRIGCH10.Enums
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module defines enumeration types for the IRIG 106 Chapter 10 data serialization system. It provides strongly-typed mappings between logical data type identifiers and their binary packet header representations used in flight data recording formats. The enums cover data file types, time sources, time formats, data type versions, secondary header time formats, and checksum types, all annotated with `PacketHeaderValue` attributes that specify the exact binary encoding for each value per the IRIG 106 standard.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DataFileDataTypes` (enum)
|
||||
|
||||
Defines all supported data type formats for IRIG 106 Chapter 10 packets. Each value is decorated with `[PacketHeaderValue(byte)]` and `[DataTypeVersionValue(byte)]` attributes.
|
||||
|
||||
**Notable defined values:**
|
||||
|
||||
| Value Name | Packet Header | Description |
|
||||
|------------|---------------|-------------|
|
||||
| `ComputerGeneratedDataFormat0` | 0x00 | User-Defined |
|
||||
| `ComputerGeneratedDataFormat1` | 0x01 | Setup Record |
|
||||
| `ComputerGeneratedDataFormat2` | 0x02 | Recording Events |
|
||||
| `ComputerGeneratedDataFormat3` | 0x03 | Recording Index |
|
||||
| `PCMDataFormat1` | 0x09 | Chapter 4 or 8 |
|
||||
| `TimeDataFormat1` | 0x11 | RCC/Global Positioning System [GPS]/RTC |
|
||||
| `MILSTD1553DataFormat1` | 0x19 | MIL-STD-1553B Data |
|
||||
| `MILSTD1553DataFormat2` | 0x1A | 16PP194 Bus |
|
||||
| `AnalogDataFormat1` | 0x21 | Analog Data |
|
||||
| `DiscreteDataFormat1` | 0x29 | Discrete Data |
|
||||
| `MessageDataFormat0` | 0x30 | Generic Message Data |
|
||||
| `ARINC429DataFormat0` | 0x38 | ARINC-429 Data |
|
||||
| `VideoDataFormat0` | 0x40 | MPEG-2/H.264 Video |
|
||||
| `VideoDataFormat1` | 0x41 | ISO 13818-1 MPEG-2 |
|
||||
| `VideoDataFormat2` | 0x42 | ISO 14496 MPEG-4 Part10 110 AVC/H.264 |
|
||||
| `VideoDataFormat3` | 0x43 | MJPEG |
|
||||
| `VideoDataFormat4` | 0x44 | MJPEG 2000 |
|
||||
| `ImageDataFormat0` | 0x48 | Image Data |
|
||||
| `ImageDataFormat1` | 0x49 | Still Imagery |
|
||||
| `ImageDataFormat2` | 0x4A | Dynamic Imagery |
|
||||
| `UARTDataFormat0` | 0x50 | UART Data |
|
||||
| `IEEE1394DataFormat0` | 0x58 | IEEE 1394 Transaction |
|
||||
| `IEEE1394DataFormat1` | 0x59 | IEEE 1394 Physical Layer |
|
||||
| `ParallelDataFormat0` | 0x60 | Parallel Data |
|
||||
| `EthernetDataFormat0` | 0x68 | Ethernet Data |
|
||||
| `EthernetDataFormat1` | 0x69 | Ethernet UDP Payload |
|
||||
| `TSPI_CTSDataFormat0` | 0x70 | GPS NMEA-RTCM |
|
||||
| `TSPI_CTSDataFormat1` | 0x71 | EAG ACMI |
|
||||
| `TSPI_CTSDataFormat2` | 0x72 | ACTTS |
|
||||
| `ControllerAreaNetworkBus` | 0x78 | CAN Bus |
|
||||
| `FibreChannelDataFormat0` | 0x79 | Fibre Channel Data |
|
||||
|
||||
Many additional values (Format0, Format2-Format7 variants for each category) are marked as "Reserved for future use."
|
||||
|
||||
---
|
||||
|
||||
### `TimeSource` (enum)
|
||||
|
||||
Defines the origin of time information in recordings.
|
||||
|
||||
| Value Name | Packet Header | Description |
|
||||
|------------|---------------|-------------|
|
||||
| `Internal` | 0x00 | Time derived from a clock in the recorder |
|
||||
| `External` | 0x01 | Time derived from a clock not in the recorder |
|
||||
| `InternalFromRMM` | 0x02 | Internal from RMM (Time derived from the clock in the RMM) |
|
||||
| `None` | 0x0F | None |
|
||||
|
||||
---
|
||||
|
||||
### `TimeFormats` (enum)
|
||||
|
||||
Defines supported time encoding formats.
|
||||
|
||||
| Value Name | Packet Header | Description |
|
||||
|------------|---------------|-------------|
|
||||
| `IRIGB` | 0x00 | IRIG-B |
|
||||
| `IRIGA` | 0x01 | IRIG-A |
|
||||
| `IRIGG` | 0x02 | IRIG-G |
|
||||
| `RTC` | 0x03 | Real-Time Clock |
|
||||
| `UTC` | 0x04
|
||||
256
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/Packets.md
Normal file
256
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/Packets.md
Normal file
@@ -0,0 +1,256 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/ITransportStreamHeader.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/ISecondaryTimeFormatHeader.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TransportStreamHeader.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/SecondaryTimeFormatHeader.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TimeDataPacket.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TMATSPacket.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/RootRecorderIndexPacket.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/RecorderIndexPacket.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TimePacketFormat2.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/IDataPacket.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/TimePacketFormat1.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Packets/AnalogDataFormat1Packet.cs
|
||||
generated_at: "2026-04-17T15:30:22.882503+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "ea68d7597278f2c1"
|
||||
---
|
||||
|
||||
# IRIG Chapter 10 Packet Serialization Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides serialization and deserialization support for IRIG 106 Chapter 10 data packets. It implements the packet structures defined in the Chapter 10 standard for recording and playback of telemetry data, including time data packets (Format 1 and Format 2), TMATS configuration packets, analog data packets, and recorder index packets. The module serves as the foundational layer for reading and writing Chapter 10 format files, handling binary encoding, checksums, and time format conversions.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Interfaces
|
||||
|
||||
#### `ITransportStreamHeader`
|
||||
```csharp
|
||||
public interface ITransportStreamHeader
|
||||
{
|
||||
int MessageFormat { get; }
|
||||
int MessageType { get; }
|
||||
int SequenceNumber { get; }
|
||||
}
|
||||
```
|
||||
Defines read-only access to transport stream header fields.
|
||||
|
||||
#### `ISecondaryTimeFormatHeader`
|
||||
```csharp
|
||||
public interface ISecondaryTimeFormatHeader
|
||||
{
|
||||
int NanoSeconds { get; }
|
||||
int Seconds { get; }
|
||||
ushort Reserved { get; }
|
||||
ushort CheckSum { get; }
|
||||
DateTime LocalTime { get; }
|
||||
}
|
||||
```
|
||||
Defines read-only access to secondary time format header fields.
|
||||
|
||||
#### `IDataPacket`
|
||||
```csharp
|
||||
public interface IDataPacket
|
||||
{
|
||||
IPacketHeader PacketHeader { get; }
|
||||
uint ComputeCheckSum();
|
||||
byte[] GetBytes();
|
||||
void SetRTC(long rtc);
|
||||
void SetDataVersion(DataTypeVersion version);
|
||||
void SetChannelID(ushort channelID);
|
||||
void SetSequenceNumber(ushort seq);
|
||||
}
|
||||
```
|
||||
Defines the contract for all Chapter 10 data packets.
|
||||
|
||||
---
|
||||
|
||||
### Abstract Base Class
|
||||
|
||||
#### `AbstractDataPacket`
|
||||
Base class for all packet types. Provides common functionality:
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `ChannelSpecificDataWord` | `uint` property | Gets/sets the Channel Specific Data Word (CSDW). |
|
||||
| `PacketHeader` | `IPacketHeader` property | Gets the packet header. |
|
||||
| `ComputeCheckSum` | `uint ComputeCheckSum()` | Computes 32-bit checksum of packet data. |
|
||||
| `GetRTC` | `long GetRTC()` | Returns the 10MHz Realtime Counter value. |
|
||||
| `SetRTC` | `void SetRTC(long rtc)` | Sets the RTC value in both the packet and header. |
|
||||
| `SetSequenceNumber` | `void SetSequenceNumber(ushort seq)` | Sets the packet sequence number. |
|
||||
| `SetDataVersion` | `void SetDataVersion(DataTypeVersion version)` | Sets the data version in the header. |
|
||||
| `SetChannelID` | `void SetChannelID(ushort channelID)` | Sets the channel ID in the header. |
|
||||
| `GetBytes` | `virtual byte[] GetBytes()` | Serializes the packet to a byte array. |
|
||||
| `BASE_RTC` | `const long = 141989612500056L` | Base RTC value constant. |
|
||||
|
||||
---
|
||||
|
||||
### Concrete Packet Classes
|
||||
|
||||
#### `TransportStreamHeader`
|
||||
```csharp
|
||||
public TransportStreamHeader(byte[] input)
|
||||
public const int TRANSPORT_HEADER_LENGTH = 4;
|
||||
```
|
||||
Parses a 4-byte transport stream header. Extracts `MessageFormat` (bits 0-3), `MessageType` (bits 4-7), and `SequenceNumber` (bits 8-31) from the input bytes.
|
||||
|
||||
#### `SecondaryTimeFormatHeader`
|
||||
```csharp
|
||||
public SecondaryTimeFormatHeader(byte[] input)
|
||||
public static byte[] GetBytes(int nanoseconds, int seconds)
|
||||
public const int SECONDARY_TIME_HEADER_LENGTH = 12;
|
||||
```
|
||||
Parses or constructs a 12-byte secondary time header. `LocalTime` is computed as Unix epoch (1970-01-01) plus `Seconds` and `NanoSeconds` converted to ticks, then converted to local time. Constructor validates checksum and writes to `Trace` on mismatch.
|
||||
|
||||
#### `TimeDataPacket`
|
||||
```csharp
|
||||
public TimeDataPacket()
|
||||
public DateTime GetDateTime()
|
||||
public void SetTime(DateTime dt)
|
||||
public void SetTimeSource(byte b)
|
||||
public void SetTimeSource(TimeSource src)
|
||||
public void SetTimeFormat(TimeFormats fmt)
|
||||
```
|
||||
Implements Time Data Format 1 packet. `SetTime` encodes a `DateTime` into BCD format in a 12-byte payload at positions 4-11.
|
||||
|
||||
#### `TimePacketFormat1`
|
||||
```csharp
|
||||
public TimePacketFormat1(byte sequenceNumber, DateTime packetTime, long rtc, int nanoseconds, int seconds)
|
||||
```
|
||||
Implements Time Data Format 1 with full IRIG time encoding. Properties include:
|
||||
- `ITS` (`IRIGTimeSource` enum) - IRIG time source (bits 15-12, not serialized per comment)
|
||||
- `TimeFormat` (`TimeFormats` enum) - bits 7-4
|
||||
- `TimeSource` (`TimeSources` enum) - bits 3-0
|
||||
- `DateFormat` (`DateFormats` enum) - bit 9
|
||||
- `IsLeapYear` (`bool`) - bit 8
|
||||
- `TimePacketTime` (`DateTime`) - the time represented by this packet
|
||||
|
||||
#### `TimePacketFormat2`
|
||||
```csharp
|
||||
public TimePacketFormat2(byte sequenceNumber, bool rtcSyncError, int nanoseconds, int seconds, long rtc, bool includeSecondaryHeader)
|
||||
public TimePacketFormat2(byte[] bytes)
|
||||
```
|
||||
Implements Time Data Format 2 for network time protocols. Properties include:
|
||||
- `LocalTimeOfFirstSample` (`DateTime`)
|
||||
- `NetworkTimeFormat` (`NetworkTimeFormats` enum) - bits 7-4
|
||||
- `TimeStatus` (`TimeStatuses` enum) - bits 3-0
|
||||
- `UnsignedSeconds` (`uint`)
|
||||
- `UnsignedNanoSeconds` (`uint`)
|
||||
- `PTPTime` (`string`) - formatted PTP timestamp
|
||||
|
||||
#### `TMATSPacket`
|
||||
```csharp
|
||||
public TMATSPacket(int nanoseconds, int seconds, string tmatsDoc, bool secondaryHeaderPresent)
|
||||
public TMATSPacket(byte[] bytes)
|
||||
public string TMATSDocument { get; }
|
||||
public bool XMLFormat { get; }
|
||||
public bool SetupRecordConfigurationChange { get; }
|
||||
public RCCChapter10Versions Chapter10Version { get; }
|
||||
```
|
||||
Implements TMATS (Telemetry Attributes Transfer Standard) packet. `TMATSDocument` returns ASCII-decoded content. `RCCChapter10Versions` enum maps values 0x07-0x0B to versions RCC_106_07 through RCC_106_15.
|
||||
|
||||
#### `AnalogDataFormat1Packet`
|
||||
```csharp
|
||||
public AnalogDataFormat1Packet(int nanoseconds, int seconds, Chapter10File.GetNextSampleDelegate getNextSample, int totalChannels, long channelLength, long rtc, long numSamples, long currentSample, byte sequenceNumber, ushort channelId, bool includeSecondaryHeader)
|
||||
public AnalogDataFormat1Packet(byte[] bytes)
|
||||
public SampleData[] Samples { get; }
|
||||
```
|
||||
Implements Analog Data Format 1 packet. CSDW properties:
|
||||
- `Same` (bit 28)
|
||||
- `Factor` (bits 27-24)
|
||||
- `TotChan` (bits 23-16)
|
||||
- `Subchan` (bits 15-8)
|
||||
- `Length` (bits 7-2)
|
||||
- `Mode` (`Modes` enum, bits 1-0)
|
||||
|
||||
`SampleData` inner class holds `ChannelData` as `short[]`.
|
||||
|
||||
#### `RecorderIndexPacket`
|
||||
```csharp
|
||||
public RecorderIndexPacket()
|
||||
public void SetRootPacketAddress(long address)
|
||||
public void AddRecordingIndex(RecordingIndex index)
|
||||
public int NumberOfEntries { get; }
|
||||
public DateTime GetDateTime()
|
||||
public override byte[] GetBytes()
|
||||
```
|
||||
Implements recorder index packet. Uses hardcoded `ChannelSpecificDataWord = {0x8D, 0x02, 0x00, 0xE0}`.
|
||||
|
||||
#### `RootRecorderIndexPacket`
|
||||
```csharp
|
||||
public RootRecorderIndexPacket(DateTime dt)
|
||||
public void SetRootPacketAddress(long address)
|
||||
public void AddRecordingIndex(RecordingIndexIndex index)
|
||||
public override byte[] GetBytes()
|
||||
```
|
||||
Implements root recorder index packet (last packet in file). Uses hardcoded `ChannelSpecificDataWord = {0x8D, 0x00, 0x00, 0x60}`.
|
||||
|
||||
#### `RecordingIndex`
|
||||
```csharp
|
||||
public RecordingIndex(long rtc, long offset, DateTime dt)
|
||||
public const int SIZE = 28;
|
||||
public byte[] GetBytes()
|
||||
public DateTime GetDateTime()
|
||||
```
|
||||
Helper structure for recorder index entries. Fixed size of 28 bytes.
|
||||
|
||||
#### `RecordingIndexIndex`
|
||||
```csharp
|
||||
public RecordingIndexIndex(long rtc, long offset, DateTime dt)
|
||||
public const int SIZE = 24;
|
||||
public byte[] GetBytes()
|
||||
```
|
||||
Helper structure for root index entries. Fixed size of 24 bytes.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **TransportStreamHeader**: Input must be exactly `TRANSPORT_HEADER_LENGTH` (4) bytes; null input throws `NullReferenceException`.
|
||||
- **SecondaryTimeFormatHeader**: Input must be exactly `SECONDARY_TIME_HEADER_LENGTH` (12) bytes.
|
||||
- **Packet alignment**: `PacketHeader.PacketLength` is always padded to a multiple of 4 bytes.
|
||||
- **RTC consistency**: Setting RTC via `SetRTC(long)` updates both the internal `_rtc` field and `PacketHeader`.
|
||||
- **Sequence numbers**: Should be monotonically increasing and wrap to 0 after maximum value (caller responsibility).
|
||||
- **TimeDataPacket**: `_dataBytes` is initialized to 12 bytes; time data is written at positions 4-11.
|
||||
- **TMATSDocument encoding**: Always decoded as ASCII.
|
||||
- **AnalogDataFormat1Packet sample data**: Samples are byte-swapped and offset by 0x8000 for signed/unsigned conversion.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Serialization.IRIGCH10.Enums` - Data type enumerations (`DataFileDataTypes`, `DataTypeVersion`)
|
||||
- `DTS.Serialization.IRIGCh10.Attributes` - `PacketHeaderValueAttribute`
|
||||
- `DTS.Serialization.IRIGCH10.Packets` - `PacketHeader`, `IPacketHeader`
|
||||
- `DTS.Common.Utilities` - `PTP1588Timestamps` (referenced in `TimePacketFormat2`)
|
||||
- `Utils.Utils` (external utility class) - Static methods: `BitArrayToInt32`, `SetBits`, `GetCheckSum8`, `GetCheckSum32`, `GetBCDBytes`
|
||||
- `System.IO` - `MemoryStream`, `BinaryWriter`
|
||||
- `System.Collections` - `BitArray`
|
||||
|
||||
### What depends on this module:
|
||||
- `Chapter10File` (referenced in `AnalogDataFormat1Packet` constructor delegate type `GetNextSampleDelegate`)
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **SecondaryTimeFormatHeader checksum validation is non-blocking**: When checksum mismatch occurs, the constructor only writes to `System.Diagnostics.Trace.WriteLine` rather than throwing an exception. Callers must not assume valid checksums.
|
||||
|
||||
2. **TimePacketFormat1 ITS field not serialized**: The `ITS` property (IRIGTimeSource) is explicitly not serialized to the CSDW due to EMC validation tool compatibility issues (comment dated 2023-10-27).
|
||||
|
||||
3. **Hardcoded ChannelSpecificDataWord values**: `RecorderIndexPacket` and `RootRecorderIndexPacket` use hardcoded byte arrays for `ChannelSpecificDataWord` with comments indicating uncertainty about individual field breakdown.
|
||||
|
||||
4. **AnalogDataFormat1Packet data version selection**: Uses `DATA_VERSION_DASSAULT` (0x06) when secondary header is present, otherwise `DATA_VERSION_V105` (0x01). Comment indicates EMC validation tool only supports CH10 106v5.
|
||||
|
||||
5. **TimeDataPacket SetTimeSource overloads behave differently**: The `byte` overload sets bits 0-3 directly, while the `TimeSource` enum overload reverses bit order (bit 0←3, bit 1←2, etc.) per Chapter 10 reference 10-47.
|
||||
|
||||
6. **LocalTime calculation in SecondaryTimeFormatHeader**: Uses `AddTicks(NanoSeconds / 100)` which truncates nanoseconds to 100-nanosecond tick precision.
|
||||
|
||||
7. **RecordingIndexIndex added automatically in RootRecorderIndexPacket.GetBytes()**: The last index entry pointing back to the current packet is appended internally during `GetBytes()` call, modifying `_indices` list state.
|
||||
166
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/TMATS.md
Normal file
166
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/TMATS.md
Normal file
@@ -0,0 +1,166 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DescriptionDecoder.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/TMATSectionNumbered.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/TMATSSection.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/TMATS.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/GeneralInformation.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/PCM.cs
|
||||
generated_at: "2026-04-17T15:35:03.196850+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d1584336ff58226c"
|
||||
---
|
||||
|
||||
# TMATS Serialization Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a C# implementation for generating TMATS (Telemetry Attributes Transfer Standard) documents compliant with the IRIG 106 standard. It offers a strongly-typed, object-oriented API for constructing telemetry configuration metadata, including PCM format attributes, storage source definitions, and general information sections. The module serializes configured objects into the TMATS text format using reflection-based attribute decoding to map enum values to their standard TMATS field identifiers.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### DescriptionDecoder (static class)
|
||||
**Signature:** `public static string GetDescription(Enum value)`
|
||||
Returns the `DescriptionAttribute` value from the enum field, or the enum's string representation if no attribute is present. Used to map enum values to TMATS field codes.
|
||||
|
||||
### MaxLengthDecoder (static class)
|
||||
**Signature:** `public static int GetMaxLength(Enum value)`
|
||||
Returns the `MaxLengthAttribute.Length` value from the enum field, or `0` if no attribute is present. Intended for field length validation.
|
||||
|
||||
### TMATSSection\<T\> (abstract class)
|
||||
Generic base class for TMATS sections where `T : Enum`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `SetValue` | `public void SetValue(T tag, string value)` | Stores a value for the given tag key. |
|
||||
| `GetValue` | `public string GetValue(T tag)` | Retrieves value for tag, or `null` if unset. |
|
||||
| `SetDate` | `public void SetDate(T tag, DateTime? value)` | Sets a date in `MM-DD-YYYY` format, or empty string if `null`. |
|
||||
| `GetDate` | `public DateTime? GetDate(T tag)` | Parses date from `MM-DD-YYYY` format, or `null` if invalid/empty. |
|
||||
| `GetIntOrNull` | `public int? GetIntOrNull(T tag)` | Parses integer value, or `null` if unset/unparseable. |
|
||||
| `SetIntOrNull` | `public void SetIntOrNull(T tag, int? val)` | Sets integer as string, or empty string if `null`. |
|
||||
| `SetValueWithLength` | `public void SetValueWithLength(T tag, string value)` | Sets value (length validation currently disabled). |
|
||||
| `Serialize` | `public virtual string Serialize()` | Serializes all tag/value pairs to TMATS format. |
|
||||
| Constructor | `public TMATSSection()` | Default constructor for unnumbered sections. |
|
||||
| Constructor | `public TMATSSection(AttributeIdentifiers attribute, int number)` | Constructor for numbered sections (e.g., channel-specific). |
|
||||
|
||||
### TMATSectionNumbered\<T\> (class)
|
||||
Represents a section with numbered sub-items where `T : Enum`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Identifier` | `public AttributeIdentifiers Identifier { get; set; }` | Section identifier (default: `GeneralInformation`). |
|
||||
| `Number` | `public int Number { get; set; }` | Section number (default: `-1`). |
|
||||
| `SetValue` | `public void SetValue(T tag, string value)` | Sets value for tag in internal dictionary. |
|
||||
| `GetValue` | `public string GetValue(T tag)` | Gets value for tag, or `null`. |
|
||||
| `Serialize` | `public string Serialize(int number)` | Serializes all tags with the given number. |
|
||||
| `SetValueWithLength` | `public void SetValueWithLength(T tag, string value)` | Sets value with length retrieval (validation disabled). |
|
||||
|
||||
### TMATSectionNumberedArray\<T\> (class)
|
||||
Manages an array of `TMATSectionNumbered<T>` items where `T : Enum`.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public TMATSectionNumberedArray(string numberedTag)` | Initializes with tag name for count field. |
|
||||
| Constructor | `public TMATSectionNumberedArray(string numberedTag, int maxNumber)` | Initializes with tag name and maximum count. |
|
||||
| Constructor | `public TMATSectionNumberedArray(AttributeIdentifiers identifier, int number, string numberedTag, int maxNumber)` | Full constructor with all parameters. |
|
||||
| `SetValue` | `public virtual void SetValue(int number, T tag, string value)` | Sets value at 1-based index, expanding array if needed. |
|
||||
| `GetValue` | `public string GetValue(int number, T tag)` | Gets value at 1-based index, or `null` if out of range. |
|
||||
| `Serialize` | `public string Serialize()` | Serializes array with count header and all items. |
|
||||
| `GetCount` | `public int GetCount()` | Returns current item count. |
|
||||
| `SetCount` | `public void SetCount(int count)` | Resizes array, enforcing `maxNumber` if set. |
|
||||
|
||||
### AttributeIdentifiers (enum)
|
||||
TMATS top-level section identifiers with `Description` attributes:
|
||||
- `GeneralInformation` ("G")
|
||||
- `TransmitionAttributes` ("T")
|
||||
- `StorageSourceAttributes` ("R")
|
||||
- `MultiplexingAttributes` ("M")
|
||||
- `PCMFormatAttributes` ("P")
|
||||
- `PCMMeasurementDescription` ("D")
|
||||
- `BusDataAttributes` ("B")
|
||||
- `PacketFormatAttributes` ("S")
|
||||
- `PAMAttributes` ("A")
|
||||
- `DataConversionAttributes` ("C")
|
||||
- `AirborneHardwareAttributes` ("H")
|
||||
- `VendorSpecificAttributes` ("V")
|
||||
|
||||
### GeneralInformationGroup (class)
|
||||
Extends `TMATSSection<GeneralTags>`. Key properties include:
|
||||
- `ProgramName`, `TestItem` (string)
|
||||
- `IRIG106RevisionLevel`, `RevisionNumber`, `UpdateNumber`, `TestNumber` (string)
|
||||
- `OriginationDate`, `RevisionDate`, `UpdateDate` (DateTime?)
|
||||
- `NumberOfDataSources`, `NumberOfPointsOfContact` (int)
|
||||
- `PreTestRequirement`, `PostTestRequirement` (bool)
|
||||
- `SecurityClassification` (enum)
|
||||
- `Comments` (string)
|
||||
|
||||
Methods:
|
||||
- `SetDataSourceField(int number, Information.DataSourceIdentificationTags tag, string value)`
|
||||
- `SetDataSourceType(int number, Information.DataSourceTypes sourceType)`
|
||||
- `Serialize()` override
|
||||
|
||||
### PCM (class)
|
||||
Extends `TMATSSection<PCMAttributes>`. Constructor: `public PCM(int number)`.
|
||||
|
||||
Properties: `DataLinkName`, `PCMCode`, `BitsPerSecond`, `DataRandomized`, `Polarity`, `DataDirection`, `TypeFormat`, `NumberOfBitsInCommonWordLength`, `WordTransferOrder`, `PCMWordParity`.
|
||||
|
||||
### MinorFrameSection (class)
|
||||
Extends `TMATSSection<MinorFrameTags>`. Constructor: `public MinorFrameSection(int number = 1)`.
|
||||
|
||||
Properties: `NumberOfMinorFramesInAMajorFrame`, `NumberOfWordsInMinorFrame`, `NumberOfBitsInMinorFrame`, `SyncLength`, `SynchronizationPattern`.
|
||||
|
||||
### TMATSCreationTest (class)
|
||||
**Signature:** `public static string CreateTMATS()`
|
||||
Demonstration method that constructs a complete TMATS document with storage, PCM, and message data configurations.
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **1-based indexing**: `TMATSectionNumberedArray<T>.SetValue` and `GetValue` use 1-based indexing internally (`_items[number - 1]`).
|
||||
- **Enum attribute requirements**: All enum values used as TMATS tags must have `[Description("...")]` attributes for proper serialization.
|
||||
- **Date format**: Dates are serialized/parsed in `MM-DD-YYYY` format only.
|
||||
- **TMATS output format**: Serialized lines follow pattern `{identifier}-{number}\{attribute}{subnumber}:{value};` or `{identifier}\{attribute}:{value};` for unnumbered sections.
|
||||
- **Default number value**: Sections with `Number < 0` serialize without the `-{number}` suffix.
|
||||
- **Null handling**: `GetValue` methods return `null` for unset keys, not empty strings or exceptions.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `System` (core types, `DateTime`, `Enum`)
|
||||
- `System.ComponentModel` (`DescriptionAttribute`)
|
||||
- `System.ComponentModel.DataAnnotations` (`MaxLengthAttribute`)
|
||||
- `System.Collections.Generic` (`Dictionary<T,K>`, `List<T>`)
|
||||
- `System.Linq` (`Cast<T>()`, `Any()`, `First()`, etc.)
|
||||
- `System.Text` (`StringBuilder`)
|
||||
- `System.Globalization` (used in `GetDate` for parsing)
|
||||
|
||||
**Consumers (inferred):**
|
||||
- Any module requiring IRIG 106 TMATS document generation for telemetry recording configuration.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **MaxLength validation is disabled**: Both `TMATSSection<T>.SetValueWithLength` and `TMATSectionNumbered<T>.SetValueWithLength` contain commented-out validation logic. The code comments state "maxlength is just a suggestion in the spec." Values exceeding `MaxLengthAttribute` will be stored without error.
|
||||
|
||||
2. **DataSource ID uniqueness check bug**: In `GeneralInformationGroup.Information.SetDataSourceField`, the loop iterates with `i` but compares using `number`:
|
||||
```csharp
|
||||
if (_datasources.GetValue(number, tag) == value) // Should likely be GetValue(i, tag)
|
||||
```
|
||||
This compares the value against itself rather than checking other indices.
|
||||
|
||||
3. **Typo in enum**: `AttributeIdentifiers.TransmitionAttributes` is misspelled (should be "Transmission").
|
||||
|
||||
4. **Double semicolon**: In `TMATSectionNumberedArray<T>.SetCount`, there is a syntax quirk: `newItem.Number = _number;;`.
|
||||
|
||||
5. **Incomplete enum definitions**: `SubFrameSynchronizationTags` and `SubFrameDefinitionTags` lack `[Description]` attributes, meaning they cannot be properly serialized using `DescriptionDecoder.GetDescription`.
|
||||
|
||||
6. **Date format inconsistency**: The format string `"MM-DD-YYYY"` uses non-standard year formatting. Standard C# would be `"MM-dd-yyyy"`. The behavior with `DateTime.TryParseExact` using `"YYYY"` (uppercase) may not parse correctly on all systems.
|
||||
|
||||
7. **Empty vs null ambiguity**: `SetIntOrNull` and `SetDate` set empty strings for `null` values, but `GetValue` returns `null` for missing keys. This creates an inconsistency where explicitly-set nulls become empty strings while never-set values remain null.
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/DataConversionSection.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/TelemetrySection.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/CoefficientSection.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/Measurand.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/OtherInformationSection.cs
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/TMATS/DataConversion/TransducerInformation.cs
|
||||
generated_at: "2026-04-17T15:35:23.451592+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "f25d8d008b57c725"
|
||||
---
|
||||
|
||||
# TMATS Data Conversion Module Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module implements the Data Conversion section of TMATS (Telemetry Attributes Transfer Standard) packets for IRIG Ch10 data serialization. It provides strongly-typed classes and enumerations for defining measurement metadata including conversion types, telemetry formats, calibration coefficients, measurand descriptions, alert/warning limits, and transducer information. Each section class maps enum-backed attributes to their TMATS-compliant string representations via `Description` attributes.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `DataConversionSection` (class)
|
||||
**Namespace:** `DTS.Serialization.IRIGCH10.Attributes`
|
||||
**Inherits:** `TMATSSection<DataConversionAttributes>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `DataConversionSection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
|
||||
| `SetConversionType` | `void SetConversionType(ConversionTypes type)` | Sets the DCT attribute using the `Description` value of the provided `ConversionTypes` enum |
|
||||
|
||||
**Related Enums:**
|
||||
- `DataConversionAttributes`: Contains `ConversionType` (Description: "DCT")
|
||||
- `ConversionTypes`: `None`, `PairSets`, `Coefficients`, `CoefficientsNegative`, `Derived`, `Discrete`, `PCMTime`, `Time1553`, `DigitalVoice`, `DigitalVideo`, `SpecializedProcessing`, `Other`
|
||||
|
||||
---
|
||||
|
||||
### `TelemetrySection` (class)
|
||||
**Namespace:** `DTS.Serialization.IRIGCH10.TMATS.DataConversion`
|
||||
**Inherits:** `TMATSSection<TelemetryAttributes>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TelemetrySection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
|
||||
| `SetBinaryFormat` | `void SetBinaryFormat(BinaryFormats format)` | Sets the BFM attribute using the `Description` value of the provided `BinaryFormats` enum |
|
||||
|
||||
**Related Enums:**
|
||||
- `TelemetryAttributes`: Contains `BinaryFormat` (Description: "BFM", MaxLength: 3)
|
||||
- `BinaryFormats`: `Integer`, `UnsignedBinary`, `SignAndMagnitudeSig`, `SignAndMagnitudeSim`, `OnesCompliment`, `TwosCompliment`, `OffsetBinary`, `FloatingPoint`, `BinaryCodedDecimal`, `BitWeight`, `Other`
|
||||
|
||||
---
|
||||
|
||||
### `CoefficientSection` (class)
|
||||
**Namespace:** `DTS.Serialization.IRIGCH10.TMATS.DataConversion`
|
||||
**Inherits:** `TMATSSection<CoefficientsAttributes>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `CoefficientSection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
|
||||
| `OrderOfCurveFit` | `int?` (property) | Gets/sets the polynomial curve fit order (attribute "CO\\N") |
|
||||
| `Coefficient0` | `string` (property) | Gets/sets the zero-order term/offset (attribute "CO") |
|
||||
| `Coefficient1` | `string` (property) | Gets/sets the first-order coefficient (attribute "CO-1") |
|
||||
|
||||
**Related Enum:**
|
||||
- `CoefficientsAttributes`: `OrderOfCurveFit` ("CO\\N"), `DerivedFromPairSet` ("CO1"), `Coefficient0` ("CO"), `Coefficient1` through `Coefficient7` ("CO-1" through "CO-7")
|
||||
|
||||
---
|
||||
|
||||
### `MeasurandSection` (class)
|
||||
**Namespace:** `DTS.Serialization.IRIGCH10.TMATS.DataConversion`
|
||||
**Inherits:** `TMATSSection<MeasurandAttributes>`
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `MeasurandSection(int number)` | Initializes with `AttributeIdentifiers.DataConversionAttributes` and section number |
|
||||
| `Description` | `string` (property) | Gets/sets parameter description (attribute "MN1", MaxLength: 64) |
|
||||
| `MeasurementAlias` | `string` (property) | Gets/sets alternate measurand name (attribute "MNA", MaxLength: 32) |
|
||||
| `ExcitationVoltage` | `string` (property) | Gets/sets sensor reference voltage in volts (attribute "MN2", MaxLength: 10) |
|
||||
| `EngineeringUnits` | `string` (property) | Gets/sets engineering units (attribute
|
||||
38
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/Utils.md
Normal file
38
docs/ai/Common/DTS.Common.Serialization/IRIGCH10/Utils.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Serialization/IRIGCH10/Utils/Utils.cs
|
||||
generated_at: "2026-04-17T16:43:36.818421+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "2999f5bcc681631b"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Serialization.IRIGCH10.Utils.Utils
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides low-level utility functions for IRIG Chapter 10 data serialization, including Binary Coded Decimal (BCD) encoding for date/time values, checksum computation (8-bit, 16-bit, and 32-bit variants per the CH10 specification), and bit-level manipulation of `BitArray` structures. It serves as a foundational helper class for encoding and validating binary packet data in the IRIG Chapter 10 format.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `public static byte[] GetBCDBytes(int value)`
|
||||
Converts an integer value to a 2-byte Binary Coded Decimal representation.
|
||||
- **Parameter:** `value` — must be in range [0, 9999]
|
||||
- **Returns:** 2-byte array containing the BCD-encoded value
|
||||
- **Throws:** `ArgumentOutOfRangeException` if `value` is outside the valid range
|
||||
|
||||
### `public static ushort GetCheckSum8(byte[] bytes)`
|
||||
Computes an 8-bit checksum by summing all byte values.
|
||||
- **Parameter:** `bytes` — input byte array
|
||||
- **Returns:** `ushort` representing the sum of all bytes (wrapping at 8 bits via implicit truncation)
|
||||
|
||||
### `public static ushort GetCheckSum16(byte[] bytes)`
|
||||
Computes a 16-bit checksum per the Chapter 10 specification by treating the byte array as an array of 16-bit unsigned integers and summing them.
|
||||
- **Parameter:** `bytes` — input byte array (must have even length)
|
||||
- **Returns:** `ushort` checksum value
|
||||
- **Asserts:** `bytes.Length % 2 == 0` via `System.Diagnostics.Trace.Assert`
|
||||
|
||||
### `public static uint GetCheckSum32(byte[] bytes)`
|
||||
Computes a 32-bit checksum per the Chapter 10 specification by treating the byte array as an array of
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user