5.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T15:43:00.640638+00:00 | zai-org/GLM-5-FP8 | 1 | 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:
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:
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:
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 onDASHardware.GetArmStatusLock. - Pre-trigger Calculation: Pre-trigger seconds is always calculated as
TSRAIR.TSRAIR_MAX_PRE_TRIGGER_SAMPLES / sampleRatefor 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
falsereturn and invocation of theonErrorcallback. - 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 containerAnalogInputDASChannel- Channel type withAlreadyLevelTriggeredpropertyArmStatus- 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 toReadyForArm()50ms polling interval used throughout- Hardcoded
30000anddasList.Count > 1inPreparedArmNowFuncwith a TODO comment:"///////////fix the 30000 and 1 (at least)"
Historical Bug Fixes Referenced
- FB 26980: Override
mod.NumberOfEventsto ensure correct value - 39345: Don't hang if Flash Erase fails
- 4527: Disarm all devices if any fail during arm (safety measure)
- 15630: Limit
EnableFaultCheckingto 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:
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.