From dd37b0dbcecfac7b11b23e5869c78536d4b7c5d9 Mon Sep 17 00:00:00 2001 From: kai60 Date: Sat, 7 May 2022 17:19:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E7=A7=8D=E5=AE=9A=E6=97=B6=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IfishHttpRequest/IfishDataUnity.m | 3 +- .../XuTo/XuanduoTimerSettingViewController.m | 98 +++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m index 2832015..f20d61f 100644 --- a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m +++ b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m @@ -216,13 +216,14 @@ UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc]; [UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav; } - else if([devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + else if([devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]||[devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO4F]||[devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO5F]){ //绚多新设备 Xuanduo2fController *xuanduo2fVc = [Xuanduo2fController new]; xuanduo2fVc.currentDevice = devicemodel; UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc]; [UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav; } + else{ int controlAmount=[devicemodel.controlAmount intValue]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m index 2962243..de648d5 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoTimerSettingViewController.m @@ -238,6 +238,91 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; return cell; } } + else if (self.timerType==2) {//循环开关 + NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section]]; + BOOL havePlus = [dataArr containsObject:plusflag]; + if (havePlus && (indexPath.row == dataArr.count-1)) { + PlusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:addCellid forIndexPath:indexPath]; + cell.addTimerBtn.tag = kBtnTag + indexPath.section; + [cell.addTimerBtn addTarget:self action:@selector(addTimer:) forControlEvents:UIControlEventTouchUpInside]; + return cell; + + }else { + SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath]; + cell.switchBtn.tag = kSwitchBtnTag + indexPath.row; + [cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside]; + XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row]; + cell.model=group; + if ([group isKindOfClass:[XuanduoTimerGroup class]]) + { + BOOL isOn = NO; + if ([group.status isEqualToString:@"01"]) { + isOn = YES; + } + [cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + } + else if([group isKindOfClass:[XuanduoCycleModel class]]) + { + XuanduoCycleModel*model=group; + BOOL isOn = NO; + if ([model.status isEqualToString:@"00"]) { + isOn = YES; + } + + + + [cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + } + return cell; + } + } + else if (self.timerType==3) {//自恢复开关 + NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section]]; + BOOL havePlus = [dataArr containsObject:plusflag]; + if (havePlus && (indexPath.row == dataArr.count-1)) { + PlusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:addCellid forIndexPath:indexPath]; + cell.addTimerBtn.tag = kBtnTag + indexPath.section; + [cell.addTimerBtn addTarget:self action:@selector(addTimer:) forControlEvents:UIControlEventTouchUpInside]; + return cell; + + }else { + SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath]; + cell.switchBtn.tag = kSwitchBtnTag + indexPath.row; + [cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside]; + XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row]; + cell.model=group; + if ([group isKindOfClass:[XuanduoTimerGroup class]]) + { + BOOL isOn = NO; + if ([group.status isEqualToString:@"01"]) { + isOn = YES; + } + [cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + } + else if([group isKindOfClass:[XuanduoCycleModel class]]) + { + XuanduoCycleModel*model=group; + BOOL isOn = NO; + if ([model.status isEqualToString:@"00"]) { + isOn = YES; + } + + + + [cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + } + return cell; + } + } + return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@""]; } @@ -1392,7 +1477,20 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; -(void)ifishDeviceLogInSuccees{ ReadTimerModel*readModel=self.readMode; if (readModel) { + if (self.timerType==1) + { + readModel.functionCode=@"16"; + } + else if (self.timerType==2) + { + readModel.functionCode=@"19"; + } + else if (self.timerType==3) + { + readModel.functionCode=@"15"; + } NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str]; + NSData*readData=[dataContorl stringToHexData:readString]; [[Socketsingleton sharedInstance] soketWriteData:readData]; [_indicatorView startAnimating];