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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bf3fe01adb129593454ad6d8c518e0a0591d6e1
4
- data.tar.gz: 9e2bc0959f86ccd9e1fdf9e56742361548953bad
3
+ metadata.gz: 2b395c9e001b9be92ec7523d17b639f45551d64b
4
+ data.tar.gz: bbb594e7ea2200d8a9452be19ef03115b21aecee
5
5
  SHA512:
6
- metadata.gz: 3ae70322824fd30cd1556bae9c37fba727051839ab71cceedddc738e4cf4d734f0af843140b28b358596ae457ec75531ebd1d99ce17c6696fdb98b2be5c8be89
7
- data.tar.gz: 084a0bdd8b68cecfac23a4da1e9a32815f0a6bf8d2af5a4c9782edbfc15a8a4ac9a7cfb39cce3fedd97725006dda893b91f6aab4d986d47f030576e85cbed503
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
- = peak - DESCRIBE YOUR GEM
1
+ = Peak
2
2
 
3
- Author:: YOUR NAME (YOUR EMAIL)
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
- DESCRIBE YOUR GEM HERE
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
- == Links
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
- * {Source on Github}[LINK TO GITHUB]
12
- * RDoc[LINK TO RDOC.INFO]
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
- == Install
27
+ peak run
15
28
 
16
- == Examples
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
- == Contributing
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
- activated_plugins = []
11
+ active_plugins = {}
16
12
  plugins = load_plugins
17
13
  plugins.each do |plugin|
18
- activated_plugin = plugin.new(nil, nil, nil)
19
- activated_plugins << activated_plugin
20
- activated_plugin.run
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
- # Transmit a beacon when we first start
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
- unless frame
37
- sleep(1)
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
@@ -1,3 +1,3 @@
1
1
  module Peak
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,5 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'peak/tnc_port'
3
+ require 'apex/aprs_kiss'
4
+ require 'kiss'
3
5
 
4
6
  module Peak
5
7
  def self.find_config(verbose, config_paths=[])
@@ -1,27 +1,23 @@
1
1
  module Peak
2
2
  module Plugins
3
- class PeakParadigm
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, recv_port_name)
21
- puts 'PeakParadigm handled packet'
17
+ def handle_packet(frame, recv_port)
22
18
  end
23
19
  end
24
20
 
25
- PluginFactory.register_plugin(PeakParadigm)
21
+ PluginFactory.register_plugin(ApexParadigm)
26
22
  end
27
23
  end
@@ -3,22 +3,66 @@ module Peak
3
3
  class Beacon
4
4
  protected
5
5
  def initialize(config, port_map, aprsis)
6
- puts 'beacon inited'
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
- puts 'beacon ran'
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
- puts 'beacon stop'
61
+ @running = false
17
62
  end
18
63
 
19
64
  public
20
- def handle_packet(frame, recv_port, recv_port_name)
21
- puts 'Beacon handled packet'
65
+ def handle_packet(frame, recv_port)
22
66
  end
23
67
  end
24
68
 
@@ -3,22 +3,66 @@ module Peak
3
3
  class Id
4
4
  protected
5
5
  def initialize(config, port_map, aprsis)
6
- puts 'Id inited'
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
- puts 'Id ran'
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
- puts 'Id stop'
61
+ @running = false
17
62
  end
18
-
63
+
19
64
  public
20
- def handle_packet(frame, recv_port, recv_port_name)
21
- puts 'Id handled packet'
65
+ def handle_packet(frame, recv_port)
22
66
  end
23
67
  end
24
68
 
@@ -3,22 +3,66 @@ module Peak
3
3
  class Status
4
4
  protected
5
5
  def initialize(config, port_map, aprsis)
6
- puts 'Status inited'
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
- puts 'Status ran'
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
- puts 'Status stop'
61
+ @running = false
17
62
  end
18
-
63
+
19
64
  public
20
- def handle_packet(frame, recv_port, recv_port_name)
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.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-04 00:00:00.000000000 Z
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
-