summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/BPDevice.h
blob: 8f7a96bb81df5b5c3b41cc745a9474ec3d0a906c (plain)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
//  BPDevice.h
//  iHealthDemoCode
//
//  Created by Realank on 2017/1/4.
//  Copyright © 2017年 ihealthSDK. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BPMacroFile.h"


/**
 a BP protocol related to realtime measure
 */
@protocol BPRealtimeMeasureProtocol <NSObject>

/**
 * Establish measurement connection and start BP measurement.
 * @param blockZeroState Zeroing state
 * @param pressure  Pressure value in the process of measurement, the unit is ‘mmHg’.
 * @param blockWaveletWithHeartbeat  Wavelet data set including pulse rate
 * @param blockWaveletWithoutHeartbeat   Wavelet data set without pulse rate
 * @param result   result of the measurement, including systolic pressure, diastolic pressure, pulse rate and irregular judgment. Relevant key: time, sys, dia, heartRate, irregular. irregular will be 0 or 1.
 * @param error   Return error codes.
 */
-(void)commandStartMeasureWithZeroingState:(BlockZero)blockZeroState pressure:(BlockPressure)pressure waveletWithHeartbeat:(BlockWavelet)blockWaveletWithHeartbeat waveletWithoutHeartbeat:(BlockWavelet)blockWaveletWithoutHeartbeat  result:(BlockMeasureResult)result errorBlock:(BlockError)error;

/**
 * stop measuring state of BP
 * @param success  The block return means measurement has been successfully stoped.
 * @param error  Return error codes.
 */
-(void)stopBPMeassureSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error;

@end


/**
 a BP protocol related to offline data transfer
 */
@protocol BPOfflineDataTransferProtocol <NSObject>

/**
 *  Upload offline data.
 * @param  totalCount quantity of total history data
 * @param  progress upload completion ratio , from 0.0 to 1.0, 1.0 means upload completed.
 * @param  uploadDataArray	offline data set, may including measurement time, systolic pressure, diastolic pressure, pulse rate, irregular judgment,scheme ID, body movement flag. corresponding KEYs are time, sys, dia, heartRate, irregular,schemeID,bodyMovementFlg.
 * @param error   Return error codes.
 */
-(void)commandTransferMemoryDataWithTotalCount:(BlockBachCount)totalCount progress:(BlockBachProgress)progress dataArray:(BlockBachArray)uploadDataArray errorBlock:(BlockError)error;


/**
 * Upload offline data total Count.
 * @param  totalCount  quantity of total history data.
 * @param error  Return error codes.
 */
-(void)commandTransferMemoryTotalCount:(BlockBachCount)totalCount errorBlock:(BlockError)error;

-(void)commandDeleteDataSuccessBlock:(BlockSuccess)success errorBlock:(BlockError)error;

@end


/**
 a BP protocol related to basic function, such as get function, get energy
 */
@protocol BPBasicProtocol <NSObject>

/**
 * Synchronize time and judge if the device supports BT auto-connection, offline detection, and if the function on or off, corresponding KEY are haveBlue, haveOffline, blueOpen, offlineOpen. ‘True’ means yes or on, ‘False’ means no or off
 * @param function  A block to return the function and states that the device supports.
 * @param error  Return error codes.
 */
-(void)commandFunction:(BlockDeviceFunction)function errorBlock:(BlockError)error;

/**
 * Get battery remaining energy by percent
 * @param energyValue  A block to return the device battery remaining energy percentage, ‘80’ stands for 80%.
 * @param error  Return error codes.
 */
-(void)commandEnergy:(BlockEnergyValue)energyValue errorBlock:(BlockError)error;

@end


/**
 a BP protocol related to basic function and disconnect
 */
@protocol BPBasicBTLEProtocol <BPBasicProtocol>

/**
 * Disconnect current device
 */
-(void)commandDisconnectDevice;

@end


/**
 a BP protocol related to enable offline
 */
@protocol BPEnableOfflineProtocol <BPBasicProtocol>

/**
 * set up offline detection
 * @param open  True means on; False means off.
 * @param successBlock  A block to refer ‘set success’.
 * @param errorBlock  A block to refer ‘set failed’.
 */
-(void)commandSetOffline:(BOOL)open success:(BlockSuccess)successBlock error:(BlockError)errorBlock;

@end


/**
 BP device basic class
 */
@interface BPDevice : NSObject

@property (copy, nonatomic) NSString *currentUUID;
///‘serialNumber’ is for separating different device when multiple device have been connected.
@property (copy, nonatomic) NSString *serialNumber;
@property (copy, nonatomic) NSString *firmwareVersion;
@property (copy, nonatomic) NSString *hardwareVersion;
@property (copy, nonatomic) NSString *deviceName;
@property (copy, nonatomic) NSString *protocolString;
@property (copy, nonatomic) NSString *modelNumber;
@property (copy, nonatomic) NSNumber *isNew550BT;
@end