peak 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.rdoc +38 -10
- data/lib/peak.rb +16 -20
- data/lib/peak/app_info.rb +1 -1
- data/lib/peak/config_loader.rb +2 -0
- data/lib/peak/plugins/apex_paradigm.rb +3 -7
- data/lib/peak/plugins/beacon.rb +49 -5
- data/lib/peak/plugins/id.rb +52 -8
- data/lib/peak/plugins/status.rb +52 -8
- metadata +2 -3
- data/README.md +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b395c9e001b9be92ec7523d17b639f45551d64b
|
4
|
+
data.tar.gz: bbb594e7ea2200d8a9452be19ef03115b21aecee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d45e7971b96c7996477fd314f19bb6763e9e0e2dfbebabf211f3d7aeb6dc548163771a09c50ec13b2f67db851dd4e17ed0d69749861e44743e5e98ac4ddd0ec
|
7
|
+
data.tar.gz: f61760fa1c991287e410e042dbb3dca2d1f1397468c6599b86df77f50cc9a04ed6befd70d6493a10e9cdb1336d57d7ca263857b995e87dfd3e5e44c8748489fa
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.1
|
4
|
+
|
5
|
+
* Added beacon plugin to transmit beacon every 10 minutes.
|
6
|
+
* Added id plugin to transmit id packet every 10 minutes.
|
7
|
+
* Added status plugin to transmit status packet every 10 minutes.
|
8
|
+
* Made plugin architecture multi-threaded.
|
9
|
+
|
3
10
|
## 1.0.0
|
4
11
|
|
5
12
|
* Initial release
|
data/README.rdoc
CHANGED
@@ -1,19 +1,47 @@
|
|
1
|
-
=
|
1
|
+
= Peak
|
2
2
|
|
3
|
-
|
4
|
-
Copyright:: Copyright (c) 2016 YOUR NAME
|
3
|
+
{<img src="https://badge.fury.io/rb/peak.svg" alt="Gem Version" />}[https://badge.fury.io/rb/peak]
|
5
4
|
|
5
|
+
Author:: Jeffrey Phillips Freeman, WI2ARD (freemo@gmail.com)
|
6
|
+
Copyright:: Copyright (c) 2016 Syncleus, Inc.
|
6
7
|
|
7
|
-
|
8
|
+
Peak is a full suite APRS client and reference implementation for the APEX protocol. APEX is a next generation APRS
|
9
|
+
based protocol. This repository represents the official application implementing APEX. It is a full-feature application
|
10
|
+
for digipeating, compatible with most AX.25 KISS TNC devices, and utilizing the full APEX stack.
|
8
11
|
|
9
|
-
|
12
|
+
For more information on the project please check out {the project's home page}[http://apexprotocol.com/].
|
13
|
+
|
14
|
+
Peak is Free and Open-source software under Apache Software License v2
|
15
|
+
|
16
|
+
== Installation
|
17
|
+
|
18
|
+
Install the application using gem.
|
19
|
+
|
20
|
+
gem install peak
|
21
|
+
|
22
|
+
== Running the app
|
10
23
|
|
11
|
-
|
12
|
-
|
24
|
+
Once installed copy the peak.conf.example file over to peak.conf in the /etc directory, then edit the file and replace
|
25
|
+
it with your details. Next just run the application with the following command.
|
13
26
|
|
14
|
-
|
27
|
+
peak run
|
15
28
|
|
16
|
-
|
29
|
+
There isn't much to the application right now, the application is still pre-release so more features and configuration
|
30
|
+
options should be added soon. For now the application will display all packets read in and send out a status, id, and
|
31
|
+
beacon packet every 10 minutes.
|
32
|
+
|
33
|
+
This is Free software: Apache License v2
|
34
|
+
|
35
|
+
== Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive
|
38
|
+
prompt that will allow you to experiment.
|
39
|
+
|
40
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
41
|
+
version number in `app_info.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
42
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
43
|
+
|
44
|
+
== Links
|
17
45
|
|
18
|
-
|
46
|
+
* {Source on Github}[https://github.com/Syncleus/peak]
|
19
47
|
|
data/lib/peak.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'kiss/kiss_serial'
|
2
|
-
require 'apex/aprs_kiss'
|
3
|
-
require 'peak/app_info'
|
4
|
-
require 'peak/plugins/plugin_factory'
|
5
1
|
require 'peak/echo'
|
6
2
|
require 'peak/config_loader'
|
7
3
|
require 'peak/plugin_loader'
|
@@ -12,31 +8,31 @@ module Peak
|
|
12
8
|
config = find_config(true)
|
13
9
|
port_map = init_port_map(config)
|
14
10
|
|
15
|
-
|
11
|
+
active_plugins = {}
|
16
12
|
plugins = load_plugins
|
17
13
|
plugins.each do |plugin|
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
active_plugin = plugin.new(config, port_map, nil)
|
15
|
+
active_plugin_thread = Thread.new {
|
16
|
+
active_plugin.run
|
17
|
+
}
|
18
|
+
active_plugins[active_plugin] = active_plugin_thread
|
21
19
|
end
|
22
20
|
|
23
|
-
#
|
24
|
-
beacon_frame = {:source => 'WI2ARD-2',
|
25
|
-
:destination => 'APRS',
|
26
|
-
:path => ['WIDE1-1', 'WIDE2-2'],
|
27
|
-
:text => '!/:=i@;N.G& --PHG5790/G/D R-I-R H24 C30'}
|
28
|
-
port_map.values.each do |tnc_port|
|
29
|
-
tnc_port.write(beacon_frame)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Display any packets we read in.
|
21
|
+
# Handle any packets we read in.
|
33
22
|
while true
|
23
|
+
something_read = false
|
34
24
|
port_map.values.each do |tnc_port|
|
35
25
|
frame = tnc_port.read
|
36
|
-
|
37
|
-
|
26
|
+
if frame
|
27
|
+
something_read = true
|
28
|
+
active_plugins.each_key do |plugin|
|
29
|
+
plugin.handle_packet(frame, tnc_port)
|
30
|
+
end
|
38
31
|
end
|
39
32
|
end
|
33
|
+
unless something_read
|
34
|
+
sleep(1)
|
35
|
+
end
|
40
36
|
end
|
41
37
|
end
|
42
38
|
end
|
data/lib/peak/app_info.rb
CHANGED
data/lib/peak/config_loader.rb
CHANGED
@@ -1,27 +1,23 @@
|
|
1
1
|
module Peak
|
2
2
|
module Plugins
|
3
|
-
class
|
3
|
+
class ApexParadigm
|
4
4
|
protected
|
5
5
|
def initialize(config, port_map, aprsis)
|
6
|
-
puts 'PeakParadigm inited'
|
7
6
|
end
|
8
7
|
|
9
8
|
public
|
10
9
|
def run
|
11
|
-
puts 'PeakParadigm ran'
|
12
10
|
end
|
13
11
|
|
14
12
|
public
|
15
13
|
def stop
|
16
|
-
puts 'PeakParadigm stop'
|
17
14
|
end
|
18
15
|
|
19
16
|
public
|
20
|
-
def handle_packet(frame, recv_port
|
21
|
-
puts 'PeakParadigm handled packet'
|
17
|
+
def handle_packet(frame, recv_port)
|
22
18
|
end
|
23
19
|
end
|
24
20
|
|
25
|
-
PluginFactory.register_plugin(
|
21
|
+
PluginFactory.register_plugin(ApexParadigm)
|
26
22
|
end
|
27
23
|
end
|
data/lib/peak/plugins/beacon.rb
CHANGED
@@ -3,22 +3,66 @@ module Peak
|
|
3
3
|
class Beacon
|
4
4
|
protected
|
5
5
|
def initialize(config, port_map, aprsis)
|
6
|
-
|
6
|
+
@port_configs = {}
|
7
|
+
@aprsis = aprsis
|
8
|
+
@running = false
|
9
|
+
|
10
|
+
config.each do |section_name, section_content|
|
11
|
+
if section_name.start_with?('TNC ')
|
12
|
+
tnc_name = section_name.strip.split(' ')[1].strip
|
13
|
+
(1..section_content['port_count']).each do |port_id|
|
14
|
+
port_name = tnc_name + '-' + port_id.to_s
|
15
|
+
port = port_map[port_name]
|
16
|
+
port_section = 'PORT ' + port_name
|
17
|
+
@port_configs[port] = {:beacon_text => config[port_section]['beacon_text'],
|
18
|
+
:beacon_path => config[port_section]['beacon_path']
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def self.now
|
27
|
+
Time.now.to_i
|
7
28
|
end
|
8
29
|
|
9
30
|
public
|
10
31
|
def run
|
11
|
-
|
32
|
+
@running = true
|
33
|
+
|
34
|
+
# Don't do anything in the first 30 seconds
|
35
|
+
last_trigger = Beacon::now
|
36
|
+
while @running and Beacon::now - last_trigger < 30
|
37
|
+
sleep(1)
|
38
|
+
end
|
39
|
+
|
40
|
+
# run every 600 second
|
41
|
+
last_trigger = Beacon::now
|
42
|
+
while @running
|
43
|
+
if Beacon::now - last_trigger >= 600
|
44
|
+
last_trigger = Beacon::now
|
45
|
+
@port_configs.each do |port, port_config|
|
46
|
+
frame = {:source => port.identifier,
|
47
|
+
:destination => 'APRS',
|
48
|
+
:path => port_config[:beacon_path],
|
49
|
+
:text => port_config[:beacon_text]
|
50
|
+
}
|
51
|
+
port.write(frame)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
sleep(1)
|
55
|
+
end
|
56
|
+
end
|
12
57
|
end
|
13
58
|
|
14
59
|
public
|
15
60
|
def stop
|
16
|
-
|
61
|
+
@running = false
|
17
62
|
end
|
18
63
|
|
19
64
|
public
|
20
|
-
def handle_packet(frame, recv_port
|
21
|
-
puts 'Beacon handled packet'
|
65
|
+
def handle_packet(frame, recv_port)
|
22
66
|
end
|
23
67
|
end
|
24
68
|
|
data/lib/peak/plugins/id.rb
CHANGED
@@ -3,22 +3,66 @@ module Peak
|
|
3
3
|
class Id
|
4
4
|
protected
|
5
5
|
def initialize(config, port_map, aprsis)
|
6
|
-
|
6
|
+
@port_configs = {}
|
7
|
+
@aprsis = aprsis
|
8
|
+
@running = false
|
9
|
+
|
10
|
+
config.each do |section_name, section_content|
|
11
|
+
if section_name.start_with?('TNC ')
|
12
|
+
tnc_name = section_name.strip.split(' ')[1].strip
|
13
|
+
(1..section_content['port_count']).each do |port_id|
|
14
|
+
port_name = tnc_name + '-' + port_id.to_s
|
15
|
+
port = port_map[port_name]
|
16
|
+
port_section = 'PORT ' + port_name
|
17
|
+
@port_configs[port] = {:id_text => config[port_section]['id_text'],
|
18
|
+
:id_path => config[port_section]['id_path']
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
7
23
|
end
|
8
|
-
|
24
|
+
|
25
|
+
private
|
26
|
+
def self.now
|
27
|
+
Time.now.to_i
|
28
|
+
end
|
29
|
+
|
9
30
|
public
|
10
31
|
def run
|
11
|
-
|
32
|
+
@running = true
|
33
|
+
|
34
|
+
# Don't do anything in the first 60 seconds
|
35
|
+
last_trigger = Id::now
|
36
|
+
while @running and Id::now - last_trigger < 60
|
37
|
+
sleep(1)
|
38
|
+
end
|
39
|
+
|
40
|
+
# run every 600 second
|
41
|
+
last_trigger = Id::now
|
42
|
+
while @running
|
43
|
+
if Id::now - last_trigger >= 600
|
44
|
+
last_trigger = Id::now
|
45
|
+
@port_configs.each do |port, port_config|
|
46
|
+
frame = {:source => port.identifier,
|
47
|
+
:destination => 'ID',
|
48
|
+
:path => port_config[:id_path],
|
49
|
+
:text => port_config[:id_text]
|
50
|
+
}
|
51
|
+
port.write(frame)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
sleep(1)
|
55
|
+
end
|
56
|
+
end
|
12
57
|
end
|
13
|
-
|
58
|
+
|
14
59
|
public
|
15
60
|
def stop
|
16
|
-
|
61
|
+
@running = false
|
17
62
|
end
|
18
|
-
|
63
|
+
|
19
64
|
public
|
20
|
-
def handle_packet(frame, recv_port
|
21
|
-
puts 'Id handled packet'
|
65
|
+
def handle_packet(frame, recv_port)
|
22
66
|
end
|
23
67
|
end
|
24
68
|
|
data/lib/peak/plugins/status.rb
CHANGED
@@ -3,22 +3,66 @@ module Peak
|
|
3
3
|
class Status
|
4
4
|
protected
|
5
5
|
def initialize(config, port_map, aprsis)
|
6
|
-
|
6
|
+
@port_configs = {}
|
7
|
+
@aprsis = aprsis
|
8
|
+
@running = false
|
9
|
+
|
10
|
+
config.each do |section_name, section_content|
|
11
|
+
if section_name.start_with?('TNC ')
|
12
|
+
tnc_name = section_name.strip.split(' ')[1].strip
|
13
|
+
(1..section_content['port_count']).each do |port_id|
|
14
|
+
port_name = tnc_name + '-' + port_id.to_s
|
15
|
+
port = port_map[port_name]
|
16
|
+
port_section = 'PORT ' + port_name
|
17
|
+
@port_configs[port] = {:status_text => config[port_section]['status_text'],
|
18
|
+
:status_path => config[port_section]['status_path']
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
7
23
|
end
|
8
|
-
|
24
|
+
|
25
|
+
private
|
26
|
+
def self.now
|
27
|
+
Time.now.to_i
|
28
|
+
end
|
29
|
+
|
9
30
|
public
|
10
31
|
def run
|
11
|
-
|
32
|
+
@running = true
|
33
|
+
|
34
|
+
# Don't do anything in the first 90 seconds
|
35
|
+
last_trigger = Status::now
|
36
|
+
while @running and Status::now - last_trigger < 90
|
37
|
+
sleep(1)
|
38
|
+
end
|
39
|
+
|
40
|
+
# run every 600 second
|
41
|
+
last_trigger = Status::now
|
42
|
+
while @running
|
43
|
+
if Status::now - last_trigger >= 600
|
44
|
+
last_trigger = Status::now
|
45
|
+
@port_configs.each do |port, port_config|
|
46
|
+
frame = {:source => port.identifier,
|
47
|
+
:destination => 'APRS',
|
48
|
+
:path => port_config[:status_path],
|
49
|
+
:text => port_config[:status_text]
|
50
|
+
}
|
51
|
+
port.write(frame)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
sleep(1)
|
55
|
+
end
|
56
|
+
end
|
12
57
|
end
|
13
|
-
|
58
|
+
|
14
59
|
public
|
15
60
|
def stop
|
16
|
-
|
61
|
+
@running = false
|
17
62
|
end
|
18
|
-
|
63
|
+
|
19
64
|
public
|
20
|
-
def handle_packet(frame, recv_port
|
21
|
-
puts 'Status handled packet'
|
65
|
+
def handle_packet(frame, recv_port)
|
22
66
|
end
|
23
67
|
end
|
24
68
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey Phillips Freeman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -120,7 +120,6 @@ files:
|
|
120
120
|
- CHANGELOG.md
|
121
121
|
- Gemfile
|
122
122
|
- LICENSE
|
123
|
-
- README.md
|
124
123
|
- README.rdoc
|
125
124
|
- Rakefile
|
126
125
|
- bin/console
|
data/README.md
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# Peak
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/peak`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'peak'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install peak
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Syncleus/peak.
|
36
|
-
|