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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 349c75a4aa254c5446b6f1e968045861b7c62b1a
4
- data.tar.gz: f6e7c251082c0095b3a1b2df520fc1b9f7240a47
3
+ metadata.gz: 20b0b88a2f8eeb3a3ac7363e0e2a575a6aa0d266
4
+ data.tar.gz: a287eb10ff7a40eb6ce20ed08ded498a48f99792
5
5
  SHA512:
6
- metadata.gz: aa8c20f6f3cf45ec8325ca58ffb0709fed794fbf4d6db39dea2237948a8c3eab2cc46ef470c985fe877950fac48b80a6ef136d24c328908952de752a72df6934
7
- data.tar.gz: 5054ae19b68c7fe860120b1394e4412fdbc408b21bdb63ad7d91adc646dc7687ad40a79aff6ddeb7686d97d19134f2a028bbee781721ad918eb0db0edf1a11ee
6
+ metadata.gz: 174831d7143c86f584368fa4aeecf68a1db5b675a5f425762af4679ae1f0e1fa9b4b1feee5ca1b61cb36f73a2f5895300fbf398dc3e708749b38b6d0173de3ab
7
+ data.tar.gz: e24dd5f81eb77472ecb7207d24bd5fdf8502e4ca296402e52713bfb76db5c8aee8573da0abc33ac69c8aa3599e5941267987945ea38178d02a101cc79c027933
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,5 @@
1
- �i�z^{�H[�hitbT
2
- J�,]~\�FK(wX׌G���\�F�4(�anܧ�)!��F�h��N�y��H�F�'l �EϢ^[;8��Ν��1��E�i�������E�d1�泙�Aq�֬�d�l�i��k��
1
+ {�m&l_��
2
+ ����DOW.�35v��`'.[���݈=΂z�������#Si����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�
@@ -11,7 +11,7 @@ module HcitoolsWrapper
11
11
 
12
12
  # options interval and duration are in seconds
13
13
  #
14
- def self.start(runinterval: 10, scanduration: 2)
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 < Time.now then
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 'changed!' if @verbose
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hcitools_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file