class

RNS::SerialInterface

Inherits RNS::Interface < Reference < Object

Serial port communication interface using HDLC framing. Ports RNS/Interfaces/SerialInterface.py using POSIX termios.

Constants

DEFAULT_IFAC_SIZE = 8
MAX_CHUNK = 32768
PARITY_EVEN = :even
PARITY_NONE = :none

Parity modes

PARITY_ODD = :odd

Constructors

new(configuration : Hash(String, String), inbound_callback : Proc(Bytes, Interface, Nil) | Nil = nil)
Source
new(name : String, port : String, speed : Int32 = 9600, databits : Int32 = 8, parity : String = "N", stopbits : Int32 = 1, open_port : Bool = true, inbound_callback : Proc(Bytes, Interface, Nil) | Nil = nil)

Constructor for testing: create with explicit parameters, no port opening

Source

Instance methods

close_port
Source
configure_device
Source
databits
Source
databits=(databits : Int32)
Source
detach

Called when the interface is being detached/removed

Source
do_open_port
Source
parity
Source
parity=(parity : Symbol)
Source
port
Source
port=(port : String)
Source
port_open?

For testing: check if port is open

Source
process_incoming(data : Bytes)
Source
process_outgoing(data : Bytes)

Send data out through the interface. Subclasses must implement this.

Source
reconnect_port
Source
should_ingress_limit?

Determine when an interface should activate ingress limiting. Subclasses may override for different behavior.

Source
speed
Source
speed=(speed : Int32)
Source
stopbits
Source
stopbits=(stopbits : Int32)
Source
teardown

Tear down the interface, releasing any resources (sockets, fibers, etc.). Subclasses should override to close their specific resources.

Source
timeout
Source
timeout=(timeout : Int32)
Source
to_s(io : IO)

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source