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
DISPLAY_READ_INTERVAL = 1.0
FB_BYTES_PER_LINE = FB_PIXEL_WIDTH // FB_PIXELS_PER_BYTE
FB_PIXELS_PER_BYTE = 8 // FB_BITS_PER_PIXEL
FREQ_MAX = 3000000000_i64
Constructors
Config hash constructor (normal usage)
Sourcenew(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)
SourceInstance methods
detach
Called when the interface is being detached/removed
Sourcedisable_external_framebuffer
Sourceenable_external_framebuffer
Sourceget_battery_state_string
Sourceprocess_outgoing(data :
Bytes)
Send data out through the interface. Subclasses must implement this.
Sourcer_airtime_short
Channel and airtime metrics
Sourcer_airtime_short=(r_airtime_short :
Float64)
Channel and airtime metrics
Sourcer_csma_slot_time_ms=(r_csma_slot_time_ms :
Int32 |
Nil)
Sourcer_frequency
Reported radio state (from RNode device)
Sourcer_frequency=(r_frequency :
Int64 |
Nil)
Reported radio state (from RNode device)
Sourcer_preamble_symbols=(r_preamble_symbols :
Int32 |
Nil)
Sourcer_premable_time_ms=(r_premable_time_ms :
Int32 |
Nil)
Sourcer_st_alock
Airtime limits reported by device
Sourcer_st_alock=(r_st_alock :
Float64 |
Nil)
Airtime limits reported by device
Sourceshould_ingress_limit?
Determine when an interface should activate ingress limiting.
Subclasses may override for different behavior.
Sourceshould_read_display=(should_read_display :
Bool)
Sourcetcp=(tcp : RNodeTCPConnection | Nil)
Sourceteardown
Tear down the interface, releasing any resources (sockets, fibers, etc.).
Subclasses should override to close their specific resources.
SourceAppends 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>
Sourceuse_ble
BLE connection (stub — BLE not fully implementable in Crystal without native lib)
SourceBLE connection (stub — BLE not fully implementable in Crystal without native lib)
Source