diff options
Diffstat (limited to 'libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m')
| -rw-r--r-- | libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m | 542 |
1 files changed, 542 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m new file mode 100644 index 0000000..24751a1 --- /dev/null +++ b/libs/ihealth-sdk/ios/ReactNativeIOSLibrary/AM5Module.m | |||
| @@ -0,0 +1,542 @@ | |||
| 1 | // | ||
| 2 | // AM5Module.m | ||
| 3 | // ReactNativeIOSLibrary | ||
| 4 | // | ||
| 5 | // Created by daiqingquan on 2016/12/4. | ||
| 6 | // Copyright © 2016年 daiqingquan. All rights reserved. | ||
| 7 | // | ||
| 8 | |||
| 9 | #import "AM5Module.h" | ||
| 10 | #import "AM5.h" | ||
| 11 | #import "AM5Controller.h" | ||
| 12 | #import "AM5ProfileModule.h" | ||
| 13 | #import "AM5Header.h" | ||
| 14 | @implementation AM5Module{ | ||
| 15 | |||
| 16 | |||
| 17 | NSMutableDictionary*resultDic; | ||
| 18 | |||
| 19 | } | ||
| 20 | |||
| 21 | #define EVENT_NOTIFY @"event_notify_am5" | ||
| 22 | #define kMAC_KEY @"mac" | ||
| 23 | #define kACTION_KEY @"action" | ||
| 24 | |||
| 25 | |||
| 26 | RCT_EXPORT_MODULE() | ||
| 27 | - (NSArray<NSString *> *)supportedEvents { | ||
| 28 | return @[@"event_notify", @"event_scan_device", @"event_scan_finish", | ||
| 29 | @"event_device_connected", @"event_device_connect_failed", | ||
| 30 | @"event_device_disconnect", @"event_authenticate_result", | ||
| 31 | @"event_notify_ts28b", @"event_notify_bg1", | ||
| 32 | @"action_connect_result_for_bg1"]; | ||
| 33 | } | ||
| 34 | |||
| 35 | |||
| 36 | |||
| 37 | #pragma mark | ||
| 38 | #pragma mark - constantsToExport | ||
| 39 | - (NSDictionary *)constantsToExport | ||
| 40 | { | ||
| 41 | return @{ @"Event_Notify": EVENT_NOTIFY }; | ||
| 42 | |||
| 43 | } | ||
| 44 | |||
| 45 | + (BOOL)requiresMainQueueSetup | ||
| 46 | { | ||
| 47 | return YES; | ||
| 48 | } | ||
| 49 | |||
| 50 | -(void)dealloc{ | ||
| 51 | [[NSNotificationCenter defaultCenter]removeObserver:self]; | ||
| 52 | } | ||
| 53 | |||
| 54 | -(AM5*)getAM5WithMac:(NSString*)mac{ | ||
| 55 | |||
| 56 | AM5Controller *controller = [AM5Controller shareAM5Controller]; | ||
| 57 | NSArray *poDeviceArray = [controller getAllCurrentAM5Instace]; | ||
| 58 | |||
| 59 | for(AM5 *tempAM5 in poDeviceArray){ | ||
| 60 | if([mac isEqualToString:tempAM5.serialNumber]){ | ||
| 61 | |||
| 62 | return tempAM5; | ||
| 63 | break; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | return nil; | ||
| 68 | } | ||
| 69 | |||
| 70 | #pragma mark | ||
| 71 | #pragma mark - Method | ||
| 72 | |||
| 73 | RCT_EXPORT_METHOD(getAllConnectedDevices){ | ||
| 74 | |||
| 75 | |||
| 76 | NSArray*AM5array= [[AM5Controller shareAM5Controller] getAllCurrentAM5Instace]; | ||
| 77 | |||
| 78 | NSMutableArray*deviceMacArray=[NSMutableArray array]; | ||
| 79 | |||
| 80 | for (int i=0; i<[AM5array count]; i++) { | ||
| 81 | |||
| 82 | AM5*am5=[AM5array objectAtIndex:i]; | ||
| 83 | |||
| 84 | [deviceMacArray addObject:am5.serialNumber]; | ||
| 85 | |||
| 86 | } | ||
| 87 | |||
| 88 | NSDictionary* deviceInfo = @{kACTION_KEY:kACTION_GET_ALL_CONNECTED_DEVICES,@"devices":deviceMacArray}; | ||
| 89 | |||
| 90 | [self sendEventWithName:EVENT_NOTIFY body:deviceInfo]; | ||
| 91 | |||
| 92 | |||
| 93 | } | ||
| 94 | |||
| 95 | #pragma mark 绑定 | ||
| 96 | RCT_EXPORT_METHOD(bindDevice:(nonnull NSString *)mac){ | ||
| 97 | |||
| 98 | |||
| 99 | if ([self getAM5WithMac:mac]) { | ||
| 100 | __weak typeof(self) weakSelf = self; | ||
| 101 | |||
| 102 | |||
| 103 | [[self getAM5WithMac:mac] commandBindingDevice:^(BOOL result) { | ||
| 104 | |||
| 105 | NSLog(@"BindingDevice:%d",result); | ||
| 106 | |||
| 107 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 108 | kMAC_KEY:mac, | ||
| 109 | kACTION_KEY:kACTION_USER_BIND, | ||
| 110 | OPERATION_STATUS:@3, | ||
| 111 | TYPE:@"AM5", | ||
| 112 | ERROR_DESCRIPTION:@"no error" | ||
| 113 | }]; | ||
| 114 | |||
| 115 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 116 | |||
| 117 | }]; | ||
| 118 | |||
| 119 | |||
| 120 | } | ||
| 121 | |||
| 122 | } | ||
| 123 | #pragma mark 解除绑定 | ||
| 124 | RCT_EXPORT_METHOD(unBindDevice:(nonnull NSString *)mac){ | ||
| 125 | |||
| 126 | |||
| 127 | if ([self getAM5WithMac:mac]) { | ||
| 128 | __weak typeof(self) weakSelf = self; | ||
| 129 | |||
| 130 | |||
| 131 | [[self getAM5WithMac:mac] commandUnBindingDevice:^(BOOL result) { | ||
| 132 | |||
| 133 | NSLog(@"BindingDevice:%d",result); | ||
| 134 | |||
| 135 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 136 | kMAC_KEY:mac, | ||
| 137 | kACTION_KEY:kACTION_USER_UNBIND, | ||
| 138 | OPERATION_STATUS:@3, | ||
| 139 | TYPE:@"AM5", | ||
| 140 | ERROR_DESCRIPTION:@"no error" | ||
| 141 | }]; | ||
| 142 | |||
| 143 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 144 | |||
| 145 | }]; | ||
| 146 | |||
| 147 | |||
| 148 | } | ||
| 149 | |||
| 150 | } | ||
| 151 | |||
| 152 | #pragma mark 获取设备信息 | ||
| 153 | RCT_EXPORT_METHOD(getBasicInfo:(nonnull NSString *)mac){ | ||
| 154 | //Mode:Device mode BatteryStatus:Battery status BatteryLevel:Battery level RebootFlag:Whether to restart BindTimeStr:Binding timestamp BindState:Binding status | ||
| 155 | |||
| 156 | if ([self getAM5WithMac:mac]) { | ||
| 157 | __weak typeof(self) weakSelf = self; | ||
| 158 | |||
| 159 | |||
| 160 | [[self getAM5WithMac:mac] commandGetDeviceInfo:^(NSMutableDictionary *DeviceInfo) { | ||
| 161 | |||
| 162 | NSLog(@"DeviceINfo:%@",DeviceInfo); | ||
| 163 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 164 | kMAC_KEY:mac, | ||
| 165 | kACTION_KEY:kACTION_BASIC_INFO, | ||
| 166 | TYPE:@"AM5", | ||
| 167 | BASIC_BATTSTATUS:[DeviceInfo valueForKey:@"BatteryStatus"], | ||
| 168 | BASIC_DEIVCEID:@"7041", | ||
| 169 | BASIC_ENERGE:[DeviceInfo valueForKey:@"BatteryLevel"], | ||
| 170 | BASIC_FIRMWAREVERSION:@"40", | ||
| 171 | BASIC_MODE:[DeviceInfo valueForKey:@"Mode"], | ||
| 172 | BASIC_PAIRFLAG:[DeviceInfo valueForKey:@"BindState"], | ||
| 173 | BASIC_REBOOT:[DeviceInfo valueForKey:@"RebootFlag"], | ||
| 174 | |||
| 175 | }]; | ||
| 176 | |||
| 177 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 178 | |||
| 179 | |||
| 180 | |||
| 181 | }]; | ||
| 182 | |||
| 183 | |||
| 184 | } | ||
| 185 | |||
| 186 | } | ||
| 187 | |||
| 188 | #pragma mark 设置时间 | ||
| 189 | RCT_EXPORT_METHOD(setTime:(nonnull NSString *)mac){ | ||
| 190 | |||
| 191 | |||
| 192 | if ([self getAM5WithMac:mac]) { | ||
| 193 | __weak typeof(self) weakSelf = self; | ||
| 194 | |||
| 195 | |||
| 196 | [[self getAM5WithMac:mac] commandSetCurrentTime:^(BOOL result) { | ||
| 197 | if (result==YES) { | ||
| 198 | NSLog(@"SetCurrentTimeSucess"); | ||
| 199 | }else{ | ||
| 200 | |||
| 201 | NSLog(@"SetCurrentTimeFaild"); | ||
| 202 | } | ||
| 203 | |||
| 204 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 205 | kMAC_KEY:mac, | ||
| 206 | kACTION_KEY:kACTION_SET_TIME, | ||
| 207 | TYPE:@"AM5", | ||
| 208 | RESULT:@1 | ||
| 209 | }]; | ||
| 210 | |||
| 211 | |||
| 212 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 213 | |||
| 214 | }]; | ||
| 215 | |||
| 216 | |||
| 217 | } | ||
| 218 | |||
| 219 | } | ||
| 220 | #pragma mark 设置用户信息 | ||
| 221 | RCT_EXPORT_METHOD(setUserInfo:(nonnull NSString *)mac :(nonnull NSNumber *)year:(nonnull NSNumber *)month:(nonnull NSNumber *)day:(nonnull NSNumber *)weight:(nonnull NSNumber *)height :(nonnull NSNumber *)gender){ | ||
| 222 | |||
| 223 | if ([self getAM5WithMac:mac]) { | ||
| 224 | |||
| 225 | __weak typeof(self) weakSelf = self; | ||
| 226 | |||
| 227 | IDOSetUserInfoBuletoothModel * userModel= [IDOSetUserInfoBuletoothModel currentModel]; | ||
| 228 | |||
| 229 | userModel.year=[year integerValue]; | ||
| 230 | |||
| 231 | userModel.month=[month integerValue]; | ||
| 232 | |||
| 233 | userModel.day=[day integerValue]; | ||
| 234 | |||
| 235 | userModel.weight=[weight integerValue]; | ||
| 236 | |||
| 237 | userModel.height=[height integerValue]; | ||
| 238 | |||
| 239 | userModel.gender=[gender integerValue]; | ||
| 240 | |||
| 241 | |||
| 242 | [[self getAM5WithMac:mac] commandSetUserInfo:userModel setResult:^(BOOL result) { | ||
| 243 | |||
| 244 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 245 | kMAC_KEY:mac, | ||
| 246 | kACTION_KEY:kACTION_SET_USER_INFO, | ||
| 247 | TYPE:@"AM5", | ||
| 248 | RESULT:@1 | ||
| 249 | }]; | ||
| 250 | |||
| 251 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 252 | |||
| 253 | }]; | ||
| 254 | |||
| 255 | |||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | #pragma mark 设置单位 | ||
| 260 | RCT_EXPORT_METHOD(setUnit:(nonnull NSString *)mac :(nonnull NSNumber *)type :(nonnull NSNumber *)unit){ | ||
| 261 | |||
| 262 | if ([self getAM5WithMac:mac]) { | ||
| 263 | |||
| 264 | __weak typeof(self) weakSelf = self; | ||
| 265 | |||
| 266 | IDOSetUnitInfoBluetoothModel * unitInfo = [IDOSetUnitInfoBluetoothModel currentModel]; | ||
| 267 | |||
| 268 | if ([type intValue]==0) { | ||
| 269 | unitInfo.distanceUnit =[unit integerValue]; | ||
| 270 | }else if ([type intValue]==1) { | ||
| 271 | unitInfo.weightUnit =[unit integerValue]; | ||
| 272 | }else { | ||
| 273 | unitInfo.tempUnit =[unit integerValue]; | ||
| 274 | } | ||
| 275 | |||
| 276 | [[self getAM5WithMac:mac] commandSetUnit:unitInfo setResult:^(BOOL result) { | ||
| 277 | |||
| 278 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 279 | kMAC_KEY:mac, | ||
| 280 | kACTION_KEY:kACTION_SET_UNIT, | ||
| 281 | TYPE:@"AM5", | ||
| 282 | RESULT:@1 | ||
| 283 | }]; | ||
| 284 | |||
| 285 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 286 | |||
| 287 | }]; | ||
| 288 | |||
| 289 | } | ||
| 290 | } | ||
| 291 | |||
| 292 | #pragma mark Hand Wear Mode | ||
| 293 | RCT_EXPORT_METHOD(setHandWearMode:(nonnull NSString *)mac :(nonnull NSNumber *)model){ | ||
| 294 | |||
| 295 | if ([self getAM5WithMac:mac]) { | ||
| 296 | |||
| 297 | __weak typeof(self) weakSelf = self; | ||
| 298 | |||
| 299 | IDOSetLeftOrRightInfoBuletoothModel * leftOrRightModel = [IDOSetLeftOrRightInfoBuletoothModel currentModel]; | ||
| 300 | |||
| 301 | if ([model intValue]==1) { | ||
| 302 | leftOrRightModel.isRight=YES; | ||
| 303 | }else{ | ||
| 304 | |||
| 305 | leftOrRightModel.isRight=NO; | ||
| 306 | } | ||
| 307 | |||
| 308 | |||
| 309 | |||
| 310 | [[self getAM5WithMac:mac] commandSetLeftRightHand:leftOrRightModel setResult:^(BOOL result) { | ||
| 311 | |||
| 312 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 313 | kMAC_KEY:mac, | ||
| 314 | kACTION_KEY:kACTION_SET_HAND_WEAR_MODE, | ||
| 315 | TYPE:@"AM5", | ||
| 316 | RESULT:@1 | ||
| 317 | }]; | ||
| 318 | |||
| 319 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 320 | |||
| 321 | }]; | ||
| 322 | |||
| 323 | } | ||
| 324 | } | ||
| 325 | |||
| 326 | #pragma mark 获取live数据 | ||
| 327 | RCT_EXPORT_METHOD(getLiveData:(nonnull NSString *)mac){ | ||
| 328 | |||
| 329 | //Step:Step count Calorie:Calorie Distances:distance ActiveTime:Duration of activity HeartRate:Heart rate | ||
| 330 | if ([self getAM5WithMac:mac]) { | ||
| 331 | |||
| 332 | __weak typeof(self) weakSelf = self; | ||
| 333 | |||
| 334 | [[self getAM5WithMac:mac] commandGetLiveData:^(NSMutableDictionary *liveDataDic) { | ||
| 335 | |||
| 336 | NSLog(@"liveDataDic:%@",liveDataDic); | ||
| 337 | |||
| 338 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 339 | kMAC_KEY:mac, | ||
| 340 | kACTION_KEY:kACTION_LIVE_DATA, | ||
| 341 | TYPE:@"AM5", | ||
| 342 | LIVE_DATA_HEARTRATE:[liveDataDic valueForKey:@"HeartRate"], | ||
| 343 | LIVE_DATA_STEP:[liveDataDic valueForKey:@"Step"], | ||
| 344 | LIVE_DATA_CALORIE:[liveDataDic valueForKey:@"Calorie"], | ||
| 345 | LIVE_DATA_DISTANCES:[liveDataDic valueForKey:@"Distances"], | ||
| 346 | LIVE_DATA_ACTIVETIME:[liveDataDic valueForKey:@"ActiveTime"], | ||
| 347 | }]; | ||
| 348 | |||
| 349 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 350 | |||
| 351 | }]; | ||
| 352 | |||
| 353 | } | ||
| 354 | } | ||
| 355 | |||
| 356 | #pragma mark Sync health data from device | ||
| 357 | |||
| 358 | //syncActivityDataDic | ||
| 359 | //{ | ||
| 360 | // head = { | ||
| 361 | // day = 3; | ||
| 362 | // "items_count" = 96; | ||
| 363 | // "key_word" = 0; | ||
| 364 | // length = 16; | ||
| 365 | // "minute_offset" = 0; | ||
| 366 | // month = 9; | ||
| 367 | // "packets_count" = 34; | ||
| 368 | // "per_minute" = 15; | ||
| 369 | // reserved = 0; | ||
| 370 | // serial = 1; | ||
| 371 | // "total_active_time" = 0; | ||
| 372 | // "total_cal" = 0; | ||
| 373 | // "total_distances" = 0; | ||
| 374 | // "total_step" = 0; | ||
| 375 | // year = 2021; | ||
| 376 | // }; | ||
| 377 | // items = ( | ||
| 378 | // { | ||
| 379 | // "active_time" = 0; | ||
| 380 | // calories = 0; | ||
| 381 | // distance = 0; | ||
| 382 | // mode = 0; | ||
| 383 | // "sport_count" = 0; | ||
| 384 | // }, | ||
| 385 | // { | ||
| 386 | // "active_time" = 0; | ||
| 387 | // calories = 0; | ||
| 388 | // distance = 0; | ||
| 389 | // mode = 0; | ||
| 390 | // "sport_count" = 0; | ||
| 391 | // }, | ||
| 392 | // { | ||
| 393 | // "active_time" = 0; | ||
| 394 | // calories = 0; | ||
| 395 | // distance = 0; | ||
| 396 | // mode = 0; | ||
| 397 | // "sport_count" = 0; | ||
| 398 | // }, | ||
| 399 | // | ||
| 400 | // ); | ||
| 401 | // type = "sport_step"; | ||
| 402 | //} | ||
| 403 | // | ||
| 404 | //syncHeartRateDataDic:{ | ||
| 405 | // head = { | ||
| 406 | // "aerobic_mins" = 0; | ||
| 407 | // "aerobic_threshold" = 154; | ||
| 408 | // "anaerobic_mins" = 0; | ||
| 409 | // "anaerobic_threshold" = 0; | ||
| 410 | // "burn_fat_mins" = 0; | ||
| 411 | // "burn_fat_threshold" = 132; | ||
| 412 | // day = 3; | ||
| 413 | // "items_count" = 0; | ||
| 414 | // length = 16; | ||
| 415 | // "limit_mins" = 0; | ||
| 416 | // "limit_threshold" = 198; | ||
| 417 | // "minute_offset" = 0; | ||
| 418 | // month = 9; | ||
| 419 | // "packets_count" = 2; | ||
| 420 | // serial = 1; | ||
| 421 | // "silent_heart_rate" = 62; | ||
| 422 | // "user_max_hr" = 0; | ||
| 423 | // "warm_up_mins" = 0; | ||
| 424 | // "warm_up_threshold" = 0; | ||
| 425 | // year = 2021; | ||
| 426 | // }; | ||
| 427 | // items = ( | ||
| 428 | // ); | ||
| 429 | // "offset_type" = minute; | ||
| 430 | // type = "heart_rate"; | ||
| 431 | //} | ||
| 432 | // | ||
| 433 | //syncSleepDataDic:{ | ||
| 434 | // head = { | ||
| 435 | // day = 0; | ||
| 436 | // "deep_sleep_count" = 0; | ||
| 437 | // "deep_sleep_minute" = 0; | ||
| 438 | // "end_time_hour" = 0; | ||
| 439 | // "end_time_minute" = 0; | ||
| 440 | // "items_count" = 0; | ||
| 441 | // length = 16; | ||
| 442 | // "light_sleep_count" = 0; | ||
| 443 | // "ligth_sleep_minute" = 0; | ||
| 444 | // month = 0; | ||
| 445 | // "packet_count" = 2; | ||
| 446 | // serial = 1; | ||
| 447 | // "sleep_item_count" = 0; | ||
| 448 | // "sleep_score" = 0; | ||
| 449 | // "total_minute" = 0; | ||
| 450 | // "wake_count" = 0; | ||
| 451 | // year = 0; | ||
| 452 | // }; | ||
| 453 | // items = ( | ||
| 454 | // ); | ||
| 455 | // type = sleep; | ||
| 456 | //} | ||
| 457 | |||
| 458 | RCT_EXPORT_METHOD(syncHealthData:(nonnull NSString *)mac){ | ||
| 459 | |||
| 460 | if ([self getAM5WithMac:mac]) { | ||
| 461 | |||
| 462 | __weak typeof(self) weakSelf = self; | ||
| 463 | |||
| 464 | [[self getAM5WithMac:mac] commandSyncData:^(NSDictionary *syncDataDic) { | ||
| 465 | |||
| 466 | NSLog(@"syncHeartRateDataDic:%@",syncDataDic); | ||
| 467 | |||
| 468 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 469 | kMAC_KEY:mac, | ||
| 470 | kACTION_KEY:kACTION_SYNC_HEALTH_DATA_HEART_RATE, | ||
| 471 | TYPE:@"AM5", | ||
| 472 | DATA:syncDataDic, | ||
| 473 | }]; | ||
| 474 | |||
| 475 | } syncSleepData:^(NSDictionary *syncDataDic) { | ||
| 476 | |||
| 477 | NSLog(@"syncSleepDataDic:%@",syncDataDic); | ||
| 478 | |||
| 479 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 480 | kMAC_KEY:mac, | ||
| 481 | kACTION_KEY:kACTION_SYNC_HEALTH_DATA_SLEEP, | ||
| 482 | TYPE:@"AM5", | ||
| 483 | DATA:syncDataDic, | ||
| 484 | }]; | ||
| 485 | |||
| 486 | } syncActivityData:^(NSDictionary *syncDataDic) { | ||
| 487 | |||
| 488 | NSLog(@"syncActivityDataDic:%@",syncDataDic); | ||
| 489 | |||
| 490 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 491 | kMAC_KEY:mac, | ||
| 492 | kACTION_KEY:kACTION_SYNC_HEALTH_DATA_SPORT, | ||
| 493 | TYPE:@"AM5", | ||
| 494 | DATA:syncDataDic, | ||
| 495 | }]; | ||
| 496 | |||
| 497 | } syncDataProgress:^(NSNumber *syncDataProgress) { | ||
| 498 | |||
| 499 | NSLog(@"syncDataProgress:%@",syncDataProgress); | ||
| 500 | |||
| 501 | [weakSelf sendEventWithName:EVENT_NOTIFY body:@{ | ||
| 502 | kMAC_KEY:mac, | ||
| 503 | kACTION_KEY:kACTION_SYNC_HEALTH_DATA, | ||
| 504 | TYPE:@"AM5", | ||
| 505 | PROGRESS:syncDataProgress, | ||
| 506 | OPERATION_STATUS:@3, | ||
| 507 | }]; | ||
| 508 | |||
| 509 | } syncDataSuccess:^{ | ||
| 510 | |||
| 511 | NSLog(@"syncDataSuccess"); | ||
| 512 | |||
| 513 | } DiaposeErrorBlock:^(AM5DeviceError errorID) { | ||
| 514 | |||
| 515 | }]; | ||
| 516 | |||
| 517 | } | ||
| 518 | } | ||
| 519 | |||
| 520 | |||
| 521 | RCT_EXPORT_METHOD(disconnect:(nonnull NSString *)mac){ | ||
| 522 | |||
| 523 | |||
| 524 | if ([self getAM5WithMac:mac]!=nil) { | ||
| 525 | |||
| 526 | [[self getAM5WithMac:mac] commandAM5Disconnect]; | ||
| 527 | |||
| 528 | }else{ | ||
| 529 | |||
| 530 | |||
| 531 | |||
| 532 | } | ||
| 533 | |||
| 534 | |||
| 535 | |||
| 536 | } | ||
| 537 | |||
| 538 | |||
| 539 | |||
| 540 | |||
| 541 | |||
| 542 | @end | ||
