Implement a modular vehicle decoding system

- Add Komatsu specific rules
- Possibility to expand to any brand
This commit is contained in:
2026-07-23 00:03:00 +02:00
parent fab448785b
commit dd38751a7c
4 changed files with 253 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# File: vehicle/__init__.py
# Copyright (C) 2026 Erick Ahmed
# SPDX-License-Identifier: AGPL-3.0-or-later
import importlib
def get_vehicle_module(brand: str):
"""
Dynamically imports the correct decoder module based on the vehicle brand.
Falls back to 'vehicle.generic' if a specific brand module is not found.
"""
if not brand:
return importlib.import_module("vehicle.generic")
module_name = f"vehicle.{brand.lower().replace(' ', '_')}"
try:
return importlib.import_module(module_name)
except ModuleNotFoundError:
return importlib.import_module("vehicle.generic")