class

RNS::KISSInterface

Inherits RNS::Interface < Reference < Object

KISS TNC interface for serial port communication. Ports RNS/Interfaces/KISSInterface.py using POSIX termios + KISS framing.

Constants

BITRATE_GUESS = 1200_i64
DEFAULT_IFAC_SIZE = 8
MAX_CHUNK = 32768
PARITY_EVEN = :even
PARITY_NONE = :none
PARITY_ODD = :odd

Constructors

new(configuration : Hash(String, String), inbound_callback : Proc(Bytes, Interface, Nil) | Nil = nil)

Config hash constructor (normal usage)

Source
new(name : String, port : String, speed : Int32 = 9600, databits : Int32 = 8, parity_str : String = "N", stopbits : Int32 = 1, open_port : Bool = true, preamble : Int32 = 350, txtail : Int32 = 20, persistence : Int32 = 64, slottime : Int32 = 20, flow_control : Bool = false, beacon_interval : Int32 | Nil = nil, beacon_data : String = "", inbound_callback : Proc(Bytes, Interface, Nil) | Nil = nil)

Explicit params constructor (for testing without opening port)

Source

Class methods

build_kiss_frame(data : Bytes) : Bytes

Build a KISS data frame: FEND + 0x00 + escaped(data) + FEND

Source

Instance methods

beacon_data
Source
beacon_data=(beacon_data : Bytes)
Source
beacon_interval

Beacon / identification

Source
beacon_interval=(beacon_interval : Int32 | Nil)

Beacon / identification

Source
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
first_tx
Source
first_tx=(first_tx : Float64 | Nil)
Source
flow_control

Flow control

Source
flow_control=(flow_control : Bool)

Flow control

Source
flow_control_locked
Source
flow_control_locked=(flow_control_locked : Float64)
Source
flow_control_timeout
Source
flow_control_timeout=(flow_control_timeout : Int32)
Source
interface_ready
Source
interface_ready=(interface_ready : Bool)
Source
packet_queue
Source
packet_queue=(packet_queue : Array(Bytes))
Source
parity
Source
parity=(parity : Symbol)
Source
persistence
Source
persistence=(persistence : Int32)
Source
port
Source
port=(port : String)
Source
port_open?
Source
preamble

KISS TNC parameters

Source
preamble=(preamble : Int32)

KISS TNC parameters

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

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

Source
process_queue
Source
queue(data : Bytes)
Source
reconnect_port
Source
running=(v : Bool)
Source
running?
Source
serial_io

Expose IO for testing

Source
serial_io=(io : IO::FileDescriptor | Nil)

Allow setting IO for pipe-based testing

Source
set_flow_control(flow_control : Bool)
Source
set_persistence(persistence : Int32)
Source
set_preamble(preamble_ms : Int32)
Source
set_slot_time(slottime_ms : Int32)
Source
set_tx_tail(txtail_ms : Int32)
Source
should_ingress_limit?

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

Source
slottime
Source
slottime=(slottime : Int32)
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
txtail
Source
txtail=(txtail : Int32)
Source