scan_beacon 0.7.3 → 0.7.4

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: 2a9114fc9606aea75ae6f7e5738834ba71af389f
4
- data.tar.gz: 47476d205b8d6ea5d331b1ccb379810d6912f627
3
+ metadata.gz: d52639ce9dbbc4e83c8d9d7af61fe061bb732de6
4
+ data.tar.gz: edb886188d0ac55dade9c9804be87db6430fc70c
5
5
  SHA512:
6
- metadata.gz: 08f9ed42dd54cc5e510f1ec69b412c5de35ca584d533704121bff1fa5c3777e5748da441e97e606345aec53149806c728ac377d3ec1a77e25f550e95c3150702
7
- data.tar.gz: 0a51b7831f1aa381a570a9c7d6eca08e52d144f500e6dc689a338af10eff0cfc8635ffae88b739ce14d980fea9029e3d39dade0be9870edc43211f21cf97e923
6
+ metadata.gz: 47388c4549f27d7b0a44fc1dae4fd34f800a2563686a9728bc5d5244c3e40512539d9f11dcced671d12491f7bfc8f7b7e071e99a5bc42301196f8f1a4064d08f
7
+ data.tar.gz: 9506c5cfd2acdcc6b6bf6aa944bbb1098a9c99dbd8c057378ef9684b0dc1ab106c76ad7746b6e3aece6615afb922425174591002d7bbe5dc72ac424a48fb32df
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ScanBeacon gem
2
2
 
3
- A ruby gem that allows you to scan for beacon advertisements using IOBluetooth (on Mac OS X) or a BlueGiga BLE112 device (on mac or linux)
3
+ A ruby gem that allows you to scan for beacon advertisements using IOBluetooth (on Mac OS X), BlueZ (on Linux), or a BlueGiga BLE112 device (on mac or linux)
4
4
 
5
5
  # Example Usage
6
6
 
@@ -145,21 +145,22 @@ module ScanBeacon
145
145
  end
146
146
 
147
147
  class BLE112Response
148
+ attr_reader :data
149
+
148
150
  def initialize(data)
149
- data ||= ""
150
- @data = data.force_encoding("ASCII-8BIT")
151
+ @data = (data || "").force_encoding("ASCII-8BIT")
151
152
  end
152
153
 
153
154
  def size
154
- @data.size
155
+ data.size
155
156
  end
156
157
 
157
158
  def event?
158
- @data[0].unpack('C')[0] == BG_EVENT
159
+ data[0].unpack('C')[0] == BG_EVENT
159
160
  end
160
161
 
161
162
  def gap_scan?
162
- @data[2..3].unpack('CC') == [BG_MSG_CLASS_GAP, 0]
163
+ data[2..3].unpack('CC') == [BG_MSG_CLASS_GAP, 0]
163
164
  end
164
165
 
165
166
  def manufacturer_ad?
@@ -175,19 +176,19 @@ module ScanBeacon
175
176
  end
176
177
 
177
178
  def advertisement_type
178
- @data[19].unpack('C')[0]
179
+ data[19].unpack('C')[0]
179
180
  end
180
181
 
181
182
  def advertisement_data
182
- @advertisement_data ||= @data[20..-1]
183
+ @advertisement_data ||= data[20..-1]
183
184
  end
184
185
 
185
186
  def mac
186
- @data[6..11].unpack('H2 H2 H2 H2 H2 H2').join(":")
187
+ data[6..11].unpack('H2 H2 H2 H2 H2 H2').join(":")
187
188
  end
188
189
 
189
190
  def rssi
190
- @data[4].unpack('c')[0]
191
+ data[4].unpack('c')[0]
191
192
  end
192
193
  end
193
194
 
@@ -5,7 +5,7 @@ module ScanBeacon
5
5
 
6
6
  def initialize(opts = {})
7
7
  super
8
- @device = BLE112Device.new opts[:port]
8
+ @device = opts[:device] || BLE112Device.new(opts[:port])
9
9
  @device_addr = @device.open{ @device.get_addr }
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module ScanBeacon
2
- VERSION = "0.7.3"
2
+ VERSION = "0.7.4"
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.3
4
+ version: 0.7.4
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-14 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler