From df311d475cfce631131a4bbe7347f9fa9765cc4d Mon Sep 17 00:00:00 2001 From: xuemh Date: Mon, 23 Apr 2018 00:41:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BA=E7=BD=AE=E9=A1=B5=E9=9D=A2=E5=92=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E8=B0=83=E8=AF=95=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ifish.xcodeproj/project.pbxproj | 54 + .../DataCenter/UserExtendataArchaver.h | 6 + .../DataCenter/UserExtendataArchaver.m | 14 + .../IfishHttpRequest/IfishDataUnity.h | 2 + .../IfishHttpRequest/IfishDataUnity.m | 9 + Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h | 2 + .../RuiMei/RuiMeiBackMsgUtils.h | 45 + .../RuiMei/RuiMeiBackMsgUtils.m | 232 ++++ .../RuiMei/RuiMeiCHControl.h | 18 + .../RuiMei/RuiMeiCHControl.m | 36 + .../RuiMei/RuiMeiCHNameCustom.h | 17 + .../RuiMei/RuiMeiCHNameCustom.m | 36 + .../RuiMei/RuiMeiProtocolModel.h | 37 + .../RuiMei/RuiMeiProtocolModel.m | 13 + .../RuiMei/RuiMeiSetViewController.h | 28 + .../RuiMei/RuiMeiSetViewController.m | 1157 +++++++++++++++++ .../RuiMei/RuiMeiViewController.h | 32 + .../RuiMei/RuiMeiViewController.m | 609 +++++++++ Ifish/ifishImgSouce/.DS_Store | Bin 10244 -> 10244 bytes Ifish/views/setViewCell/CustomModeSetCell.h | 17 + Ifish/views/setViewCell/CustomModeSetCell.m | 33 + Ifish/views/setViewCell/CustomModeSetCell.xib | 61 + .../views/setViewCell/TemperatureSetCell.xib | 24 +- 23 files changed, 2472 insertions(+), 10 deletions(-) create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.m create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.m create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.m create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.m create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.m create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiViewController.h create mode 100644 Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiViewController.m create mode 100644 Ifish/views/setViewCell/CustomModeSetCell.h create mode 100644 Ifish/views/setViewCell/CustomModeSetCell.m create mode 100644 Ifish/views/setViewCell/CustomModeSetCell.xib diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index a38f4d7..70909c8 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2453,11 +2453,19 @@ 88F5EFF01D48D08100CC7CAF /* split.c in Sources */ = {isa = PBXBuildFile; fileRef = 88F5EF8E1D48D08100CC7CAF /* split.c */; }; 88F5EFF11D48D08100CC7CAF /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 88F5EFA81D48D08100CC7CAF /* libzbar.a */; }; 88F740C01ECC28E800876AED /* ShopAddGoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F740BF1ECC28E800876AED /* ShopAddGoodsViewController.m */; }; + E51D7D4B208CD528001FF053 /* RuiMeiCHNameCustom.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D4A208CD528001FF053 /* RuiMeiCHNameCustom.m */; }; + E51D7D4E208CD5C8001FF053 /* RuiMeiCHControl.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D4D208CD5C8001FF053 /* RuiMeiCHControl.m */; }; + E51D7D51208CDB5B001FF053 /* RuiMeiSetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D50208CDB5B001FF053 /* RuiMeiSetViewController.m */; }; + E51D7D55208CE08D001FF053 /* CustomModeSetCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E51D7D53208CE08D001FF053 /* CustomModeSetCell.m */; }; + E51D7D58208CE121001FF053 /* CustomModeSetCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E51D7D57208CE120001FF053 /* CustomModeSetCell.xib */; }; E547870B20728F390060C2C2 /* back_btn@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E547870A20728F380060C2C2 /* back_btn@2x.png */; }; E547870F2073192E0060C2C2 /* introlImage_iphonex_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870C2073192D0060C2C2 /* introlImage_iphonex_1.jpg */; }; E54787102073192E0060C2C2 /* introlImage_iphonex_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */; }; E54787112073192E0060C2C2 /* introlImage_iphonex_3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870E2073192E0060C2C2 /* introlImage_iphonex_3.jpg */; }; E58C9980208189780004C42B /* back_btn_1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E58C997F208189780004C42B /* back_btn_1@2x.png */; }; + E58C9984208195640004C42B /* RuiMeiViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E58C9983208195640004C42B /* RuiMeiViewController.m */; }; + E58C99872081A3BA0004C42B /* RuiMeiProtocolModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E58C99862081A3BA0004C42B /* RuiMeiProtocolModel.m */; }; + E58C998A2081A6930004C42B /* RuiMeiBackMsgUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = E58C99892081A6930004C42B /* RuiMeiBackMsgUtils.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -6217,11 +6225,26 @@ 88F5EFA81D48D08100CC7CAF /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; 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 = ""; }; + E51D7D49208CD528001FF053 /* RuiMeiCHNameCustom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiCHNameCustom.h; sourceTree = ""; }; + E51D7D4A208CD528001FF053 /* RuiMeiCHNameCustom.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiCHNameCustom.m; sourceTree = ""; }; + E51D7D4C208CD5C8001FF053 /* RuiMeiCHControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiCHControl.h; sourceTree = ""; }; + E51D7D4D208CD5C8001FF053 /* RuiMeiCHControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiCHControl.m; sourceTree = ""; }; + E51D7D4F208CDB5B001FF053 /* RuiMeiSetViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiSetViewController.h; sourceTree = ""; }; + E51D7D50208CDB5B001FF053 /* RuiMeiSetViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiSetViewController.m; sourceTree = ""; }; + E51D7D52208CE08D001FF053 /* CustomModeSetCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomModeSetCell.h; sourceTree = ""; }; + E51D7D53208CE08D001FF053 /* CustomModeSetCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomModeSetCell.m; sourceTree = ""; }; + E51D7D57208CE120001FF053 /* CustomModeSetCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomModeSetCell.xib; sourceTree = ""; }; E547870A20728F380060C2C2 /* back_btn@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_btn@2x.png"; sourceTree = ""; }; E547870C2073192D0060C2C2 /* introlImage_iphonex_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_1.jpg; sourceTree = ""; }; E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_2.jpg; sourceTree = ""; }; E547870E2073192E0060C2C2 /* introlImage_iphonex_3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_3.jpg; sourceTree = ""; }; E58C997F208189780004C42B /* back_btn_1@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_btn_1@2x.png"; sourceTree = ""; }; + E58C9982208195640004C42B /* RuiMeiViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiViewController.h; sourceTree = ""; }; + E58C9983208195640004C42B /* RuiMeiViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiViewController.m; sourceTree = ""; }; + E58C99852081A3BA0004C42B /* RuiMeiProtocolModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiProtocolModel.h; sourceTree = ""; }; + E58C99862081A3BA0004C42B /* RuiMeiProtocolModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiProtocolModel.m; sourceTree = ""; }; + E58C99882081A6930004C42B /* RuiMeiBackMsgUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuiMeiBackMsgUtils.h; sourceTree = ""; }; + E58C99892081A6930004C42B /* RuiMeiBackMsgUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RuiMeiBackMsgUtils.m; sourceTree = ""; }; E5C644C0206BBD7100C558D5 /* CommonMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonMacros.h; sourceTree = ""; }; /* End PBXFileReference section */ @@ -8894,6 +8917,7 @@ 883E76621D48A5E50030E075 /* CenterontrolControllers */ = { isa = PBXGroup; children = ( + E58C9981208195350004C42B /* RuiMei */, 881B12411E1CCC5E004C074B /* JuNeng */, 889C25E31E1B7CD9004F745D /* RuSunTemp */, 883E76631D48A5E50030E075 /* FourControl */, @@ -9893,6 +9917,9 @@ 883E799C1D48B0280030E075 /* TemperatureSetCell.h */, 883E799D1D48B0280030E075 /* TemperatureSetCell.m */, 883E799E1D48B0280030E075 /* TemperatureSetCell.xib */, + E51D7D52208CE08D001FF053 /* CustomModeSetCell.h */, + E51D7D53208CE08D001FF053 /* CustomModeSetCell.m */, + E51D7D57208CE120001FF053 /* CustomModeSetCell.xib */, ); path = setViewCell; sourceTree = ""; @@ -13733,6 +13760,25 @@ path = zbar; sourceTree = ""; }; + E58C9981208195350004C42B /* RuiMei */ = { + isa = PBXGroup; + children = ( + E58C99852081A3BA0004C42B /* RuiMeiProtocolModel.h */, + E58C99862081A3BA0004C42B /* RuiMeiProtocolModel.m */, + E58C99882081A6930004C42B /* RuiMeiBackMsgUtils.h */, + E58C99892081A6930004C42B /* RuiMeiBackMsgUtils.m */, + E58C9982208195640004C42B /* RuiMeiViewController.h */, + E58C9983208195640004C42B /* RuiMeiViewController.m */, + E51D7D49208CD528001FF053 /* RuiMeiCHNameCustom.h */, + E51D7D4A208CD528001FF053 /* RuiMeiCHNameCustom.m */, + E51D7D4C208CD5C8001FF053 /* RuiMeiCHControl.h */, + E51D7D4D208CD5C8001FF053 /* RuiMeiCHControl.m */, + E51D7D4F208CDB5B001FF053 /* RuiMeiSetViewController.h */, + E51D7D50208CDB5B001FF053 /* RuiMeiSetViewController.m */, + ); + path = RuiMei; + sourceTree = ""; + }; E5C644BF206BBD5F00C558D5 /* Common */ = { isa = PBXGroup; children = ( @@ -14630,6 +14676,7 @@ 88742C2F1D63F9AB0074F1F8 /* CertifyListViewFirstCell.xib in Resources */, 883E783C1D48A5E50030E075 /* StoreViewController.xib in Resources */, 880708041DE812B30076F65A /* live_sharechat_iocn@2x.png in Resources */, + E51D7D58208CE121001FF053 /* CustomModeSetCell.xib in Resources */, 882956A61DBDA3A200E9DDD7 /* community_left@2x.png in Resources */, 883E79181D48A74F0030E075 /* scanscanBg.png in Resources */, 8871C4981E6D507B000AA49F /* signin_condition_await@3x.png in Resources */, @@ -15361,6 +15408,7 @@ 8815D1321DFAADC300BEA2DA /* IfishCameraRecordThirdCell.m in Sources */, 887001CF1D794D7B00668C8C /* KanHuViewLastCell.m in Sources */, 886D15831E605EEF0085F7D6 /* CustomeLabel.m in Sources */, + E51D7D55208CE08D001FF053 /* CustomModeSetCell.m in Sources */, 8860286E1E10BB1100F3DB5D /* NSBundle+CTAssetsPickerController.m in Sources */, 883E78531D48A5E50030E075 /* TwoControlNinetyninebiteViewController.m in Sources */, 88F5EFDA1D48D08100CC7CAF /* Reachability.m in Sources */, @@ -15560,6 +15608,7 @@ 883E76311D4897570030E075 /* ShopModel.m in Sources */, 88613F711E5C1E86008D2C69 /* IfishFeedListData.m in Sources */, 883E76221D4897570030E075 /* ChatViewModel.m in Sources */, + E51D7D4B208CD528001FF053 /* RuiMeiCHNameCustom.m in Sources */, 88602F711E12002600F3DB5D /* NTESSessionJankenponContentView.m in Sources */, 88602F821E12002600F3DB5D /* NTESNotificationCenter.m in Sources */, 882A760C1EBB27BE00AD1D15 /* ShopCerPart1InfoViewCell.m in Sources */, @@ -15660,6 +15709,7 @@ 881671A51EA5DE2B00BEBF23 /* UMComLikeListDataController.m in Sources */, 88597AC21E56BAF1003D0E5C /* WFTailoringViewController.m in Sources */, 882957FD1DC0443600E9DDD7 /* IfishCardScrollView.m in Sources */, + E51D7D4E208CD5C8001FF053 /* RuiMeiCHControl.m in Sources */, 883E78A01D48A5E50030E075 /* ShotScreenImgViewController.m in Sources */, 88602DB81E10D97E00F3DB5D /* SDWebImagePrefetcher.m in Sources */, 88602F5B1E12002600F3DB5D /* NTESSystemNotificationViewController.m in Sources */, @@ -15875,6 +15925,7 @@ 8867C8761D49B6BC0029F1FA /* TabBarDeviceShouYeCell.m in Sources */, 8815D1281DFAACED00BEA2DA /* IfishCameraRecordfirstCell.m in Sources */, 885979E21E52E38E003D0E5C /* MinekanHuNotSelectShopController.m in Sources */, + E58C998A2081A6930004C42B /* RuiMeiBackMsgUtils.m in Sources */, 88602DB41E10D97E00F3DB5D /* SDWebImageDecoder.m in Sources */, 8815D13C1DFF892A00BEA2DA /* CameraNoParyBackVideoView.m in Sources */, 889133391ECEB97D00F52EBC /* VideoEditeNameViewCell.m in Sources */, @@ -15925,6 +15976,7 @@ 8816721B1EA5DE2B00BEBF23 /* UMComSimplicityDiscoverViewController.m in Sources */, 88C5989D1EA0965B00BDC812 /* LBLaunchImageAdView.m in Sources */, 88602A551E10BC3500F3DB5D /* NIMSessionListViewController.m in Sources */, + E58C9984208195640004C42B /* RuiMeiViewController.m in Sources */, 881A1D051DD2B9F200BA1AF4 /* WoDeKanKanViewController.m in Sources */, 886E6A551D893870009C7724 /* SVIndefiniteAnimatedView.m in Sources */, 88602A2C1E10BC3500F3DB5D /* NIMInputView.m in Sources */, @@ -16046,6 +16098,7 @@ 883E76261D4897570030E075 /* DeviceCameraModel.m in Sources */, 88602F571E12002600F3DB5D /* NTESCustomSysNotificationViewController.m in Sources */, 8875B4FB1EDFA406000FAE93 /* RunSun84Protocol.m in Sources */, + E58C99872081A3BA0004C42B /* RuiMeiProtocolModel.m in Sources */, 881671C31EA5DE2B00BEBF23 /* UMComViewController.m in Sources */, 883E785D1D48A5E50030E075 /* XuToWenDuPicview.m in Sources */, 880707F51DE302630076F65A /* LXActionView.m in Sources */, @@ -16234,6 +16287,7 @@ 88602A1B1E10BC3400F3DB5D /* NIMContactDataCell.m in Sources */, 88696FBD1E9C7215005D4AFB /* MemberDetailViewController.m in Sources */, 8816722C1EA5DE2B00BEBF23 /* UMComSimpleFeedTableViewController.m in Sources */, + E51D7D51208CDB5B001FF053 /* RuiMeiSetViewController.m in Sources */, 88602F8B1E12002600F3DB5D /* NTESBadgeView.m in Sources */, 885692B41E82413200C51617 /* IfishBannerData.m in Sources */, 881672091EA5DE2B00BEBF23 /* UMComiToast.m in Sources */, diff --git a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h index 7f392e9..eb90ab6 100644 --- a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h +++ b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.h @@ -15,7 +15,13 @@ #import "ThreeControlName.h" #import "FourControlName.h" #import "XuToControlName.h" +#import "RuiMeiCHControl.h" + @interface UserExtendataArchaver : NSObject +//自定义水族箱名字数据 ++(void)archiverRuiMeiDeviceCHInfo:(RuiMeiCHControl*)ch; ++(RuiMeiCHControl*)unArchiverRuiMeiDeviceCHInfo:(NSString *)mac; + //自定义水族箱名字数据 +(void)archiverDeviceCHInfo:(RunSunCHControl*)ch; +(RunSunCHControl*)unArchiverDeviceCHInfo:(NSString *)mac; diff --git a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m index e800a43..e80feed 100644 --- a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m +++ b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m @@ -9,6 +9,20 @@ #import "UserExtendataArchaver.h" @implementation UserExtendataArchaver + ++(void)archiverRuiMeiDeviceCHInfo:(RuiMeiCHControl*)ch { + NSString *key = [NSString stringWithFormat:@"Ruimei%@",ch.macAd]; + NSString *file = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:key]; + [NSKeyedArchiver archiveRootObject:ch toFile:file]; +} + ++(RuiMeiCHControl*)unArchiverRuiMeiDeviceCHInfo:(NSString *)mac { + NSString *key = [NSString stringWithFormat:@"Ruimei%@",mac]; + NSString *file = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:key]; + RuiMeiCHControl *ch = [NSKeyedUnarchiver unarchiveObjectWithFile:file]; + return ch; +} + +(void)archiverDeviceCHInfo:(RunSunCHControl*)ch { NSString *key = [NSString stringWithFormat:@"Rusun%@",ch.macAd]; diff --git a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.h b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.h index 9259ece..0cef2bf 100644 --- a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.h +++ b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.h @@ -19,6 +19,8 @@ #import "RuSunHaveHeateViewController.h" #import "SongNuoDBCenterViewController.h" #import "RunSun84biteCenterViewController.h" +#import "RuiMeiViewController.h" + //默认选中 下表类型 //typedef NS_ENUM (NSInteger,saveIndexType){ // diff --git a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m index 86feaba..c4c88df 100644 --- a/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m +++ b/Ifish/Utinitys/IfishHttpRequest/IfishDataUnity.m @@ -140,6 +140,15 @@ [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault]; app1.window.rootViewController=nav; + } else if ([devicemodel.type isEqualToString:DECICE_TYPE_RUIMEI]) { + RuiMeiViewController *ruimeiCenter=[[RuiMeiViewController alloc] init]; + ruimeiCenter.currentDevice = devicemodel; + UIApplication*app=[UIApplication sharedApplication]; + AppDelegate*app1=(AppDelegate*)app.delegate; + UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:ruimeiCenter]; + [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault]; + app1.window.rootViewController=nav; + }else{ int controlAmount=[devicemodel.controlAmount intValue]; diff --git a/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h b/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h index b47c6e8..58899b6 100644 --- a/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h +++ b/Ifish/Utinitys/IfishUtils/IfishDeviceInfo.h @@ -46,5 +46,7 @@ //睿芯 独立 84 字节 #define DECICE_TYPE_RUSUN2A @"2a" //0x2a +//瑞美4控 +#define DECICE_TYPE_RUIMEI @"2b" #endif /* IfishDeviceInfo_h */ diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.h new file mode 100644 index 0000000..c2dad5a --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.h @@ -0,0 +1,45 @@ +// +// RuiMeiBackMsgUtils.h +// Ifish +// +// Created by Minghao Xue on 2018/4/14. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import +#import "RuiMeiProtocolModel.h" + +#define DataCenterRuiMeiModelKey @"DataCenterRuiMeiModelKey" + +@interface RuiMeiBackMsgUtils : NSObject + +/** + * save soket massage control + */ ++(void)readSoketDataWithBaackMassgModel:(RuiMeiProtocolModel*)ruSunModel + addWithBackData:(NSData*)data; + +/** + * setTemperaturelabel + */ ++(void)setTemperaturelabel:(UILabel*)temperaturelabel + addbubleImge:(UIImageView*)bubleImg + WithBackData:(NSData*)data + addWithBackMassageModel:(RuiMeiProtocolModel*)backModel + addWithTableview:(UITableView*)tableview; +/** + * light state + */ + ++(void)resetRuSunCHState:(UIButton*)ch1 + ch2:(UIButton*)ch2 + ch3:(UIButton*)ch3 + ch4:(UIButton*)ch4 + andJiaRe:(UIButton*)jiaReBang + withBackModel:(RuiMeiProtocolModel*)backModel; +/** + * refresh setViewData + */ ++(NSArray*)refreshRuSunTimerAddTemperatureWithBackMassageModel:(RuiMeiProtocolModel*)backModel; + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.m new file mode 100644 index 0000000..eaabd7a --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiBackMsgUtils.m @@ -0,0 +1,232 @@ +// +// RuiMeiBackMsgUtils.m +// Ifish +// +// Created by Minghao Xue on 2018/4/14. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "RuiMeiBackMsgUtils.h" + +@implementation RuiMeiBackMsgUtils + ++(void)readSoketDataWithBaackMassgModel:(RuiMeiProtocolModel*)ruSunModel + addWithBackData:(NSData*)data +{ + + NSString*totalString=[dataContorl dataToHexString:data]; + //无运行模式 + ruSunModel.ch1=[totalString substringWithRange:NSMakeRange(30, 4)]; + ruSunModel.ch2=[totalString substringWithRange:NSMakeRange(34, 4)]; + ruSunModel.ch3 = [totalString substringWithRange:NSMakeRange(38, 4)]; + ruSunModel.ch4 = [totalString substringWithRange:NSMakeRange(42, 4)]; + ruSunModel.customModel = [totalString substringWithRange:NSMakeRange(46, 4)]; + ruSunModel.timer1=[totalString substringWithRange:NSMakeRange(50,12)]; + ruSunModel.timer2=[totalString substringWithRange:NSMakeRange(62, 12)]; + ruSunModel.timer3=[totalString substringWithRange:NSMakeRange(74, 12)]; + ruSunModel.timer4=[totalString substringWithRange:NSMakeRange(86, 12)]; + ruSunModel.timer5=[totalString substringWithRange:NSMakeRange(98, 12)]; + ruSunModel.timer6=[totalString substringWithRange:NSMakeRange(110, 12)]; + ruSunModel.timer7=[totalString substringWithRange:NSMakeRange(122, 12)]; + ruSunModel.timer8=[totalString substringWithRange:NSMakeRange(134, 12)]; + ruSunModel.heatStickState=[totalString substringWithRange:NSMakeRange(146, 2)];//16进制型 + ruSunModel.wendu=[totalString substringWithRange:NSMakeRange(148, 4)]; + ruSunModel.heatTemperature=[totalString substringWithRange:NSMakeRange(152, 4)]; + ruSunModel.shiwen = [totalString substringWithRange:NSMakeRange(156, 4)]; + ruSunModel.baojingSwitch=[totalString substringWithRange:NSMakeRange(160, 2)]; + ruSunModel.miniTp=[totalString substringWithRange:NSMakeRange(162, 4)]; + ruSunModel.maxTp=[totalString substringWithRange:NSMakeRange(166, 4)]; + ruSunModel.funcCode= [totalString substringWithRange:NSMakeRange(170, 4)]; + [[DataCenter defaultDtacenter] setValue:ruSunModel forKey:DataCenterRuiMeiModelKey]; + +} + ++(void)setTemperaturelabel:(UILabel*)temperaturelabel + addbubleImge:(UIImageView*)bubleImg + WithBackData:(NSData*)data + addWithBackMassageModel:(RuiMeiProtocolModel*)backModel + addWithTableview:(UITableView*)tableview +{ + + + NSString*str=[dataContorl dataToHexString:data]; + str=[str substringWithRange:NSMakeRange(148,4)]; + UInt64 mac=[dataContorl hexToTen:str]; + float TPlabel=mac/10+(mac%10)*0.1; + NSString *stringFloat = [NSString stringWithFormat:@"%.1f",TPlabel]; + NSLog(@"%@",stringFloat); + dispatch_async(dispatch_get_main_queue(), ^{ + if (mac==0) { + + temperaturelabel.text=@"00.0"; + + }else{ + + temperaturelabel.text=stringFloat; + } + }); +} ++(void)resetRuSunCHState:(UIButton*)ch1 + ch2:(UIButton*)ch2 + ch3:(UIButton*)ch3 + ch4:(UIButton*)ch4 + andJiaRe:(UIButton*)jiaReBang + withBackModel:(RuiMeiProtocolModel*)backModel +{ + + // ch1 + + NSString*stateString1=[backModel.ch1 substringWithRange:NSMakeRange(2, 2)]; + + if ([stateString1 isEqualToString:@"01"]) { + [ch1 setImage:[UIImage imageNamed:@"PFLight1_on"] forState:UIControlStateNormal]; + ch1.selected=YES; + }else{ + [ch1 setImage:[UIImage imageNamed:@"PFLight1_off"] forState:UIControlStateNormal]; + ch1.selected=NO; + + } + // ch2 + + NSString*stateString2=[backModel.ch2 substringWithRange:NSMakeRange(2, 2)]; + + if ([stateString2 isEqualToString:@"01"]) { + [ch2 setImage:[UIImage imageNamed:@"PFLight1_on"] forState:UIControlStateNormal]; + ch2.selected=YES; + }else{ + [ch2 setImage:[UIImage imageNamed:@"PFLight1_off"] forState:UIControlStateNormal]; + ch2.selected=NO; + } + + // ch3 + + NSString*stateString3=[backModel.ch3 substringWithRange:NSMakeRange(2, 2)]; + + if ([stateString3 isEqualToString:@"01"]){ + + [ch3 setImage:[UIImage imageNamed:@"PFkilLlight_on"] forState:UIControlStateNormal]; + ch3.selected=YES; + + }else{ + [ch3 setImage:[UIImage imageNamed:@"PFkilLlight_off"] forState:UIControlStateNormal]; + ch3.selected=NO; + + } + + // ch4 + + NSString*stateString4=[backModel.ch4 substringWithRange:NSMakeRange(2, 2)]; + + if ([stateString4 isEqualToString:@"01"]){ + + [ch4 setImage:[UIImage imageNamed:@"O2_on"] forState:UIControlStateNormal]; + ch4.selected=YES; + + }else{ + [ch4 setImage:[UIImage imageNamed:@"O2_off"] forState:UIControlStateNormal]; + ch4.selected=NO; + + } + + // 加热制冷 状态 1字节 + NSString*stateString6=[backModel.heatStickState substringWithRange:NSMakeRange(0, 2)]; + + if ([stateString6 isEqualToString:@"01"]){ + //加热 + [jiaReBang setImage:[UIImage imageNamed:@"JiaReBang_on"] forState:UIControlStateNormal]; + jiaReBang.selected=YES; + + }else{ + //制冷 + + [jiaReBang setImage:[UIImage imageNamed:@"JiaReBang_off"] forState:UIControlStateNormal]; + jiaReBang.selected=NO; + + } + +} + ++(NSArray*)refreshRuSunTimerAddTemperatureWithBackMassageModel:(RuiMeiProtocolModel*)backModel +{ + NSArray*timerArr=[[NSArray alloc]init]; + NSString*low=backModel.miniTp; + NSString*heigh=backModel.maxTp; + UInt64 lowten=[dataContorl hexToTen:low]; + UInt64 heighten=[dataContorl hexToTen:heigh]; + float formatlow=lowten/10; + float formatheigh=heighten/10; + + NSString*wenduString=[NSString stringWithFormat:@"%.0f~%.0f°C",formatlow,formatheigh]; + + // 十六进制 + NSString*startTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(8, 4)]; + + // 十进制 + NSString*startTimeTen1=[dataContorl hexStringToDateString:startTimeHex1]; + NSString*endTimeTen1=[dataContorl hexStringToDateString:endTimeHex1]; + NSString*setTim1=[NSString stringWithFormat:@"%@~%@",startTimeTen1,endTimeTen1]; + // 十六进制 + NSString*startTimeHex2=[backModel.timer2 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex2=[backModel.timer2 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen2=[dataContorl hexStringToDateString:startTimeHex2]; + NSString*endTimeTen2=[dataContorl hexStringToDateString:endTimeHex2]; + NSString*setTim2=[NSString stringWithFormat:@"%@~%@",startTimeTen2,endTimeTen2]; + + // 十六进制 + NSString*startTimeHex3=[backModel.timer3 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex3=[backModel.timer3 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen3=[dataContorl hexStringToDateString:startTimeHex3]; + NSString*endTimeTen3=[dataContorl hexStringToDateString:endTimeHex3]; + NSString*setTim3=[NSString stringWithFormat:@"%@~%@",startTimeTen3,endTimeTen3]; + + // 十六进制 + NSString*startTimeHex4=[backModel.timer4 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex4=[backModel.timer4 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen4=[dataContorl hexStringToDateString:startTimeHex4]; + NSString*endTimeTen4=[dataContorl hexStringToDateString:endTimeHex4]; + NSString*setTim4=[NSString stringWithFormat:@"%@~%@",startTimeTen4,endTimeTen4]; + + // 十六进制 + NSString*startTimeHex5=[backModel.timer5 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex5=[backModel.timer5 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen5=[dataContorl hexStringToDateString:startTimeHex5]; + NSString*endTimeTen5=[dataContorl hexStringToDateString:endTimeHex5]; + NSString*setTim5=[NSString stringWithFormat:@"%@~%@",startTimeTen5,endTimeTen5]; + + // 十六进制 + NSString*startTimeHex6=[backModel.timer6 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex6=[backModel.timer6 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen6=[dataContorl hexStringToDateString:startTimeHex6]; + NSString*endTimeTen6=[dataContorl hexStringToDateString:endTimeHex6]; + NSString*setTim6=[NSString stringWithFormat:@"%@~%@",startTimeTen6,endTimeTen6]; + + // 十六进制 + NSString*startTimeHex7=[backModel.timer7 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex7=[backModel.timer7 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen7=[dataContorl hexStringToDateString:startTimeHex7]; + NSString*endTimeTen7=[dataContorl hexStringToDateString:endTimeHex7]; + NSString*setTim7=[NSString stringWithFormat:@"%@~%@",startTimeTen7,endTimeTen7]; + + // 十六进制 + NSString*startTimeHex8=[backModel.timer8 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex8=[backModel.timer8 substringWithRange:NSMakeRange(8, 4)]; + // 十进制 + NSString*startTimeTen8=[dataContorl hexStringToDateString:startTimeHex8]; + NSString*endTimeTen8=[dataContorl hexStringToDateString:endTimeHex8]; + NSString*setTim8=[NSString stringWithFormat:@"%@~%@",startTimeTen8,endTimeTen8]; + + timerArr=@[@[wenduString,@"设置时段"],@[setTim1,setTim2],@[setTim3,setTim4],@[setTim5,setTim6],@[setTim7,setTim8,@""]]; + + return timerArr; + + +} + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.h new file mode 100644 index 0000000..1beb8b1 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.h @@ -0,0 +1,18 @@ +// +// RuiMeiCHControl.h +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import + +@interface RuiMeiCHControl : NSObject +@property (nonatomic,copy) NSString *ch1name; +@property (nonatomic,copy) NSString *ch2name; +@property (nonatomic,copy) NSString *ch3name; +@property (nonatomic,copy) NSString *ch4name; +@property (nonatomic,copy) NSString *jiaRe; +@property (nonatomic,copy) NSString *macAd; +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.m new file mode 100644 index 0000000..46d66d8 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHControl.m @@ -0,0 +1,36 @@ +// +// RuiMeiCHControl.m +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "RuiMeiCHControl.h" + +@implementation RuiMeiCHControl + +-(void)encodeWithCoder:(NSCoder*)aCoder{ + + [aCoder encodeObject:_ch1name forKey:@"ch1name"]; + [aCoder encodeObject:_ch2name forKey:@"ch2name"]; + [aCoder encodeObject:_ch3name forKey:@"ch3name"]; + [aCoder encodeObject:_ch4name forKey:@"ch4name"]; + [aCoder encodeObject:_macAd forKey:@"macaddress"]; + [aCoder encodeObject:_jiaRe forKey:@"jiaRe"]; +} + +-(id)initWithCoder:(NSCoder*)aDecoder{ + if (self=[super init]) { + self.ch1name=[aDecoder decodeObjectForKey:@"ch1name"]; + self.ch2name=[aDecoder decodeObjectForKey:@"ch2name"]; + self.ch3name=[aDecoder decodeObjectForKey:@"ch3name"]; + self.ch4name=[aDecoder decodeObjectForKey:@"ch4name"]; + self.macAd = [aDecoder decodeObjectForKey:@"macaddress"]; + self.jiaRe = [aDecoder decodeObjectForKey:@"jiaRe"]; + } + + return self; +} + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.h new file mode 100644 index 0000000..093bd3f --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.h @@ -0,0 +1,17 @@ +// +// RuiMeiCHNameCustom.h +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import +#import "RuiMeiCHControl.h" + +@interface RuiMeiCHNameCustom : NSObject + ++(void)saveCHname:(RuiMeiCHControl*)chModel; ++(RuiMeiCHControl *)currentdevice:(NSString *)macaddress; + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.m new file mode 100644 index 0000000..882303e --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiCHNameCustom.m @@ -0,0 +1,36 @@ +// +// RuiMeiCHNameCustom.m +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "RuiMeiCHNameCustom.h" +#import "UserExtendataArchaver.h" + +@implementation RuiMeiCHNameCustom + ++(void)saveCHname:(RuiMeiCHControl*)chModel +{ + + [UserExtendataArchaver archiverRuiMeiDeviceCHInfo:chModel]; + +} + ++(RuiMeiCHControl *)currentdevice:(NSString *)macaddress +{ + RuiMeiCHControl *runsunCH = [UserExtendataArchaver unArchiverRuiMeiDeviceCHInfo:macaddress]; + if (!runsunCH||[runsunCH isKindOfClass:[NSNull class]]) { + runsunCH = [[RuiMeiCHControl alloc] init]; + runsunCH.ch1name = @"S1"; + runsunCH.ch2name = @"S2"; + runsunCH.ch3name = @"UV/杀菌"; + runsunCH.ch4name = @"冲浪/氧泵"; + runsunCH.jiaRe = @"加热棒"; + runsunCH.macAd = macaddress; + } + return runsunCH; +} + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.h new file mode 100644 index 0000000..5810be6 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.h @@ -0,0 +1,37 @@ +// +// RuiMeiProtocolModel.h +// Ifish +// +// Created by Minghao Xue on 2018/4/14. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import + +@interface RuiMeiProtocolModel : NSObject +@property (nonatomic,copy) NSString *ch1; +@property (nonatomic,copy) NSString *ch2; +@property (nonatomic,copy) NSString *ch3; +@property (nonatomic,copy) NSString *ch4; +@property (nonatomic,copy) NSString *customModel; + +@property(nonatomic,copy) NSString *timer1; +@property(nonatomic,copy) NSString *timer2; +@property(nonatomic,copy) NSString *timer3; +@property(nonatomic,copy) NSString *timer4; +@property(nonatomic,copy) NSString *timer5; +@property(nonatomic,copy) NSString *timer6; +@property(nonatomic,copy) NSString *timer7; +@property(nonatomic,copy) NSString *timer8; +@property(nonatomic,copy) NSString *heatStickState; +@property(nonatomic,copy) NSString *wendu; +// 加热温度 +@property(nonatomic,copy) NSString *heatTemperature; +//室温 +@property(nonatomic,copy) NSString *shiwen; +@property(nonatomic,copy) NSString *baojingSwitch; +@property(nonatomic,copy) NSString *miniTp; +@property(nonatomic,copy) NSString *maxTp; +@property(nonatomic,copy) NSString *funcCode; + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.m new file mode 100644 index 0000000..1e859d3 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiProtocolModel.m @@ -0,0 +1,13 @@ +// +// RuiMeiProtocolModel.m +// Ifish +// +// Created by Minghao Xue on 2018/4/14. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "RuiMeiProtocolModel.h" + +@implementation RuiMeiProtocolModel + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.h b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.h new file mode 100644 index 0000000..f62277e --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.h @@ -0,0 +1,28 @@ +// +// RuiMeiSetViewController.h +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "FatherController.h" + +@interface RuiMeiSetViewController : FatherController +{ + BOOL _isHidden; + BOOL mySwitchIsOn; + +} + +@property(nonatomic,strong)NSArray*timeArr; +@property(nonatomic,strong)NSArray*titleArr; +@property(nonatomic)BOOL isAuto;// 自动模式 + +@property(nonatomic)UIActivityIndicatorView*indicatorView; + +@property(nonatomic)int percent; +@property(nonatomic,strong) DeviceModel* currentdevice; +@property (nonatomic, assign) BOOL customModeOn; + +@end diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.m new file mode 100644 index 0000000..6415ad6 --- /dev/null +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/RuiMei/RuiMeiSetViewController.m @@ -0,0 +1,1157 @@ +// +// RuiMeiSetViewController.m +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "SetTimeCell.h" +#import "SecondSetTimeCell.h" +#import "SetTimeModel.h" +#import "SetSelectorTime.h" +//#import "AsyncSocket.h" +#import "setWaringTpModel.h" +#import "appLogin.h" +#import "workTypeModel.h" +#import "SetSelectorTime.h" +#define TIME_TAG 300 +#import "MyPickerView.h" +#import "searchDeviceModel.h" +#import "BackmassegeModel.h" +#import "MydatePickerView.h" +#define SET_CELL_TAG 2000 +#define MYSWITCH_TAG 30000 +#import "CenterViewController.h" +#import "TimerSateModel.h" +#import "TemperatureSetCell.h" +#import "TemperatureSetModel.h" +#import "AppDelegate.h" +#import "BrightnessCell.h" +#import "GuidengKaiGuanModel.h" +#import "GuiDengViewCell.h" +#import "ChangeWaterCell.h" +#import "remindCyclePic.h" +#import "BrightnessModel.h" +#import "RuiMeiProtocolModel.h" +#import "RuiMeiBackMsgUtils.h" +#import "RuSunGuiDeng.h" +#import "RuiMeiSetViewController.h" +#import "CustomModeSetCell.h" +#import "RuSunLightOrder.h" + +@interface RuiMeiSetViewController () +{ + + MydatePickerView*_mydatepicView; + MyPickerView* _mypicView; + remindCyclePic*_remindPic; + dispatch_queue_t _mainQueue; +} + +@property(nonatomic,strong)NSIndexPath*indexpath; + +@property(nonatomic,copy)NSString*statString; + +@property(nonatomic,copy)NSString*endString; + +@property(nonatomic,strong)UIView*lodingbackView; + +@property(nonatomic,copy)NSString*nextChangeDateLabel; + +@property(nonatomic,strong)setRemindWaterModel*waterInfmodel; + +@property(nonatomic) NSInteger tian; + +@end + +@implementation RuiMeiSetViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + _waterInfmodel=[[setRemindWaterModel alloc]init]; + [super viewDidLoad]; + _mainQueue = dispatch_get_main_queue(); + self.navigationController.navigationBar.backItem.title=@""; + [self addTitleViewWithTitle:@"设置"]; + [self initData]; + + [self creatIndicatorView]; + + self.tableView.backgroundColor=COLOR_MIAN; + self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone; +} + +-(void)creatIndicatorView{ + + _indicatorView=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + + + _indicatorView.frame=CGRectMake(kScreenSize.width/2-50,kScreenSize.height/2-100,100, 100); + _indicatorView.backgroundColor=IndicatorBack_COLOR; + _indicatorView.layer.masksToBounds=YES; + _indicatorView.layer.cornerRadius=5; + AppDelegate*delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate]; + [delegate.window addSubview:_indicatorView]; + +} + + +-(void)initData{ + + self.titleArr=@[@[@"预警设置",@"换水提醒",@"自定义模式开关"],@[@"时段一",@"时段二"],@[@"时段一",@"时段二"],@[@"时段一",@"时段二"],@[@"时段一",@"时段二"]]; + + + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + if (backmodel) { + NSString*low=backmodel.miniTp; + NSString*heigh=backmodel.maxTp; + UInt64 lowten=[dataContorl hexToTen:low]; + UInt64 heighten=[dataContorl hexToTen:heigh]; + float formatlow=lowten/10; + float formatheigh=heighten/10; + + NSString*wenduString=[NSString stringWithFormat:@"%.0f~%.0f°C",formatlow,formatheigh]; + //共八定时器 一个灯两个定时器 + //CH1 timer1 timer2 + // 十六进制 + NSString*startTimeHex1=[backmodel.timer1 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex1=[backmodel.timer1 substringWithRange:NSMakeRange(8, 4)]; + + // 十进制 + NSString*startTimeTen1=[dataContorl hexStringToDateString:startTimeHex1]; + NSString*endTimeTen1=[dataContorl hexStringToDateString:endTimeHex1]; + NSString*setTim1=[NSString stringWithFormat:@"%@~%@",startTimeTen1,endTimeTen1]; + + NSString*startTimeHex2=[backmodel.timer2 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex2=[backmodel.timer2 substringWithRange:NSMakeRange(8, 4)]; + NSString*startTimeTen2=[dataContorl hexStringToDateString:startTimeHex2]; + NSString*endTimeTen2=[dataContorl hexStringToDateString:endTimeHex2]; + NSString*setTim2=[NSString stringWithFormat:@"%@~%@",startTimeTen2,endTimeTen2]; + + //CH2 timer3 timer4 + // 十六进制 + NSString*startTimeHex3=[backmodel.timer3 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex3=[backmodel.timer3 substringWithRange:NSMakeRange(8, 4)]; + NSString*startTimeTen3=[dataContorl hexStringToDateString:startTimeHex3]; + NSString*endTimeTen3=[dataContorl hexStringToDateString:endTimeHex3]; + NSString*setTim3=[NSString stringWithFormat:@"%@~%@",startTimeTen3,endTimeTen3]; + + + NSString*startTimeHex4=[backmodel.timer4 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex4=[backmodel.timer4 substringWithRange:NSMakeRange(8, 4)]; + NSString*startTimeTen4=[dataContorl hexStringToDateString:startTimeHex4]; + NSString*endTimeTen4=[dataContorl hexStringToDateString:endTimeHex4]; + NSString*setTim4=[NSString stringWithFormat:@"%@~%@",startTimeTen4,endTimeTen4]; + + //CH3 timer5 timer6 + NSString*startTimeHex5=[backmodel.timer5 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex5=[backmodel.timer5 substringWithRange:NSMakeRange(8, 4)]; + + NSString*startTimeTen5=[dataContorl hexStringToDateString:startTimeHex5]; + NSString*endTimeTen5=[dataContorl hexStringToDateString:endTimeHex5]; + NSString*setTim5=[NSString stringWithFormat:@"%@~%@",startTimeTen5,endTimeTen5]; + + + NSString*startTimeHex6=[backmodel.timer6 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex6=[backmodel.timer6 substringWithRange:NSMakeRange(8, 4)]; + NSString*startTimeTen6=[dataContorl hexStringToDateString:startTimeHex6]; + NSString*endTimeTen6=[dataContorl hexStringToDateString:endTimeHex6]; + NSString*setTim6=[NSString stringWithFormat:@"%@~%@",startTimeTen6,endTimeTen6]; + //CH4 timer7 timer8 + + NSString*startTimeHex7=[backmodel.timer7 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex7=[backmodel.timer7 substringWithRange:NSMakeRange(8, 4)]; + + NSString*startTimeTen7=[dataContorl hexStringToDateString:startTimeHex7]; + NSString*endTimeTen7=[dataContorl hexStringToDateString:endTimeHex7]; + NSString*setTim7=[NSString stringWithFormat:@"%@~%@",startTimeTen7,endTimeTen7]; + + + NSString*startTimeHex8=[backmodel.timer8 substringWithRange:NSMakeRange(4, 4)]; + NSString*endTimeHex8=[backmodel.timer8 substringWithRange:NSMakeRange(8, 4)]; + NSString*startTimeTen8=[dataContorl hexStringToDateString:startTimeHex8]; + NSString*endTimeTen8=[dataContorl hexStringToDateString:endTimeHex8]; + NSString*setTim8=[NSString stringWithFormat:@"%@~%@",startTimeTen8,endTimeTen8]; + + self.timeArr=@[@[wenduString,@"设置时段"],@[setTim1,setTim2],@[setTim3,setTim4],@[setTim5,setTim6],@[setTim7,setTim8,@""]]; + + }else{ + + [self.view makeToast:@"设备已离线"]; + self.timeArr=@[@[@"20~30°C",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00"],@[@"2:00~5:00",@"2:00~5:00",@""]]; + + } +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 5; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (section == 0) { + return 3; + + }else if (section == 4){ + + return 3; + + }else{ + return 2; + } + +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + static NSString *cellID=@"kongCell"; + UITableViewCell *kongCell=[tableView dequeueReusableCellWithIdentifier:cellID]; + + if (kongCell==nil) { + + kongCell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID]; + } + + + if (indexPath.section==0&&indexPath.row==0){ + TemperatureSetCell*cell=[tableView dequeueReusableCellWithIdentifier:@"TemperatureSetCell"]; + if (cell==nil) { + cell=[[[NSBundle mainBundle]loadNibNamed:@"TemperatureSetCell" owner:self options:nil]lastObject]; + } + cell.tag=indexPath.row +SET_CELL_TAG+indexPath.section*10; + TemperatureSetModel*model=[[TemperatureSetModel alloc]init]; + model.title=self.titleArr[indexPath.section][indexPath.row]; + + cell.titleLabel.text=model.title; + model.temperatureLabel=self.timeArr[indexPath.section][indexPath.row]; + cell.temperaturelabel.text=model.temperatureLabel; + [cell.temPSwitch addTarget:self action:@selector(ruSunTempSwitchAction:) forControlEvents:UIControlEventTouchUpInside]; + if (backmodel) { + if ([backmodel.baojingSwitch isEqualToString:@"01"]) { + + [cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; + cell.temPSwitch.selected = NO; + + }else{ + + [cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; + + cell.temPSwitch.selected = YES; + } + + }else{ + + } + + return cell; + + }else if (indexPath.section==0&&indexPath.row==1){ + // 换水提醒 + if (![self.currentdevice.waterRemind isEqual:[NSNull null]]) { + ChangeWaterCell*cell=[tableView dequeueReusableCellWithIdentifier:@"ChangeWaterCell"]; + if (cell==nil) { + cell=[[[NSBundle mainBundle]loadNibNamed:@"ChangeWaterCell" owner:self options:nil]lastObject]; + } + + [cell.ChangeWaterSwitch addTarget:self action:@selector(ruSunChangeWaterSwitch:) forControlEvents:UIControlEventTouchUpInside]; + + if ([self.waterInfmodel.waterremind isEqualToString:@"1"]) { + [cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal]; + cell.ChangeWaterSwitch.selected = NO; + + + + cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"set_cellBack"]]; + }else{ + [cell.ChangeWaterSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal]; + cell.ChangeWaterSwitch.selected = YES; + + cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"set_cellBack"]]; + } + + + if (self.waterInfmodel.remindcycle == 0) { + //在未获取换水信息时暂时显示 + cell.huanshuiDaylabel.text=@"换水时间"; + }else{ + + cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%ld天",(long)self.waterInfmodel.remindcycle]; + NSLog(@"ce;;%@",cell.huanshuiDaylabel.text); + + NSLog(@"222"); + } + + + return cell; + + }else{ + + kongCell.textLabel.text =@"错误信息 waterRemind null"; + return kongCell; + + } + + + }else if (indexPath.section==0&&indexPath.row==2){ + static NSString*customModeSetCellId=@"customModeSetCell"; + CustomModeSetCell*cell=[tableView dequeueReusableCellWithIdentifier:customModeSetCellId]; + if (cell==nil) { + cell=[[[NSBundle mainBundle]loadNibNamed:@"CustomModeSetCell" owner:self options:nil]lastObject]; + } + cell.switchControl.selected = self.customModeOn; + [cell.switchControl addTarget:self action:@selector(customModeSwitchBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; + return cell; + + }else{ + + if (indexPath.section==4&&indexPath.row==2) { + //最后插入一个cell达到 椭圆底效果 + static NSString*cellId=@"lastSectlastcell"; + UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:cellId]; + if (cell==nil) { + cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId]; + } + cell.backgroundView =[ [UIImageView alloc] initWithImage:[UIImage imageNamed:@"secondSetCell"]]; + cell.userInteractionEnabled = NO; + + return cell; + + }else{ + + SetTimeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SetTimeCell"]; + if (cell==nil) { + cell=[[[NSBundle mainBundle]loadNibNamed:@"SetTimeCell" owner:self options:nil]lastObject]; + } + + SetTimeModel*model=[[SetTimeModel alloc]init]; + model.title=self.titleArr[indexPath.section][indexPath.row]; + cell.titleLabel.text=model.title; + model.timestring=self.timeArr[indexPath.section][indexPath.row]; + cell.timeLabel.text=model.timestring; + cell.timeLabel.tag=TIME_TAG+indexPath.section*10+indexPath.row; + + + if (indexPath.section!=0 && !(indexPath.section==4&&indexPath.row==2)) { + + cell.tag=indexPath.row +SET_CELL_TAG+indexPath.section*10; + cell.mySwitchButton.tag=indexPath.row +MYSWITCH_TAG+indexPath.section*10; + + } + + if (indexPath.section!=0 && !(indexPath.section==4&&indexPath.row==2)) { + + + if (indexPath.section==1&&indexPath.row==0) {//开关一 + NSString*state=[backmodel.timer1 substringWithRange:NSMakeRange(2, 2)]; + + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + + if (indexPath.section==1&&indexPath.row==1) {//开关2 + NSString*state=[backmodel.timer2 substringWithRange:NSMakeRange(2, 2)]; + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + if (indexPath.section==2&&indexPath.row==0) {//开关3 + NSString*state=[backmodel.timer3 substringWithRange:NSMakeRange(2, 2)]; + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + + if (indexPath.section==2&&indexPath.row==1) {//开关4 + NSString*state=[backmodel.timer4 substringWithRange:NSMakeRange(2, 2)]; + + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + + if (indexPath.section==3&&indexPath.row==0) {//开关5 + NSString*state=[backmodel.timer5 substringWithRange:NSMakeRange(2, 2)]; + NSLog(@"state5****%@",state); + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + + if (indexPath.section==3&&indexPath.row==1) {//开关6 + NSString*state=[backmodel.timer6 substringWithRange:NSMakeRange(2, 2)]; + NSLog(@"state6****%@",state); + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + + } + } + + if (indexPath.section==4&&indexPath.row==0) {//开关7 + NSString*state=[backmodel.timer7 substringWithRange:NSMakeRange(2, 2)]; + NSLog(@"state7****%@",state); + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + + if (indexPath.section==4&&indexPath.row==1) {//开关8 + + NSString*state=[backmodel.timer8 substringWithRange:NSMakeRange(2, 2)]; + NSLog(@"state8****%@",state); + if ([state isEqualToString:@"00"]) { + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + + [cell.mySwitchButton setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + } + + } + + [cell setRuSunControl84biteAtIndex:indexPath currenmac:self.currentdevice.macAddress]; + //cell 选中效果 + [cell.mySwitchButton addTarget:self action:@selector(btnCliCk:) forControlEvents:UIControlEventTouchUpInside]; + + return cell; + + + } + } + +} + +-(void)btnCliCk:(UIButton*)btn{ + + TimerSateModel*stateModel=[[TimerSateModel alloc]init]; + stateModel.sendmacId = self.currentdevice.macAddress; + stateModel.resavemacId =self.currentdevice.macAddress; + + + stateModel.crc16String=@"0000"; + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + + NSString*backState=nil; + + if (btn.tag==30010) { + backState=[backmodel.timer1 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"01"; + + }else if (btn.tag==30011){ + backState=[backmodel.timer2 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"02"; + // stateModel.timerState=[backmodel.timer2 substringWithRange:NSMakeRange(2, 2)]; + + }else if (btn.tag==30020){ + + backState=[backmodel.timer3 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"03"; + // stateModel.timerState=[backmodel.timer3 substringWithRange:NSMakeRange(2, 2)]; + }else if (btn.tag==30021){ + backState=[backmodel.timer4 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"04"; + // stateModel.timerState=[backmodel.timer4 substringWithRange:NSMakeRange(2, 2)]; + + }else if (btn.tag==30030){ + backState=[backmodel.timer5 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"05"; + //stateModel.timerState=[backmodel.timer5 substringWithRange:NSMakeRange(2, 2)]; + + + }else if (btn.tag==30031){ + backState=[backmodel.timer6 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"06"; + + }else if (btn.tag==30040){ + + backState=[backmodel.timer7 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"07"; + }else if (btn.tag==30041){ + + backState=[backmodel.timer8 substringWithRange:NSMakeRange(2, 2)]; + + stateModel.timerNumber=@"08"; + } + + if ([backState isEqualToString:@"01"]) { + //发关闭指令 + stateModel.timerState=@"00";// 关 + NSString*stateString=[NSString stringWithFormat:@"%@%@%@%@",stateModel.description,stateModel.timerNumber,stateModel.timerState,stateModel.crc16String]; + + NSData*selctorData=[dataContorl stringToHexData:stateString]; + [[Socketsingleton sharedInstance] soketWriteData:selctorData]; + [_indicatorView startAnimating]; + [btn setImage:[UIImage imageNamed:@"Switch-Off"] forState:UIControlStateNormal]; + + }else{ + //发打开指令 + stateModel.timerState=@"01";// 开 + NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@",stateModel.description,stateModel.timerNumber,stateModel.timerState,stateModel.crc16String]; + + NSData*selctorData=[dataContorl stringToHexData:selectorString]; + [[Socketsingleton sharedInstance] soketWriteData:selctorData]; + [_indicatorView startAnimating]; + [btn setImage:[UIImage imageNamed:@"Switch-On"] forState:UIControlStateNormal]; + } + +} + +#pragma mark 开启关闭报警 +-(void)ruSunTempSwitchAction:(UIButton*)temperatureSwitch{ + + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + setWaringTpModel*warModel1=[[setWaringTpModel alloc]init]; + warModel1.sendmacId =self.currentdevice.macAddress; + warModel1.resavemacId = self.currentdevice.macAddress; + + //BOOL isOn=[temperatureSwitch isOn]; + if (temperatureSwitch.selected == YES) { + NSLog(@"开"); + temperatureSwitch.selected = NO; + warModel1.kaiguan=@"01";// 开 + warModel1.miniwaterTp=@"0000"; // 0 + warModel1.maxwaterTp=@"0000";//0 + }else{ + temperatureSwitch.selected =YES; + + warModel1.kaiguan=@"00";// 关 + warModel1.miniwaterTp=@"0000"; // 0 + warModel1.maxwaterTp=@"0000";//0 + NSLog(@"关"); + } + [self setTmperatureStateWithModel:warModel1 addBackModel:backmodel]; + +} +-(void)setTmperatureStateWithModel:(setWaringTpModel*)waringModel addBackModel:(RuiMeiProtocolModel *)backModel{ + NSString*maxminTpString=waringModel.description; + waringModel.crc16Ing=@"0000"; + NSString*minString=[NSString stringWithFormat:@"%@%@%@%@%@",maxminTpString,waringModel.kaiguan,waringModel.miniwaterTp,waringModel.maxwaterTp,waringModel.crc16Ing]; + NSData*minwenDuData=[dataContorl stringToHexData:minString]; + [[Socketsingleton sharedInstance] soketWriteData:minwenDuData]; + [_indicatorView startAnimating]; + backModel.miniTp=waringModel.miniwaterTp; + backModel.maxTp=waringModel.maxwaterTp; + +} + +#pragma mark 换水提醒Action +-(void)ruSunChangeWaterSwitch:(UIButton*)sender{ + + UIButton*huanShuiSwitch=(UIButton*)sender; + + //BOOL isButtonOn=[huanShuiSwitch isOn]; + + NSUserDefaults*defuat=[NSUserDefaults standardUserDefaults]; + NSString*picResult=[defuat valueForKey:@"RuiMei2aPicResult"]; + int pic = picResult.intValue; + if (pic==0) { + [self showTitle:@"" messsage:@"请设置提醒天数"]; + if (huanShuiSwitch.selected == YES) { + huanShuiSwitch.selected =NO; + + }else{ + huanShuiSwitch.selected =YES; + } + + }else{ + + if (huanShuiSwitch.selected ==YES) { + //开 + huanShuiSwitch.selected =NO; + [IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId + waterRemind:@"1" remindCycle:picResult + huishuiShiJian:^(setRemindWaterModel *remindModel) { + self.nextChangeDateLabel=remindModel.remindDate; + + }]; + //更新选择状态 设置界面 在不断 刷新 + + self.waterInfmodel.waterremind=@"1"; + [self.tableView reloadData]; + + }else{ + //关 + huanShuiSwitch.selected =YES; + [IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId + waterRemind:@"0" remindCycle:picResult + huishuiShiJian:^(setRemindWaterModel *remindModel) { + + self.nextChangeDateLabel=remindModel.remindDate; + self.waterInfmodel=remindModel; + + }]; + + self.waterInfmodel.waterremind=@"0"; + + [self.tableView reloadData]; + + } + } +} + +#pragma mark - 自定义模式开关设置 +-(void)customModeSwitchBtnClicked:(UIButton*)sender{ + //此款设备无运行模式 + RuSunLightOrder*lightOrder=[[RuSunLightOrder alloc]init]; + lightOrder.sendmacId = self.currentdevice.macAddress; + lightOrder.resavemacId = self.currentdevice.macAddress; + NSString*switchString1=lightOrder.description; + + NSString *lightSate; + if (sender.selected == YES) { + sender.selected = NO; + lightSate=@"00"; + }else{ + sender.selected =YES; + lightSate=@"01";// 关 + } + lightOrder.switchBtn = lightSate; + lightOrder.crc16Str=@"0000"; + lightOrder.lightNumber=@"05"; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightOrder.lightNumber,lightOrder.switchBtn,lightOrder.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [ [Socketsingleton sharedInstance] soketWriteData:manulData]; + [_indicatorView startAnimating]; +} + +#pragma mark tableView 头视图和脚视图 +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + + + if (section == 1) { + return 50; + + }else if (section ==0){ + return 5; + }else { + return 0; + } + +} + +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + + if (indexPath.section==0&&indexPath.row==2) { + return 50; + + }else if (indexPath.section==0&&indexPath.row==1){ + + if (![_currentdevice.waterRemind isEqual:[NSNull null]]) { + + return 50; + + }else{ + + return 0; + } + + }else if (indexPath.section==0&&indexPath.row==0){ + //会否有 预警 + if (![_currentdevice.isPushWendu isEqual:[NSNull null]]) { + + if ([_currentdevice.isPushWendu isEqualToString:@"1"]) { + return 50; + }else{ + return 0; + } + + }else{ + + return 0; + } + + }else{ + + return 50; + } + +} + +-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + if (section==1) { + UIImageView*secondSectionHeader=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"firstSetCell"]]; + UILabel *label=[[UILabel alloc] init]; + label.text=@"定时模式"; + label.font = [UIFont systemFontOfSize:15]; + label.frame=CGRectMake(18, 5, 100, 40); + [secondSectionHeader addSubview:label]; + + return secondSectionHeader; + + + }else if (section == 0){ + UIView*oneHeader=[[UIView alloc] init]; + oneHeader.backgroundColor=COLOR_MIAN; + return oneHeader; + + }else{ + return nil; + } + +} +#pragma mark tableView 点击事件 + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + _indexpath=indexPath; + if (indexPath.row==0&&indexPath.section==0) { + + _mypicView=[[MyPickerView alloc]init]; + + _mypicView.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); + [self.view.window addSubview:_mypicView]; + [_mypicView.cancleButton addTarget:self action:@selector(mypicviewRemoveByCancle) forControlEvents:UIControlEventTouchUpInside]; + [_mypicView.sureButton addTarget:self action:@selector(mypicViewRemoveByDone) forControlEvents:UIControlEventTouchUpInside]; + [self temperatureMainQueue]; + + }else if (indexPath.section==0&&indexPath.row==1){ + //换水提醒日期选择 + _remindPic=[[remindCyclePic alloc]init]; + + _remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); + [self.view.window addSubview:_remindPic]; + [_remindPic.cancleBtn addTarget:self action:@selector(xuToremindCyclePicRemove) forControlEvents:UIControlEventTouchUpInside]; + + [_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside]; + + [self huanShuiMainQueue]; + + }else if (indexPath.section!=0){ + + + + _mydatepicView=[[MydatePickerView alloc]init]; + + _mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height); + + [_mydatepicView.cancleButton addTarget:self action:@selector(cancleButtonClick) forControlEvents:UIControlEventTouchUpInside]; + [_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; + + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + if (backmodel) { + //在线 + [self useMainQueue]; + } + + + + // 设置pickerView 默认选择行 + + [self.view.window addSubview:_mydatepicView]; + + + } +} + +#pragma mark 移除换水时间选择器 + +-(void)xuToremindCyclePicRemove{ + + [_remindPic removeFromSuperview]; + +} + +#pragma mark 换水时间设置 + +-(void)xuToremindCyclePicDone{ + + if (_indexpath.section==0&&_indexpath.row==1) { + ChangeWaterCell*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.huanshuiDaylabel.text=[NSString stringWithFormat:@"%@天",str]; + //设置换水日期 + [IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId + waterRemind:@"1" remindCycle:str + huishuiShiJian:^(setRemindWaterModel *remindModel) { + + self.nextChangeDateLabel=remindModel.remindDate; + self.waterInfmodel.waterremind=@"1"; + self.waterInfmodel.remindDate=remindModel.remindDate; + self.waterInfmodel.remindcycle = remindModel.remindcycle; + [self.tableView reloadData]; + + }]; + + NSUserDefaults*defuat=[NSUserDefaults standardUserDefaults]; + + [defuat setValue:str forKey:@"RuiMei2aPicResult"]; + + [defuat synchronize]; + + [_remindPic removeFromSuperview]; + + + } + +} + +#pragma mark 默认换水时间 +-(void)huanShuiMainQueue{ + + if (_remindPic.picViewResultString !=nil || (_remindPic.picViewResultString ==nil && self.waterInfmodel.remindcycle !=0 )) { + + + + NSArray*shijianArr=[_remindPic.picArr objectAtIndex:0]; + dispatch_async(_mainQueue, ^{ + NSLog(@"a"); + for (NSInteger k=0; k +{ + dispatch_queue_t _ruSunMainQueue; +} +@property(nonatomic,strong) RuiMeiProtocolModel *backmodel; +@property(nonatomic,strong) HaveHotCoolWenDuPicview *wenduPicview; +@property(nonatomic,strong) RuiMeiSetViewController *setVC; +//@property(nonatomic,strong) RunSunChangeNameViewController *changenameVC; +@property(nonatomic,strong) RuSunInpdViewController *changenameVC; + +@end + +@implementation RuiMeiViewController + +- (void)viewDidLoad { + + [super viewDidLoad]; + + _backmodel=[[RuiMeiProtocolModel alloc] init]; + [Socketsingleton sharedInstance].communiteDelegate=self; + _ruSunMainQueue = dispatch_get_main_queue(); + // Do any additional setup after loading the view. + UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(RuSunCenterViewSetTap)]; + [self.setImag addGestureRecognizer:tapgestureRecognizer]; + [self.setbackBtn addTarget:self action:@selector(RuSunCenterViewSetAction:) forControlEvents:UIControlEventTouchUpInside]; + [self.SetTimeButton addTarget:self action:@selector(RuSunCenterViewSetAction:) forControlEvents:UIControlEventTouchUpInside]; + + [self initControlNormalBtn]; +} + +-(void)RuSunCenterViewSetTap +{ + + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + + if (backmodel) { + [self pushSetTimeVC]; + }else{ + [self deviceNotOnlineState]; + + [self showLableAction:@"设备已离线"]; + + [self.indicatorView stopAnimating]; + + } + + +} + +#pragma mark -转跳设置界面 + +-(void)RuSunCenterViewSetAction:(UIButton*)btn +{ + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + if (backmodel) { + [self pushSetTimeVC]; + }else{ + [self deviceNotOnlineState]; + + [self showLableAction:@"设备已离线"]; + + [self.indicatorView stopAnimating]; + + } + +} + +-(void)pushSetTimeVC{ + + self.setVC=[[RuiMeiSetViewController alloc]init]; + + self.setVC.currentdevice=self.currentDevice; + NSString*stateString=[self.backmodel.customModel substringWithRange:NSMakeRange(2, 2)]; + if ([stateString isEqualToString:@"01"]) { + self.setVC.customModeOn=YES; + }else{ + self.setVC.customModeOn=NO; + } + [self.navigationController pushViewController:self.setVC animated:YES]; + +} + + +-(void)initControlNormalBtn +{ + + NSArray*nameArr=@[@"PFLight1_off.png",@"PFLight1_off.png",@"PFkilLlight_off.png",@"O2_off.png",@"JiaReBang_off"]; + + CGFloat btnControlWith = 70; + CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith )/4; + + for (int i = 0; i < 3; i ++) { + + self.button = [[UIButton alloc] init] ; + self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -10 - 10 , btnControlWith, btnControlWith +11); + + [self.button setImage:[UIImage imageNamed:nameArr[i]] forState:UIControlStateNormal]; + //self.button.backgroundColor = [UIColor redColor]; + self.button.tag=6000+i; + [self.button addTarget:self action:@selector(controlBtnCilck:) forControlEvents:UIControlEventTouchUpInside]; + + + self.chName = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -20 + btnControlWith -5 , btnControlWith, btnControlPlace - 5)]; + //textLbl.backgroundColor = [UIColor blackColor]; + self.chName.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1]; + self.chName.textAlignment = NSTextAlignmentCenter; + NSArray *arr = @[@"S1",@"S2",@"UV/杀菌"]; + self.chName.text = arr[i]; + + self.chName.font = [UIFont boldSystemFontOfSize:14]; + + [self.tableView addSubview:self.chName]; + [self.tableView addSubview:self.button]; + + if (i==0) { + + self.ch1Button = self.button; + self.ch1Name = self.chName; + }else if (i==1){ + + self.ch2Button = self.button; + self.ch2Name = self.chName; + + }else if (i==2){ + self.ch3Name = self.chName; + self.ch3Button = self.button; + + } + + } + + //CGFloat btnControlPlace1 = (kScreenSize.width - 2*btnControlWith )/3; + + for (int i = 0; i < 2; i ++) { + self.button = [[UIButton alloc] init] ; + self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -25 -5 , btnControlWith, btnControlWith + 11); + + + [self.button setImage:[UIImage imageNamed:nameArr[i+3]]forState:UIControlStateNormal]; + + self.button.tag= 6003+i; + [self.button addTarget:self action:@selector(controlBtnCilck:) forControlEvents:UIControlEventTouchUpInside]; + + UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -35 + btnControlWith, btnControlWith, btnControlPlace - 5)]; + //textLbl.backgroundColor = [UIColor blackColor]; + textLbl.textAlignment = NSTextAlignmentCenter; + textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1]; + NSArray *arr = @[@"冲浪/氧泵",@"加热棒"]; + textLbl.font = [UIFont boldSystemFontOfSize:14]; + textLbl.text = arr[i]; + self.chName = textLbl; + [self.tableView addSubview:textLbl]; + [self.tableView addSubview:self.button]; + + if (i==0) { + + self.ch4Button = self.button; + self.ch4Name = self.chName; + } else if (i==1){ + self.heatBtn = self.button; + self.jiaReName = self.chName; + + } + } + + //重置 self.bubble 的 frame + CGFloat animViewHeight= kScreenSize.width/4; + if (kScreenSize.height==480) { + + self.bubble.frame = CGRectMake((kScreenSize.width -(kScreenSize.width - 2 * kPlace)*2/3)/2, kPlace + 60 , (kScreenSize.width - 2 * kPlace)*2/3, (kScreenSize.width - 2 * kPlace)*2/3); + + //(kScreenSize.width - 2 * kPlace - 200)*2/3 + self.temperature.frame = CGRectMake(30, 70, (kScreenSize.width - 2 * kPlace - 100)*2/3, 50); + self.temperature.font = [UIFont fontWithName:@"Avenir Next Condensed" size:46]; + + self.dulabel.frame = CGRectMake( (kScreenSize.width - 2 * kPlace - 100)*2/3,74,50, kScreenSize.width - 2 * kPlace - 210); + + + self.dulabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:20]; + + self.animView.frame= CGRectMake(0, kPlace + 80 + (kScreenSize.width - 2 * kPlace) -animViewHeight/2 - 15-80, kScreenSize.width, animViewHeight); + + self.notOnLineLabel.frame = CGRectMake(40, 60, kScreenSize.width - 2 * kPlace - 100, kScreenSize.width - 2 * kPlace - 200); + self.notOnLineLabel .font = [UIFont fontWithName:@"Avenir Next Condensed" size:15]; + + self.hotcolLabe = [[UILabel alloc] init]; + self.hotcolLabe.frame = CGRectMake(0, CGRectGetMaxY(self.temperature.frame) + 10, self.bubble.frame.size.width, 15); + //self.hotcolLabe.textColor = JWUIColorFromRGB(fc6638); + self.hotcolLabe.textAlignment = NSTextAlignmentCenter; + self.hotcolLabe.font =[UIFont systemFontOfSize:13]; + self.hotcolLabe.text = @"制冷加热"; + [self.bubble addSubview:self.hotcolLabe]; + + self.hotcolTempLabe = [[UILabel alloc] init]; + self.hotcolTempLabe.frame = CGRectMake(0, CGRectGetMaxY(self.hotcolLabe.frame) + 5, self.bubble.frame.size.width, 15); + self.hotcolTempLabe.font =[UIFont systemFontOfSize:14]; + self.hotcolTempLabe.textAlignment = NSTextAlignmentCenter; + self.hotcolTempLabe.textColor = JWUIColorFromRGB(0x666666); + self.hotcolTempLabe.text = @"温度"; + [self.bubble addSubview:self.hotcolTempLabe]; + + + }else{ + //kScreenSize.width - 2 * kPlace - 200 + self.temperature.frame = CGRectMake(10, 80, kScreenSize.width - 2 * kPlace - 100,70); + self.temperature.font = [UIFont fontWithName:@"Avenir Next Condensed" size:60]; + + self.bubble.frame = CGRectMake((kScreenSize.width -(kScreenSize.width - 3 * kPlace ))/2, kPlace + 80 , kScreenSize.width - 3 * kPlace, kScreenSize.width - 3 * kPlace); + + self.dulabel.frame = CGRectMake((kScreenSize.width - 2 * kPlace)/3*2 -30 , 90 ,50, 60); + self.dulabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:40]; + self.animView.frame= CGRectMake(0, kPlace + 40 + (kScreenSize.width - 2 * kPlace) -animViewHeight/2 - 15, kScreenSize.width, animViewHeight); + + CGFloat bubH=kScreenSize.width - 3 * kPlace; + self.notOnLineLabel.frame = CGRectMake(0,bubH/2-15, bubH, 30); + self.notOnLineLabel .font = [UIFont fontWithName:@"Avenir Next Condensed" size:20]; + + self.hotcolLabe = [[UILabel alloc] init]; + self.hotcolLabe.frame = CGRectMake(0, CGRectGetMaxY(self.temperature.frame) + 10, self.bubble.frame.size.width, 15); + //self.hotcolLabe.textColor = JWUIColorFromRGB(fc6638); + self.hotcolLabe.textAlignment = NSTextAlignmentCenter; + self.hotcolLabe.font =[UIFont systemFontOfSize:13]; + [self.bubble addSubview:self.hotcolLabe]; + + self.hotcolTempLabe = [[UILabel alloc] init]; + self.hotcolTempLabe.frame = CGRectMake(0, CGRectGetMaxY(self.hotcolLabe.frame) + 5, self.bubble.frame.size.width, 15); + self.hotcolTempLabe.font =[UIFont systemFontOfSize:14]; + self.hotcolTempLabe.textAlignment = NSTextAlignmentCenter; + self.hotcolTempLabe.textColor = JWUIColorFromRGB(0x666666); + self.hotcolTempLabe.text = @"温度"; + [self.bubble addSubview:self.hotcolTempLabe]; + } + + [self initCHNames]; +} + + +#pragma mark - 控制按钮事件 + +-(void)controlBtnCilck:(UIButton *)btn{ + + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + if (backmodel) { + + + }else{ + [self.indicatorView stopAnimating]; + [self deviceNotOnlineState]; + [self showLableAction:@"设备已离线"]; + return; + } + + NSString *lightSate; + if (btn.selected) { + lightSate=@"00"; + btn.selected=NO; + + }else { + lightSate=@"01"; + btn.selected=YES; + } + + switch (btn.tag) { + + case RUNSUN_CH1: + { + btn.userInteractionEnabled=YES; + [btn setImage:[UIImage imageNamed:@"PFLight1_on.png"] forState:UIControlStateSelected]; + [self sendOffOnLinghtCommend:@"01" liaghtState:lightSate]; + + } + break; + + case RUNSUN_CH2: + { + btn.userInteractionEnabled=YES; + [btn setImage:[UIImage imageNamed:@"PFLight1_on.png"] forState:UIControlStateSelected]; + [self sendOffOnLinghtCommend:@"02" liaghtState:lightSate]; + } + break; + case RUNSUN_CH3: + { + btn.userInteractionEnabled=YES; + [btn setImage:[UIImage imageNamed:@"PFkilLlight_on.png"] forState:UIControlStateSelected]; + [self sendOffOnLinghtCommend:@"03" liaghtState:lightSate]; + } + break; + case RUNSUN_CH4: + { + btn.userInteractionEnabled=YES; + [btn setImage:[UIImage imageNamed:@"O2_on.png"] forState:UIControlStateSelected]; + [self sendOffOnLinghtCommend:@"04" liaghtState:lightSate]; + } + break; + case RUNSUN_JARE: + { + if (backmodel) { + _wenduPicview=[[HaveHotCoolWenDuPicview alloc] init]; + _wenduPicview.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height); + [_wenduPicview.sureBtn addTarget:self action:@selector(sureBtnClick:) forControlEvents:UIControlEventTouchUpInside]; + + [self.view.window addSubview:_wenduPicview]; + _wenduPicview.wenDuPicviewDelegate = self; + NSString *stateStr =nil; + if ([backmodel.heatStickState isKindOfClass:[NSNull class]]||!backmodel.heatStickState) { + backmodel.heatStickState = @"00"; + } + stateStr = [backmodel.heatStickState substringWithRange:NSMakeRange(0, 2)]; + [_wenduPicview initCateBtnSate:stateStr]; + + [self ruSunJiaReMianQue]; + + }else{ + + [self showLableAction:@"设备已离线"]; + } + + } + break; + default: + break; + } + +} + +#pragma mark - 发送开关灯指令 +-(void)sendOffOnLinghtCommend:(NSString *)linghtNumber liaghtState:(NSString *)state +{ + //此款设备无运行模式 + RuSunLightOrder*lightOrder=[[RuSunLightOrder alloc]init]; + lightOrder.sendmacId = self.currentDevice.macAddress; + lightOrder.resavemacId = self.currentDevice.macAddress; + NSString*switchString1=lightOrder.description; + lightOrder.switchBtn = state; + lightOrder.crc16Str=@"0000"; + lightOrder.lightNumber=linghtNumber; + NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightOrder.lightNumber,lightOrder.switchBtn,lightOrder.crc16Str]; + NSData*manulData=[dataContorl stringToHexData:switchString2]; + [ [Socketsingleton sharedInstance] soketWriteData:manulData]; + if ([Socketsingleton sharedInstance].clientSocket.isConnected) { + //soket 未断开时显示 + [self initHUD]; + [self.myhud myhudstart]; + } + +} + +#pragma mark -发送柜灯指令 +-(void)sendGuiDengCommend:(NSString *)lightSate +{ + + + RuSunGuiDeng*guidengModel=[[RuSunGuiDeng alloc]init]; + guidengModel.resavemacId = self.currentDevice.macAddress; + guidengModel.sendmacId = self.currentDevice.macAddress; + guidengModel.crc16Str=@"0000"; + guidengModel.onOff=lightSate; + + NSString* guidengOrder=[NSString stringWithFormat:@"%@%@%@",guidengModel.description,guidengModel.onOff,guidengModel.crc16Str]; + NSData*guidengData=[dataContorl stringToHexData:guidengOrder]; + [[Socketsingleton sharedInstance] soketWriteData:guidengData]; + + if ([Socketsingleton sharedInstance].clientSocket.isConnected) { + //soket 未断开时显示 + [self initHUD]; + [self.myhud myhudstart]; + } +} + +#pragma mark -加热制冷温度选择 + +-(void)sureBtnClick:(UIButton *)btn{ + + NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString); + if (_wenduPicview.picViewResultString ==nil) { + + [_wenduPicview removeFromSuperview]; + + }else{ + + JiaReWenDuModel *model=[[JiaReWenDuModel alloc] init]; + model.resavemacId = self.currentDevice.macAddress; + model.sendmacId = self.currentDevice.macAddress; + int intlowString = [_wenduPicview.picViewResultString intValue]; + int newIntlowString=intlowString*10; + + NSLog(@"%d******** newIntlowString",newIntlowString); + // 转四位16进制 + model.JiaReWenDu=[dataContorl tpIntStringToFourHex:newIntlowString]; + model.crc16Code =@"0000"; + + NSString * hexstring=[NSString stringWithFormat:@"%@%@%@",model.description,model.JiaReWenDu,model.crc16Code]; + NSData*data=[dataContorl stringToHexData:hexstring]; + + [ [Socketsingleton sharedInstance] soketWriteData:data]; + } + + [_wenduPicview removeFromSuperview]; + +} + +-(void)ruSunJiaReMianQue +{ + RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey]; + UInt64 mac=[dataContorl hexToTen:backmodel.heatTemperature]; + NSLog(@"%llu",mac); + float TPlabel=mac/10; + int temp= (int)(TPlabel+0.5); + NSString *stringFloat = [NSString stringWithFormat:@"%d",temp]; + NSLog(@"%@",stringFloat); + NSArray*wenDuArr=[_wenduPicview.picArr objectAtIndex:0]; + + dispatch_async(_ruSunMainQueue, ^{ + for (NSInteger i=0; iZ7nAUhorh&P+VzK->lh7mM&X< a@X+L+0`iQ9H&2%;V4c{YzL{O&FFOF}TO + +@interface CustomModeSetCell : UITableViewCell + +@property (weak, nonatomic) IBOutlet UILabel *customModeTitleLbl; + +@property (weak, nonatomic) IBOutlet UIButton *switchControl; + +@end diff --git a/Ifish/views/setViewCell/CustomModeSetCell.m b/Ifish/views/setViewCell/CustomModeSetCell.m new file mode 100644 index 0000000..dab1c88 --- /dev/null +++ b/Ifish/views/setViewCell/CustomModeSetCell.m @@ -0,0 +1,33 @@ +// +// CustomModeSetCell.m +// Ifish +// +// Created by Minghao Xue on 2018/4/22. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "CustomModeSetCell.h" + +@implementation CustomModeSetCell + +- (void)awakeFromNib { + // Initialization code + self.backgroundView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"set_cellBack"]]; + UIView *clearView=[[UIView alloc] init]; + clearView.backgroundColor=[UIColor clearColor]; + clearView.frame=self.bounds; + + self.customModeTitleLbl.font = [UIFont systemFontOfSize:15]; + [self.customModeTitleLbl sizeToFit]; + + [self setSelectedBackgroundView:clearView]; + +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/Ifish/views/setViewCell/CustomModeSetCell.xib b/Ifish/views/setViewCell/CustomModeSetCell.xib new file mode 100644 index 0000000..ec28fbb --- /dev/null +++ b/Ifish/views/setViewCell/CustomModeSetCell.xib @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ifish/views/setViewCell/TemperatureSetCell.xib b/Ifish/views/setViewCell/TemperatureSetCell.xib index 6dfcc7c..e5e9bf1 100644 --- a/Ifish/views/setViewCell/TemperatureSetCell.xib +++ b/Ifish/views/setViewCell/TemperatureSetCell.xib @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -12,32 +16,32 @@ - +