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
101
102
103
104
|
//
// THV3.h
// iHealthDemoCode
//
// Created by Realank on 2016/12/23.
// Copyright © 2016年 zhiwei jing. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
THV3RcvDataType
*/
typedef NS_ENUM(NSUInteger, THV3RcvDataType) {
/// recieve real time temperature
THV3RcvDataRT,
/// recieve button event
THV3RcvDataButtonStatus,
};
/**
THV3RcvButtonType
*/
typedef NS_ENUM(NSUInteger, THV3RcvButtonType) {
/// placeholder
THV3RcvBtnNone,
/// power button
THV3RcvBtnPower,
/// audio button
THV3RcvBtnAudio,
/// M button
THV3RcvBtnMemory,
/// unit button
THV3RcvBtnCF
};
/**
THV3Status
*/
typedef NS_ENUM(NSUInteger, THV3Status) {
/// not init
THV3StatusUnInit,
/// init time
THV3StatusInitTime,
/// init configuration
THV3StatusInitConfig,
/// working
THV3StatusWorking,
};
@interface THV3HistoryData : NSObject
@property (nonatomic, strong) NSDate* measureDate;
@property (nonatomic, assign) float temperature;
@property (nonatomic, assign) BOOL isHumanBody;
@end
/**
ReceiveHistoryBlock
@param dataArray THV3HistoryData object's array
*/
typedef void(^ReceiveHistoryBlock)(NSArray<THV3HistoryData*>* dataArray);
/**
ConfigResultBlock
@param success YES:success NO:fail
*/
typedef void(^ConfigResultBlock)(BOOL success);
@interface THV3 : NSObject
@property (nonatomic, assign) THV3Status status;//status to flag whether device is ready
@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSString *currentUUID;
//‘serialNumber’ is for separating different device when multiple device have been connected.
@property (strong, nonatomic) NSString *serialNumber;//MAC
@property (strong, nonatomic) NSTimer *firmwareVersion;
@property (nonatomic, assign) THV3RcvDataType rtDataType;
@property (nonatomic, strong) THV3HistoryData* rtTemperature;// for temperature
@property (nonatomic, assign) BOOL voltIsNormal;// for battary
@property (nonatomic, assign) THV3RcvButtonType buttonType;//for button use
@property (nonatomic, assign) BOOL isButtonOn;//for button use
//status
@property (nonatomic, assign) NSInteger idleTimeInterval;
@property (nonatomic, assign) BOOL isUnitCelsius;
@property (nonatomic, assign) BOOL isTargetHuman;
@property (nonatomic, assign) BOOL isOfflineMode;
- (void)readHistoryDataWithResultBlock:(ReceiveHistoryBlock)receivedDataBlock;
- (void)configIdleTime:(NSUInteger)timeInterval withResultBlock:(ConfigResultBlock)resultBlock;
- (void)configTemperUnit:(BOOL)isCelsius withResultBlock:(ConfigResultBlock)resultBlock;
- (void)configMeasureTarget:(BOOL)isHumanBody withResultBlock:(ConfigResultBlock)resultBlock;
- (void)configOfflineMode:(BOOL)isOffline withResultBlock:(ConfigResultBlock)resultBlock;
/**
Disconnect device. If this method is called immediately after "readHistoryDataWithResultBlock:" method, the history data will not be cleared automatically.
*/
- (void)commandDisconnectDevice;
@end
|