定时设置

This commit is contained in:
kai60 2022-05-06 19:05:47 +08:00
parent c5ed8f0873
commit 50bd64b8b4
6 changed files with 1791 additions and 333 deletions

View File

@ -2286,6 +2286,8 @@
C02ED597249E3B7300CAC37D /* InfoByImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */; };
C057166C282376CC004F113A /* UIButton+ImageTitleStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = C057166A282376CC004F113A /* UIButton+ImageTitleStyle.h */; };
C057166D282376CC004F113A /* UIButton+ImageTitleStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = C057166B282376CC004F113A /* UIButton+ImageTitleStyle.m */; };
C05716702823D653004F113A /* XuanduoTimerListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C057166E2823D652004F113A /* XuanduoTimerListViewController.h */; };
C05716712823D653004F113A /* XuanduoTimerListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C057166F2823D652004F113A /* XuanduoTimerListViewController.m */; };
C072196A253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */; };
C072196D253B1F4F0065CF17 /* DatePickerCustomView.h in Headers */ = {isa = PBXBuildFile; fileRef = C072196B253B1F4F0065CF17 /* DatePickerCustomView.h */; };
C072196E253B1F4F0065CF17 /* DatePickerCustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = C072196C253B1F4F0065CF17 /* DatePickerCustomView.m */; };
@ -5780,6 +5782,8 @@
C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoByImageViewController.m; sourceTree = "<group>"; };
C057166A282376CC004F113A /* UIButton+ImageTitleStyle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIButton+ImageTitleStyle.h"; sourceTree = "<group>"; };
C057166B282376CC004F113A /* UIButton+ImageTitleStyle.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIButton+ImageTitleStyle.m"; sourceTree = "<group>"; };
C057166E2823D652004F113A /* XuanduoTimerListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XuanduoTimerListViewController.h; sourceTree = "<group>"; };
C057166F2823D652004F113A /* XuanduoTimerListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XuanduoTimerListViewController.m; sourceTree = "<group>"; };
C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IfishP2PPlayBackListViewController.xib; sourceTree = "<group>"; };
C072196B253B1F4F0065CF17 /* DatePickerCustomView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePickerCustomView.h; sourceTree = "<group>"; };
C072196C253B1F4F0065CF17 /* DatePickerCustomView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DatePickerCustomView.m; sourceTree = "<group>"; };
@ -9722,6 +9726,8 @@
883E76A81D48A5E50030E075 /* XuToSetViewController.h */,
883E76A91D48A5E50030E075 /* XuToSetViewController.m */,
C0CCEF69280D08C600604601 /* XuanduoSettingController.h */,
C057166E2823D652004F113A /* XuanduoTimerListViewController.h */,
C057166F2823D652004F113A /* XuanduoTimerListViewController.m */,
C08976B3282119300098B5FA /* XuanduoTimerSettingViewController.h */,
C08976B4282119300098B5FA /* XuanduoTimerSettingViewController.m */,
C0CCEF6A280D08C600604601 /* XuanduoSettingController.m */,
@ -13196,6 +13202,7 @@
3D1C5095221A9EDF0096AE43 /* Alarm.h in Headers */,
CB4820872334E99700A50C92 /* IQKeyboardManagerConstantsInternal.h in Headers */,
C0EA8A2D23AF74F4003DC53B /* SDWebImagePrefetcher.h in Headers */,
C05716702823D653004F113A /* XuanduoTimerListViewController.h in Headers */,
3D1C5145221A9EE10096AE43 /* BootomViewSoketBackMasgConreol.h in Headers */,
3D1C5146221A9EE10096AE43 /* FishTankBootmDataHelper.h in Headers */,
2AC8750B26874F7500B6161C /* ESPGuideCode.h in Headers */,
@ -15373,6 +15380,7 @@
E58C998A2081A6930004C42B /* RuiMeiBackMsgUtils.m in Sources */,
889133391ECEB97D00F52EBC /* VideoEditeNameViewCell.m in Sources */,
883E76351D4897570030E075 /* BackmassegeModel.m in Sources */,
C05716712823D653004F113A /* XuanduoTimerListViewController.m in Sources */,
881A1D541DD41BEE00BA1AF4 /* MineKanEditSec2FirstCell.m in Sources */,
883E78321D48A5E50030E075 /* BrandDetailViewController.m in Sources */,
3D1C50DE221A9EE00096AE43 /* ShapeRenderNotifyMsg.mm in Sources */,

View File

@ -28,7 +28,7 @@
#import "NSString+Add.h"
#import "XuToControlName.h"
#import "UserExtendataArchaver.h"
#import "XuanduoTimerSettingViewController.h"
#import "XuanduoTimerListViewController.h"
#define kBtnTag 500
#define kSwitchBtnTag 600
@ -523,7 +523,7 @@ static NSString *setTimerflag = @"SetTimerCell";
#pragma mark - cell
- (void)foldAction:(UIButton *)btn
{
XuanduoTimerSettingViewController *_settingVC = [[XuanduoTimerSettingViewController alloc] init];
XuanduoTimerListViewController *_settingVC = [[XuanduoTimerListViewController alloc] init];
_settingVC.currentdevice = self.currentdevice;
_settingVC.dataModel = self.dataModel;
[self.navigationController pushViewController:_settingVC animated:YES];

View File

@ -0,0 +1,28 @@
//
// Xuanduo2SettingController.h
// Ifish
//
// Created by Alex on 2019/4/28.
// Copyright © 2019 lianlian. All rights reserved.
//
#import "FatherController.h"
#import "IfishDeviceInfo.h"
#import "xuanduo3fModel.h"
#import "ReadTimerModel.h"
#import "XuanduoTimerSettingViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class Xuanduo2Model;
@interface XuanduoTimerListViewController : FatherController
@property (nonatomic,strong) UIActivityIndicatorView*indicatorView;
@property (nonatomic ,strong) id dataModel;
@property(nonatomic,strong) DeviceModel* currentdevice;
@property (nonatomic, strong) ReadTimerModel *readMode;
- (void)refreshWithData:(id)model;
@end
NS_ASSUME_NONNULL_END

View File

@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic ,strong) id dataModel;
@property(nonatomic,strong) DeviceModel* currentdevice;
@property (nonatomic, strong) ReadTimerModel *readMode;
@property (nonatomic, assign) NSInteger timerType; //1,定时 2循环 3自恢复
- (void)refreshWithData:(id)model;
@end

View File

@ -97,7 +97,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
- (void)setup {
[self.navigationController.navigationBar resetBackgroundImage];
NSString*title=@"定时设置";
NSString*title=self.readMode.selectorName;
[self addTitleViewWithTitle:title];
[self refreshWithData:self.dataModel];
@ -119,36 +119,37 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
- (void)setupTable {
XuToControlName *name = [UserExtendataArchaver currentNewXuToControlName:self.currentdevice.macAddress];
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
name=[UserExtendataArchaver currentPetsXuToControlName:self.currentdevice.macAddress];
}
// _titieArr = @[@"循环泵",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"杀菌灯"];
_titieArr = @[name.xunhuanPump,name.zengyangPump,name.light1,name.light2,name.zaolangPump,name.shajunLight];
_imgArr = @[@"循环棒",@"增氧泵",@"灯光1",@"灯光2",@"造浪",@"杀菌"];
NSString*type=@"";
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
if (self.timerType==1)
{
_titieArr = @[name.xunhuanPump,name.zaolangPump,name.light1];
_imgArr = @[@"照明开",@"换气开",@"杀菌开"];
type=@"定时模式";
}
else if(self.timerType==2)
{
type=@"循环模式";
}
else if(self.timerType==3)
{
type=@"自恢复模式";
}
_titieArr = @[type];
_selectSection = -1;
for (int i = 0; i<_titieArr.count; i++) {
NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0];
if (![_titieArr[i] isEqualToString:@"杀菌"])
{
[dataArr addObject:plusflag];
_selectSection = 0;
if (self.timerType==1||self.timerType==3)
{
for (int i = 0; i<_titieArr.count; i++) {
NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0];
[dataArr addObject:plusflag];
[self.timeDic setObject:dataArr forKey:_titieArr[i]];
}
[self.timeDic setObject:dataArr forKey:_titieArr[i]];
}
self.tableView.backgroundColor=COLOR_MIAN;
self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:temperatureCellid bundle:nil] forCellReuseIdentifier:temperatureCellid];
@ -165,173 +166,45 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2 + self.timeDic.allKeys.count+([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]?1:0);
return (self.timerType==3)?2:1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return 1;
}else if (section == 1){
return 2;
}
if (section - 2 < _titieArr.count) {
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[section-2]];
if (self.timerType==1)
{
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[0]];
return dataArr.count;
}
else
else if(self.timerType==2)
{
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
return 1;
}
else if(self.timerType==3)
{
if (section==0)
{
return 1;
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[0]];
return dataArr.count;
}
else{
return 0;
}
}
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0){
TemperatureSetCell *cell = [tableView dequeueReusableCellWithIdentifier:temperatureCellid];
TemperatureSetModel *model=[[TemperatureSetModel alloc]init];
model.title = @"定时设置";
cell.titleLabel.text = model.title;
NSLog(@"wendu str = %@",_wenduString);
model.temperatureLabel = _wenduString;
cell.temperaturelabel.text = model.temperatureLabel;
[cell.temPSwitch addTarget:self action:@selector(xuTotempSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
cell.temperaturelabel.hidden=YES;
cell.temPSwitch.hidden=YES;
cell.icon.hidden=NO;
cell.icon.image=[UIImage imageNamed:@"定时"];
cell.titileLabelLayout.constant=40;
if (self.dataModel) {
Xuanduo2Model*model=self.dataModel;
if ([model.alarmSwitch isEqualToString:@"01"]) {
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal];
cell.temPSwitch.selected = NO;
}else{
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal];
cell.temPSwitch.selected = YES;
}
}
return cell;
}else if(indexPath.section == 1 && indexPath.row == 0){
if (![self.currentdevice.waterRemind isEqual:[NSNull null]]) {
ChangeWaterCell *cell = [tableView dequeueReusableCellWithIdentifier:changeWaterCellid];
[cell.ChangeWaterSwitch addTarget:self action:@selector(xuTochangeWaterSwitch:) forControlEvents:UIControlEventTouchUpInside];
if ([self.waterInfmodel.waterremind isEqualToString:@"1"]) {
[cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal];
cell.ChangeWaterSwitch.selected = NO;
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"firstSetCell"]];
_huanShuiSwitchIsOn=YES;
}else{
[cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal];
cell.ChangeWaterSwitch.selected = YES;
_huanShuiSwitchIsOn=NO;
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"set_cellBack"]];
}
if (self.waterInfmodel.remindcycle == 0) {
//
cell.huanshuiDaylabel.text=@"换水时间";
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
cell.huanshuiDaylabel.text=@"杀菌时间";
cell.titleLabel.text=@"杀菌提醒";
}
}else{
cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%ld天",(long)self.waterInfmodel.remindcycle];
}
return cell;
}
}else if (indexPath.section==1 && indexPath.row == 1){
static NSString*nextHuanShuiLablecellId=@"labelcell";
UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:nextHuanShuiLablecellId];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nextHuanShuiLablecellId];
}
if (_huanShuiSwitchIsOn) {
cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.waterInfmodel.remindDate];
if (!self.waterInfmodel.remindDate) {
cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.nextChangeDateLabel];
}
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
cell.textLabel.text=[NSString stringWithFormat:@"下次杀菌时间:%@",self.waterInfmodel.remindDate];
if (!self.waterInfmodel.remindDate) {
cell.textLabel.text=[NSString stringWithFormat:@"下次杀菌时间:%@",self.nextChangeDateLabel];
}
}
cell.textLabel.font=[UIFont systemFontOfSize:15];
[cell.textLabel sizeToFit];
cell.textLabel.textColor =[UIColor colorWithRed:146.0/256.0 green:146.0/256.0 blue:146.0/256.0 alpha:1];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"secondSetCell"]];
}
else{
cell.textLabel.text=@"";
}
cell.userInteractionEnabled = NO;
return cell;
}else if(indexPath.section -2== _titieArr.count && indexPath.row == 0&&[self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
TemperatureSetCell *cell = [tableView dequeueReusableCellWithIdentifier:temperatureCellid];
TemperatureSetModel *model=[[TemperatureSetModel alloc]init];
model.title = @"恒温设置";
cell.titleLabel.text = model.title;
Xuanduo3fModel*xmodel=(Xuanduo3fModel*)_dataModel;
NSString*heating = xmodel.heatingTemperature;
UInt64 heat = [dataContorl hexToTen:heating];
float formatheat = heat/10;
model.temperatureLabel = [NSString stringWithFormat:@"%f",formatheat];
cell.temPSwitch.hidden=YES;
cell.temperaturelabel.frame=cell.temPSwitch.frame;
Xuanduo3fModel*model3=self.dataModel;
int mac=[dataContorl hexToTen:model3.heatingTemperature];
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp];
cell.temperaturelabel.textAlignment=NSTextAlignmentRight;
[cell.temperaturelabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"℃"]]];
return cell;
}
else {
if (indexPath.section - 2 < _titieArr.count && _selectSection == indexPath.section) {
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section-2]];
if (self.timerType==1) {
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section]];
BOOL havePlus = [dataArr containsObject:plusflag];
if (havePlus && (indexPath.row == dataArr.count-1)) {
TimerTypeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:timerTypeFlag];
if (!cell) {
cell=[[TimerTypeTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:timerTypeFlag];
}
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;
@ -365,133 +238,57 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
return cell;
}
}
}
return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@""];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
return 50;
}else if (indexPath.section == 1 && indexPath.row == 0){
return 0;
}else if (indexPath.section == 1 && indexPath.row == 1){
if (!_huanShuiSwitchIsOn) {
}else {
return 0;
}
}else if (indexPath.section - 2 <_titieArr.count) {
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section-2]];
BOOL havePlus = [dataArr containsObject:plusflag];
if (_selectSection == indexPath.section) {
if (havePlus && indexPath.row == dataArr.count - 1) {
return 40;
}else{
return 50;
}
}else {
return 0;
}
}
else if(indexPath.section - 2 ==_titieArr.count&&[self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
CGFloat height=40;
if (self.timerType==1||self.timerType==3)
{
return 50;
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section]];
BOOL havePlus = [dataArr containsObject:plusflag];
if (havePlus && (indexPath.row == dataArr.count-1))
{
height=80;
}
}
return 0;
return height;
}
#pragma mark tableView
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == 0) {
return 5;
}else if (section == 2){
return 40;
}else if (section == 3){
return 40;
}else if (section == 4){
return 40;
}else if (section == 5){
return [self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]?0:40;
}else if (section == 6){
return 40;
}else if (section == 7){
return 40;
}else {
return CGFLOAT_MIN;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
CGFloat height=0;
height=section==0?50:40;
return height;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if (section == 0) {
UIView *oneHeader = [[UIView alloc] init];
oneHeader.backgroundColor = COLOR_MIAN;
return oneHeader;
}else if(section == 2){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}else if(section == 3){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}else if(section == 4){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}else if(section == 5){
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
UIView *oneHeader = [[UIView alloc] init];
oneHeader.backgroundColor = COLOR_MIAN;
return oneHeader;
}
else
{
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}
CGFloat height=0;
height=section==0?50:40;
UIImageView*imageView=[[UIImageView alloc]init];
imageView.frame=CGRectMake(0, 0, self.tableView.frame.size.width, height);
imageView.image=[UIImage imageNamed:@"ifishSetCell_back"];
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.tableView.frame.size.width-20, height)];
label.text=_titieArr[section];
label.textColor=[UIColor blackColor];
[imageView addSubview:label];
}else if(section == 6){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}else if(section == 7){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
return imageView;
}else if(section == 1)
{
CGFloat height=0;
height=section==0?50:40;
UIImageView*imageView=[[UIImageView alloc]init];
imageView.frame=CGRectMake(0, 0, self.tableView.frame.size.width, height);
imageView.image=[UIImage imageNamed:@"ifishSetCell_back"];
return imageView;
}
return nil;
@ -499,35 +296,10 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
#pragma mark tableView
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
_indexPath = indexPath;
if (indexPath.section==0) {
// _mypicView=[[MyPickerView alloc]init];
//
// _mypicView.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
// [self.view.window addSubview:_mypicView];
// [_mypicView.sureButton addTarget:self action:@selector(mypicViewRemoveByDone) forControlEvents:UIControlEventTouchUpInside];
// [self temperatureMainQueue];
}else if (indexPath.section==1){
//
_remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:self.currentdevice.type];
_remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
_remindPic.type=self.currentdevice.type;
[self.view.window addSubview:_remindPic];
[_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside];
[self huanShuiMainQueue];
}else if(indexPath.section-2==_titieArr.count){
//
_remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:@"temp"];
_remindPic.type=@"temp";
_remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
[self.view.window addSubview:_remindPic];
[_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside];
[self huanShuiMainQueue];
}else {
{
SetTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath];
if ([cell isKindOfClass:[PlusTableViewCell class]]) {
return;
@ -596,8 +368,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
_selectSection = btn.tag - kBtnTag;
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
//
readModel.selectorName=_titieArr[_selectSection - 2];
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]&&(_selectSection - 2)==2)
readModel.selectorName=_titieArr[_selectSection ];
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
readModel.functionCode=@"19";//
}
@ -608,7 +380,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
readModel.sendmacId =self.currentdevice.macAddress;
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
switch (_selectSection - 2) {
switch (_selectSection ) {
case 0: //
readModel.selectorNumber = @"04";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
@ -653,7 +425,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
- (void)switchAction:(UIButton *)btn {
NSInteger index = btn.tag - kSwitchBtnTag;
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
BOOL havePlus = [dataArr containsObject:plusflag];
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
timerModel.sendmacId =self.currentdevice.macAddress;
@ -675,7 +447,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
readModel.sendmacId =self.currentdevice.macAddress;
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
switch (_selectSection - 2) {
switch (_selectSection ) {
case 0: //
{
timerModel.selectorNumber = @"04";
@ -792,7 +564,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
}
- (void)resetPickerView {
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
BOOL havePlus = [dataArr containsObject:plusflag];
XuanduoTimerGroup *model = nil;
if (havePlus) {
@ -871,7 +643,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
readModel.sendmacId =self.currentdevice.macAddress;
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
NSInteger index = _selectSection - 2;
NSInteger index = _selectSection ;
if (index < _titieArr.count) {
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]];
NSInteger groupNumber = 1;
@ -986,10 +758,10 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
readModel.sendmacId =self.currentdevice.macAddress;
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
NSInteger index = _selectSection - 2;
NSInteger index = _selectSection ;
NSLog(@"index = %d",index);
if (index < _titieArr.count) {
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
BOOL havePlus = [dataArr containsObject:plusflag];
XuanduoTimerGroup *group = [dataArr objectAtIndex:(havePlus?_indexPath.row+1:_indexPath.row)];
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];
@ -1065,7 +837,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
NSString *endHourStr = [NSString stringWithFormat:@"%ld",endHour + 24];
addEndtime = [NSString stringWithFormat:@"%@:%@",endHourStr,[addEndtime substringFromIndex:3]];
}
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
[dataArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XuanduoTimerGroup class]]) {
XuanduoTimerGroup *group = obj;
@ -1186,7 +958,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
#pragma mark
-(void)huanShuiMainQueue{
if (_indexPath.section-2==_titieArr.count)
if (_indexPath.section==_titieArr.count)
{
Xuanduo3fModel*model3=self.dataModel;
int mac=[dataContorl hexToTen:model3.heatingTemperature];
@ -1288,7 +1060,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
[_remindPic removeFromSuperview];
}
else if (_indexPath.section-2==_titieArr.count)
else if (_indexPath.section==_titieArr.count)
{
TemperatureSetCell*cell=[self.tableView cellForRowAtIndexPath:_indexPath];
NSString *str=_remindPic.picViewResultString;
@ -1569,7 +1341,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
NSString*string1=[dataContorl dataToHexString:data];
NSLog(@"return str == %@",string1);
NSString *readTimer = [string1 substringToIndex:4];
if (_selectSection-2<_titieArr.count && _selectSection-2>=0 && [readTimer isEqualToString:@"0116"]) {
if ([readTimer isEqualToString:@"0116"]) {
if (!_timerModel) {
_timerModel = [[Xuanduo2TimerModel alloc] init];
_timerModel.groupModelArr = [NSMutableArray array];
@ -1577,7 +1349,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
[_timerModel.groupModelArr removeAllObjects];
}
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type];
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
[dataArr removeAllObjects];
[dataArr addObject:plusflag];
[dataArr addObjectsFromArray:_timerModel.groupModelArr];
@ -1591,11 +1363,11 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
}
else if (_selectSection-2<_titieArr.count && _selectSection-2>=0 && [readTimer isEqualToString:@"0119"]) {
else if (_selectSection<_titieArr.count && _selectSection>=0 && [readTimer isEqualToString:@"0119"]) {
_cycleModel=[[XuanduoCycleModel alloc]init];
[Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentdevice.type];
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
[dataArr removeAllObjects];
[dataArr addObject:_cycleModel];
@ -1618,6 +1390,13 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
}
-(void)ifishDeviceLogInSuccees{
ReadTimerModel*readModel=self.readMode;
if (readModel) {
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
NSData*readData=[dataContorl stringToHexData:readString];
[[Socketsingleton sharedInstance] soketWriteData:readData];
[_indicatorView startAnimating];
}
}