-
Notifications
You must be signed in to change notification settings - Fork 72
/
HeartBeat.h
100 lines (68 loc) · 2.15 KB
/
HeartBeat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// HeartBeat.h
// HeartBeatsPlugin
//
// Created by A053 on 16/9/6.
// Copyright © 2016年 Yvan. All rights reserved.
//
/*
--------Block方法----------
[[HeartBeat shareManager] startHeartRatePoint:^(NSDictionary *point) {
} Frequency:^(NSInteger fre) {
} Error:^(NSError *error) {
}];
// 结束时调用
[[HeartBeat shareManager]stop];
--------Delegate方法------------
[HeartBeat shareManager].delegate = self;
[[HeartBeat shareManager] start];
// 结束时调用
[[HeartBeat shareManager]stop];
// 代理回调
- (void)startHeartDelegateRatePoint:(NSDictionary *)point {
NSLog(@"%@",point);
}
// 代理错误回调
- (void)startHeartDelegateRateError:(NSError *)error {
NSLog(@"%@",error);
}
// 返回心率
- (void)startHeartDelegateRateFrequency:(NSInteger)frequency {
}
*/
#import <UIKit/UIKit.h>
@protocol HeartBeatPluginDelegate <NSObject>
- (void)startHeartDelegateRatePoint:(NSDictionary *)point;
@optional
- (void)startHeartDelegateRateError:(NSError *)error;
- (void)startHeartDelegateRateFrequency:(NSInteger)frequency;
@end
@interface HeartBeat : NSObject
@property (copy, nonatomic) void ((^backPoint)(NSDictionary *));
@property (copy, nonatomic) void ((^frequency)(NSInteger ));
@property (copy, nonatomic) void ((^Error)(NSError *));
@property (assign, nonatomic) id <HeartBeatPluginDelegate> delegate;
/**
* 单例
*/
+ (instancetype)shareManager;
- (void)start;
/**
* 调用摄像头测心率方法
*
* @param backPoint 浮点和时间戳的 实时回调
* * 数据类型 字典
* * 数据格式 { "1473386373135.52" = "0.3798618"; }
* * 字典Key: NSNumber类型double浮点数->时间戳 小数点前精确到毫秒
* * 字典Value: NSNumber类型float浮点数,数据未处理全部返回
* @param frequency 返回心率
* @param error 错误信息
*/
- (void)startHeartRatePoint:(void(^)(NSDictionary *point))backPoint
Frequency:(void(^)(NSInteger fre))frequency
Error:(void(^)(NSError *error))error;
/**
* 结束方法
*/
- (void)stop;
@end