HDLController¶
- class hdlcontroller.hdlcontroller.HDLController(read_func: Callable[[], bytes], write_func: Callable[[bytes], Optional[int]], sending_timeout: Timeout = 2.0, window: int = 3, frames_queue_size: int = 0, fcs_nack: bool = True)[source]¶
An HDLC controller based on python4yahdlc.
- class Receiver(read_func: Callable[[], bytes], write_func: Callable[[bytes], Optional[int]], send_lock: allocate_lock, senders_list: Dict[SequenceNumber, Sender], frames_received: Queue, callback: Optional[Callable[[bytes], None]] = None, fcs_nack: bool = True)[source]¶
Thread used to receive HDLC frames.
- run()[source]¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- class Sender(write_func: Callable[[bytes], Optional[int]], send_lock: allocate_lock, data: bytes, seq_no: SequenceNumber, timeout: Timeout = 2.0, callback: Optional[Callable[[bytes], None]] = None)[source]¶
Thread used to send HDLC frames.
- ack_received() None [source]¶
Informs the sender that the related ACK frame has been received. As a consequence, the current thread is being stopped.
- nack_received() None [source]¶
Informs the sender that an NACK frame has been received. As a consequence, the data frame is being resent.
- run() None [source]¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- get_data() bytes [source]¶
Gets the next frame received.
This method will block until a new data frame is available.
- send(data: bytes) None [source]¶
Sends a new data frame.
This method will block until a new room is available for a new sender. This limit is determined by the size of the window.
- set_receive_callback(callback: Callable[[bytes], None]) None [source]¶
Sets the receive callback function.
This method has to be called before starting the HDLC controller.