3.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T02:44:19.261971+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | fb3a2f656d5788aa |
Communication
1. Purpose
This module defines core enumerations and delegates used for representing the outcomes and callback mechanisms of communication operations within the DTS system. It serves as a shared contract between communication implementations (e.g., network, serial, or custom transport layers) and higher-level consumers, enabling consistent reporting of connection, disconnection, send, receive, and cancellation states. The CommunicationResult enum standardizes status reporting, while the CommunicationCallback delegate provides a standardized way to handle asynchronous or event-driven communication reports.
2. Public Interface
CommunicationResult enum
A set of named constants representing the possible outcomes of communication operations:
ConnectOK,ConnectFailed,ConnectTimeout— outcomes for connection attemptsDisconnectOK,DisconnectFailed,DisconnectTimeout— outcomes for disconnection attemptsSendOK,SendFailed,SendTimeout— outcomes for send operationsReceiveOK,ReceiveFailed,ReceiveTimeout— outcomes for receive operationsCanceled— indicates an operation was canceled (e.g., via cancellation token)
CommunicationCallback delegate
public delegate bool CommunicationCallback(ICommunicationReport report);
A callback function type used to process ICommunicationReport instances. It returns true to indicate the callback handled the report successfully or wishes to continue processing, and false to signal termination or failure. The actual behavior of the callback (e.g., logging, UI update, state transition) is implementation-defined, but the delegate contract requires a boolean return value.
3. Invariants
- The
CommunicationResultenum values are exhaustive for the categories of operations: connect, disconnect, send, receive, and cancellation. No other result codes are defined in this module. - The
CommunicationCallbackdelegate must accept anICommunicationReportparameter (fromDTS.Common.Interface.Communication) and return abool. The semantics of the return value are not defined in this file and must be inferred from usage or documentation of the calling code. - No runtime validation or enforcement is performed on the enum values or callback invocations within this module — it is purely a definition layer.
4. Dependencies
- Depends on:
DTS.Common.Interface.Communicationnamespace (specifically forICommunicationReportused inCommunicationCallback).
- Used by:
- Any module implementing or consuming communication operations (e.g., transport layer implementations, communication managers, UI components).
- The
ICommunicationReportinterface (from theDTS.Common.Interface.Communicationnamespace) must be defined elsewhere; this module assumes its existence and contract.
5. Gotchas
- The
CommunicationCallbackreturn value semantics (true/false) are not specified in this file — callers and implementers must coordinate on interpretation (e.g.,falsemay mean “stop processing” or “retry failed” depending on context). - The
Canceledresult is distinct from timeout/failure modes but does not imply why it was canceled (e.g., user action, timeout, resource exhaustion). - No constants (e.g., timeout durations, buffer sizes) are defined in this file despite the class name
CommunicationConstantsAndEnums— only theCommunicationResultenum andCommunicationCallbackdelegate are present. - None identified from source alone.