Skip to main content
Glama
test_decode_roundtrip.py744 B
import os import cantools from mcp_can.dbc import decode_frame def test_encode_decode_roundtrip_engine_status(): db_path = os.path.join(os.path.dirname(__file__), "..", "vehicle.dbc") db_path = os.path.abspath(db_path) db = cantools.database.load_file(db_path) msg = db.get_message_by_name("ENGINE_STATUS") signals = { "ENGINE_SPEED": 1500, "ENGINE_TEMP": 80, "THROTTLE_POSITION": 20, "ENGINE_LOAD": 30, "FUEL_LEVEL": 50, } data = msg.encode(signals) decoded = decode_frame(db, msg.frame_id, data) for key, value in signals.items(): assert key in decoded # Allow small floating rounding differences assert abs(decoded[key] - value) < 1.0

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/farzadnadiri/mcp-ecu'

If you have feedback or need assistance with the MCP directory API, please join our Discord server