Class: ScanBeacon::CoreBluetoothAdvertiser

Inherits:
GenericIndividualAdvertiser show all
Defined in:
lib/scan_beacon/core_bluetooth_advertiser.rb

Instance Attribute Summary

Attributes inherited from GenericAdvertiser

#ad, #advertising, #beacon, #parser

Instance Method Summary collapse

Methods inherited from GenericIndividualAdvertiser

#beacon=, #parser=, #update_ad

Constructor Details

#initialize(opts = {}) ⇒ CoreBluetoothAdvertiser



4
5
6
# File 'lib/scan_beacon/core_bluetooth_advertiser.rb', line 4

def initialize(opts = {})
  super
end

Instance Method Details

#ad=(value) ⇒ Object



8
9
10
11
# File 'lib/scan_beacon/core_bluetooth_advertiser.rb', line 8

def ad=(value)
  @ad = value
  CoreBluetooth.set_advertisement_data @ad
end

#inspectObject



27
28
29
# File 'lib/scan_beacon/core_bluetooth_advertiser.rb', line 27

def inspect
  "<CoreBluetoothAdvertiser ad=#{@ad.inspect}>"
end

#rotate_addr_and_update_adObject



21
22
23
24
25
# File 'lib/scan_beacon/core_bluetooth_advertiser.rb', line 21

def rotate_addr_and_update_ad
  self.update_ad
  self.stop
  self.start(true)
end

#start(with_rotation = false) ⇒ Object



13
14
15
# File 'lib/scan_beacon/core_bluetooth_advertiser.rb', line 13

def start(with_rotation = false)
  CoreBluetooth.start_advertising(with_rotation)
end

#stopObject



17
18
19
# File 'lib/scan_beacon/core_bluetooth_advertiser.rb', line 17

def stop
  CoreBluetooth.stop_advertising
end