Skip to main content

Simple HDLC Protocol

Project description

# simple-hdlc
Simple HDLC Protocol

Used for simple communication with devices. Framing of serial data.

## Usage

Use with instance of In/Output with read and write methods (like pyserial).

Blocking Read:

```python
from simple_hdlc import HDLC
import serial

s = serial.serial_for_url('loop://', timeout=1)
# or
# s = serial.Serial('/dev/tty0')

h = HDLC(s)
h.sendFrame(b"hello")
print h.readFrame() # Blocking
```

Reader Thread with callback:

```python
from simple_hdlc import HDLC
import serial

s = serial.serial_for_url('loop://', timeout=1)
h = HDLC(s)
# or
# s = serial.Serial('/dev/tty0')

def frame_callback(data):
print(data)

h.startReader(onFrame=frame_callback)
h.sendFrame(b"hello")
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simple-hdlc, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size simple_hdlc-0.2-py2-none-any.whl (5.2 kB) File type Wheel Python version py2 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page