-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An interface proposal for a CoreMotion wrapper #357
Comments
I like it! However, do you feel like this should go into BubbleWrap? What about making it its own thing? |
It could, but it bears a striking resemblance to BW::Compass and BW::Location... I like that we have a collection of "Core-*" wrappers in a community project, too. |
Looks good - I wonder if or maybe allow |
I looked at the device motion stuff again, and it's not able to be scoped; the data will be there regardless, so might as well have it in the I'm not a big fan of how the The hash interface was meant to be similar to the other Location & Compass result objects. |
See #366 |
Hi, this is a first-draft of an interface for CoreMotion. @markrickert, @clayallsopp - what do you guys think?
Motion
Interface for the accelerometer, gyroscope, and magnetometer sensors (the
CoreMotion framework). You can access each sensor individually, or you can get
data from all of them at once using the
BW::Motion.device
interface, whichdelegates to
CMMotionManager#deviceMotion
.Each sensor has an
every
andonce
method.every
expects a time interval,and you will need to retain the object it returns and call
#stop
on it whenyou are done with the data.
The
every
andonce
methods can accept a:queue
option. The default valueis a queue that runs on the main loop, so that UI updates can be processed in
the block. This is useful, but not recommended by Apple, since the events can
come in at a high rate. If you want to use a background queue, you can either
specify an NSOperationQueue object, or you can use one of these symbols:
:main
-NSOperationQueue.mainQueue
, this is the default value.:background
- BubbleWrap will create a newNSOperationQueue
.:current
- BubbleWrap will useNSOperationQueue.currentQueue
.If you pass a string instead, a new queue will be created and its
name
property will be set to that string.
The
CMDeviceMotion
interface (BW::Motion.device
) accepts a:reference
option, which specifies the
CMAttitudeReferenceFrame
. The default value isthe same as the one that
CMMotionManager
uses, which is returned by theCMMotionManager#attitudeReferenceFrame
method. This option should be passedto the
every
oronce
method.Accelerometer
Gyroscope
Magnetometer
Device Motion
This is an amalgam of all the motion sensor data.
The text was updated successfully, but these errors were encountered: