| | |
| | | self.enState = STATE_PLAT; |
| | | [self createTimerWithTimeOut:30]; |
| | | [GlobalKit shareKit].deviceVerifyCode = [alertView textFieldAtIndex:0].text; |
| | | [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | // completion:^(NSError *error) { |
| | | // [self handleTheError:error]; |
| | | // }]; |
| | | //2021-03-03 添加设备的方法都修改成河东的接口方法 |
| | | [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo |
| | | verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | completion:^(NSError *error) { |
| | | [self handleTheError:error]; |
| | | completion:^(ResponseData *responseData) { |
| | | // [hud hide:YES]; |
| | | [self handleTheError:responseData]; |
| | | }]; |
| | | } |
| | | else if (alertView.tag == 0xbb && buttonIndex == 1) |
| | |
| | | [weakSelf createTimerWithTimeOut:30]; |
| | | if([GlobalKit shareKit].deviceVerifyCode != nil) |
| | | { |
| | | [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | // completion:^(NSError *error) { |
| | | // [weakSelf handleTheError:error]; |
| | | // }]; |
| | | [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo |
| | | verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | completion:^(NSError *error) { |
| | | [weakSelf handleTheError:error]; |
| | | completion:^(ResponseData *responseData) { |
| | | [weakSelf handleTheError:responseData]; |
| | | }]; |
| | | } |
| | | else |
| | |
| | | { |
| | | if ([GlobalKit shareKit].deviceVerifyCode != nil) |
| | | { |
| | | [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo |
| | | // verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | // completion:^(NSError *error) { |
| | | // if (!error) |
| | | // { |
| | | // [self handleTheError:error]; |
| | | // } |
| | | // else |
| | | // { |
| | | // [self showFailedView]; |
| | | // } |
| | | // }]; |
| | | |
| | | [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo |
| | | verifyCode:[GlobalKit shareKit].deviceVerifyCode |
| | | completion:^(NSError *error) { |
| | | if (!error) |
| | | completion:^(ResponseData *responseData) { |
| | | if (responseData.success) |
| | | { |
| | | [self handleTheError:error]; |
| | | [self handleTheError:responseData]; |
| | | } |
| | | else |
| | | { |
| | | [self showFailedView]; |
| | | } |
| | | }]; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | self.failedTipsView.hidden = NO; |
| | | } |
| | | |
| | | - (void)handleTheError:(NSError *)error |
| | | //- (void)handleTheError:(NSError *)error |
| | | //{ |
| | | // [EZOPENSDK stopConfigWifi]; |
| | | // |
| | | // if (!error) |
| | | // { |
| | | // if ([_countTimer isValid]) |
| | | // { |
| | | // [_countTimer invalidate]; |
| | | // _countTimer = nil; |
| | | // } |
| | | // _enState = STATE_SUCC; |
| | | // [self showTipsView]; |
| | | // return; |
| | | // } |
| | | // |
| | | // if (error.code == 120010) |
| | | // { |
| | | // UIAlertView *retryAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_verify_code_wrong", @"验证码错误") |
| | | // message:nil delegate:self |
| | | // cancelButtonTitle:NSLocalizedString(@"cancel", @"取消") |
| | | // otherButtonTitles:NSLocalizedString(@"retry", @"重试"), nil]; |
| | | // retryAlertView.tag = 0xbb; |
| | | // [retryAlertView show]; |
| | | // } |
| | | // else if (error.code == 120020) |
| | | // { |
| | | // [UIView dd_showMessage:NSLocalizedString(@"ad_already_added", @"您已添加过此设备")]; |
| | | // } |
| | | // else if (error.code == 120022) |
| | | // { |
| | | // [UIView dd_showMessage:NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加")]; |
| | | // } |
| | | // else |
| | | // { |
| | | // [UIView dd_showMessage:NSLocalizedString(@"wifi_add_fail", @"添加失败")]; |
| | | // } |
| | | //} |
| | | |
| | | - (void)handleTheError:(ResponseData *)responseData |
| | | { |
| | | [EZOPENSDK stopConfigWifi]; |
| | | |
| | | if (!error) |
| | | if (responseData.success) |
| | | { |
| | | if ([_countTimer isValid]) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (error.code == 120010) |
| | | if ([responseData.code isEqual: @"20010"]) |
| | | { |
| | | UIAlertView *retryAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_verify_code_wrong", @"验证码错误") |
| | | message:nil delegate:self |
| | |
| | | retryAlertView.tag = 0xbb; |
| | | [retryAlertView show]; |
| | | } |
| | | else if (error.code == 120020) |
| | | else if ([responseData.code isEqual: @"20017"]) |
| | | { |
| | | [UIView dd_showMessage:NSLocalizedString(@"ad_already_added", @"您已添加过此设备")]; |
| | | } |
| | | else if (error.code == 120022) |
| | | else if ([responseData.code isEqual: @"20013"]) |
| | | { |
| | | [UIView dd_showMessage:NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加")]; |
| | | } |
| | |
| | | [UIView dd_showMessage:NSLocalizedString(@"wifi_add_fail", @"添加失败")]; |
| | | } |
| | | } |
| | | |
| | | #pragma mark - Action Methods |
| | | |
| | | - (void)completionButtonClicked:(id)sender |