Skip to main content

LDF Language support for Python

Project description

LDF Parser

Workflow PyPI version codecov.io License

This tool is able parse LIN Description Files, retrieve signal names and frames from them, as well as encoding messages using frame definitions and decoding them.


Example

import ldfparser

# Load LDF
ldf = ldfparser.LDF(path = "network.ldf")
frame = ldf.frame('Frame_1')

# Get baudrate from LDF
print(ldf.baudrate)

# Encode signal values into frame
message = frame.raw({"Signal_1": 123, "Signal_2": 0})
print(binascii.hexlify(message))
# >> 0x7B00

# Decode message into dictionary of signal names and values
received = bytearray([0x7B, 0x00])
print(frame.parse(received))
# >> {"Signal_1": 123, "Signal_2": 0}

# Encode signal values through converters
message = frame.data({"MotorRPM": 100, "FanState": "ON"}, ldf.converters)
print(binascii.hexlify(message))
# >> 0xFE01

Features

  • Semantic validation of LDF files

  • Retrieve header information (version, baudrate)

  • Retrieve Signal and Frame information

  • Retrieve Signal encoding types and use them to convert values

Currently not supported

  • Signals longer than 16 bits

  • Ascii and BCD signal values

  • Node attributes

  • Scheduling table

  • Diagnostics


Installation

Install via pip install ldfparser


Credits

Inspired by uCAN-LIN LinUSBConverter, specifically the LDF parsing mechanism via Lark


License

License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ldfparser-0.4.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ldfparser-0.4.1-py3.6.egg (19.0 kB view details)

Uploaded Egg

ldfparser-0.4.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file ldfparser-0.4.1.tar.gz.

File metadata

  • Download URL: ldfparser-0.4.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.12

File hashes

Hashes for ldfparser-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0bc3e3221b72bf0bebfabf1c87a1f1d16fdc539d9c59f15e3cd5a4d57b0d8f2a
MD5 0b32494748b9436cf3bf92ba55155204
BLAKE2b-256 93ad030a8af3e62a9ec72005ebb1b5385ad050fa7f2ebd35174de9bd14c63986

See more details on using hashes here.

File details

Details for the file ldfparser-0.4.1-py3.6.egg.

File metadata

  • Download URL: ldfparser-0.4.1-py3.6.egg
  • Upload date:
  • Size: 19.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.12

File hashes

Hashes for ldfparser-0.4.1-py3.6.egg
Algorithm Hash digest
SHA256 4db80211597c466dae0f0729c320a9ffcb28a07748639046b98bcd1e5e845d89
MD5 79f47ff10b9d72a3e36d4cab777354d6
BLAKE2b-256 2ed13c65727cc4e0e166129827962eac19579eba18f428a21a8b443b7fc5739b

See more details on using hashes here.

File details

Details for the file ldfparser-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: ldfparser-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.12

File hashes

Hashes for ldfparser-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d8790a93bd5c72a0829cbc9be3e38cf93f74be2759f7f106c6f6d7c20d2ade8
MD5 dc635fc374c90b4ceda3ceeead81431a
BLAKE2b-256 b5f97ba0d9a8f4c09da10017ac79866f169c9174d82a970ebc3602fca54573ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page