Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Python binding of the yahdlc library

License

NotificationsYou must be signed in to change notification settings

SkypLabs/python4yahdlc

Repository files navigation

PyPI Package Latest ReleasePyPI Package Downloads Per MonthPyPI Package Python VersionsBuild Status

python4yahdlc is a Python binding of theyahdlc library, allowing to encode anddecodeHDLCframes.

Dependencies

This software requires Python 3.

Installation

From PyPI (recommended)

pip install --upgrade python4yahdlc

From sources

git clone https://github.com/SkypLabs/python4yahdlc.gitcd python4yahdlcgit submodule update --init --recursivepip install --upgrade.

Usage

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.

Development

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]

License

This project is released under theGPL version 3 license. Theyahdlc library is released under theMIT license.


[8]ページ先頭

©2009-2025 Movatter.jp