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.0.tar.gz (8.5 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.0-py3.6.egg (18.9 kB view details)

Uploaded Egg

ldfparser-0.4.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ldfparser-0.4.0.tar.gz
  • Upload date:
  • Size: 8.5 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.0 CPython/3.6.12

File hashes

Hashes for ldfparser-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c08c0aa796e0fb44d9c4a11588c5256d38454b857038f16a384532a85eae005d
MD5 7ad07df65f38b38ce7127b10cd06a6dd
BLAKE2b-256 d1dd1af42eec5bca5b736fb41aecf62972966c55f10739cdae170a1cb22cae17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ldfparser-0.4.0-py3.6.egg
  • Upload date:
  • Size: 18.9 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.0 CPython/3.6.12

File hashes

Hashes for ldfparser-0.4.0-py3.6.egg
Algorithm Hash digest
SHA256 356b020859938bc8b6c7281acc3aa3b657163d6405c8a0ffcf074317e4fc87a4
MD5 dc2dae04b188a28ff47d24eb5c6cbac3
BLAKE2b-256 75f20e2f61ed86f06af367d2cab0a4662d5c2844c29f6625c8e43abd8e240d1b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ldfparser-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.0 CPython/3.6.12

File hashes

Hashes for ldfparser-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ea922cd8bb93c39a056cfb8fde678f2f5ff360eda4eafc4914661a6ccca0edb
MD5 d559459c3f9e86d2fb777d7fe95f2c3b
BLAKE2b-256 60ebc7dc1c32769046ef9a20ff2f11f590d0ef7601abbebca9f5ac089e83a45b

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