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)
# or
# s = serial.Serial('/dev/tty0')
def frame_callback(data):
print(data)
h.startReader(onFrame=frame_callback, onError=error_callback)
h.sendFrame(b"hello")
```
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)
# or
# s = serial.Serial('/dev/tty0')
def frame_callback(data):
print(data)
h.startReader(onFrame=frame_callback, onError=error_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.
Source Distribution
simple-hdlc-0.1.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for simple_hdlc-0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cff679e877143f2abd35b3efcf7bbfea26572f14a74c682edf1c5a9c74dc7837 |
|
MD5 | e4494fd6f10d28173fe75f6c0cd4d6bb |
|
BLAKE2b-256 | bbda1ebde027d55762189e2a1f055e8a0f291b3cb460f1c11dc04b4e67b5086f |