打开和关闭一键 喂鱼
This commit is contained in:
parent
d00aff3ccd
commit
fa81a11902
|
|
@ -30,6 +30,7 @@
|
||||||
#import "UIImage+WaterMark.h"
|
#import "UIImage+WaterMark.h"
|
||||||
#import "XuanduoSettingController.h"
|
#import "XuanduoSettingController.h"
|
||||||
#import "XuanduoElectricityController.h"
|
#import "XuanduoElectricityController.h"
|
||||||
|
#import "XuanduofishFeedViewController.h"
|
||||||
|
|
||||||
#define kBtnTag 100
|
#define kBtnTag 100
|
||||||
|
|
||||||
|
|
@ -72,6 +73,7 @@
|
||||||
@property(nonatomic,assign) NSInteger heartCount;
|
@property(nonatomic,assign) NSInteger heartCount;
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet UILabel *waterLever;
|
@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]}];
|
uvsel=[uvsel imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
|
||||||
// [self.light1 setImage:uvsel forState:UIControlStateSelected];
|
// [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
|
else
|
||||||
|
|
@ -444,6 +495,10 @@
|
||||||
[self readCycleWithNumber:@"03"];
|
[self readCycleWithNumber:@"03"];
|
||||||
self.heartCount=0;
|
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])//一键喂鱼
|
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"];
|
[self readFishFeedModel];//先读取
|
||||||
|
|
||||||
NSData*readData=[dataContorl stringToHexData:readString];
|
|
||||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
|
||||||
|
|
||||||
[_indicatorView startAnimating];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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 {
|
- (IBAction)btnActions:(UIButton *)btn {
|
||||||
if (self.dataModel.gasPump) {
|
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 - 加热棒处理 -
|
#pragma mark - 加热棒处理 -
|
||||||
- (void)sureBtnClick:(UIButton *)btn {
|
- (void)sureBtnClick:(UIButton *)btn {
|
||||||
NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString);
|
NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString);
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||||
self.tableView.delegate=self;
|
self.tableView.delegate=self;
|
||||||
self.tableView.dataSource=self;
|
self.tableView.dataSource=self;
|
||||||
self.tableView.backgroundColor=COLOR_MIAN;
|
self.tableView.backgroundColor=COLOR_MIAN;
|
||||||
|
self.tableView.layer.cornerRadius=8;
|
||||||
|
|
||||||
ElectricityView*header=[ElectricityView viewFromXib];
|
ElectricityView*header=[ElectricityView viewFromXib];
|
||||||
self.tableView.tableHeaderView=header;
|
self.tableView.tableHeaderView=header;
|
||||||
self.headerView=header;
|
self.headerView=header;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue