Class: ScanBeacon::BLE112Advertiser
Instance Attribute Summary
#ad, #advertising, #beacon, #parser
Instance Method Summary
collapse
#ad=, #beacon=, #parser=, #update_ad
Constructor Details
4
5
6
7
|
# File 'lib/scan_beacon/ble112_advertiser.rb', line 4
def initialize(opts = {})
@device = BLE112Device.new opts[:port]
super(opts)
end
|
Instance Method Details
#inspect ⇒ Object
23
24
25
|
# File 'lib/scan_beacon/ble112_advertiser.rb', line 23
def inspect
"<BLE112Advertiser ad=#{@ad.inspect}>"
end
|
#rotate_addr ⇒ Object
27
28
29
30
31
|
# File 'lib/scan_beacon/ble112_advertiser.rb', line 27
def rotate_addr
@device.open do
@device.rotate_addr
end
end
|
#rotate_addr_and_update_ad ⇒ Object
33
34
35
36
|
# File 'lib/scan_beacon/ble112_advertiser.rb', line 33
def rotate_addr_and_update_ad
self.update_ad
self.start(true)
end
|
#start(with_rotation = false) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/scan_beacon/ble112_advertiser.rb', line 9
def start(with_rotation = false)
@device.open do
@device.start_advertising(@ad, with_rotation)
@advertising = true
end
end
|
#stop ⇒ Object
16
17
18
19
20
21
|
# File 'lib/scan_beacon/ble112_advertiser.rb', line 16
def stop
@device.open do
@device.stop_advertising
@advertising = false
end
end
|