diff --git a/Ifish/Assets.xcassets/绚多设备/right.imageset/Contents.json b/Ifish/Assets.xcassets/绚多设备/right.imageset/Contents.json new file mode 100644 index 0000000..fa438e5 --- /dev/null +++ b/Ifish/Assets.xcassets/绚多设备/right.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "right@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ifish/Assets.xcassets/绚多设备/right.imageset/right@2x.png b/Ifish/Assets.xcassets/绚多设备/right.imageset/right@2x.png new file mode 100644 index 0000000..c6d18c5 Binary files /dev/null and b/Ifish/Assets.xcassets/绚多设备/right.imageset/right@2x.png differ diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h index 013c694..041410d 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h @@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN +(void)readSocketDataWithBackMsgModel:(Xuanduo2Model*)xuanduoModel addWithBackData:(NSData*)data; ++(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:(Xuanduo2Model*)backModel; @end NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m index b58c15d..da3d92f 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m @@ -29,4 +29,61 @@ xuanduoModel.maxTemp = [dataString substringWithRange:NSMakeRange(80, 4)]; } ++(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:(Xuanduo2Model*)backModel{ + // 杀菌灯 + NSString *stateString1 = [backModel.uvLamp substringWithRange:NSMakeRange(2, 2)]; + if ([stateString1 isEqualToString:@"01"]) { + uvLightBtn.selected = YES; + }else{ + uvLightBtn.selected = NO; + } + // 气泵 + NSString *stateString2 = [backModel.gasPump substringWithRange:NSMakeRange(2, 2)]; + if ([stateString2 isEqualToString:@"01"]) { + gasLightBtn.selected = YES; + }else{ + gasLightBtn.selected = NO; + } + // 灯1 + NSString *stateString3 = [backModel.light1 substringWithRange:NSMakeRange(2, 2)]; + if ([stateString3 isEqualToString:@"01"]) { + light1Btn.selected = YES; + }else{ + light1Btn.selected = NO; + } + // 灯2 + NSString *stateString4 = [backModel.light2 substringWithRange:NSMakeRange(2, 2)]; + if ([stateString4 isEqualToString:@"01"]) { + light2Btn.selected = YES; + }else{ + light2Btn.selected = NO; + } + // 造浪 + NSString *stateString5 = [backModel.waveMakingPump substringWithRange:NSMakeRange(2, 2)]; + if ([stateString5 isEqualToString:@"01"]) { + waveLightBtn.selected = YES; + }else{ + waveLightBtn.selected = NO; + } + // 护理灯 + NSString *stateString6 = backModel.huliLight; + if ([stateString6 isEqualToString:@"01"]) { + huliLightBtn.selected = YES; + }else{ + huliLightBtn.selected = NO; + } + NSString *stateString7 = [backModel.waterPump substringWithRange:NSMakeRange(2, 2)]; + if ([stateString7 isEqualToString:@"01"]) { + waveLightBtn.selected = YES; + }else{ + waveLightBtn.selected = NO; + } + NSString *stateString8 = backModel.heatStatus; + if ([stateString8 isEqualToString:@"01"]) { + heatLightBtn.selected = YES; + }else{ + heatLightBtn.selected = NO; + } +} + @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m index 8bbf873..47bd935 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m @@ -40,6 +40,14 @@ @property (weak, nonatomic) IBOutlet UILabel *tempLabel; @property (weak, nonatomic) IBOutlet UILabel *tipLabel; @property (nonatomic, strong) NSTimer *switchTimer; +@property (weak, nonatomic) IBOutlet UIButton *uvLight; +@property (weak, nonatomic) IBOutlet UIButton *gasPumpLight; +@property (weak, nonatomic) IBOutlet UIButton *light1; +@property (weak, nonatomic) IBOutlet UIButton *light2; +@property (weak, nonatomic) IBOutlet UIButton *waveLight; +@property (weak, nonatomic) IBOutlet UIButton *huliLight; +@property (weak, nonatomic) IBOutlet UIButton *waterLight; +@property (weak, nonatomic) IBOutlet UIButton *heatLight; @end @@ -60,7 +68,7 @@ - (void)setup{ self.title = self.currentDevice.showName; //右侧菜单 - UIImage *MyEquipmentImage = [UIImage imageNamed:@"ifishnav_dropview_list"]; + UIImage *MyEquipmentImage = [UIImage imageNamed:@"right"]; UIButton *rightPopButton = [UIButton buttonWithType:UIButtonTypeCustom]; [rightPopButton setImage:MyEquipmentImage forState:UIControlStateNormal]; rightPopButton.frame=CGRectMake(kScreenWidth-60,0,60,44); @@ -140,9 +148,11 @@ -(void)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock{ [Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data]; - if ([self.tipLabel.text isEqualToString:@"当月电量"]) { + if ([self.tipLabel.text isEqualToString:@"鱼缸温度"]) { [self setTemperature]; } + [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]; + } -(void)ifishDeviceLogInFail{ @@ -185,9 +195,20 @@ UInt64 mac = [dataContorl hexToTen:self.dataModel.electricity]; NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac]; [self.tempLabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]]; + if (!_switchTimer) { + _switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:_switchTimer forMode:NSRunLoopCommonModes]; + } } } +- (void)changeTemp { + self.tipLabel.text = @"鱼缸温度"; + [self setTemperature]; + [_switchTimer invalidate]; + _switchTimer = nil; +} + - (void)goBackAction{ [[Socketsingleton sharedInstance] cutOffSocket]; [[IfishDataUnity shareDataInstance] setAppTabRoot]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib index a3eb8be..9563727 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib @@ -14,15 +14,23 @@ + + + + + + + +