Skip to main content

DLE/STX/ETX packet encoder/decoder

Project description

latest release on PyPI build & test status test coverage status

DLE/STX/ETX is a packet framing algorithm, used by some devices (such as Metlink LED passenger information displays) to transmit data as packets over a serial medium. This algorithm delimits data using DLE, STX, and ETX control codes.

Packets begin with a DLE STX sequence, follow with a byte-stuffed data stream (all DLE bytes in the data are conveyed as DLE DLE), and end with a DLE ETX sequence.

The dlestxetx module provides functions to encode data into packets:

>>> from dlestxetx import encode
>>> encode(b'\x01\x10\x05')
b'\x10\x02\x01\x10\x10\x05\x10\x03'

decode packets into data:

>>> from dlestxetx import decode
>>> decode(b'\x10\x02\x01\x10\x10\x05\x10\x03')
b'\x01\x10\x05'

and read packets directly from file objects:

>>> from dlestxetx import read
>>> packets = BytesIO(encode(b'\x04\x05\x06') + encode(b'\x07\x08\x09'))
>>> read(packets)
b'\x04\x05\x06'
>>> read(packets)
b'\x07\x08\x09'

Installation

Install this module from PyPI using pip:

pip install dlestxetx

Changes

1.0.1

Add support for Python 3.5.

1.0.0

Initial release.

Contribute

Support

License

This project is licensed under the MIT 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

dlestxetx-1.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

dlestxetx-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file dlestxetx-1.0.1.tar.gz.

File metadata

  • Download URL: dlestxetx-1.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for dlestxetx-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d639fbcb94ac36320ffe833829c8eb9201a959124c849f9fff91c3cd44d04fd2
MD5 f72e0d8dc7fad250af58d204d7421e15
BLAKE2b-256 25be04fce66ae06665567ba7cc831db31415c39258d935c687941495b223e51c

See more details on using hashes here.

File details

Details for the file dlestxetx-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: dlestxetx-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for dlestxetx-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 711c8de64ded4442203acc6181bdb0362434274aa8bd4079f65fb5a493f35294
MD5 5d715c22308ccbfa6034d30866ee5dcd
BLAKE2b-256 5211a3faee518484baa41895fc6de0501d77c1a51993b0ffebccbf4eac6d45fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page