--- source_files: - DataPRO/IService/SLICE Service/SystemAttribute.cs - DataPRO/IService/SLICE Service/Attribute.cs - DataPRO/IService/SLICE Service/EventAttribute.cs generated_at: "2026-04-16T03:56:30.099134+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "61f87a0978ab0f91" --- # SLICE Service ## Documentation: SLICE Service Attribute Infrastructure ### 1. Purpose This module provides foundational infrastructure for handling SLICE device attributes within the `DTS.Slice.Service` namespace. It defines base abstractions (`Attribute`, `SystemAttribute`, `EventAttribute`) intended to encapsulate metadata and configuration data associated with system-level, event-level, and user-level attributes. Although the current source files contain only commented-out implementations (no active code), the structure indicates a planned design for typed attribute classes that map to specific data types (e.g., `UInt16`, `Ascii`, `DoubleDict`) and store categories (e.g., `System`, `Event`). The module supports serialization/deserialization of dictionary-based attributes (`Dictionary`) via helper methods in `Attribute`, and is intended to integrate with the `DTS.DASLib.Command.SLICE` command layer. --- ### 2. Public Interface **No public types or members are currently active.** All classes and methods in the provided files are commented out. The following are *intended* public interfaces based on the commented code: #### `SystemAttribute` (class) - **Inherits from**: `Attribute` - **Purpose**: Base class for system-level attributes (e.g., serial number, flash size). - **Note**: Contains no active members; only commented-out nested `TypeValues` enum and subclasses (`SerialNumberAttribute`, `TotalEventsStoredAttribute`) are present. #### `EventAttribute` (class) - **Inherits from**: `Attribute` - **Purpose**: Base class for event-level attributes (e.g., event number, sample rate, timestamps). - **Note**: Contains no active members; only commented-out nested `TypeValues` enum and subclasses (e.g., `EventNumber`, `EventName`, `EventStartTime`, `PreEventScaleFactors`) are present. #### `Attribute` (class) - **Inherits from**: `object` - **Protected members**: - `protected enum AttributeInterface { Arm, Event, System, User }` - `protected AttributeInterface Store { get; set; }` - `protected AttributeTypes.AttributeDataTypes datatype;` - `protected ushort key;` - `protected object value;` - **Public constants**: - `public const int MaxSingleAttributeSize = 500;` - `public const int BulkAttributeStartNumber = 3000;` - **Protected methods**: - `protected Dictionary ByteArrayToDict(byte[] bytes)` Parses a byte array into a dictionary of `byte → double` pairs. Assumes format: `[byte][double][byte][double]...`, where each `double` is 8 bytes. - `protected byte[] DictToByteArray(Dictionary dict)` Serializes a `Dictionary` into a byte array in the same format as above. --- ### 3. Invariants - **No runtime invariants can be verified** from the source, as all logic is commented out and no constructors, properties, or methods are active. - Based on commented code, the *intended* invariants include: - `MaxSingleAttributeSize = 500` bytes — likely a hard limit on serialized attribute size. - `BulkAttributeStartNumber = 3000` — likely an offset indicating where bulk attributes begin (e.g., IDs ≥ 3000 are bulk). - Dictionary serialization assumes fixed-size pairs: 1 byte key + 8 bytes double = 9 bytes per entry. - `EventStartTime` serialization uses 8 bytes total: 4 bytes for seconds (since Unix epoch) + 4 bytes for milliseconds. --- ### 4. Dependencies - **Internal dependencies**: - `DTS.Common.Utils` — likely contains `ByteConvertor` (used in commented code for type conversion). - `DTS.DASLib.Command.SLICE` — provides `AttributeTypes.AttributeDataTypes` (used in commented subclasses). - **No external dependencies beyond these namespaces**. - **Depended upon by**: Unknown — no usages are visible in the provided files. --- ### 5. Gotchas - **Critical**: All functionality is commented out. This module is non-functional as-is and likely represents a work-in-progress or legacy design artifact. - **Ambiguity in `EventStartTime` implementation**: The setter computes `UInt32 fractions = (UInt32)(leftOver.TotalSeconds - (double)seconds);`, which is incorrect — it should use `leftOver.TotalMilliseconds % 1000` or similar to extract milliseconds. This is a likely bug if uncommented. - **Inconsistent enum references**: Subclasses reference `QueryArmAttribute.AttributeDataTypes` (e.g., `QueryArmAttribute.AttributeDataTypes.Ascii`), but the base `Attribute` class uses `AttributeTypes.AttributeDataTypes`. This suggests either: - A naming inconsistency (e.g., `QueryArmAttribute` should be `AttributeTypes`), or - A missing import/namespace alias. - **Missing `ByteConvertor` usage context**: The helper methods `ByteArrayToDict`/`DictToByteArray` assume `ByteConvertor` exists and supports `Convert(byte[], int, out T)` and `ToByteArray(T)`, but its implementation is not provided. - **No validation on dictionary keys**: `ByteArrayToDict` does not check for duplicate keys — adding an existing key would throw `ArgumentException`. > **Note**: Since no active code exists, these "gotchas" pertain to the *commented design*, not runtime behavior.