一键喂鱼
This commit is contained in:
+3
-1
@@ -39,11 +39,13 @@
|
||||
<constraint firstAttribute="width" constant="30" id="wt7-Qr-eyY"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UKV-VP-KnJ" userLabel="statusBtn">
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UKV-VP-KnJ" userLabel="statusBtn">
|
||||
<rect key="frame" x="154" y="2" width="67" height="31"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" title="Button"/>
|
||||
<buttonConfiguration key="configuration" style="plain" title="关闭">
|
||||
<backgroundConfiguration key="background"/>
|
||||
<fontDescription key="titleFontDescription" type="system" pointSize="15"/>
|
||||
</buttonConfiguration>
|
||||
</button>
|
||||
|
||||
+44
-21
@@ -602,7 +602,10 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
NSLog(@"read str = %@",readString);
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
;
|
||||
if (self.timerType==3)
|
||||
{
|
||||
[self readAllDayRecoveryMode];
|
||||
}
|
||||
}
|
||||
else if ([group isKindOfClass: [XuanduoCycleModel class] ])
|
||||
{
|
||||
@@ -644,8 +647,7 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
//全天自恢复
|
||||
- (void)allDayModesSwitchAction:(UIButton *)btn {
|
||||
|
||||
UIAlertController*alert=[UIAlertController alertControllerWithTitle:@"提示" message:@"确认开启全天自恢复模式吗?开启此模式后,当手动关闭该设备时,10分钟后该设备将自动打开" preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction*okaction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
void(^switchModeBlock)(void)=^(void){
|
||||
btn.selected=!btn.selected;
|
||||
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
|
||||
timerModel.sendmacId =self.currentdevice.macAddress;
|
||||
@@ -663,24 +665,13 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str];
|
||||
NSData*selctorData=[dataContorl stringToHexData:selectorString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:selctorData];
|
||||
[self readAllDayRecoveryMode];
|
||||
[self readTimer];
|
||||
|
||||
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
|
||||
|
||||
readModel.functionCode=@"16";
|
||||
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
readModel.selectorNumber=[self.lightNumber stringByReplacingOccurrencesOfString:@"d" withString:@"f"];
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
[_indicatorView startAnimating];
|
||||
|
||||
};
|
||||
UIAlertController*alert=[UIAlertController alertControllerWithTitle:@"提示" message:@"确认开启全天自恢复模式吗?开启此模式后,当手动关闭该设备时,10分钟后该设备将自动打开" preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction*okaction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
switchModeBlock();
|
||||
}];
|
||||
UIAlertAction*cancelAction=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
@@ -688,7 +679,15 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
[alert addAction:okaction];
|
||||
[alert addAction:cancelAction];
|
||||
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
if (!btn.selected)//打开需确认
|
||||
{
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
else//关闭不需要
|
||||
{
|
||||
switchModeBlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1679,6 +1678,11 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
}
|
||||
|
||||
-(void)ifishDeviceLogInSuccees{
|
||||
[self readTimer];//读取定时器
|
||||
}
|
||||
|
||||
-(void)readTimer
|
||||
{
|
||||
|
||||
//读取具体开关定时
|
||||
ReadTimerModel*readModel=self.readMode;
|
||||
@@ -1694,6 +1698,25 @@ static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
}
|
||||
|
||||
}
|
||||
-(void)readAllDayRecoveryMode
|
||||
{
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
|
||||
|
||||
readModel.functionCode=@"16";
|
||||
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
readModel.selectorNumber=[self.lightNumber stringByReplacingOccurrencesOfString:@"d" withString:@"f"];
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
[_indicatorView startAnimating];
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)ifishSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket{
|
||||
|
||||
|
||||
+230
-242
@@ -236,6 +236,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
cell.icon.hidden=NO;
|
||||
cell.icon.image=[UIImage imageNamed:@"喂鱼"];
|
||||
cell.titileLabelLayout.constant=40;
|
||||
cell.tempLabelLayout.constant=(kScreenWidth-38)/2.0-65-19;
|
||||
cell.temperaturelabel.textAlignment=NSTextAlignmentCenter;
|
||||
if (self.dataModel) {
|
||||
Xuanduo2Model*model=self.dataModel;
|
||||
if ([model.alarmSwitch isEqualToString:@"01"]) {
|
||||
@@ -414,13 +416,10 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
}
|
||||
}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;
|
||||
}
|
||||
return 0;
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
@@ -466,14 +465,79 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
headerView.statusBtn.tag = kBtnTag + section;
|
||||
[headerView.controlBtn setImage:[UIImage imageNamed:@"normalImage"] forState:UIControlStateNormal];
|
||||
[headerView.controlBtn setImage:[UIImage imageNamed:@"selectedImage"] forState:UIControlStateNormal];
|
||||
[headerView.controlBtn setImage:[UIImage imageNamed:@"selectedImage"] forState:UIControlStateSelected];
|
||||
|
||||
[headerView.statusBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
|
||||
[headerView.statusBtn setTitleColor:[UIColor grayColor] forState:UIControlStateSelected];
|
||||
[headerView.statusBtn setBackgroundColor:[UIColor whiteColor]];
|
||||
|
||||
|
||||
|
||||
headerView.statusBtn.hidden=NO;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
}
|
||||
|
||||
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[headerView.controlBtn addTarget:self action:@selector(statusChangeAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[headerView.statusBtn addTarget:self action:@selector(statusChangeAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
NSInteger location=0;
|
||||
|
||||
switch (section - 2) {
|
||||
case 0: //循环泵
|
||||
{
|
||||
location = 3;
|
||||
|
||||
}
|
||||
break;
|
||||
case 1: //增氧
|
||||
{
|
||||
location = 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 2: //灯光1
|
||||
{
|
||||
location=1;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 3: //灯光2
|
||||
{
|
||||
location = 2;
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
location=5;
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
location=4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
NSString*choose=[dataContorl getBinaryByHex:self.fishFeedModel.lightChooseStatus location:location];
|
||||
NSString*open=[dataContorl getBinaryByHex:self.fishFeedModel.lightOpenStatus location:location];
|
||||
if ([open isEqualToString:@"1"])
|
||||
{
|
||||
headerView.statusBtn.selected=YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
headerView.statusBtn.selected=NO;
|
||||
}
|
||||
if ([choose isEqualToString:@"1"])
|
||||
{
|
||||
headerView.controlBtn.selected=YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
headerView.controlBtn.selected=NO;
|
||||
}
|
||||
|
||||
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
|
||||
return headerView;
|
||||
}
|
||||
@@ -487,10 +551,9 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
_indexPath = indexPath;
|
||||
if (indexPath.section==0&&indexPath.row==0){
|
||||
//换水提醒日期选择
|
||||
_remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:self.currentdevice.type];
|
||||
_remindPic.type=@"temp";
|
||||
_remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:@"feed"];
|
||||
|
||||
_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];
|
||||
@@ -535,121 +598,143 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
#pragma mark - cell的折叠
|
||||
//添加或者去除一键喂鱼的关联
|
||||
- (void)foldAction:(UIButton *)btn {
|
||||
|
||||
_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)
|
||||
|
||||
_selectSection = btn.tag - kBtnTag;
|
||||
btn.selected=!btn.selected;
|
||||
NSInteger section= _selectSection;
|
||||
NSInteger location=0;
|
||||
|
||||
switch (section - 2) {
|
||||
case 0: //循环泵
|
||||
{
|
||||
readModel.functionCode=@"19";//读取
|
||||
location = 3;
|
||||
|
||||
}
|
||||
else
|
||||
break;
|
||||
case 1: //增氧
|
||||
{
|
||||
readModel.functionCode=@"16";
|
||||
location = 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
switch (_selectSection - 2) {
|
||||
case 0: //循环泵 或 照明
|
||||
readModel.selectorNumber = @"04";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
readModel.selectorNumber=@"01";
|
||||
}
|
||||
break;
|
||||
case 1: //增氧
|
||||
readModel.selectorNumber = @"01";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
readModel.selectorNumber=@"02";
|
||||
}
|
||||
break;
|
||||
case 2: //灯光1
|
||||
readModel.selectorNumber = @"02";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
readModel.selectorNumber=@"03";
|
||||
}
|
||||
break;
|
||||
case 3: //灯光2
|
||||
readModel.selectorNumber = @"03";
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
readModel.selectorNumber = @"06";
|
||||
break;
|
||||
case 5: // 杀菌灯
|
||||
readModel.selectorNumber = @"05";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
case 2: //灯光1
|
||||
{
|
||||
location=1;
|
||||
|
||||
|
||||
}
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
self.readMode=readModel;
|
||||
[_indicatorView startAnimating];
|
||||
break;
|
||||
case 3: //灯光2
|
||||
{
|
||||
location = 2;
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
location=5;
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
location=4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
NSString*binaryLightChooseStatus=[dataContorl getBinaryByHex:self.fishFeedModel.lightChooseStatus];
|
||||
|
||||
binaryLightChooseStatus =[binaryLightChooseStatus stringByReplacingCharactersInRange:NSMakeRange(location, 1) withString:btn.selected?@"1":@"0"];
|
||||
NSString*hexLightChooseStatus=[dataContorl getHexByBinary:binaryLightChooseStatus];
|
||||
self.fishFeedModel.lightChooseStatus=hexLightChooseStatus;
|
||||
baseModel*readModel=[[baseModel alloc]init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId =self.currentdevice.macAddress;
|
||||
readModel.functionCode=@"15";
|
||||
readModel.massagelegth=@"18";
|
||||
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@%@%@",readModel.description,@"09",self.fishFeedModel.feedTime,self.fishFeedModel.lightChooseStatus,self.fishFeedModel.lightOpenStatus,@"000000",@"0000"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
[_indicatorView startAnimating];
|
||||
[self readFishFeedModel];
|
||||
|
||||
}
|
||||
//改变一键喂鱼的开关状态
|
||||
-(void)statusChangeAction:(UIButton*)btn
|
||||
{
|
||||
|
||||
_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)
|
||||
|
||||
_selectSection = btn.tag - kBtnTag;
|
||||
btn.selected=!btn.selected;
|
||||
NSInteger section= _selectSection;
|
||||
NSInteger location=0;
|
||||
|
||||
switch (section - 2) {
|
||||
case 0: //循环泵
|
||||
{
|
||||
readModel.functionCode=@"19";//读取
|
||||
location = 3;
|
||||
|
||||
}
|
||||
else
|
||||
break;
|
||||
case 1: //增氧
|
||||
{
|
||||
readModel.functionCode=@"16";
|
||||
location = 0;
|
||||
|
||||
|
||||
|
||||
}
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
switch (_selectSection - 2) {
|
||||
case 0: //循环泵 或 照明
|
||||
readModel.selectorNumber = @"04";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
readModel.selectorNumber=@"01";
|
||||
}
|
||||
break;
|
||||
case 1: //增氧
|
||||
readModel.selectorNumber = @"01";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
readModel.selectorNumber=@"02";
|
||||
}
|
||||
break;
|
||||
case 2: //灯光1
|
||||
readModel.selectorNumber = @"02";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
readModel.selectorNumber=@"03";
|
||||
}
|
||||
break;
|
||||
case 3: //灯光2
|
||||
readModel.selectorNumber = @"03";
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
readModel.selectorNumber = @"06";
|
||||
break;
|
||||
case 5: // 杀菌灯
|
||||
readModel.selectorNumber = @"05";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
case 2: //灯光1
|
||||
{
|
||||
location=1;
|
||||
|
||||
|
||||
}
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
self.readMode=readModel;
|
||||
[_indicatorView startAnimating];
|
||||
break;
|
||||
case 3: //灯光2
|
||||
{
|
||||
location = 2;
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
location=5;
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
location=4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
NSString*binaryLightOpenStatus=[dataContorl getBinaryByHex:self.fishFeedModel.lightOpenStatus];
|
||||
|
||||
binaryLightOpenStatus =[binaryLightOpenStatus stringByReplacingCharactersInRange:NSMakeRange(location, 1) withString:btn.selected?@"1":@"0"];
|
||||
NSString*hexBinaryLightOpenStatus=[dataContorl getHexByBinary:binaryLightOpenStatus];
|
||||
self.fishFeedModel.lightOpenStatus=hexBinaryLightOpenStatus;
|
||||
baseModel*readModel=[[baseModel alloc]init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId =self.currentdevice.macAddress;
|
||||
readModel.functionCode=@"15";
|
||||
readModel.massagelegth=@"18";
|
||||
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@%@%@",readModel.description,@"09",self.fishFeedModel.feedTime,self.fishFeedModel.lightChooseStatus,self.fishFeedModel.lightOpenStatus,@"000000",@"0000"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
[_indicatorView startAnimating];
|
||||
[self readFishFeedModel];
|
||||
|
||||
}
|
||||
|
||||
@@ -1189,13 +1274,12 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
#pragma mark 默认换水时间
|
||||
-(void)huanShuiMainQueue{
|
||||
|
||||
if (_indexPath.section-2==_titieArr.count)
|
||||
if ([_remindPic.type isEqualToString:@"feed"])
|
||||
{
|
||||
Xuanduo3fModel*model3=self.dataModel;
|
||||
int mac=[dataContorl hexToTen:model3.heatingTemperature];
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
NSInteger temp = mac/10.0;
|
||||
int temp=[dataContorl hexToTen:self.fishFeedModel.feedTime];
|
||||
|
||||
|
||||
if (temp<1)
|
||||
{
|
||||
temp=1;
|
||||
@@ -1254,140 +1338,41 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
-(void)xuToremindCyclePicDone{
|
||||
|
||||
if (_indexPath.section==1) {
|
||||
ChangeWaterCell*cell=[self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
NSString *str=_remindPic.picViewResultString;
|
||||
if (str==nil) {
|
||||
//str=@"1";
|
||||
|
||||
NSLog(@"ni hua dong tai kuai");
|
||||
|
||||
str=[NSString stringWithFormat:@"%ld",(long)self.waterInfmodel.remindcycle];
|
||||
NSString*title=@"请设置换水天数";
|
||||
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
title=@"请设置杀菌天数";
|
||||
}
|
||||
[_remindPic makeToast:title];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%@天",str];
|
||||
//设置换水日期
|
||||
[IFISHHTTPTOOL setRemindWaterInfWith:[NSString stringWithFormat:@"%@_%@",self.currentdevice.deviceId,self.currentdevice.type]
|
||||
waterRemind:@"1" remindCycle:str
|
||||
huishuiShiJian:^(setRemindWaterModel *remindModel) {
|
||||
|
||||
self.nextChangeDateLabel=remindModel.remindDate;
|
||||
self.waterInfmodel.waterremind=@"1";
|
||||
self.waterInfmodel.remindDate=remindModel.remindDate;
|
||||
self.waterInfmodel.remindcycle = remindModel.remindcycle;
|
||||
[self.tableView reloadData];
|
||||
}];
|
||||
NSUserDefaults*defuat=[NSUserDefaults standardUserDefaults];
|
||||
[defuat setValue:str forKey:@"xuto2picResult"];
|
||||
[defuat synchronize];
|
||||
[_remindPic removeFromSuperview];
|
||||
|
||||
}
|
||||
else if (_indexPath.section-2==_titieArr.count)
|
||||
|
||||
{
|
||||
TemperatureSetCell*cell=[self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
NSString *str=_remindPic.picViewResultString;
|
||||
if (str==nil) {
|
||||
//str=@"1";
|
||||
|
||||
NSLog(@"ni hua dong tai kuai");
|
||||
|
||||
str=[NSString stringWithFormat:@"%ld",(long)self.waterInfmodel.remindcycle];
|
||||
NSString*title=@"请设置换水天数";
|
||||
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
title=@"请设置杀菌天数";
|
||||
}
|
||||
NSString*title=@"请喂鱼时间";
|
||||
|
||||
[_remindPic makeToast:title];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cell.temperaturelabel.text=[NSString stringWithFormat:@"%.1f℃",str.floatValue];
|
||||
//设置换水日期
|
||||
;
|
||||
self.fishFeedModel.feedTime=[dataContorl leftAddZero:2 andStr:[dataContorl ToHex:str.integerValue]];
|
||||
[_remindPic removeFromSuperview];
|
||||
baseModel*tempModel=[[baseModel alloc]init];
|
||||
tempModel.sendmacId =self.currentdevice.macAddress;
|
||||
tempModel.resavemacId =self.currentdevice.macAddress;
|
||||
tempModel.functionCode=@"0e";
|
||||
tempModel.massagelegth=@"13";
|
||||
|
||||
cell.temperaturelabel.text=[NSString stringWithFormat:@"%ld分钟",(self.fishFeedModel?[dataContorl hexToTen:self.fishFeedModel.feedTime]:0)];
|
||||
|
||||
|
||||
int intString = [str intValue];
|
||||
int newIntString=intString*10;
|
||||
|
||||
NSString*temp =[dataContorl tpIntStringToFourHex:newIntString];
|
||||
NSString*minString=[NSString stringWithFormat:@"%@%@%@",tempModel.description,temp,@"0000"];
|
||||
NSLog(@"minstring = %@",minString);
|
||||
NSData*tempData=[dataContorl stringToHexData:minString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:tempData];
|
||||
|
||||
|
||||
}
|
||||
else if ([_remindPic.type isEqualToString:@"cycle"])
|
||||
{
|
||||
SetTimerCell*cell=[self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
NSString *str=_remindPic.picViewResultString;
|
||||
if (str==nil) {
|
||||
//str=@"1";
|
||||
|
||||
NSLog(@"ni hua dong tai kuai");
|
||||
|
||||
str=[NSString stringWithFormat:@"%ld",(long)self.waterInfmodel.remindcycle];
|
||||
|
||||
[_remindPic makeToast:@"请设置杀菌持续时间"];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cell.timerLabel.text=[NSString stringWithFormat:@"%d分钟",str.intValue];
|
||||
//设置换水日期
|
||||
;
|
||||
[_remindPic removeFromSuperview];
|
||||
baseModel*tempModel=[[baseModel alloc]init];
|
||||
tempModel.sendmacId =self.currentdevice.macAddress;
|
||||
tempModel.resavemacId =self.currentdevice.macAddress;
|
||||
tempModel.functionCode=@"18";
|
||||
tempModel.massagelegth=@"17";
|
||||
|
||||
|
||||
|
||||
int intString = [str intValue];
|
||||
|
||||
NSString*hex=[dataContorl ToHex:intString];
|
||||
NSString*temp =[dataContorl leftAddZero:4 andStr:hex];
|
||||
_cycleModel.lastTime=temp;
|
||||
NSString*minString=[NSString stringWithFormat:@"%@%@%@%@%@%@",tempModel.description,_cycleModel.lightNumber,_cycleModel.lastTime,_cycleModel.gapTime,_cycleModel.status,@"0000"];
|
||||
NSLog(@"minstring = %@",minString);
|
||||
NSData*tempData=[dataContorl stringToHexData:minString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:tempData];
|
||||
|
||||
|
||||
baseModel*readModel=[[baseModel alloc]init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId =self.currentdevice.macAddress;
|
||||
readModel.functionCode=@"19";
|
||||
readModel.massagelegth=@"12";
|
||||
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@%@",readModel.description,_cycleModel.lightNumber,@"0000"];
|
||||
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId =self.currentdevice.macAddress;
|
||||
readModel.functionCode=@"15";
|
||||
readModel.massagelegth=@"18";
|
||||
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@%@%@",readModel.description,@"09",self.fishFeedModel.feedTime,self.fishFeedModel.lightChooseStatus,self.fishFeedModel.lightOpenStatus,@"000000",@"0000"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
|
||||
;
|
||||
[self readFishFeedModel];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 开启关闭报警
|
||||
@@ -1580,8 +1565,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
{
|
||||
XuanduoFishFeedModel*fishFeedModel=[[XuanduoFishFeedModel alloc]init];
|
||||
fishFeedModel.feedTime=[string1 substringWithRange:NSMakeRange(32, 2)];
|
||||
fishFeedModel.lightChooseStatus=[string1 substringWithRange:NSMakeRange(34, 1)];
|
||||
fishFeedModel.lightOpenStatus=[string1 substringWithRange:NSMakeRange(35, 1)];
|
||||
fishFeedModel.lightChooseStatus=[string1 substringWithRange:NSMakeRange(34, 2)];
|
||||
fishFeedModel.lightOpenStatus=[string1 substringWithRange:NSMakeRange(36, 2)];
|
||||
|
||||
self.fishFeedModel=fishFeedModel;
|
||||
|
||||
@@ -1590,12 +1575,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
}
|
||||
else if (_selectSection-2<_titieArr.count && _selectSection-2>=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]];
|
||||
[dataArr removeAllObjects];
|
||||
|
||||
[dataArr addObject:_cycleModel];
|
||||
|
||||
|
||||
|
||||
@@ -1616,6 +1596,15 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
-(void)ifishDeviceLogInSuccees{
|
||||
|
||||
[self readFishFeedModel];
|
||||
|
||||
}
|
||||
-(void)readFishFeedModel
|
||||
{
|
||||
if (!self.fishFeedModel)
|
||||
{
|
||||
self.fishFeedModel=[[XuanduoFishFeedModel alloc]init];
|
||||
}
|
||||
//读取一键喂鱼状态
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
@@ -1629,8 +1618,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
[_indicatorView startAnimating];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)ifishSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket{
|
||||
|
||||
Reference in New Issue
Block a user