Files
ResearchKit/ResearchKitActiveTask/Tapping/ORKTappingIntervalResult.h
Pariece McKinney b14e5cfcb0 Public Release 3.0
2024-03-28 19:39:04 -04:00

142 lines
5.0 KiB
Objective-C

/*
Copyright (c) 2015, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <ResearchKit/ORKResult.h>
NS_ASSUME_NONNULL_BEGIN
/**
Values that identify the button that was tapped in a tapping sample.
*/
typedef NS_ENUM(NSInteger, ORKTappingButtonIdentifier) {
/// The touch landed outside of the two buttons.
ORKTappingButtonIdentifierNone,
/// The touch landed in the left button.
ORKTappingButtonIdentifierLeft,
/// The touch landed in the right button.
ORKTappingButtonIdentifierRight
} ORK_ENUM_AVAILABLE;
/**
The `ORKTappingSample` class represents a single tap on a button.
The tapping sample object records the location of the tap, the
button that was tapped, and the time at which the event occurred. A tapping sample is
included in an `ORKTappingIntervalResult` object, and is recorded by the
step view controller for the corresponding task when a tap is
recognized.
A tapping sample is typically generated by the framework as the task proceeds. When the task
completes, it may be appropriate to serialize the sample for transmission to a server,
or to immediately perform analysis on it.
*/
ORK_CLASS_AVAILABLE
@interface ORKTappingSample : NSObject <NSCopying, NSSecureCoding>
/**
A relative timestamp indicating the time of the tap event.
The timestamp is relative to the value of `startDate` in the `ORKResult` object that includes this
sample.
*/
@property (nonatomic, assign) NSTimeInterval timestamp;
/**
A duration of the tap event.
The duration store time interval between touch down and touch release events.
*/
@property (nonatomic, assign) NSTimeInterval duration;
/**
An enumerated value that indicates which button was tapped, if any.
If the value of this property is `ORKTappingButtonIdentifierNone`, it indicates that the tap
was near, but not inside, one of the target buttons.
*/
@property (nonatomic, assign) ORKTappingButtonIdentifier buttonIdentifier;
/**
The location of the tap within the step's view.
The location coordinates are relative to a rectangle whose size corresponds to
the `stepViewSize` in the enclosing `ORKTappingIntervalResult` object.
*/
@property (nonatomic, assign) CGPoint location;
@end
/**
The `ORKTappingIntervalResult` class records the results of a tapping interval test.
The tapping interval result object records an array of touch samples (one for each tap) and also the geometry of the
task at the time it was displayed. You can use the information in the object for reference in interpreting the touch
samples.
A tapping interval sample is typically generated by the framework as the task proceeds. When the task
completes, it may be appropriate to serialize it for transmission to a server,
or to immediately perform analysis on it.
*/
ORK_CLASS_AVAILABLE
@interface ORKTappingIntervalResult : ORKResult
/**
An array of collected samples, in which each item is an `ORKTappingSample` object that represents a
tapping event.
*/
@property (nonatomic, copy, nullable) NSArray<ORKTappingSample *> *samples;
/**
The size of the bounds of the step view containing the tap targets.
*/
@property (nonatomic) CGSize stepViewSize;
/**
The frame of the left button, in points, relative to the step view bounds.
*/
@property (nonatomic) CGRect buttonRect1;
/**
The frame of the right button, in points, relative to the step view bounds.
*/
@property (nonatomic) CGRect buttonRect2;
@end
NS_ASSUME_NONNULL_END