三种定时模式
This commit is contained in:
parent
50bd64b8b4
commit
dd37b0dbce
|
|
@ -216,13 +216,14 @@
|
||||||
UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc];
|
UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc];
|
||||||
[UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav;
|
[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];
|
Xuanduo2fController *xuanduo2fVc = [Xuanduo2fController new];
|
||||||
xuanduo2fVc.currentDevice = devicemodel;
|
xuanduo2fVc.currentDevice = devicemodel;
|
||||||
UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc];
|
UINavigationController *xuanduo2fNav=[[UINavigationController alloc]initWithRootViewController:xuanduo2fVc];
|
||||||
[UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav;
|
[UIApplication sharedApplication].delegate.window.rootViewController = xuanduo2fNav;
|
||||||
}
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
|
|
||||||
int controlAmount=[devicemodel.controlAmount intValue];
|
int controlAmount=[devicemodel.controlAmount intValue];
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,91 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||||
return cell;
|
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:@""];
|
return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@""];
|
||||||
}
|
}
|
||||||
|
|
@ -1392,7 +1477,20 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||||
-(void)ifishDeviceLogInSuccees{
|
-(void)ifishDeviceLogInSuccees{
|
||||||
ReadTimerModel*readModel=self.readMode;
|
ReadTimerModel*readModel=self.readMode;
|
||||||
if (readModel) {
|
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];
|
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||||
|
|
||||||
NSData*readData=[dataContorl stringToHexData:readString];
|
NSData*readData=[dataContorl stringToHexData:readString];
|
||||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||||
[_indicatorView startAnimating];
|
[_indicatorView startAnimating];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue