ant-wireless 0.1.0.pre.20210617213631

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ require 'ant'
5
+
data/spec/ant_spec.rb ADDED
@@ -0,0 +1,88 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ require_relative 'spec_helper'
5
+
6
+ require 'securerandom'
7
+ require 'rspec'
8
+ require 'ant'
9
+
10
+
11
+
12
+ RSpec.describe( Ant ) do
13
+
14
+ after( :each ) do
15
+ described_class.close
16
+ end
17
+
18
+
19
+ it "knows what the version of the underlying library is" do
20
+ expect( described_class.lib_version ).to match( /ALU\d+\.\d+/ )
21
+ end
22
+
23
+
24
+ it "exposes relevant constants to Ruby" do
25
+ expect( described_class::EVENT_CLK_ERROR ).to eq( 0x36 )
26
+ end
27
+
28
+
29
+ it "raises when initialized with an invalid serial port", :hardware do
30
+ expect {
31
+ described_class.init( 0xFF )
32
+ }.to raise_error( RuntimeError, /no ant device present/i )
33
+ end
34
+
35
+
36
+ it "can validate a device number" do
37
+ expect( described_class.validate_device_number(111) ).to eq( 111 )
38
+ expect {
39
+ described_class.validate_device_number( 65540 )
40
+ }.to raise_error( RangeError, /invalid device number/i )
41
+ end
42
+
43
+
44
+ it "can validate a device type" do
45
+ expect( described_class.validate_device_type(34) ).to eq( 34 )
46
+ expect {
47
+ described_class.validate_device_type( 400 )
48
+ }.to raise_error( RangeError, /invalid device type/i )
49
+ end
50
+
51
+
52
+ it "can validate a channel period" do
53
+ expect( described_class.validate_channel_period(8192) ).to eq( 8192 )
54
+ expect {
55
+ described_class.validate_channel_period( 70000 )
56
+ }.to raise_error( RangeError, /invalid channel period/i )
57
+ end
58
+
59
+
60
+ it "can validate an ANT network number" do
61
+ expect( described_class.validate_network_number(0) ).to eq( 0 )
62
+ expect {
63
+ described_class.validate_network_number( 260 )
64
+ }.to raise_error( RangeError, /invalid network number/i )
65
+ end
66
+
67
+
68
+ it "can validate an ANT network key" do
69
+ valid_key = SecureRandom.bytes( 8 )
70
+ expect( described_class.validate_network_key(valid_key) ).
71
+ to eq( valid_key )
72
+
73
+ invalid_key = SecureRandom.bytes( 11 )
74
+ expect {
75
+ described_class.validate_network_key( invalid_key )
76
+ }.to raise_error( RangeError, /invalid network key/i )
77
+ end
78
+
79
+
80
+ it "can validate an RF frequency value" do
81
+ expect( described_class.validate_rf_frequency(112) ).to eq( 112 )
82
+ expect {
83
+ described_class.validate_rf_frequency( 200 )
84
+ }.to raise_error( RangeError, /invalid rf frequency/i )
85
+ end
86
+
87
+ end
88
+
@@ -0,0 +1,37 @@
1
+ # -*- ruby -*-
2
+ # frozen_string_literal: true
3
+
4
+ require 'simplecov' if ENV['COVERAGE']
5
+
6
+ require 'rspec'
7
+
8
+ require 'ant'
9
+ require 'loggability/spechelpers'
10
+
11
+
12
+ ### Mock with RSpec
13
+ RSpec.configure do |config|
14
+ config.mock_with( :rspec ) do |mock|
15
+ mock.syntax = :expect
16
+ end
17
+
18
+ begin
19
+ Ant.close
20
+ Ant.init
21
+ Ant.close
22
+ rescue => err
23
+ config.filter_run_excluding( :hardware )
24
+ end
25
+
26
+ config.disable_monkey_patching!
27
+ config.example_status_persistence_file_path = "spec/.status"
28
+ config.filter_run :focus
29
+ config.filter_run_when_matching :focus
30
+ config.order = :random
31
+ config.profile_examples = 5
32
+ config.run_all_when_everything_filtered = true
33
+ config.shared_context_metadata_behavior = :apply_to_host_groups
34
+ # config.warnings = true
35
+ end
36
+
37
+
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ant-wireless
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.20210617213631
5
+ platform: ruby
6
+ authors:
7
+ - Michael Granger
8
+ - Mahlon E. Smith
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIID+DCCAmCgAwIBAgIBAzANBgkqhkiG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xK321VIHyTibbKeA1hWSE6ljlQDvFbTqiCj3Ulp1jTv3TOlvRl8fqcfhxUJI0
31
+ +5Q82jJODjEN+GaWs0V+NlrbU94cXwS2PH5dXogftB5YYA5Ex8A0ikZ73xns4Hdo
32
+ XxdLdd92F5ovxA23j/rKe/IDwqr6FpDkU3nPXH/Qp0TVGv9zZnVJc/Z6ChkuWj8z
33
+ pW7JAyyiiHZgKKDReDrA2LA7Zs3o/7KA6UtUH0FHf8LYhcK+pfHk6RtjRe65ffw+
34
+ MCh97sQ/Z/MOusb5+QddBmB+k8EicXyGNl4b5L4XpL7fIQu+Y96TB3JEJlShxFD9
35
+ k9FjI4d9EP54gS/4
36
+ -----END CERTIFICATE-----
37
+ date: 2021-06-17 00:00:00.000000000 Z
38
+ dependencies:
39
+ - !ruby/object:Gem::Dependency
40
+ name: rake-compiler
41
+ requirement: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - "~>"
44
+ - !ruby/object:Gem::Version
45
+ version: '1.1'
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.1'
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake-deveiate
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.10'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.10'
67
+ description: A binding for the ANT ultra-low power wireless protocol via the Garmin
68
+ USB ANT Stick. ANT can be used to send information wirelessly from one device to
69
+ another device, in a robust and flexible manner.
70
+ email:
71
+ - ged@FaerieMUD.org
72
+ - mahlon@martini.nu
73
+ executables: []
74
+ extensions:
75
+ - ext/ant_ext/extconf.rb
76
+ extra_rdoc_files: []
77
+ files:
78
+ - History.md
79
+ - LICENSE.txt
80
+ - README.md
81
+ - ext/ant_ext/ant_ext.c
82
+ - ext/ant_ext/ant_ext.h
83
+ - ext/ant_ext/antdefines.h
84
+ - ext/ant_ext/antmessage.h
85
+ - ext/ant_ext/build_version.h
86
+ - ext/ant_ext/callbacks.c
87
+ - ext/ant_ext/channel.c
88
+ - ext/ant_ext/defines.h
89
+ - ext/ant_ext/extconf.rb
90
+ - ext/ant_ext/message.c
91
+ - ext/ant_ext/types.h
92
+ - ext/ant_ext/version.h
93
+ - lib/ant.rb
94
+ - lib/ant/channel.rb
95
+ - lib/ant/channel/event_callbacks.rb
96
+ - lib/ant/message.rb
97
+ - lib/ant/mixins.rb
98
+ - lib/ant/response_callbacks.rb
99
+ - lib/ant/wireless.rb
100
+ - spec/ant_spec.rb
101
+ - spec/spec_helper.rb
102
+ homepage: https://sr.ht/~ged/ruby-ant-wireless/
103
+ licenses:
104
+ - BSD-3-Clause
105
+ metadata:
106
+ bug_tracker_uri: https://todo.sr.ht/~ged/ruby-ant-wireless
107
+ changelog_uri: https://deveiate.org/code/ant-wireless/History_md.html
108
+ documentation_uri: https://deveiate.org/code/ant-wireless
109
+ homepage_uri: https://sr.ht/~ged/ruby-ant-wireless/
110
+ source_uri: https://hg.sr.ht/~ged/ruby-ant-wireless
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.3.1
125
+ requirements: []
126
+ rubygems_version: 3.1.6
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: A binding for the ANT ultra-low power wireless protocol via the Garmin USB
130
+ ANT Stick.
131
+ test_files: []