Commit 6c880896 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman 💥
Browse files

Added configuration for controlling echo output on received APRS packets

parent 2d20abbc
......@@ -99,11 +99,16 @@ module Peak
end
tnc_port = port_section['tnc_port']
port_map[port_name] = TncPort.new(kiss_tnc, port_name, port_identifier, port_net, true, tnc_port)
unless config_lookup_enforce(port_section, 'echo')
return nil
end
echo_state = port_section['echo']
port_map[port_name] = TncPort.new(kiss_tnc, port_name, port_identifier, port_net, echo_state, tnc_port)
end
end
end
return port_map
end
end
\ No newline at end of file
end
......@@ -3,7 +3,7 @@ require 'peak/echo'
module Peak
class TncPort
protected
def initialize(data_stream, name, identifier, net, echo_frames=false, port=0)
def initialize(data_stream, name, identifier, net, echo_frames = 'none', port=0)
@data_stream = data_stream
@port = port
@name = name
......@@ -25,7 +25,7 @@ module Peak
public
def read(*args, **kwargs)
read_frame = @data_stream.read(*args, **kwargs)
if @echo_frames and read_frame
if (@echo_frames == 'all' or @echo_frames == 'in') and read_frame
Peak::echo_color_frame(read_frame, @name, true)
end
return read_frame
......@@ -34,11 +34,11 @@ module Peak
public
def write(frame, *args, **kwargs)
@data_stream.write(frame, @port, *args, **kwargs)
if @echo_frames and frame
if (@echo_frames == 'all' or @echo_frames == 'out') and frame
Peak::echo_color_frame(frame, @name, false)
end
end
attr_reader :name, :net, :port, :identifier
end
end
\ No newline at end of file
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment