source: orbit/iOS/Orbit/CoreMotion.framework/Headers/CMMotionActivityManager.h @ 876e42b

Servo
Last change on this file since 876e42b was 876e42b, checked in by Steve Castellotti <sc@…>, 7 years ago
  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  CMMotionActivityManager.h
3 *  CoreMotion
4 *
5 *  Copyright (c) 2013 Apple Inc. All rights reserved.
6 */
7
8#import <Foundation/Foundation.h>
9#import <CoreMotion/CMMotionActivity.h>
10
11/*
12 *  CMMotionActivityHandler
13 *
14 *  Discussion:
15 *    Typedef of block to be invoked when the device's activity is updated.
16 */
17typedef void (^CMMotionActivityHandler)(CMMotionActivity *activity) __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0);
18
19/*
20 *  CMMotionActivityQueryHandler
21 *
22 *  Discussion:
23 *    Typedef of block to be invoked when the historical activity query is
24 *    completed.  The array is an array of CMMotionActivity objects.
25 */
26typedef void (^CMMotionActivityQueryHandler)(NSArray *activities, NSError *error) __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0);
27
28/*
29 *   CMMotionActivityManager
30 *
31 *   Discussion:
32 *      CMMotionActivityManager allows access to the activity of the device.
33 *      Activities can be retrieved in one of two ways:
34 *
35 *      1. Via a query specifying a time range from which an array of
36 *      activities will be returned.
37 *
38 *      2. By providing a queue and a block to startActivityUpdatesToQueue:withHandler:
39 *      which will provide live activity updates to a running application.
40 */
41NS_CLASS_AVAILABLE(NA,7_0)
42@interface CMMotionActivityManager : NSObject
43
44/*
45 *  isActivityAvailable
46 *
47 *  Discussion:
48 *      Determines whether activity estimation is available.
49 */
50+ (BOOL)isActivityAvailable;
51
52/*
53 * queryActivityStartingFrom:to:toQueue:withHandler:
54 *
55 * Discussion:
56 *      Queries for activity transitions that happened during the given time
57 *      range.  The date range must be in the past.  Data is only available
58 *      for the last seven days.  The result is returned to the handler/queue
59 *      specified.
60 *
61 *      The first activity returned may have a startDate before start, this
62 *      activity represents what the state was at the start time.
63 *
64 */
65- (void)queryActivityStartingFromDate:(NSDate *)start
66                               toDate:(NSDate *)end
67                              toQueue:(NSOperationQueue *)queue
68                          withHandler:(CMMotionActivityQueryHandler)handler;
69
70/*
71 *  startActivityUpdatesToQueue:withHandler
72 *
73 *  Discussion:
74 *      Start activity updates, providing data to the given handler through
75 *      the given queue.  An update with the current activity will arrive
76 *      first.  Then when the activity state changes the handler will be
77 *      called with the new activity.
78 *
79 *      You can only have one handler installed at a time, calling
80 *      startActivityUpdatesToQueue:withHandler: replaces the current
81 *      handler.
82 *
83 *      Updates are not delivered while the application is suspended, the
84 *      application may use
85 *      queryActivityStartingFromDate:toDate:toQueue:withHandler: to get
86 *      activities from the time when the application was suspended.
87 */
88- (void)startActivityUpdatesToQueue:(NSOperationQueue *)queue
89                        withHandler:(CMMotionActivityHandler)handler;
90
91/*
92 *  stopActivityUpdates
93 *
94 *  Discussion:
95 *      Stop delivering live updates.
96 */
97- (void)stopActivityUpdates;
98
99@end
Note: See TracBrowser for help on using the repository browser.