Files
CANveyor/vehicle/__init__.py
T
eeeck dd38751a7c Implement a modular vehicle decoding system
- Add Komatsu specific rules
- Possibility to expand to any brand
2026-07-23 00:03:00 +02:00

20 lines
624 B
Python

# 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")