hcitools_wrapper 0.1.4 → 0.1.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
- checksums.yaml.gz.sig +5 -2
- data/lib/hcitools_wrapper.rb +9 -5
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20b0b88a2f8eeb3a3ac7363e0e2a575a6aa0d266
|
4
|
+
data.tar.gz: a287eb10ff7a40eb6ce20ed08ded498a48f99792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 174831d7143c86f584368fa4aeecf68a1db5b675a5f425762af4679ae1f0e1fa9b4b1feee5ca1b61cb36f73a2f5895300fbf398dc3e708749b38b6d0173de3ab
|
7
|
+
data.tar.gz: e24dd5f81eb77472ecb7207d24bd5fdf8502e4ca296402e52713bfb76db5c8aee8573da0abc33ac69c8aa3599e5941267987945ea38178d02a101cc79c027933
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
{�m&l_��
|
2
|
+
����DOW.�35v��`'.[���݈=z�������#S�i����j��}��[4W���?鹠-Z��v+h��f���
|
3
|
+
b�����0>{pя��b�����Q
|
4
|
+
3,�~�:�mt�����#��#����5A<�:pҜ����TQs4�E]2���g�;�oS��>P]���כ~����Ɨ�$��-��� f��>���� �:�th���%�gy�����l'��
|
5
|
+
o�� I<rW�
|
data/lib/hcitools_wrapper.rb
CHANGED
@@ -11,7 +11,7 @@ module HcitoolsWrapper
|
|
11
11
|
|
12
12
|
# options interval and duration are in seconds
|
13
13
|
#
|
14
|
-
def self.start(runinterval:
|
14
|
+
def self.start(runinterval: 20, scanduration: 2)
|
15
15
|
|
16
16
|
interval, duration = runinterval, scanduration
|
17
17
|
RunEvery.new(seconds: interval) do
|
@@ -41,7 +41,7 @@ module HcitoolsWrapper
|
|
41
41
|
def start()
|
42
42
|
|
43
43
|
id = @bd_address.split(':').reverse.join(' ')
|
44
|
-
found = false
|
44
|
+
found, last_found = false, Time.now - 60
|
45
45
|
a = []
|
46
46
|
|
47
47
|
t3 = Time.now + @interval
|
@@ -54,7 +54,7 @@ module HcitoolsWrapper
|
|
54
54
|
a << rssi.to_i unless a.include? rssi.to_i
|
55
55
|
h = {bdaddress: @bd_address, rssi: rssi.inspect}
|
56
56
|
|
57
|
-
if t3
|
57
|
+
if t3 <= Time.now then
|
58
58
|
|
59
59
|
avg = a.max + (a.min - a.max) / 2
|
60
60
|
|
@@ -64,11 +64,13 @@ module HcitoolsWrapper
|
|
64
64
|
[a.max, a.min, avg, a.sort.inspect]
|
65
65
|
|
66
66
|
end
|
67
|
+
|
68
|
+
recent_movement = Time.now - last_found >= 60
|
67
69
|
|
68
70
|
# the RSSI will vary by up to 10 when the device is stationary
|
69
|
-
if a.length > 10 or rssi > (a.max + 10) or rssi < (a.min - 10) then
|
71
|
+
if recent_movement or a.length > 10 or rssi > (a.max + 10) or rssi < (a.min - 10) then
|
70
72
|
|
71
|
-
puts '
|
73
|
+
puts 'movement!' if @verbose
|
72
74
|
|
73
75
|
if block_given? then
|
74
76
|
yield a, avg
|
@@ -79,6 +81,8 @@ module HcitoolsWrapper
|
|
79
81
|
|
80
82
|
t3 = Time.now + @interval
|
81
83
|
end
|
84
|
+
|
85
|
+
last_found = Time.now
|
82
86
|
|
83
87
|
false
|
84
88
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|