source: orbit/iOS/Orbit/CoreMotion.framework/Headers/CMStepCounter.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.5 KB
Line 
1/*
2 *  CMStepCounter.h
3 *  CoreMotion
4 *
5 *  Copyright (c) 2013 Apple Inc. All rights reserved.
6 *
7 */
8
9#import <Foundation/Foundation.h>
10
11/*
12 *  CMStepQueryHandler
13 *
14 *  Discussion:
15 *    Typedef of block to be invoked when the step count query is completed.
16 */
17typedef void (^CMStepQueryHandler)(NSInteger numberOfSteps, NSError *error);
18
19/*
20 *  CMStepUpdateHandler
21 *
22 *  Discussion:
23 *      Typedef of block to be invoked on every update.  The total step count since startStepCountingUpdatesToQueue
24 *      was called along with the timestamp associated with the latest determination will be returned.
25 */
26typedef void (^CMStepUpdateHandler)(NSInteger numberOfSteps, NSDate *timestamp, NSError *error);
27
28/*
29 *  CMStepCounter
30 *
31 *  Discussion:
32 *      CMStepCounter allows access to the approximate number of steps a user has taken
33 *      with a device.  Steps can be retrieved in one of two ways:
34 *
35 *      1. Via a query specifying a time range from which the approximate number of steps is
36 *      tabulated and returned. (See queryStepCountStartingFrom:to:toQueue:withHandler)
37 *
38 *      2. By providing a queue and a block to startStepCountingUpdatesToQueue:withHandler,
39 *      step count updates will be provided on a best effort basis.  Each update will return a
40 *      monotonically increasing number of steps counted since
41 *      startStepCountingUpdatesToQueue:withHandler was called and a timestamp
42 *      associated with the latest stepcount determination.  Step count updates can be stopped
43 *      by either calling stopStepCountingUpdates or upon CMStepCounter deallocation.
44 *
45 */
46NS_CLASS_AVAILABLE(NA,7_0)
47@interface CMStepCounter : NSObject
48
49/*
50 *  isStepCountingAvailable
51 *
52 *  Discussion:
53 *      Determines whether the device supports step counting.
54 */
55+ (BOOL)isStepCountingAvailable;
56
57/*
58 *  queryStepCountStartingFrom:to:toQueue:withHandler
59 *
60 *  Discussion:
61 *      Queries for the approximate number of steps taken in the given time range, for up to 7 days.
62 *      The step count returned is computed from a system wide history that is continuously being
63 *      collected in the background.  The result is returned to the handler/queue specified.
64 */
65- (void)queryStepCountStartingFrom:(NSDate *)start
66                                to:(NSDate *)end
67                           toQueue:(NSOperationQueue *)queue
68                       withHandler:(CMStepQueryHandler)handler;
69
70/*
71 *  startStepCountingUpdatesToQueue:withHandler
72 *
73 *  Discussion:
74 *       Starts a series of continuous step counting updates to the handler on the designated queue.  For each
75 *       update, the app will receive the total step count since this method was called (this includes
76 *       subsequent calls) and the timestamp associated with the latest determination.  If the app is backgrounded
77 *       and resumed at a later time, the app will receive all of the steps counted during the background
78 *       period in the very next update.  The handler will be called when the number of steps (as defined by
79 *       the user) has been detected on a best effort basis.
80 */
81- (void)startStepCountingUpdatesToQueue:(NSOperationQueue *)queue
82                               updateOn:(NSInteger)stepCounts
83                            withHandler:(CMStepUpdateHandler)handler;
84
85
86/*
87 *  stopStepCountingUpdates
88 *
89 *  Discussion:
90 *      Stops step counting updates.  Upon deallocation of CMStepCounter, this function will be
91 *      automatically invoked if updates are still active and stopStepCountingUpdates has not been
92 *      called.
93 */
94- (void)stopStepCountingUpdates;
95
96@end
Note: See TracBrowser for help on using the repository browser.