How kutukvpavel/mechatrolinkparser works
Main Components
• MechatrolinkParser Application:
• Command Line Interface (CLI): The entry point (Program.cs) that initiates the parsing process, dispatching input data.
• Data Decoders:
∘ Manchester Decoder (HDLCManchesterDecoder.cs): Handles Manchester decoding.
∘ HDLC Parser: Likely integrated in or called by HDLCManchesterDecoder or separate error handling modules like ErrorListener.cs.
• Data Structures and Logic:
∘ MechatrolinkStructures.cs, EncoderStructures.cs: Define the communication protocol’s data representations.
∘ LogicAnalyzerData.cs: Stores and processes raw logic analyzer exports.
• Database/Command Engine:
∘ DatabaseEngine.cs, MechatrolinkCommandDatabase.cs, MechatrolinkParameterDatabase.cs, EncoderCommandDatabase.cs: Serve as in-memory or on-disk repositories mapping commands and parameters to their definitions.
• Data Reporter and Bulk Processing:
∘ DataReporter.cs, BulkProcessing.cs: Likely aggregate and format output data for reporting or further processing.
• AnalysisHelper:
• A supporting project (AnalysisHelper.csproj) that might be used for auxiliary analysis functions or testing support. Its existence indicates a layered design where the core parsing logic is separated from secondary or helper analyses.
• External Dependencies:
• NuGet Package: HashFunction.CRC for FCS (checksum) calculations.
• Configuration files: App.config files in both projects for specifying settings.
• External Interfaces:
• Input: Logic analyzer exports (via text import and possible real-time data input).
• Output: Generated reports/presentations (as hinted by the README example image).
Relationships and Interactions
• The CLI (Program.cs) in MechatrolinkParser acts as the coordinator: it accepts data input then sequentially or in a pipeline calls the Manchester decoder and HDLC parser.
• Once decoding is done, the data flows into the command/field database engine, where commands are looked up and further processed.
• The BulkProcessing and DataReporter components gather the processed data and prepare output reports.
• AnalysisHelper may either provide additional analysis tasks or testing utilities that can be invoked by MechatrolinkParser, suggesting a modular interaction between both projects.
• The configuration files (App.config) are essential at the initialization stage to configure decoders, reference external dependencies, and adjust logging or other parameters.
Architectural Patterns and Design Principles
• Modular Design: Different aspects (decoding, processing, reporting) are separated into standalone modules/files.
• Separation of Concerns: The existence of a separate AnalysisHelper project indicates a clear separation between primary functionality and auxiliary or testing support.
• Use of External Libraries/Configurations: Highlighting the use of a NuGet package for CRC calculation and App.config for environment setup.