This folder contains several code examples of the use of python4yahdlc.
The code examples work in pairs: send_data_frame.py works with receive_data_frame.py and fsm_endpoint_1.py works with fsm_endpoint_2.py.
To make the two code examples of each pair work together, you need a serial bus of communication. The easiest way to set up a serial bus is to use a virtual one. socat is a great tool for carrying out this task:
socat -d -d socat -d -d pty,raw,echo=0 pty,raw,echo=0
This command will create two virtual devices such as /dev/pts/5 and /dev/pts/6. Everything you write in /dev/pts/5 will be echoed in /dev/pts/6 and vice versa.
These two code examples need pyserial as dependency:
pip3 install pyserial
These two code examples need pyserial and fysom as dependencies:
pip3 install pyserial fysom
fysom is used to define the Finite-State Machines (FSM) of the two endpoints.
The sending FSM endpoint:
The receiving FSM endpoint:

