三种定时模式

This commit is contained in:
kai60 2022-05-07 17:19:20 +08:00
parent 50bd64b8b4
commit dd37b0dbce
2 changed files with 100 additions and 1 deletions

View File

@ -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];

View File

@ -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];