aprs-is 0.0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/aprs-is.rb +74 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 11ae1073951014edfd65a2fce321abbddfd2e4e7
|
4
|
+
data.tar.gz: bb7a3eba68ff6f4c0927ffe4d86b2736bebe508d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20a3a9bbd0f4ac7a7cd652725563ad66d7fe8f5bdca3a679adc76af106306e5628aeabd932036b13789e86a244268ab62c595caf0bb16454bad6f3f07e2b2e9d
|
7
|
+
data.tar.gz: 15c5bd6ed189fe7a47d5e87f1ade65e9e08437c55df338949dffee3b2e7a899ec7bc251c9301d357a681756eeef76388cb08303bd23e392284ee877c733c607c
|
data/lib/aprs-is.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'socket'
|
2
|
+
|
3
|
+
class Aprs
|
4
|
+
def initialize(server, port, call, version)
|
5
|
+
@server = server
|
6
|
+
@port = port
|
7
|
+
@call = call
|
8
|
+
@version = version
|
9
|
+
end
|
10
|
+
|
11
|
+
def connect
|
12
|
+
@socket = TCPSocket.open(@server, @port)
|
13
|
+
@socket.puts "#{@server} #{@port}"
|
14
|
+
pass = self.passcode(@call.upcase)
|
15
|
+
@socket.puts "user #{@call.upcase} pass #{pass} ver \"#{@version}\""
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def msg_filter()
|
20
|
+
until @socket.eof? do
|
21
|
+
msg = @socket.gets
|
22
|
+
self.msg_dis(msg)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def msg_raw()
|
27
|
+
until @socket.eof? do
|
28
|
+
msg = @socket.gets
|
29
|
+
self.msg_dis_raw(msg)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def msg_dis(msg)
|
35
|
+
Thread.new do
|
36
|
+
msg.gsub!(/.*::/, "").gsub!(/\s*[:]/, ": ") #filters out data leaving only callsign and message
|
37
|
+
puts "Debug(Incomming): #{msg}" if msg =~ /#{@call.upcase}/
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def msg_dis_raw(msg)
|
42
|
+
Thread.new do
|
43
|
+
puts "Debug(Incoming): #{msg}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def send_msg(msg, sendto)
|
48
|
+
@socket.puts "#{@call.upcase}>APRS,TCPIP*,qAC,THIRD::#{sendto.upcase} :#{msg}" #3 spaces between call and msg
|
49
|
+
end
|
50
|
+
|
51
|
+
def packet(position, comment)
|
52
|
+
init = "#{@call.upcase}>APRS,TCPIP*:"
|
53
|
+
send = "#{init}#{position} #{comment}"
|
54
|
+
puts "Debug(Outgoing): #{send}"
|
55
|
+
@socket.puts "#{send}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def passcode(call_sign) ## credit to https://github.com/xles/aprs-passcode/blob/master/aprs_passcode.rb
|
59
|
+
call_sign.upcase!
|
60
|
+
call_sign.slice!(0,call_sign.index('-')) if call_sign =~ /-/
|
61
|
+
hash = 0x73e2
|
62
|
+
flag = true
|
63
|
+
call_sign.split('').each{|c|
|
64
|
+
hash = if flag
|
65
|
+
(hash ^ (c.ord << 8))
|
66
|
+
else
|
67
|
+
(hash ^ c.ord)
|
68
|
+
end
|
69
|
+
flag = !flag
|
70
|
+
}
|
71
|
+
hash & 0x7fff
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aprs-is
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harold Giddings/KR0SIV
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Allows you to interact with the APRS-IS network with your ruby applications
|
14
|
+
email:
|
15
|
+
- harold@giddings.me
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/aprs-is.rb
|
21
|
+
homepage: https://github.com/KR0SIV
|
22
|
+
licenses: []
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.14
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: A ruby wrapper to access the APRS-IS network
|
44
|
+
test_files: []
|