15 KiB
15 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T04:33:08.085586+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | d8ddaddf5f4cb968 |
TestObject
Documentation Page: Test Object & Template Management Module
1. Purpose
This module provides in-memory wrappers and management abstractions for test object and template data originating from the ISO.TestObject and ISO.TestObjectTemplate types in the underlying ISO namespace. It serves as the data-access and UI-binding layer for test object configurations, templates, and associated channel/sensor metadata within the DatabaseImporter module. Its primary role is to decouple UI and business logic from raw database structures (ISO13499FileDb) while supporting both ISO-compliant and non-ISO (custom) test object types, and enabling template reuse, inheritance, and zone-based channel organization.
2. Public Interface
TemplateChannelUI
TemplateChannelUI(TestObjectTemplateChannel channel)
Constructor wrapping aTestObjectTemplateChannel. No public properties or methods exposed beyond the internal_channelfield.
TestObjectTemplateCollection
static TestObjectTemplateCollection TemplateCollection { get; }
Singleton accessor for the global collection of test object templates.TestObjectTemplate GetTemplate(string templateId)
Retrieves aTestObjectTemplateby ID from the database (IsoDb) and wraps it in aTestObjectTemplateinstance. Returnsnullif not found.TestObjectTemplate SysBuiltTestObjectTemplate { get; }
Returns the system-built template (currently uninitialized in source;_sysBuiltTestObjectTemplateisnull).void ReloadAll(bool loadSubComponents)
Stubbed out (all logic commented out). Intended to refresh templates and subcomponents.static void DeleteAll()
Deletes all templates in the database viaISO.TestObjectTemplate.DeleteAllTemplates(), then resets the singleton collection.
TestObjectList
static TestObjectList TestObjectsList { get; }
Singleton accessor for the main list of test objects (non-system-built).static TestObjectList AddedGroupsList { get; }
Singleton accessor for a separate list used for user-added groups (system-built).void ReloadAll(bool bLoadSubComponents)
Stubbed out (empty body). Intended to reload all test objects and subcomponents.TestObject GetTestObject(string serialNumber, bool bSysBuilt)
Retrieves a test object by serial number andbSysBuiltflag. Returnsnullif not found.TestObject GetTestObject(string serialNumber)
Convenience overload: tries non-system-built first, then system-built.TestObject GetAddedGroup(string serialNumber)
Alias forGetTestObject(serialNumber, true).void DeleteAll()
Deletes all test objects in the database viaISO.TestObject.DeleteAllTestObjects().
TestTestObject
TestTestObject(TestObject obj)
Constructor wrapping aTestObject.MMEPositions Position { get; set; }
Gets/sets the group position. Setting toUserSetKey("@") hides the combo box and shows the position button; otherwise, vice versa. Also propagates position to all required sensors.string ChannelDefaultsKey { get; }
Constant"#"representing the default channel position.string UserSetKey { get; }
Constant"@"representing a user-defined position.Visibility GroupPositionComboBoxVisible { get; set; }
Controls visibility of the position combo box. Collapsed ifISO13499support is disabled (NO_ISO).Visibility GroupPositionButtonVisible { get; set; }
Controls visibility of the position button. Collapsed ifISO13499support is disabled.MMETestObjects TestObject { get; set; }
Gets/sets the test object for the group. Setting it propagates the change to all required sensors.int ChannelTypesIndex { get; set; }
Index into a list of channel types (used for UI binding).int ExcitationWarmupTimeMS { get; set; }
Excitation warm-up time in milliseconds.double TargetSampleRate { get; set; }
Target sample rate.double PreTriggerSeconds { get; set; }
Pre-trigger duration in seconds.double PostTriggerSeconds { get; set; }
Post-trigger duration in seconds.MMEPositions[] AvailablePositions { get; }
Returns available positions fromIsoDb.MMEPositions[] AvailableGroupPositions { get; }
Returns combined list:ChannelDefaultsKeyposition first, thenAvailablePositions.void SetTestObject(string s)
Sets_testObjectand raisesTestObjectproperty change.void SetPosition(string s)
Sets_positionand raisesPositionchange; updates UI visibility flags.
TestObjectTemplate
TestObjectTemplate()
Default constructor. InitializesTestObjectbased onSerializedSettings.ISOSupportLevel. ForNO_ISO, creates a non-ISO test object and sets channel type toConstants.NON_ISO_TESTOBJECT_CHANNEL_TYPE.TestObjectTemplate(ISO.TestObjectTemplate template, ref ISO13499FileDb db)
Wraps anISO.TestObjectTemplateinstance.TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db)
Copy constructor.string TemplateName { get; set; }
Template name.string TemplateDescription { get; set; }
Template description.string TemplateParent { get; set; }
Parent template name (for inheritance).bool SysBuilt { get; set; }
Whether the template is system-built.bool Embedded { get; set; }
Whether the template is embedded.string OriginalTemplateName { get; set; }
Original template name (preserved for tracking).MMETestObjects TestObject { get; set; }
Test object associated with the template.string TestObjectType { get; set; }
Test object type (e.g., channel type).int TestObjectTypeIndex { get; set; }
Index intoAvailableTestObjectTypes.string[] AvailableTestObjectTypes { get; set; }
List of test object types compatible with currentTestObject.TestObjectTemplateChannel[] RequiredChannels { get; }
List of required channels for the template.TestObjectTemplateChannel[] TemplateAllChannels { get; set; }
All channels (required + optional), sorted byDisplayOrder.TemplateChannelUI[] TemplateAllUIChannels { get; set; }
UI wrapper list forTemplateAllChannels.Zone[] TemplateZones { get; set; }
List of zones defined in the template.int CurrentZoneIndex { get; set; }
Index of the currently selected zone. UpdatesCurrentZone.Zone CurrentZone { get; set; }
Currently selected zone. ControlsAreZoneControlsEnabled.bool AreZoneControlsEnabled { get; }
trueifCurrentZoneis non-null.DateTime LastModified { get; set; }
Last modification timestamp.string LastModifiedBy { get; set; }
User who last modified the template.static MMETestObjects GetNonISOTestObject()
Retrieves or creates a non-ISO test object (name:Constants.NON_ISO_TESTOBJECT_NAME). Tries letters A–Z, then digits 0–9.ISO.TestObjectTemplate ToISOTestObjectTemplate()
Converts the wrapper to anISO.TestObjectTemplateinstance for persistence.
TestObject
TestObject()
Default constructor. Initializes empty_isoTestObjectandTemplate.TestObject(ISO.TestObject to, bool sysBuilt)
Wraps anISO.TestObject. InitializesTemplateand hardware.TestObject(TestObject copy)
Copy constructor.string SerialNumber { get; set; }
Unique serial number.string SerialNumberConverted { get; set; }
Human-readable serial number (e.g., stripped prefix for system-built).string DisplaySerialNumber { get; set; }
Serial number used for display. Setting it updatesSerialNumber,OriginalSerialNumber, and template name.string TestSetupName { get; set; }
Name prefix for user-added groups.string TestObjectType { get; set; }
Type of the test object (from template).string ParentObject { get; set; }
Parent test object (for hierarchy).bool SysBuilt { get; set; }
Whether the test object is system-built.TestObjectTemplate Template { get; set; }
Template associated with the test object.void SetTemplateDontResetISOObject(TestObjectTemplate value)
Sets template without resetting underlyingISO.TestObject.Template.string[] ZoneNames { get; set; }
Names of zones in the current template.string TemplateType { get; }
Template.TestObjectType, or""if no template.DASHardware[] Hardware { get; }
List of attached hardware devices, sorted.void SetHardwareFromISO()
Refreshes_hardwarefromISO.TestObject.HardwareIds.void SetHardware(DASHardware[] hardware)
Sets hardware list in memory and updatesISO.TestObject.HardwareIds.void AddHardware(DASHardware hardware)
Adds hardware, handling dummy hardware naming collisions.bool ContainsHardware(DASHardware h)
Checks if hardware is attached.SensorData GetSensor(string channelId, string serialNumber, string alternateChannelId = null)
Retrieves sensor settings for a given channel and serial number. Applies ISO channel defaults and overrides fromISO.TestObject.SensorSettings.void SetSensor(string channelName, SensorData sensor)
Persists sensor settings to the underlyingISO.TestObject.ISO.TestObject GetISOTestObject()
Returns the underlyingISO.TestObjectinstance.void RefreshHardware()
Alias forSetHardwareFromISO().string SerialNumberOrOriginalSerialNumber { get; }
ReturnsOriginalSerialNumberif embedded, elseSerialNumberConvertedorSerialNumber.SerializedSettings.ISOSupportLevels GetObjectISOLevel()
ReturnsNO_ISOif template type containsNON_ISO_TESTOBJECT_CHANNEL_TYPEorNONISOCHANNELTYPE, elseISO_ONLY.
3. Invariants
- Singleton consistency:
TestObjectTemplateCollection.TemplateCollectionandTestObjectList.TestObjectsList/AddedGroupsListare lazily initialized singletons. Thread-safety is ensured viavolatileandlock(MyLock)(inTestObjectList). - Template ↔ ISO mapping:
EveryTestObjectTemplatewraps exactly oneISO.TestObjectTemplate, and vice versa. TheToISOTestObjectTemplate()method must produce a validISO.TestObjectTemplatewith all fields populated. - Sensor settings precedence:
TestObject.GetSensor()applies ISO channel defaults first, then overlaysSensorSettingsfromISO.TestObject. IfFilterClassIsois"?", it is normalized to"P". - Channel ordering:
TemplateAllChannelsis sorted byDisplayOrder(viaCompareChannels). - Non-ISO test object uniqueness:
GetNonISOTestObject()ensures a single non-ISO test object exists, using letters A–Z first, then digits 0–9 if needed. - Template type consistency:
TestObject.TemplateTypeis derived fromTemplate.TestObjectType. IfTemplateisnull, it returns"".
4. Dependencies
Internal Dependencies
ISO.TestObject,ISO.TestObjectTemplate,ISO13499FileDb(fromISOnamespace).App.IsoDb(accessed viaApplication.Current as App).DASHardware,DASHardwareList,SensorData,SensorsCollection.SensorsList.MMEPositions,MMETestObjects,MMEPossibleChannels.SerializedSettings,Constants(e.g.,NON_ISO_TESTOBJECT_NAME,NON_ISO_TESTOBJECT_CHANNEL_TYPE).Zone,TemplateZone,TestObjectTemplateChannel.DbTimeStampBase(base class forTestObject).Tagsenum (used for property change notifications).
External Dependencies
System.Windows(forVisibility,Application,Guid.NewGuid()).System.Globalization(forCultureInfo.InvariantCultureparsing).System.Linq(for LINQ queries inGetNonISOTestObject()andTestObjectTemplateinitialization).
Dependents
- UI layers (e.g., WPF views binding to
TemplateChannelUI,TestObject,TestTestObject). - Import/export logic (e.g., TDM imports calling
DeleteAll()onTestObjectListorTestObjectTemplateCollection). - Template management UI (e.g., zone editing, channel assignment).
5. Gotchas
SysBuiltTestObjectTemplateis uninitialized:
_sysBuiltTestObjectTemplateis declared but never assigned.SysBuiltTestObjectTemplatewill always returnnull.ReloadAllstubbed out:
BothTestObjectTemplateCollection.ReloadAll()andTestObjectList.ReloadAll()have no implementation (all logic commented out). This may cause stale data if callers assume reload occurs.TemplateAllChannelssetter triggers side effects:
SettingTemplateAllChannelsinTestObjectTemplateinstantiatesTemplateAllUIChannelsand updates_channelsand_availableTestObjectTypes. This may cause unexpected behavior if called multiple times.TestObject.GetSensor()uses ambiguous channel lookup:
The method trieschannelIdfirst, thenalternateChannelId(oftenchannelIdagain). The comment notes historical inconsistency between channel name vs. ID usage.DisplaySerialNumbersetter mutates multiple fields:
SettingDisplaySerialNumberon a user-added group updatesSerialNumber,SerialNumberConverted,OriginalSerialNumber, and template names. This may cause unintended side effects if used on system-built objects.TestTestObject.Positionsetter propagates to sensors:
ChangingPositionupdates all required sensors’ positions, but only ifPosition != UserSetKey. This may be unexpected if the UI allows switching toUserSetKeymid-edit.GetNonISOTestObject()may throw:
If no available letters/digits remain,GetNonISOTestObject()throwsNotSupportedException. No fallback or logging is present.TemplateTypemay be"?":
TestObject.TestObjectTypedefaults to"?", andTemplateTypeinherits this. Consumers must handle this sentinel value.- No explicit
INotifyPropertyChangedimplementation visible:
Classes referenceSetPropertyandOnPropertyChanged, but no base class (BasePropertyChanged) is included in the source. Behavior assumes a working implementation elsewhere.
End of Documentation.