summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/Communication_SDK/Headers/HS2S.h
blob: 96b482901779613b4d3f15e419dafb7f33ec451b (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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
//
//  HS2S.h
//  iHealthSDKStatic
//
//  Created by jing on 2019/5/8.
//  Copyright © 2019 ihealthSDK. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HSMacroFile.h"
NS_ASSUME_NONNULL_BEGIN

@interface HS2S : NSObject

@property (strong, nonatomic) NSString *serialNumber;
@property (strong, nonatomic) NSString *currentUUID;
@property (nonatomic,strong) NSNumber *hs2sDeviceFlag;
/**
 *Get HS2S DeviceInfo (After the HS2S device is successfully connected, the interface must be called to synchronize the device time. Otherwise, the offline data measurement time error will be caused)
 
 * @param deviceInfo Contains  device IDPS info(FirmwareVersion,HardwareVersion,Manufacture,ModelNumber,ProtocolString,SerialNumber),user count ,HS2S current unit(1:Kg,2:LB,3:ST),battery
 * Example:
 * {
           Battary = 70;
           DeviceName = HS2S;
           FirmwareVersion = "0.5.4";
           HardwareVersion = "1.0.0";
           Manufacture = iHealth;
           ModelNumber = "HS2S 11070";
           ProtocolString = "com.jiuan.BFSV22";
           SerialNumber = 004D320CA04D;
           Unit = 1;
           UserCount = 1;
 * }
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SDeviceInfo:(DisposeHS2SDeviceInfo)deviceInfo DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;


/**
 *Get HS2S battery
 
 * @param battary HS2Sbattery [Range:0~100]%
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SBattery:(DisposeHS2SBatteryBlock)battary DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;


/**
 
 * SetUnit
 
 * Import parameter:
 * @param tempUnit  -Unit displayed on HS2S: HSUnit_Kg、HSUnit_LB、HSUnit_ST。
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */

-(void)commandSetHS2SUnit:(HSUnit)tempUnit result:(DisposeHS2SResult)result  DisposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 * Get HS2S UserInfo
 * Return parameters:
 * @param userInfo  NSDictionary type,contains: UserCount and UserInfo
 * Example:
 * {
        UserCount = 1;
        UserInfo =(
            {
              "UserInfo_Age" = 20;
              "UserInfo_Height" = 100;
              "UserInfo_CreatTS" = 1558406503;                      //User creat time
              "UserInfo_ID" = <69486561 6c746831 32333435 36373839>;
              "UserInfo_ImpedanceMark" = 1;                         //0 Don't measure 1 Measure
              "UserInfo_SEX" = 1;                                   //0 female 1 male,
              "UserInfo_Weight" = "79.5";
              "UserInfo_Fitness" = 1;                               //0:Don't fitness 1:fitness
            }
         );
 * }
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SUserInfo:(DisposeHS2SUserInfo)userInfo DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 * Create or Update HS2S UserInfo (The HS2S device only supports the creation of a maximum of 8 users)
 * Import parameter:
 * @param user (user information must be entered in accordance with the reference range, otherwise it may be impossible to measure the accurate body fat information)
 
 * contains:
 * hs2SUserID:NSData type,The user ID must be 16 bytes or the user creation fails,
 * createTS:NSInteger type,The unit of time is seconds ,
 * weight:NSNumber type,range:20-150kg,
 * age:NSNumber type,range:18-99 years,
 * height:NSNumber type,range:90-220cm
 * sex:0 female 1 male,
 * impedanceMark: 0 Don't measure 1 Measure
 * fitnessMark:0 Don't fitness 1:fitness
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandUpdateHS2SUserInfoWithUser:(HealthUser*)user result:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Delete HS2S User
 * Import parameter:
 * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails,
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandDeleteHS2SUserWithUserID:(NSData*)userID result:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Get HS2S Memory data count
 * Import parameter:
 * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails,
 * Return parameters:
 * @param count  NSNumber Type,memory count
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SMemoryDataCountWithUserID:(NSData*)userID memoryCount:(DisposeHS2SMemoryCountBlock)count DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Get HS2S Memory data
 
 Lean mass calculation formula: result = weight * (1 - body fat percentage)
 BMI calculation formula: result = weight / (height * height)
 BMR calculation formula:
 If no fat is measured
 {
 For men:
 P = 13.397* weight + 4.799* height – 5.677* age + 88.362
 For women:
 P = 9.247* weight + 3.098* height – 4.330* age + 447.593
 If the user enters the sport level in the app, correct the P:
 Sport level=1, P = P*1.0
 Sport level = 2, P = P*1.05
 Sport level = 3, P = P*1.10
 }
 When fat is measured:
 {
 P=370 + 21.6*Lean mass(kg )
 }
 * Import parameter:
 * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails,
 * Return parameters:
 * @param memoryData NSArray Type,memory data
 * Example:
 * (
 
          {
               DeviceMac = 004D320CA04D;                      //device mac
               HS2SBodyAge = 10;                              //body age
               HS2SBodyWaterPercentAge = "39.3";              //body moisture rate
               HS2SBoneMineral = "1.9";                       //Bone salt
               HS2SFatControl = 0;                            //Fat Control
               HS2SFatWeight = 0;                             //Fat weight
               HS2SFitness = 1;                               //0:Don't fitness 1:fitness
               HS2SImpedance = ();                            //NSArray type ,Impedance
               HS2SIsRightTS = 1;                             //0:Incorrect, unsynchronized time on measured data 1:Correct, synchronize the measured data after the time
               HS2SMeasureTS = "2019-05-18 08:56:38 +0000";
               HS2SMuscle = "13.1";                           //Muscle mass
               HS2SMuscleControl = 0;                         //Muscle Control
               HS2SProteinPercentAge = "9.8";                 //Protein rate
               HS2SResultBodyFatPercentAge = "44.2";          //Body fat rate
               HS2SBodyWeightFlag = 0;                        //0:Body fat was not measured 1:Measure body fat
               HS2SSkeletalMuscle = 0;                        //Skeletal Muscle
               HS2SStandardWeight = 0;                        //Standard Weight
               HS2SVFR = 29;                                  //Visceral fat grade
               HS2SWeightControl = 0;                         //Weight Control
               HS2SWeigthResult = "79.5";
               "UserInfo_Age" = 18;
               "UserInfo_Height" = 100;
               "UserInfo_SEX" = 1;
          }
 * )
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SMemoryDataWithUserID:(NSData*)userID memoryData:(DisposeHS2SMemoryDataBlock)memoryData DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Delete HS2S Memory data
 * Import parameter:
 * @param userID :NSData type,The user ID must be 16 bytes or the user creation fails,
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandDeleteHS2SMemoryDataWithUserID:(NSData*)userID result:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Get HS2S Anonymous Memory data count
 * Return parameters:
 * @param count memory count
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SAnonymousMemoryDataCount:(DisposeHS2SAnonymousMemoryCountBlock)count DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Get HS2S Anonymous Memory data
 * Return parameters:
 * @param memoryData  NSArray type,Each result dictionary contains: HS2SIsRightTS(Time correctness identification,0:Incorrect, unsynchronized time on measured data 1:Correct, synchronize the measured data after the time),HS2SMeasureTS(Measure Time,NSdate type),HS2SWeigthResult(Weigth Result)
 * Example:
 * (
        {
           HS2SIsRightTS = 0;    //Time correctness identification
           HS2SMeasureTS = "2019-05-18 07:18:36 +0000";
           HS2SWeigthResult = "43.7";
        }
 * )
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandGetHS2SAnonymousMemoryData:(DisposeHS2SAnonymousMemoryDataBlock)memoryData DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *  Delete HS2S Anonymous Memory data
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandDeleteHS2SAnonymousMemoryData:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;


/**
 *  Measure HS2S Data
 * Import parameter:
 * @param user (user information must be entered in accordance with the reference range, otherwise it may be impossible to measure the accurate body fat information)
 
       Lean mass calculation formula: result = weight * (1 - body fat percentage)
       BMI calculation formula: result = weight / (height * height)
       BMR calculation formula:
       If no fat is measured
      {
          For men:
          P = 13.397* weight + 4.799* height – 5.677* age + 88.362
          For women:
          P = 9.247* weight + 3.098* height – 4.330* age + 447.593
          If the user enters the sport level in the app, correct the P:
          Sport level=1, P = P*1.0
          Sport level = 2, P = P*1.05
          Sport level = 3, P = P*1.10
      }
       When fat is measured:
      {
           P=370 + 21.6*Lean mass(kg )
      }
 * contains:
 * userType :  0 guest  1 normal
 * hs2SUserID:NSData type,The user ID must be 16 bytes or the user creation fails,
 * createTS:NSInteger type,The unit of time is seconds ,
 * weight:NSNumber type,range:20-150kg,
 * age:NSNumber type,range:18-99 years,
 * height:NSNumber type,range:90-220cm
 * sex:0 female 1 male,
 * impedanceMark: 0 Don't measure 1 Measure
 * fitnessMark:0 Don't fitness 1:fitness
 * Return parameters:
 * @param unStableWeight     - Current weight, (Kg) [Value Range:0~180]
 * @param stableWeight       - Stable weight, (Kg) [Value Range:0~180]
 * @param weightAndBodyInfo  Weight and body fat information   guest user not return weightAndBodyInfo
 * Example:
 * {
       DeviceMac = 004D320CA04D;                      //device mac
       HS2SBodyAge = 10;                              //body age
       HS2SBodyWaterPercentAge = "39.3";              //body moisture rate
       HS2SBoneMineral = "1.9";                       //Bone salt
       HS2SFatControl = 0;                            //Fat Control
       HS2SFatWeight = 0;                             //Fat weight
       HS2SFitness = 1;                               //0:Don't fitness 1:fitness
       HS2SImpedance = ();                            //NSArray type ,Impedance
       HS2SMeasureTS = "2019-05-18 08:56:38 +0000";
       HS2SMuscle = "13.1";                           //Muscle mass
       HS2SMuscleControl = 0;                         //Muscle Control
       HS2SProteinPercentAge = "9.8";                 //Protein rate
       HS2SResultBodyFatPercentAge = "44.2";          //Body fat rate
       HS2SBodyWeightFlag = 0;                        //0:Body fat was not measured 1:Measure body fat
       HS2SSkeletalMuscle = 0;                        //Skeletal Muscle
       HS2SStandardWeight = 0;                        //Standard Weight
       HS2SVFR = 29;                                  //Visceral fat grade
       HS2SWeightControl = 0;                         //Weight Control
       HS2SWeigthResult = "79.5";
       "UserInfo_Age" = 18;
       "UserInfo_Height" = 100;
       "UserInfo_SEX" = 1;
 * }
 * @param measureFinish  If HS2S is measuring weight, the call to the online measurement interface will fail at the beginning, and the call to the interface will succeed when the return measurement is completed.
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandStartHS2SMeasureWithUser:(HealthUser*)user weight:(DisposeHS2SUnStableWeight)unStableWeight stableWeight:(DisposeHS2SStableWeight)stableWeight weightAndBodyInfo:(DisposeHS2SWeightAndBodyInfo)weightAndBodyInfo  disposeHS2SMeasureFinish:(DisposeHS2SMeasureFinish)measureFinish DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;


/**
 *  Reset HS2S device
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandResetHS2SDevice:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *   HS2S BroadCastType device
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandBroadCastTypeHS2SDevice:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;


/**
 Disconnect current device
 */

-(void)commandDisconnectDevice;

/**
 *   HS2S Light up bluetooth
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandSetHS2SDeviceLightUp:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;




/**
 *   HS2S  Enter heart rate measurement mode
 * Return parameters:
 * @param result
 *  heartResultDic:{
    HeartValue = 0;
    ResultStatus = 1;(0: success,
                 1: failed 1, no real-time data received in 6s
                 2: Failure 2, the algorithm judges that the user is weighing down
                 3: Failure 3, calculation failed
                 4: Failure 4: 30s timeout)
  }

 * @param status  ( 1: User on the scale
                  2: User referred below
                  3: The user's heartbeat signal is detected)
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandEnterHS2SHeartRateMeasurementMode:(DisposeHS2SHeartResult)result measurementStatus:(DisposeHS2SMeasurementStatus)status  DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;

/**
 *   HS2S  Exit heart rate measurement mode
 * Return parameters:
 * @param result   YES:Success  NO:Failed
 * @param disposeErrorBlock  - error code
 * Error code definition:
 *  refer to “error” : HS2S error instruction.
 */
-(void)commandExitHS2SHeartRateMeasurementMode:(DisposeHS2SResult)result DiaposeErrorBlock:(DisposeHS2SErrorBlock)disposeErrorBlock;


@end




NS_ASSUME_NONNULL_END