| | |
| | | @property (nonatomic,assign) BOOL supportApMode; |
| | | @property (nonatomic,assign) BOOL supportSmartMode; |
| | | @property (nonatomic,assign) BOOL supportSoundMode; |
| | | |
| | | @property (nonatomic,strong) UIView *tipView ;//配网提示view |
| | | |
| | | @property (nonatomic,strong) UIImageView *step1TipImgV ;//步骤1提示图view |
| | | @property (nonatomic,strong) UIImageView *step1ImgV ;//步骤1图view |
| | | @property (nonatomic,strong) UILabel *step1DescribeL ;//步骤1描述lable |
| | | |
| | | @property (nonatomic,strong) UIImageView *step2TipImgV ;//步骤2提示图view |
| | | @property (nonatomic,strong) UIImageView *step2ImgV ;//步骤2图view |
| | | @property (nonatomic,strong) UILabel *step2DescribeL ;//步骤2描述lable |
| | | |
| | | |
| | | @property (nonatomic,strong) UIView *btnBackView ;//按钮背景view |
| | | @property (nonatomic,strong) UIButton *connectedBtn;//已连接按钮 |
| | | |
| | | @end |
| | | |
| | | @implementation EZDeviceResultViewController |
| | |
| | | error.code == EZ_HTTPS_DEVICE_NOT_EXISTS || |
| | | error.code == EZ_HTTPS_DEVICE_OFFLINE_IS_ADDED_MYSELF) |
| | | { |
| | | if ([[EZSDK sharedInstance].connectTipModels containsObject:deviceInfo.model]||[self checkIfShouldTipWithDeviceModel:deviceInfo.model]) {//为需要提示配网的类型 |
| | | [self showConnectWifiTipView]; |
| | | return; |
| | | } |
| | | self.statusLabel.hidden = NO; |
| | | self.actionButton.hidden = NO; |
| | | if (deviceInfo) |
| | |
| | | self.supportSmartMode = YES; |
| | | self.supportSoundMode = YES; |
| | | } |
| | | |
| | | self.statusLabel.text =HDLEZLocallizedString(@"wifi_config_not_connected"); |
| | | |
| | | [self.actionButton setTitle:NSLocalizedString(@"ad_connect_net", @"连接网络") forState:UIControlStateNormal]; |
| | | } |
| | | else |
| | |
| | | |
| | | } |
| | | |
| | | /*检测model是否包含需要提示的类型 |
| | | */ |
| | | -(BOOL)checkIfShouldTipWithDeviceModel:(NSString*)deviceModel{ |
| | | for (NSString *model in [EZSDK sharedInstance].connectTipModels) { |
| | | if ([deviceModel containsString:[NSString stringWithFormat:@"-%@-",model]]) { |
| | | return YES; |
| | | break; |
| | | } |
| | | } |
| | | return NO; |
| | | } |
| | | |
| | | /*提示view |
| | | */ |
| | | -(UIView*)tipView{ |
| | | if (!_tipView) { |
| | | //提示view |
| | | _tipView=[[UIView alloc] init]; |
| | | [self.view addSubview:_tipView]; |
| | | [_tipView mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(self.view).offset(HDLEZ_APP_TOP_BAR_HEIGHT); |
| | | make.left.bottom.right.equalTo(self.view); |
| | | }]; |
| | | _tipView.backgroundColor=HDLEZ_COLOR_VIEW_BACKGROUND; |
| | | |
| | | //步骤1指示图 |
| | | _step1TipImgV=[[UIImageView alloc] init]; |
| | | [_tipView addSubview:_step1TipImgV]; |
| | | [_step1TipImgV mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(_tipView).offset(33); |
| | | make.left.equalTo(_tipView).offset(HDLEZGetRealWidth(33)); |
| | | make.width.mas_equalTo(130); |
| | | make.height.mas_equalTo(120); |
| | | }]; |
| | | _step1TipImgV.image=[UIImage imageNamed:@"hdl_ez_wifi_connect_step1"]; |
| | | |
| | | //步骤1图 |
| | | _step1ImgV=[[UIImageView alloc] init]; |
| | | [_tipView addSubview:_step1ImgV]; |
| | | [_step1ImgV mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(_step1TipImgV.mas_bottom).offset(13); |
| | | make.left.equalTo(_step1TipImgV).offset(7); |
| | | make.width.mas_equalTo(19); |
| | | make.height.mas_equalTo(22); |
| | | }]; |
| | | _step1ImgV.image=[UIImage imageNamed:@"hdl_ez_wifi_connect_step_one"]; |
| | | |
| | | //步骤1描述lable |
| | | _step1DescribeL=[[UILabel alloc] init]; |
| | | [_tipView addSubview:_step1DescribeL]; |
| | | [_step1DescribeL mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(_step1ImgV.mas_bottom).offset(7); |
| | | make.left.equalTo(_step1ImgV); |
| | | make.right.equalTo(_step1TipImgV); |
| | | make.height.mas_equalTo(22); |
| | | }]; |
| | | _step1DescribeL.font=HDLEZ_Get_FontBoldWithSize(HDLEZ_FontSize_16); |
| | | _step1DescribeL.textColor=HDLEZ_COLOR_TEXT_TITLE_GRAY; |
| | | _step1DescribeL.numberOfLines=2; |
| | | _step1DescribeL.adjustsFontSizeToFitWidth=YES; |
| | | _step1DescribeL.text=HDLEZLocallizedString(@"wifi_config_select_set_param"); |
| | | |
| | | //步骤2指示图 |
| | | _step2TipImgV=[[UIImageView alloc] init]; |
| | | [_tipView addSubview:_step2TipImgV]; |
| | | [_step2TipImgV mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(_tipView).offset(33); |
| | | make.right.equalTo(_tipView).offset(HDLEZGetRealWidth(-33)); |
| | | make.width.mas_equalTo(130); |
| | | make.height.mas_equalTo(120); |
| | | }]; |
| | | _step2TipImgV.image=[UIImage imageNamed:@"hdl_ez_wifi_connect_step2"]; |
| | | |
| | | //步骤2图 |
| | | _step2ImgV=[[UIImageView alloc] init]; |
| | | [_tipView addSubview:_step2ImgV]; |
| | | [_step2ImgV mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(_step2TipImgV.mas_bottom).offset(13); |
| | | make.left.equalTo(_step2TipImgV).offset(7); |
| | | make.width.mas_equalTo(19); |
| | | make.height.mas_equalTo(22); |
| | | }]; |
| | | _step2ImgV.image=[UIImage imageNamed:@"hdl_ez_wifi_connect_step_two"]; |
| | | |
| | | //步骤2描述lable |
| | | _step2DescribeL=[[UILabel alloc] init]; |
| | | [_tipView addSubview:_step2DescribeL]; |
| | | [_step2DescribeL mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.top.equalTo(_step2ImgV.mas_bottom).offset(7); |
| | | make.left.equalTo(_step2ImgV); |
| | | make.right.equalTo(_step2TipImgV); |
| | | make.height.mas_equalTo(22); |
| | | }]; |
| | | _step2DescribeL.font=HDLEZ_Get_FontBoldWithSize(HDLEZ_FontSize_16); |
| | | _step2DescribeL.textColor=HDLEZ_COLOR_TEXT_TITLE_GRAY; |
| | | _step2DescribeL.numberOfLines=2; |
| | | _step2DescribeL.adjustsFontSizeToFitWidth=YES; |
| | | _step2DescribeL.text=HDLEZLocallizedString(@"wifi_config_select_wifi"); |
| | | |
| | | //已连接按钮背景view |
| | | _btnBackView=[[UIView alloc] init]; |
| | | [_tipView addSubview:_btnBackView]; |
| | | [_btnBackView mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.left.bottom.right.equalTo(_tipView); |
| | | make.height.mas_equalTo(76); |
| | | }]; |
| | | _btnBackView.backgroundColor=HDLEZ_COLOR_VIEW_FOREGROUND; |
| | | _btnBackView.layer.cornerRadius = 16; |
| | | _btnBackView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner; |
| | | |
| | | |
| | | //已连接按钮 |
| | | _connectedBtn=[[UIButton alloc] init]; |
| | | [_btnBackView addSubview:_connectedBtn]; |
| | | [_connectedBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| | | make.left.equalTo(_tipView).offset(78); |
| | | make.right.equalTo(_tipView).offset(-78); |
| | | make.top.equalTo(_btnBackView).offset(12); |
| | | make.height.mas_equalTo(44); |
| | | }]; |
| | | _connectedBtn.layer.cornerRadius = 22; |
| | | [_connectedBtn setBackgroundColor:HDLEZ_COLOR_BACKGROUND_BUTTON]; |
| | | [_connectedBtn setTitle:HDLEZLocallizedString(@"wifi_config_connected") forState:UIControlStateNormal]; |
| | | _connectedBtn.titleLabel.font=HDLEZ_Get_FontBoldWithSize(HDLEZ_FontSize_16); |
| | | [_connectedBtn setTitleColor:HDLEZ_COLOR_TEXT_WHITE forState:UIControlStateNormal]; |
| | | [_connectedBtn addTarget:self action:@selector(Connected) forControlEvents:UIControlEventTouchUpInside]; |
| | | } |
| | | return _tipView; |
| | | } |
| | | |
| | | /*展示引导view(萤石部分设备不能通过该流程进行配网) |
| | | */ |
| | | -(void)showConnectWifiTipView{ |
| | | self.title = HDLEZLocallizedString(@"wifi_config_net_work"); |
| | | [self.tipView setHidden:NO]; |
| | | |
| | | } |
| | | |
| | | /*已连接 |
| | | */ |
| | | -(void)Connected{ |
| | | self.title = HDLEZLocallizedString(@"ad_result_title"); |
| | | |
| | | //隐藏指示view |
| | | [self.tipView setHidden:YES]; |
| | | |
| | | [self doSearchDevice]; |
| | | } |
| | | |
| | | - (void)handleTheError:(ResponseData *)responseData |
| | | { |
| | | if (responseData.success) |