Sha256: 48455f7e94d90528e489ae0f19fd5667438fed9faf6de058412099b83f4ff67f
Contents?: true
Size: 1.18 KB
Versions: 8
Compression:
Stored size: 1.18 KB
Contents
module BubbleWrap module Motion class Magnetometer < GenericMotionInterface 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 private def handle_result(result_data, error, handler) if result_data result = { data: result_data, field: result_data.magneticField, x: result_data.magneticField.x, y: result_data.magneticField.y, z: result_data.magneticField.z, } else result = nil end handler.call(result, error) end def available? @manager.magnetometerAvailable? end def active? @manager.magnetometerActive? end def data @manager.magnetometerData end def stop @manager.stopMagnetometerUpdates end end end end
Version data entries
8 entries across 8 versions & 1 rubygems