scan_beacon 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d52639ce9dbbc4e83c8d9d7af61fe061bb732de6
4
- data.tar.gz: edb886188d0ac55dade9c9804be87db6430fc70c
3
+ metadata.gz: 039d7885782b7d34eee4ee7e151a600c57931ec2
4
+ data.tar.gz: 696725c4564bba3c7ac9fd65c7ddcbd1a6cbf530
5
5
  SHA512:
6
- metadata.gz: 47388c4549f27d7b0a44fc1dae4fd34f800a2563686a9728bc5d5244c3e40512539d9f11dcced671d12491f7bfc8f7b7e071e99a5bc42301196f8f1a4064d08f
7
- data.tar.gz: 9506c5cfd2acdcc6b6bf6aa944bbb1098a9c99dbd8c057378ef9684b0dc1ab106c76ad7746b6e3aece6615afb922425174591002d7bbe5dc72ac424a48fb32df
6
+ metadata.gz: 1eeae293dd4911257b8cd4130472e68e96ee3a7151eaa3e64937767a517efed011adf7bbd162c404be417620d5d3e4d072dd15a9b2a5dc59ffc283882420f5d4
7
+ data.tar.gz: 21149279596ac7d934cd867f5edf718fed58cdd69f20644bce72dc706f71d94da29be093b356e61d4783255be432f978e12b87002a871a8187cf9eee4b0b3337
@@ -137,10 +137,10 @@ module ScanBeacon
137
137
  device_count = possible_devices.count
138
138
  possible_devices.each do |device_path|
139
139
  File.open(device_path, 'r+b') do |file|
140
- file.write([BG_COMMAND, 0, BG_MSG_CLASS_GAP, BG_DISCOVER_STOP].pack('C*'))
140
+ bg_command(file, BG_MSG_CLASS_GAP, BG_DISCOVER_STOP, nil, nil, 0.5)
141
141
  end
142
142
  # open and close the file to clear the buffer
143
- File.open(device_path, 'r+b') {|file| }
143
+ File.open(device_path, 'r+b') {|file| file.sync}
144
144
  end
145
145
  end
146
146
 
@@ -194,7 +194,7 @@ module ScanBeacon
194
194
 
195
195
  private
196
196
 
197
- def bg_command(port, msg_class, msg, data=nil, data_format=nil, timeout=nil)
197
+ def self.bg_command(port, msg_class, msg, data=nil, data_format=nil, timeout=nil)
198
198
  data = [data].compact unless data.is_a? Array
199
199
  if data_format.nil?
200
200
  data = data.pack('C*')
@@ -206,7 +206,7 @@ module ScanBeacon
206
206
  bg_read(port, timeout)
207
207
  end
208
208
 
209
- def bg_read(port, timeout = nil)
209
+ def self.bg_read(port, timeout = nil)
210
210
  if !timeout.nil?
211
211
  return nil if IO.select([port],nil,nil, timeout).nil?
212
212
  end
@@ -215,5 +215,14 @@ module ScanBeacon
215
215
  payload_length = response[1].unpack('C')[0]
216
216
  response << port.read(payload_length)
217
217
  end
218
+
219
+ def bg_command(*args)
220
+ self.class.bg_command(*args)
221
+ end
222
+
223
+ def bg_read(*args)
224
+ self.class.bg_read(*args)
225
+ end
226
+
218
227
  end
219
228
  end
@@ -1,3 +1,3 @@
1
1
  module ScanBeacon
2
- VERSION = "0.7.4"
2
+ VERSION = "0.7.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scan_beacon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radius Networks
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler