Class: ScanBeacon::GenericIndividualAdvertiser

Inherits:
GenericAdvertiser show all
Defined in:
lib/scan_beacon/generic_individual_advertiser.rb

Direct Known Subclasses

BLE112Advertiser, BlueZAdvertiser

Instance Attribute Summary

Attributes inherited from GenericAdvertiser

#ad, #advertising, #beacon, #parser

Instance Method Summary collapse

Methods inherited from GenericAdvertiser

#inspect, #start, #stop

Constructor Details

#initialize(opts = {}) ⇒ GenericIndividualAdvertiser

Returns a new instance of GenericIndividualAdvertiser.



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

def initialize(opts={})
  @parser = nil
  super(opts)
end

Instance Method Details

#ad=(value) ⇒ Object



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

def ad=(value)
  @ad = value
  self.start if advertising
end

#beacon=(value) ⇒ Object



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

def beacon=(value)
  @beacon = value
  update_ad
end

#parser=(value) ⇒ Object



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

def parser=(value)
  @parser = value
  update_ad
end

#update_adObject



18
19
20
# File 'lib/scan_beacon/generic_individual_advertiser.rb', line 18

def update_ad    
  self.ad = @parser.generate_ad(@beacon) if @parser && @beacon
end