Class: BubbleWrap::Motion::Gyroscope

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


220
221
222
# File 'motion/motion/motion.rb', line 220

def active?
  @manager.gyroActive?
end

#available?Boolean


216
217
218
# File 'motion/motion/motion.rb', line 216

def available?
  @manager.gyroAvailable?
end

#dataObject


224
225
226
# File 'motion/motion/motion.rb', line 224

def data
  @manager.gyroData
end

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


185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'motion/motion/motion.rb', line 185

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

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

  return self
end

#stopObject


228
229
230
# File 'motion/motion/motion.rb', line 228

def stop
  @manager.stopGyroUpdates
end