Skip to main content

LDF Language support for Python

Project description

LDF Parser

Workflow 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.3.1.tar.gz (8.0 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.3.1-py3.6.egg (18.6 kB view details)

Uploaded Egg

ldfparser-0.3.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ldfparser-0.3.1.tar.gz
  • Upload date:
  • Size: 8.0 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.48.2 CPython/3.6.12

File hashes

Hashes for ldfparser-0.3.1.tar.gz
Algorithm Hash digest
SHA256 39c8beecb2afffce2590ed3aeda4ebd52bb02f4d6e948347f7b1df6b7662a485
MD5 d7977742d2aaa882a7b9fb8f329b3be3
BLAKE2b-256 48a9bd2c2b4cf5a639fc7c947992514af1b09d0b989b2e2962994096746ab3b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ldfparser-0.3.1-py3.6.egg
  • Upload date:
  • Size: 18.6 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.48.2 CPython/3.6.12

File hashes

Hashes for ldfparser-0.3.1-py3.6.egg
Algorithm Hash digest
SHA256 2e0dbfa12760b482e8003012225644e57a437c114b86c162c81d55abbb0a47a7
MD5 1c2045b54aef84e579d34b522f5f6071
BLAKE2b-256 0d6b69167d602db1f769536ecc6bdb70dc43ab17c5f7ef616b14ce477dc5b98c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ldfparser-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 05fe683ecb3193cd0da7daf904af4e1180d6a71b5437dcae328c53c656d4cfda
MD5 8c6cbc9701307ab50e65e7c9bd90bcff
BLAKE2b-256 d00027e6459e972e9e17ebb42ffce6d2972298518d3bba3f3b8332eb0d13faa8

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