Class: BubbleWrap::Motion::Magnetometer

Inherits:
GenericMotionInterface show all
Defined in:
motion/motion/motion.rb

Instance Method Summary collapse

Methods inherited from GenericMotionInterface

#every, #initialize, #once, #repeat

Constructor Details

This class inherits a constructor from BubbleWrap::Motion::GenericMotionInterface

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


271
272
273
# File 'motion/motion/motion.rb', line 271

def active?
  @manager.magnetometerActive?
end

#available?Boolean

Returns:

  • (Boolean)


267
268
269
# File 'motion/motion/motion.rb', line 267

def available?
  @manager.magnetometerAvailable?
end

#dataObject



275
276
277
# File 'motion/motion/motion.rb', line 275

def data
  @manager.magnetometerData
end

#start(options = {}, &handler) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'motion/motion/motion.rb', line 236

def start(options={}, &handler)
  if options.key?(:interval)
    @manager.magnetometerUpdateInterval = options[:interval]
  end

  if handler
    queue = convert_queue(options[:queue])
    @manager.startMagnetometerUpdatesToQueue(queue, withHandler: internal_handler(handler))
  else
    @manager.startMagnetometerUpdates
  end

  return self
end

#stopObject



279
280
281
# File 'motion/motion/motion.rb', line 279

def stop
  @manager.stopMagnetometerUpdates
end