Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peak
peak
Commits
65d342f4
Commit
65d342f4
authored
Sep 05, 2021
by
Jeffrey Phillips Freeman
💥
Browse files
Added IGATE support and ability to add all incoming packets to the igate
parent
a858fc91
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/peak/config_loader.rb
View file @
65d342f4
...
...
@@ -2,6 +2,7 @@ require 'yaml'
require
'peak/tnc_port'
require
'apex/aprs_kiss'
require
'kiss'
require
'aprs_is'
module
Peak
def
self
.
find_config
(
verbose
,
config_paths
=
[])
...
...
@@ -34,8 +35,34 @@ module Peak
end
def
self
.
init_port_map
(
config
)
igate_server
=
nil
igate_callsign
=
nil
igate_server_port
=
14580
igate_password
=
nil
config
.
each
do
|
section_name
,
section_content
|
if
section_name
.
eql?
(
'IGATE'
)
return
nil
unless
config_lookup_enforce
(
section_content
,
'server'
)
igate_server
=
section_content
[
'server'
]
return
nil
unless
config_lookup_enforce
(
section_content
,
'callsign'
)
igate_callsign
=
section_content
[
'callsign'
]
igate_server_port
=
section_content
[
'server_port'
]
if
section_content
.
key?
'server_port'
return
nil
unless
config_lookup_enforce
(
section_content
,
'password'
)
igate_password
=
section_content
[
'pasword'
]
end
end
igate
=
nil
unless
igate_server
.
nil?
igate
=
AprsIs
::
Client
.
new
(
hostname:
igate_server
,
port:
igate_server_port
)
igate
.
login
(
igate_callsign
)
end
port_map
=
{}
config
.
each
do
|
section_name
,
section_content
|
if
section_name
.
start_with?
(
'TNC '
)
tnc_name
=
section_name
.
strip
.
split
(
' '
)[
1
].
strip
...
...
@@ -104,9 +131,10 @@ module Peak
end
echo_state
=
port_section
[
'echo'
]
port_map
[
port_name
]
=
TncPort
.
new
(
kiss_tnc
,
port_name
,
port_identifier
,
port_net
,
echo_state
,
tnc_port
)
port_map
[
port_name
]
=
TncPort
.
new
(
kiss_tnc
,
port_name
,
port_identifier
,
port_net
,
echo_state
,
tnc_port
,
igate
=
igate
)
end
end
end
return
port_map
...
...
lib/peak/tnc_port.rb
View file @
65d342f4
...
...
@@ -3,13 +3,14 @@ require 'peak/echo'
module
Peak
class
TncPort
protected
def
initialize
(
data_stream
,
name
,
identifier
,
net
,
echo_frames
=
'none'
,
port
=
0
)
def
initialize
(
data_stream
,
name
,
identifier
,
net
,
echo_frames
=
'none'
,
port
=
0
,
igate
=
nil
)
@data_stream
=
data_stream
@port
=
port
@name
=
name
@identifier
=
identifier
@net
=
net
@echo_frames
=
echo_frames
@igate
=
igate
end
public
...
...
@@ -25,6 +26,7 @@ module Peak
public
def
read
(
*
args
,
**
kwargs
)
read_frame
=
@data_stream
.
read
(
*
args
,
**
kwargs
)
@igate
.
send_message
(
read_frame
)
unless
@igate
.
nil?
if
(
@echo_frames
==
'all'
or
@echo_frames
==
'in'
)
and
read_frame
Peak
::
echo_color_frame
(
read_frame
,
@name
,
true
)
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment