diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m index 3bf9d7f..6f89ec3 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m @@ -66,6 +66,8 @@ #import "RunSun84CHSetViewController.h" #import "HaveHotCoolWenDuPicview.h" #import "RuSunLightOrder.h" +#import "RuiMeiSetViewController.h" + //上部分视频封装 下部分分段控制器 封装 (下一步代码优化) @interface IfishP2PMonitorController () { @@ -103,6 +105,7 @@ @property(nonatomic,strong) KeLiAiSetViewController *keLiAiSetVc; @property(nonatomic,strong) RusunHaveHeateSetViewController *rusunSet; @property(nonatomic,strong) RunSun84CHSetViewController *rusun84Set; +@property (nonatomic, strong) RuiMeiSetViewController *ruimeiSet; @property(nonatomic,strong) DXPopover *popover; @property(nonatomic,strong) UIButton *rightPopButton; @property (nonatomic,strong) SetNameTextViewController *setNameVC; @@ -468,7 +471,7 @@ [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault]; UIButton*leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; leftBtn.frame = CGRectMake(0, 0, 47,44); - [leftBtn setBackgroundImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal]; + [leftBtn setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal]; [leftBtn addTarget: self action: @selector(btnClickToBack:) forControlEvents: UIControlEventTouchUpInside]; UIBarButtonItem * lbbItem=[[UIBarButtonItem alloc]initWithCustomView:leftBtn]; self.navigationItem.leftBarButtonItem=lbbItem; @@ -4002,6 +4005,19 @@ [self.navigationController pushViewController:_rusun84Set animated:YES]; + }else if ([dmodel.type isEqualToString:DECICE_TYPE_RUIMEI]){ + _ruimeiSet = [[RuiMeiSetViewController alloc] init]; + _ruimeiSet.currentdevice = dmodel; + NSString*stateString=[self.fishControlView.ruiMeiBack.customModel substringWithRange:NSMakeRange(2, 2)]; + if ([stateString isEqualToString:@"01"]) { + _ruimeiSet.customModeOn=YES; + }else{ + _ruimeiSet.customModeOn=NO; + } + usleep(50*1000); + [self.navigationController pushViewController:_ruimeiSet animated:YES]; + + }else if ([dmodel.type isEqualToString:DECICE_TYPE_JUNENGCC]){ @@ -4149,6 +4165,19 @@ [_rusun84Set.tableView reloadData]; + }else if ([dmodel.type isEqualToString:DECICE_TYPE_RUIMEI]){ + _ruimeiSet.timeArr = timerArr; + [_ruimeiSet.indicatorView stopAnimating]; + + NSString*stateString=[self.fishControlView.ruiMeiBack.customModel substringWithRange:NSMakeRange(2, 2)]; + if ([stateString isEqualToString:@"01"]) { + _ruimeiSet.customModeOn=YES; + }else{ + _ruimeiSet.customModeOn=NO; + } + [_ruimeiSet.tableView reloadData]; + + }else if ([dmodel.type isEqualToString:DECICE_TYPE_JUNENGCC]){ @@ -4571,7 +4600,13 @@ [self setHotCoolMianQueueWithUint64:mac]; } +#pragma mark - 瑞美 +-(void)selectRuiMeiIndex:(NSIndexPath *)index withbackModle:(RunSun84Protocol *)backModel { + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + UInt64 mac=[dataContorl hexToTen:backmodel.heatTemperature]; + [self setHotCoolMianQueueWithUint64:mac]; +} #pragma mark - 松诺BD 加热棒 -(void)selectSongNuoBDIndex:(NSIndexPath *)index withBackModel:(SongNuoBDProtocol *)backModel{ diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.h index ab33fe8..9c83df0 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.h @@ -18,6 +18,8 @@ #import "RuSunProtocol.h" #import "SongNuoBDProtocol.h" #import "RunSun84Protocol.h" +#import "RuiMeiProtocolModel.h" + @interface BootomViewSoketBackMasgConreol : NSObject //获取温度 +(NSString*)getTempWithSoketData:(NSData *)data; @@ -59,5 +61,7 @@ indexPath; +(void)SongnuoBDCommandSelectorWithBackMode86:(SongNuoBDProtocol *)model atindexPath:(NSIndexPath *)indexPath; +//瑞美 ++(void)RuiMeiCommandSelectorWithBackMode168:(RuiMeiProtocolModel *)model atindexPath:(NSIndexPath *)indexPath; @end diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m index 1a6cd80..b6f6eb2 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m @@ -84,6 +84,10 @@ //睿芯 86 字节 str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)]; + }else if ([type isEqualToString:DECICE_TYPE_RUIMEI]){ + //瑞美 + str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)]; + } UInt64 mac=[dataContorl hexToTen:str]; @@ -762,6 +766,81 @@ indexPath{ } ++(void)RuiMeiCommandSelectorWithBackMode168:(RuiMeiProtocolModel *)model atindexPath:(NSIndexPath *)indexPath +{ + + NSInteger index= indexPath.row - 3; + manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; + [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; + NSString*switchString=manulModel.description; + + if (index == 0) { + + manulModel.lightNumber = @"01"; + if([[model.ch1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + + }else{ + + manulModel.switchBtn = @"00"; + } + + }else if (index == 1){ + + manulModel.lightNumber = @"02"; + if([[model.ch2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + + }else{ + + manulModel.switchBtn = @"00"; + } + + + }else if (index == 2){ + + + manulModel.lightNumber = @"03"; + if([[model.ch3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + + }else{ + + manulModel.switchBtn = @"00"; + } + + + }else if (index == 3){ + + + manulModel.lightNumber = @"04"; + if([[model.ch4 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + + }else{ + + manulModel.switchBtn = @"00"; + } + + + }else if (index == 4){ + //加热棒 + return; + + } + + manulModel.crc16Str = @"0000"; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + +} + +(void)SongnuoBDCommandSelectorWithBackMode86:(SongNuoBDProtocol *)model atindexPath:(NSIndexPath *)indexPath { NSInteger index= indexPath.row - 3; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h index b1a7efe..aff274a 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h @@ -30,6 +30,9 @@ #import "SongNuoBDProtocol.h" #import "RunSun84Protocol.h" #import "RuSun84BackMsgUtils.h" +#import "RuiMeiProtocolModel.h" +#import "RuiMeiBackMsgUtils.h" + @protocol MonitorBottomCollcetionSelectDelegate @optional @@ -67,6 +70,8 @@ -(void)selectRuSunIndex:(NSIndexPath*)index withbackModle:(RuSunProtocol *)backModel; -(void)selectRuSun84Index:(NSIndexPath*)index withbackModle:(RunSun84Protocol *)backModel; +//瑞美 +-(void)selectRuiMeiIndex:(NSIndexPath*)index withbackModle:(RunSun84Protocol *)backModel; //松诺 BD @@ -141,6 +146,7 @@ @property(nonatomic,strong) RuSunProtocol *ruSunBack; @property(nonatomic,strong) RunSun84Protocol *ruSun84Back; +@property (nonatomic, strong) RuiMeiProtocolModel *ruiMeiBack; @property(nonatomic,strong) SongNuoBDProtocol *songNuoBDBack; -(void)setTabViewWithFrame:(CGRect)frame; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m index 7f3d80c..1cda06b 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m @@ -27,6 +27,9 @@ #import "ThreeControlName.h" #import "FourControlName.h" #import "XuToControlName.h" +#import "RuiMeiCHNameCustom.h" +#import "RuiMeiCHControl.h" + @implementation MonitorBootmView -(id)initWithFrame:(CGRect)frame @@ -605,7 +608,9 @@ return 3 + self.device.controlAmount.integerValue +1; - }else{ + } else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]) { + return 3 + 5; + } else { if (self.device.controlAmount.integerValue ==5) { @@ -659,6 +664,17 @@ withData:self.device addMassglength:self.dataLength]; + }else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){ + + if (!_ruiMeiBack) { + [self makeToast:@"暂未连接"]; + return; + } + + [self.MonitorBottomDelegate didselectCollectionIex:indexPath + withData:self.device + addMassglength:self.dataLength]; + }else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){ @@ -843,6 +859,23 @@ } + }else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){ + if (!_ruiMeiBack) { + [self makeToast:@"暂未连接"]; + return; + } + if (indexPath.row == 7) { + + //点击加热棒 + [self.MonitorBottomDelegate selectRuiMeiIndex:indexPath withbackModle:_ruSun84Back]; + + }else{ + + [BootomViewSoketBackMasgConreol RuiMeiCommandSelectorWithBackMode168:_ruiMeiBack atindexPath:indexPath]; + [self makeToastActivity]; + } + + }else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){ @@ -1124,6 +1157,14 @@ [cell setRusuan84ControlBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_ruSun84Back]; + }else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){ + + if (!_ruiMeiBack) { + cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3]; + [self makeToast:@"连接设备中..."]; + } + + [cell setRuiMeiControlBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_ruiMeiBack]; }else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){ @@ -1337,7 +1378,24 @@ LXImageWithImageName(@"bootview_022_on"), LXImageWithImageName(@"bootview_heat_on")]; - }else{ + } else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){ + //self.btnNameArr = @[@"灯1",@"灯2",@"水泵",@"氧泵",@"加热棒"]; + RuiMeiCHControl* songNuo = [UserExtendataArchaver unArchiverRuiMeiDeviceCHInfo:self.device.macAddress]; + self.btnNameArr = @[songNuo.ch1name,songNuo.ch2name,songNuo.ch3name,songNuo.ch4name,songNuo.jiaRe]; + + self.btnImgArr = @[LXImageWithImageName(@"bootview_light_off"), + LXImageWithImageName(@"bootview_light_off"), + LXImageWithImageName(@"bootview_shajun_off"), + LXImageWithImageName(@"bootview_co2_off"), + LXImageWithImageName(@"bootview_heat_off")]; + + self.btnOnImgArr = @[LXImageWithImageName(@"bootview_light_on"), + LXImageWithImageName(@"bootview_light_on"), + LXImageWithImageName(@"bootview_shajun_on"), + LXImageWithImageName(@"bootview_co2_on"), + LXImageWithImageName(@"bootview_heat_on")]; + + } else{ int controlAmount=[self.device.controlAmount intValue]; @@ -1608,6 +1666,26 @@ addMassglength:string1.length]; + }else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){ + //瑞美 + if (!_ruiMeiBack) { + _ruiMeiBack = [[RuiMeiProtocolModel alloc] init]; + + } + + [RuiMeiBackMsgUtils readSoketDataWithBaackMassgModel:_ruiMeiBack addWithBackData:data]; + + self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_RUIMEI]; + + [self.collectionView reloadData]; + + NSArray *timerArr=[RuiMeiBackMsgUtils refreshRuSunTimerAddTemperatureWithBackMassageModel:_ruiMeiBack]; + + [self.MonitorBottomDelegate setTimeVCReloadDatawithTimerArr:timerArr + withData:self.device + addMassglength:string1.length]; + + }else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){ //巨能 diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h index a1e105d..d09e213 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.h @@ -16,6 +16,8 @@ #import "RuSunProtocol.h" #import "SongNuoBDProtocol.h" #import "RunSun84Protocol.h" +#import "RuiMeiProtocolModel.h" + @interface FishControlFourthCell : UICollectionViewCell @property(nonatomic,strong) UIImageView *controBtnImg; @@ -80,4 +82,10 @@ atIndex:(NSIndexPath *)indexPath addBackModel:(SongNuoBDProtocol*)model; +// 瑞美 +-(void)setRuiMeiControlBtnImg:(NSArray *)imgOffArr + addArr:(NSArray *)imgOnArr + atIndex:(NSIndexPath *)indexPath + addBackModel:(RuiMeiProtocolModel*)model; + @end diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m index d3ec595..b3a54b4 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m @@ -397,6 +397,50 @@ } +} + +-(void)setRuiMeiControlBtnImg:(NSArray *)imgOffArr + addArr:(NSArray *)imgOnArr + atIndex:(NSIndexPath *)indexPath + addBackModel:(RuiMeiProtocolModel*)model +{ + NSInteger index = indexPath.row - 3; + if (index == 0) { + + NSString*stateString=[model.ch1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + }else if (index == 1){ + + NSString*stateString=[model.ch2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else if (index == 2){ + + NSString*stateString=[model.ch3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else if (index == 3){ + + NSString*stateString=[model.ch4 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else if (index == 4){ + //加热棒状态 + //加热棒状态 加热还是制冷 + //00 加热 01 制冷 + //model.heatStickState 加热棒开关状态 + NSString*stateString=[model.heatStickState substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)]; + + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + } + + } -(void)setSongNuoBDControBtnImg:(NSArray *)imgOffArr