ecu-tests/docs/05_architecture_overview.md
Hosam-Eldin Mostafa 582764d410 Mark legacy BabyLIN adapter as deprecated across code and docs
The MUM (Melexis Universal Master) adapter is the current default; the
BabyLIN SDK adapter is retained only for backward compatibility with
existing rigs.

Code:
- Emit DeprecationWarning when BabyLinInterface is instantiated and
  when tests/conftest.py routes interface.type=='babylin' to it.
- Update module/class docstrings in ecu_framework/{__init__,config,
  lin/__init__,lin/babylin}.py to label BabyLIN-specific fields and
  paths as deprecated.

Config / scripts / pytest:
- pytest.ini: relabel the babylin marker as deprecated.
- config/{babylin.example,examples,test_config}.yaml: add deprecation
  banners and field comments.
- scripts/99-babylin.rules and scripts/pi_install.sh: annotate the
  udev-rule install block as legacy-only.

Documentation:
- TESTING_FRAMEWORK_GUIDE.md, docs/08_babylin_internals.md, and
  vendor/README.md: prepend explicit "DEPRECATED" banners.
- docs/{README,01,02,04,05,07,09,10,12,13,14,15,18,DEVELOPER_COMMIT_
  GUIDE}.md: relabel "legacy" to "deprecated" where babylin is
  mentioned, present MUM as the primary path, and steer new work
  toward the MUM examples.

No tests, configs, or modules were deleted; existing BabyLIN setups
keep working but now produce a clear DeprecationWarning at runtime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:32:24 +02:00

90 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Architecture Overview
This document provides a high-level view of the frameworks components and how they interact, plus a Mermaid diagram for quick orientation.
## Components
- Tests (pytest) — test modules and functions under `tests/`
- Fixtures — defined in `tests/conftest.py` (config, lin, flash_ecu)
- Config Loader — `ecu_framework/config.py` (YAML → dataclasses)
- LIN Abstraction — `ecu_framework/lin/base.py` (`LinInterface`, `LinFrame`)
- Mock LIN Adapter — `ecu_framework/lin/mock.py`
- MUM LIN Adapter — `ecu_framework/lin/mum.py` (Melexis Universal Master via `pylin` + `pymumclient`)
- BabyLIN Adapter — `ecu_framework/lin/babylin.py` (SDK wrapper → BabyLIN_library.py; **DEPRECATED**, kept for legacy rigs only)
- LDF Database — `ecu_framework/lin/ldf.py` (`LdfDatabase`/`Frame` over `ldfparser`; per-frame `pack`/`unpack`)
- Flasher — `ecu_framework/flashing/hex_flasher.py`
- Power Supply (PSU) control — `ecu_framework/power/owon_psu.py` (serial SCPI)
- PSU quick demo script — `vendor/Owon/owon_psu_quick_demo.py`
- Reporting Plugin — `conftest_plugin.py` (docstring → report metadata)
- Reports — `reports/report.html`, `reports/junit.xml`
## Mermaid architecture diagram
```mermaid
flowchart TB
subgraph Tests & Pytest
T[tests/*]
CF[tests/conftest.py]
PL[conftest_plugin.py]
end
subgraph Framework
CFG[ecu_framework/config.py]
BASE[ecu_framework/lin/base.py]
MOCK[ecu_framework/lin/mock.py]
MUM[ecu_framework/lin/mum.py]
BABY[ecu_framework/lin/babylin.py<br/>DEPRECATED]
LDF[ecu_framework/lin/ldf.py]
FLASH[ecu_framework/flashing/hex_flasher.py]
POWER[ecu_framework/power/owon_psu.py]
end
subgraph Artifacts
REP[reports/report.html<br/>reports/junit.xml]
YAML[config/*.yaml<br/>test_config.yaml<br/>mum.example.yaml<br/>babylin.example.yaml — deprecated]
PSU_YAML[config/owon_psu.yaml<br/>OWON_PSU_CONFIG]
MELEXIS[Melexis pylin + pymumclient<br/>MUM @ 192.168.7.2]
SDK[vendor/BabyLIN_library.py<br/>platform-specific libs<br/>DEPRECATED]
OWON[vendor/Owon/owon_psu_quick_demo.py]
LDFFILE[vendor/*.ldf]
LDFLIB[ldfparser PyPI]
end
T --> CF
CF --> CFG
CF --> BASE
CF --> MOCK
CF --> MUM
CF --> BABY
CF --> FLASH
T --> POWER
T --> LDF
PL --> REP
CFG --> YAML
CFG --> PSU_YAML
MUM --> MELEXIS
BABY --> SDK
LDF --> LDFLIB
LDF --> LDFFILE
T --> OWON
T --> REP
```
## Data and control flow summary
- Tests use fixtures to obtain config and a connected LIN adapter
- Config loader reads YAML (or env override), returns typed dataclasses
- LIN calls are routed through the interface abstraction to the selected adapter
- Flasher (optional) uses the same interface to program the ECU
- Power supply control (optional) uses `ecu_framework/power/owon_psu.py` and reads
`config.power_supply` (merged with `config/owon_psu.yaml` or `OWON_PSU_CONFIG` when present);
the quick demo script under `vendor/Owon/` provides a quick manual flow
- Reporting plugin parses docstrings and enriches the HTML report
## Extending the architecture
- Add new bus adapters by implementing `LinInterface`
- Add new report sinks (e.g., JSON or a DB) by extending the plugin
- Add new fixtures for diagnostics or measurement tools (Scopes, power supplies, etc.)