Class: TiltHydrometer::Core
- Inherits:
-
Object
- Object
- TiltHydrometer::Core
- Defined in:
- lib/tilt_hydrometer/core.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Core
constructor
A new instance of Core.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Core
Returns a new instance of Core.
7 8 9 |
# File 'lib/tilt_hydrometer/core.rb', line 7 def initialize( = {}) = end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tilt_hydrometer/core.rb', line 11 def run Open3.popen3 'hcidump -R' do |_stdin, stdout, _stderr, _thread| buffer = [] while line = stdout.gets if line.start_with?('>') || line.start_with?('<') process_advertisement(buffer.join.gsub(/\s+/, '')) buffer = [] end buffer << line[2..-2] end end end |