测试修改
This commit is contained in:
+3
-1
@@ -13,9 +13,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface SetTimerCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton *switchBtn;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timerLabel;
|
||||
|
||||
- (void)configTitleLabel:(NSString *)title timer:(NSString *)timeStr switchStatus:(BOOL)status;
|
||||
|
||||
@property (nonatomic, strong) id model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@
|
||||
#import "SetTimerCell.h"
|
||||
|
||||
@interface SetTimerCell ()
|
||||
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timerLabel;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+(void)readTimerSocketDataWithBackMsgModel:(Xuanduo2TimerModel*)xuanduoTimerModel addWithBackStr:(NSString*)dataStr type:(NSString*)type;
|
||||
|
||||
+(void)resetNewXuanduoButtonState:(UIButton*)uvLightBtn gasPumpLight:(UIButton*)gasLightBtn light1:(UIButton*)light1Btn light2:(UIButton*)light2Btn waveLight:(UIButton*)waveLightBtn huliLight:(UIButton*)huliLightBtn waterLight:(UIButton*)waterLightBtn heatLight:(UIButton*)heatLightBtn withModel:(id)backModel type:(NSString*)type;
|
||||
+(void)readCycleSocketDataWithBackMsgModel:(XuanduoCycleModel*)xuanduoTimerModel addWithBackStr:(NSString*)dataStr type:(nonnull NSString *)type;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
+29
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "Xuanduo2DataUtility.h"
|
||||
#import "UIImage+WaterMark.h"
|
||||
|
||||
|
||||
@implementation Xuanduo2DataUtility
|
||||
@@ -147,6 +148,7 @@
|
||||
waterLightBtn.selected = NO;
|
||||
}
|
||||
// 恒温
|
||||
|
||||
NSString *stateString4 = [backModel.constTmep substringWithRange:NSMakeRange(2, 2)];
|
||||
if ([stateString4 isEqualToString:@"01"]) {
|
||||
light2Btn.selected = YES;
|
||||
@@ -154,6 +156,21 @@
|
||||
light2Btn.selected = NO;
|
||||
}
|
||||
|
||||
UInt64 mac=[dataContorl hexToTen:backModel.heatingTemperature];
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
float temp = mac/10.0;
|
||||
NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp];
|
||||
UIImage*imageTempNomal=[UIImage imageNamed:@"恒温关"];
|
||||
imageTempNomal=[imageTempNomal imageWaterMarkWithString:stringTemp rect:CGRectMake(130, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
|
||||
[light2Btn setImage:imageTempNomal forState:UIControlStateNormal];
|
||||
|
||||
UIImage*imageTempsel=[UIImage imageNamed:@"恒温开"];
|
||||
imageTempsel=[imageTempNomal imageWaterMarkWithString:stringTemp rect:CGRectMake(130, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
|
||||
[light2Btn setImage:imageTempsel forState:UIControlStateSelected];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -179,5 +196,17 @@
|
||||
group.time = [NSString stringWithFormat:@"%@ - %@",startStr,endStr];
|
||||
[xuanduoTimerModel.groupModelArr addObject:group];
|
||||
}
|
||||
}
|
||||
|
||||
+(void)readCycleSocketDataWithBackMsgModel:(XuanduoCycleModel*)xuanduocycleModel addWithBackStr:(NSString*)dataStr type:(nonnull NSString *)type
|
||||
|
||||
{
|
||||
xuanduocycleModel.lightNumber = [dataStr substringWithRange:NSMakeRange(30, 2)];
|
||||
xuanduocycleModel.lastTime = [dataStr substringWithRange:NSMakeRange(32, 4)];
|
||||
xuanduocycleModel.gapTime = [dataStr substringWithRange:NSMakeRange(36, 4)];
|
||||
xuanduocycleModel.status = [dataStr substringWithRange:NSMakeRange(40, 2)];
|
||||
|
||||
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
+264
-91
@@ -39,6 +39,8 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
@interface Xuanduo2SettingController ()<IfishCommuniteDelegate>
|
||||
@property(nonatomic,strong) setRemindWaterModel *waterInfmodel;
|
||||
@property(nonatomic,strong) Xuanduo2TimerModel *timerModel;
|
||||
@property(nonatomic,strong) XuanduoCycleModel *cycleModel;
|
||||
|
||||
@property (nonatomic,strong) NSMutableDictionary *timeDic;
|
||||
@property(nonatomic,copy) NSString *nextChangeDateLabel;
|
||||
@property(nonatomic,strong) MyHud *XuTohud;
|
||||
@@ -131,7 +133,11 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
_selectSection = -1;
|
||||
for (int i = 0; i<_titieArr.count; i++) {
|
||||
NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0];
|
||||
[dataArr addObject:plusflag];
|
||||
if (![_titieArr[i] isEqualToString:@"杀菌"])
|
||||
{
|
||||
[dataArr addObject:plusflag];
|
||||
}
|
||||
|
||||
[self.timeDic setObject:dataArr forKey:_titieArr[i]];
|
||||
}
|
||||
self.tableView.backgroundColor=COLOR_MIAN;
|
||||
@@ -223,9 +229,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
}else{
|
||||
|
||||
cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%ld天",(long)self.waterInfmodel.remindcycle];
|
||||
NSLog(@"ce;;%@",cell.huanshuiDaylabel.text);
|
||||
|
||||
NSLog(@"222");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -273,13 +277,18 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
TemperatureSetModel *model=[[TemperatureSetModel alloc]init];
|
||||
model.title = @"恒温设置";
|
||||
cell.titleLabel.text = model.title;
|
||||
NSLog(@"wendu str = %@",_wenduString);
|
||||
model.temperatureLabel = _wenduString;
|
||||
|
||||
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.temperature];
|
||||
int mac=[dataContorl hexToTen:model3.heatingTemperature];
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
float temp = mac/10.0;
|
||||
@@ -307,12 +316,31 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
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];
|
||||
BOOL isOn = NO;
|
||||
if ([group.status isEqualToString:@"01"]) {
|
||||
isOn = YES;
|
||||
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;
|
||||
|
||||
}
|
||||
[cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
@@ -462,7 +490,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
|
||||
}else if (indexPath.section==1){
|
||||
//换水提醒日期选择
|
||||
_remindPic=[[remindCyclePic alloc]init];
|
||||
_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;
|
||||
@@ -479,11 +507,27 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
[_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self huanShuiMainQueue];
|
||||
}else {
|
||||
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
SetTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
if ([cell isKindOfClass:[PlusTableViewCell class]]) {
|
||||
return;
|
||||
}
|
||||
[self addTimer:nil];
|
||||
else if([cell isKindOfClass:[SetTimerCell class]]&&[cell.model isKindOfClass:[XuanduoCycleModel class]])
|
||||
{
|
||||
//恒温设置
|
||||
_cycleModel=cell.model;
|
||||
_remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:@"cycle"];
|
||||
_remindPic.type=@"cycle";
|
||||
|
||||
_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
|
||||
{
|
||||
[self addTimer:nil];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,6 +574,15 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
}else {
|
||||
_selectSection = btn.tag - kBtnTag;
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
//杀菌不定时
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]&&(_selectSection - 2)==2)
|
||||
{
|
||||
readModel.functionCode=@"19";//读取
|
||||
}
|
||||
else
|
||||
{
|
||||
readModel.functionCode=@"16";
|
||||
}
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
@@ -584,82 +637,120 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
timerModel.resavemacId = self.currentdevice.macAddress;
|
||||
timerModel.crc16str=@"0000";
|
||||
XuanduoTimerGroup *group = [dataArr objectAtIndex:(havePlus?index+1:index)];
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:group.startTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:group.endTime];
|
||||
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2];
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];
|
||||
if ([group.status isEqualToString:@"01"]) {
|
||||
timerModel.isOn = @"00";
|
||||
}else {
|
||||
timerModel.isOn = @"01";
|
||||
}
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
switch (_selectSection - 2) {
|
||||
case 0: //循环泵
|
||||
{
|
||||
timerModel.selectorNumber = @"04";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
timerModel.selectorNumber=@"01";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1: //增氧
|
||||
{
|
||||
timerModel.selectorNumber = @"01";
|
||||
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
timerModel.selectorNumber=@"02";
|
||||
}
|
||||
if ([group isKindOfClass: [XuanduoTimerGroup class] ]) {
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:group.startTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:group.endTime];
|
||||
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2];
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];
|
||||
if ([group.status isEqualToString:@"01"]) {
|
||||
timerModel.isOn = @"00";
|
||||
}else {
|
||||
timerModel.isOn = @"01";
|
||||
}
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
switch (_selectSection - 2) {
|
||||
case 0: //循环泵
|
||||
{
|
||||
timerModel.selectorNumber = @"04";
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
timerModel.selectorNumber=@"01";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1: //增氧
|
||||
{
|
||||
timerModel.selectorNumber = @"01";
|
||||
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
timerModel.selectorNumber=@"02";
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case 2: //灯光1
|
||||
{
|
||||
timerModel.selectorNumber = @"02";
|
||||
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
timerModel.selectorNumber=@"03";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: //灯光1
|
||||
{
|
||||
timerModel.selectorNumber = @"02";
|
||||
|
||||
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
timerModel.selectorNumber=@"03";
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case 3: //灯光2
|
||||
{
|
||||
timerModel.selectorNumber = @"03";
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
timerModel.selectorNumber = @"06";
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
timerModel.selectorNumber = @"05";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3: //灯光2
|
||||
{
|
||||
timerModel.selectorNumber = @"03";
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
timerModel.selectorNumber = @"06";
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
timerModel.selectorNumber = @"05";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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];
|
||||
[_indicatorView startAnimating];
|
||||
|
||||
readModel.selectorNumber = timerModel.selectorNumber;
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSLog(@"read str = %@",readString);
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
[_indicatorView startAnimating];
|
||||
}
|
||||
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];
|
||||
[_indicatorView startAnimating];
|
||||
|
||||
readModel.selectorNumber = timerModel.selectorNumber;
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSLog(@"read str = %@",readString);
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
[_indicatorView startAnimating];
|
||||
else if ([group isKindOfClass: [XuanduoCycleModel class] ])
|
||||
{
|
||||
baseModel*tempModel=[[baseModel alloc]init];
|
||||
tempModel.sendmacId =self.currentdevice.macAddress;
|
||||
tempModel.resavemacId =self.currentdevice.macAddress;
|
||||
tempModel.functionCode=@"18";
|
||||
tempModel.massagelegth=@"17";
|
||||
|
||||
|
||||
|
||||
if ([_cycleModel.status isEqualToString:@"01"]) {
|
||||
_cycleModel.status = @"00";
|
||||
}else {
|
||||
_cycleModel.status = @"01";
|
||||
}
|
||||
|
||||
|
||||
NSString*minString=[NSString stringWithFormat:@"%@%@%@%@%@%@",tempModel.description,_cycleModel.lightNumber,_cycleModel.lastTime,_cycleModel.gapTime,_cycleModel.status,@"0000"];
|
||||
|
||||
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"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)addTimer:(UIButton *)btn {
|
||||
@@ -1056,7 +1147,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
if (_indexPath.section-2==_titieArr.count)
|
||||
{
|
||||
Xuanduo3fModel*model3=self.dataModel;
|
||||
int mac=[dataContorl hexToTen:model3.temperature];
|
||||
int mac=[dataContorl hexToTen:model3.heatingTemperature];
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
NSInteger temp = mac/10.0;
|
||||
@@ -1068,6 +1159,21 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
|
||||
return;
|
||||
}
|
||||
else if ([_remindPic.type isEqualToString:@"cycle"])
|
||||
{
|
||||
|
||||
int mac=[dataContorl hexToTen:_cycleModel.lastTime];
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
NSInteger temp = mac;
|
||||
if (temp<1)
|
||||
{
|
||||
temp=1;
|
||||
}
|
||||
[_remindPic.pic selectRow:temp-1 inComponent:0 animated:NO];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else if (_remindPic.picViewResultString !=nil || (_remindPic.picViewResultString ==nil && self.waterInfmodel.remindcycle !=0 )) {
|
||||
NSArray*shijianArr=[_remindPic.picArr objectAtIndex:0];
|
||||
@@ -1167,7 +1273,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
baseModel*tempModel=[[baseModel alloc]init];
|
||||
tempModel.sendmacId =self.currentdevice.macAddress;
|
||||
tempModel.resavemacId =self.currentdevice.macAddress;
|
||||
tempModel.functionCode=@"0E";
|
||||
tempModel.functionCode=@"14";
|
||||
tempModel.massagelegth=@"13";
|
||||
|
||||
|
||||
@@ -1176,12 +1282,65 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
int newIntString=intString*10;
|
||||
|
||||
NSString*temp =[dataContorl tpIntStringToFourHex:newIntString];
|
||||
NSString*minString=[NSString stringWithFormat:@"%@%@%%@",tempModel.description,temp,@"0000"];
|
||||
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*temp =[dataContorl tpIntStringToFourHex:intString];
|
||||
_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"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1392,6 +1551,20 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
[self.indicatorView stopAnimating];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
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];
|
||||
|
||||
|
||||
[self.XuTohud hidmyHud];
|
||||
[self.indicatorView stopAnimating];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
if ([readTimer isEqualToString:@"0108"] || [readTimer isEqualToString:@"0105"]) {
|
||||
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentdevice.type];
|
||||
[self refreshWithData:self.dataModel];
|
||||
|
||||
+10
@@ -43,6 +43,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, strong) NSMutableArray *groupModelArr;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@interface XuanduoCycleModel : NSObject
|
||||
|
||||
/// 灯的序号
|
||||
@property (nonatomic, strong) NSString *lightNumber;
|
||||
@property (nonatomic, strong) NSString *lastTime;
|
||||
@property (nonatomic, strong) NSString *gapTime;
|
||||
@property (nonatomic, strong) NSString *status;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
+5
@@ -15,3 +15,8 @@
|
||||
@implementation Xuanduo2TimerModel
|
||||
|
||||
@end
|
||||
|
||||
@implementation XuanduoCycleModel
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+60
-4
@@ -27,6 +27,7 @@
|
||||
#import "JHRefresh.h"
|
||||
#import "searchDeviceModel.h"
|
||||
#import "PetStoresViewController.h"
|
||||
#import "UIImage+WaterMark.h"
|
||||
|
||||
#define kBtnTag 100
|
||||
|
||||
@@ -65,6 +66,8 @@
|
||||
@property(nonatomic) BOOL isconnect;// socket 是否连接
|
||||
@property (weak, nonatomic) IBOutlet UIView *contentView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
|
||||
@property(nonatomic,strong) XuanduoCycleModel *cycleModel;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -254,13 +257,46 @@
|
||||
//[_HUD hide:YES];
|
||||
[self.XuTohud hidmyHud];
|
||||
[self endRefreshing];
|
||||
NSLog(@"123124124");
|
||||
|
||||
|
||||
NSString*string1=[dataContorl dataToHexString:data];
|
||||
NSLog(@"return str == %@",string1);
|
||||
NSString *readTimer = [string1 substringToIndex:4];
|
||||
|
||||
|
||||
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentDevice.type];
|
||||
|
||||
[self setTemperature];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ([readTimer isEqualToString:@"0119"])
|
||||
{
|
||||
|
||||
_cycleModel=[[XuanduoCycleModel alloc]init];
|
||||
[Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentDevice.type];
|
||||
if (_cycleModel.lastTime.length)
|
||||
{
|
||||
UInt64 mac1=[dataContorl hexToTen:_cycleModel.lastTime];
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
float temp1 = mac1/10.0;
|
||||
NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp1];
|
||||
UIImage*uvNomal=[UIImage imageNamed:@"杀菌关"];
|
||||
uvNomal=[uvNomal imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
|
||||
[self.light1 setImage:uvNomal forState:UIControlStateNormal];
|
||||
|
||||
UIImage*uvsel=[UIImage imageNamed:@"杀菌开"];
|
||||
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
|
||||
{
|
||||
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentDevice.type];
|
||||
[self setTemperature];
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (self.dataModel) {
|
||||
_offLineLabel.hidden = YES;
|
||||
@@ -268,6 +304,25 @@
|
||||
_offLineLabel.hidden = NO;
|
||||
}
|
||||
[Xuanduo2DataUtility resetNewXuanduoButtonState:self.uvLight gasPumpLight:self.gasPumpLight light1:self.light1 light2:self.light2 waveLight:self.waveLight huliLight:self.huliLight waterLight:self.waterLight heatLight:self.heatLight withModel:self.dataModel type:self.currentDevice.type];
|
||||
|
||||
//杀菌灯的状态
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)readCycleWithNumber:(NSString*)num
|
||||
{
|
||||
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,num,@"0000"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
|
||||
}
|
||||
|
||||
-(void)ifishDeviceLogInFail{
|
||||
@@ -276,6 +331,7 @@
|
||||
|
||||
-(void)ifishDeviceLogInSuccees{
|
||||
|
||||
[self readCycleWithNumber:@"03"];
|
||||
}
|
||||
|
||||
-(void)ifishSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket{
|
||||
|
||||
Reference in New Issue
Block a user