diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 129258d..3cbac31 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2234,6 +2234,8 @@ 88F5EFD81D48D08100CC7CAF /* MMVectorImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF591D48D08100CC7CAF /* MMVectorImage.m */; }; 88F5EFD91D48D08100CC7CAF /* MyControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF5C1D48D08100CC7CAF /* MyControl.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 88F740C01ECC28E800876AED /* ShopAddGoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */; }; + C017B1E2245ED2D4003151DF /* UIImage+WaterMark.h in Headers */ = {isa = PBXBuildFile; fileRef = C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */; }; + C017B1E3245ED2D4003151DF /* UIImage+WaterMark.m in Sources */ = {isa = PBXBuildFile; fileRef = C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */; }; C024B79E2379668B00509424 /* NSArray+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */; }; C024B79F2379668B00509424 /* AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B78B2379668B00509424 /* AvoidCrash.h */; }; C024B7A02379668B00509424 /* NSString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = C024B78C2379668B00509424 /* NSString+AvoidCrash.m */; }; @@ -5684,6 +5686,8 @@ 88F5EF5C1D48D08100CC7CAF /* MyControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyControl.m; sourceTree = ""; }; 88F740BE1ECC28E800876AED /* ShopAddGoodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShopAddGoodsViewController.h; sourceTree = ""; }; 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShopAddGoodsViewController.m; sourceTree = ""; }; + C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+WaterMark.h"; sourceTree = ""; }; + C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+WaterMark.m"; sourceTree = ""; }; C024B78A2379668B00509424 /* NSArray+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+AvoidCrash.m"; sourceTree = ""; }; C024B78B2379668B00509424 /* AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrash.h; sourceTree = ""; }; C024B78C2379668B00509424 /* NSString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AvoidCrash.m"; sourceTree = ""; }; @@ -12208,6 +12212,8 @@ C0837A54244FF5500034FEC5 /* EGOCache */ = { isa = PBXGroup; children = ( + C017B1E0245ED2D3003151DF /* UIImage+WaterMark.h */, + C017B1E1245ED2D4003151DF /* UIImage+WaterMark.m */, C0837A55244FF5500034FEC5 /* EGOCache.m */, C0837A56244FF5500034FEC5 /* EGOCache.h */, ); @@ -13026,6 +13032,7 @@ CB484E0E22B8C8C80075F050 /* version.h in Headers */, 3D1C50E4221A9EE00096AE43 /* config.h in Headers */, CBB0243223517947002900D5 /* NSObject+MJProperty.h in Headers */, + C017B1E2245ED2D4003151DF /* UIImage+WaterMark.h in Headers */, 3D1C5104221A9EE00096AE43 /* YooseConnectFirstViewController.h in Headers */, CB484E1E22B8C8C90075F050 /* P2PCInterface.h in Headers */, 3D1C5127221A9EE00096AE43 /* IfishCameraRecordSecondCell.h in Headers */, @@ -15467,6 +15474,7 @@ E51D7D5B208CF4E7001FF053 /* RuiMeiInputViewController.m in Sources */, 881672241EA5DE2B00BEBF23 /* UMComSelectTopicCell.m in Sources */, FAFC08242279CB5900B5A07B /* SetTimerCell.m in Sources */, + C017B1E3245ED2D4003151DF /* UIImage+WaterMark.m in Sources */, 3D1C5097221A9EDF0096AE43 /* TabView.m in Sources */, 88696FBD1E9C7215005D4AFB /* MemberDetailViewController.m in Sources */, 8816722C1EA5DE2B00BEBF23 /* UMComSimpleFeedTableViewController.m in Sources */, @@ -15689,7 +15697,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -15807,7 +15815,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; diff --git a/Ifish/Assets.xcassets/.DS_Store b/Ifish/Assets.xcassets/.DS_Store index d561c4b..91d1bd6 100644 Binary files a/Ifish/Assets.xcassets/.DS_Store and b/Ifish/Assets.xcassets/.DS_Store differ diff --git a/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png b/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png index 5eb2319..63a3bdd 100644 Binary files a/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png and b/Ifish/Assets.xcassets/petimage/恒温关.imageset/恒温关.png differ diff --git a/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png b/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png index 34b12dc..23be987 100644 Binary files a/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png and b/Ifish/Assets.xcassets/petimage/恒温开.imageset/恒温开.png differ diff --git a/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png b/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png index 3295d06..97368d2 100644 Binary files a/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png and b/Ifish/Assets.xcassets/petimage/杀菌关.imageset/杀菌关.png differ diff --git a/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png b/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png index 3584aa4..6f8039a 100644 Binary files a/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png and b/Ifish/Assets.xcassets/petimage/杀菌开.imageset/杀菌开.png differ diff --git a/Ifish/Info.plist b/Ifish/Info.plist index c619fd3..2f87fd1 100644 --- a/Ifish/Info.plist +++ b/Ifish/Info.plist @@ -70,7 +70,7 @@ CFBundleVersion - 3 + $(CURRENT_PROJECT_VERSION) ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/Ifish/Utinitys/EGOCache/UIImage+WaterMark.h b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.h new file mode 100644 index 0000000..c8de568 --- /dev/null +++ b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.h @@ -0,0 +1,81 @@ +// +// UIImage+WaterMark.h +// PictureWatermark +// +// Created by AD-iOS on 15/8/3. +// Copyright (c) 2015年 Adinnet. All rights reserved. +// + +#import + +@interface UIImage (WaterMark) + +/** + * 给图片加水印图片 + * + * @param image 水印图片 + * @param imgRect 水印图片所在位置,大小 + * @param alpha 水印图片的透明度,0~1之间,透明度太大会完全遮盖被加水印图片的那一部分 + * + * @return 加完水印的图片 + */ +- (UIImage*)imageWaterMarkWithImage:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha; +/** + * 同上 + * + * @param image 同上 + * @param imgPoint 水印图片(0,0)所在位置 + * @param alpha 同上 + * + * @return 同上 + */ +- (UIImage*)imageWaterMarkWithImage:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha; + +/** + * 给图片加文字水印 + * + * @param str 水印文字 + * @param strRect 文字所在的位置大小 + * @param attri 文字的相关属性,自行设置 + * + * @return 加完水印文字的图片 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri; +/** + * 同上 + * + * @param str 同上 + * @param strPoint 文字(0,0)点所在位置 + * @param attri 同上 + * + * @return 同上 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri; +/** + * 返回加水印文字和图片的图片 + * + * @param str 水印文字 + * @param strPoint 文字(0,0)点所在位置 + * @param attri 文字属性 + * @param image 水印图片 + * @param imgPoint 图片(0,0)点所在位置 + * @param alpha 透明度 + * + * @return 加完水印的图片 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri image:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha; +/** + * 同上 + * + * @param str 同上 + * @param strRect 文字的位置大小 + * @param attri 同上 + * @param image 同上 + * @param imgRect 图片的位置大小 + * @param alpha 透明度 + * + * @return 同上 + */ +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri image:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha; + +@end diff --git a/Ifish/Utinitys/EGOCache/UIImage+WaterMark.m b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.m new file mode 100644 index 0000000..e76024d --- /dev/null +++ b/Ifish/Utinitys/EGOCache/UIImage+WaterMark.m @@ -0,0 +1,70 @@ +// +// UIImage+WaterMark.m +// PictureWatermark +// +// Created by AD-iOS on 15/8/3. +// Copyright (c) 2015年 Adinnet. All rights reserved. +// + +#import "UIImage+WaterMark.h" + +@implementation UIImage (WaterMark) + +- (UIImage*)imageWaterMarkWithImage:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha +{ + return [self imageWaterMarkWithString:nil rect:CGRectZero attribute:nil image:image imageRect:imgRect alpha:alpha]; +} + +- (UIImage*)imageWaterMarkWithImage:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha +{ + return [self imageWaterMarkWithString:nil point:CGPointZero attribute:nil image:image imagePoint:imgPoint alpha:alpha]; +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri +{ + return [self imageWaterMarkWithString:str rect:strRect attribute:attri image:nil imageRect:CGRectZero alpha:0]; +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri +{ + return [self imageWaterMarkWithString:str point:strPoint attribute:attri image:nil imagePoint:CGPointZero alpha:0]; +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str point:(CGPoint)strPoint attribute:(NSDictionary*)attri image:(UIImage*)image imagePoint:(CGPoint)imgPoint alpha:(CGFloat)alpha +{ + UIGraphicsBeginImageContext(self.size); + [self drawAtPoint:CGPointMake(0, 0) blendMode:kCGBlendModeNormal alpha:1.0]; + if (image) { + [image drawAtPoint:imgPoint blendMode:kCGBlendModeNormal alpha:alpha]; + } + + if (str) { + [str drawAtPoint:strPoint withAttributes:attri]; + } + UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return resultImage; + +} + +- (UIImage*)imageWaterMarkWithString:(NSString*)str rect:(CGRect)strRect attribute:(NSDictionary *)attri image:(UIImage *)image imageRect:(CGRect)imgRect alpha:(CGFloat)alpha +{ + UIGraphicsBeginImageContext(self.size); + [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height) blendMode:kCGBlendModeNormal alpha:1.0]; + if (image) { + [image drawInRect:imgRect blendMode:kCGBlendModeNormal alpha:alpha]; + } + + if ([str isKindOfClass:[NSAttributedString class]]) + { + [(NSAttributedString*)str drawInRect:strRect]; + } + else if (str) { + [str drawInRect:strRect withAttributes:attri]; + } + UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return resultImage; +} + +@end diff --git a/Ifish/Utinitys/dataUnity/dataContorl.m b/Ifish/Utinitys/dataUnity/dataContorl.m index d9f83c0..8386350 100644 --- a/Ifish/Utinitys/dataUnity/dataContorl.m +++ b/Ifish/Utinitys/dataUnity/dataContorl.m @@ -240,6 +240,10 @@ { NSString*hexString=[NSString stringWithFormat:@"%@",[[NSString alloc]initWithFormat:@"%1x",intString]]; siWeihexString=[NSString stringWithFormat:@"00%@",hexString]; + if (hexString.length==1) + { + siWeihexString=[NSString stringWithFormat:@"000%@",hexString]; + } }else if (intString>=260) diff --git a/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m b/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m index 843141f..bef29df 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m +++ b/Ifish/controllers/ConnectAauariumVC/ConAquarChooseWiFiVC.m @@ -131,6 +131,7 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init]; nextvc.wifiName=self.wifiName; nextvc.wifiPwd=self.wifiPwd; + nextvc.conectType =conectType_ap; [self.navigationController pushViewController:nextvc animated:YES]; } diff --git a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m index 5269e83..0a85b11 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m +++ b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m @@ -68,7 +68,7 @@ Copy NSString *deviceId; // // Do any additional setup after loading the view. self.timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerAction) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; - [self showStoreNameView]; + } //AP模式配网 @@ -349,6 +349,10 @@ Copy NSString *deviceId; }; store.sureBlock=^(NSString*name) { + if (!name) + { + name=@"宠物店"; + } [weakSelf.mask removeFromSuperview]; [weakSelf.storeNameView removeFromSuperview]; weakSelf.storeName=name; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h index a875b40..ab5035c 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.h @@ -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 diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m index 3233567..de34179 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/SetTimerCell.m @@ -9,8 +9,7 @@ #import "SetTimerCell.h" @interface SetTimerCell () -@property (weak, nonatomic) IBOutlet UILabel *titleLabel; -@property (weak, nonatomic) IBOutlet UILabel *timerLabel; + @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h index 412b246..e725d98 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h @@ -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 diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m index 379f6b8..8e6ef4c 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m @@ -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 diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m index 88bb564..cb7764b 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m @@ -39,6 +39,8 @@ static NSString *setTimerflag = @"SetTimerCell"; @interface Xuanduo2SettingController () @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]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h index 4f5e915..91e4121 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.h @@ -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 diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.m index b48f801..358f081 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2TimerModel.m @@ -15,3 +15,8 @@ @implementation Xuanduo2TimerModel @end + +@implementation XuanduoCycleModel + +@end + diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m index 538dda6..dc0c055 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m @@ -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{ diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m index e9b46cd..2a45f58 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m @@ -399,7 +399,9 @@ Assign BOOL isPush; petStores[storeName]=array; } - else { + + + { [deviceArr insertObject:devicemodel atIndex:0]; } @@ -848,12 +850,17 @@ Assign BOOL isPush; } for (DeviceModel *device in deivceArr) { - FormatTankAddCamera *deviceListModel =[[FormatTankAddCamera alloc] init]; - deviceListModel.device = device; - deviceListModel.type = @"tank"; - deviceListModel.deviceName = device.showName; - deviceListModel.imgeaName = @"home_iocn_aquarium"; - [self.totalArr addObject:deviceListModel]; + + if (!device.storeName.length) + { + FormatTankAddCamera *deviceListModel =[[FormatTankAddCamera alloc] init]; + deviceListModel.device = device; + deviceListModel.type = @"tank"; + deviceListModel.deviceName = device.showName; + deviceListModel.imgeaName = @"home_iocn_aquarium"; + [self.totalArr addObject:deviceListModel]; + + } } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m index 89d2792..4455520 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m @@ -64,6 +64,7 @@ #import "RuiMeiSetViewController.h" #import "Xuanduo2SettingController.h" #import "MessageAlertView.h" +#import "CreatErWeiMaController.h" //上部分视频封装 下部分分段控制器 封装 (下一步代码优化) @interface IfishP2PMonitorController () { @@ -347,12 +348,13 @@ Strong UIImage *screenShotImage;//截图 }); } ready:^{ - [self.view makeToast:@"连接成功"]; + //呼叫成功操作 NSLog(@"连接摄像头成功 当前所在线程为%@",[NSThread currentThread]); //隐藏呼叫中的UI dispatch_async(dispatch_get_main_queue(), ^{ //隐藏旋转按钮 + [self.view makeToast:@"连接成功"]; [weakSelf hiddenMonitoringUI:YES callWithErrorType:100 isReCall:NO]; // [weakSelf didHiddenMonitorUIWith:YES]; @@ -583,7 +585,47 @@ Strong UIImage *screenShotImage;//截图 CGFloat controlSegY= CGRectGetMaxY(self.canvasView.frame); IifshSegmentView *seg = [[IifshSegmentView alloc] initWithFrame:CGRectMake(0.0, controlSegY,kScreenSize.width, segMentH)]; seg.segDelegate = self; - [seg initleftTitle:@"摄像头" addRightTitle:@"水族箱" isSelectStyle:YES]; + NSString*title=@"水族箱"; + NSArray*devicearray=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"]; + + BOOL contain3F=NO; + BOOL contain2F=NO; + + for (DeviceModel*model in devicearray) + { + if ([model.type isEqualToString:DECICE_TYPE_XUANDUO2F]) + { + contain2F=YES; + } + if ([model.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + contain3F=YES; + } + + } + + if (contain2F) + { + if (contain3F) + { + title=@"设备"; + } + else + { + title=@"水族箱"; + } + } + else if(contain3F) + { + title=@"宠物笼"; + + } + else + { + title=@"水族城"; + } + + [seg initleftTitle:@"摄像头" addRightTitle:title isSelectStyle:YES]; self.segControl = seg; [self.view addSubview:seg]; @@ -629,6 +671,11 @@ Strong UIImage *screenShotImage;//截图 [weakSelf delectCamera]; }else if (tag == 2){ + //删除摄像头 + [weakSelf fenXiangSheBei]; + + } + else if (tag == 3){ //检查设备更新 if ([weakSelf.player isPlaying]) { @@ -665,8 +712,8 @@ Strong UIImage *screenShotImage;//截图 [self.view addSubview:self.popView]; NSArray *titleImgs =nil; NSArray *titles=nil; - titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device",@"equipment_icon_equipmentupdate"]; - titles=@[@"修改名称",@"删除设备",@"设备升级"]; + titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device",@"Ifish_share_device",@"equipment_icon_equipmentupdate"]; + titles=@[@"修改名称",@"删除设备",@"分享设备",@"设备升级"]; [self.popView loadInfoWithTitle:titles Icons:titleImgs]; } @@ -747,6 +794,15 @@ Strong UIImage *screenShotImage;//截图 [self presentViewController:ac2 animated:YES completion:nil]; } +-(void)fenXiangSheBei{ + + CreatErWeiMaController*vc=[[CreatErWeiMaController alloc]init]; + vc.isNewdevice = YES; + vc.deviceid=self.contact.cameraId; + + [self.navigationController pushViewController:vc animated:YES]; + +} -(void)deleteCameraAtRequset{ @@ -998,14 +1054,14 @@ Strong UIImage *screenShotImage;//截图 }else{ UIButton *notbindBtn=[UIButton buttonWithType:UIButtonTypeCustom]; - NSString *title=@"您暂未绑定水族箱,前往绑定。"; + NSString *title=@"您暂未绑定水族箱或宠物笼,前往绑定。"; [notbindBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:title]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - [paragraphStyle setLineSpacing:8]; + [paragraphStyle setLineSpacing:12]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(9,4)]; - [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,9)]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,13)]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)]; [notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal]; [notbindBtn sizeToFit]; @@ -4216,35 +4272,60 @@ GWP2PCallErrorNotSupport, -(void)selectXuanduo2Index:(NSIndexPath *)index withBackModel:(Xuanduo2Model *)backModel{ if (backModel) { - if (index.row == 3) { - //循环泵 - manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; - [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; - NSString*switchString=manulModel.description; - manulModel.lightNumber = @"04"; - if([[backModel.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) - { - manulModel.switchBtn = @"01"; - }else{ - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil]; - UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - manulModel.switchBtn = @"00"; - manulModel.crc16Str = @"0000"; - NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; - NSData*manulData=[dataContorl stringToHexData:switchString2]; - [[Socketsingleton sharedInstance] soketWriteData:manulData]; - }]; - [alertController addAction:cancelAction]; - [alertController addAction:sureAction]; - [self.navigationController presentViewController:alertController animated:YES completion:nil]; - return; - } + if (index.row == 3) + { + if ([backModel isKindOfClass:[Xuanduo2Model class]]) { + //循环泵 + manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; + [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; + NSString*switchString=manulModel.description; + manulModel.lightNumber = @"04"; + if([[backModel.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + }else{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil]; + UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + manulModel.switchBtn = @"00"; + manulModel.crc16Str = @"0000"; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + }]; + [alertController addAction:cancelAction]; + [alertController addAction:sureAction]; + [self.navigationController presentViewController:alertController animated:YES completion:nil]; + return; + } + manulModel.crc16Str = @"0000"; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + } + else + { + //循环泵 + Xuanduo3fModel*backModel=backModel; manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init]; + [[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel]; + NSString*switchString=manulModel.description; + manulModel.lightNumber = @"01"; + if([[backModel.light substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + { + manulModel.switchBtn = @"01"; + }else + { + manulModel.switchBtn = @"00"; + } + + manulModel.crc16Str = @"0000"; - NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; - NSData*manulData=[dataContorl stringToHexData:switchString2]; - [[Socketsingleton sharedInstance] soketWriteData:manulData]; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [[Socketsingleton sharedInstance] soketWriteData:manulData]; + + } }else { _xuanduoPicView=[[HaveHotCoolWenDuPicview alloc] init]; _xuanduoPicView.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm index f6a534c..d1b0318 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/YooseeNextConnectViewController.mm @@ -473,10 +473,17 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 [[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { NSLog(@"success:%i %@",success,dataDictionary); [self resetPassWord];//初始化密码 - [self bindCameraDevice]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self bindCameraDevice]; + + }); }]; }else{//如果已经设置过初始密码,则直接使用 - [self bindCameraDevice]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self bindCameraDevice]; + + }); } } @@ -574,6 +581,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔,复位摄像 contact.contactType = CONTACT_TYPE_UNKNOWN; [[FListManager sharedFList] insert:contact]; //设置密码成功后爱鱼奇用户绑定摄像头 + [self ifishUserBindcameraIdBy:self.deviceID]; } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m index cdf2df2..5e33a69 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/BootomViewSoketBackMasgConreol.m @@ -10,6 +10,7 @@ #import "IfishDeviceInfo.h" #import "RuSunGuiDeng.h" #import "XuanduoHuliModel.h" +#import "xuanduo3fModel.h" @implementation BootomViewSoketBackMasgConreol @@ -92,6 +93,9 @@ }else if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]){ str=[str substringWithRange:NSMakeRange(60,IFISH_TEMPERATURE_BYTE2)]; } + else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + str=[str substringWithRange:NSMakeRange(46,IFISH_TEMPERATURE_BYTE2)]; + } UInt64 mac=[dataContorl hexToTen:str]; NSLog(@"%llu",mac); @@ -927,7 +931,17 @@ indexPath { if (index == 0) { //循环 manulModel.lightNumber = @"04"; - if([[model.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + + NSString*state; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + state=model.gasPump; + manulModel.lightNumber=@"01"; + } + else{ + state= model.waterPump; + } + if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { manulModel.switchBtn = @"01"; @@ -939,6 +953,11 @@ indexPath { }else if (index == 1){ //增氧 manulModel.lightNumber = @"01"; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + manulModel.lightNumber=@"02"; + } + if([[model.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { @@ -953,7 +972,16 @@ indexPath { manulModel.lightNumber = @"02"; - if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + NSString*state; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + state=model.uvLamp; + manulModel.lightNumber=@"03"; + } + else{ + state= model.light1; + } + if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { manulModel.switchBtn = @"01"; @@ -967,7 +995,17 @@ indexPath { manulModel.lightNumber = @"03"; - if([[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) + NSString*state; + if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + state=((Xuanduo3fModel*)model).constTmep; + manulModel.lightNumber=@"04"; + } + else{ + state= model.light2; + } + + if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"]) { manulModel.switchBtn = @"01"; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h index 4fe9f9f..07478e1 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.h @@ -154,7 +154,7 @@ @property(nonatomic,strong) RunSun84Protocol *ruSun84Back; @property (nonatomic, strong) RuiMeiProtocolModel *ruiMeiBack; @property(nonatomic,strong) SongNuoBDProtocol *songNuoBDBack; -@property(nonatomic,strong) Xuanduo2Model *xuanduoBack; +@property(nonatomic,strong) id xuanduoBack; -(void)setTabViewWithFrame:(CGRect)frame; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m index 3b29a93..626d65f 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/MonitorBootmView.m @@ -237,14 +237,14 @@ UIButton *notbindBtn=[UIButton buttonWithType:UIButtonTypeCustom]; - NSString *title=@"您暂无可用的水族箱,前往绑定。"; + NSString *title=@"您暂无可用的水族箱或宠物笼,前往绑定。"; [notbindBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:title]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - [paragraphStyle setLineSpacing:8]; + [paragraphStyle setLineSpacing:12]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])]; - [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(9,5)]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(13,5)]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,10)]; [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)]; [notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal]; @@ -307,7 +307,7 @@ //[headerView setBackgroundColor:XBGAlpha]; [headerView setBackgroundColor:RGB(242, 242, 242)]; UILabel *readLabel=[[UILabel alloc] init ]; - readLabel.text = @"请选择一个水族箱,和摄像头建立关系"; + readLabel.text = @"请选择一个水族箱或宠物笼,和摄像头建立关系"; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:readLabel.text ]; @@ -618,7 +618,11 @@ return 3 + 5; } else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){ return 3 + self.device.controlAmount.integerValue + 1; - }else { + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + return 3 + self.device.controlAmount.integerValue + 1; + } + else { if (self.device.controlAmount.integerValue ==5) { @@ -708,7 +712,32 @@ if (!cell || [cell.templabel.text containsString:@"kwh"]) { return; } - UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity]; + Xuanduo2Model*model=_xuanduoBack; + UInt64 mac = [dataContorl hexToTen:model.electricity]; + NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0]; + cell.templabel.font = [UIFont systemFontOfSize:37]; + cell.templabel.textColor = RGB(253, 188, 63); + [cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] 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]; + } + }else if(indexPath.row == 2) { + [self.MonitorBottomDelegate didselectXuanduo2SetttngWithData:self.device andBackModel:_xuanduoBack]; + } + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + if (!_xuanduoBack) { + [self makeToast:@"暂未连接"]; + return; + } + if (indexPath.row == 1) { + FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag]; + if (!cell || [cell.templabel.text containsString:@"kwh"]) { + return; + } + Xuanduo3fModel*model=_xuanduoBack; + UInt64 mac = [dataContorl hexToTen:model.temperature]; NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0]; cell.templabel.font = [UIFont systemFontOfSize:37]; cell.templabel.textColor = RGB(253, 188, 63); @@ -925,7 +954,7 @@ } [self makeToastActivity:CSToastPositionCenter]; - }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){ + }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ // 新绚多 if (!_xuanduoBack) { [self makeToast:@"暂未连接"]; @@ -1118,10 +1147,17 @@ if (!cell) { return; } - UInt64 mac = [dataContorl hexToTen:_xuanduoBack.waterTemperature]; - NSLog(@"%llu",mac); - //float TPlabel=mac/10+(mac%10)*0.1; - float temp = mac/10.0; + UInt64 mac = 0; + NSLog(@"%llu",mac); + if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]) { + Xuanduo2Model*model=(Xuanduo2Model*)_xuanduoBack; + mac=[dataContorl hexToTen:model.waterTemperature]; + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) + { + Xuanduo3fModel*model=(Xuanduo3fModel*)_xuanduoBack; + mac=[dataContorl hexToTen:model.temperature]; + } float temp = mac/10.0; NSString *stringTemp = [NSString stringWithFormat:@"%.1f",temp]; [cell setTemWith:stringTemp]; } @@ -1243,7 +1279,7 @@ [cell setSongNuoBDControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_songNuoBDBack]; - }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){ + }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ if (!_xuanduoBack) { cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3]; [self makeToast:@"连接设备中..."]; @@ -1487,7 +1523,21 @@ [UIImage imageNamed:@"shajun_selected"], [UIImage imageNamed:@"huli_selected"], [UIImage imageNamed:@"jiare_selected"]]; - }else{ + } + else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + self.btnNameArr = @[@"照明",@"换气",@"杀菌",@"恒温"]; + + self.btnImgArr = @[[UIImage imageNamed:@"照明关"], + [UIImage imageNamed:@"换气关"], + [UIImage imageNamed:@"杀菌关"], + [UIImage imageNamed:@"恒温关"]]; + + self.btnOnImgArr = @[[UIImage imageNamed:@"照明开"], + [UIImage imageNamed:@"换气开"], + [UIImage imageNamed:@"杀菌开"], + [UIImage imageNamed:@"恒温开"]]; + } + else{ int controlAmount=[self.device.controlAmount intValue]; @@ -1802,7 +1852,16 @@ [Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data type:DECICE_TYPE_XUANDUO2F]; self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO2F]; [self.collectionView reloadData]; - }else{ + }else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){ + // 新绚多 + if (!_xuanduoBack) { + _xuanduoBack = [[Xuanduo3fModel alloc] init]; + } + [Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data type:self.device.type]; + self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO3F]; + [self.collectionView reloadData]; + } + else{ int controlAmount=[devicemoel.controlAmount intValue]; diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m index 79b26ac..0c7b606 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFirstCell.m @@ -29,6 +29,8 @@ UIView *hengLine=[[UIView alloc] initWithFrame:CGRectMake(0,self.frame.size.height -1,self.frame.size.width, 1)]; hengLine.backgroundColor = shuLine.backgroundColor = JWUIColorFromRGB(0xdddddd); [self addSubview:hengLine]; + [self bringSubviewToFront:self.factoryIcon]; + self.factoryIcon.hidden=NO; } @@ -38,12 +40,18 @@ -(void)intiFactoryImgWith:(DeviceModel *)devicemodel{ - [self.factoryIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,devicemodel.logo]] placeholderImage:[UIImage imageNamed:@""]]; + + if (!self.factoryIcon.image) { + self.factoryIcon.image = [UIImage imageNamed:@"brandLogo_hold"]; + } + [self.factoryIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,devicemodel.logo]] placeholderImage:[UIImage imageNamed:@"brandLogo_hold"]]; if (!self.factoryIcon) { self.factoryIcon.image = [UIImage imageNamed:@"greenbtn_big"]; } - + [self bringSubviewToFront:self.factoryIcon]; + self.factoryIcon.hidden=NO; + } @end diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m index 5e072ef..e769328 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/YseeCollectionCell/FishControlFourthCell.m @@ -7,6 +7,7 @@ // #import "FishControlFourthCell.h" +#import "xuanduo3fModel.h" @implementation FishControlFourthCell - (instancetype)initWithFrame:(CGRect)frame{ @@ -258,6 +259,10 @@ atIndex:(NSIndexPath *)indexPath addBackModel:(Xuanduo2Model*)model { + if ([model isKindOfClass:[Xuanduo2Model class]]) + { + + NSInteger index = indexPath.row - 3; if (index == 0) { @@ -307,7 +312,40 @@ addOffArr:imgOffArr]; } - + } + else if ([model isKindOfClass:[Xuanduo3fModel class]]) + { + + Xuanduo3fModel*xuan3fmodel=model; + NSInteger index = indexPath.row - 3; + if (index == 0) { + + NSString*stateString=[xuan3fmodel.light substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + }else if (index == 1){ + + NSString*stateString=[xuan3fmodel.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else if (index == 2){ + + NSString*stateString=[xuan3fmodel.uvLamp substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else if (index == 3){ + + NSString*stateString=[xuan3fmodel.constTmep substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)]; + [self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr + addOffArr:imgOffArr]; + + }else + { + NSLog(@"index=%ld",indexPath.row); + } + } } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m index b3956fe..81f47a9 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/yooseFishTankView/ifishdeviceListCell.m @@ -72,7 +72,7 @@ withdeviceName:(NSString *)nameStr{ - self.deviceNameLabel.text = [NSString stringWithFormat:@"水族箱:%@",nameStr]; + self.deviceNameLabel.text = nameStr; self.deviceNameLabel.textColor = [UIColor blackColor]; diff --git a/Ifish/controllers/erweima/CreatErWeiMaController.h b/Ifish/controllers/erweima/CreatErWeiMaController.h index f255d41..d2dc87c 100644 --- a/Ifish/controllers/erweima/CreatErWeiMaController.h +++ b/Ifish/controllers/erweima/CreatErWeiMaController.h @@ -14,6 +14,7 @@ @property (weak, nonatomic) IBOutlet UIImageView *erWeiMaView; @property (nonatomic,strong) DeviceModel *erdevicemodel; +@property (nonatomic, strong) NSString *deviceid; @end diff --git a/Ifish/controllers/erweima/CreatErWeiMaController.m b/Ifish/controllers/erweima/CreatErWeiMaController.m index 81999cd..2788300 100644 --- a/Ifish/controllers/erweima/CreatErWeiMaController.m +++ b/Ifish/controllers/erweima/CreatErWeiMaController.m @@ -42,7 +42,7 @@ // } //DeviceModel*model=[_arry objectAtIndex:0];//分享选中设备 - NSString*str=[NSString stringWithFormat:@"deviceId=%@",self.erdevicemodel.deviceId]; + NSString*str=[NSString stringWithFormat:@"deviceId=%@",self.erdevicemodel.deviceId.length?self.erdevicemodel.deviceId:[CommonUtils getNotNilStr:self.deviceid]]; self.erWeiMaView.image=[QRCodeGenerator qrImageForString:str imageSize:self.erWeiMaView.bounds.size.width]; } diff --git a/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m b/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m index fe4ca46..7cc0f96 100644 --- a/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m +++ b/Ifish/controllers/leftcontrollers/SecondConnectWifiController.m @@ -135,7 +135,7 @@ extern BOOL isfromCameraView; [self creatConnectStateUI]; //获取WiFi名称 [self getSSid]; - [self showStoreNameView]; + } - (void)updateUI { diff --git a/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m b/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m index 9eee4b3..9344418 100644 --- a/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m +++ b/Ifish/models/wifiModel/sendmaseegemodel/ReadTimerModel.m @@ -13,7 +13,9 @@ { self.messagetype=@"00"; self.massagelegth=@"12"; - self.functionCode=@"16"; + if (!self.functionCode.length) { + self.functionCode=@"16"; + } return [NSString stringWithFormat:@"%@%@%@%@%@",self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth]; } diff --git a/Ifish/views/mypicView/remindCyclePic.m b/Ifish/views/mypicView/remindCyclePic.m index 5b00e2e..ace172c 100644 --- a/Ifish/views/mypicView/remindCyclePic.m +++ b/Ifish/views/mypicView/remindCyclePic.m @@ -52,6 +52,9 @@ else if ([self.type isEqualToString:@"temp"]) { title.text=@"恒温设置"; } + else if ([self.type isEqualToString:@"cycle"]) { + title.text=@"杀菌持续时长"; + } title.textAlignment=NSTextAlignmentCenter; @@ -118,6 +121,10 @@ _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13" { _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56",@"57",@"58",@"59",@"60",@"61",@"62",@"63",@"64",@"65",@"66",@"67",@"68",@"69",@"70",@"71",@"72",@"73",@"74",@"75",@"76",@"77",@"78",@"79",@"80"]]; } + else if ([self.type isEqualToString:@"cycle"]) + { + _picArr=@[@[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30"]]; + } }