class

RNS::RNodeInterface

Inherits RNS::Interface < Reference < Object

RNode LoRa radio interface. Ports RNS/Interfaces/RNodeInterface.py (1558 LOC). Communicates with RNode hardware via KISS-based command protocol over serial, TCP, or BLE connections.

Constants

BATTERY_STATE_CHARGED = 3_u8
BATTERY_STATE_CHARGING = 2_u8
BATTERY_STATE_DISCHARGING = 1_u8
BATTERY_STATE_UNKNOWN = 0_u8
CALLSIGN_MAX_LEN = 32
DEFAULT_IFAC_SIZE = 8
DISPLAY_READ_INTERVAL = 1.0
FB_BITS_PER_PIXEL = 1
FB_BYTES_PER_LINE = FB_PIXEL_WIDTH // FB_PIXELS_PER_BYTE
FB_PIXEL_WIDTH = 64
FB_PIXELS_PER_BYTE = 8 // FB_BITS_PER_PIXEL
FREQ_MAX = 3000000000_i64
FREQ_MIN = 137000000_i64
MAX_CHUNK = 32768
Q_SNR_MAX = 6
Q_SNR_MIN_BASE = -9
Q_SNR_STEP = 2
RECONNECT_WAIT = 5
REQUIRED_FW_VER_MAJ = 1
REQUIRED_FW_VER_MIN = 52
RSSI_OFFSET = 157

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 | Nil = nil, frequency : Int64 = 0_i64, bandwidth : Int64 = 0_i64, txpower : Int32 = 0, sf : Int32 = 0, cr : Int32 = 0, flow_control : Bool = false, id_interval : Int32 | Nil = nil, id_callsign : String | Nil = nil, st_alock : Float64 | Nil = nil, lt_alock : Float64 | Nil = nil, open_port : Bool = false, inbound_callback : Proc(Bytes, Interface, Nil) | Nil = nil)

Explicit constructor for testing (no port opening)

Source

Instance methods

bandwidth
Source
bandwidth=(bandwidth : Int64)
Source
bitrate_kbps
Source
bitrate_kbps=(bitrate_kbps : Float64)
Source
ble_addr
Source
ble_addr=(ble_addr : String | Nil)
Source
ble_name
Source
ble_name=(ble_name : String | Nil)
Source
close_port
Source
configure_device
Source
cpu_temp
Source
cpu_temp=(cpu_temp : Int32 | Nil)
Source
cr=(cr : Int32)
Source
databits
Source
databits=(databits : Int32)
Source
detach

Called when the interface is being detached/removed

Source
detect
Source
detected

Device info

Source
detected=(detected : Bool)

Device info

Source
device_io

Expose IO for testing

Source
device_io=(io : IO | Nil)
Source
disable_external_framebuffer
Source
display
Source
display=(display : Bool | Nil)
Source
display_image(imagedata : Bytes)
Source
do_open_port
Source
enable_external_framebuffer
Source
firmware_ok
Source
firmware_ok=(firmware_ok : Bool)
Source
first_tx
Source
first_tx=(first_tx : Float64 | Nil)
Source
flow_control
Source
flow_control=(flow_control : Bool)
Source
frequency

Radio parameters

Source
frequency=(frequency : Int64)

Radio parameters

Source
get_battery_percent
Source
get_battery_state
Source
get_battery_state_string
Source
hard_reset
Source
hw_errors
Source
hw_errors=(hw_errors : Array(NamedTuple(error: UInt8, description: String)))
Source
id_callsign
Source
id_callsign=(id_callsign : Bytes | Nil)
Source
id_interval

ID beacon

Source
id_interval=(id_interval : Int32 | Nil)

ID beacon

Source
init_radio
Source
interface_ready
Source
interface_ready=(interface_ready : Bool)
Source
last_id
Source
last_id=(last_id : Float64)
Source
leave
Source
lt_alock
Source
lt_alock=(lt_alock : Float64 | Nil)
Source
maj_version
Source
maj_version=(maj_version : Int32)
Source
mcu=(mcu : UInt8 | Nil)
Source
min_version
Source
min_version=(min_version : Int32)
Source
packet_queue
Source
packet_queue=(packet_queue : Array(Bytes))
Source
platform
Source
platform=(platform : UInt8 | Nil)
Source
port

Configuration properties

Source
port=(port : String | Nil)

Configuration properties

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
r_airtime_long
Source
r_airtime_long=(r_airtime_long : Float64)
Source
r_airtime_short

Channel and airtime metrics

Source
r_airtime_short=(r_airtime_short : Float64)

Channel and airtime metrics

Source
r_bandwidth
Source
r_bandwidth=(r_bandwidth : Int64 | Nil)
Source
r_battery_percent
Source
r_battery_percent=(r_battery_percent : Int32)
Source
r_battery_state

Battery

Source
r_battery_state=(r_battery_state : UInt8)

Battery

Source
r_channel_load_long
Source
r_channel_load_long=(r_channel_load_long : Float64)
Source
r_channel_load_short
Source
r_channel_load_short=(r_channel_load_short : Float64)
Source
r_cr
Source
r_cr=(r_cr : Int32 | Nil)
Source
r_csma_cw_band
Source
r_csma_cw_band=(r_csma_cw_band : UInt8 | Nil)
Source
r_csma_cw_max
Source
r_csma_cw_max=(r_csma_cw_max : UInt8 | Nil)
Source
r_csma_cw_min
Source
r_csma_cw_min=(r_csma_cw_min : UInt8 | Nil)
Source
r_csma_difs_ms
Source
r_csma_difs_ms=(r_csma_difs_ms : Int32 | Nil)
Source
r_csma_slot_time_ms
Source
r_csma_slot_time_ms=(r_csma_slot_time_ms : Int32 | Nil)
Source
r_current_rssi

Signal quality

Source
r_current_rssi=(r_current_rssi : Int32 | Nil)

Signal quality

Source
r_disp
Source
r_disp=(r_disp : Bytes)
Source
r_disp_latency
Source
r_disp_latency=(r_disp_latency : Float64)
Source
r_disp_readtime
Source
r_disp_readtime=(r_disp_readtime : Float64)
Source
r_framebuffer

Framebuffer

Source
r_framebuffer=(r_framebuffer : Bytes)

Framebuffer

Source
r_framebuffer_latency
Source
r_framebuffer_latency=(r_framebuffer_latency : Float64)
Source
r_framebuffer_readtime
Source
r_framebuffer_readtime=(r_framebuffer_readtime : Float64)
Source
r_frequency

Reported radio state (from RNode device)

Source
r_frequency=(r_frequency : Int64 | Nil)

Reported radio state (from RNode device)

Source
r_interference
Source
r_interference=(r_interference : Int32 | Nil)
Source
r_interference_l
Source
r_interference_l=(r_interference_l : Array(Float64) | Nil)
Source
r_lock
Source
r_lock=(r_lock : UInt8 | Nil)
Source
r_lt_alock
Source
r_lt_alock=(r_lt_alock : Float64 | Nil)
Source
r_noise_floor
Source
r_noise_floor=(r_noise_floor : Int32 | Nil)
Source
r_preamble_symbols
Source
r_preamble_symbols=(r_preamble_symbols : Int32 | Nil)
Source
r_premable_time_ms
Source
r_premable_time_ms=(r_premable_time_ms : Int32 | Nil)
Source
r_random
Source
r_random=(r_random : UInt8 | Nil)
Source
r_sf
Source
r_sf=(r_sf : Int32 | Nil)
Source
r_st_alock

Airtime limits reported by device

Source
r_st_alock=(r_st_alock : Float64 | Nil)

Airtime limits reported by device

Source
r_stat_q
Source
r_stat_q=(r_stat_q : Float64 | Nil)
Source
r_stat_rssi
Source
r_stat_rssi=(r_stat_rssi : Int32 | Nil)
Source
r_stat_rx

Statistics

Source
r_stat_rx=(r_stat_rx : Int64 | Nil)

Statistics

Source
r_stat_snr
Source
r_stat_snr=(r_stat_snr : Float64 | Nil)
Source
r_stat_tx
Source
r_stat_tx=(r_stat_tx : Int64 | Nil)
Source
r_state
Source
r_state=(r_state : UInt8 | Nil)
Source
r_symbol_rate
Source
r_symbol_rate=(r_symbol_rate : Int32 | Nil)
Source
r_symbol_time_ms
Source
r_symbol_time_ms=(r_symbol_time_ms : Float64 | Nil)
Source
r_temperature
Source
r_temperature=(r_temperature : Int32 | Nil)
Source
r_txpower
Source
r_txpower=(r_txpower : Int32 | Nil)
Source
read_display
Source
read_display_interval
Source
read_display_interval=(read_display_interval : Float64)
Source
read_framebuffer
Source
reconnect_port
Source
reconnecting

Connection state

Source
reconnecting=(reconnecting : Bool)

Connection state

Source
reset_radio_state
Source
running=(v : Bool)
Source
running?
Source
set_bandwidth
Source
set_coding_rate
Source
set_frequency
Source
set_lt_alock
Source
set_radio_state(state : UInt8)
Source
set_spreading_factor
Source
set_st_alock
Source
set_tx_power
Source
sf=(sf : Int32)
Source
should_ingress_limit?

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

Source
should_read_display
Source
should_read_display=(should_read_display : Bool)
Source
speed
Source
speed=(speed : Int32)
Source
st_alock
Source
st_alock=(st_alock : Float64 | Nil)
Source
start_display_updates
Source
state

Operational state

Source
state=(state : UInt8)

Operational state

Source
stop_display_updates
Source
stopbits
Source
stopbits=(stopbits : Int32)
Source
tcp=(tcp : RNodeTCPConnection | Nil)
Source
tcp_host
Source
tcp_host=(tcp_host : String | Nil)
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
txpower
Source
txpower=(txpower : Int32)
Source
update_bitrate
Source
use_ble

BLE connection (stub — BLE not fully implementable in Crystal without native lib)

Source
use_ble=(use_ble : Bool)

BLE connection (stub — BLE not fully implementable in Crystal without native lib)

Source
use_tcp

TCP connection

Source
use_tcp=(use_tcp : Bool)

TCP connection

Source
validate_firmware
Source
validate_radio_state
Source
validcfg
Source
validcfg=(validcfg : Bool)
Source
write_framebuffer(line : Int32, line_data : Bytes)
Source