- Notifications
You must be signed in to change notification settings - Fork16
Python binding of the yahdlc library
License
NotificationsYou must be signed in to change notification settings
SkypLabs/python4yahdlc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
python4yahdlc is a Python binding of theyahdlc library, allowing to encode anddecodeHDLCframes.
This software requires Python 3.
pip install --upgrade python4yahdlc
git clone https://github.com/SkypLabs/python4yahdlc.gitcd python4yahdlcgit submodule update --init --recursivepip install --upgrade.
To generate a new HDLC data frame:
fromyahdlcimport*frame=frame_data('hello world!')
To generate a new HDLCACK
frame with a specific sequence number:
frame=frame_data('',FRAME_ACK,3)
The highest sequence number is 7 and the following frame types are available:
FRAME_DATA
FRAME_ACK
FRAME_NACK
Note that when you generate anACK
orNACK
frame, the payload isuseless.
To decode a received HDLC frame:
data,ftype,seq_no=get_data(frame)
For a more advanced use, take a look at the examples available in theexamples folder.
To set up a development environment on your local machine:
# Clone the Git repository and initialise its sub-modules.git clone https://github.com/SkypLabs/python4yahdlc.gitcd python4yahdlcgit submodule update --init --recursive# Create a virtual environment and activate it.python -m venv .venvsource .venv/bin/activate# Make sure to have the latest versions of pip and setuptools.pip install --upgrade pip setuptools# Install python4yahdlc in editable mode with all its optional# dependencies.pip install -e .[examples,tests]
This project is released under theGPL version 3 license. Theyahdlc library is released under theMIT license.
About
Python binding of the yahdlc library