LDF Language support for Python
Project description
LDF Parser
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')
# Encode signal values into frame
message = frame.data({"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}
Installation
Install via pip install ldfparser
Credits
Inspired by uCAN-LIN LinUSBConverter, specifically the LDF parsing mechanism via Lark
License
Project details
Release history Release notifications | RSS feed
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.1.0.tar.gz
(5.2 kB
view hashes)
Built Distributions
ldfparser-0.1.0-py3.6.egg
(11.1 kB
view hashes)
Close
Hashes for ldfparser-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e390e2e1176086d2536d77b0e3a33537880993a2f332978ac5abb264362205be |
|
MD5 | 09334fc66cf169463924115c0857f37d |
|
BLAKE2b-256 | e67ca193e8b29c18283be2bae43d19df704de956f917087999f762f7c2ed7455 |