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

Uploaded Egg

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ldfparser-0.3.0.tar.gz
  • Upload date:
  • Size: 7.9 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.0.tar.gz
Algorithm Hash digest
SHA256 ca5092c5940777ef1871c453d67e1d81fac0f80cfeb01969bc08f48527aadd0e
MD5 9f4aec32a1e05a76647e785e450c9211
BLAKE2b-256 bb95f57f273402c0698943c72be7ab756ff8c576a6366cbcc65dafd1c162bfd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ldfparser-0.3.0-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.0-py3.6.egg
Algorithm Hash digest
SHA256 cca9ebcfa45f987d06ff89923b5b4b58d1b02f8469956a124f500f67ee28adad
MD5 073c61bdc2f1caaeedec0f5ece1db12b
BLAKE2b-256 4378761fd25ecf40530bdee4108f68950e2504bc0b3102c3c30d60b31920567e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ldfparser-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0803fa702d5f6867e2b04d4bb0c31ded0e2ef4960c5fdb5d32adbca722a3a3a
MD5 e2d6298fca20b78ab135c7e213a073ca
BLAKE2b-256 64e16bf21573bdaffa69c85d118e573f1fcba1df982fd2609b5fcb24ed96aa0d

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