萤石云 iOSSDK,移植跨平台相关工程
JLChen
2021-03-05 60bb4ce8d3ef0f8a324c6844cc990405de5d2e0f
2021-03-05 1.更新
18个文件已修改
814 ■■■■■ 已修改文件
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Base.lproj/AddDevice.storyboard 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Base.lproj/EZMain.storyboard 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.m 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Info.plist 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZAPConfigResultViewController.m 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZDeviceResultViewController.m 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZSettingViewController.m 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZWifiConfigViewController.m 255 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK.IOS/EZSDK.IOS/Properties/AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/Global/EZHttpUtil.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/Global/EZHttpUtil.m 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/UIViewControllers/EZAPConfigResultViewController.m 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/UIViewControllers/EZDeviceResultViewController.m 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
EZSDK/EZSDK/EZ/UIViewControllers/EZWifiConfigViewController.m 255 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Base.lproj/AddDevice.storyboard
@@ -141,6 +141,7 @@
                                <constraints>
                                    <constraint firstAttribute="height" constant="40" id="vLh-9U-8RO"/>
                                </constraints>
                                <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                <textInputTraits key="textInputTraits" keyboardType="alphabet"/>
                                <connections>
@@ -165,6 +166,7 @@
                                <constraints>
                                    <constraint firstAttribute="height" constant="40" id="DjM-dg-5en"/>
                                </constraints>
                                <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                <textInputTraits key="textInputTraits" keyboardType="alphabet"/>
                                <connections>
@@ -450,6 +452,7 @@
                                <constraints>
                                    <constraint firstAttribute="height" constant="34" id="FPO-BB-N1L"/>
                                </constraints>
                                <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                <textInputTraits key="textInputTraits" secureTextEntry="YES"/>
                            </textField>
@@ -912,7 +915,7 @@
    <inferredMetricsTieBreakers>
        <segue reference="9TP-S2-hhI"/>
        <segue reference="MFl-yy-ZsP"/>
        <segue reference="VYk-37-nb6"/>
        <segue reference="ikM-Zn-H8f"/>
    </inferredMetricsTieBreakers>
    <resources>
        <image name="addDevice_success" width="320" height="185"/>
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Base.lproj/EZMain.storyboard
@@ -2025,10 +2025,11 @@
                        <subviews>
                            <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入设备名称" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="r1W-d8-Rg7">
                                <rect key="frame" x="0.0" y="94" width="375" height="40"/>
                                <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                <constraints>
                                    <constraint firstAttribute="height" constant="40" id="NLX-OK-XZ7"/>
                                </constraints>
                                <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                <textInputTraits key="textInputTraits"/>
                            </textField>
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.h
@@ -14,13 +14,16 @@
/// 河东接口网络请求工具类
@interface EZHttpUtil : NSObject
/// sharedManager
+ (id)sharedManager;
#pragma mark -接口
/**
 *  @since 河东获取子账号token的接口
 *
 *  @param block 回调block
 */
+ (void)getChildToken:(void (^)(NSString *accessToken))block;
- (void)getChildToken:(void (^)(NSString *accessToken))block;
/**
 *  @since 河东添加设备的接口
@@ -31,7 +34,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)addDeviceByHDL:(NSString *)deviceSerial
- (void)addDeviceByHDL:(NSString *)deviceSerial
                verifyCode:(NSString *)verifyCode
                completion:(void (^)(ResponseData *responseData))completion;
@@ -43,7 +46,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion;
- (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion;
@end
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.m
@@ -24,20 +24,29 @@
#define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
#define TIME_OUT 15.0f
@implementation EZHttpUtil
#pragma mark -接口请求部分
/// sharedManager
+ (id)sharedManager {
    static dispatch_once_t once;
    static id instance;
    dispatch_once(&once, ^{
        instance = [self new];
    });
    return instance;
}
/**
 *  @since 河东获取子账号token的接口
 *
 *  @param block 回调block
 */
+ (void)getChildToken:(void (^)(NSString *accessToken))block{
- (void)getChildToken:(void (^)(NSString *accessToken))block{
    
    //2.设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
@@ -65,7 +74,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)addDeviceByHDL:(NSString *)deviceSerial
- (void)addDeviceByHDL:(NSString *)deviceSerial
                              verifyCode:(NSString *)verifyCode
                              completion:(void (^)(ResponseData *responseData))completion{
@@ -92,7 +101,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion{
- (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion{
    //1.设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:deviceSerial forKey:@"deviceSerial"];
@@ -111,7 +120,7 @@
/// 刷新token
/// @param block 结果
+ (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
- (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
    //1.设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
@@ -148,7 +157,7 @@
/// @param apiPath 接口地址
/// @param parameters 请求参数
/// @param completion 请求响应参数
+ (void)requestHttpsPost:(NSString *)apiPath
- (void)requestHttpsPost:(NSString *)apiPath
                                parameters:(NSMutableDictionary *)parameters
              completion:(void (^)(ResponseData *responseData))completion{
    
@@ -176,7 +185,7 @@
/// @param apiPath 接口地址
/// @param parameters 请求参数
/// @param completion 请求响应参数
+ (void)requestHttpsBase:(NSString *)apiPath
- (void)requestHttpsBase:(NSString *)apiPath
                                parameters:(NSMutableDictionary *)parameters
                                completion:(void (^)(ResponseData *responseData))completion{
    
@@ -194,7 +203,7 @@
      
    //3.request
    NSMutableURLRequest * request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"post" URLString:URL parameters:parameters error:nil];
    request.timeoutInterval = 10.0f;
    request.timeoutInterval = TIME_OUT;
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [request setValue:GlobalKit.shareKit.hdlAccessToken forHTTPHeaderField:@"Authorization"];
@@ -223,7 +232,7 @@
/**
 *  基础服务的接口都要校验sign
 */
+(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params{
-(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params{
    if(params == NULL){
        params =[NSMutableDictionary dictionary];
    }
@@ -262,7 +271,7 @@
/// 字符串判空
/// @param valueStr 传入判断字符
+ (BOOL)stringIsNullOrEmpty:(NSString *)valueStr
- (BOOL)stringIsNullOrEmpty:(NSString *)valueStr
{
    if((valueStr == nil || [valueStr isKindOfClass:[NSNull class]] || valueStr.length == 0)){
        return YES;
@@ -275,7 +284,7 @@
/**
 MD5转换+转小写
 */
+ (NSString*)signMD5Encrypt:(NSString *)str
- (NSString*)signMD5Encrypt:(NSString *)str
{
    const char *cStr = [str UTF8String];
    unsigned char digest[CC_MD5_DIGEST_LENGTH];
@@ -295,7 +304,7 @@
/// </summary>
/// <param name="valueStr"></param>
/// <returns></returns>
+(bool)IfValueNeedSign:(NSString *)valueStr{
-(bool)IfValueNeedSign:(NSString *)valueStr{
    if (( [self stringIsNullOrEmpty:valueStr])//判空字符
        || ([[valueStr substringToIndex:1] isEqual:@"{"])//判断是否为对象
        || ([[valueStr substringToIndex:1] isEqual:@"["])//判断是否为数组
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Info.plist
@@ -53,9 +53,9 @@
    <key>NSLocalNetworkUsageDescription</key>
    <string>用于wifi配网</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>$(PRODUCT_NAME) App needs Location permission to configure device's network.</string>
    <string>$(PRODUCT_NAME) App needs Location permission to configure device&apos;s network.</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>$(PRODUCT_NAME) App needs Location permission to configure device's network.</string>
    <string>$(PRODUCT_NAME) App needs Location permission to configure device&apos;s network.</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>$(PRODUCT_NAME) App needs Location permission so that you can select location information when posting videos publicly.</string>
    <key>NSMicrophoneUsageDescription</key>
@@ -84,7 +84,5 @@
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UIUserInterfaceStyle</key>
    <string>Light</string>
</dict>
</plist>
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZAPConfigResultViewController.m
@@ -31,7 +31,7 @@
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = NSLocalizedString(@"wifi_ap_add_device_title", @"添加设备");
    
    [self initSubviews];
@@ -102,7 +102,7 @@
    [self stopTimer];
    
    self.addCount = 0;
    self.timer = [NSTimer scheduledTimerWithTimeInterval:5.0
                                                  target:self
                                                selector:@selector(timerCallback)
@@ -130,26 +130,41 @@
    [EZOPENSDK probeDeviceInfo:[GlobalKit shareKit].deviceSerialNo
                    deviceType:[GlobalKit shareKit].deviceModel
                    completion:^(EZProbeDeviceInfo *deviceInfo, NSError *error) {
                        if (error)
                        {
                            [self probeErrorProcessWithError:error];
                        }
                        else
                        {
                            [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                                      verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                      completion:^(NSError *error) {
                                          if (error)
                                          {
                                              [self addErrorProcessWithError:error];
                                          }
                                          else
                                          {
                                              [self successProcess];
                                          }
                                      }];
                        }
                    }];
        if (error)
        {
            [self probeErrorProcessWithError:error];
        }
        else
        {
            //                            [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo
            //                                      verifyCode:[GlobalKit shareKit].deviceVerifyCode
            //                                      completion:^(NSError *error) {
            //                                          if (error)
            //                                          {
            //                                              [self addErrorProcessWithError:error];
            //                                          }
            //                                          else
            //                                          {
            //                                              [self successProcess];
            //                                          }
            //                                      }];
            [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                            verifyCode:[GlobalKit shareKit].deviceVerifyCode
                            completion:^(ResponseData *responseData) {
                if (!responseData.success)
                {
                    [self addErrorProcessWithError:responseData];
                }
                else
                {
                    [self successProcess];
                }
            }];
        }
    }];
}
- (void) probeErrorProcessWithError:(NSError *) error
@@ -181,18 +196,42 @@
    [self.view makeToast:msg duration:2.0 position:@"center"];
}
- (void) addErrorProcessWithError:(NSError *) error
//- (void) addErrorProcessWithError:(NSError *) error
//{
//    NSString *msg = nil;
//    if (error.code == 120010)
//    {
//        msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误");
//    }
//    else if (error.code == 120020)
//    {
//        msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备");
//    }
//    else if (error.code == 120022)
//    {
//        msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加");
//    }
//    else
//    {
//        msg = NSLocalizedString(@"wifi_add_fail", @"添加失败");
//    }
//
//    [self.view makeToast:msg duration:2.0 position:@"center"];
//    self.msgLabel.hidden = YES;
//}
- (void) addErrorProcessWithError:(ResponseData *)responseData
{
    NSString *msg = nil;
    if (error.code == 120010)
    if ([responseData.code isEqual: @"20010"])
    {
        msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误");
    }
    else if (error.code == 120020)
    else if ([responseData.code isEqual: @"20017"])
    {
        msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备");
    }
    else if (error.code == 120022)
    else if ([responseData.code isEqual: @"20013"])
    {
        msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加");
    }
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZDeviceResultViewController.m
@@ -90,7 +90,7 @@
//                      [self handleTheError:error];
//                  }];
        
        [EZHttpUtil addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
        [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                   verifyCode:[GlobalKit shareKit].deviceVerifyCode
                   completion:^(ResponseData *responseData) {
                       [hud hide:YES];
@@ -127,7 +127,7 @@
//                          [hud hide:YES];
//                          [self handleTheError:error];
//                      }];
            [EZHttpUtil addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
            [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                       verifyCode:[GlobalKit shareKit].deviceVerifyCode
                       completion:^(ResponseData *responseData) {
                           [hud hide:YES];
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZSettingViewController.m
@@ -377,7 +377,7 @@
//            }
//        }];
        
        [EZHttpUtil deleteDeviceByHDL:self.deviceInfo.deviceSerial completion:^(ResponseData *responseData) {
        [EZHttpUtil.sharedManager deleteDeviceByHDL:self.deviceInfo.deviceSerial completion:^(ResponseData *responseData) {
            if(responseData.success)
            {
                [hud hide:YES];
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/UIViewControllers/EZWifiConfigViewController.m
@@ -89,14 +89,14 @@
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
 #pragma mark - Navigation
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */
#pragma mark - UIAlertViewDelgate Methods
@@ -107,11 +107,18 @@
        self.enState = STATE_PLAT;
        [self createTimerWithTimeOut:30];
        [GlobalKit shareKit].deviceVerifyCode = [alertView textFieldAtIndex:0].text;
        [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                  verifyCode:[GlobalKit shareKit].deviceVerifyCode
                  completion:^(NSError *error) {
                      [self handleTheError:error];
                  }];
        //        [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:^(ResponseData *responseData) {
            //                       [hud hide:YES];
            [self handleTheError:responseData];
        }];
    }
    else if (alertView.tag == 0xbb && buttonIndex == 1)
    {
@@ -133,58 +140,63 @@
        NSInteger mode = 0;
        mode |= self.supportSmartMode?EZWiFiConfigSmart:0;
        mode |= self.supportSoundMode?EZWiFiConfigWave:0;
        __weak typeof(self) weakSelf = self;
        [EZOPENSDK startConfigWifi:weakSelf.ssid
                          password:weakSelf.password
                      deviceSerial:[GlobalKit shareKit].deviceSerialNo
                              mode:mode
                      deviceStatus:^(EZWifiConfigStatus status, NSString *deviceSerial) {
                          if (status == DEVICE_WIFI_CONNECTING)
                          {
                              weakSelf.enState = STATE_NONE;
                              [weakSelf createTimerWithTimeOut:60];
                          }
                          else if (status == DEVICE_WIFI_CONNECTED)
                          {
                              if(weakSelf.enState != STATE_WIFI){
                                  weakSelf.enState = STATE_WIFI;
                                  [weakSelf createTimerWithTimeOut:60];
                              }
                          }
                          else if (status == DEVICE_PLATFORM_REGISTED)
                          {
                              weakSelf.enState = STATE_PLAT;
                              [weakSelf createTimerWithTimeOut:30];
                              if([GlobalKit shareKit].deviceVerifyCode != nil)
                              {
                                  [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                                            verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                            completion:^(NSError *error) {
                                                [weakSelf handleTheError:error];
                                            }];
                              }
                              else
                              {
                                  UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:weakSelf cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                                  alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                                  alertView.tag = 0xaa;
                                  [alertView show];
                                  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                                      if ([_countTimer isValid])
                                      {
                                          [_countTimer invalidate];
                                          _countTimer = nil;
                                      }
                                  });
                              }
                          }
                      }];
            if (status == DEVICE_WIFI_CONNECTING)
            {
                weakSelf.enState = STATE_NONE;
                [weakSelf createTimerWithTimeOut:60];
            }
            else if (status == DEVICE_WIFI_CONNECTED)
            {
                if(weakSelf.enState != STATE_WIFI){
                    weakSelf.enState = STATE_WIFI;
                    [weakSelf createTimerWithTimeOut:60];
                }
            }
            else if (status == DEVICE_PLATFORM_REGISTED)
            {
                weakSelf.enState = STATE_PLAT;
                [weakSelf createTimerWithTimeOut:30];
                if([GlobalKit shareKit].deviceVerifyCode != nil)
                {
                    //                                  [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:^(ResponseData *responseData) {
                        [weakSelf handleTheError:responseData];
                    }];
                }
                else
                {
                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:weakSelf cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                    alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                    alertView.tag = 0xaa;
                    [alertView show];
                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                        if ([_countTimer isValid])
                        {
                            [_countTimer invalidate];
                            _countTimer = nil;
                        }
                    });
                }
            }
        }];
    }
    else
    {
        [self createAddDeviceInitView];
        _enState = STATE_SUCC;
        [self showTipsView];
    }
@@ -232,37 +244,52 @@
        [EZOPENSDK probeDeviceInfo:[GlobalKit shareKit].deviceSerialNo
                        deviceType:[GlobalKit shareKit].deviceModel
                        completion:^(EZProbeDeviceInfo *deviceInfo, NSError *error) {
                            if (error)
                            {
                                //有错误直接显示错误的UI
                                [self showFailedView];
                            }
                            else
                            {
                                if ([GlobalKit shareKit].deviceVerifyCode != nil)
                                {
                                    [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                                              verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                              completion:^(NSError *error) {
                                                  if (!error)
                                                  {
                                                      [self handleTheError:error];
                                                  }
                                                  else
                                                  {
                                                      [self showFailedView];
                                                  }
                                              }];
                                }
                                else
                                {
                                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:self cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                                    alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                                    alertView.tag = 0xaa;
                                    [alertView show];
                                }
                            }
                        }];
            if (error)
            {
                //有错误直接显示错误的UI
                [self showFailedView];
            }
            else
            {
                if ([GlobalKit shareKit].deviceVerifyCode != nil)
                {
                    //                                    [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:^(ResponseData *responseData) {
                        if (responseData.success)
                        {
                            [self handleTheError:responseData];
                        }
                        else
                        {
                            [self showFailedView];
                        }
                    }];
                }
                else
                {
                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:self cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                    alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                    alertView.tag = 0xaa;
                    [alertView show];
                }
            }
        }];
    }
    
    UILabel *timeLabel = (UILabel *)[self.timerImageView viewWithTag:0x11c];
@@ -417,10 +444,10 @@
            
            self.registerLabel.font = [UIFont systemFontOfSize:15.0f];
            self.registerLabel.textColor = [UIColor dd_hexStringToColor:@"0x666666"];
            self.bindLabel.font = [UIFont systemFontOfSize:15.0f];
            self.bindLabel.textColor = [UIColor dd_hexStringToColor:@"0x666666"];
            self.wifiLabel.text = NSLocalizedString(@"wifi_connecting_net", @"萤小石正在努力连接Wi-Fi网络");
            self.registerLabel.text = NSLocalizedString(@"wifi_register_server", @"注册平台服务器");
            self.bindLabel.text = NSLocalizedString(@"wifi_bind_account", @"绑定你的账号");
@@ -672,7 +699,7 @@
        case STATE_PLAT:
        {
            failedLab.text = NSLocalizedString(@"wifi_bind_fail", @"Wi-Fi配置成功,绑定账号失败,请重试");
            self.animationImageView.image = [UIImage imageNamed:@"failure_account"];//设备绑定失败
        }
            break;
@@ -683,11 +710,50 @@
    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])
        {
@@ -699,7 +765,7 @@
        return;
    }
    
    if (error.code == 120010)
    if ([responseData.code isEqual: @"20010"])
    {
        UIAlertView *retryAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_verify_code_wrong", @"验证码错误")
                                                                 message:nil delegate:self
@@ -708,11 +774,11 @@
        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", @"此设备已被别人添加")];
    }
@@ -721,7 +787,6 @@
        [UIView dd_showMessage:NSLocalizedString(@"wifi_add_fail", @"添加失败")];
    }
}
#pragma mark - Action Methods
- (void)completionButtonClicked:(id)sender
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m
@@ -55,15 +55,15 @@
//     */
//    [self performSegueWithIdentifier:@"go2CameraList" sender:nil];
    
    [EZSDK setHDlAccessToken:@"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmZDgyMDY0ZmJmMGE0YTdmOWFhMmVhOTA0Y2FmNDY3MyIsInJvbGUiOiIiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidXNlckFjY291bnQiOiIxODgyNDg2NDE0MyIsInRlbmFudElkIjoiMjAiLCJ1c2VyVHlwZSI6IlVTRVJfQyIsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJOYW1lIjoiTEUwMDAiLCJhcHBsaWNhdGlvbklkIjoiMCIsInVzZXJJZCI6IjEzMjg4ODYyNzMwMDM4NTU4NzQiLCJleHAiOjE2MTQ1OTc5MzQsIm5iZiI6MTYxNDU5MDczNH0.e-ghYGplCF5lrMDwNd38RcbCjC79G729-iOMn3ozaEfmuZA_f5ElMvoyUf0Vm64IJMdwScuXPnSzJa2UQPyXNyZJRhpJDR4GKXI7X9VHqWJyrkc-_CJO0puLfB64K3SvKASD-PSHwzRggrmfn5G7GZ1gf-piK1grYurUIT-KaaE" refreshToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJlYzRiOTg4MTgxNWI0ZWJjYTEyNTU0ODNmNjg3NjgyMyIsImhlYWRlclByZWZpeCI6IkJlYXJlciAiLCJ0ZW5hbnRJZCI6IjIwIiwidG9rZW5UeXBlIjoicmVmcmVzaF90b2tlbiIsImFwcGxpY2F0aW9uSWQiOiIwIiwidXNlcklkIjoiMTMyODg4NjI3MzAwMzg1NTg3NCIsImV4cCI6MTYxNTI1NjMxMCwibmJmIjoxNjE0NjUxNTEwfQ.CgpIhgGb4U-NB3EvveBg6mBgLKi0H_zdA_RgPhDREmMeVyAH58H4guzutIi2EO7Dw8bkR2PB9n6jP4MQQNaHclN1EaahNQtZ4rHipLrBY0oT35Uz4vw5yXaWAyLG6_FW2Ky4wpqLbSjv9x24yc5cuKNaknruf73V6bNIDnGaEr0"];
    [EZSDK setHDlAccessToken:@"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI4ZmIxNDBlYzMzYTM0OGU2YjgyYjg5MmJhNDc4NzljMiIsInJvbGUiOiIiLCJoZWFkZXJQcmVmaXgiOiJCZWFyZXIgIiwidXNlckFjY291bnQiOiIxODgyNDg2NDE0MyIsInRlbmFudElkIjoiMjAiLCJ1c2VyVHlwZSI6IlVTRVJfQyIsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJOYW1lIjoiTEUwMDAiLCJhcHBsaWNhdGlvbklkIjoiMCIsInVzZXJJZCI6IjEzMjg4ODYyNzMwMDM4NTU4NzQiLCJleHAiOjE2MTQ5MTc0NzYsIm5iZiI6MTYxNDkxMDI3Nn0.RUKrm2BARWbdwmhj6KKlqalYCXUQ7hIRJBT-5LbPM2EUs2eLNFnwSxx3CGTgN94l3-5WW00srhzvcx6la4IAMfR1kh8-vzr4bXcXOs-wXifxIyt36Y3j9wodzEUWnR0w-42XlQb3jjlz9LiaFKWAHoXaOsmb3Uf6UsoWdqFlnSc" refreshToken:@"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJhZTU1NjBmOTRlNzY0Mzk5ODFlY2MzZDZkZGQ3NDNhYiIsImhlYWRlclByZWZpeCI6IkJlYXJlciAiLCJ0ZW5hbnRJZCI6IjIwIiwidG9rZW5UeXBlIjoicmVmcmVzaF90b2tlbiIsImFwcGxpY2F0aW9uSWQiOiIwIiwidXNlcklkIjoiMTMyODg4NjI3MzAwMzg1NTg3NCIsImV4cCI6MTYxNTUxNTA3NiwibmJmIjoxNjE0OTEwMjc2fQ.YTb0I1t9SKJpoQmdGDyzOIB6mVNQ94AteekAgs15bFsx_LVsj9xOoiURGVfHpthqpCcvL4MxYAYqLjDQHqsf_FbT0KKujqCOjTfnVB-EkqKm5yCmq827NEbq3ZukBcGs0fxGxRQJPzkDyd0AerzkwERYZqryoooNGsOeMN6vC_k"];
    
    [EZSDK setRequestHttpsHost:@"https://nearest.hdlcontrol.com"];
//    [EZSDK setRequestHttpsHost:@"https://nearest.hdlcontrol.com"];
    
    
    
    __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    hud.labelText = NSLocalizedString(@"ad_adding_msg", @"正在添加,请稍候...");
    [EZHttpUtil getChildToken:^(NSString *accessToken) {
    [EZHttpUtil.sharedManager  getChildToken:^(NSString *accessToken) {
        [hud hide:YES];
        if(accessToken != NULL && ![accessToken isEqual:@""]){
            [[GlobalKit shareKit] setAccessToken:accessToken];
EZSDK.IOS/EZSDK.IOS/Library/libEZSDK.a
Binary files differ
EZSDK.IOS/EZSDK.IOS/Properties/AssemblyInfo.cs
@@ -25,7 +25,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.8")]
[assembly: AssemblyVersion("1.1.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
EZSDK/EZSDK/EZ/Global/EZHttpUtil.h
@@ -14,13 +14,16 @@
/// 河东接口网络请求工具类
@interface EZHttpUtil : NSObject
/// sharedManager
+ (id)sharedManager;
#pragma mark -接口
/**
 *  @since 河东获取子账号token的接口
 *
 *  @param block 回调block
 */
+ (void)getChildToken:(void (^)(NSString *accessToken))block;
- (void)getChildToken:(void (^)(NSString *accessToken))block;
/**
 *  @since 河东添加设备的接口
@@ -31,7 +34,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)addDeviceByHDL:(NSString *)deviceSerial
- (void)addDeviceByHDL:(NSString *)deviceSerial
                verifyCode:(NSString *)verifyCode
                completion:(void (^)(ResponseData *responseData))completion;
@@ -43,7 +46,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion;
- (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion;
@end
EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
@@ -24,20 +24,29 @@
#define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
#define TIME_OUT 15.0f
@implementation EZHttpUtil
#pragma mark -接口请求部分
/// sharedManager
+ (id)sharedManager {
    static dispatch_once_t once;
    static id instance;
    dispatch_once(&once, ^{
        instance = [self new];
    });
    return instance;
}
/**
 *  @since 河东获取子账号token的接口
 *
 *  @param block 回调block
 */
+ (void)getChildToken:(void (^)(NSString *accessToken))block{
- (void)getChildToken:(void (^)(NSString *accessToken))block{
    
    //2.设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
@@ -65,7 +74,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)addDeviceByHDL:(NSString *)deviceSerial
- (void)addDeviceByHDL:(NSString *)deviceSerial
                              verifyCode:(NSString *)verifyCode
                              completion:(void (^)(ResponseData *responseData))completion{
@@ -92,7 +101,7 @@
 *  @param completion   回调block,error为空时表示添加成功
 *
 */
+ (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion{
- (void)deleteDeviceByHDL:(NSString *)deviceSerial completion:(void (^)(ResponseData *responseData))completion{
    //1.设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:deviceSerial forKey:@"deviceSerial"];
@@ -111,7 +120,7 @@
/// 刷新token
/// @param block 结果
+ (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
- (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
    //1.设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
@@ -148,7 +157,7 @@
/// @param apiPath 接口地址
/// @param parameters 请求参数
/// @param completion 请求响应参数
+ (void)requestHttpsPost:(NSString *)apiPath
- (void)requestHttpsPost:(NSString *)apiPath
                                parameters:(NSMutableDictionary *)parameters
              completion:(void (^)(ResponseData *responseData))completion{
    
@@ -176,7 +185,7 @@
/// @param apiPath 接口地址
/// @param parameters 请求参数
/// @param completion 请求响应参数
+ (void)requestHttpsBase:(NSString *)apiPath
- (void)requestHttpsBase:(NSString *)apiPath
                                parameters:(NSMutableDictionary *)parameters
                                completion:(void (^)(ResponseData *responseData))completion{
    
@@ -194,7 +203,7 @@
      
    //3.request
    NSMutableURLRequest * request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"post" URLString:URL parameters:parameters error:nil];
    request.timeoutInterval = 10.0f;
    request.timeoutInterval = TIME_OUT;
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [request setValue:GlobalKit.shareKit.hdlAccessToken forHTTPHeaderField:@"Authorization"];
@@ -223,7 +232,7 @@
/**
 *  基础服务的接口都要校验sign
 */
+(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params{
-(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params{
    if(params == NULL){
        params =[NSMutableDictionary dictionary];
    }
@@ -262,7 +271,7 @@
/// 字符串判空
/// @param valueStr 传入判断字符
+ (BOOL)stringIsNullOrEmpty:(NSString *)valueStr
- (BOOL)stringIsNullOrEmpty:(NSString *)valueStr
{
    if((valueStr == nil || [valueStr isKindOfClass:[NSNull class]] || valueStr.length == 0)){
        return YES;
@@ -275,7 +284,7 @@
/**
 MD5转换+转小写
 */
+ (NSString*)signMD5Encrypt:(NSString *)str
- (NSString*)signMD5Encrypt:(NSString *)str
{
    const char *cStr = [str UTF8String];
    unsigned char digest[CC_MD5_DIGEST_LENGTH];
@@ -295,7 +304,7 @@
/// </summary>
/// <param name="valueStr"></param>
/// <returns></returns>
+(bool)IfValueNeedSign:(NSString *)valueStr{
-(bool)IfValueNeedSign:(NSString *)valueStr{
    if (( [self stringIsNullOrEmpty:valueStr])//判空字符
        || ([[valueStr substringToIndex:1] isEqual:@"{"])//判断是否为对象
        || ([[valueStr substringToIndex:1] isEqual:@"["])//判断是否为数组
EZSDK/EZSDK/EZ/UIViewControllers/EZAPConfigResultViewController.m
@@ -31,7 +31,7 @@
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = NSLocalizedString(@"wifi_ap_add_device_title", @"添加设备");
    
    [self initSubviews];
@@ -102,7 +102,7 @@
    [self stopTimer];
    
    self.addCount = 0;
    self.timer = [NSTimer scheduledTimerWithTimeInterval:5.0
                                                  target:self
                                                selector:@selector(timerCallback)
@@ -130,26 +130,41 @@
    [EZOPENSDK probeDeviceInfo:[GlobalKit shareKit].deviceSerialNo
                    deviceType:[GlobalKit shareKit].deviceModel
                    completion:^(EZProbeDeviceInfo *deviceInfo, NSError *error) {
                        if (error)
                        {
                            [self probeErrorProcessWithError:error];
                        }
                        else
                        {
                            [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                                      verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                      completion:^(NSError *error) {
                                          if (error)
                                          {
                                              [self addErrorProcessWithError:error];
                                          }
                                          else
                                          {
                                              [self successProcess];
                                          }
                                      }];
                        }
                    }];
        if (error)
        {
            [self probeErrorProcessWithError:error];
        }
        else
        {
            //                            [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo
            //                                      verifyCode:[GlobalKit shareKit].deviceVerifyCode
            //                                      completion:^(NSError *error) {
            //                                          if (error)
            //                                          {
            //                                              [self addErrorProcessWithError:error];
            //                                          }
            //                                          else
            //                                          {
            //                                              [self successProcess];
            //                                          }
            //                                      }];
            [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                            verifyCode:[GlobalKit shareKit].deviceVerifyCode
                            completion:^(ResponseData *responseData) {
                if (!responseData.success)
                {
                    [self addErrorProcessWithError:responseData];
                }
                else
                {
                    [self successProcess];
                }
            }];
        }
    }];
}
- (void) probeErrorProcessWithError:(NSError *) error
@@ -181,18 +196,42 @@
    [self.view makeToast:msg duration:2.0 position:@"center"];
}
- (void) addErrorProcessWithError:(NSError *) error
//- (void) addErrorProcessWithError:(NSError *) error
//{
//    NSString *msg = nil;
//    if (error.code == 120010)
//    {
//        msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误");
//    }
//    else if (error.code == 120020)
//    {
//        msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备");
//    }
//    else if (error.code == 120022)
//    {
//        msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加");
//    }
//    else
//    {
//        msg = NSLocalizedString(@"wifi_add_fail", @"添加失败");
//    }
//
//    [self.view makeToast:msg duration:2.0 position:@"center"];
//    self.msgLabel.hidden = YES;
//}
- (void) addErrorProcessWithError:(ResponseData *)responseData
{
    NSString *msg = nil;
    if (error.code == 120010)
    if ([responseData.code isEqual: @"20010"])
    {
        msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误");
    }
    else if (error.code == 120020)
    else if ([responseData.code isEqual: @"20017"])
    {
        msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备");
    }
    else if (error.code == 120022)
    else if ([responseData.code isEqual: @"20013"])
    {
        msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加");
    }
EZSDK/EZSDK/EZ/UIViewControllers/EZDeviceResultViewController.m
@@ -90,7 +90,7 @@
//                      [self handleTheError:error];
//                  }];
        
        [EZHttpUtil addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
        [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                   verifyCode:[GlobalKit shareKit].deviceVerifyCode
                   completion:^(ResponseData *responseData) {
                       [hud hide:YES];
@@ -127,7 +127,7 @@
//                          [hud hide:YES];
//                          [self handleTheError:error];
//                      }];
            [EZHttpUtil addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
            [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                       verifyCode:[GlobalKit shareKit].deviceVerifyCode
                       completion:^(ResponseData *responseData) {
                           [hud hide:YES];
EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m
@@ -377,7 +377,7 @@
//            }
//        }];
        
        [EZHttpUtil deleteDeviceByHDL:self.deviceInfo.deviceSerial completion:^(ResponseData *responseData) {
        [EZHttpUtil.sharedManager deleteDeviceByHDL:self.deviceInfo.deviceSerial completion:^(ResponseData *responseData) {
            if(responseData.success)
            {
                [hud hide:YES];
EZSDK/EZSDK/EZ/UIViewControllers/EZWifiConfigViewController.m
@@ -89,14 +89,14 @@
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
 #pragma mark - Navigation
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */
#pragma mark - UIAlertViewDelgate Methods
@@ -107,11 +107,18 @@
        self.enState = STATE_PLAT;
        [self createTimerWithTimeOut:30];
        [GlobalKit shareKit].deviceVerifyCode = [alertView textFieldAtIndex:0].text;
        [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                  verifyCode:[GlobalKit shareKit].deviceVerifyCode
                  completion:^(NSError *error) {
                      [self handleTheError:error];
                  }];
        //        [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:^(ResponseData *responseData) {
            //                       [hud hide:YES];
            [self handleTheError:responseData];
        }];
    }
    else if (alertView.tag == 0xbb && buttonIndex == 1)
    {
@@ -133,58 +140,63 @@
        NSInteger mode = 0;
        mode |= self.supportSmartMode?EZWiFiConfigSmart:0;
        mode |= self.supportSoundMode?EZWiFiConfigWave:0;
        __weak typeof(self) weakSelf = self;
        [EZOPENSDK startConfigWifi:weakSelf.ssid
                          password:weakSelf.password
                      deviceSerial:[GlobalKit shareKit].deviceSerialNo
                              mode:mode
                      deviceStatus:^(EZWifiConfigStatus status, NSString *deviceSerial) {
                          if (status == DEVICE_WIFI_CONNECTING)
                          {
                              weakSelf.enState = STATE_NONE;
                              [weakSelf createTimerWithTimeOut:60];
                          }
                          else if (status == DEVICE_WIFI_CONNECTED)
                          {
                              if(weakSelf.enState != STATE_WIFI){
                                  weakSelf.enState = STATE_WIFI;
                                  [weakSelf createTimerWithTimeOut:60];
                              }
                          }
                          else if (status == DEVICE_PLATFORM_REGISTED)
                          {
                              weakSelf.enState = STATE_PLAT;
                              [weakSelf createTimerWithTimeOut:30];
                              if([GlobalKit shareKit].deviceVerifyCode != nil)
                              {
                                  [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                                            verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                            completion:^(NSError *error) {
                                                [weakSelf handleTheError:error];
                                            }];
                              }
                              else
                              {
                                  UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:weakSelf cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                                  alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                                  alertView.tag = 0xaa;
                                  [alertView show];
                                  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                                      if ([_countTimer isValid])
                                      {
                                          [_countTimer invalidate];
                                          _countTimer = nil;
                                      }
                                  });
                              }
                          }
                      }];
            if (status == DEVICE_WIFI_CONNECTING)
            {
                weakSelf.enState = STATE_NONE;
                [weakSelf createTimerWithTimeOut:60];
            }
            else if (status == DEVICE_WIFI_CONNECTED)
            {
                if(weakSelf.enState != STATE_WIFI){
                    weakSelf.enState = STATE_WIFI;
                    [weakSelf createTimerWithTimeOut:60];
                }
            }
            else if (status == DEVICE_PLATFORM_REGISTED)
            {
                weakSelf.enState = STATE_PLAT;
                [weakSelf createTimerWithTimeOut:30];
                if([GlobalKit shareKit].deviceVerifyCode != nil)
                {
                    //                                  [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:^(ResponseData *responseData) {
                        [weakSelf handleTheError:responseData];
                    }];
                }
                else
                {
                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:weakSelf cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                    alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                    alertView.tag = 0xaa;
                    [alertView show];
                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                        if ([_countTimer isValid])
                        {
                            [_countTimer invalidate];
                            _countTimer = nil;
                        }
                    });
                }
            }
        }];
    }
    else
    {
        [self createAddDeviceInitView];
        _enState = STATE_SUCC;
        [self showTipsView];
    }
@@ -232,37 +244,52 @@
        [EZOPENSDK probeDeviceInfo:[GlobalKit shareKit].deviceSerialNo
                        deviceType:[GlobalKit shareKit].deviceModel
                        completion:^(EZProbeDeviceInfo *deviceInfo, NSError *error) {
                            if (error)
                            {
                                //有错误直接显示错误的UI
                                [self showFailedView];
                            }
                            else
                            {
                                if ([GlobalKit shareKit].deviceVerifyCode != nil)
                                {
                                    [EZOPENSDK addDevice:[GlobalKit shareKit].deviceSerialNo
                                              verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                              completion:^(NSError *error) {
                                                  if (!error)
                                                  {
                                                      [self handleTheError:error];
                                                  }
                                                  else
                                                  {
                                                      [self showFailedView];
                                                  }
                                              }];
                                }
                                else
                                {
                                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:self cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                                    alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                                    alertView.tag = 0xaa;
                                    [alertView show];
                                }
                            }
                        }];
            if (error)
            {
                //有错误直接显示错误的UI
                [self showFailedView];
            }
            else
            {
                if ([GlobalKit shareKit].deviceVerifyCode != nil)
                {
                    //                                    [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:^(ResponseData *responseData) {
                        if (responseData.success)
                        {
                            [self handleTheError:responseData];
                        }
                        else
                        {
                            [self showFailedView];
                        }
                    }];
                }
                else
                {
                    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_input_vierify_code", @"请输入设备验证码") message:@"" delegate:self cancelButtonTitle:NSLocalizedString(@"cancel",@"取消") otherButtonTitles:NSLocalizedString(@"done",@"确定"), nil];
                    alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
                    alertView.tag = 0xaa;
                    [alertView show];
                }
            }
        }];
    }
    
    UILabel *timeLabel = (UILabel *)[self.timerImageView viewWithTag:0x11c];
@@ -417,10 +444,10 @@
            
            self.registerLabel.font = [UIFont systemFontOfSize:15.0f];
            self.registerLabel.textColor = [UIColor dd_hexStringToColor:@"0x666666"];
            self.bindLabel.font = [UIFont systemFontOfSize:15.0f];
            self.bindLabel.textColor = [UIColor dd_hexStringToColor:@"0x666666"];
            self.wifiLabel.text = NSLocalizedString(@"wifi_connecting_net", @"萤小石正在努力连接Wi-Fi网络");
            self.registerLabel.text = NSLocalizedString(@"wifi_register_server", @"注册平台服务器");
            self.bindLabel.text = NSLocalizedString(@"wifi_bind_account", @"绑定你的账号");
@@ -672,7 +699,7 @@
        case STATE_PLAT:
        {
            failedLab.text = NSLocalizedString(@"wifi_bind_fail", @"Wi-Fi配置成功,绑定账号失败,请重试");
            self.animationImageView.image = [UIImage imageNamed:@"failure_account"];//设备绑定失败
        }
            break;
@@ -683,11 +710,50 @@
    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])
        {
@@ -699,7 +765,7 @@
        return;
    }
    
    if (error.code == 120010)
    if ([responseData.code isEqual: @"20010"])
    {
        UIAlertView *retryAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_verify_code_wrong", @"验证码错误")
                                                                 message:nil delegate:self
@@ -708,11 +774,11 @@
        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", @"此设备已被别人添加")];
    }
@@ -721,7 +787,6 @@
        [UIView dd_showMessage:NSLocalizedString(@"wifi_add_fail", @"添加失败")];
    }
}
#pragma mark - Action Methods
- (void)completionButtonClicked:(id)sender