diff --git a/.DS_Store b/.DS_Store index b2fefd1..f708742 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 148416b..45ceefa 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2708,6 +2708,12 @@ E5F1B03B21183E9700A879A1 /* setting-restart.png in Resources */ = {isa = PBXBuildFile; fileRef = E5F1B03821183E9600A879A1 /* setting-restart.png */; }; E5F1B03C21183E9700A879A1 /* setting-restart@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E5F1B03921183E9700A879A1 /* setting-restart@2x.png */; }; E5F1B03F21184F9400A879A1 /* IFishHotpotUDPHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E5F1B03D21184F9300A879A1 /* IFishHotpotUDPHelper.m */; }; + FA0892E9226B22C90084A609 /* Xuanduo2Model.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0892E7226B22C90084A609 /* Xuanduo2Model.h */; }; + FA0892EA226B22C90084A609 /* Xuanduo2Model.m in Sources */ = {isa = PBXBuildFile; fileRef = FA0892E8226B22C90084A609 /* Xuanduo2Model.m */; }; + FA0892ED226C15000084A609 /* Xuanduo2DataUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0892EB226C15000084A609 /* Xuanduo2DataUtility.h */; }; + FA0892EE226C15000084A609 /* Xuanduo2DataUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = FA0892EC226C15000084A609 /* Xuanduo2DataUtility.m */; }; + FA0892F1226CA3920084A609 /* NSString+Add.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0892EF226CA3920084A609 /* NSString+Add.h */; }; + FA0892F2226CA3920084A609 /* NSString+Add.m in Sources */ = {isa = PBXBuildFile; fileRef = FA0892F0226CA3920084A609 /* NSString+Add.m */; }; FAB3721122619DB70051E107 /* Xuanduo2fController.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB3720E22619DB70051E107 /* Xuanduo2fController.h */; }; FAB3721222619DB70051E107 /* Xuanduo2fController.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB3720F22619DB70051E107 /* Xuanduo2fController.m */; }; FAB3721322619DB70051E107 /* Xuanduo2fController.xib in Resources */ = {isa = PBXBuildFile; fileRef = FAB3721022619DB70051E107 /* Xuanduo2fController.xib */; }; @@ -6640,6 +6646,12 @@ E5F1B03921183E9700A879A1 /* setting-restart@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "setting-restart@2x.png"; sourceTree = ""; }; E5F1B03D21184F9300A879A1 /* IFishHotpotUDPHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IFishHotpotUDPHelper.m; sourceTree = ""; }; E5F1B03E21184F9400A879A1 /* IFishHotpotUDPHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IFishHotpotUDPHelper.h; sourceTree = ""; }; + FA0892E7226B22C90084A609 /* Xuanduo2Model.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Xuanduo2Model.h; sourceTree = ""; }; + FA0892E8226B22C90084A609 /* Xuanduo2Model.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Xuanduo2Model.m; sourceTree = ""; }; + FA0892EB226C15000084A609 /* Xuanduo2DataUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Xuanduo2DataUtility.h; sourceTree = ""; }; + FA0892EC226C15000084A609 /* Xuanduo2DataUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Xuanduo2DataUtility.m; sourceTree = ""; }; + FA0892EF226CA3920084A609 /* NSString+Add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Add.h"; sourceTree = ""; }; + FA0892F0226CA3920084A609 /* NSString+Add.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Add.m"; sourceTree = ""; }; FAB3720E22619DB70051E107 /* Xuanduo2fController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Xuanduo2fController.h; sourceTree = ""; }; FAB3720F22619DB70051E107 /* Xuanduo2fController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Xuanduo2fController.m; sourceTree = ""; }; FAB3721022619DB70051E107 /* Xuanduo2fController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Xuanduo2fController.xib; sourceTree = ""; }; @@ -10305,6 +10317,13 @@ 883E76A11D48A5E50030E075 /* JiaReWenDuModel.m */, 883E76A21D48A5E50030E075 /* XutoBackMsgModel.h */, 883E76A31D48A5E50030E075 /* XutoBackMsgModel.m */, + FA0892E7226B22C90084A609 /* Xuanduo2Model.h */, + FA0892E8226B22C90084A609 /* Xuanduo2Model.m */, + FA0892EB226C15000084A609 /* Xuanduo2DataUtility.h */, + FA0892EC226C15000084A609 /* Xuanduo2DataUtility.m */, + FAB3720E22619DB70051E107 /* Xuanduo2fController.h */, + FAB3720F22619DB70051E107 /* Xuanduo2fController.m */, + FAB3721022619DB70051E107 /* Xuanduo2fController.xib */, 883E76A41D48A5E50030E075 /* XuToCenterViewController.h */, 883E76A51D48A5E50030E075 /* XuToCenterViewController.m */, 883E76A61D48A5E50030E075 /* XuToLightModel.h */, @@ -10319,9 +10338,6 @@ 886185CC1EF255F900459AD1 /* XuToControlNameViewController.m */, 886185CE1EF2561700459AD1 /* XuToControlName.h */, 886185CF1EF2561700459AD1 /* XuToControlName.m */, - FAB3720E22619DB70051E107 /* Xuanduo2fController.h */, - FAB3720F22619DB70051E107 /* Xuanduo2fController.m */, - FAB3721022619DB70051E107 /* Xuanduo2fController.xib */, ); path = XuTo; sourceTree = ""; @@ -14420,6 +14436,8 @@ E5C644BF206BBD5F00C558D5 /* Common */ = { isa = PBXGroup; children = ( + FA0892EF226CA3920084A609 /* NSString+Add.h */, + FA0892F0226CA3920084A609 /* NSString+Add.m */, E5C644C0206BBD7100C558D5 /* CommonMacros.h */, 404D7CE92238CF77005655F5 /* UIViewController+Swizzling.h */, 404D7CE82238CF77005655F5 /* UIViewController+Swizzling.m */, @@ -14470,6 +14488,7 @@ 3D1C50E2221A9EE00096AE43 /* UDPManager.h in Headers */, 3D1C509A221A9EDF0096AE43 /* ConnectFailurePromptView.h in Headers */, 3D1C505F221A9EDF0096AE43 /* imgutils.h in Headers */, + FA0892ED226C15000084A609 /* Xuanduo2DataUtility.h in Headers */, 3D1C50B7221A9EDF0096AE43 /* YTargetAndAction.h in Headers */, 3D1C505E221A9EDF0096AE43 /* channel_layout.h in Headers */, 3D1C5047221A9EDE0096AE43 /* lfg.h in Headers */, @@ -14497,6 +14516,7 @@ 3D1C503D221A9EDE0096AE43 /* error.h in Headers */, 3D1C506D221A9EDF0096AE43 /* swscale.h in Headers */, 3D1C50C0221A9EE00096AE43 /* Contact.h in Headers */, + FA0892F1226CA3920084A609 /* NSString+Add.h in Headers */, 3D1C5100221A9EE00096AE43 /* IfishCameraModel.h in Headers */, 3D1C505D221A9EDF0096AE43 /* audioconvert.h in Headers */, 3D1C508D221A9EDF0096AE43 /* CustomBorderButton.h in Headers */, @@ -14504,6 +14524,7 @@ 3D1C50B4221A9EDF0096AE43 /* YTheNaviBar.h in Headers */, 3D1C5121221A9EE00096AE43 /* CameraBottomCollectionViewCell.h in Headers */, 3D1C50BC221A9EE00096AE43 /* P2PClient.h in Headers */, + FA0892E9226B22C90084A609 /* Xuanduo2Model.h in Headers */, 3D1C5115221A9EE00096AE43 /* ShotScreenImgViewController.h in Headers */, 3D1C506F221A9EDF0096AE43 /* version.h in Headers */, 3D1C5083221A9EDF0096AE43 /* KTThumbsViewController.h in Headers */, @@ -16235,6 +16256,7 @@ 885EC4C91DB4C73D008134DA /* LXADViewTool.m in Sources */, 88602F611E12002600F3DB5D /* NTESCustomAttachmentDecoder.m in Sources */, 88602F801E12002600F3DB5D /* NTESDevice.m in Sources */, + FA0892EA226B22C90084A609 /* Xuanduo2Model.m in Sources */, 881672371EA5DE2B00BEBF23 /* UMComSimpleHomeViewController.m in Sources */, 881671DD1EA5DE2B00BEBF23 /* UMComUserNearbyViewController.m in Sources */, 88F740C01ECC28E800876AED /* ShopAddGoodsViewController.m in Sources */, @@ -16402,6 +16424,7 @@ 3DD7AB5321E2F2FB0064856A /* rscode.c in Sources */, 885A376E1E6EBB67007AD930 /* QianDaoGiftView.m in Sources */, 88F5EE4E1D48CA2800CC7CAF /* ESP_NetUtil.m in Sources */, + FA0892F2226CA3920084A609 /* NSString+Add.m in Sources */, 883E763E1D4897570030E075 /* ServerBackDeviceLogInModel.m in Sources */, 88F5EE511D48CA2800CC7CAF /* ESPTouchTask.m in Sources */, 88602A141E10BC3400F3DB5D /* NIMBadgeView.m in Sources */, @@ -17069,6 +17092,7 @@ 3D8F64EE215797E700F04BD3 /* IQTextView.m in Sources */, 8871FAB91EBC539C0038E99A /* ShopCerSelectImgViewCell.m in Sources */, 8860D7941D6D7C00001E544C /* KanHuWorkViewSecondCell.m in Sources */, + FA0892EE226C15000084A609 /* Xuanduo2DataUtility.m in Sources */, 881672321EA5DE2B00BEBF23 /* UMComLargeImageTableViewCell.m in Sources */, 888EEB311DC2F37C003C5C5B /* YYWeakProxy.m in Sources */, 3D1C50FC221A9EE00096AE43 /* TouchButton.m in Sources */, @@ -17559,7 +17583,7 @@ CLANG_CXX_LIBRARY = "compiler-default"; CODE_SIGN_ENTITLEMENTS = Ifish/Ifish.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Shanghai Yu Ying Technology Co., Ltd. (WFX8GD5HFX)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; diff --git a/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/Contents.json b/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/Contents.json index ea9d559..d513d7a 100644 --- a/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/Contents.json +++ b/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/Contents.json @@ -11,7 +11,6 @@ }, { "idiom" : "universal", - "filename" : "xuanduo_bg@3x.png", "scale" : "3x" } ], diff --git a/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/xuanduo_bg@3x.png b/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/xuanduo_bg@3x.png deleted file mode 100644 index 540382d..0000000 Binary files a/Ifish/Assets.xcassets/绚多设备/xuanduo_bg.imageset/xuanduo_bg@3x.png and /dev/null differ diff --git a/Ifish/Common/NSString+Add.h b/Ifish/Common/NSString+Add.h new file mode 100644 index 0000000..77381a2 --- /dev/null +++ b/Ifish/Common/NSString+Add.h @@ -0,0 +1,55 @@ +// +// NSString+Add.h +// LettuceFinancial +// +// Created by roadroor on 2017/12/8. +// Copyright © 2017年 Roadoor. All rights reserved. +// + +#import + +@interface NSString (Add) + ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString lineSpace:(CGFloat)spacing textAlignment:(NSTextAlignment)alignment SubStringArray:(NSArray *)subArray; + + ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString lineSpace:(CGFloat)spacing SubStringArray:(NSArray *)subArray; +/** + * 改变某些文字的颜色 并单独设置其字体 + * + * @param font 设置的字体 + * @param color 颜色 + * @param totalString 总的字符串 + * @param subArray 想要变色的字符数组 + * + * @return 生成的富文本 + */ ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString SubStringArray:(NSArray *)subArray; + +/** + * 改变某些文字的颜色 并单独设置其字体 + * + * @param font 设置的字体 + * @param color 设置的颜色 + * @param totalString 总的字符串 + * @param subArray 想要变色的Range数组 + * + * @return 生成的富文本 + */ ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString SubRangeArray:(NSArray *)subArray; + +/** + 设置文字最后一个字母 + + @param font <#font description#> + @param color <#color description#> + @param totalString <#totalString description#> + @return <#return value description#> + */ ++ (NSMutableAttributedString *)ls_changeLastLettersLFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString; + +/** + 改变某些文字的颜色 设置不同的字体 + */ ++ (NSMutableAttributedString *)ls_changePrefixString:(NSString *)prefixString PrefixFont:(UIFont *)prefixFont PrefixColor:(UIColor *)prefixColor SuffixesString:(NSString*)suffixesString SuffixesFont:(UIFont *)suffixesFont SuffixesColor:(UIColor *)suffixesColor; +@end diff --git a/Ifish/Common/NSString+Add.m b/Ifish/Common/NSString+Add.m new file mode 100644 index 0000000..551599a --- /dev/null +++ b/Ifish/Common/NSString+Add.m @@ -0,0 +1,87 @@ +// +// NSString+Add.m +// LettuceFinancial +// +// Created by roadroor on 2017/12/8. +// Copyright © 2017年 Roadoor. All rights reserved. +// + +#import "NSString+Add.h" + +@implementation NSString (Add) ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString lineSpace:(CGFloat)spacing textAlignment:(NSTextAlignment)alignment SubStringArray:(NSArray *)subArray{ + NSMutableAttributedString *attributedStr = [self ls_changeFontAndColor:font Color:color TotalString:totalString SubStringArray:subArray]; + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:spacing]; + [paragraphStyle setAlignment:alignment]; + [attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalString length])]; + return attributedStr; +} + + ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString lineSpace:(CGFloat)spacing SubStringArray:(NSArray *)subArray { + NSMutableAttributedString *attributedStr = [self ls_changeFontAndColor:font Color:color TotalString:totalString SubStringArray:subArray]; + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + [paragraphStyle setLineSpacing:spacing]; + [attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalString length])]; + return attributedStr; +} + +/** + * 改变某些文字的颜色 并单独设置其字体 + * + * @param font 设置的字体 + * @param color 颜色 + * @param totalString 总的字符串 + * @param subArray 想要变色的字符数组 + * + * @return 生成的富文本 + */ + ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString SubStringArray:(NSArray *)subArray { + if (!totalString.length) {return [NSMutableAttributedString new];} + NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:totalString]; + if (!subArray.count) {return attributedStr;} + for (NSString *rangeStr in subArray) { + NSRange range = [totalString rangeOfString:rangeStr options:NSBackwardsSearch]; + if (color) { + [attributedStr addAttribute:NSForegroundColorAttributeName value:color range:range]; + } + if (font) { + [attributedStr addAttribute:NSFontAttributeName value:font range:range]; + } + } + + return attributedStr; +} + ++ (NSMutableAttributedString *)ls_changeFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString SubRangeArray:(NSArray *)subArray{ + NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:totalString]; + for (NSNumber *obj in subArray) { + if (color) { + [attributedStr addAttribute:NSForegroundColorAttributeName value:color range:obj.rangeValue]; + } + if (font) { + [attributedStr addAttribute:NSFontAttributeName value:font range:obj.rangeValue]; + } + } + return attributedStr; +} + ++(NSMutableAttributedString *)ls_changeLastLettersLFontAndColor:(UIFont *)font Color:(UIColor *)color TotalString:(NSString *)totalString{ + if (!totalString.length) {return [NSMutableAttributedString new];} + NSArray *range = [NSArray arrayWithObject:[NSValue valueWithRange:NSMakeRange(totalString.length-1, 1)]]; + return [self ls_changeFontAndColor:font Color:color TotalString:totalString SubRangeArray:range]; +} + ++ (NSMutableAttributedString *)ls_changePrefixString:(NSString *)prefixString PrefixFont:(UIFont *)prefixFont PrefixColor:(UIColor *)prefixColor SuffixesString:(NSString*)suffixesString SuffixesFont:(UIFont *)suffixesFont SuffixesColor:(UIColor *)suffixesColor{ + if (!prefixString.length) {return [NSMutableAttributedString new];} + NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:prefixString attributes:@{NSForegroundColorAttributeName: prefixColor,NSFontAttributeName : prefixFont}]; + if (suffixesString.length) { + NSMutableAttributedString *attributedStr2 = [[NSMutableAttributedString alloc] initWithString:suffixesString attributes:@{NSForegroundColorAttributeName: suffixesColor,NSFontAttributeName : suffixesFont}]; + [attributedStr appendAttributedString:attributedStr2]; + } + return attributedStr; +} +@end diff --git a/Ifish/Info.plist b/Ifish/Info.plist index 6a5dcef..566d548 100644 --- a/Ifish/Info.plist +++ b/Ifish/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 4.9.2 + 4.9.3 CFBundleSignature ???? CFBundleURLTypes diff --git a/Ifish/controllers/FishTinkController/centerPushcontrollers/SongBaoViewController.m b/Ifish/controllers/FishTinkController/centerPushcontrollers/SongBaoViewController.m index 263610c..3ad802f 100644 --- a/Ifish/controllers/FishTinkController/centerPushcontrollers/SongBaoViewController.m +++ b/Ifish/controllers/FishTinkController/centerPushcontrollers/SongBaoViewController.m @@ -21,6 +21,16 @@ @implementation SongBaoViewController +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + self.navigationController.navigationBar.translucent = YES; +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + self.navigationController.navigationBar.translucent = NO; +} + - (void)viewDidLoad { [super viewDidLoad]; [self creatWebView]; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h new file mode 100644 index 0000000..013c694 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.h @@ -0,0 +1,20 @@ +// +// Xuanduo2DataUtility.h +// Ifish +// +// Created by Alex on 2019/4/21. +// Copyright © 2019 lianlian. All rights reserved. +// + +#import +#import "Xuanduo2Model.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface Xuanduo2DataUtility : NSObject + ++(void)readSocketDataWithBackMsgModel:(Xuanduo2Model*)xuanduoModel addWithBackData:(NSData*)data; + +@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 new file mode 100644 index 0000000..b58c15d --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2DataUtility.m @@ -0,0 +1,32 @@ +// +// Xuanduo2DataUtility.m +// Ifish +// +// Created by Alex on 2019/4/21. +// Copyright © 2019 lianlian. All rights reserved. +// + +#import "Xuanduo2DataUtility.h" + +@implementation Xuanduo2DataUtility + ++(void)readSocketDataWithBackMsgModel:(Xuanduo2Model*)xuanduoModel addWithBackData:(NSData*)data{ + NSString *dataString = [dataContorl dataToHexString:data];// 转十六进制 + xuanduoModel.gasPump = [dataString substringWithRange:NSMakeRange(30, 4)]; + xuanduoModel.light1 = [dataString substringWithRange:NSMakeRange(34, 4)]; + xuanduoModel.light2 = [dataString substringWithRange:NSMakeRange(38, 4)]; + xuanduoModel.waterPump = [dataString substringWithRange:NSMakeRange(42, 4)]; + xuanduoModel.uvLamp = [dataString substringWithRange:NSMakeRange(46, 4)]; + xuanduoModel.waveMakingPump = [dataString substringWithRange:NSMakeRange(50, 4)]; + xuanduoModel.status = [dataString substringWithRange:NSMakeRange(54, 4)]; + xuanduoModel.heatStatus = [dataString substringWithRange:NSMakeRange(58, 2)]; + xuanduoModel.waterTemperature = [dataString substringWithRange:NSMakeRange(60, 4)]; + xuanduoModel.heatingTemperature = [dataString substringWithRange:NSMakeRange(64, 4)]; + xuanduoModel.huliLight = [dataString substringWithRange:NSMakeRange(68, 2)]; + xuanduoModel.electricity = [dataString substringWithRange:NSMakeRange(70, 4)]; + xuanduoModel.alarmSwitch = [dataString substringWithRange:NSMakeRange(74, 2)]; + xuanduoModel.miniTemp = [dataString substringWithRange:NSMakeRange(76, 4)]; + xuanduoModel.maxTemp = [dataString substringWithRange:NSMakeRange(80, 4)]; +} + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h new file mode 100644 index 0000000..1d634b6 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.h @@ -0,0 +1,73 @@ +// +// Xuanduo2Model.h +// Ifish +// +// Created by Alex on 2019/4/20. +// Copyright © 2019 lianlian. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +#if 0 +01 +08 +807d3a42a200 +807d3a42a200 +2c — 44字节 +0101 增氧 +0201 灯1 +0301 灯2 +0401 循环泵 +0501 杀菌 +0601 造浪 +0701 加热制冷 +01 加热控制状态 +00e1 水温 +00fa 加热温度 +00 护理灯开关 +007d 电量 +00 报警开关 +00c8 最低报警温度 +012c 最高报警温度 +bfec crc16校验码 +#endif + +@interface Xuanduo2Model : NSObject + +/// 增氧泵 -- 气泵 +@property (nonatomic, strong) NSString *gasPump; +/// 灯1 +@property (nonatomic, strong) NSString *light1; +/// 灯2 +@property (nonatomic, strong) NSString *light2; +/// 循环泵 -- 水泵 +@property (nonatomic, strong) NSString *waterPump; +/// 杀菌灯 +@property (nonatomic, strong) NSString *uvLamp; +/// 造浪泵 +@property (nonatomic, strong) NSString *waveMakingPump; +/// 加热制冷状态 +@property (nonatomic, strong) NSString *status; +/// 加热状态 +@property (nonatomic, strong) NSString *heatStatus; +/// 水温 +@property (nonatomic, strong) NSString *waterTemperature; +/// 加热温度 +@property (nonatomic, strong) NSString *heatingTemperature; +/// 护理灯开关 +@property (nonatomic, strong) NSString *huliLight; +/// 电量 +@property (nonatomic, strong) NSString *electricity; +/// 报警开关 +@property (nonatomic, strong) NSString *alarmSwitch; +/// 最低温 +@property (nonatomic, strong) NSString *miniTemp; +/// 最高温 +@property (nonatomic, strong) NSString *maxTemp; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.m new file mode 100644 index 0000000..e0cd9b8 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2Model.m @@ -0,0 +1,13 @@ +// +// Xuanduo2Model.m +// Ifish +// +// Created by Alex on 2019/4/20. +// Copyright © 2019 lianlian. All rights reserved. +// + +#import "Xuanduo2Model.h" + +@implementation Xuanduo2Model + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m index 6edc090..8bbf873 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m @@ -14,10 +14,16 @@ #import "IfishDataUnity.h" #import "XuToSetViewController.h" #import "CreatErWeiMaController.h" +#import "SongBaoViewController.h" #import "XuToControlName.h" #import "UserExtendataArchaver.h" +#import "UIButton+WebCache.h" +#import "NSString+Add.h" +#import "Xuanduo2DataUtility.h" -@interface Xuanduo2fController () +#define kBtnTag 100 + +@interface Xuanduo2fController () @property(nonatomic,strong) DXPopover *popover; @property (weak, nonatomic) IBOutlet UIView *positionView; @property (weak, nonatomic) IBOutlet UILabel *shajunLight; @@ -28,6 +34,12 @@ @property (weak, nonatomic) IBOutlet UILabel *huliLabel; @property (weak, nonatomic) IBOutlet UILabel *xunhuanLabel; @property (weak, nonatomic) IBOutlet UILabel *jiareLabel; +@property (weak, nonatomic) IBOutlet UIButton *brandBtn; +@property (weak, nonatomic) IBOutlet UILabel *brandName; +@property (nonatomic ,strong) Xuanduo2Model *dataModel; +@property (weak, nonatomic) IBOutlet UILabel *tempLabel; +@property (weak, nonatomic) IBOutlet UILabel *tipLabel; +@property (nonatomic, strong) NSTimer *switchTimer; @end @@ -41,6 +53,7 @@ - (void)viewDidLoad { [super viewDidLoad]; [self setup]; + [self connect]; // Do any additional setup after loading the view from its nib. } @@ -52,53 +65,135 @@ [rightPopButton setImage:MyEquipmentImage forState:UIControlStateNormal]; rightPopButton.frame=CGRectMake(kScreenWidth-60,0,60,44); [rightPopButton setImageEdgeInsets:UIEdgeInsetsMake(0, 30, 0, 0)]; - [rightPopButton addTarget:self action:@selector(presentPopView) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightPopButton]; self.navigationItem.rightBarButtonItem =rightItem; + //品牌展示 + [_brandBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,self.currentDevice.logo]] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"brandLogo_hold"]]; + _brandName.text = self.currentDevice.brandName; [self initCHNames]; + [Socketsingleton sharedInstance].communiteDelegate = self; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tempSwitch)]; + [self.tempLabel addGestureRecognizer:tap]; +} + +- (void)connect { + if ([self.currentDevice.isBlacklist isEqualToString:@"0"]) { + [self InitSocket];//允许请求数据 + } +} + +#pragma mark - 连接socket +-(void)InitSocket{ + NSLog(@"******%d",[Socketsingleton sharedInstance].clientSocket.isConnected); + if (![Socketsingleton sharedInstance].clientSocket.isConnected) { + + //[[Socketsingleton sharedInstance]; + } + // 切换设备 先断开然后重连 + [[Socketsingleton sharedInstance] socketConnectHost]; + [Socketsingleton sharedInstance].macAddress = self.currentDevice.macAddress; +} + +#pragma mark 通信监听communiteDelegate + +//当已经和服务端断开连接后调用该代理方法 +//断线重连功能需要在这里进行 + +-(void)ifishSocketDidDisconnect:(AsyncSocket *)sock{ + + +} + +-(void)ifishSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err{ + // NSLog(@"soket错误断开"); + // NSLog(@"存留数据%@",[sock unreadData]); + +} + +-(BOOL)ifishSocketWillConnect:(AsyncSocket *)sock{ + + // NSLog(@"将要链接"); + return YES; + +} + +#pragma mark 当已经与服务端建立连接后调用的代理方法 + + +-(void)ifishSocket:(AsyncSocket *)sock ifishSocketdidConnectToHost:(NSString *)host port:(UInt16)port{ + //已建立连接 登陆指令同意在soket单例中 + +} + +//发送完成处理 + +-(void)ifishSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag{ + +} + +#pragma mark 登陆成功后收到服务端的回执之后,调用的代理方法 + +//父类里面不执行此方法 接收服务器返回信息 在子类中做处理 + +//communiteDelegate + +-(void)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock{ + [Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data]; + if ([self.tipLabel.text isEqualToString:@"当月电量"]) { + [self setTemperature]; + } +} +-(void)ifishDeviceLogInFail{ + +} + +-(void)ifishDeviceLogInSuccees{ + +} + +-(void)ifishSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket{ + +} + +#pragma mark -- actions -- + +- (IBAction)btnActions:(UIButton *)sender { + sender.selected = !sender.selected; + switch (sender.tag) { + case kBtnTag: //杀菌灯 + + break; + case kBtnTag + 1: + default: + break; + } +} + +- (IBAction)brandClick:(id)sender { + SongBaoViewController *brand = [[SongBaoViewController alloc]init]; + brand.brandIntroduce = self.currentDevice.brandIntroduce; + [self.navigationController pushViewController:brand animated:YES]; + self.navigationController.navigationBarHidden=NO; +} + +- (void)tempSwitch { + if ([self.tipLabel.text isEqualToString:@"当月电量"]) { + + }else { + self.tipLabel.text = @"当月电量"; + 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"]]]; + } } -#pragma -- actions -- - (void)goBackAction{ [[Socketsingleton sharedInstance] cutOffSocket]; [[IfishDataUnity shareDataInstance] setAppTabRoot]; } -- (IBAction)shajunAction:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)zengyangAction:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)dengguang1Action:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)dengguang2Action:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)zaoyangAction:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)huliAction:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)xunhuanAction:(UIButton*)sender { - sender.selected = !sender.selected; -} - -- (IBAction)jiareAction:(UIButton*)sender { - sender.selected = !sender.selected; -} - --(void)presentPopView{ - +- (void)presentPopView{ UIImage *image = [UIImage imageNamed:@"popover_background_image_notrangle"]; NSArray *titleImgs = nil; @@ -156,6 +251,15 @@ #pragma mark - 修改设备名 +- (void)setTemperature { + UInt64 mac = [dataContorl hexToTen:self.dataModel.waterTemperature]; + NSLog(@"%llu",mac); + //float TPlabel=mac/10+(mac%10)*0.1; + float temp = mac/10; + NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp]; + [self.tempLabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"℃"]]]; +} + -(void)shezhiMingCheng{ XuToControlNameViewController *_changeNameVC = [[XuToControlNameViewController alloc] init]; _changeNameVC.isNewdevice = YES; @@ -169,6 +273,7 @@ [ wself.navigationController pushViewController: _changeNameVC animated:YES]; } +/// 各种控制旋钮标题显示 -(void)initCHNames{ XuToControlName *name = [UserExtendataArchaver currentNewXuToControlName:self.currentDevice.macAddress]; @@ -322,5 +427,16 @@ } +- (Xuanduo2Model *)dataModel { + if (!_dataModel) { + _dataModel = [Xuanduo2Model new]; + } + return _dataModel; +} + +- (void)dealloc { + +} + @end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib index 3b89cb1..a3eb8be 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.xib @@ -1,6 +1,6 @@ - + @@ -12,12 +12,16 @@ + + + + @@ -26,14 +30,14 @@ - + - + - + @@ -42,143 +46,143 @@ - - - - - - - - - @@ -213,11 +234,13 @@ + + @@ -236,6 +259,7 @@ + @@ -261,6 +285,7 @@ + @@ -294,6 +319,7 @@ + @@ -302,7 +328,7 @@ - + diff --git a/Ifish/controllers/IfishTabControllers/探索/IfishLive/IfishLivelist/IfishP2PLivePlayViewController.m b/Ifish/controllers/IfishTabControllers/探索/IfishLive/IfishLivelist/IfishP2PLivePlayViewController.m index d79b656..cf71fb7 100644 --- a/Ifish/controllers/IfishTabControllers/探索/IfishLive/IfishLivelist/IfishP2PLivePlayViewController.m +++ b/Ifish/controllers/IfishTabControllers/探索/IfishLive/IfishLivelist/IfishP2PLivePlayViewController.m @@ -20,7 +20,6 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - [self addTitleViewWithTitle:@"分享中"]; //自定义封装播放器 由于xib创建OPGLview 无法显示(暂未找到方法)暂时不用 纯代码建UI可以试试 //[self setupVideoPlayView]; @@ -32,9 +31,14 @@ } +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + self.navigationController.navigationBar.translucent = YES; +} + -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; - + self.navigationController.navigationBar.translucent = NO; } -(void)resetBootomView{