Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Syncleus
apex-aprs
Commits
e96c26cd
Commit
e96c26cd
authored
Sep 06, 2021
by
Jeffrey Phillips Freeman
💥
Browse files
Fixed bugs in aprs-is, it now appears fully functional
parent
93589cc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
+19
-21
lib/apex/igate_tcp.rb
lib/apex/igate_tcp.rb
+19
-21
No files found.
lib/apex/igate_tcp.rb
View file @
e96c26cd
require
'apex/app_info'
module
Apex
class
IGateTcp
DEFAULT_APRSIS_URL
=
'http://srvr.aprs-is.net:8080'
...
...
@@ -7,7 +9,7 @@ module Apex
protected
def
initialize
(
user
,
password
=
'-1'
)
@user
=
user
@auth
=
[
'user'
,
user
,
'pass'
,
password
,
'vers'
,
'
APEX
-APRS Ruby Module'
].
join
(
' '
)
@auth
=
[
'user'
,
user
,
'pass'
,
password
,
'vers'
,
"
APEX
#{
VERSION
}
"
].
join
(
' '
)
@aprsis_sock
=
nil
@data_buffer
=
''
@packet_buffer
=
[]
...
...
@@ -75,16 +77,16 @@ module Apex
port
=
DEFAULT_APRSIS_FILTER_PORT
end
unless
aprs_filter
aprs_filter
=
[
'p'
,
@user
].
join
(
'/'
)
if
aprs_filter
.
nil?
@full_auth
=
@auth
else
@full_auth
=
[
@auth
,
'filter'
,
aprs_filter
].
join
(
' '
)
end
@full_auth
=
[
@auth
,
'filter'
,
aprs_filter
].
join
(
' '
)
@server
=
server
@port
=
port
@aprsis_sock
=
TCPSocket
.
open
(
@server
,
@port
)
@aprsis_sock
.
puts
(
@full_auth
+
'
\r\n
'
)
@aprsis_sock
.
puts
(
@full_auth
+
"
\r\n
"
)
end
end
end
...
...
@@ -106,28 +108,24 @@ module Apex
# check if there is any data waiting
read_more
=
true
while
read_more
selected
=
IO
.
select
([
@aprsis_sock
],
[],
[],
0
)
if
selected
.
nil?
==
false
ready_len
=
selected
.
first
.
length
if
ready_len
>
0
recvd_data
=
@aprsis_sock
.
read
(
ready_len
)
if
recvd_data
@data_buffer
+=
recvd_data
end
end
else
read_more
=
false
begin
read_line
=
@aprsis_sock
.
read_nonblock
(
100
)
unless
read_line
.
nil?
@data_buffer
<<
read_line
end
rescue
IO
::
WaitReadable
read_more
=
false
end
end
# check for any complete packets and move them to the packet buffer
if
@data_buffer
.
include?
'
\r\n
'
if
@data_buffer
.
include?
"
\r\n
"
partial
=
true
if
@data_buffer
.
end_with?
'
\r\n
'
if
@data_buffer
.
end_with?
"
\r\n
"
partial
=
false
end
packets
=
@data_buffer
.
split
(
'
\r\n
'
)
packets
=
@data_buffer
.
split
(
"
\r\n
"
)
if
partial
@data_buffer
=
packets
.
pop
.
dup
else
...
...
@@ -142,7 +140,7 @@ module Apex
# return the next packet that matches the filter
while
@packet_buffer
.
length
>
0
packet
=
@packet_buffer
.
pop
unless
filter_logresp
and
packet
.
start_with?
(
'#'
)
and
packet
.
include?
'logresp'
unless
(
filter_logresp
and
packet
.
start_with?
(
'#'
)
)
return
IGateTcp
::
decode_frame
(
packet
)
end
end
...
...
Write
Preview
Markdown
is supported
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