From fa81a1190216f7f9c9574deb95a3314a55f58591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E5=8F=91=E5=86=AC?= Date: Sun, 29 May 2022 18:41:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=BC=80=E5=92=8C=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E4=B8=80=E9=94=AE=20=E5=96=82=E9=B1=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XuTo/Xuanduo2fController.m | 101 +++++++++++++++--- .../XuTo/XuanduoElectricityController.m | 2 + 2 files changed, 91 insertions(+), 12 deletions(-) diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m index 2adcf80..b25469f 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m @@ -30,6 +30,7 @@ #import "UIImage+WaterMark.h" #import "XuanduoSettingController.h" #import "XuanduoElectricityController.h" +#import "XuanduofishFeedViewController.h" #define kBtnTag 100 @@ -72,6 +73,7 @@ @property(nonatomic,assign) NSInteger heartCount; @property (weak, nonatomic) IBOutlet UILabel *waterLever; +@property(nonatomic,strong)XuanduoFishFeedModel*fishFeedModel; @@ -340,6 +342,55 @@ uvsel=[uvsel imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}]; // [self.light1 setImage:uvsel forState:UIControlStateSelected]; + } + }else if ([readTimer isEqualToString:@"0116"]) + { + + NSString*lightNumber=[string1 substringWithRange:NSMakeRange(30, 2)]; + if ([lightNumber isEqualToString:@"09"])//一键喂鱼 + { + XuanduoFishFeedModel*fishFeedModel=[[XuanduoFishFeedModel alloc]init]; + fishFeedModel.feedTime=[string1 substringWithRange:NSMakeRange(32, 2)]; + fishFeedModel.lightChooseStatus=[string1 substringWithRange:NSMakeRange(34, 2)]; + fishFeedModel.lightOpenStatus=[string1 substringWithRange:NSMakeRange(36, 2)]; + + self.fishFeedModel=fishFeedModel; + + NSString*tips=@""; + if ([self.fishFeedModel.lightChooseStatus isEqualToString:@"00"]&&[self.fishFeedModel.lightOpenStatus isEqualToString:@"00"]) + { + tips=@"请先添加喂鱼设置"; + } + else if ([self.dataModel.fishFeedStatus isEqualToString:@"00"]) + { + tips=@"您确定要立即喂鱼吗?"; + } + else if ([self.dataModel.fishFeedStatus isEqualToString:@"01"]) + { + tips=@"您确定要立即关闭喂鱼功能吗?"; + } + UIAlertController*alert=[UIAlertController alertControllerWithTitle:@"提示" message:tips preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction*okaction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + if ([self.fishFeedModel.lightChooseStatus isEqualToString:@"00"]&&[self.fishFeedModel.lightOpenStatus isEqualToString:@"00"]) + { + XuanduofishFeedViewController *_settingVC = [[XuanduofishFeedViewController alloc] init]; + _settingVC.currentdevice = self.currentDevice; + _settingVC.dataModel = self.dataModel; + [self.navigationController pushViewController:_settingVC animated:YES]; + } + else + { + [self changeFeedStatus]; + } + }]; + UIAlertAction*cancelAction=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + + }]; + [alert addAction:okaction]; + [alert addAction:cancelAction]; + + [self presentViewController:alert animated:YES completion:nil]; + } } else @@ -444,6 +495,10 @@ [self readCycleWithNumber:@"03"]; self.heartCount=0; + } + else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO4F]||[self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO5F]) + { + } } @@ -517,19 +572,8 @@ if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO4F]||[self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO5F])//一键喂鱼 { - sender.selected=!sender.selected; - baseModel*readModel=[[baseModel alloc]init]; - readModel.sendmacId =self.currentDevice.macAddress; - readModel.resavemacId =self.currentDevice.macAddress; - readModel.functionCode=@"0c"; - readModel.massagelegth=@"12"; - NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,[self.dataModel.fishFeedStatus isEqualToString:@"00"]?@"01":@"00",@"0000"]; - - NSData*readData=[dataContorl stringToHexData:readString]; - [[Socketsingleton sharedInstance] soketWriteData:readData]; - - [_indicatorView startAnimating]; + [self readFishFeedModel];//先读取 } @@ -549,6 +593,22 @@ } } } +//改变喂鱼状态 +-(void)changeFeedStatus +{ + baseModel*readModel=[[baseModel alloc]init]; + readModel.sendmacId =self.currentDevice.macAddress; + readModel.resavemacId =self.currentDevice.macAddress; + readModel.functionCode=@"0c"; + readModel.massagelegth=@"12"; + + NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,[self.dataModel.fishFeedStatus isEqualToString:@"00"]?@"01":@"00",@"0000"]; + + NSData*readData=[dataContorl stringToHexData:readString]; + [[Socketsingleton sharedInstance] soketWriteData:readData]; + + [_indicatorView startAnimating]; +} - (IBAction)btnActions:(UIButton *)btn { if (self.dataModel.gasPump) { @@ -692,6 +752,23 @@ } } +-(void)readFishFeedModel +{ + //读取一键喂鱼状态 + ReadTimerModel *readModel = [[ReadTimerModel alloc] init]; + readModel.sendmacId =self.currentDevice.macAddress; + readModel.resavemacId = self.currentDevice.macAddress; + readModel.crc16str=@"0000"; + readModel.selectorNumber=@"09"; + NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str]; + + + + NSData*readData=[dataContorl stringToHexData:readString]; + [[Socketsingleton sharedInstance] soketWriteData:readData]; + [_indicatorView startAnimating]; + +} #pragma mark - 加热棒处理 - - (void)sureBtnClick:(UIButton *)btn { NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString); diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoElectricityController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoElectricityController.m index 237ba51..c3159fa 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoElectricityController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuanduoElectricityController.m @@ -159,6 +159,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell"; self.tableView.delegate=self; self.tableView.dataSource=self; self.tableView.backgroundColor=COLOR_MIAN; + self.tableView.layer.cornerRadius=8; + ElectricityView*header=[ElectricityView viewFromXib]; self.tableView.tableHeaderView=header; self.headerView=header;