scan_beacon 0.7.5 → 0.7.6
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 +5 -4
- data/lib/scan_beacon/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 279c17d8ac41187e2fca0485fa7e509b95b39a5a
|
4
|
+
data.tar.gz: 5f66d567c6c6e1c24fdcfaae49be7ab5ae5107d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f59688043cf8f7399f63ef2c5fc6a1b990b04f527e7bd8aaee0fea2bf714b52641c78e69d824d56472be72a45577d6e876c94a52cf7aadb489ea4272f8d5e84f
|
7
|
+
data.tar.gz: 0afcf93cb60a0d40863f43b841110c2dafd9fa78709e949895cf8ac857e190484cf6a198a2018f808718beba1d7ef243de35b92c62a055802c910baab7d04c6e
|
@@ -41,7 +41,7 @@ module ScanBeacon
|
|
41
41
|
|
42
42
|
def open
|
43
43
|
response = nil
|
44
|
-
configure_port
|
44
|
+
self.class.configure_port(@port)
|
45
45
|
File.open(@port, 'r+b') do |file|
|
46
46
|
@file = file
|
47
47
|
response = yield(self)
|
@@ -50,16 +50,16 @@ module ScanBeacon
|
|
50
50
|
return response
|
51
51
|
end
|
52
52
|
|
53
|
-
def configure_port
|
53
|
+
def self.configure_port(port)
|
54
54
|
if RUBY_PLATFORM =~ /linux/
|
55
|
-
system("stty -F #{
|
55
|
+
system("stty -F #{port} 115200 raw -brkint -icrnl -imaxbel -opost -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def get_addr
|
60
60
|
# use a timeout here because we're using this to detect BLE112s and if it
|
61
61
|
# isn't one, it may not respond right away
|
62
|
-
response = bg_command(@file, BG_MSG_CLASS_SYSTEM, BG_GET_ADDRESS,nil,nil,0.
|
62
|
+
response = bg_command(@file, BG_MSG_CLASS_SYSTEM, BG_GET_ADDRESS,nil,nil,0.5)
|
63
63
|
response[4..-1].reverse.unpack("H2:H2:H2:H2:H2:H2").join(":") if response && response.length == 10
|
64
64
|
end
|
65
65
|
|
@@ -136,6 +136,7 @@ module ScanBeacon
|
|
136
136
|
# try to reset all the devices
|
137
137
|
device_count = possible_devices.count
|
138
138
|
possible_devices.each do |device_path|
|
139
|
+
configure_port(device_path)
|
139
140
|
File.open(device_path, 'r+b') do |file|
|
140
141
|
bg_command(file, BG_MSG_CLASS_GAP, BG_DISCOVER_STOP, nil, nil, 0.5)
|
141
142
|
end
|
data/lib/scan_beacon/version.rb
CHANGED