summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/ECG3USB.h
blob: 58820288ec502b0da585c4e6ce872dbac1ba107c (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
//
//  ECG3.h
//  iHealthDemoCode
//
//  Created by daiqingquan on 15/9/15.
//  Copyright (c) 2015年 zhiwei jing. All rights reserved.
//

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

/**
 Sync Start
 */
typedef void (^ECG3USBSyncStartBlock)(void);

/**
 Sync Progress

 @param progress 0-100
 */
typedef void (^ECG3USBSyncProgressBlock)(NSUInteger progress);

/**
 @brief Sync Result

 @param resultArray An array contains Dictionary
 @code Dictionary format: {
 @"SampleRate":@(sampleRate),
 @"StartTime":startTimeString,
 @"EndTime":endTimeString,
 @"FileName":fileName,
 @"FilePath":path
 });
 @endcode
 @param finish YES means all data has been uploaded, NO means not all data has been uploaded because of some reasons sucn as device disconnect\communication error\iOS device's memory issue\raw data error. The reason you can get from ECG3USBErrorBlock.
 */
typedef void (^ECG3USBSyncResultBlock)(NSArray *resultArray,BOOL finish);

/**
 Sync Error

 @param errorID error ID
 */
typedef void (^ECG3USBErrorBlock)(ECG3USBError errorID);


/**
 Format SD Card Success
 */
typedef void (^ECG3FormatSDCardSuccessBlock)(void);

/**
 Format SD Card Fail
 */
typedef void (^ECG3FormatSDCardFailBlock)(ECG3USBError error);
/**
 Format Progress
 
 @param progress 0-100
 */
typedef void (^ECG3USBFormatProgressBlock)(NSUInteger progress);
/**
 ECG3USB
 */
@interface ECG3USB : NSObject
@property (strong, nonatomic) NSString *currentUUID;
@property (strong, nonatomic) NSString *serialNumber;
@property (strong, nonatomic) NSString *firmwareVersion;

/**
 Sync Data

 @param startBlock means start
 @param progressBlock 0-100
 @param resultBlock You can get filtered data from the NSDocumentDirectory path.
 
 Abnormal Point Marked by User: OBData_FileName.xml
 Filtered ECG Data: ECGAnalyseResult_FileName.dat
 Lead Off Begin Point: ECGLeadOffBegin_FileName.xml
 Lead Off End Point: ECGLeadOffEnd_FileName.xml
 ECG HR Information EveryHour: ECGHREveryHour_FileName.xml
 Abnormal Point Filtered by Algorithm: ECGOBbyFilter_FileName.xml
 ECG HR Information for Day: ECGDetail_FileName.xml
 @param errorBlock error
 
 */
- (void)syncDataWithStartBlock:(ECG3USBSyncStartBlock)startBlock
                 progressBlock:(ECG3USBSyncProgressBlock)progressBlock
                   resultBlock:(ECG3USBSyncResultBlock)resultBlock
                    errorBlock:(ECG3USBErrorBlock)errorBlock;

/**
 Format SD Card

 @param successBlock Success
 @param progressBlock 0-100
 @param failBlock Fail
 */
-(void)formatSDCard:(ECG3FormatSDCardSuccessBlock)successBlock
      progressBlock:(ECG3USBFormatProgressBlock)progressBlock
         errorBlock:(ECG3FormatSDCardFailBlock)failBlock;

/**
 Splice data
 
 @param fileNames An Array with FileName value from ECG3USBSyncResultBlock
 @param successBlock a block contains a dictionary with keys: success(@{@"DataFileName":dataFileName,@"MarkFileName":markFileName,@"StartTime":yyyyMMddHHmmss,@"EndTime":yyyyMMddHHmmss,@"FilePath":directory});
 @param errorBlock a block contains error message
 */
+ (void)spliceWithFileNames:(NSArray<NSString *>*)fileNames
               successBlock:(void(^)(NSDictionary *dic))successBlock
                 errorBlock:(void(^)(ECG3USBError error,NSString *message))errorBlock;


/**
 Get data cache

 @param block An array contains Dictionary object
 {
 @"SampleRate":@(sampleRate),
 @"StartTime":startTimeString,
 @"EndTime":endTimeString,
 @"FileName":fileName,
 @"FilePath":path
 });
 */
- (void)getCacheDataWithBlock:(void(^)(NSArray *array))block;

/**
 

 @param dic the dictionary from the success block of method ’synthesisWithFileNames:success:error:‘
 */

/**
 Filter

 @param dic the dictionary from the success block of method ’synthesisWithFileNames:success:error:‘
 @param success see ECG3USBSyncResultBlock comments
 @param error a block contains error message (If the files don't exist, no error block retrun but print error message in the console)
 */
- (void)getFilterDataWithDic:(NSDictionary *)dic success:(ECG3USBSyncResultBlock)success error:(void(^)(NSString *message))error;

@end