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 +4 -4
- data/lib/scan_beacon/ble112_device.rb +13 -4
- data/lib/scan_beacon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 039d7885782b7d34eee4ee7e151a600c57931ec2
|
4
|
+
data.tar.gz: 696725c4564bba3c7ac9fd65c7ddcbd1a6cbf530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
data/lib/scan_beacon/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|